Another set of refactoring
diff --git a/apps/ndn-app.cc b/apps/ndn-app.cc
index 54ea5c6..ab119d1 100644
--- a/apps/ndn-app.cc
+++ b/apps/ndn-app.cc
@@ -25,57 +25,57 @@
#include "ns3/ndn-interest-header.h"
#include "ns3/ndn-content-object-header.h"
-#include "ns3/ndn.h"
+#include "ns3/ndn-l3-protocol.h"
#include "ns3/ndn-fib.h"
#include "ns3/ndn-app-face.h"
#include "ns3/ndn-forwarding-strategy.h"
-NS_LOG_COMPONENT_DEFINE ("NdnApp");
+NS_LOG_COMPONENT_DEFINE ("ndn.App");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnApp);
+NS_OBJECT_ENSURE_REGISTERED (App);
TypeId
-NdnApp::GetTypeId (void)
+App::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnApp")
+ static TypeId tid = TypeId ("ns3::ndn::App")
.SetGroupName ("Ndn")
.SetParent<Application> ()
- .AddConstructor<NdnApp> ()
+ .AddConstructor<App> ()
.AddTraceSource ("ReceivedInterests", "ReceivedInterests",
- MakeTraceSourceAccessor (&NdnApp::m_receivedInterests))
+ MakeTraceSourceAccessor (&App::m_receivedInterests))
.AddTraceSource ("ReceivedNacks", "ReceivedNacks",
- MakeTraceSourceAccessor (&NdnApp::m_receivedNacks))
+ MakeTraceSourceAccessor (&App::m_receivedNacks))
.AddTraceSource ("ReceivedContentObjects", "ReceivedContentObjects",
- MakeTraceSourceAccessor (&NdnApp::m_receivedContentObjects))
+ MakeTraceSourceAccessor (&App::m_receivedContentObjects))
.AddTraceSource ("TransmittedInterests", "TransmittedInterests",
- MakeTraceSourceAccessor (&NdnApp::m_transmittedInterests))
+ MakeTraceSourceAccessor (&App::m_transmittedInterests))
.AddTraceSource ("TransmittedContentObjects", "TransmittedContentObjects",
- MakeTraceSourceAccessor (&NdnApp::m_transmittedContentObjects))
+ MakeTraceSourceAccessor (&App::m_transmittedContentObjects))
;
return tid;
}
-NdnApp::NdnApp ()
+App::App ()
: m_protocolHandler (0)
, m_active (false)
, m_face (0)
{
}
-NdnApp::~NdnApp ()
+App::~App ()
{
}
void
-NdnApp::DoDispose (void)
+App::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -86,27 +86,27 @@
}
void
-NdnApp::RegisterProtocolHandler (ProtocolHandler handler)
+App::RegisterProtocolHandler (ProtocolHandler handler)
{
m_protocolHandler = handler;
}
void
-NdnApp::OnInterest (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet)
+App::OnInterest (const Ptr<const InterestHeader> &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)
+App::OnNack (const Ptr<const InterestHeader> &interest, Ptr<Packet> packet)
{
NS_LOG_FUNCTION (this << interest);
m_receivedNacks (interest, this, m_face);
}
void
-NdnApp::OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+App::OnContentObject (const Ptr<const ContentObjectHeader> &contentObject,
Ptr<Packet> payload)
{
NS_LOG_FUNCTION (this << contentObject << payload);
@@ -115,34 +115,34 @@
// Application Methods
void
-NdnApp::StartApplication () // Called at time specified by Start
+App::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,
+ NS_ASSERT_MSG (GetNode ()->GetObject<L3Protocol> () != 0,
"Ndn stack should be installed on the node " << GetNode ());
// step 1. Create a face
- m_face = CreateObject<NdnAppFace> (/*Ptr<NdnApp> (this)*/this);
+ m_face = CreateObject<AppFace> (/*Ptr<App> (this)*/this);
// step 2. Add face to the Ndn stack
- GetNode ()->GetObject<Ndn> ()->AddFace (m_face);
+ GetNode ()->GetObject<L3Protocol> ()->AddFace (m_face);
// step 3. Enable face
m_face->SetUp (true);
}
void
-NdnApp::StopApplication () // Called at time specified by Stop
+App::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);
+ NS_ASSERT (GetNode ()->GetObject<L3Protocol> () != 0);
m_active = false;
@@ -150,9 +150,9 @@
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
+ GetNode ()->GetObject<L3Protocol> ()->RemoveFace (m_face);
+ GetNode ()->GetObject<Fib> ()->RemoveFromAll (m_face);
+ GetNode ()->GetObject<ForwardingStrategy> ()->RemoveFace (m_face); // notify that face is removed
// step 3. Destroy face
NS_ASSERT_MSG (m_face->GetReferenceCount ()==1,
@@ -161,4 +161,5 @@
m_face = 0;
}
-}
+} // namespace ndn
+} // namespace ns3
diff --git a/apps/ndn-app.h b/apps/ndn-app.h
index c152ff2..f61d54b 100644
--- a/apps/ndn-app.h
+++ b/apps/ndn-app.h
@@ -26,25 +26,27 @@
#include "ns3/callback.h"
#include "ns3/traced-callback.h"
-namespace ns3
-{
+namespace ns3 {
class Packet;
-class NdnInterestHeader;
-class NdnContentObjectHeader;
-class NdnFace;
+
+namespace ndn {
+
+class InterestHeader;
+class ContentObjectHeader;
+class Face;
/**
* @ingroup ndn
- * @brief Base class that all Ndn applications should be derived from.
+ * @brief Base class that all NDN applications should be derived from.
*
* The class implements virtual calls onInterest, onNack, and onContentObject
*/
-class NdnApp: public Application
+class App: public Application
{
public:
/**
- * @brief A callback to pass packets to underlying Ndn protocol
+ * @brief A callback to pass packets to underlying NDN protocol
*/
typedef Callback<bool, const Ptr<const Packet>&> ProtocolHandler;
@@ -53,8 +55,8 @@
/**
* @brief Default constructor
*/
- NdnApp ();
- virtual ~NdnApp ();
+ App ();
+ virtual ~App ();
/**
* @brief Register lower layer callback (to send interests from the application)
@@ -69,14 +71,14 @@
* may be useful to get packet tags
*/
virtual void
- OnInterest (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet);
+ OnInterest (const Ptr<const InterestHeader> &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 NdnInterestHeader> &interest, Ptr<Packet> packet);
+ OnNack (const Ptr<const InterestHeader> &interest, Ptr<Packet> packet);
/**
* @brief Method that will be called every time new ContentObject arrives
@@ -84,7 +86,7 @@
* @param payload payload (potentially virtual) of the ContentObject packet (may include packet tags of original packet)
*/
virtual void
- OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+ OnContentObject (const Ptr<const ContentObjectHeader> &contentObject,
Ptr<Packet> payload);
protected:
@@ -102,27 +104,28 @@
StopApplication (); ///< @brief Called at time specified by Stop
protected:
- ProtocolHandler m_protocolHandler; ///< @brief A callback to pass packets to underlying Ndn 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<NdnFace> m_face; ///< @brief automatically created application face through which application communicates
+ Ptr<Face> m_face; ///< @brief automatically created application face through which application communicates
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<NdnApp>, Ptr<NdnFace> > m_receivedInterests; ///< @brief App-level trace of received Interests
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<App>, Ptr<Face> > m_receivedInterests; ///< @brief App-level trace of received Interests
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<NdnApp>, Ptr<NdnFace> > m_receivedNacks; ///< @brief App-level trace of received NACKs
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<App>, Ptr<Face> > m_receivedNacks; ///< @brief App-level trace of received NACKs
- TracedCallback<Ptr<const NdnContentObjectHeader>, Ptr<const Packet>,
- Ptr<NdnApp>, Ptr<NdnFace> > m_receivedContentObjects; ///< @brief App-level trace of received Data
+ TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
+ Ptr<App>, Ptr<Face> > m_receivedContentObjects; ///< @brief App-level trace of received Data
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<NdnApp>, Ptr<NdnFace> > m_transmittedInterests; ///< @brief App-level trace of transmitted Interests
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<App>, Ptr<Face> > m_transmittedInterests; ///< @brief App-level trace of transmitted Interests
- TracedCallback<Ptr<const NdnContentObjectHeader>, Ptr<const Packet>,
- Ptr<NdnApp>, Ptr<NdnFace> > m_transmittedContentObjects; ///< @brief App-level trace of transmitted Data
+ TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
+ Ptr<App>, Ptr<Face> > m_transmittedContentObjects; ///< @brief App-level trace of transmitted Data
};
+} // namespace ndn
} // namespace ns3
#endif // NDN_APP_H
diff --git a/apps/ndn-consumer-batches.cc b/apps/ndn-consumer-batches.cc
index c7de149..e66b741 100644
--- a/apps/ndn-consumer-batches.cc
+++ b/apps/ndn-consumer-batches.cc
@@ -29,47 +29,47 @@
#include "ns3/double.h"
#include "ns3/batches.h"
-NS_LOG_COMPONENT_DEFINE ("NdnConsumerBatches");
+NS_LOG_COMPONENT_DEFINE ("ndn.ConsumerBatches");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnConsumerBatches);
+NS_OBJECT_ENSURE_REGISTERED (ConsumerBatches);
TypeId
-NdnConsumerBatches::GetTypeId (void)
+ConsumerBatches::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnConsumerBatches")
+ static TypeId tid = TypeId ("ns3::ndn::ConsumerBatches")
.SetGroupName ("Ndn")
- .SetParent<NdnConsumer> ()
- .AddConstructor<NdnConsumerBatches> ()
+ .SetParent<Consumer> ()
+ .AddConstructor<ConsumerBatches> ()
.AddAttribute ("Batches", "Batches to schedule. Should be vector, containing pairs of time and amount",
// TypeId::ATTR_SET,
StringValue (""),
- MakeBatchesAccessor (&NdnConsumerBatches::GetBatch, &NdnConsumerBatches::SetBatch),
+ MakeBatchesAccessor (&ConsumerBatches::GetBatch, &ConsumerBatches::SetBatch),
MakeBatchesChecker ())
;
return tid;
}
-NdnConsumerBatches::NdnConsumerBatches ()
+ConsumerBatches::ConsumerBatches ()
{
}
void
-NdnConsumerBatches::SetBatch (const Batches &batches)
+ConsumerBatches::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> (), &NdnConsumerBatches::AddBatch, this, i->get<1> ());
+ Simulator::Schedule (i->get<0> (), &ConsumerBatches::AddBatch, this, i->get<1> ());
}
}
void
-NdnConsumerBatches::AddBatch (uint32_t amount)
+ConsumerBatches::AddBatch (uint32_t amount)
{
// std::cout << Simulator::Now () << " adding batch of " << amount << "\n";
m_seqMax += amount;
@@ -78,14 +78,15 @@
}
void
-NdnConsumerBatches::ScheduleNextPacket ()
+ConsumerBatches::ScheduleNextPacket ()
{
if (!m_sendEvent.IsRunning ())
- m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1), &NdnConsumer::SendPacket, this);
+ m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1), &Consumer::SendPacket, this);
}
///////////////////////////////////////////////////
// Process incoming packets //
///////////////////////////////////////////////////
+} // namespace ndn
} // namespace ns3
diff --git a/apps/ndn-consumer-batches.h b/apps/ndn-consumer-batches.h
index f177551..c7479da 100644
--- a/apps/ndn-consumer-batches.h
+++ b/apps/ndn-consumer-batches.h
@@ -25,14 +25,14 @@
#include "ns3/traced-value.h"
#include "ns3/batches.h"
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
/**
* @ingroup ndn
* \brief Ndn application for sending out Interest packets in batches
*/
-class NdnConsumerBatches: public NdnConsumer
+class ConsumerBatches: public Consumer
{
public:
static TypeId GetTypeId ();
@@ -40,17 +40,17 @@
/**
* \brief Default constructor
*/
- NdnConsumerBatches ();
+ ConsumerBatches ();
- // From NdnApp
+ // From App
// virtual void
- // OnInterest (const Ptr<const NdnInterestHeader> &interest);
+ // OnInterest (const Ptr<const InterestHeader> &interest);
// virtual void
- // OnNack (const Ptr<const NdnInterestHeader> &interest);
+ // OnNack (const Ptr<const InterestHeader> &interest);
// virtual void
- // OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+ // OnContentObject (const Ptr<const ContentObjectHeader> &contentObject,
// const Ptr<const Packet> &payload);
// virtual void
@@ -67,12 +67,13 @@
AddBatch (uint32_t amount);
protected:
/**
- * \brief Constructs the Interest packet and sends it using a callback to the underlying Ndn protocol
+ * \brief Constructs the Interest packet and sends it using a callback to the underlying NDN protocol
*/
virtual void
ScheduleNextPacket ();
};
+} // namespace ndn
} // namespace ns3
#endif
diff --git a/apps/ndn-consumer-cbr.cc b/apps/ndn-consumer-cbr.cc
index ef52ef5..831e06c 100644
--- a/apps/ndn-consumer-cbr.cc
+++ b/apps/ndn-consumer-cbr.cc
@@ -34,35 +34,35 @@
#include "ns3/ndn-interest-header.h"
#include "ns3/ndn-content-object-header.h"
-NS_LOG_COMPONENT_DEFINE ("NdnConsumerCbr");
+NS_LOG_COMPONENT_DEFINE ("ndn.ConsumerCbr");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnConsumerCbr);
+NS_OBJECT_ENSURE_REGISTERED (ConsumerCbr);
TypeId
-NdnConsumerCbr::GetTypeId (void)
+ConsumerCbr::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnConsumerCbr")
+ static TypeId tid = TypeId ("ns3::ndn::ConsumerCbr")
.SetGroupName ("Ndn")
- .SetParent<NdnConsumer> ()
- .AddConstructor<NdnConsumerCbr> ()
+ .SetParent<Consumer> ()
+ .AddConstructor<ConsumerCbr> ()
.AddAttribute ("Frequency", "Frequency of interest packets",
StringValue ("1.0"),
- MakeDoubleAccessor (&NdnConsumerCbr::m_frequency),
+ MakeDoubleAccessor (&ConsumerCbr::m_frequency),
MakeDoubleChecker<double> ())
.AddAttribute ("Randomize", "Type of send time randomization: none (default), uniform, exponential",
StringValue ("none"),
- MakeStringAccessor (&NdnConsumerCbr::SetRandomize, &NdnConsumerCbr::GetRandomize),
+ MakeStringAccessor (&ConsumerCbr::SetRandomize, &ConsumerCbr::GetRandomize),
MakeStringChecker ())
;
return tid;
}
-NdnConsumerCbr::NdnConsumerCbr ()
+ConsumerCbr::ConsumerCbr ()
: m_frequency (1.0)
, m_firstTime (true)
, m_random (0)
@@ -71,14 +71,14 @@
m_seqMax = std::numeric_limits<uint32_t>::max ();
}
-NdnConsumerCbr::~NdnConsumerCbr ()
+ConsumerCbr::~ConsumerCbr ()
{
if (m_random)
delete m_random;
}
void
-NdnConsumerCbr::ScheduleNextPacket ()
+ConsumerCbr::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),
- &NdnConsumer::SendPacket, this);
+ &Consumer::SendPacket, this);
m_firstTime = false;
}
else if (!m_sendEvent.IsRunning ())
@@ -95,11 +95,11 @@
Seconds(1.0 / m_frequency)
:
Seconds(m_random->GetValue ()),
- &NdnConsumer::SendPacket, this);
+ &Consumer::SendPacket, this);
}
void
-NdnConsumerCbr::SetRandomize (const std::string &value)
+ConsumerCbr::SetRandomize (const std::string &value)
{
if (m_random)
delete m_random;
@@ -119,7 +119,7 @@
}
std::string
-NdnConsumerCbr::GetRandomize () const
+ConsumerCbr::GetRandomize () const
{
return m_randomType;
}
@@ -130,16 +130,17 @@
///////////////////////////////////////////////////
// void
-// NdnConsumer::OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+// Consumer::OnContentObject (const Ptr<const ContentObjectHeader> &contentObject,
// const Ptr<const Packet> &payload)
// {
-// NdnConsumer::OnContentObject (contentObject, payload); // tracing inside
+// Consumer::OnContentObject (contentObject, payload); // tracing inside
// }
// void
-// NdnConsumer::OnNack (const Ptr<const NdnInterestHeader> &interest)
+// Consumer::OnNack (const Ptr<const InterestHeader> &interest)
// {
-// NdnConsumer::OnNack (interest); // tracing inside
+// Consumer::OnNack (interest); // tracing inside
// }
+} // namespace ndn
} // namespace ns3
diff --git a/apps/ndn-consumer-cbr.h b/apps/ndn-consumer-cbr.h
index 6916d7a..26fef1d 100644
--- a/apps/ndn-consumer-cbr.h
+++ b/apps/ndn-consumer-cbr.h
@@ -24,14 +24,14 @@
#include "ndn-consumer.h"
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
/**
* @ingroup ndn
* \brief Ndn application for sending out Interest packets at a "constant" rate (Poisson process)
*/
-class NdnConsumerCbr: public NdnConsumer
+class ConsumerCbr: public Consumer
{
public:
static TypeId GetTypeId ();
@@ -40,23 +40,23 @@
* \brief Default constructor
* Sets up randomizer function and packet sequence number
*/
- NdnConsumerCbr ();
- virtual ~NdnConsumerCbr ();
+ ConsumerCbr ();
+ virtual ~ConsumerCbr ();
// From NdnApp
// virtual void
- // OnInterest (const Ptr<const NdnInterestHeader> &interest);
+ // OnInterest (const Ptr<const InterestHeader> &interest);
// virtual void
- // OnNack (const Ptr<const NdnInterestHeader> &interest);
+ // OnNack (const Ptr<const InterestHeader> &interest);
// virtual void
- // OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+ // OnContentObject (const Ptr<const ContentObjectHeader> &contentObject,
// const Ptr<const Packet> &payload);
protected:
/**
- * \brief Constructs the Interest packet and sends it using a callback to the underlying Ndn protocol
+ * \brief Constructs the Interest packet and sends it using a callback to the underlying NDN protocol
*/
virtual void
ScheduleNextPacket ();
@@ -95,6 +95,7 @@
std::string m_randomType;
};
+} // namespace ndn
} // namespace ns3
#endif
diff --git a/apps/ndn-consumer-window.cc b/apps/ndn-consumer-window.cc
index 242456a..86457c8 100644
--- a/apps/ndn-consumer-window.cc
+++ b/apps/ndn-consumer-window.cc
@@ -28,78 +28,78 @@
#include "ns3/uinteger.h"
#include "ns3/double.h"
-NS_LOG_COMPONENT_DEFINE ("NdnConsumerWindow");
+NS_LOG_COMPONENT_DEFINE ("ndn.ConsumerWindow");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnConsumerWindow);
+NS_OBJECT_ENSURE_REGISTERED (ConsumerWindow);
TypeId
-NdnConsumerWindow::GetTypeId (void)
+ConsumerWindow::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnConsumerWindow")
+ static TypeId tid = TypeId ("ns3::ndn::ConsumerWindow")
.SetGroupName ("Ndn")
- .SetParent<NdnConsumer> ()
- .AddConstructor<NdnConsumerWindow> ()
+ .SetParent<Consumer> ()
+ .AddConstructor<ConsumerWindow> ()
.AddAttribute ("Window", "Initial size of the window",
StringValue ("1"),
- MakeUintegerAccessor (&NdnConsumerWindow::GetWindow, &NdnConsumerWindow::SetWindow),
+ MakeUintegerAccessor (&ConsumerWindow::GetWindow, &ConsumerWindow::SetWindow),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("PayloadSize", "Average size of content object size (to calculate interest generation rate)",
UintegerValue (1040),
- MakeUintegerAccessor (&NdnConsumerWindow::GetPayloadSize, &NdnConsumerWindow::SetPayloadSize),
+ MakeUintegerAccessor (&ConsumerWindow::GetPayloadSize, &ConsumerWindow::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 (&NdnConsumerWindow::GetMaxSize, &NdnConsumerWindow::SetMaxSize),
+ MakeDoubleAccessor (&ConsumerWindow::GetMaxSize, &ConsumerWindow::SetMaxSize),
MakeDoubleChecker<double> ())
.AddTraceSource ("WindowTrace",
"Window that controls how many outstanding interests are allowed",
- MakeTraceSourceAccessor (&NdnConsumerWindow::m_window))
+ MakeTraceSourceAccessor (&ConsumerWindow::m_window))
.AddTraceSource ("InFlight",
"Current number of outstanding interests",
- MakeTraceSourceAccessor (&NdnConsumerWindow::m_window))
+ MakeTraceSourceAccessor (&ConsumerWindow::m_window))
;
return tid;
}
-NdnConsumerWindow::NdnConsumerWindow ()
+ConsumerWindow::ConsumerWindow ()
: m_payloadSize (1040)
, m_inFlight (0)
{
}
void
-NdnConsumerWindow::SetWindow (uint32_t window)
+ConsumerWindow::SetWindow (uint32_t window)
{
m_window = window;
}
uint32_t
-NdnConsumerWindow::GetWindow () const
+ConsumerWindow::GetWindow () const
{
return m_window;
}
uint32_t
-NdnConsumerWindow::GetPayloadSize () const
+ConsumerWindow::GetPayloadSize () const
{
return m_payloadSize;
}
void
-NdnConsumerWindow::SetPayloadSize (uint32_t payload)
+ConsumerWindow::SetPayloadSize (uint32_t payload)
{
m_payloadSize = payload;
}
double
-NdnConsumerWindow::GetMaxSize () const
+ConsumerWindow::GetMaxSize () const
{
if (m_seqMax == 0)
return -1.0;
@@ -108,7 +108,7 @@
}
void
-NdnConsumerWindow::SetMaxSize (double size)
+ConsumerWindow::SetMaxSize (double size)
{
m_maxSize = size;
if (m_maxSize < 0)
@@ -124,12 +124,12 @@
void
-NdnConsumerWindow::ScheduleNextPacket ()
+ConsumerWindow::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), &NdnConsumer::SendPacket, this);
+ m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1), &Consumer::SendPacket, this);
return;
}
@@ -137,7 +137,7 @@
if (!m_sendEvent.IsRunning ())
{
m_inFlight++;
- m_sendEvent = Simulator::ScheduleNow (&NdnConsumer::SendPacket, this);
+ m_sendEvent = Simulator::ScheduleNow (&Consumer::SendPacket, this);
}
}
@@ -146,10 +146,10 @@
///////////////////////////////////////////////////
void
-NdnConsumerWindow::OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+ConsumerWindow::OnContentObject (const Ptr<const ContentObjectHeader> &contentObject,
Ptr<Packet> payload)
{
- NdnConsumer::OnContentObject (contentObject, payload);
+ Consumer::OnContentObject (contentObject, payload);
m_window = m_window + 1;
@@ -158,9 +158,9 @@
}
void
-NdnConsumerWindow::OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> payload)
+ConsumerWindow::OnNack (const Ptr<const InterestHeader> &interest, Ptr<Packet> payload)
{
- NdnConsumer::OnNack (interest, payload);
+ Consumer::OnNack (interest, payload);
if (m_inFlight > static_cast<uint32_t> (0)) m_inFlight--;
if (m_window > static_cast<uint32_t> (0))
@@ -171,10 +171,11 @@
}
void
-NdnConsumerWindow::OnTimeout (uint32_t sequenceNumber)
+ConsumerWindow::OnTimeout (uint32_t sequenceNumber)
{
if (m_inFlight > static_cast<uint32_t> (0)) m_inFlight--;
- NdnConsumer::OnTimeout (sequenceNumber);
+ Consumer::OnTimeout (sequenceNumber);
}
+} // namespace ndn
} // namespace ns3
diff --git a/apps/ndn-consumer-window.h b/apps/ndn-consumer-window.h
index 5d9adff..5713c70 100644
--- a/apps/ndn-consumer-window.h
+++ b/apps/ndn-consumer-window.h
@@ -25,8 +25,8 @@
#include "ndn-consumer.h"
#include "ns3/traced-value.h"
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
/**
* @ingroup ndn
@@ -35,7 +35,7 @@
* !!! ATTENTION !!! This is highly experimental and relies on experimental features of the simulator.
* Behavior may be unpredictable if used incorrectly.
*/
-class NdnConsumerWindow: public NdnConsumer
+class ConsumerWindow: public Consumer
{
public:
static TypeId GetTypeId ();
@@ -43,17 +43,17 @@
/**
* \brief Default constructor
*/
- NdnConsumerWindow ();
+ ConsumerWindow ();
- // From NdnApp
+ // From App
// virtual void
- // OnInterest (const Ptr<const NdnInterestHeader> &interest);
+ // OnInterest (const Ptr<const InterestHeader> &interest);
virtual void
- OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> payload);
+ OnNack (const Ptr<const InterestHeader> &interest, Ptr<Packet> payload);
virtual void
- OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+ OnContentObject (const Ptr<const ContentObjectHeader> &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 Ndn protocol
+ * \brief Constructs the Interest packet and sends it using a callback to the underlying NDN protocol
*/
virtual void
ScheduleNextPacket ();
@@ -93,6 +93,7 @@
TracedValue<uint32_t> m_inFlight;
};
+} // namespace ndn
} // namespace ns3
#endif
diff --git a/apps/ndn-consumer.cc b/apps/ndn-consumer.cc
index 6d976fc..dd61f74 100644
--- a/apps/ndn-consumer.cc
+++ b/apps/ndn-consumer.cc
@@ -44,63 +44,63 @@
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnConsumer");
+NS_LOG_COMPONENT_DEFINE ("ndn.Consumer");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnConsumer);
+NS_OBJECT_ENSURE_REGISTERED (Consumer);
TypeId
-NdnConsumer::GetTypeId (void)
+Consumer::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnConsumer")
+ static TypeId tid = TypeId ("ns3::ndn::Consumer")
.SetGroupName ("Ndn")
- .SetParent<NdnApp> ()
+ .SetParent<App> ()
.AddAttribute ("StartSeq", "Initial sequence number",
IntegerValue (0),
- MakeIntegerAccessor(&NdnConsumer::m_seq),
+ MakeIntegerAccessor(&Consumer::m_seq),
MakeIntegerChecker<int32_t>())
- .AddAttribute ("Prefix","NdnName of the Interest",
+ .AddAttribute ("Prefix","Name of the Interest",
StringValue ("/"),
- MakeNdnNameComponentsAccessor (&NdnConsumer::m_interestName),
- MakeNdnNameComponentsChecker ())
+ MakeNameComponentsAccessor (&Consumer::m_interestName),
+ MakeNameComponentsChecker ())
.AddAttribute ("LifeTime", "LifeTime for interest packet",
StringValue ("2s"),
- MakeTimeAccessor (&NdnConsumer::m_interestLifeTime),
+ MakeTimeAccessor (&Consumer::m_interestLifeTime),
MakeTimeChecker ())
.AddAttribute ("MinSuffixComponents", "MinSuffixComponents",
IntegerValue(-1),
- MakeIntegerAccessor(&NdnConsumer::m_minSuffixComponents),
+ MakeIntegerAccessor(&Consumer::m_minSuffixComponents),
MakeIntegerChecker<int32_t>())
.AddAttribute ("MaxSuffixComponents", "MaxSuffixComponents",
IntegerValue(-1),
- MakeIntegerAccessor(&NdnConsumer::m_maxSuffixComponents),
+ MakeIntegerAccessor(&Consumer::m_maxSuffixComponents),
MakeIntegerChecker<int32_t>())
.AddAttribute ("ChildSelector", "ChildSelector",
BooleanValue(false),
- MakeBooleanAccessor(&NdnConsumer::m_childSelector),
+ MakeBooleanAccessor(&Consumer::m_childSelector),
MakeBooleanChecker())
- .AddAttribute ("Exclude", "only simple name matching is supported (use NdnNameComponents)",
- NdnNameComponentsValue (),
- MakeNdnNameComponentsAccessor (&NdnConsumer::m_exclude),
- MakeNdnNameComponentsChecker ())
+ .AddAttribute ("Exclude", "only simple name matching is supported (use NameComponents)",
+ NameComponentsValue (),
+ MakeNameComponentsAccessor (&Consumer::m_exclude),
+ MakeNameComponentsChecker ())
.AddAttribute ("RetxTimer",
"Timeout defining how frequent retransmission timeouts should be checked",
StringValue ("50ms"),
- MakeTimeAccessor (&NdnConsumer::GetRetxTimer, &NdnConsumer::SetRetxTimer),
+ MakeTimeAccessor (&Consumer::GetRetxTimer, &Consumer::SetRetxTimer),
MakeTimeChecker ())
.AddTraceSource ("PathWeightsTrace", "PathWeightsTrace",
- MakeTraceSourceAccessor (&NdnConsumer::m_pathWeightsTrace))
+ MakeTraceSourceAccessor (&Consumer::m_pathWeightsTrace))
;
return tid;
}
-NdnConsumer::NdnConsumer ()
+Consumer::Consumer ()
: m_rand (0, std::numeric_limits<uint32_t>::max ())
, m_seq (0)
, m_seqMax (0) // don't request anything
@@ -111,7 +111,7 @@
}
void
-NdnConsumer::SetRetxTimer (Time retxTimer)
+Consumer::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,
- &NdnConsumer::CheckRetxTimeout, this);
+ &Consumer::CheckRetxTimeout, this);
}
Time
-NdnConsumer::GetRetxTimer () const
+Consumer::GetRetxTimer () const
{
return m_retxTimer;
}
void
-NdnConsumer::CheckRetxTimeout ()
+Consumer::CheckRetxTimeout ()
{
Time now = Simulator::Now ();
@@ -150,23 +150,23 @@
}
m_retxEvent = Simulator::Schedule (m_retxTimer,
- &NdnConsumer::CheckRetxTimeout, this);
+ &Consumer::CheckRetxTimeout, this);
}
// Application Methods
void
-NdnConsumer::StartApplication () // Called at time specified by Start
+Consumer::StartApplication () // Called at time specified by Start
{
NS_LOG_FUNCTION_NOARGS ();
// do base stuff
- NdnApp::StartApplication ();
+ App::StartApplication ();
ScheduleNextPacket ();
}
void
-NdnConsumer::StopApplication () // Called at time specified by Stop
+Consumer::StopApplication () // Called at time specified by Stop
{
NS_LOG_FUNCTION_NOARGS ();
@@ -174,11 +174,11 @@
Simulator::Cancel (m_sendEvent);
// cleanup base stuff
- NdnApp::StopApplication ();
+ App::StopApplication ();
}
void
-NdnConsumer::SendPacket ()
+Consumer::SendPacket ()
{
if (!m_active) return;
@@ -220,18 +220,18 @@
// std::cout << Simulator::Now ().ToDouble (Time::S) << "s -> " << seq << "\n";
//
- Ptr<NdnNameComponents> nameWithSequence = Create<NdnNameComponents> (m_interestName);
+ Ptr<NameComponents> nameWithSequence = Create<NameComponents> (m_interestName);
(*nameWithSequence) (seq);
//
- NdnInterestHeader interestHeader;
+ InterestHeader 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<NdnNameComponents> (m_exclude));
+ interestHeader.SetExclude (Create<NameComponents> (m_exclude));
}
interestHeader.SetMaxSuffixComponents (m_maxSuffixComponents);
interestHeader.SetMinSuffixComponents (m_minSuffixComponents);
@@ -261,12 +261,12 @@
void
-NdnConsumer::OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+Consumer::OnContentObject (const Ptr<const ContentObjectHeader> &contentObject,
Ptr<Packet> payload)
{
if (!m_active) return;
- NdnApp::OnContentObject (contentObject, payload); // tracing inside
+ App::OnContentObject (contentObject, payload); // tracing inside
NS_LOG_FUNCTION (this << contentObject << payload);
@@ -300,11 +300,11 @@
}
void
-NdnConsumer::OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> origPacket)
+Consumer::OnNack (const Ptr<const InterestHeader> &interest, Ptr<Packet> origPacket)
{
if (!m_active) return;
- NdnApp::OnNack (interest, origPacket); // tracing inside
+ App::OnNack (interest, origPacket); // tracing inside
NS_LOG_DEBUG ("Nack type: " << interest->GetNack ());
@@ -325,7 +325,7 @@
}
void
-NdnConsumer::OnTimeout (uint32_t sequenceNumber)
+Consumer::OnTimeout (uint32_t sequenceNumber)
{
// std::cout << Simulator::Now () << ", TO: " << sequenceNumber << ", current RTO: " << m_rtt->RetransmitTimeout ().ToDouble (Time::S) << "s\n";
@@ -335,4 +335,5 @@
ScheduleNextPacket ();
}
+} // namespace ndn
} // namespace ns3
diff --git a/apps/ndn-consumer.h b/apps/ndn-consumer.h
index 0bc7f70..3be11c1 100644
--- a/apps/ndn-consumer.h
+++ b/apps/ndn-consumer.h
@@ -37,14 +37,14 @@
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/member.hpp>
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
/**
* @ingroup ndn
- * \brief Ndn application for sending out Interest packets
+ * \brief NDN application for sending out Interest packets
*/
-class NdnConsumer: public NdnApp
+class Consumer: public App
{
public:
static TypeId GetTypeId ();
@@ -53,18 +53,18 @@
* \brief Default constructor
* Sets up randomizer function and packet sequence number
*/
- NdnConsumer ();
- virtual ~NdnConsumer () {};
+ Consumer ();
+ virtual ~Consumer () {};
- // From NdnApp
+ // From App
// virtual void
- // OnInterest (const Ptr<const NdnInterestHeader> &interest);
+ // OnInterest (const Ptr<const InterestHeader> &interest);
virtual void
- OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet);
+ OnNack (const Ptr<const InterestHeader> &interest, Ptr<Packet> packet);
virtual void
- OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+ OnContentObject (const Ptr<const ContentObjectHeader> &contentObject,
Ptr<Packet> payload);
/**
@@ -81,7 +81,7 @@
SendPacket ();
protected:
- // from NdnApp
+ // from App
virtual void
StartApplication ();
@@ -89,7 +89,7 @@
StopApplication ();
/**
- * \brief Constructs the Interest packet and sends it using a callback to the underlying Ndn 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
- NdnNameComponents m_interestName; ///< \brief NdnName of the Interest (use NdnNameComponents)
+ NameComponents m_interestName; ///< \brief NDN Name of the Interest (use NameComponents)
Time m_interestLifeTime; ///< \brief LifeTime for interest packet
- 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
+ int32_t m_minSuffixComponents; ///< \brief MinSuffixComponents. See InterestHeader for more information
+ int32_t m_maxSuffixComponents; ///< \brief MaxSuffixComponents. See InterestHeader for more information
+ bool m_childSelector; ///< \brief ChildSelector. See InterestHeader for more information
+ NameComponents m_exclude; ///< \brief Exclude. See InterestHeader for more information
/// @cond include_hidden
/**
@@ -185,6 +185,7 @@
/// @endcond
};
+} // namespace ndn
} // namespace ns3
#endif
diff --git a/apps/ndn-producer.cc b/apps/ndn-producer.cc
index 541d6d8..0d71101 100644
--- a/apps/ndn-producer.cc
+++ b/apps/ndn-producer.cc
@@ -37,89 +37,89 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnProducer");
+NS_LOG_COMPONENT_DEFINE ("ndn.Producer");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnProducer);
+NS_OBJECT_ENSURE_REGISTERED (Producer);
TypeId
-NdnProducer::GetTypeId (void)
+Producer::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnProducer")
+ static TypeId tid = TypeId ("ns3::ndn::Producer")
.SetGroupName ("Ndn")
- .SetParent<NdnApp> ()
- .AddConstructor<NdnProducer> ()
+ .SetParent<App> ()
+ .AddConstructor<Producer> ()
.AddAttribute ("Prefix","Prefix, for which producer has the data",
StringValue ("/"),
- MakeNdnNameComponentsAccessor (&NdnProducer::m_prefix),
- MakeNdnNameComponentsChecker ())
+ MakeNameComponentsAccessor (&Producer::m_prefix),
+ MakeNameComponentsChecker ())
.AddAttribute ("PayloadSize", "Virtual payload size for Content packets",
UintegerValue (1024),
- MakeUintegerAccessor(&NdnProducer::m_virtualPayloadSize),
+ MakeUintegerAccessor(&Producer::m_virtualPayloadSize),
MakeUintegerChecker<uint32_t>())
// optional attributes
.AddAttribute ("SignatureBits", "SignatureBits field",
UintegerValue (0),
- MakeUintegerAccessor(&NdnProducer::m_signatureBits),
+ MakeUintegerAccessor(&Producer::m_signatureBits),
MakeUintegerChecker<uint32_t> ())
;
return tid;
}
-NdnProducer::NdnProducer ()
+Producer::Producer ()
{
// NS_LOG_FUNCTION_NOARGS ();
}
// inherited from Application base class.
void
-NdnProducer::StartApplication ()
+Producer::StartApplication ()
{
NS_LOG_FUNCTION_NOARGS ();
- NS_ASSERT (GetNode ()->GetObject<NdnFib> () != 0);
+ NS_ASSERT (GetNode ()->GetObject<Fib> () != 0);
- NdnApp::StartApplication ();
+ App::StartApplication ();
NS_LOG_DEBUG ("NodeID: " << GetNode ()->GetId ());
- Ptr<NdnFib> fib = GetNode ()->GetObject<NdnFib> ();
+ Ptr<Fib> fib = GetNode ()->GetObject<Fib> ();
- Ptr<NdnFibEntry> fibEntry = fib->Add (m_prefix, m_face, 0);
+ Ptr<fib::Entry> fibEntry = fib->Add (m_prefix, m_face, 0);
- fibEntry->UpdateStatus (m_face, NdnFibFaceMetric::NDN_FIB_GREEN);
+ fibEntry->UpdateStatus (m_face, fib::FaceMetric::NDN_FIB_GREEN);
// // make face green, so it will be used primarily
- // StaticCast<NdnFibImpl> (fib)->modify (fibEntry,
- // ll::bind (&NdnFibEntry::UpdateStatus,
- // ll::_1, m_face, NdnFibFaceMetric::NDN_FIB_GREEN));
+ // StaticCast<fib::FibImpl> (fib)->modify (fibEntry,
+ // ll::bind (&fib::Entry::UpdateStatus,
+ // ll::_1, m_face, fib::FaceMetric::NDN_FIB_GREEN));
}
void
-NdnProducer::StopApplication ()
+Producer::StopApplication ()
{
NS_LOG_FUNCTION_NOARGS ();
- NS_ASSERT (GetNode ()->GetObject<NdnFib> () != 0);
+ NS_ASSERT (GetNode ()->GetObject<Fib> () != 0);
- NdnApp::StopApplication ();
+ App::StopApplication ();
}
void
-NdnProducer::OnInterest (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> origPacket)
+Producer::OnInterest (const Ptr<const InterestHeader> &interest, Ptr<Packet> origPacket)
{
- NdnApp::OnInterest (interest, origPacket); // tracing inside
+ App::OnInterest (interest, origPacket); // tracing inside
NS_LOG_FUNCTION (this << interest);
if (!m_active) return;
- static NdnContentObjectTail tail;
- Ptr<NdnContentObjectHeader> header = Create<NdnContentObjectHeader> ();
- header->SetName (Create<NdnNameComponents> (interest->GetName ()));
+ static ContentObjectTail tail;
+ Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
+ header->SetName (Create<NameComponents> (interest->GetName ()));
header->GetSignedInfo ().SetTimestamp (Simulator::Now ());
header->GetSignature ().SetSignatureBits (m_signatureBits);
@@ -147,4 +147,5 @@
m_transmittedContentObjects (header, packet, this, m_face);
}
+} // namespace ndn
} // namespace ns3
diff --git a/apps/ndn-producer.h b/apps/ndn-producer.h
index 4b0e079..e29a31c 100644
--- a/apps/ndn-producer.h
+++ b/apps/ndn-producer.h
@@ -28,8 +28,8 @@
#include "ns3/ndn-name-components.h"
#include "ns3/ndn-content-object-header.h"
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
/**
* @brief A simple Interest-sink applia simple Interest-sink application
@@ -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 NdnProducer : public NdnApp
+class Producer : public App
{
public:
static TypeId
GetTypeId (void);
- NdnProducer ();
+ Producer ();
// inherited from NdnApp
- void OnInterest (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet);
+ void OnInterest (const Ptr<const InterestHeader> &interest, Ptr<Packet> packet);
protected:
// inherited from Application base class.
@@ -59,13 +59,14 @@
StopApplication (); // Called at time specified by Stop
private:
- NdnNameComponents m_prefix;
+ NameComponents m_prefix;
uint32_t m_virtualPayloadSize;
uint32_t m_signatureBits;
- // NdnContentObjectHeader::SignedInfo m_signedInfo;
+ // ContentObjectHeader::SignedInfo m_signedInfo;
};
-}
+} // namespace ndn
+} // namespace ns3
#endif // NDN_PRODUCER_H
diff --git a/docs/source/intro.rst b/docs/source/intro.rst
index 797bf53..68b6dd7 100644
--- a/docs/source/intro.rst
+++ b/docs/source/intro.rst
@@ -69,7 +69,7 @@
Portability
------------
-ndnSIM has been successfully compiled and used under Ubuntu Linux 11.04 (stock gcc), Mac OS 10.6/10.7 (gcc-4.2 apple/llvm, macports gcc 4.6), FreeBSD 8.2 (requires gcc from ports - the stock gcc will not work!).
+ndnSIM has been successfully compiled and used under Ubuntu Linux 12.04 (stock gcc, boost 1.48), Mac OS 10.6/10.7/10.8 (gcc-4.2 apple/llvm, macports gcc 4.6, boost 1.49 or 1.50).
Requirements
-------------
@@ -127,9 +127,11 @@
ndnSIM uses standard NS-3 compilation procedure. For example::
cd <ns-3-folder>
- ./waf configure --enable-examples
+ ./waf configure --enable-examples --enable-ndn-plugins=topology,mobility
./waf
+
+
To run :doc:`sample ndnSIM simulations <examples>`::
./waf --run=ccnx-simple
diff --git a/examples/ndn-grid.cc b/examples/ndn-grid.cc
index d037fda..ace79df 100644
--- a/examples/ndn-grid.cc
+++ b/examples/ndn-grid.cc
@@ -27,7 +27,7 @@
using namespace ns3;
-NS_LOG_COMPONENT_DEFINE ("NdnGrid");
+NS_LOG_COMPONENT_DEFINE ("ndn.Grid");
/**
* This scenario simulates a grid topology (using PointToPointGrid module)
diff --git a/examples/ndn-simple.cc b/examples/ndn-simple.cc
index 84d306b..5a3b6bf 100644
--- a/examples/ndn-simple.cc
+++ b/examples/ndn-simple.cc
@@ -47,7 +47,7 @@
* NS_LOG=NdnSimple:NdnConsumer ./waf --run=ndn-simple
*/
-NS_LOG_COMPONENT_DEFINE ("NdnSimple");
+NS_LOG_COMPONENT_DEFINE ("ndn.Simple");
int
main (int argc, char *argv[])
diff --git a/examples/trie.cc b/examples/trie.cc
index 4766229..2523857 100644
--- a/examples/trie.cc
+++ b/examples/trie.cc
@@ -33,7 +33,7 @@
using namespace ndnSIM;
using namespace boost;
-NS_LOG_COMPONENT_DEFINE ("Trie");
+NS_LOG_COMPONENT_DEFINE ("ndn.Trie");
// class Integer : public ns3::SimpleRefCount<Integer>
// {
@@ -98,21 +98,21 @@
Ptr<Node> node = CreateObject<Node> ();
Names::Add ("TestNode", node);
- Ptr<NdnApp> app = CreateObject<NdnApp> ();
+ Ptr<ndn::App> app = CreateObject<ndn::App> ();
node->AddApplication (app);
- ObjectFactory factory ("ns3::NdnFib");
+ ObjectFactory factory ("ns3::ndn::fib::Default");
- Ptr<NdnFib> fib = factory.Create<NdnFib> ();
+ Ptr<ndn::Fib> fib = factory.Create<ndn::Fib> ();
node->AggregateObject (fib);
- Ptr<NdnFace> face = CreateObject<NdnAppFace> (app);
+ Ptr<ndn::Face> face = CreateObject<ndn::AppFace> (app);
- fib->Add (lexical_cast<NdnNameComponents> ("/bla"), face, 1);
- fib->Add (lexical_cast<NdnNameComponents> ("/bla/1"), face, 1);
- fib->Add (lexical_cast<NdnNameComponents> ("/bla/2"), face, 1);
- fib->Add (lexical_cast<NdnNameComponents> ("/bla/3"), face, 1);
- fib->Add (lexical_cast<NdnNameComponents> ("/bla/1/1"), face, 1);
- fib->Add (lexical_cast<NdnNameComponents> ("/bla/1/2"), face, 1);
+ fib->Add (lexical_cast<ndn::NameComponents> ("/bla"), face, 1);
+ fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1"), face, 1);
+ fib->Add (lexical_cast<ndn::NameComponents> ("/bla/2"), face, 1);
+ fib->Add (lexical_cast<ndn::NameComponents> ("/bla/3"), face, 1);
+ fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1/1"), face, 1);
+ fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1/2"), face, 1);
cout << *fib << endl;
diff --git a/helper/boost-graph-ndn-global-routing-helper.h b/helper/boost-graph-ndn-global-routing-helper.h
index ab619c6..df08c73 100644
--- a/helper/boost-graph-ndn-global-routing-helper.h
+++ b/helper/boost-graph-ndn-global-routing-helper.h
@@ -35,13 +35,12 @@
#include <list>
#include <map>
-namespace boost
-{
+namespace boost {
class NdnGlobalRouterGraph
{
public:
- typedef ns3::Ptr< ns3::NdnGlobalRouter > Vertice;
+ typedef ns3::Ptr< ns3::ndn::GlobalRouter > Vertice;
typedef uint16_t edge_property_type;
typedef uint32_t vertex_property_type;
@@ -49,14 +48,14 @@
{
for (ns3::NodeList::Iterator node = ns3::NodeList::Begin (); node != ns3::NodeList::End (); node++)
{
- ns3::Ptr<ns3::NdnGlobalRouter> gr = (*node)->GetObject<ns3::NdnGlobalRouter> ();
+ ns3::Ptr<ns3::ndn::GlobalRouter> gr = (*node)->GetObject<ns3::ndn::GlobalRouter> ();
if (gr != 0)
m_vertices.push_back (gr);
}
for (ns3::ChannelList::Iterator channel = ns3::ChannelList::Begin (); channel != ns3::ChannelList::End (); channel++)
{
- ns3::Ptr<ns3::NdnGlobalRouter> gr = (*channel)->GetObject<ns3::NdnGlobalRouter> ();
+ ns3::Ptr<ns3::ndn::GlobalRouter> gr = (*channel)->GetObject<ns3::ndn::GlobalRouter> ();
if (gr != 0)
m_vertices.push_back (gr);
}
@@ -85,7 +84,7 @@
{
// Graph concept
typedef NdnGlobalRouterGraph::Vertice vertex_descriptor;
- typedef ns3::NdnGlobalRouter::Incidency edge_descriptor;
+ typedef ns3::ndn::GlobalRouter::Incidency edge_descriptor;
typedef directed_tag directed_category;
typedef disallow_parallel_edge_tag edge_parallel_category;
typedef ndn_global_router_graph_category traversal_category;
@@ -95,7 +94,7 @@
typedef size_t vertices_size_type;
// AdjacencyGraph concept
- typedef ns3::NdnGlobalRouter::IncidencyList::iterator out_edge_iterator;
+ typedef ns3::ndn::GlobalRouter::IncidencyList::iterator out_edge_iterator;
typedef size_t degree_size_type;
// typedef size_t edges_size_type;
@@ -206,9 +205,9 @@
struct property_traits< EdgeWeights >
{
// Metric property map
- typedef tuple< ns3::Ptr<ns3::NdnFace>, uint16_t > value_type;
- typedef tuple< ns3::Ptr<ns3::NdnFace>, uint16_t > reference;
- typedef ns3::NdnGlobalRouter::Incidency key_type;
+ typedef tuple< ns3::Ptr<ns3::ndn::Face>, uint16_t > value_type;
+ typedef tuple< ns3::Ptr<ns3::ndn::Face>, uint16_t > reference;
+ typedef ns3::ndn::GlobalRouter::Incidency key_type;
typedef readable_property_map_tag category;
};
@@ -254,8 +253,8 @@
return a + b.get<1> ();
}
- tuple< ns3::Ptr<ns3::NdnFace>, uint32_t >
- operator () (tuple< ns3::Ptr<ns3::NdnFace>, uint32_t > a,
+ tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t >
+ operator () (tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t > a,
property_traits< EdgeWeights >::reference b) const
{
if (a.get<0> () == 0)
@@ -271,7 +270,7 @@
// Metric property map
typedef uint32_t value_type;
typedef uint32_t reference;
- typedef ns3::Ptr< ns3::NdnGlobalRouter > key_type;
+ typedef ns3::Ptr< ns3::ndn::GlobalRouter > key_type;
typedef readable_property_map_tag category;
};
@@ -300,16 +299,16 @@
}
// void
-// put (cref< std::map< ns3::Ptr<ns3::NdnGlobalRouter>, ns3::Ptr<ns3::NdnGlobalRouter> > > map,
+// put (cref< std::map< ns3::Ptr<ns3::ndn::GlobalRouter>, ns3::Ptr<ns3::ndn::GlobalRouter> > > map,
uint32_t
-get (const boost::VertexIds&, ns3::Ptr<ns3::NdnGlobalRouter> &gr)
+get (const boost::VertexIds&, ns3::Ptr<ns3::ndn::GlobalRouter> &gr)
{
return gr->GetId ();
}
inline property_traits< EdgeWeights >::reference
-get(const boost::EdgeWeights&, ns3::NdnGlobalRouter::Incidency &edge)
+get(const boost::EdgeWeights&, ns3::ndn::GlobalRouter::Incidency &edge)
{
if (edge.get<1> () == 0)
return property_traits< EdgeWeights >::reference (0, 0);
@@ -318,7 +317,7 @@
}
struct PredecessorsMap :
- public std::map< ns3::Ptr< ns3::NdnGlobalRouter >, ns3::Ptr< ns3::NdnGlobalRouter > >
+ public std::map< ns3::Ptr< ns3::ndn::GlobalRouter >, ns3::Ptr< ns3::ndn::GlobalRouter > >
{
};
@@ -326,15 +325,15 @@
struct property_traits< reference_wrapper<PredecessorsMap> >
{
// Metric property map
- typedef ns3::Ptr< ns3::NdnGlobalRouter > value_type;
- typedef ns3::Ptr< ns3::NdnGlobalRouter > reference;
- typedef ns3::Ptr< ns3::NdnGlobalRouter > key_type;
+ typedef ns3::Ptr< ns3::ndn::GlobalRouter > value_type;
+ typedef ns3::Ptr< ns3::ndn::GlobalRouter > reference;
+ typedef ns3::Ptr< ns3::ndn::GlobalRouter > key_type;
typedef read_write_property_map_tag category;
};
struct DistancesMap :
- public std::map< ns3::Ptr< ns3::NdnGlobalRouter >, tuple< ns3::Ptr<ns3::NdnFace>, uint32_t > >
+ public std::map< ns3::Ptr< ns3::ndn::GlobalRouter >, tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t > >
{
};
@@ -342,18 +341,18 @@
struct property_traits< reference_wrapper<DistancesMap> >
{
// Metric property map
- typedef tuple< ns3::Ptr<ns3::NdnFace>, uint32_t > value_type;
- typedef tuple< ns3::Ptr<ns3::NdnFace>, uint32_t > reference;
- typedef ns3::Ptr< ns3::NdnGlobalRouter > key_type;
+ typedef tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t > value_type;
+ typedef tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t > reference;
+ typedef ns3::Ptr< ns3::ndn::GlobalRouter > key_type;
typedef read_write_property_map_tag category;
};
-inline tuple< ns3::Ptr<ns3::NdnFace>, uint32_t >
-get (DistancesMap &map, ns3::Ptr<ns3::NdnGlobalRouter> key)
+inline tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t >
+get (DistancesMap &map, ns3::Ptr<ns3::ndn::GlobalRouter> key)
{
boost::DistancesMap::iterator i = map.find (key);
if (i == map.end ())
- return tuple< ns3::Ptr<ns3::NdnFace>, uint32_t > (0, std::numeric_limits<uint32_t>::max ());
+ return tuple< ns3::Ptr<ns3::ndn::Face>, uint32_t > (0, std::numeric_limits<uint32_t>::max ());
else
return i->second;
}
diff --git a/helper/ccnb-parser/ccnb-parser-common.h b/helper/ccnb-parser/common.h
similarity index 97%
rename from helper/ccnb-parser/ccnb-parser-common.h
rename to helper/ccnb-parser/common.h
index 528bcb0..260ae74 100644
--- a/helper/ccnb-parser/ccnb-parser-common.h
+++ b/helper/ccnb-parser/common.h
@@ -22,13 +22,14 @@
#define _CCNB_PARSER_COMMON_H_
namespace ns3 {
+namespace ndn {
/**
- * \ingroup ccnx
- * \defgroup ccnx-ccnb CCNB decoding routines
+ * \ingroup ndn
+ * \defgroup ndn-ccnb CCNB decoding routines
*/
/**
- * \ingroup ccnx-ccnb
+ * \ingroup ndn-ccnb
* \brief Namespace for ccnb parer
*/
namespace CcnbParser {
@@ -174,6 +175,7 @@
};
} // namespace CcnxParser
+} // namespace ndn
} // namespace ns3
#endif // _CCNB_PARSER_COMMON_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-attr.cc b/helper/ccnb-parser/syntax-tree/attr.cc
similarity index 95%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-attr.cc
rename to helper/ccnb-parser/syntax-tree/attr.cc
index bdc1f0a..fda4c77 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-attr.cc
+++ b/helper/ccnb-parser/syntax-tree/attr.cc
@@ -18,10 +18,11 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-attr.h"
-#include "../ccnb-parser-common.h"
+#include "attr.h"
+#include "../common.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
// length length in octets of UTF-8 encoding of tag name - 1 (minimum tag name length is 1)
@@ -42,3 +43,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-attr.h b/helper/ccnb-parser/syntax-tree/attr.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-attr.h
rename to helper/ccnb-parser/syntax-tree/attr.h
index 1b7d5e8..6238aee 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-attr.h
+++ b/helper/ccnb-parser/syntax-tree/attr.h
@@ -21,10 +21,11 @@
#ifndef _CCNB_PARSER_ATTR_H_
#define _CCNB_PARSER_ATTR_H_
-#include "ccnb-parser-base-attr.h"
+#include "base-attr.h"
#include <string>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -56,5 +57,6 @@
}
}
+}
#endif // _CCNB_PARSER_ATTR_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-base-attr.h b/helper/ccnb-parser/syntax-tree/base-attr.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-base-attr.h
rename to helper/ccnb-parser/syntax-tree/base-attr.h
index 9b20073..d6890a1 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-base-attr.h
+++ b/helper/ccnb-parser/syntax-tree/base-attr.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_BASE_ATTR_H_
#define _CCNB_PARSER_BASE_ATTR_H_
-#include "ccnb-parser-udata.h"
+#include "udata.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -41,5 +42,6 @@
}
}
+}
#endif // _CCNB_PARSER_BASE_ATTR_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-base-tag.h b/helper/ccnb-parser/syntax-tree/base-tag.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-base-tag.h
rename to helper/ccnb-parser/syntax-tree/base-tag.h
index 15310a5..403dcb4 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-base-tag.h
+++ b/helper/ccnb-parser/syntax-tree/base-tag.h
@@ -21,10 +21,11 @@
#ifndef _CCNB_PARSER_BASE_TAG_H_
#define _CCNB_PARSER_BASE_TAG_H_
-#include "ccnb-parser-block.h"
+#include "block.h"
#include <list>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -49,6 +50,7 @@
}
}
+}
#endif // _CCNB_PARSER_BASE_TAG_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-blob.cc b/helper/ccnb-parser/syntax-tree/blob.cc
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-blob.cc
rename to helper/ccnb-parser/syntax-tree/blob.cc
index 159643f..6df6012 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-blob.cc
+++ b/helper/ccnb-parser/syntax-tree/blob.cc
@@ -18,9 +18,10 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-blob.h"
+#include "blob.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
Blob::Blob (Buffer::Iterator &start, uint32_t length)
@@ -47,3 +48,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-blob.h b/helper/ccnb-parser/syntax-tree/blob.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-blob.h
rename to helper/ccnb-parser/syntax-tree/blob.h
index 195c84c..1745b1d 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-blob.h
+++ b/helper/ccnb-parser/syntax-tree/blob.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_BLOB_H_
#define _CCNB_PARSER_BLOB_H_
-#include "ccnb-parser-block.h"
+#include "block.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -57,5 +58,6 @@
}
}
+}
#endif // _CCNB_PARSER_BLOB_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc b/helper/ccnb-parser/syntax-tree/block.cc
similarity index 89%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc
rename to helper/ccnb-parser/syntax-tree/block.cc
index 805582a..0d425dd 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc
+++ b/helper/ccnb-parser/syntax-tree/block.cc
@@ -18,21 +18,22 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-block.h"
+#include "block.h"
-#include "ccnb-parser-blob.h"
-#include "ccnb-parser-udata.h"
-#include "ccnb-parser-tag.h"
-#include "ccnb-parser-dtag.h"
-#include "ccnb-parser-attr.h"
-#include "ccnb-parser-dattr.h"
-#include "ccnb-parser-ext.h"
+#include "blob.h"
+#include "udata.h"
+#include "tag.h"
+#include "dtag.h"
+#include "attr.h"
+#include "dattr.h"
+#include "ext.h"
#include "ns3/log.h"
-NS_LOG_COMPONENT_DEFINE ("CcnbParserBlock");
+NS_LOG_COMPONENT_DEFINE ("ndn.CcnbParser.Block");
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/// @cond include_hidden
@@ -95,3 +96,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.h b/helper/ccnb-parser/syntax-tree/block.h
similarity index 91%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-block.h
rename to helper/ccnb-parser/syntax-tree/block.h
index 6ea5fba..23604f5 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.h
+++ b/helper/ccnb-parser/syntax-tree/block.h
@@ -26,12 +26,13 @@
#include "ns3/ptr.h"
// visitors
-#include "../visitors/ccnb-parser-void-no-argu-visitor.h"
-#include "../visitors/ccnb-parser-void-visitor.h"
-#include "../visitors/ccnb-parser-no-argu-visitor.h"
-#include "../visitors/ccnb-parser-visitor.h"
+#include "../visitors/void-no-argu-visitor.h"
+#include "../visitors/void-visitor.h"
+#include "../visitors/no-argu-visitor.h"
+#include "../visitors/visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -81,5 +82,6 @@
}
}
+}
#endif // _CCNB_PARSER_BLOCK_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-dattr.cc b/helper/ccnb-parser/syntax-tree/dattr.cc
similarity index 96%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-dattr.cc
rename to helper/ccnb-parser/syntax-tree/dattr.cc
index bb6be82..dde424c 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-dattr.cc
+++ b/helper/ccnb-parser/syntax-tree/dattr.cc
@@ -18,9 +18,10 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-dattr.h"
+#include "dattr.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
// dictionary attributes are not used (yet?) in CCNx
@@ -34,3 +35,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-dattr.h b/helper/ccnb-parser/syntax-tree/dattr.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-dattr.h
rename to helper/ccnb-parser/syntax-tree/dattr.h
index 6775017..e4c622c 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-dattr.h
+++ b/helper/ccnb-parser/syntax-tree/dattr.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_DATTR_H_
#define _CCNB_PARSER_DATTR_H_
-#include "ccnb-parser-base-attr.h"
+#include "base-attr.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -55,5 +56,6 @@
}
}
+}
#endif // _CCNB_PARSER_DATTR_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.cc b/helper/ccnb-parser/syntax-tree/dtag.cc
similarity index 96%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.cc
rename to helper/ccnb-parser/syntax-tree/dtag.cc
index e7d9b98..129b363 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.cc
+++ b/helper/ccnb-parser/syntax-tree/dtag.cc
@@ -18,12 +18,13 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-dtag.h"
+#include "dtag.h"
-#include "ccnb-parser-base-attr.h"
-#include "ccnb-parser-base-tag.h"
+#include "base-attr.h"
+#include "base-tag.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
Dtag::Dtag (Buffer::Iterator &start, uint32_t dtag)
@@ -85,3 +86,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.h b/helper/ccnb-parser/syntax-tree/dtag.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.h
rename to helper/ccnb-parser/syntax-tree/dtag.h
index cca0bba..cf9871e 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.h
+++ b/helper/ccnb-parser/syntax-tree/dtag.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_DTAG_H_
#define _CCNB_PARSER_DTAG_H_
-#include "ccnb-parser-base-tag.h"
+#include "base-tag.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -60,5 +61,6 @@
}
}
+}
#endif // _CCNB_PARSER_DTAG_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-ext.cc b/helper/ccnb-parser/syntax-tree/ext.cc
similarity index 96%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-ext.cc
rename to helper/ccnb-parser/syntax-tree/ext.cc
index 7d90019..b80743c 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-ext.cc
+++ b/helper/ccnb-parser/syntax-tree/ext.cc
@@ -18,9 +18,10 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-ext.h"
+#include "ext.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
Ext::Ext (Buffer::Iterator &start, uint32_t extSubtype)
@@ -30,3 +31,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-ext.h b/helper/ccnb-parser/syntax-tree/ext.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-ext.h
rename to helper/ccnb-parser/syntax-tree/ext.h
index 568706b..072405c 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-ext.h
+++ b/helper/ccnb-parser/syntax-tree/ext.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_EXT_H_
#define _CCNB_PARSER_EXT_H_
-#include "ccnb-parser-block.h"
+#include "block.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -55,5 +56,6 @@
}
}
+}
#endif // _CCNB_PARSER_EXT_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-tag.cc b/helper/ccnb-parser/syntax-tree/tag.cc
similarity index 96%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-tag.cc
rename to helper/ccnb-parser/syntax-tree/tag.cc
index 723c57e..5a0d96c 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-tag.cc
+++ b/helper/ccnb-parser/syntax-tree/tag.cc
@@ -18,11 +18,12 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-tag.h"
+#include "tag.h"
-#include "ccnb-parser-base-attr.h"
+#include "base-attr.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
Tag::Tag (Buffer::Iterator &start, uint32_t length)
@@ -64,3 +65,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-tag.h b/helper/ccnb-parser/syntax-tree/tag.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-tag.h
rename to helper/ccnb-parser/syntax-tree/tag.h
index c80581d..94f4d32 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-tag.h
+++ b/helper/ccnb-parser/syntax-tree/tag.h
@@ -21,10 +21,11 @@
#ifndef _CCNB_PARSER_TAG_H_
#define _CCNB_PARSER_TAG_H_
-#include "ccnb-parser-base-tag.h"
+#include "base-tag.h"
#include <string>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -56,5 +57,6 @@
}
}
+}
#endif // _CCNB_PARSER_TAG_H_
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-udata.cc b/helper/ccnb-parser/syntax-tree/udata.cc
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-udata.cc
rename to helper/ccnb-parser/syntax-tree/udata.cc
index 91cba15..cd69aba 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-udata.cc
+++ b/helper/ccnb-parser/syntax-tree/udata.cc
@@ -18,9 +18,10 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-udata.h"
+#include "udata.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
Udata::Udata (Buffer::Iterator &start, uint32_t length)
@@ -44,3 +45,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-udata.h b/helper/ccnb-parser/syntax-tree/udata.h
similarity index 97%
rename from helper/ccnb-parser/syntax-tree/ccnb-parser-udata.h
rename to helper/ccnb-parser/syntax-tree/udata.h
index b6ef2c2..b589ea4 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-udata.h
+++ b/helper/ccnb-parser/syntax-tree/udata.h
@@ -21,10 +21,11 @@
#ifndef _CCNB_PARSER_UDATA_H_
#define _CCNB_PARSER_UDATA_H_
-#include "ccnb-parser-block.h"
+#include "block.h"
#include <string>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -54,5 +55,6 @@
}
}
+}
#endif // _CCNB_PARSER_UDATA_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.cc b/helper/ccnb-parser/visitors/content-type-visitor.cc
similarity index 93%
rename from helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.cc
rename to helper/ccnb-parser/visitors/content-type-visitor.cc
index 34608b1..a89b99c 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.cc
+++ b/helper/ccnb-parser/visitors/content-type-visitor.cc
@@ -18,10 +18,11 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-content-type-visitor.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
+#include "content-type-visitor.h"
+#include "../syntax-tree/blob.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
boost::any
@@ -48,3 +49,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h b/helper/ccnb-parser/visitors/content-type-visitor.h
similarity index 96%
rename from helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h
rename to helper/ccnb-parser/visitors/content-type-visitor.h
index 0c3cc6c..2cbd883 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h
+++ b/helper/ccnb-parser/visitors/content-type-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
#define _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
-#include "ccnb-parser-no-argu-depth-first-visitor.h"
+#include "no-argu-depth-first-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -44,5 +45,6 @@
}
}
+}
#endif // _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-depth-first-visitor.cc b/helper/ccnb-parser/visitors/depth-first-visitor.cc
similarity index 86%
rename from helper/ccnb-parser/visitors/ccnb-parser-depth-first-visitor.cc
rename to helper/ccnb-parser/visitors/depth-first-visitor.cc
index 9a89c19..305fff6 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-depth-first-visitor.cc
+++ b/helper/ccnb-parser/visitors/depth-first-visitor.cc
@@ -18,19 +18,20 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-depth-first-visitor.h"
+#include "depth-first-visitor.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
-#include "../syntax-tree/ccnb-parser-udata.h"
-#include "../syntax-tree/ccnb-parser-tag.h"
-#include "../syntax-tree/ccnb-parser-dtag.h"
-#include "../syntax-tree/ccnb-parser-attr.h"
-#include "../syntax-tree/ccnb-parser-dattr.h"
-#include "../syntax-tree/ccnb-parser-ext.h"
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/tag.h"
+#include "../syntax-tree/dtag.h"
+#include "../syntax-tree/attr.h"
+#include "../syntax-tree/dattr.h"
+#include "../syntax-tree/ext.h"
#include <boost/foreach.hpp>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
boost::any
@@ -106,3 +107,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-depth-first-visitor.h b/helper/ccnb-parser/visitors/depth-first-visitor.h
similarity index 97%
rename from helper/ccnb-parser/visitors/ccnb-parser-depth-first-visitor.h
rename to helper/ccnb-parser/visitors/depth-first-visitor.h
index 98c3c96..2257802 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-depth-first-visitor.h
+++ b/helper/ccnb-parser/visitors/depth-first-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_DEPTH_FIRST_VISITOR_H_
#define _CCNB_PARSER_DEPTH_FIRST_VISITOR_H_
-#include "ccnb-parser-visitor.h"
+#include "visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -44,5 +45,6 @@
}
}
+}
#endif // _CCNB_PARSER_DEPTH_FIRST_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc b/helper/ccnb-parser/visitors/interest-visitor.cc
similarity index 90%
rename from helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc
rename to helper/ccnb-parser/visitors/interest-visitor.cc
index 5188f8d..175eaad 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc
+++ b/helper/ccnb-parser/visitors/interest-visitor.cc
@@ -18,34 +18,35 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-interest-visitor.h"
+#include "interest-visitor.h"
-#include "../syntax-tree/ccnb-parser-block.h"
-#include "../syntax-tree/ccnb-parser-dtag.h"
+#include "../syntax-tree/block.h"
+#include "../syntax-tree/dtag.h"
#include "ns3/ndn-name-components.h"
+#include "ns3/ndn-interest-header.h"
#include "ns3/assert.h"
#include "ns3/nstime.h"
-#include "ns3/ndn-interest-header.h"
-#include "ccnb-parser-name-components-visitor.h"
-#include "ccnb-parser-non-negative-integer-visitor.h"
-#include "ccnb-parser-timestamp-visitor.h"
-#include "ccnb-parser-uint32t-blob-visitor.h"
+#include "name-components-visitor.h"
+#include "non-negative-integer-visitor.h"
+#include "timestamp-visitor.h"
+#include "uint32t-blob-visitor.h"
#include <boost/foreach.hpp>
#include "ns3/log.h"
-NS_LOG_COMPONENT_DEFINE ("CcnbParserInterestVisitor");
+NS_LOG_COMPONENT_DEFINE ("ndn.CcnbParser.InterestVisitor");
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
// We don't care about any other fields
void
-InterestVisitor::visit (Dtag &n, boost::any param/*should be NdnInterestHeader* */)
+InterestVisitor::visit (Dtag &n, boost::any param/*should be InterestHeader* */)
{
// uint32_t n.m_dtag;
// std::list<Ptr<Block> > n.m_nestedBlocks;
@@ -55,7 +56,7 @@
static TimestampVisitor timestampVisitor;
static Uint32tBlobVisitor nonceVisitor;
- NdnInterestHeader &interest = *(boost::any_cast<NdnInterestHeader*> (param));
+ InterestHeader &interest = *(boost::any_cast<InterestHeader*> (param));
switch (n.m_dtag)
{
@@ -73,7 +74,7 @@
NS_LOG_DEBUG ("Name");
// process name components
- Ptr<NdnNameComponents> name = Create<NdnNameComponents> ();
+ Ptr<NameComponents> name = Create<NameComponents> ();
BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
{
@@ -106,7 +107,7 @@
{
NS_LOG_DEBUG ("Exclude");
// process exclude components
- Ptr<NdnNameComponents> exclude = Create<NdnNameComponents> ();
+ Ptr<NameComponents> exclude = Create<NameComponents> ();
BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
{
@@ -183,4 +184,5 @@
}
} // namespace CcnbParser
+} // namespace ndn
} // namespace ns3
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.h b/helper/ccnb-parser/visitors/interest-visitor.h
similarity index 92%
rename from helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.h
rename to helper/ccnb-parser/visitors/interest-visitor.h
index 35a1e13..f78d07f 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.h
+++ b/helper/ccnb-parser/visitors/interest-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_INTEREST_VISITOR_H_
#define _CCNB_PARSER_INTEREST_VISITOR_H_
-#include "ccnb-parser-void-depth-first-visitor.h"
+#include "void-depth-first-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -44,7 +45,8 @@
virtual void visit (Dtag &n, boost::any param/*should be CcnxInterestHeader* */);
};
-}
-}
+} // namespace CcnbParser
+} // namespace ndn
+} // namespace ns3
#endif // _CCNB_PARSER_INTEREST_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.cc b/helper/ccnb-parser/visitors/name-components-visitor.cc
similarity index 87%
rename from helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.cc
rename to helper/ccnb-parser/visitors/name-components-visitor.cc
index 387292b..ef87281 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.cc
+++ b/helper/ccnb-parser/visitors/name-components-visitor.cc
@@ -18,23 +18,25 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-name-components-visitor.h"
+#include "name-components-visitor.h"
-#include "ccnb-parser-string-visitor.h"
-#include "../syntax-tree/ccnb-parser-dtag.h"
+#include "string-visitor.h"
+#include "../syntax-tree/dtag.h"
+
#include "ns3/ndn-name-components.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
void
-NameComponentsVisitor::visit (Dtag &n, boost::any param/*should be NdnNameComponents* */)
+NameComponentsVisitor::visit (Dtag &n, boost::any param/*should be NameComponents* */)
{
// uint32_t n.m_dtag;
// std::list<Ptr<Block> > n.m_nestedBlocks;
static StringVisitor stringVisitor;
- NdnNameComponents &components = *(boost::any_cast<NdnNameComponents*> (param));
+ NameComponents &components = *(boost::any_cast<NameComponents*> (param));
switch (n.m_dtag)
{
@@ -55,3 +57,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.h b/helper/ccnb-parser/visitors/name-components-visitor.h
similarity index 95%
rename from helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.h
rename to helper/ccnb-parser/visitors/name-components-visitor.h
index 70257c5..823de35 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.h
+++ b/helper/ccnb-parser/visitors/name-components-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_NAME_COMPONENTS_VISITOR_H_
#define _CCNB_PARSER_NAME_COMPONENTS_VISITOR_H_
-#include "ccnb-parser-void-depth-first-visitor.h"
+#include "void-depth-first-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -38,6 +39,7 @@
}
}
+}
#endif // _CCNB_PARSER_NAME_COMPONENTS_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-no-argu-depth-first-visitor.cc b/helper/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
similarity index 85%
rename from helper/ccnb-parser/visitors/ccnb-parser-no-argu-depth-first-visitor.cc
rename to helper/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
index 12264fd..53f1122 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-no-argu-depth-first-visitor.cc
+++ b/helper/ccnb-parser/visitors/no-argu-depth-first-visitor.cc
@@ -18,19 +18,20 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-no-argu-depth-first-visitor.h"
+#include "no-argu-depth-first-visitor.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
-#include "../syntax-tree/ccnb-parser-udata.h"
-#include "../syntax-tree/ccnb-parser-tag.h"
-#include "../syntax-tree/ccnb-parser-dtag.h"
-#include "../syntax-tree/ccnb-parser-attr.h"
-#include "../syntax-tree/ccnb-parser-dattr.h"
-#include "../syntax-tree/ccnb-parser-ext.h"
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/tag.h"
+#include "../syntax-tree/dtag.h"
+#include "../syntax-tree/attr.h"
+#include "../syntax-tree/dattr.h"
+#include "../syntax-tree/ext.h"
#include <boost/foreach.hpp>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
boost::any
@@ -106,3 +107,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-no-argu-depth-first-visitor.h b/helper/ccnb-parser/visitors/no-argu-depth-first-visitor.h
similarity index 96%
rename from helper/ccnb-parser/visitors/ccnb-parser-no-argu-depth-first-visitor.h
rename to helper/ccnb-parser/visitors/no-argu-depth-first-visitor.h
index 7d3841d..4b6c2e9 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-no-argu-depth-first-visitor.h
+++ b/helper/ccnb-parser/visitors/no-argu-depth-first-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_NO_ARGU_DEPTH_FIRST_VISITOR_H_
#define _CCNB_PARSER_NO_ARGU_DEPTH_FIRST_VISITOR_H_
-#include "ccnb-parser-no-argu-visitor.h"
+#include "no-argu-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -44,5 +45,6 @@
}
}
+}
#endif // _CCNB_PARSER_NO_ARGU_DEPTH_FIRST_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-no-argu-visitor.h b/helper/ccnb-parser/visitors/no-argu-visitor.h
similarity index 97%
rename from helper/ccnb-parser/visitors/ccnb-parser-no-argu-visitor.h
rename to helper/ccnb-parser/visitors/no-argu-visitor.h
index 95be166..abbf843 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-no-argu-visitor.h
+++ b/helper/ccnb-parser/visitors/no-argu-visitor.h
@@ -21,10 +21,11 @@
#ifndef _CCNB_PARSER_NO_ARGU_VISITOR_H_
#define _CCNB_PARSER_NO_ARGU_VISITOR_H_
-#include "../ccnb-parser-common.h"
+#include "../common.h"
#include <boost/any.hpp>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -50,5 +51,6 @@
}
}
+}
#endif // _CCNB_PARSER_NO_ARGU_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.cc b/helper/ccnb-parser/visitors/non-negative-integer-visitor.cc
similarity index 90%
rename from helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.cc
rename to helper/ccnb-parser/visitors/non-negative-integer-visitor.cc
index a9aed41..d5fc041 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.cc
+++ b/helper/ccnb-parser/visitors/non-negative-integer-visitor.cc
@@ -18,13 +18,14 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-non-negative-integer-visitor.h"
+#include "non-negative-integer-visitor.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
-#include "../syntax-tree/ccnb-parser-udata.h"
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
#include <sstream>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
boost::any
@@ -49,3 +50,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.h b/helper/ccnb-parser/visitors/non-negative-integer-visitor.h
similarity index 95%
rename from helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.h
rename to helper/ccnb-parser/visitors/non-negative-integer-visitor.h
index 7ecc3a9..2bb9f91 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.h
+++ b/helper/ccnb-parser/visitors/non-negative-integer-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_NON_NEGATIVE_INTEGER_VISITOR_H_
#define _CCNB_PARSER_NON_NEGATIVE_INTEGER_VISITOR_H_
-#include "ccnb-parser-no-argu-depth-first-visitor.h"
+#include "no-argu-depth-first-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -41,5 +42,6 @@
}
}
+}
#endif // _CCNB_PARSER_NON_NEGATIVE_INTEGER_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-string-visitor.cc b/helper/ccnb-parser/visitors/string-visitor.cc
similarity index 89%
rename from helper/ccnb-parser/visitors/ccnb-parser-string-visitor.cc
rename to helper/ccnb-parser/visitors/string-visitor.cc
index 6fb5e6b..5f44bf3 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-string-visitor.cc
+++ b/helper/ccnb-parser/visitors/string-visitor.cc
@@ -18,11 +18,12 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-string-visitor.h"
-#include "../syntax-tree/ccnb-parser-udata.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
+#include "string-visitor.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/blob.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
boost::any
@@ -41,3 +42,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-string-visitor.h b/helper/ccnb-parser/visitors/string-visitor.h
similarity index 95%
rename from helper/ccnb-parser/visitors/ccnb-parser-string-visitor.h
rename to helper/ccnb-parser/visitors/string-visitor.h
index 2a1e8ed..ea285d1 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-string-visitor.h
+++ b/helper/ccnb-parser/visitors/string-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_STRING_VISITOR_H_
#define _CCNB_PARSER_STRING_VISITOR_H_
-#include "ccnb-parser-no-argu-depth-first-visitor.h"
+#include "no-argu-depth-first-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -41,5 +42,6 @@
}
}
+}
#endif // _CCNB_PARSER_STRING_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.cc b/helper/ccnb-parser/visitors/timestamp-visitor.cc
similarity index 95%
rename from helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.cc
rename to helper/ccnb-parser/visitors/timestamp-visitor.cc
index 4569bb9..5917711 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.cc
+++ b/helper/ccnb-parser/visitors/timestamp-visitor.cc
@@ -18,12 +18,13 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-timestamp-visitor.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
+#include "timestamp-visitor.h"
+#include "../syntax-tree/blob.h"
#include "ns3/nstime.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
boost::any/*Time*/
@@ -61,3 +62,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.h b/helper/ccnb-parser/visitors/timestamp-visitor.h
similarity index 95%
rename from helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.h
rename to helper/ccnb-parser/visitors/timestamp-visitor.h
index ff7e8c8..3884ff6 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.h
+++ b/helper/ccnb-parser/visitors/timestamp-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_TIMESTAMP_VISITOR_H_
#define _CCNB_PARSER_TIMESTAMP_VISITOR_H_
-#include "ccnb-parser-no-argu-depth-first-visitor.h"
+#include "no-argu-depth-first-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -41,5 +42,6 @@
}
}
+}
#endif // _CCNB_PARSER_TIMESTAMP_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.cc b/helper/ccnb-parser/visitors/uint32t-blob-visitor.cc
similarity index 92%
rename from helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.cc
rename to helper/ccnb-parser/visitors/uint32t-blob-visitor.cc
index fbeee6e..351cc36 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.cc
+++ b/helper/ccnb-parser/visitors/uint32t-blob-visitor.cc
@@ -18,10 +18,11 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-uint32t-blob-visitor.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
+#include "uint32t-blob-visitor.h"
+#include "../syntax-tree/blob.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
boost::any
@@ -43,3 +44,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h b/helper/ccnb-parser/visitors/uint32t-blob-visitor.h
similarity index 96%
rename from helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h
rename to helper/ccnb-parser/visitors/uint32t-blob-visitor.h
index e06273f..de5f374 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h
+++ b/helper/ccnb-parser/visitors/uint32t-blob-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
#define _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
-#include "ccnb-parser-no-argu-depth-first-visitor.h"
+#include "no-argu-depth-first-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -44,5 +45,6 @@
}
}
+}
#endif // _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-visitor.h b/helper/ccnb-parser/visitors/visitor.h
similarity index 95%
rename from helper/ccnb-parser/visitors/ccnb-parser-visitor.h
rename to helper/ccnb-parser/visitors/visitor.h
index bc858eb..76744ee 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-visitor.h
+++ b/helper/ccnb-parser/visitors/visitor.h
@@ -21,10 +21,11 @@
#ifndef _CCNB_PARSER_VISITOR_H_
#define _CCNB_PARSER_VISITOR_H_
-#include "../ccnb-parser-common.h"
+#include "../common.h"
#include <boost/any.hpp>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -48,7 +49,8 @@
virtual ~Visitor () { }
};
-}
+}
+}
}
#endif // _CCNB_PARSER_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.cc b/helper/ccnb-parser/visitors/void-depth-first-visitor.cc
similarity index 85%
rename from helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.cc
rename to helper/ccnb-parser/visitors/void-depth-first-visitor.cc
index 05218b5..1a1770a 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.cc
+++ b/helper/ccnb-parser/visitors/void-depth-first-visitor.cc
@@ -18,19 +18,20 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-void-depth-first-visitor.h"
+#include "void-depth-first-visitor.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
-#include "../syntax-tree/ccnb-parser-udata.h"
-#include "../syntax-tree/ccnb-parser-tag.h"
-#include "../syntax-tree/ccnb-parser-dtag.h"
-#include "../syntax-tree/ccnb-parser-attr.h"
-#include "../syntax-tree/ccnb-parser-dattr.h"
-#include "../syntax-tree/ccnb-parser-ext.h"
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/tag.h"
+#include "../syntax-tree/dtag.h"
+#include "../syntax-tree/attr.h"
+#include "../syntax-tree/dattr.h"
+#include "../syntax-tree/ext.h"
#include <boost/foreach.hpp>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
void
@@ -99,3 +100,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.h b/helper/ccnb-parser/visitors/void-depth-first-visitor.h
similarity index 97%
rename from helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.h
rename to helper/ccnb-parser/visitors/void-depth-first-visitor.h
index 35283d2..2e1862e 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.h
+++ b/helper/ccnb-parser/visitors/void-depth-first-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_VOID_DEPTH_FIRST_VISITOR_H_
#define _CCNB_PARSER_VOID_DEPTH_FIRST_VISITOR_H_
-#include "ccnb-parser-void-visitor.h"
+#include "void-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -44,5 +45,6 @@
}
}
+}
#endif // _CCNB_PARSER_VOID_DEPTH_FIRST_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-depth-first-visitor.cc b/helper/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
similarity index 84%
rename from helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-depth-first-visitor.cc
rename to helper/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
index 15519f2..439bf93 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-depth-first-visitor.cc
+++ b/helper/ccnb-parser/visitors/void-no-argu-depth-first-visitor.cc
@@ -18,19 +18,20 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnb-parser-void-no-argu-depth-first-visitor.h"
+#include "void-no-argu-depth-first-visitor.h"
-#include "../syntax-tree/ccnb-parser-blob.h"
-#include "../syntax-tree/ccnb-parser-udata.h"
-#include "../syntax-tree/ccnb-parser-tag.h"
-#include "../syntax-tree/ccnb-parser-dtag.h"
-#include "../syntax-tree/ccnb-parser-attr.h"
-#include "../syntax-tree/ccnb-parser-dattr.h"
-#include "../syntax-tree/ccnb-parser-ext.h"
+#include "../syntax-tree/blob.h"
+#include "../syntax-tree/udata.h"
+#include "../syntax-tree/tag.h"
+#include "../syntax-tree/dtag.h"
+#include "../syntax-tree/attr.h"
+#include "../syntax-tree/dattr.h"
+#include "../syntax-tree/ext.h"
#include <boost/foreach.hpp>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
void
@@ -99,3 +100,4 @@
}
}
+}
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-depth-first-visitor.h b/helper/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
similarity index 96%
rename from helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-depth-first-visitor.h
rename to helper/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
index e796c7f..995f90a 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-depth-first-visitor.h
+++ b/helper/ccnb-parser/visitors/void-no-argu-depth-first-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_VOID_NO_ARGU_DEPTH_FIRST_VISITOR_H_
#define _CCNB_PARSER_VOID_NO_ARGU_DEPTH_FIRST_VISITOR_H_
-#include "ccnb-parser-void-no-argu-visitor.h"
+#include "void-no-argu-visitor.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -44,5 +45,6 @@
}
}
+}
#endif // _CCNB_PARSER_VOID_NO_ARGU_DEPTH_FIRST_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-visitor.h b/helper/ccnb-parser/visitors/void-no-argu-visitor.h
similarity index 97%
rename from helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-visitor.h
rename to helper/ccnb-parser/visitors/void-no-argu-visitor.h
index 25f9e50..6dccf4e 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-void-no-argu-visitor.h
+++ b/helper/ccnb-parser/visitors/void-no-argu-visitor.h
@@ -21,9 +21,10 @@
#ifndef _CCNB_PARSER_VOID_NO_ARGU_VISITOR_H_
#define _CCNB_PARSER_VOID_NO_ARGU_VISITOR_H_
-#include "../ccnb-parser-common.h"
+#include "../common.h"
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -49,5 +50,6 @@
}
}
+}
#endif // _CCNB_PARSER_VOID_NO_ARGU_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-void-visitor.h b/helper/ccnb-parser/visitors/void-visitor.h
similarity index 97%
rename from helper/ccnb-parser/visitors/ccnb-parser-void-visitor.h
rename to helper/ccnb-parser/visitors/void-visitor.h
index 1f9d1fa..6ad7eed 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-void-visitor.h
+++ b/helper/ccnb-parser/visitors/void-visitor.h
@@ -21,10 +21,11 @@
#ifndef _CCNB_PARSER_VOID_VISITOR_H_
#define _CCNB_PARSER_VOID_VISITOR_H_
-#include "../ccnb-parser-common.h"
+#include "../common.h"
#include <boost/any.hpp>
namespace ns3 {
+namespace ndn {
namespace CcnbParser {
/**
@@ -50,5 +51,6 @@
}
}
+}
#endif // _CCNB_PARSER_VOID_VISITOR_H_
diff --git a/helper/ndn-app-helper.cc b/helper/ndn-app-helper.cc
index dcaee07..58f62d3 100644
--- a/helper/ndn-app-helper.cc
+++ b/helper/ndn-app-helper.cc
@@ -28,30 +28,30 @@
#include "ns3/mpi-interface.h"
#endif
-NS_LOG_COMPONENT_DEFINE ("NdnAppHelper");
+NS_LOG_COMPONENT_DEFINE ("ndn.AppHelper");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NdnAppHelper::NdnAppHelper (const std::string &app)
+AppHelper::AppHelper (const std::string &app)
{
m_factory.SetTypeId (app);
}
void
-NdnAppHelper::SetPrefix (const std::string &prefix)
+AppHelper::SetPrefix (const std::string &prefix)
{
m_factory.Set ("Prefix", StringValue(prefix));
}
void
-NdnAppHelper::SetAttribute (std::string name, const AttributeValue &value)
+AppHelper::SetAttribute (std::string name, const AttributeValue &value)
{
m_factory.Set (name, value);
}
ApplicationContainer
-NdnAppHelper::Install (Ptr<Node> node)
+AppHelper::Install (Ptr<Node> node)
{
ApplicationContainer apps;
Ptr<Application> app = InstallPriv (node);
@@ -62,14 +62,14 @@
}
ApplicationContainer
-NdnAppHelper::Install (std::string nodeName)
+AppHelper::Install (std::string nodeName)
{
Ptr<Node> node = Names::Find<Node> (nodeName);
return Install (node);
}
ApplicationContainer
-NdnAppHelper::Install (NodeContainer c)
+AppHelper::Install (NodeContainer c)
{
ApplicationContainer apps;
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
@@ -83,7 +83,7 @@
}
Ptr<Application>
-NdnAppHelper::InstallPriv (Ptr<Node> node)
+AppHelper::InstallPriv (Ptr<Node> node)
{
#ifdef NS3_MPI
if (MpiInterface::IsEnabled () &&
@@ -94,10 +94,11 @@
}
#endif
- Ptr<NdnApp> app = m_factory.Create<NdnApp> ();
+ Ptr<App> app = m_factory.Create<App> ();
node->AddApplication (app);
return app;
}
-}
+} // namespace ndn
+} // namespace ns3
diff --git a/helper/ndn-app-helper.h b/helper/ndn-app-helper.h
index 1a76c84..94d1046 100644
--- a/helper/ndn-app-helper.h
+++ b/helper/ndn-app-helper.h
@@ -27,14 +27,14 @@
#include "ns3/application-container.h"
#include "ns3/ptr.h"
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
/**
* \brief A helper to make it easier to instantiate an ns3::NdnConsumer Application
* on a set of nodes.
*/
-class NdnAppHelper
+class AppHelper
{
public:
@@ -43,7 +43,7 @@
*
* \param app Class of the application
*/
- NdnAppHelper (const std::string &prefix);
+ AppHelper (const std::string &prefix);
/**
* @brief Set the prefix consumer will be requesting
@@ -100,6 +100,7 @@
ObjectFactory m_factory;
};
+} // namespace ndn
} // namespace ns3
#endif // NDN_APP_HELPER_H
diff --git a/helper/ndn-decoding-helper.cc b/helper/ndn-decoding-helper.cc
index 4e5e6b8..89936c1 100644
--- a/helper/ndn-decoding-helper.cc
+++ b/helper/ndn-decoding-helper.cc
@@ -22,19 +22,20 @@
#include "ns3/ndn-interest-header.h"
-#include "ccnb-parser/visitors/ccnb-parser-interest-visitor.h"
+#include "ccnb-parser/visitors/interest-visitor.h"
-#include "ccnb-parser/syntax-tree/ccnb-parser-block.h"
-#include "ccnb-parser/syntax-tree/ccnb-parser-dtag.h"
+#include "ccnb-parser/syntax-tree/block.h"
+#include "ccnb-parser/syntax-tree/dtag.h"
#include "ns3/log.h"
-NS_LOG_COMPONENT_DEFINE ("NdnDecodingHelper");
+NS_LOG_COMPONENT_DEFINE ("ndn.DecodingHelper");
namespace ns3 {
+namespace ndn {
size_t
-NdnDecodingHelper::Deserialize (Buffer::Iterator start, NdnInterestHeader &interest)
+DecodingHelper::Deserialize (Buffer::Iterator start, InterestHeader &interest)
{
static CcnbParser::InterestVisitor interestVisitor;
@@ -57,4 +58,5 @@
// return i.GetDistanceFrom (start);
// }
+} // namespace ndn
} // namespace ns3
diff --git a/helper/ndn-decoding-helper.h b/helper/ndn-decoding-helper.h
index f6ab9fa..9e1f5ef 100644
--- a/helper/ndn-decoding-helper.h
+++ b/helper/ndn-decoding-helper.h
@@ -25,14 +25,15 @@
#include "ns3/buffer.h"
namespace ns3 {
+namespace ndn {
-class NdnInterestHeader;
-class NdnContentObjectHeader;
+class InterestHeader;
+class ContentObjectHeader;
/**
* \brief Helper class to decode ccnb formatted Ndn message
*/
-class NdnDecodingHelper
+class DecodingHelper
{
public:
/**
@@ -42,7 +43,7 @@
* @return Number of bytes used for deserialization
*/
static size_t
- Deserialize (Buffer::Iterator start, NdnInterestHeader &interest);
+ Deserialize (Buffer::Iterator start, InterestHeader &interest);
/**
* \brief Deserialize Buffer::Iterator to NdnContentObjectHeader
@@ -50,9 +51,11 @@
* @param contentObject Pointer to the NdnContentObjectHeader to hold deserialized value
* @return Number of bytes used for deserialization
*/
- static size_t
- Deserialize (Buffer::Iterator start, NdnContentObjectHeader &contentObject);
+ // static size_t
+ // Deserialize (Buffer::Iterator start, ContentObjectHeader &contentObject);
};
+
+} // namespace ndn
} // namespace ns3
#endif // _NDN_DECODING_HELPER_H_
diff --git a/helper/ndn-encoding-helper.cc b/helper/ndn-encoding-helper.cc
index 200072b..c9292ab 100644
--- a/helper/ndn-encoding-helper.cc
+++ b/helper/ndn-encoding-helper.cc
@@ -28,9 +28,10 @@
#include <boost/foreach.hpp>
namespace ns3 {
+namespace ndn {
size_t
-NdnEncodingHelper::Serialize (Buffer::Iterator start, const NdnInterestHeader &interest)
+EncodingHelper::Serialize (Buffer::Iterator start, const InterestHeader &interest)
{
size_t written = 0;
written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Interest, CcnbParser::CCN_DTAG); // <Interest>
@@ -99,7 +100,7 @@
}
size_t
-NdnEncodingHelper::GetSerializedSize (const NdnInterestHeader &interest)
+EncodingHelper::GetSerializedSize (const InterestHeader &interest)
{
size_t written = 0;
written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Interest); // <Interest>
@@ -176,7 +177,7 @@
#define CCN_TT_HBIT ((unsigned char)(1 << 7))
size_t
-NdnEncodingHelper::AppendBlockHeader (Buffer::Iterator &start, size_t val, CcnbParser::ccn_tt tt)
+EncodingHelper::AppendBlockHeader (Buffer::Iterator &start, size_t val, CcnbParser::ccn_tt tt)
{
unsigned char buf[1+8*((sizeof(val)+6)/7)];
unsigned char *p = &(buf[sizeof(buf)-1]);
@@ -195,7 +196,7 @@
}
size_t
-NdnEncodingHelper::EstimateBlockHeader (size_t value)
+EncodingHelper::EstimateBlockHeader (size_t value)
{
value >>= (7-CCN_TT_BITS);
size_t n = 1;
@@ -208,7 +209,7 @@
}
size_t
-NdnEncodingHelper::AppendNumber (Buffer::Iterator &start, uint32_t number)
+EncodingHelper::AppendNumber (Buffer::Iterator &start, uint32_t number)
{
std::ostringstream os;
os << number;
@@ -222,7 +223,7 @@
}
size_t
-NdnEncodingHelper::EstimateNumber (uint32_t number)
+EncodingHelper::EstimateNumber (uint32_t number)
{
std::ostringstream os;
os << number;
@@ -230,14 +231,14 @@
}
size_t
-NdnEncodingHelper::AppendCloser (Buffer::Iterator &start)
+EncodingHelper::AppendCloser (Buffer::Iterator &start)
{
start.WriteU8 (CcnbParser::CCN_CLOSE);
return 1;
}
size_t
-NdnEncodingHelper::AppendNameComponents (Buffer::Iterator &start, const NdnNameComponents &name)
+EncodingHelper::AppendNameComponents (Buffer::Iterator &start, const NameComponents &name)
{
size_t written = 0;
BOOST_FOREACH (const std::string &component, name.GetComponents())
@@ -249,7 +250,7 @@
}
size_t
-NdnEncodingHelper::EstimateNameComponents (const NdnNameComponents &name)
+EncodingHelper::EstimateNameComponents (const NameComponents &name)
{
size_t written = 0;
BOOST_FOREACH (const std::string &component, name.GetComponents())
@@ -260,7 +261,7 @@
}
size_t
-NdnEncodingHelper::AppendTimestampBlob (Buffer::Iterator &start, const Time &time)
+EncodingHelper::AppendTimestampBlob (Buffer::Iterator &start, const Time &time)
{
// the original function implements Markers... thought not sure what are these markers for...
@@ -287,7 +288,7 @@
}
size_t
-NdnEncodingHelper::EstimateTimestampBlob (const Time &time)
+EncodingHelper::EstimateTimestampBlob (const Time &time)
{
int required_bytes = 2; // 12 bits for fractions of a second, 4 bits left for seconds. Sometimes it is enough
intmax_t ts = time.ToInteger (Time::S) >> 4;
@@ -298,7 +299,7 @@
}
size_t
-NdnEncodingHelper::AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
+EncodingHelper::AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
const uint8_t *data, size_t size)
{
size_t written = AppendBlockHeader (start, dtag, CcnbParser::CCN_DTAG);
@@ -317,7 +318,7 @@
}
size_t
-NdnEncodingHelper::EstimateTaggedBlob (CcnbParser::ccn_dtag dtag, size_t size)
+EncodingHelper::EstimateTaggedBlob (CcnbParser::ccn_dtag dtag, size_t size)
{
if (size>0)
return EstimateBlockHeader (dtag) + EstimateBlockHeader (size) + size + 1;
@@ -326,7 +327,7 @@
}
size_t
-NdnEncodingHelper::AppendString (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
+EncodingHelper::AppendString (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
const std::string &string)
{
size_t written = AppendBlockHeader (start, dtag, CcnbParser::CCN_DTAG);
@@ -341,10 +342,11 @@
}
size_t
-NdnEncodingHelper::EstimateString (CcnbParser::ccn_dtag dtag, const std::string &string)
+EncodingHelper::EstimateString (CcnbParser::ccn_dtag dtag, const std::string &string)
{
return EstimateBlockHeader (dtag) + EstimateBlockHeader (string.size ()) + string.size () + 1;
}
+} // namespace ndn
} // namespace ns3
diff --git a/helper/ndn-encoding-helper.h b/helper/ndn-encoding-helper.h
index 90b3f57..66796c3 100644
--- a/helper/ndn-encoding-helper.h
+++ b/helper/ndn-encoding-helper.h
@@ -23,22 +23,23 @@
#include <sys/types.h>
-#include "ccnb-parser/ccnb-parser-common.h"
+#include "ccnb-parser/common.h"
#include "ns3/ptr.h"
#include "ns3/nstime.h"
#include "ns3/buffer.h"
namespace ns3 {
+namespace ndn {
-class NdnNameComponents;
+class NameComponents;
-class NdnInterestHeader;
-class NdnContentObjectHeader;
+class InterestHeader;
+class ContentObjectHeader;
/**
* \brief Helper to encode/decode ccnb formatted Ndn message
*/
-class NdnEncodingHelper
+class EncodingHelper
{
public:
/**
@@ -48,7 +49,7 @@
* @return length of serialized NdnInterestHeader
*/
static size_t
- Serialize (Buffer::Iterator start, const NdnInterestHeader &interest);
+ Serialize (Buffer::Iterator start, const InterestHeader &interest);
/**
* \brief Compute the size of serialized NdnInterestHeader
@@ -56,7 +57,7 @@
* @return length
*/
static size_t
- GetSerializedSize (const NdnInterestHeader &interest);
+ GetSerializedSize (const InterestHeader &interest);
public:
/**
@@ -98,7 +99,7 @@
/**
* @brief Append CCNB closer tag (estimated size is 1)
- * @param start Buffer to store serialized NdnInterestHeader
+ * @param start Buffer to store serialized InterestHeader
*
* @returns written length
*/
@@ -106,22 +107,22 @@
AppendCloser (Buffer::Iterator &start);
/**
- * @brief Append NdnNameComponents in CCNB encoding
- * @param start Buffer to store serialized NdnInterestHeader
- * @param name constant reference to NdnNameComponents object
+ * @brief Append NameComponents in CCNB encoding
+ * @param start Buffer to store serialized InterestHeader
+ * @param name constant reference to NameComponents object
*
* @returns written length
*/
static size_t
- AppendNameComponents (Buffer::Iterator &start, const NdnNameComponents &name);
+ AppendNameComponents (Buffer::Iterator &start, const NameComponents &name);
/**
- * @brief Estimate size of NdnNameComponents in CCNB encoding
- * @param name constant reference to NdnNameComponents object
+ * @brief Estimate size of NameComponents in CCNB encoding
+ * @param name constant reference to NameComponents object
* @returns estimated length
*/
static size_t
- EstimateNameComponents (const NdnNameComponents &name);
+ EstimateNameComponents (const NameComponents &name);
/**
* Append a binary timestamp as a BLOB using the ccn binary
@@ -213,11 +214,12 @@
template<class T>
size_t
-NdnEncodingHelper::AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag, const T &data)
+EncodingHelper::AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag, const T &data)
{
return AppendTaggedBlob (start, dtag, reinterpret_cast<const uint8_t*> (&data), sizeof (data));
}
+} // namespace ndn
} // namespace ns3
#endif // _NDN_ENCODING_HELPER_H_
diff --git a/helper/ndn-face-container.cc b/helper/ndn-face-container.cc
index 2e0ec33..888b9a8 100644
--- a/helper/ndn-face-container.cc
+++ b/helper/ndn-face-container.cc
@@ -25,18 +25,19 @@
#include "ns3/ndn-face.h"
namespace ns3 {
+namespace ndn {
-NdnFaceContainer::NdnFaceContainer ()
+FaceContainer::FaceContainer ()
{
}
-NdnFaceContainer::NdnFaceContainer (const NdnFaceContainer &other)
+FaceContainer::FaceContainer (const FaceContainer &other)
{
AddAll (other);
}
-NdnFaceContainer&
-NdnFaceContainer::operator= (const NdnFaceContainer &other)
+FaceContainer&
+FaceContainer::operator= (const FaceContainer &other)
{
m_faces.clear ();
AddAll (other);
@@ -46,38 +47,38 @@
void
-NdnFaceContainer::AddAll (Ptr<NdnFaceContainer> other)
+FaceContainer::AddAll (Ptr<FaceContainer> other)
{
AddAll (*other);
}
void
-NdnFaceContainer::AddAll (const NdnFaceContainer &other)
+FaceContainer::AddAll (const FaceContainer &other)
{
m_faces.insert (m_faces.end (),
other.m_faces.begin (), other.m_faces.end ());
}
-NdnFaceContainer::Iterator
-NdnFaceContainer::Begin (void) const
+FaceContainer::Iterator
+FaceContainer::Begin (void) const
{
return m_faces.begin ();
}
-NdnFaceContainer::Iterator
-NdnFaceContainer::End (void) const
+FaceContainer::Iterator
+FaceContainer::End (void) const
{
return m_faces.end ();
}
uint32_t
-NdnFaceContainer::GetN (void) const
+FaceContainer::GetN (void) const
{
return m_faces.size ();
}
// void
-// NdnFaceContainer::SetMetricToAll (uint16_t metric)
+// FaceContainer::SetMetricToAll (uint16_t metric)
// {
// for (FaceContainer::iterator it=m_faces.begin ();
// it != m_faces.end ();
@@ -88,16 +89,16 @@
// }
void
-NdnFaceContainer::Add (const Ptr<NdnFace> &face)
+FaceContainer::Add (const Ptr<Face> &face)
{
m_faces.push_back (face);
}
-Ptr<NdnFace>
-NdnFaceContainer::Get (NdnFaceContainer::Iterator i) const
+Ptr<Face>
+FaceContainer::Get (FaceContainer::Iterator i) const
{
return *i;
}
-
+} // namespace ndn
} // namespace ns3
diff --git a/helper/ndn-face-container.h b/helper/ndn-face-container.h
index e1fd4b2..692daf6 100644
--- a/helper/ndn-face-container.h
+++ b/helper/ndn-face-container.h
@@ -29,6 +29,7 @@
#include "ns3/ndn-face.h"
namespace ns3 {
+namespace ndn {
/**
* \ingroup ndn-helpers
@@ -39,47 +40,47 @@
*
* \see NdnStackHelper
*/
-class NdnFaceContainer : public SimpleRefCount<NdnFaceContainer>
+class FaceContainer : public SimpleRefCount<FaceContainer>
{
private:
- typedef std::vector<Ptr<NdnFace> > FaceContainer;
+ typedef std::vector< Ptr<Face> > Container;
public:
- typedef FaceContainer::const_iterator Iterator; ///< \brief Iterator over NdnFaceContainer
+ typedef Container::const_iterator Iterator; ///< \brief Iterator over FaceContainer
/**
- * \brief Create an empty NdnFaceContainer.
+ * \brief Create an empty FaceContainer.
*/
- NdnFaceContainer ();
+ FaceContainer ();
/**
- * \brief Copy constructor for NdnFaceContainer. Calls AddAll method
+ * \brief Copy constructor for FaceContainer. Calls AddAll method
*
- * \see NdnFaceContainer::AddAll
+ * \see FaceContainer::AddAll
*/
- NdnFaceContainer (const NdnFaceContainer &other);
+ FaceContainer (const FaceContainer &other);
/**
- * \brief Copy operator for NdnFaceContainer. Empties vector and calls AddAll method
+ * \brief Copy operator for FaceContainer. Empties vector and calls AddAll method
*
* All previously obtained iterators (Begin() and End()) will be invalidated
*
- * \see NdnFaceContainer::AddAll
+ * \see FaceContainer::AddAll
*/
- NdnFaceContainer& operator= (const NdnFaceContainer &other);
+ FaceContainer& operator= (const FaceContainer &other);
/**
* \brief Add all entries from other container
*
* \param other smart pointer to a container
*/
- void AddAll (Ptr<NdnFaceContainer> other);
+ void AddAll (Ptr<FaceContainer> other);
/**
* \brief Add all entries from other container
*
* \param other container
*/
- void AddAll (const NdnFaceContainer &other);
+ void AddAll (const FaceContainer &other);
/**
* \brief Get an iterator which refers to the first pair in the
@@ -114,27 +115,28 @@
/**
* Add an entry to the container
*
- * \param face a smart pointer to a NdnFace-derived object
+ * \param face a smart pointer to a Face-derived object
*
- * @see NdnFace
+ * @see Face
*/
- void Add (const Ptr<NdnFace> &face);
+ void Add (const Ptr<Face> &face);
/**
- * Get a smart pointer to NdnFace-derived object stored in the container
+ * Get a smart pointer to Face-derived object stored in the container
*
* \param i the iterator corresponding to the requested object
*
* This method is redundant and simple dereferencing of the iterator should be used instead
*
- * @see NdnFace
+ * @see Face
*/
- Ptr<NdnFace> Get (Iterator i) const;
+ Ptr<Face> Get (Iterator i) const;
private:
- FaceContainer m_faces;
+ Container m_faces;
};
+} // namespace ndn
} // namespace ns3
#endif /* NDN_FACE_CONTAINER_H */
diff --git a/helper/ndn-global-routing-helper.cc b/helper/ndn-global-routing-helper.cc
index c3c9968..4ee8f58 100644
--- a/helper/ndn-global-routing-helper.cc
+++ b/helper/ndn-global-routing-helper.cc
@@ -20,7 +20,7 @@
#include "ndn-global-routing-helper.h"
-#include "ns3/ndn.h"
+#include "ns3/ndn-l3-protocol.h"
#include "../model/ndn-net-device-face.h"
#include "../model/ndn-global-router.h"
#include "ns3/ndn-name-components.h"
@@ -45,34 +45,35 @@
#include "boost-graph-ndn-global-routing-helper.h"
-NS_LOG_COMPONENT_DEFINE ("NdnGlobalRoutingHelper");
+NS_LOG_COMPONENT_DEFINE ("ndn.GlobalRoutingHelper");
using namespace std;
using namespace boost;
namespace ns3 {
+namespace ndn {
void
-NdnGlobalRoutingHelper::Install (Ptr<Node> node)
+GlobalRoutingHelper::Install (Ptr<Node> node)
{
NS_LOG_LOGIC ("Node: " << node->GetId ());
- Ptr<Ndn> ndn = node->GetObject<Ndn> ();
- NS_ASSERT_MSG (ndn != 0, "Cannot install NdnGlobalRoutingHelper before Ndn is installed on a node");
+ Ptr<L3Protocol> ndn = node->GetObject<L3Protocol> ();
+ NS_ASSERT_MSG (ndn != 0, "Cannot install GlobalRoutingHelper before Ndn is installed on a node");
- Ptr<NdnGlobalRouter> gr = node->GetObject<NdnGlobalRouter> ();
+ Ptr<GlobalRouter> gr = node->GetObject<GlobalRouter> ();
if (gr != 0)
{
- NS_LOG_DEBUG ("NdnGlobalRouter is already installed: " << gr);
+ NS_LOG_DEBUG ("GlobalRouter is already installed: " << gr);
return; // already installed
}
- gr = CreateObject<NdnGlobalRouter> ();
+ gr = CreateObject<GlobalRouter> ();
node->AggregateObject (gr);
for (uint32_t faceId = 0; faceId < ndn->GetNFaces (); faceId++)
{
- Ptr<NdnNetDeviceFace> face = DynamicCast<NdnNetDeviceFace> (ndn->GetFace (faceId));
+ Ptr<NetDeviceFace> face = DynamicCast<NetDeviceFace> (ndn->GetFace (faceId));
if (face == 0)
{
NS_LOG_DEBUG ("Skipping non-netdevice face");
@@ -82,7 +83,7 @@
Ptr<NetDevice> nd = face->GetNetDevice ();
if (nd == 0)
{
- NS_LOG_DEBUG ("Not a NetDevice associated with NdnNetDeviceFace");
+ NS_LOG_DEBUG ("Not a NetDevice associated with NetDeviceFace");
continue;
}
@@ -104,24 +105,24 @@
Ptr<Node> otherNode = otherSide->GetNode ();
NS_ASSERT (otherNode != 0);
- Ptr<NdnGlobalRouter> otherGr = otherNode->GetObject<NdnGlobalRouter> ();
+ Ptr<GlobalRouter> otherGr = otherNode->GetObject<GlobalRouter> ();
if (otherGr == 0)
{
Install (otherNode);
}
- otherGr = otherNode->GetObject<NdnGlobalRouter> ();
+ otherGr = otherNode->GetObject<GlobalRouter> ();
NS_ASSERT (otherGr != 0);
gr->AddIncidency (face, otherGr);
}
}
else
{
- Ptr<NdnGlobalRouter> grChannel = ch->GetObject<NdnGlobalRouter> ();
+ Ptr<GlobalRouter> grChannel = ch->GetObject<GlobalRouter> ();
if (grChannel == 0)
{
Install (ch);
}
- grChannel = ch->GetObject<NdnGlobalRouter> ();
+ grChannel = ch->GetObject<GlobalRouter> ();
gr->AddIncidency (0, grChannel);
}
@@ -129,15 +130,15 @@
}
void
-NdnGlobalRoutingHelper::Install (Ptr<Channel> channel)
+GlobalRoutingHelper::Install (Ptr<Channel> channel)
{
NS_LOG_LOGIC ("Channel: " << channel->GetId ());
- Ptr<NdnGlobalRouter> gr = channel->GetObject<NdnGlobalRouter> ();
+ Ptr<GlobalRouter> gr = channel->GetObject<GlobalRouter> ();
if (gr != 0)
return;
- gr = CreateObject<NdnGlobalRouter> ();
+ gr = CreateObject<GlobalRouter> ();
channel->AggregateObject (gr);
for (uint32_t deviceId = 0; deviceId < channel->GetNDevices (); deviceId ++)
@@ -147,12 +148,12 @@
Ptr<Node> node = dev->GetNode ();
NS_ASSERT (node != 0);
- Ptr<NdnGlobalRouter> grOther = node->GetObject<NdnGlobalRouter> ();
+ Ptr<GlobalRouter> grOther = node->GetObject<GlobalRouter> ();
if (grOther == 0)
{
Install (node);
}
- grOther = node->GetObject<NdnGlobalRouter> ();
+ grOther = node->GetObject<GlobalRouter> ();
NS_ASSERT (grOther != 0);
gr->AddIncidency (0, grOther);
@@ -160,7 +161,7 @@
}
void
-NdnGlobalRoutingHelper::Install (const NodeContainer &nodes)
+GlobalRoutingHelper::Install (const NodeContainer &nodes)
{
for (NodeContainer::Iterator node = nodes.Begin ();
node != nodes.End ();
@@ -171,25 +172,25 @@
}
void
-NdnGlobalRoutingHelper::InstallAll ()
+GlobalRoutingHelper::InstallAll ()
{
Install (NodeContainer::GetGlobal ());
}
void
-NdnGlobalRoutingHelper::AddOrigin (const std::string &prefix, Ptr<Node> node)
+GlobalRoutingHelper::AddOrigin (const std::string &prefix, Ptr<Node> node)
{
- Ptr<NdnGlobalRouter> gr = node->GetObject<NdnGlobalRouter> ();
+ Ptr<GlobalRouter> gr = node->GetObject<GlobalRouter> ();
NS_ASSERT_MSG (gr != 0,
- "NdnGlobalRouter is not installed on the node");
+ "GlobalRouter is not installed on the node");
- Ptr<NdnNameComponents> name = Create<NdnNameComponents> (boost::lexical_cast<NdnNameComponents> (prefix));
+ Ptr<NameComponents> name = Create<NameComponents> (boost::lexical_cast<NameComponents> (prefix));
gr->AddLocalPrefix (name);
}
void
-NdnGlobalRoutingHelper::AddOrigins (const std::string &prefix, const NodeContainer &nodes)
+GlobalRoutingHelper::AddOrigins (const std::string &prefix, const NodeContainer &nodes)
{
for (NodeContainer::Iterator node = nodes.Begin ();
node != nodes.End ();
@@ -200,7 +201,7 @@
}
void
-NdnGlobalRoutingHelper::AddOrigin (const std::string &prefix, const std::string &nodeName)
+GlobalRoutingHelper::AddOrigin (const std::string &prefix, const std::string &nodeName)
{
Ptr<Node> node = Names::Find<Node> (nodeName);
NS_ASSERT_MSG (node != 0, nodeName << "is not a Node");
@@ -209,7 +210,7 @@
}
void
-NdnGlobalRoutingHelper::CalculateRoutes ()
+GlobalRoutingHelper::CalculateRoutes ()
{
/**
* Implementation of route calculation is heavily based on Boost Graph Library
@@ -227,10 +228,10 @@
// is not obviously how implement in an efficient manner
for (NodeList::Iterator node = NodeList::Begin (); node != NodeList::End (); node++)
{
- Ptr<NdnGlobalRouter> source = (*node)->GetObject<NdnGlobalRouter> ();
+ Ptr<GlobalRouter> source = (*node)->GetObject<GlobalRouter> ();
if (source == 0)
{
- NS_LOG_DEBUG ("Node " << (*node)->GetId () << " does not export NdnGlobalRouter interface");
+ NS_LOG_DEBUG ("Node " << (*node)->GetId () << " does not export GlobalRouter interface");
continue;
}
@@ -252,7 +253,7 @@
// NS_LOG_DEBUG (predecessors.size () << ", " << distances.size ());
- Ptr<NdnFib> fib = source->GetObject<NdnFib> ();
+ Ptr<Fib> fib = source->GetObject<Fib> ();
fib->InvalidateAll ();
NS_ASSERT (fib != 0);
@@ -275,7 +276,7 @@
// cout << " reachable via face " << *i->second.get<0> ()
// << " with distance " << i->second.get<1> () << endl;
- BOOST_FOREACH (const Ptr<const NdnNameComponents> &prefix, i->first->GetLocalPrefixes ())
+ BOOST_FOREACH (const Ptr<const NameComponents> &prefix, i->first->GetLocalPrefixes ())
{
fib->Add (prefix, i->second.get<0> (), i->second.get<1> ());
}
@@ -286,4 +287,5 @@
}
-}
+} // namespace ndn
+} // namespace ns3
diff --git a/helper/ndn-global-routing-helper.h b/helper/ndn-global-routing-helper.h
index ac92641..17493d2 100644
--- a/helper/ndn-global-routing-helper.h
+++ b/helper/ndn-global-routing-helper.h
@@ -29,36 +29,38 @@
class NodeContainer;
class Channel;
+namespace ndn {
+
/**
* @ingroup ndn
- * @brief Helper for NdnGlobalRouter interface
+ * @brief Helper for GlobalRouter interface
*/
-class NdnGlobalRoutingHelper
+class GlobalRoutingHelper
{
public:
/**
- * @brief Install NdnGlobalRouter interface on a node
+ * @brief Install GlobalRouter interface on a node
*
- * Note that NdnGlobalRouter will also be installed on all connected nodes and channels
+ * Note that GlobalRouter will also be installed on all connected nodes and channels
*
- * @param node Node to install NdnGlobalRouter interface
+ * @param node Node to install GlobalRouter interface
*/
void
Install (Ptr<Node> node);
/**
- * @brief Install NdnGlobalRouter interface on nodes
+ * @brief Install GlobalRouter interface on nodes
*
- * Note that NdnGlobalRouter will also be installed on all connected nodes and channels
+ * Note that GlobalRouter will also be installed on all connected nodes and channels
*
- * @param nodes NodeContainer to install NdnGlobalRouter interface
+ * @param nodes NodeContainer to install GlobalRouter interface
*/
void
Install (const NodeContainer &nodes);
/**
- * @brief Install NdnGlobalRouter interface on all nodes
+ * @brief Install GlobalRouter interface on all nodes
*/
void
InstallAll ();
@@ -98,6 +100,7 @@
Install (Ptr<Channel> channel);
};
-}
+} // namespace ndn
+} // namespace ns3
#endif // NDN_GLOBAL_ROUTING_HELPER_H
diff --git a/helper/ndn-header-helper.cc b/helper/ndn-header-helper.cc
index 58f8dde..8121764 100644
--- a/helper/ndn-header-helper.cc
+++ b/helper/ndn-header-helper.cc
@@ -29,32 +29,39 @@
#include "ns3/ndn-content-object-header.h"
#include <iomanip>
-NS_LOG_COMPONENT_DEFINE ("NdnHeaderHelper");
+NS_LOG_COMPONENT_DEFINE ("ndn.HeaderHelper");
+
+#define INTEREST_BYTE0 0x01
+#define INTEREST_BYTE1 0xD2
+
+#define CONTENT_OBJECT_BYTE0 0x04
+#define CONTENT_OBJECT_BYTE1 0x82
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NdnHeaderHelper::Type
-NdnHeaderHelper::GetNdnHeaderType (Ptr<const Packet> packet)
+HeaderHelper::Type
+HeaderHelper::GetNdnHeaderType (Ptr<const Packet> packet)
{
uint8_t type[2];
uint32_t read=packet->CopyData (type,2);
- if (read!=2) throw NdnUnknownHeaderException();
+ if (read!=2) throw UnknownHeaderException();
NS_LOG_DEBUG (*packet);
if (type[0] == INTEREST_BYTE0 && type[1] == INTEREST_BYTE1)
{
- return NdnHeaderHelper::INTEREST;
+ return HeaderHelper::INTEREST;
}
else if (type[0] == CONTENT_OBJECT_BYTE0 && type[1] == CONTENT_OBJECT_BYTE1)
{
- return NdnHeaderHelper::CONTENT_OBJECT;
+ return HeaderHelper::CONTENT_OBJECT;
}
NS_LOG_DEBUG (*packet);
- throw NdnUnknownHeaderException();
+ throw UnknownHeaderException();
}
+} // namespace ndn
} // namespace ns3
diff --git a/helper/ndn-header-helper.h b/helper/ndn-header-helper.h
index 7f2e111..47d8ed4 100644
--- a/helper/ndn-header-helper.h
+++ b/helper/ndn-header-helper.h
@@ -23,18 +23,13 @@
#include "ns3/ptr.h"
-#define INTEREST_BYTE0 0x01
-#define INTEREST_BYTE1 0xD2
-
-#define CONTENT_OBJECT_BYTE0 0x04
-#define CONTENT_OBJECT_BYTE1 0x82
-
-namespace ns3
-{
+namespace ns3 {
class Header;
class Packet;
+namespace ndn {
+
/**
* \ingroup ndn-helpers
*
@@ -43,11 +38,11 @@
*
* Ndn doesn't really have a header, so we need this class to
* determine type of Ndn packet and return corresponent header class,
- * NdnInterestHeader or NdnContentObjectHeader
+ * InterestHeader or ContentObjectHeader
*
- * Throws NdnUnknownHeaderException if header type couldn't be determined
+ * Throws UnknownHeaderException if header type couldn't be determined
*/
-class NdnHeaderHelper
+class HeaderHelper
{
public:
/**
@@ -89,8 +84,9 @@
* \brief Exception thrown if Ndn stack receives unrecognized
* message type
*/
-class NdnUnknownHeaderException {};
+class UnknownHeaderException {};
+} // namespace ndn
} // namespace ns3
#endif // _NDN_HEADER_HELPER_H_
diff --git a/helper/ndn-stack-helper.cc b/helper/ndn-stack-helper.cc
index 6b0a022..d88eeb2 100644
--- a/helper/ndn-stack-helper.cc
+++ b/helper/ndn-stack-helper.cc
@@ -56,30 +56,31 @@
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
-NS_LOG_COMPONENT_DEFINE ("NdnStackHelper");
+NS_LOG_COMPONENT_DEFINE ("ndn.StackHelper");
namespace ns3 {
+namespace ndn {
-NdnStackHelper::NdnStackHelper ()
+StackHelper::StackHelper ()
: m_limitsEnabled (false)
, m_needSetDefaultRoutes (false)
{
- m_ndnFactory. SetTypeId ("ns3::NdnL3Protocol");
- m_strategyFactory. SetTypeId ("ns3::ndnSIM::Flooding");
- m_contentStoreFactory.SetTypeId ("ns3::NdnContentStoreLru");
- m_fibFactory. SetTypeId ("ns3::NdnFib");
- m_pitFactory. SetTypeId ("ns3::NdnPit");
+ m_ndnFactory. SetTypeId ("ns3::ndn::L3Protocol");
+ m_strategyFactory. SetTypeId ("ns3::ndn::fw::Flooding");
+ m_contentStoreFactory.SetTypeId ("ns3::ndn::cs::Lru");
+ m_fibFactory. SetTypeId ("ns3::ndn::fib::Default");
+ m_pitFactory. SetTypeId ("ns3::ndn::pit::Persistent");
}
-NdnStackHelper::~NdnStackHelper ()
+StackHelper::~StackHelper ()
{
}
void
-NdnStackHelper::SetNdnAttributes (const std::string &attr1, const std::string &value1,
- const std::string &attr2, const std::string &value2,
- const std::string &attr3, const std::string &value3,
- const std::string &attr4, const std::string &value4)
+StackHelper::SetStackAttributes (const std::string &attr1, const std::string &value1,
+ const std::string &attr2, const std::string &value2,
+ const std::string &attr3, const std::string &value3,
+ const std::string &attr4, const std::string &value4)
{
if (attr1 != "")
m_ndnFactory.Set (attr1, StringValue (value1));
@@ -92,7 +93,7 @@
}
void
-NdnStackHelper::SetForwardingStrategy (const std::string &strategy,
+StackHelper::SetForwardingStrategy (const std::string &strategy,
const std::string &attr1, const std::string &value1,
const std::string &attr2, const std::string &value2,
const std::string &attr3, const std::string &value3,
@@ -110,7 +111,7 @@
}
void
-NdnStackHelper::SetContentStore (const std::string &contentStore,
+StackHelper::SetContentStore (const std::string &contentStore,
const std::string &attr1, const std::string &value1,
const std::string &attr2, const std::string &value2,
const std::string &attr3, const std::string &value3,
@@ -128,7 +129,7 @@
}
void
-NdnStackHelper::SetPit (const std::string &pitClass,
+StackHelper::SetPit (const std::string &pitClass,
const std::string &attr1, const std::string &value1,
const std::string &attr2, const std::string &value2,
const std::string &attr3, const std::string &value3,
@@ -146,7 +147,7 @@
}
void
-NdnStackHelper::SetFib (const std::string &fibClass,
+StackHelper::SetFib (const std::string &fibClass,
const std::string &attr1, const std::string &value1,
const std::string &attr2, const std::string &value2,
const std::string &attr3, const std::string &value3,
@@ -164,14 +165,14 @@
}
void
-NdnStackHelper::SetDefaultRoutes (bool needSet)
+StackHelper::SetDefaultRoutes (bool needSet)
{
NS_LOG_FUNCTION (this << needSet);
m_needSetDefaultRoutes = needSet;
}
void
-NdnStackHelper::EnableLimits (bool enable/* = true*/,
+StackHelper::EnableLimits (bool enable/* = true*/,
Time avgRtt/*=Seconds(0.1)*/,
uint32_t avgContentObject/*=1100*/,
uint32_t avgInterest/*=40*/)
@@ -183,10 +184,10 @@
m_avgInterestSize = avgInterest;
}
-Ptr<NdnFaceContainer>
-NdnStackHelper::Install (NodeContainer c) const
+Ptr<FaceContainer>
+StackHelper::Install (NodeContainer c) const
{
- Ptr<NdnFaceContainer> faces = Create<NdnFaceContainer> ();
+ Ptr<FaceContainer> faces = Create<FaceContainer> ();
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
faces->AddAll (Install (*i));
@@ -194,42 +195,42 @@
return faces;
}
-Ptr<NdnFaceContainer>
-NdnStackHelper::InstallAll (void) const
+Ptr<FaceContainer>
+StackHelper::InstallAll (void) const
{
return Install (NodeContainer::GetGlobal ());
}
-Ptr<NdnFaceContainer>
-NdnStackHelper::Install (Ptr<Node> node) const
+Ptr<FaceContainer>
+StackHelper::Install (Ptr<Node> node) const
{
// NS_ASSERT_MSG (m_forwarding, "SetForwardingHelper() should be set prior calling Install() method");
- Ptr<NdnFaceContainer> faces = Create<NdnFaceContainer> ();
+ Ptr<FaceContainer> faces = Create<FaceContainer> ();
- if (node->GetObject<Ndn> () != 0)
+ if (node->GetObject<L3Protocol> () != 0)
{
- NS_FATAL_ERROR ("NdnStackHelper::Install (): Installing "
+ NS_FATAL_ERROR ("StackHelper::Install (): Installing "
"a NdnStack to a node with an existing Ndn object");
return 0;
}
- // Create NdnL3Protocol
- Ptr<Ndn> ndn = m_ndnFactory.Create<Ndn> ();
+ // Create L3Protocol
+ Ptr<L3Protocol> ndn = m_ndnFactory.Create<L3Protocol> ();
// Create and aggregate FIB
- Ptr<NdnFib> fib = m_fibFactory.Create<NdnFib> ();
+ Ptr<Fib> fib = m_fibFactory.Create<Fib> ();
ndn->AggregateObject (fib);
// Create and aggregate PIT
- ndn->AggregateObject (m_pitFactory.Create<NdnPit> ());
+ ndn->AggregateObject (m_pitFactory.Create<Pit> ());
// Create and aggregate forwarding strategy
- ndn->AggregateObject (m_strategyFactory.Create<NdnForwardingStrategy> ());
+ ndn->AggregateObject (m_strategyFactory.Create<ForwardingStrategy> ());
// Create and aggregate content store
- ndn->AggregateObject (m_contentStoreFactory.Create<NdnContentStore> ());
+ ndn->AggregateObject (m_contentStoreFactory.Create<ContentStore> ());
- // Aggregate NdnL3Protocol on node
+ // Aggregate L3Protocol on node
node->AggregateObject (ndn);
for (uint32_t index=0; index < node->GetNDevices (); index++)
@@ -240,10 +241,10 @@
// if (DynamicCast<LoopbackNetDevice> (device) != 0)
// continue; // don't create face for a LoopbackNetDevice
- Ptr<NdnNetDeviceFace> face = CreateObject<NdnNetDeviceFace> (node, device);
+ Ptr<NetDeviceFace> face = CreateObject<NetDeviceFace> (node, device);
ndn->AddFace (face);
- NS_LOG_LOGIC ("Node " << node->GetId () << ": added NdnNetDeviceFace as face #" << *face);
+ NS_LOG_LOGIC ("Node " << node->GetId () << ": added NetDeviceFace as face #" << *face);
if (m_needSetDefaultRoutes)
{
@@ -282,8 +283,8 @@
return faces;
}
-Ptr<NdnFaceContainer>
-NdnStackHelper::Install (std::string nodeName) const
+Ptr<FaceContainer>
+StackHelper::Install (std::string nodeName) const
{
Ptr<Node> node = Names::Find<Node> (nodeName);
return Install (node);
@@ -291,43 +292,43 @@
void
-NdnStackHelper::AddRoute (Ptr<Node> node, std::string prefix, Ptr<NdnFace> face, int32_t metric)
+StackHelper::AddRoute (Ptr<Node> node, std::string prefix, Ptr<Face> face, int32_t metric)
{
NS_LOG_LOGIC ("[" << node->GetId () << "]$ route add " << prefix << " via " << *face << " metric " << metric);
- Ptr<NdnFib> fib = node->GetObject<NdnFib> ();
+ Ptr<Fib> fib = node->GetObject<Fib> ();
- NdnNameComponentsValue prefixValue;
- prefixValue.DeserializeFromString (prefix, MakeNdnNameComponentsChecker ());
+ NameComponentsValue prefixValue;
+ prefixValue.DeserializeFromString (prefix, MakeNameComponentsChecker ());
fib->Add (prefixValue.Get (), face, metric);
}
void
-NdnStackHelper::AddRoute (Ptr<Node> node, std::string prefix, uint32_t faceId, int32_t metric)
+StackHelper::AddRoute (Ptr<Node> node, std::string prefix, uint32_t faceId, int32_t metric)
{
- Ptr<Ndn> ndn = node->GetObject<Ndn> ();
+ Ptr<L3Protocol> ndn = node->GetObject<L3Protocol> ();
NS_ASSERT_MSG (ndn != 0, "Ndn stack should be installed on the node");
- Ptr<NdnFace> face = ndn->GetFace (faceId);
+ Ptr<Face> face = ndn->GetFace (faceId);
NS_ASSERT_MSG (face != 0, "Face with ID [" << faceId << "] does not exist on node [" << node->GetId () << "]");
AddRoute (node, prefix, face, metric);
}
void
-NdnStackHelper::AddRoute (std::string nodeName, std::string prefix, uint32_t faceId, int32_t metric)
+StackHelper::AddRoute (std::string nodeName, std::string prefix, uint32_t faceId, int32_t metric)
{
Ptr<Node> node = Names::Find<Node> (nodeName);
NS_ASSERT_MSG (node != 0, "Node [" << nodeName << "] does not exist");
- Ptr<Ndn> ndn = node->GetObject<Ndn> ();
+ Ptr<L3Protocol> ndn = node->GetObject<L3Protocol> ();
NS_ASSERT_MSG (ndn != 0, "Ndn stack should be installed on the node");
- Ptr<NdnFace> face = ndn->GetFace (faceId);
+ Ptr<Face> face = ndn->GetFace (faceId);
NS_ASSERT_MSG (face != 0, "Face with ID [" << faceId << "] does not exist on node [" << nodeName << "]");
AddRoute (node, prefix, face, metric);
}
-
+} // namespace ndn
} // namespace ns3
diff --git a/helper/ndn-stack-helper.h b/helper/ndn-stack-helper.h
index 0bd69ad..3b7e3cf 100644
--- a/helper/ndn-stack-helper.h
+++ b/helper/ndn-stack-helper.h
@@ -30,8 +30,11 @@
namespace ns3 {
class Node;
-class NdnFaceContainer;
-class NdnFace;
+
+namespace ndn {
+
+class FaceContainer;
+class Face;
/**
* \ingroup ndn
@@ -54,27 +57,27 @@
* attribute or a set of functionality that may be of interest to many other
* classes.
*/
-class NdnStackHelper
+class StackHelper
{
public:
/**
* \brief Create a new NdnStackHelper with a default NDN_FLOODING forwarding stategy
*/
- NdnStackHelper();
+ StackHelper();
/**
* \brief Destroy the NdnStackHelper
*/
- virtual ~NdnStackHelper ();
+ virtual ~StackHelper ();
/**
* @brief Set parameters of NdnL3Protocol
*/
void
- SetNdnAttributes (const std::string &attr1 = "", const std::string &value1 = "",
- const std::string &attr2 = "", const std::string &value2 = "",
- const std::string &attr3 = "", const std::string &value3 = "",
- const std::string &attr4 = "", const std::string &value4 = "");
+ SetStackAttributes (const std::string &attr1 = "", const std::string &value1 = "",
+ const std::string &attr2 = "", const std::string &value2 = "",
+ const std::string &attr3 = "", const std::string &value3 = "",
+ const std::string &attr4 = "", const std::string &value4 = "");
/**
@@ -147,7 +150,7 @@
* \returns list of installed faces in the form of a smart pointer
* to NdnFaceContainer object
*/
- Ptr<NdnFaceContainer>
+ Ptr<FaceContainer>
Install (std::string nodeName) const;
/**
@@ -159,9 +162,9 @@
* \param node The node on which to install the stack.
*
* \returns list of installed faces in the form of a smart pointer
- * to NdnFaceContainer object
+ * to FaceContainer object
*/
- Ptr<NdnFaceContainer>
+ Ptr<FaceContainer>
Install (Ptr<Node> node) const;
/**
@@ -174,18 +177,18 @@
* new stacks.
*
* \returns list of installed faces in the form of a smart pointer
- * to NdnFaceContainer object
+ * to FaceContainer object
*/
- Ptr<NdnFaceContainer>
+ Ptr<FaceContainer>
Install (NodeContainer c) const;
/**
* \brief Install Ndn stack on all nodes in the simulation
*
* \returns list of installed faces in the form of a smart pointer
- * to NdnFaceContainer object
+ * to FaceContainer object
*/
- Ptr<NdnFaceContainer>
+ Ptr<FaceContainer>
InstallAll () const;
/**
@@ -219,7 +222,7 @@
* \param metric Routing metric
*/
static void
- AddRoute (Ptr<Node> node, std::string prefix, Ptr<NdnFace> face, int32_t metric);
+ AddRoute (Ptr<Node> node, std::string prefix, Ptr<Face> face, int32_t metric);
/**
* \brief Set flag indicating necessity to install default routes in FIB
@@ -228,8 +231,8 @@
SetDefaultRoutes (bool needSet);
private:
- NdnStackHelper (const NdnStackHelper &);
- NdnStackHelper &operator = (const NdnStackHelper &o);
+ StackHelper (const StackHelper &);
+ StackHelper &operator = (const StackHelper &o);
private:
ObjectFactory m_ndnFactory;
@@ -245,6 +248,7 @@
bool m_needSetDefaultRoutes;
};
+} // namespace ndn
} // namespace ns3
#endif /* NDN_STACK_HELPER_H */
diff --git a/model/content-store/ndn-content-store-impl.h b/model/content-store/ndn-content-store-impl.h
deleted file mode 100644
index 0140f58..0000000
--- a/model/content-store/ndn-content-store-impl.h
+++ /dev/null
@@ -1,107 +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>
- */
-
-#ifndef NDN_CONTENT_STORE_IMPL_H_
-#define NDN_CONTENT_STORE_IMPL_H_
-
-#include "ndn-content-store.h"
-#include "ns3/packet.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
-#include <boost/foreach.hpp>
-
-namespace ns3
-{
-
-template<class Container>
-class NdnContentStoreImpl : public NdnContentStore,
- protected Container
-{
-public:
- // from NdnContentStore
-
- virtual inline boost::tuple<Ptr<Packet>, Ptr<const NdnContentObjectHeader>, Ptr<const Packet> >
- Lookup (Ptr<const NdnInterestHeader> interest);
-
- virtual inline bool
- Add (Ptr<const NdnContentObjectHeader> header, Ptr<const Packet> packet);
-
- // virtual bool
- // Remove (Ptr<NdnInterestHeader> header);
-
- virtual inline void
- Print (std::ostream &os) const;
-};
-
-
-template<class Container>
-boost::tuple<Ptr<Packet>, Ptr<const NdnContentObjectHeader>, Ptr<const Packet> >
-NdnContentStoreImpl<Container>::Lookup (Ptr<const NdnInterestHeader> interest)
-{
- // NS_LOG_FUNCTION (this << interest->GetName ());
-
- /// @todo Change to search with predicate
- typename Container::const_iterator node = this->deepest_prefix_match (interest->GetName ());
-
- if (node != this->end ())
- {
- this->m_cacheHitsTrace (interest, node->payload ()->GetHeader ());
-
- // NS_LOG_DEBUG ("cache hit with " << node->payload ()->GetHeader ()->GetName ());
- return boost::make_tuple (node->payload ()->GetFullyFormedNdnPacket (),
- node->payload ()->GetHeader (),
- node->payload ()->GetPacket ());
- }
- else
- {
- // NS_LOG_DEBUG ("cache miss for " << interest->GetName ());
- this->m_cacheMissesTrace (interest);
- return boost::tuple<Ptr<Packet>, Ptr<NdnContentObjectHeader>, Ptr<Packet> > (0, 0, 0);
- }
-}
-
-template<class Container>
-bool
-NdnContentStoreImpl<Container>::Add (Ptr<const NdnContentObjectHeader> header, Ptr<const Packet> packet)
-{
- // NS_LOG_FUNCTION (this << header->GetName ());
-
- return
- this->insert (header->GetName (), Create<NdnContentStoreEntry> (header, packet))
- .second;
-}
-
-template<class Container>
-void
-NdnContentStoreImpl<Container>::Print (std::ostream &os) const
-{
- for (typename Container::policy_container::const_iterator item = this->getPolicy ().begin ();
- item != this->getPolicy ().end ();
- item++)
- // BOOST_FOREACH (const typename Container::parent_trie &item, this->getPolicy ())
- {
- os << item->payload ()->GetName () << std::endl;
- }
-}
-
-
-} // namespace ns3
-
-#endif // NDN_CONTENT_STORE_IMPL_H_
diff --git a/model/content-store/ndn-content-store-policies.cc b/model/content-store/ndn-content-store-policies.cc
deleted file mode 100644
index a474461..0000000
--- a/model/content-store/ndn-content-store-policies.cc
+++ /dev/null
@@ -1,173 +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 "ndn-content-store-policies.h"
-#include "ns3/log.h"
-#include "ns3/uinteger.h"
-
-NS_LOG_COMPONENT_DEFINE ("NdnContentStorePolicies");
-
-namespace ns3
-{
-
-////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////
-// LRU policy
-////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////
-
-NS_OBJECT_ENSURE_REGISTERED (NdnContentStoreLru);
-
-TypeId
-NdnContentStoreLru::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::NdnContentStoreLru")
- .SetGroupName ("Ndn")
- .SetParent< NdnContentStore > ()
- .AddConstructor<NdnContentStoreLru> ()
- .AddAttribute ("Size",
- "Maximum number of packets that content storage can hold",
- UintegerValue (100),
- MakeUintegerAccessor (&NdnContentStoreLru::SetMaxSize,
- &NdnContentStoreLru::GetMaxSize),
- MakeUintegerChecker<uint32_t> ())
- ;
-
- return tid;
-}
-
-void
-NdnContentStoreLru::SetMaxSize (uint32_t maxSize)
-{
- getPolicy ().set_max_size (maxSize);
-}
-
-uint32_t
-NdnContentStoreLru::GetMaxSize () const
-{
- return getPolicy ().get_max_size ();
-}
-
-NdnContentStoreLru::NdnContentStoreLru ()
-{
-}
-
-NdnContentStoreLru::~NdnContentStoreLru ()
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////
-// RANDOM policy
-////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////
-
-NS_OBJECT_ENSURE_REGISTERED (NdnContentStoreRandom);
-
-TypeId
-NdnContentStoreRandom::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::NdnContentStoreRandom")
- .SetGroupName ("Ndn")
- .SetParent< NdnContentStore > ()
- .AddConstructor<NdnContentStoreRandom> ()
-
- .AddAttribute ("Size",
- "Maximum number of packets that content storage can hold",
- UintegerValue (100),
- MakeUintegerAccessor (&NdnContentStoreRandom::SetMaxSize,
- &NdnContentStoreRandom::GetMaxSize),
- MakeUintegerChecker<uint32_t> ())
- ;
-
- return tid;
-}
-
-void
-NdnContentStoreRandom::SetMaxSize (uint32_t maxSize)
-{
- getPolicy ().set_max_size (maxSize);
-}
-
-uint32_t
-NdnContentStoreRandom::GetMaxSize () const
-{
- return getPolicy ().get_max_size ();
-}
-
-NdnContentStoreRandom::NdnContentStoreRandom ()
-{
-}
-
-NdnContentStoreRandom::~NdnContentStoreRandom ()
-{
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////
-// FIFO policy
-////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////
-
-NS_OBJECT_ENSURE_REGISTERED (NdnContentStoreFifo);
-
-TypeId
-NdnContentStoreFifo::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::NdnContentStoreFifo")
- .SetGroupName ("Ndn")
- .SetParent< NdnContentStore > ()
- .AddConstructor<NdnContentStoreFifo> ()
-
- .AddAttribute ("Size",
- "Maximum number of packets that content storage can hold",
- UintegerValue (100),
- MakeUintegerAccessor (&NdnContentStoreFifo::SetMaxSize,
- &NdnContentStoreFifo::GetMaxSize),
- MakeUintegerChecker<uint32_t> ())
- ;
-
- return tid;
-}
-
-void
-NdnContentStoreFifo::SetMaxSize (uint32_t maxSize)
-{
- getPolicy ().set_max_size (maxSize);
-}
-
-uint32_t
-NdnContentStoreFifo::GetMaxSize () const
-{
- return getPolicy ().get_max_size ();
-}
-
-NdnContentStoreFifo::NdnContentStoreFifo ()
-{
-}
-
-NdnContentStoreFifo::~NdnContentStoreFifo ()
-{
-}
-
-
-} // namespace ns3
-
diff --git a/model/content-store/ndn-content-store-policies.h b/model/content-store/ndn-content-store-policies.h
deleted file mode 100644
index 506dc72..0000000
--- a/model/content-store/ndn-content-store-policies.h
+++ /dev/null
@@ -1,142 +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>
- * Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#ifndef NDN_CONTENT_STORE_POLICIES_H
-#define NDN_CONTENT_STORE_POLICIES_H
-
-// #include "ns3/ndn.h"
-
-#include "ndn-content-store-impl.h"
-
-#include "../../utils/trie.h"
-#include "../../utils/trie-with-policy.h"
-
-#include "../../utils/lru-policy.h"
-#include "../../utils/random-policy.h"
-#include "../../utils/fifo-policy.h"
-
-namespace ns3
-{
-
-/**
- * \ingroup ndn
- * \brief Content Store with LRU replacement policy
- */
-class NdnContentStoreLru :
- public NdnContentStoreImpl<
- ndnSIM::trie_with_policy<NdnNameComponents,
- ndnSIM::smart_pointer_payload_traits<NdnContentStoreEntry>,
- ndnSIM::lru_policy_traits >
- >
-{
-public:
- /**
- * \brief Interface ID
- *
- * \return interface ID
- */
- static TypeId GetTypeId ();
-
- /**
- * Default constructor
- */
- NdnContentStoreLru ();
- virtual ~NdnContentStoreLru ();
-
-private:
- void
- SetMaxSize (uint32_t maxSize);
-
- uint32_t
- GetMaxSize () const;
-};
-
-
-/**
- * \ingroup ndn
- * \brief Content Store with RANDOM replacement policy
- */
-class NdnContentStoreRandom :
- public NdnContentStoreImpl<
- ndnSIM::trie_with_policy<NdnNameComponents,
- ndnSIM::smart_pointer_payload_traits<NdnContentStoreEntry>,
- ndnSIM::random_policy_traits >
- >
-{
-public:
- /**
- * \brief Interface ID
- *
- * \return interface ID
- */
- static TypeId GetTypeId ();
-
- /**
- * Default constructor
- */
- NdnContentStoreRandom ();
- virtual ~NdnContentStoreRandom ();
-
-private:
- void
- SetMaxSize (uint32_t maxSize);
-
- uint32_t
- GetMaxSize () const;
-};
-
-/**
- * \ingroup ndn
- * \brief Content Store with FIFO replacement policy
- */
-class NdnContentStoreFifo :
- public NdnContentStoreImpl<
- ndnSIM::trie_with_policy<NdnNameComponents,
- ndnSIM::smart_pointer_payload_traits<NdnContentStoreEntry>,
- ndnSIM::fifo_policy_traits >
- >
-{
-public:
- /**
- * \brief Interface ID
- *
- * \return interface ID
- */
- static TypeId GetTypeId ();
-
- /**
- * Default constructor
- */
- NdnContentStoreFifo ();
- virtual ~NdnContentStoreFifo ();
-
-private:
- void
- SetMaxSize (uint32_t maxSize);
-
- uint32_t
- GetMaxSize () const;
-};
-
-
-} //namespace ns3
-
-#endif // NDN_CONTENT_STORE_POLICIES_H
diff --git a/model/cs/content-store-impl.cc b/model/cs/content-store-impl.cc
new file mode 100644
index 0000000..fe6346b
--- /dev/null
+++ b/model/cs/content-store-impl.cc
@@ -0,0 +1,188 @@
+/* -*- 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 "content-store-impl.h"
+#include "ns3/log.h"
+#include "ns3/uinteger.h"
+#include "ns3/string.h"
+
+#include "../../utils/random-policy.h"
+#include "../../utils/lru-policy.h"
+#include "../../utils/fifo-policy.h"
+
+NS_LOG_COMPONENT_DEFINE ("ndn.cs.ContentStoreImpl");
+
+#define NS_OBJECT_ENSURE_REGISTERED_TEMPL(type, templ) \
+ static struct X ## type ## templ ## RegistrationClass \
+ { \
+ X ## type ## templ ## RegistrationClass () { \
+ ns3::TypeId tid = type<templ>::GetTypeId (); \
+ tid.GetParent (); \
+ } \
+ } x_ ## type ## templ ## RegistrationVariable
+
+namespace ns3 {
+namespace ndn {
+
+using namespace ndnSIM;
+
+namespace cs {
+
+
+template<>
+TypeId
+ContentStoreImpl< lru_policy_traits >::GetTypeId ()
+{
+ static TypeId tid = TypeId ("ns3::ndn::cs::Lru")
+ .SetGroupName ("Ndn")
+ .SetParent<ContentStore> ()
+ .AddConstructor< ContentStoreImpl< lru_policy_traits > > ()
+ .AddAttribute ("MaxSize",
+ "Set maximum number of entries in ContentStore. If 0, limit is not enforced",
+ StringValue ("100"),
+ MakeUintegerAccessor (&ContentStoreImpl< lru_policy_traits >::GetMaxSize,
+ &ContentStoreImpl< lru_policy_traits >::SetMaxSize),
+ MakeUintegerChecker<uint32_t> ())
+ ;
+
+ return tid;
+}
+
+template<>
+TypeId
+ContentStoreImpl< random_policy_traits >::GetTypeId ()
+{
+ static TypeId tid = TypeId ("ns3::ndn::cs::Random")
+ .SetGroupName ("Ndn")
+ .SetParent<ContentStore> ()
+ .AddConstructor< ContentStoreImpl< random_policy_traits > > ()
+ .AddAttribute ("MaxSize",
+ "Set maximum number of entries in ContentStore. If 0, limit is not enforced",
+ StringValue ("100"),
+ MakeUintegerAccessor (&ContentStoreImpl< random_policy_traits >::GetMaxSize,
+ &ContentStoreImpl< random_policy_traits >::SetMaxSize),
+ MakeUintegerChecker<uint32_t> ())
+ ;
+
+ return tid;
+}
+
+template<>
+TypeId
+ContentStoreImpl< fifo_policy_traits >::GetTypeId ()
+{
+ static TypeId tid = TypeId ("ns3::ndn::cs::Fifo")
+ .SetGroupName ("Ndn")
+ .SetParent<ContentStore> ()
+ .AddConstructor< ContentStoreImpl< fifo_policy_traits > > ()
+ .AddAttribute ("MaxSize",
+ "Set maximum number of entries in ContentStore. If 0, limit is not enforced",
+ StringValue ("100"),
+ MakeUintegerAccessor (&ContentStoreImpl< fifo_policy_traits >::GetMaxSize,
+ &ContentStoreImpl< fifo_policy_traits >::SetMaxSize),
+ MakeUintegerChecker<uint32_t> ())
+ ;
+
+ return tid;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+template<class Policy>
+boost::tuple<Ptr<Packet>, Ptr<const ContentObjectHeader>, Ptr<const Packet> >
+ContentStoreImpl<Policy>::Lookup (Ptr<const InterestHeader> interest)
+{
+ // NS_LOG_FUNCTION (this << interest->GetName ());
+
+ /// @todo Change to search with predicate
+ typename super::const_iterator node = this->deepest_prefix_match (interest->GetName ());
+
+ if (node != this->end ())
+ {
+ this->m_cacheHitsTrace (interest, node->payload ()->GetHeader ());
+
+ // NS_LOG_DEBUG ("cache hit with " << node->payload ()->GetHeader ()->GetName ());
+ return boost::make_tuple (node->payload ()->GetFullyFormedNdnPacket (),
+ node->payload ()->GetHeader (),
+ node->payload ()->GetPacket ());
+ }
+ else
+ {
+ // NS_LOG_DEBUG ("cache miss for " << interest->GetName ());
+ this->m_cacheMissesTrace (interest);
+ return boost::tuple<Ptr<Packet>, Ptr<ContentObjectHeader>, Ptr<Packet> > (0, 0, 0);
+ }
+}
+
+template<class Policy>
+bool
+ContentStoreImpl<Policy>::Add (Ptr<const ContentObjectHeader> header, Ptr<const Packet> packet)
+{
+ // NS_LOG_FUNCTION (this << header->GetName ());
+
+ return
+ this->insert (header->GetName (), Create<Entry> (header, packet))
+ .second;
+}
+
+template<class Policy>
+void
+ContentStoreImpl<Policy>::Print (std::ostream &os) const
+{
+ for (typename super::policy_container::const_iterator item = this->getPolicy ().begin ();
+ item != this->getPolicy ().end ();
+ item++)
+ // BOOST_FOREACH (const typename super::parent_trie &item, this->getPolicy ())
+ {
+ os << item->payload ()->GetName () << std::endl;
+ }
+}
+
+template<class Policy>
+void
+ContentStoreImpl<Policy>::SetMaxSize (uint32_t maxSize)
+{
+ this->getPolicy ().set_max_size (maxSize);
+}
+
+template<class Policy>
+uint32_t
+ContentStoreImpl<Policy>::GetMaxSize () const
+{
+ return this->getPolicy ().get_max_size ();
+}
+
+////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
+
+// explicit instantiation and registering
+template class ContentStoreImpl<lru_policy_traits>;
+template class ContentStoreImpl<random_policy_traits>;
+template class ContentStoreImpl<fifo_policy_traits>;
+
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, lru_policy_traits);
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, random_policy_traits);
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, fifo_policy_traits);
+
+
+} // namespace cs
+} // namespace ndn
+} // namespace ns3
diff --git a/model/cs/content-store-impl.h b/model/cs/content-store-impl.h
new file mode 100644
index 0000000..9ba1af5
--- /dev/null
+++ b/model/cs/content-store-impl.h
@@ -0,0 +1,81 @@
+/* -*- 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>
+ */
+
+#ifndef NDN_CONTENT_STORE_IMPL_H_
+#define NDN_CONTENT_STORE_IMPL_H_
+
+#include "ndn-content-store.h"
+#include "ns3/packet.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include <boost/foreach.hpp>
+
+#include "../../utils/trie-with-policy.h"
+
+namespace ns3 {
+namespace ndn {
+namespace cs {
+
+
+template<class Policy>
+class ContentStoreImpl : public ContentStore,
+ protected ndnSIM::trie_with_policy< NameComponents,
+ ndnSIM::smart_pointer_payload_traits< Entry >,
+ Policy >
+{
+private:
+ typedef ndnSIM::trie_with_policy< NameComponents,
+ ndnSIM::smart_pointer_payload_traits< Entry >,
+ Policy > super;
+
+public:
+ static TypeId
+ GetTypeId ();
+
+ ContentStoreImpl () { };
+ virtual ~ContentStoreImpl () { };
+
+ // from ContentStore
+
+ virtual inline boost::tuple<Ptr<Packet>, Ptr<const ContentObjectHeader>, Ptr<const Packet> >
+ Lookup (Ptr<const InterestHeader> interest);
+
+ virtual inline bool
+ Add (Ptr<const ContentObjectHeader> header, Ptr<const Packet> packet);
+
+ // virtual bool
+ // Remove (Ptr<InterestHeader> header);
+
+ virtual inline void
+ Print (std::ostream &os) const;
+
+private:
+ void
+ SetMaxSize (uint32_t maxSize);
+
+ uint32_t
+ GetMaxSize () const;
+};
+
+} // namespace cs
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDN_CONTENT_STORE_IMPL_H_
diff --git a/model/content-store/ndn-content-store.cc b/model/cs/ndn-content-store.cc
similarity index 68%
rename from model/content-store/ndn-content-store.cc
rename to model/cs/ndn-content-store.cc
index 75e9373..bfd4926 100644
--- a/model/content-store/ndn-content-store.cc
+++ b/model/cs/ndn-content-store.cc
@@ -27,47 +27,49 @@
#include "ns3/ndn-interest-header.h"
#include "ns3/ndn-content-object-header.h"
-NS_LOG_COMPONENT_DEFINE ("NdnContentStore");
+NS_LOG_COMPONENT_DEFINE ("ndn.cs.ContentStore");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnContentStore);
+NS_OBJECT_ENSURE_REGISTERED (ContentStore);
TypeId
-NdnContentStore::GetTypeId (void)
+ContentStore::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnContentStore")
+ static TypeId tid = TypeId ("ns3::ndn::ContentStore")
.SetGroupName ("Ndn")
.SetParent<Object> ()
.AddTraceSource ("CacheHits", "Trace called every time there is a cache hit",
- MakeTraceSourceAccessor (&NdnContentStore::m_cacheHitsTrace))
+ MakeTraceSourceAccessor (&ContentStore::m_cacheHitsTrace))
.AddTraceSource ("CacheMisses", "Trace called every time there is a cache miss",
- MakeTraceSourceAccessor (&NdnContentStore::m_cacheMissesTrace))
+ MakeTraceSourceAccessor (&ContentStore::m_cacheMissesTrace))
;
return tid;
}
-NdnContentStore::~NdnContentStore ()
+ContentStore::~ContentStore ()
{
}
+namespace cs {
+
//////////////////////////////////////////////////////////////////////
-NdnContentStoreEntry::NdnContentStoreEntry (Ptr<const NdnContentObjectHeader> header, Ptr<const Packet> packet)
+Entry::Entry (Ptr<const ContentObjectHeader> header, Ptr<const Packet> packet)
: m_header (header)
, m_packet (packet->Copy ())
{
}
Ptr<Packet>
-NdnContentStoreEntry::GetFullyFormedNdnPacket () const
+Entry::GetFullyFormedNdnPacket () const
{
- static NdnContentObjectTail tail; ///< \internal for optimization purposes
+ static ContentObjectTail tail; ///< \internal for optimization purposes
Ptr<Packet> packet = m_packet->Copy ();
packet->AddHeader (*m_header);
@@ -75,22 +77,24 @@
return packet;
}
-const NdnNameComponents&
-NdnContentStoreEntry::GetName () const
+const NameComponents&
+Entry::GetName () const
{
return m_header->GetName ();
}
-Ptr<const NdnContentObjectHeader>
-NdnContentStoreEntry::GetHeader () const
+Ptr<const ContentObjectHeader>
+Entry::GetHeader () const
{
return m_header;
}
Ptr<const Packet>
-NdnContentStoreEntry::GetPacket () const
+Entry::GetPacket () const
{
return m_packet;
}
+} // namespace cs
+} // namespace ndn
} // namespace ns3
diff --git a/model/content-store/ndn-content-store.h b/model/cs/ndn-content-store.h
similarity index 70%
rename from model/content-store/ndn-content-store.h
rename to model/cs/ndn-content-store.h
index 2d4ada6..963c7bc 100644
--- a/model/content-store/ndn-content-store.h
+++ b/model/cs/ndn-content-store.h
@@ -28,13 +28,17 @@
#include <boost/tuple/tuple.hpp>
-namespace ns3
-{
+namespace ns3 {
class Packet;
-class NdnContentObjectHeader;
-class NdnInterestHeader;
-class NdnNameComponents;
+
+namespace ndn {
+
+class ContentObjectHeader;
+class InterestHeader;
+class NameComponents;
+
+namespace cs {
/**
* \ingroup ndn
@@ -42,37 +46,37 @@
*
* Content store entry stores separately pseudo header and content of
* ContentObject packet. It is responsibility of the caller to
- * construct a fully formed NdnPacket by calling Copy(), AddHeader(),
+ * construct a fully formed NDN Packet by calling Copy(), AddHeader(),
* AddTail() on the packet received by GetPacket() method.
*
* GetFullyFormedNdnPacket method provided as a convenience
*/
-class NdnContentStoreEntry : public SimpleRefCount<NdnContentStoreEntry>
+class Entry : public SimpleRefCount<Entry>
{
public:
/**
* \brief Construct content store entry
*
- * \param header Parsed NdnContentObject header
+ * \param header Parsed ContentObject header
* \param packet Original Ndn packet
*
* The constructor will make a copy of the supplied packet and calls
* RemoveHeader and RemoveTail on the copy.
*/
- NdnContentStoreEntry (Ptr<const NdnContentObjectHeader> header, Ptr<const Packet> packet);
+ Entry (Ptr<const ContentObjectHeader> header, Ptr<const Packet> packet);
/**
* \brief Get prefix of the stored entry
* \returns prefix of the stored entry
*/
- const NdnNameComponents&
+ const NameComponents&
GetName () const;
/**
- * \brief Get NdnContentObjectHeader of the stored entry
- * \returns NdnContentObjectHeader of the stored entry
+ * \brief Get ContentObjectHeader of the stored entry
+ * \returns ContentObjectHeader of the stored entry
*/
- Ptr<const NdnContentObjectHeader>
+ Ptr<const ContentObjectHeader>
GetHeader () const;
/**
@@ -84,16 +88,18 @@
/**
* \brief Convenience method to create a fully formed Ndn packet from stored header and content
- * \returns A read-write copy of the packet with NdnContentObjectHeader and CcxnContentObjectTail
+ * \returns A read-write copy of the packet with ContentObjectHeader and ContentObjectTail
*/
Ptr<Packet>
GetFullyFormedNdnPacket () const;
private:
- Ptr<const NdnContentObjectHeader> m_header; ///< \brief non-modifiable NdnContentObjectHeader
+ Ptr<const ContentObjectHeader> m_header; ///< \brief non-modifiable ContentObjectHeader
Ptr<Packet> m_packet; ///< \brief non-modifiable content of the ContentObject packet
};
+} // namespace cs
+
/**
* \ingroup ndn
@@ -101,7 +107,7 @@
*
* Particular implementations should implement Lookup, Add, and Print methods
*/
-class NdnContentStore : public Object
+class ContentStore : public Object
{
public:
/**
@@ -115,7 +121,8 @@
/**
* @brief Virtual destructor
*/
- virtual ~NdnContentStore ();
+ virtual
+ ~ContentStore ();
/**
* \brief Find corresponding CS entry for the given interest
@@ -126,19 +133,19 @@
* If an entry is found, it is promoted to the top of most recent
* used entries index, \see m_contentStore
*/
- virtual boost::tuple<Ptr<Packet>, Ptr<const NdnContentObjectHeader>, Ptr<const Packet> >
- Lookup (Ptr<const NdnInterestHeader> interest) = 0;
+ virtual boost::tuple<Ptr<Packet>, Ptr<const ContentObjectHeader>, Ptr<const Packet> >
+ Lookup (Ptr<const InterestHeader> interest) = 0;
/**
* \brief Add a new content to the content store.
*
- * \param header Fully parsed NdnContentObjectHeader
+ * \param header Fully parsed ContentObjectHeader
* \param packet Fully formed Ndn packet to add to content store
* (will be copied and stripped down of headers)
* @returns true if an existing entry was updated, false otherwise
*/
virtual bool
- Add (Ptr<const NdnContentObjectHeader> header, Ptr<const Packet> packet) = 0;
+ Add (Ptr<const ContentObjectHeader> header, Ptr<const Packet> packet) = 0;
// /**
// * \brief Add a new content to the content store.
@@ -147,7 +154,7 @@
// * @returns true if an existing entry was removed, false otherwise
// */
// virtual bool
- // Remove (Ptr<NdnInterestHeader> header) = 0;
+ // Remove (Ptr<InterestHeader> header) = 0;
/**
* \brief Print out content store entries
@@ -156,19 +163,20 @@
Print (std::ostream &os) const = 0;
protected:
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<const NdnContentObjectHeader> > m_cacheHitsTrace; ///< @brief trace of cache hits
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<const ContentObjectHeader> > m_cacheHitsTrace; ///< @brief trace of cache hits
- TracedCallback<Ptr<const NdnInterestHeader> > m_cacheMissesTrace; ///< @brief trace of cache misses
+ TracedCallback<Ptr<const InterestHeader> > m_cacheMissesTrace; ///< @brief trace of cache misses
};
inline std::ostream&
-operator<< (std::ostream &os, const NdnContentStore &cs)
+operator<< (std::ostream &os, const ContentStore &cs)
{
cs.Print (os);
return os;
}
+} // namespace ndn
} // namespace ns3
#endif // NDN_CONTENT_STORE_H
diff --git a/model/fib/ndn-fib-entry.cc b/model/fib/ndn-fib-entry.cc
index 965886f..01e2970 100644
--- a/model/fib/ndn-fib-entry.cc
+++ b/model/fib/ndn-fib-entry.cc
@@ -32,30 +32,25 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnFibEntry");
+NS_LOG_COMPONENT_DEFINE ("ndn.fib.Entry");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
+namespace fib {
//////////////////////////////////////////////////////////////////////
// Helpers
//////////////////////////////////////////////////////////////////////
-namespace __ndn_private {
-struct NdnFibFaceMetricByFace
+struct FaceMetricByFace
{
- typedef NdnFibFaceMetricContainer::type::index<i_face>::type
+ typedef FaceMetricContainer::type::index<i_face>::type
type;
};
-}
-//////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////
-
-using namespace __ndn_private;
void
-NdnFibFaceMetric::UpdateRtt (const Time &rttSample)
+FaceMetric::UpdateRtt (const Time &rttSample)
{
// const Time & this->m_rttSample
@@ -78,56 +73,56 @@
/////////////////////////////////////////////////////////////////////
void
-NdnFibEntry::UpdateFaceRtt (Ptr<NdnFace> face, const Time &sample)
+Entry::UpdateFaceRtt (Ptr<Face> face, const Time &sample)
{
- NdnFibFaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
+ FaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
NS_ASSERT_MSG (record != m_faces.get<i_face> ().end (),
"Update status can be performed only on existing faces of CcxnFibEntry");
m_faces.modify (record,
- ll::bind (&NdnFibFaceMetric::UpdateRtt, ll::_1, sample));
+ ll::bind (&FaceMetric::UpdateRtt, ll::_1, sample));
// reordering random access index same way as by metric index
m_faces.get<i_nth> ().rearrange (m_faces.get<i_metric> ().begin ());
}
void
-NdnFibEntry::UpdateStatus (Ptr<NdnFace> face, NdnFibFaceMetric::Status status)
+Entry::UpdateStatus (Ptr<Face> face, FaceMetric::Status status)
{
NS_LOG_FUNCTION (this << boost::cref(*face) << status);
- NdnFibFaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
+ FaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
NS_ASSERT_MSG (record != m_faces.get<i_face> ().end (),
"Update status can be performed only on existing faces of CcxnFibEntry");
m_faces.modify (record,
- (&ll::_1)->*&NdnFibFaceMetric::m_status = status);
+ (&ll::_1)->*&FaceMetric::m_status = status);
// reordering random access index same way as by metric index
m_faces.get<i_nth> ().rearrange (m_faces.get<i_metric> ().begin ());
}
void
-NdnFibEntry::AddOrUpdateRoutingMetric (Ptr<NdnFace> face, int32_t metric)
+Entry::AddOrUpdateRoutingMetric (Ptr<Face> face, int32_t metric)
{
NS_LOG_FUNCTION (this);
NS_ASSERT_MSG (face != NULL, "Trying to Add or Update NULL face");
- NdnFibFaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
+ FaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
if (record == m_faces.get<i_face> ().end ())
{
- m_faces.insert (NdnFibFaceMetric (face, metric));
+ m_faces.insert (FaceMetric (face, metric));
}
else
{
// don't update metric to higher value
- if (record->m_routingCost > metric || record->m_status == NdnFibFaceMetric::NDN_FIB_RED)
+ if (record->m_routingCost > metric || record->m_status == FaceMetric::NDN_FIB_RED)
{
m_faces.modify (record,
- (&ll::_1)->*&NdnFibFaceMetric::m_routingCost = metric);
+ (&ll::_1)->*&FaceMetric::m_routingCost = metric);
m_faces.modify (record,
- (&ll::_1)->*&NdnFibFaceMetric::m_status = NdnFibFaceMetric::NDN_FIB_YELLOW);
+ (&ll::_1)->*&FaceMetric::m_status = FaceMetric::NDN_FIB_YELLOW);
}
}
@@ -136,31 +131,31 @@
}
void
-NdnFibEntry::Invalidate ()
+Entry::Invalidate ()
{
- for (NdnFibFaceMetricByFace::type::iterator face = m_faces.begin ();
+ for (FaceMetricByFace::type::iterator face = m_faces.begin ();
face != m_faces.end ();
face++)
{
m_faces.modify (face,
- (&ll::_1)->*&NdnFibFaceMetric::m_routingCost = std::numeric_limits<uint16_t>::max ());
+ (&ll::_1)->*&FaceMetric::m_routingCost = std::numeric_limits<uint16_t>::max ());
m_faces.modify (face,
- (&ll::_1)->*&NdnFibFaceMetric::m_status = NdnFibFaceMetric::NDN_FIB_RED);
+ (&ll::_1)->*&FaceMetric::m_status = FaceMetric::NDN_FIB_RED);
}
}
-const NdnFibFaceMetric &
-NdnFibEntry::FindBestCandidate (uint32_t skip/* = 0*/) const
+const FaceMetric &
+Entry::FindBestCandidate (uint32_t skip/* = 0*/) const
{
- if (m_faces.size () == 0) throw NdnFibEntry::NoFaces ();
+ if (m_faces.size () == 0) throw Entry::NoFaces ();
skip = skip % m_faces.size();
return m_faces.get<i_nth> () [skip];
}
-std::ostream& operator<< (std::ostream& os, const NdnFibEntry &entry)
+std::ostream& operator<< (std::ostream& os, const Entry &entry)
{
- for (NdnFibFaceMetricContainer::type::index<i_nth>::type::iterator metric =
+ for (FaceMetricContainer::type::index<i_nth>::type::iterator metric =
entry.m_faces.get<i_nth> ().begin ();
metric != entry.m_faces.get<i_nth> ().end ();
metric++)
@@ -173,7 +168,7 @@
return os;
}
-std::ostream& operator<< (std::ostream& os, const NdnFibFaceMetric &metric)
+std::ostream& operator<< (std::ostream& os, const FaceMetric &metric)
{
static const std::string statusString[] = {"","g","y","r"};
@@ -181,5 +176,6 @@
return os;
}
-
-} // ns3
+} // namespace fib
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fib/ndn-fib-entry.h b/model/fib/ndn-fib-entry.h
index cf8cbe6..532120f 100644
--- a/model/fib/ndn-fib-entry.h
+++ b/model/fib/ndn-fib-entry.h
@@ -23,8 +23,8 @@
#include "ns3/ptr.h"
#include "ns3/nstime.h"
-#include "ns3/ndn.h"
#include "ns3/ndn-face.h"
+#include "ns3/ndn-name-components.h"
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/tag.hpp>
@@ -35,16 +35,18 @@
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/mem_fun.hpp>
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-class NdnNameComponents;
+class NameComponents;
+
+namespace fib {
/**
* \ingroup ndn
* \brief Structure holding various parameters associated with a (FibEntry, Face) tuple
*/
-class NdnFibFaceMetric
+class FaceMetric
{
public:
/**
@@ -60,7 +62,7 @@
* \param face Face for which metric
* \param cost Initial value for routing cost
*/
- NdnFibFaceMetric (Ptr<NdnFace> face, int32_t cost)
+ FaceMetric (Ptr<Face> face, int32_t cost)
: m_face (face)
, m_status (NDN_FIB_YELLOW)
, m_routingCost (cost)
@@ -72,18 +74,18 @@
* \brief Comparison operator used by boost::multi_index::identity<>
*/
bool
- operator< (const NdnFibFaceMetric &fm) const { return *m_face < *fm.m_face; } // return identity of the face
+ operator< (const FaceMetric &fm) const { return *m_face < *fm.m_face; } // return identity of the face
/**
- * @brief Comparison between NdnFibFaceMetric and NdnFace
+ * @brief Comparison between FaceMetric and Face
*/
bool
- operator< (const Ptr<NdnFace> &face) const { return *m_face < *face; }
+ operator< (const Ptr<Face> &face) const { return *m_face < *face; }
/**
- * @brief Return NdnFace associated with NdnFibFaceMetric
+ * @brief Return Face associated with FaceMetric
*/
- Ptr<NdnFace>
+ Ptr<Face>
GetFace () const { return m_face; }
/**
@@ -94,9 +96,9 @@
UpdateRtt (const Time &rttSample);
private:
- friend std::ostream& operator<< (std::ostream& os, const NdnFibFaceMetric &metric);
+ friend std::ostream& operator<< (std::ostream& os, const FaceMetric &metric);
public:
- Ptr<NdnFace> m_face; ///< Face
+ Ptr<Face> m_face; ///< Face
Status m_status; ///< \brief Status of the next hop:
///< - NDN_FIB_GREEN
@@ -109,9 +111,16 @@
Time m_rttVar; ///< \brief round-trip time variation
};
+/// @cond include_hidden
+class i_face {};
+class i_metric {};
+class i_nth {};
+/// @endcond
+
+
/**
* \ingroup ndn
- * \brief Typedef for indexed face container of NdnFibEntry
+ * \brief Typedef for indexed face container of Entry
*
* Currently, there are 2 indexes:
* - by face (used to find record and update metric)
@@ -119,31 +128,31 @@
* - random access index (for fast lookup on nth face). Order is
* maintained manually to be equal to the 'by metric' order
*/
-struct NdnFibFaceMetricContainer
+struct FaceMetricContainer
{
/// @cond include_hidden
typedef boost::multi_index::multi_index_container<
- NdnFibFaceMetric,
+ FaceMetric,
boost::multi_index::indexed_by<
- // For fast access to elements using NdnFace
+ // For fast access to elements using Face
boost::multi_index::ordered_unique<
- boost::multi_index::tag<__ndn_private::i_face>,
- boost::multi_index::member<NdnFibFaceMetric,Ptr<NdnFace>,&NdnFibFaceMetric::m_face>
+ boost::multi_index::tag<i_face>,
+ boost::multi_index::member<FaceMetric,Ptr<Face>,&FaceMetric::m_face>
>,
// List of available faces ordered by (status, m_routingCost)
boost::multi_index::ordered_non_unique<
- boost::multi_index::tag<__ndn_private::i_metric>,
+ boost::multi_index::tag<i_metric>,
boost::multi_index::composite_key<
- NdnFibFaceMetric,
- boost::multi_index::member<NdnFibFaceMetric,NdnFibFaceMetric::Status,&NdnFibFaceMetric::m_status>,
- boost::multi_index::member<NdnFibFaceMetric,int32_t,&NdnFibFaceMetric::m_routingCost>
+ FaceMetric,
+ boost::multi_index::member<FaceMetric,FaceMetric::Status,&FaceMetric::m_status>,
+ boost::multi_index::member<FaceMetric,int32_t,&FaceMetric::m_routingCost>
>
>,
// To optimize nth candidate selection (sacrifice a little bit space to gain speed)
boost::multi_index::random_access<
- boost::multi_index::tag<__ndn_private::i_nth>
+ boost::multi_index::tag<i_nth>
>
>
> type;
@@ -155,7 +164,7 @@
* \brief Structure for FIB table entry, holding indexed list of
* available faces and their respective metrics
*/
-class NdnFibEntry : public SimpleRefCount<NdnFibEntry>
+class Entry : public SimpleRefCount<Entry>
{
public:
class NoFaces {}; ///< @brief Exception class for the case when FIB entry is not found
@@ -164,7 +173,7 @@
* \brief Constructor
* \param prefix smart pointer to the prefix for the FIB entry
*/
- NdnFibEntry (const Ptr<const NdnNameComponents> &prefix)
+ Entry (const Ptr<const NameComponents> &prefix)
: m_prefix (prefix)
, m_needsProbing (false)
{ }
@@ -173,14 +182,14 @@
* \brief Update status of FIB next hop
* \param status Status to set on the FIB entry
*/
- void UpdateStatus (Ptr<NdnFace> face, NdnFibFaceMetric::Status status);
+ void UpdateStatus (Ptr<Face> face, FaceMetric::Status status);
/**
* \brief Add or update routing metric of FIB next hop
*
* Initial status of the next hop is set to YELLOW
*/
- void AddOrUpdateRoutingMetric (Ptr<NdnFace> face, int32_t metric);
+ void AddOrUpdateRoutingMetric (Ptr<Face> face, int32_t metric);
/**
* @brief Invalidate face
@@ -194,44 +203,46 @@
* @brief Update RTT averages for the face
*/
void
- UpdateFaceRtt (Ptr<NdnFace> face, const Time &sample);
+ UpdateFaceRtt (Ptr<Face> face, const Time &sample);
/**
* \brief Get prefix for the FIB entry
*/
- const NdnNameComponents&
+ const NameComponents&
GetPrefix () const { return *m_prefix; }
/**
* \brief Find "best route" candidate, skipping `skip' first candidates (modulo # of faces)
*
- * throws NdnFibEntry::NoFaces if m_faces.size()==0
+ * throws Entry::NoFaces if m_faces.size()==0
*/
- const NdnFibFaceMetric &
+ const FaceMetric &
FindBestCandidate (uint32_t skip = 0) const;
/**
* @brief Remove record associated with `face`
*/
void
- RemoveFace (const Ptr<NdnFace> &face)
+ RemoveFace (const Ptr<Face> &face)
{
m_faces.erase (face);
}
private:
- friend std::ostream& operator<< (std::ostream& os, const NdnFibEntry &entry);
+ friend std::ostream& operator<< (std::ostream& os, const Entry &entry);
public:
- Ptr<const NdnNameComponents> m_prefix; ///< \brief Prefix of the FIB entry
- NdnFibFaceMetricContainer::type m_faces; ///< \brief Indexed list of faces
+ Ptr<const NameComponents> m_prefix; ///< \brief Prefix of the FIB entry
+ FaceMetricContainer::type m_faces; ///< \brief Indexed list of faces
bool m_needsProbing; ///< \brief flag indicating that probing should be performed
};
-std::ostream& operator<< (std::ostream& os, const NdnFibEntry &entry);
-std::ostream& operator<< (std::ostream& os, const NdnFibFaceMetric &metric);
+std::ostream& operator<< (std::ostream& os, const Entry &entry);
+std::ostream& operator<< (std::ostream& os, const FaceMetric &metric);
-} // ns3
+} // namespace fib
+} // namespace ndn
+} // namespace ns3
#endif // _NDN_FIB_ENTRY_H_
diff --git a/model/fib/ndn-fib-impl.cc b/model/fib/ndn-fib-impl.cc
index 747c689..a55e9fd 100644
--- a/model/fib/ndn-fib-impl.cc
+++ b/model/fib/ndn-fib-impl.cc
@@ -34,43 +34,45 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnFibImpl");
+NS_LOG_COMPONENT_DEFINE ("ndn.fib.FibImpl");
namespace ns3 {
+namespace ndn {
+namespace fib {
-NS_OBJECT_ENSURE_REGISTERED (NdnFibImpl);
+NS_OBJECT_ENSURE_REGISTERED (FibImpl);
TypeId
-NdnFibImpl::GetTypeId (void)
+FibImpl::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnFib") // cheating ns3 object system
- .SetParent<NdnFib> ()
+ static TypeId tid = TypeId ("ns3::ndn::fib::Default") // cheating ns3 object system
+ .SetParent<Fib> ()
.SetGroupName ("Ndn")
- .AddConstructor<NdnFibImpl> ()
+ .AddConstructor<FibImpl> ()
;
return tid;
}
-NdnFibImpl::NdnFibImpl ()
+FibImpl::FibImpl ()
{
}
void
-NdnFibImpl::NotifyNewAggregate ()
+FibImpl::NotifyNewAggregate ()
{
Object::NotifyNewAggregate ();
}
void
-NdnFibImpl::DoDispose (void)
+FibImpl::DoDispose (void)
{
clear ();
Object::DoDispose ();
}
-Ptr<NdnFibEntry>
-NdnFibImpl::LongestPrefixMatch (const NdnInterestHeader &interest)
+Ptr<Entry>
+FibImpl::LongestPrefixMatch (const InterestHeader &interest)
{
super::iterator item = super::longest_prefix_match (interest.GetName ());
// @todo use predicate to search with exclude filters
@@ -82,14 +84,14 @@
}
-Ptr<NdnFibEntry>
-NdnFibImpl::Add (const NdnNameComponents &prefix, Ptr<NdnFace> face, int32_t metric)
+Ptr<Entry>
+FibImpl::Add (const NameComponents &prefix, Ptr<Face> face, int32_t metric)
{
- return Add (Create<NdnNameComponents> (prefix), face, metric);
+ return Add (Create<NameComponents> (prefix), face, metric);
}
-Ptr<NdnFibEntry>
-NdnFibImpl::Add (const Ptr<const NdnNameComponents> &prefix, Ptr<NdnFace> face, int32_t metric)
+Ptr<Entry>
+FibImpl::Add (const Ptr<const NameComponents> &prefix, Ptr<Face> face, int32_t metric)
{
NS_LOG_FUNCTION (this->GetObject<Node> ()->GetId () << boost::cref(*prefix) << boost::cref(*face) << metric);
@@ -99,13 +101,13 @@
{
if (result.second)
{
- Ptr<NdnFibEntryImpl> newEntry = Create<NdnFibEntryImpl> (prefix);
+ Ptr<EntryImpl> newEntry = Create<EntryImpl> (prefix);
newEntry->SetTrie (result.first);
result.first->set_payload (newEntry);
}
super::modify (result.first,
- ll::bind (&NdnFibEntry::AddOrUpdateRoutingMetric, ll::_1, face, metric));
+ ll::bind (&Entry::AddOrUpdateRoutingMetric, ll::_1, face, metric));
return result.first->payload ();
}
@@ -114,7 +116,7 @@
}
void
-NdnFibImpl::Remove (const Ptr<const NdnNameComponents> &prefix)
+FibImpl::Remove (const Ptr<const NameComponents> &prefix)
{
NS_LOG_FUNCTION (this->GetObject<Node> ()->GetId () << boost::cref(*prefix));
@@ -122,7 +124,7 @@
}
// void
-// NdnFibImpl::Invalidate (const Ptr<const NdnNameComponents> &prefix)
+// FibImpl::Invalidate (const Ptr<const NameComponents> &prefix)
// {
// NS_LOG_FUNCTION (this->GetObject<Node> ()->GetId () << boost::cref(*prefix));
@@ -134,11 +136,11 @@
// return; // nothing to invalidate
// super::modify (lastItem,
-// ll::bind (&NdnFibEntry::Invalidate, ll::_1));
+// ll::bind (&Entry::Invalidate, ll::_1));
// }
void
-NdnFibImpl::InvalidateAll ()
+FibImpl::InvalidateAll ()
{
NS_LOG_FUNCTION (this->GetObject<Node> ()->GetId ());
@@ -149,28 +151,28 @@
if (item->payload () == 0) continue;
super::modify (&(*item),
- ll::bind (&NdnFibEntry::Invalidate, ll::_1));
+ ll::bind (&Entry::Invalidate, ll::_1));
}
}
void
-NdnFibImpl::RemoveFace (super::parent_trie &item, Ptr<NdnFace> face)
+FibImpl::RemoveFace (super::parent_trie &item, Ptr<Face> face)
{
if (item.payload () == 0) return;
NS_LOG_FUNCTION (this);
super::modify (&item,
- ll::bind (&NdnFibEntry::RemoveFace, ll::_1, face));
+ ll::bind (&Entry::RemoveFace, ll::_1, face));
}
void
-NdnFibImpl::RemoveFromAll (Ptr<NdnFace> face)
+FibImpl::RemoveFromAll (Ptr<Face> face)
{
NS_LOG_FUNCTION (this);
std::for_each (super::parent_trie::recursive_iterator (super::getTrie ()),
super::parent_trie::recursive_iterator (0),
- ll::bind (&NdnFibImpl::RemoveFace,
+ ll::bind (&FibImpl::RemoveFace,
this, ll::_1, face));
super::parent_trie::recursive_iterator trieNode (super::getTrie ());
@@ -187,7 +189,7 @@
}
void
-NdnFibImpl::Print (std::ostream &os) const
+FibImpl::Print (std::ostream &os) const
{
// !!! unordered_set imposes "random" order of item in the same level !!!
super::parent_trie::const_recursive_iterator item (super::getTrie ());
@@ -201,13 +203,13 @@
}
uint32_t
-NdnFibImpl::GetSize () const
+FibImpl::GetSize () const
{
return super::getPolicy ().size ();
}
-Ptr<const NdnFibEntry>
-NdnFibImpl::Begin ()
+Ptr<const Entry>
+FibImpl::Begin ()
{
super::parent_trie::const_recursive_iterator item (super::getTrie ());
super::parent_trie::const_recursive_iterator end (0);
@@ -223,18 +225,18 @@
return item->payload ();
}
-Ptr<const NdnFibEntry>
-NdnFibImpl::End ()
+Ptr<const Entry>
+FibImpl::End ()
{
return 0;
}
-Ptr<const NdnFibEntry>
-NdnFibImpl::Next (Ptr<const NdnFibEntry> from)
+Ptr<const Entry>
+FibImpl::Next (Ptr<const Entry> from)
{
if (from == 0) return 0;
- super::parent_trie::const_recursive_iterator item (*StaticCast<const NdnFibEntryImpl> (from)->to_iterator ());
+ super::parent_trie::const_recursive_iterator item (*StaticCast<const EntryImpl> (from)->to_iterator ());
super::parent_trie::const_recursive_iterator end (0);
for (item++; item != end; item++)
{
@@ -248,5 +250,6 @@
return item->payload ();
}
-
+} // namespace fib
+} // namespace ndn
} // namespace ns3
diff --git a/model/fib/ndn-fib-impl.h b/model/fib/ndn-fib-impl.h
index 562f06e..4c78997 100644
--- a/model/fib/ndn-fib-impl.h
+++ b/model/fib/ndn-fib-impl.h
@@ -28,18 +28,20 @@
#include "../../utils/counting-policy.h"
namespace ns3 {
+namespace ndn {
+namespace fib {
-class NdnFibEntryImpl : public NdnFibEntry
+class EntryImpl : public Entry
{
public:
typedef ndnSIM::trie_with_policy<
- NdnNameComponents,
- ndnSIM::smart_pointer_payload_traits<NdnFibEntryImpl>,
+ NameComponents,
+ ndnSIM::smart_pointer_payload_traits<EntryImpl>,
ndnSIM::counting_policy_traits
> trie;
- NdnFibEntryImpl (const Ptr<const NdnNameComponents> &prefix)
- : NdnFibEntry (prefix)
+ EntryImpl (const Ptr<const NameComponents> &prefix)
+ : Entry (prefix)
, item_ (0)
{
}
@@ -57,24 +59,19 @@
trie::iterator item_;
};
-struct NdnFibEntryContainer
-{
- typedef ndnSIM::trie_with_policy<
- NdnNameComponents,
- ndnSIM::smart_pointer_payload_traits<NdnFibEntryImpl>,
- ndnSIM::counting_policy_traits
- > type;
-};
-
/**
* \ingroup ndn
* \brief Class implementing FIB functionality
*/
-class NdnFibImpl : public NdnFib,
- private NdnFibEntryContainer::type
+class FibImpl : public Fib,
+ protected ndnSIM::trie_with_policy< NameComponents,
+ ndnSIM::smart_pointer_payload_traits< EntryImpl >,
+ ndnSIM::counting_policy_traits >
{
public:
- typedef NdnFibEntryContainer::type super;
+ typedef ndnSIM::trie_with_policy< NameComponents,
+ ndnSIM::smart_pointer_payload_traits<EntryImpl>,
+ ndnSIM::counting_policy_traits > super;
/**
* \brief Interface ID
@@ -86,25 +83,25 @@
/**
* \brief Constructor
*/
- NdnFibImpl ();
+ FibImpl ();
- virtual Ptr<NdnFibEntry>
- LongestPrefixMatch (const NdnInterestHeader &interest);
+ virtual Ptr<Entry>
+ LongestPrefixMatch (const InterestHeader &interest);
- virtual Ptr<NdnFibEntry>
- Add (const NdnNameComponents &prefix, Ptr<NdnFace> face, int32_t metric);
+ virtual Ptr<Entry>
+ Add (const NameComponents &prefix, Ptr<Face> face, int32_t metric);
- virtual Ptr<NdnFibEntry>
- Add (const Ptr<const NdnNameComponents> &prefix, Ptr<NdnFace> face, int32_t metric);
+ virtual Ptr<Entry>
+ Add (const Ptr<const NameComponents> &prefix, Ptr<Face> face, int32_t metric);
virtual void
- Remove (const Ptr<const NdnNameComponents> &prefix);
+ Remove (const Ptr<const NameComponents> &prefix);
virtual void
InvalidateAll ();
virtual void
- RemoveFromAll (Ptr<NdnFace> face);
+ RemoveFromAll (Ptr<Face> face);
virtual void
Print (std::ostream &os) const;
@@ -112,24 +109,14 @@
virtual uint32_t
GetSize () const;
- virtual Ptr<const NdnFibEntry>
+ virtual Ptr<const Entry>
Begin ();
- virtual Ptr<const NdnFibEntry>
+ virtual Ptr<const Entry>
End ();
- virtual Ptr<const NdnFibEntry>
- Next (Ptr<const NdnFibEntry> item);
-
- // /**
- // * @brief Modify element in container
- // */
- // template<typename Modifier>
- // bool
- // modify (Ptr<NdnFibEntry> item, Modifier mod)
- // {
- // return super::modify (StaticCast<NdnFibEntryImpl> (item)->to_iterator (), mod);
- // }
+ virtual Ptr<const Entry>
+ Next (Ptr<const Entry> item);
protected:
// inherited from Object class
@@ -142,12 +129,14 @@
* entry will be removed
*/
void
- RemoveFace (super::parent_trie &item, Ptr<NdnFace> face);
+ RemoveFace (super::parent_trie &item, Ptr<Face> face);
private:
Ptr<Node> m_node;
};
-
+
+} // namespace fib
+} // namespace ndn
} // namespace ns3
#endif /* _NDN_FIB_IMPL_H_ */
diff --git a/model/fib/ndn-fib.cc b/model/fib/ndn-fib.cc
index 7046634..f63dadf 100644
--- a/model/fib/ndn-fib.cc
+++ b/model/fib/ndn-fib.cc
@@ -20,36 +20,24 @@
#include "ndn-fib.h"
-#include "ndn-fib-impl.h"
-
-#include "ns3/ndn.h"
-#include "ns3/ndn-face.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-name-components.h"
-
#include "ns3/node.h"
#include "ns3/names.h"
-#include <boost/ref.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
-namespace ll = boost::lambda;
-
namespace ns3 {
-
-using namespace __ndn_private;
+namespace ndn {
TypeId
-NdnFib::GetTypeId (void)
+Fib::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::private::NdnFib") // cheating ns3 object system
+ static TypeId tid = TypeId ("ns3::ndn::Fib") // cheating ns3 object system
.SetParent<Object> ()
.SetGroupName ("Ndn")
;
return tid;
}
-std::ostream& operator<< (std::ostream& os, const NdnFib &fib)
+std::ostream&
+operator<< (std::ostream& os, const Fib &fib)
{
os << "Node " << Names::FindName (fib.GetObject<Node>()) << "\n";
os << " Dest prefix Interfaces(Costs) \n";
@@ -59,4 +47,5 @@
return os;
}
+} // namespace ndn
} // namespace ns3
diff --git a/model/fib/ndn-fib.h b/model/fib/ndn-fib.h
index 12a6148..b1b4be7 100644
--- a/model/fib/ndn-fib.h
+++ b/model/fib/ndn-fib.h
@@ -27,14 +27,15 @@
#include "ns3/ndn-fib-entry.h"
namespace ns3 {
+namespace ndn {
-class NdnInterestHeader;
+class InterestHeader;
/**
* \ingroup ndn
* \brief Class implementing FIB functionality
*/
-class NdnFib : public Object
+class Fib : public Object
{
public:
/**
@@ -46,12 +47,12 @@
/**
* @brief Default constructor
*/
- NdnFib () {}
+ Fib () {}
/**
* @brief Virtual destructor
*/
- virtual ~NdnFib () { };
+ virtual ~Fib () { };
/**
* \brief Perform longest prefix match
@@ -61,8 +62,8 @@
* \param interest Interest packet header
* \returns If entry found a valid iterator will be returned, otherwise end ()
*/
- virtual Ptr<NdnFibEntry>
- LongestPrefixMatch (const NdnInterestHeader &interest) = 0;
+ virtual Ptr<fib::Entry>
+ LongestPrefixMatch (const InterestHeader &interest) = 0;
/**
* \brief Add or update FIB entry
@@ -75,8 +76,8 @@
* @param face Forwarding face
* @param metric Routing metric
*/
- virtual Ptr<NdnFibEntry>
- Add (const NdnNameComponents &prefix, Ptr<NdnFace> face, int32_t metric) = 0;
+ virtual Ptr<fib::Entry>
+ Add (const NameComponents &prefix, Ptr<Face> face, int32_t metric) = 0;
/**
* \brief Add or update FIB entry using smart pointer to prefix
@@ -89,8 +90,8 @@
* @param face Forwarding face
* @param metric Routing metric
*/
- virtual Ptr<NdnFibEntry>
- Add (const Ptr<const NdnNameComponents> &prefix, Ptr<NdnFace> face, int32_t metric) = 0;
+ virtual Ptr<fib::Entry>
+ Add (const Ptr<const NameComponents> &prefix, Ptr<Face> face, int32_t metric) = 0;
/**
* @brief Remove FIB entry
@@ -101,7 +102,7 @@
* @param name Smart pointer to prefix
*/
virtual void
- Remove (const Ptr<const NdnNameComponents> &prefix) = 0;
+ Remove (const Ptr<const NameComponents> &prefix) = 0;
// /**
// * @brief Invalidate FIB entry ("Safe" version of Remove)
@@ -110,7 +111,7 @@
// * @param name Smart pointer to prefix
// */
// virtual void
- // Invalidate (const Ptr<const NdnNameComponents> &prefix) = 0;
+ // Invalidate (const Ptr<const NameComponents> &prefix) = 0;
/**
* @brief Invalidate all FIB entries
@@ -123,7 +124,7 @@
* this FIB entry will be removed.
*/
virtual void
- RemoveFromAll (Ptr<NdnFace> face) = 0;
+ RemoveFromAll (Ptr<Face> face) = 0;
/**
* @brief Print out entries in FIB
@@ -140,20 +141,20 @@
/**
* @brief Return first element of FIB (no order guaranteed)
*/
- virtual Ptr<const NdnFibEntry>
+ virtual Ptr<const fib::Entry>
Begin () = 0;
/**
* @brief Return item next after last (no order guaranteed)
*/
- virtual Ptr<const NdnFibEntry>
+ virtual Ptr<const fib::Entry>
End () = 0;
/**
* @brief Advance the iterator
*/
- virtual Ptr<const NdnFibEntry>
- Next (Ptr<const NdnFibEntry>) = 0;
+ virtual Ptr<const fib::Entry>
+ Next (Ptr<const fib::Entry>) = 0;
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
@@ -162,28 +163,29 @@
/**
* @brief Static call to cheat python bindings
*/
- static inline Ptr<NdnFib>
- GetNdnFib (Ptr<Object> node);
+ static inline Ptr<Fib>
+ GetFib (Ptr<Object> node);
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
private:
- NdnFib(const NdnFib&) {} ; ///< \brief copy constructor is disabled
+ Fib (const Fib&) {} ; ///< \brief copy constructor is disabled
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-std::ostream& operator<< (std::ostream& os, const NdnFib &fib);
+std::ostream& operator<< (std::ostream& os, const Fib &fib);
-Ptr<NdnFib>
-NdnFib::GetNdnFib (Ptr<Object> node)
+Ptr<Fib>
+Fib::GetFib (Ptr<Object> node)
{
- return node->GetObject<NdnFib> ();
+ return node->GetObject<Fib> ();
}
+} // namespace ndn
} // namespace ns3
#endif // _NDN_FIB_H_
diff --git a/model/forwarding-strategy/ndn-forwarding-strategy.h b/model/forwarding-strategy/ndn-forwarding-strategy.h
deleted file mode 100644
index c2fa296..0000000
--- a/model/forwarding-strategy/ndn-forwarding-strategy.h
+++ /dev/null
@@ -1,235 +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>
- * Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-#ifndef NDN_FORWARDING_STRATEGY_H
-#define NDN_FORWARDING_STRATEGY_H
-
-#include "ns3/packet.h"
-#include "ns3/callback.h"
-#include "ns3/object.h"
-#include "ns3/traced-callback.h"
-
-namespace ns3 {
-
-class NdnFace;
-class NdnInterestHeader;
-class NdnContentObjectHeader;
-class NdnPit;
-class NdnPitEntry;
-class NdnFibFaceMetric;
-class NdnFib;
-class NdnContentStore;
-
-/**
- * \ingroup ndn
- * \brief Abstract base class for Ndn forwarding strategies
- */
-class NdnForwardingStrategy :
- public Object
-{
-public:
- static TypeId GetTypeId (void);
-
- /**
- * @brief Default constructor
- */
- NdnForwardingStrategy ();
- virtual ~NdnForwardingStrategy ();
-
- /**
- * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
- *
- * Processing Interest packets
- * @param face incoming face
- * @param header deserialized Interest header
- * @param packet original packet
- */
- virtual void
- OnInterest (const Ptr<NdnFace> &face,
- Ptr<NdnInterestHeader> &header,
- const Ptr<const Packet> &p);
-
- /**
- * \brief Actual processing of incoming Ndn content objects
- *
- * Processing ContentObject packets
- * @param face incoming face
- * @param header deserialized ContentObject header
- * @param payload data packet payload
- * @param packet original packet
- */
- virtual void
- OnData (const Ptr<NdnFace> &face,
- Ptr<NdnContentObjectHeader> &header,
- Ptr<Packet> &payload,
- const Ptr<const Packet> &packet);
-
- virtual void
- WillErasePendingInterest (Ptr<NdnPitEntry> pitEntry);
-
- virtual void
- RemoveFace (Ptr<NdnFace> face);
-
-protected:
- // events
- virtual void
- DidReceiveDuplicateInterest (const Ptr<NdnFace> &face,
- Ptr<NdnInterestHeader> &header,
- const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
-
- virtual void
- DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
-
- virtual void
- FailedToCreatePitEntry (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
- const Ptr<const Packet> &packet);
-
- virtual void
- DidCreatePitEntry (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
-
- virtual bool
- DetectRetransmittedInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry);
-
- // makes sense only for data received from network
- // When Interest is satisfied from the cache, incoming face is 0
- virtual void
- WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry);
-
- // for data received both from network and cache
- virtual void
- SatisfyPendingInterest (const Ptr<NdnFace> &incomingFace, // 0 allowed (from cache)
- Ptr<const NdnContentObjectHeader> header,
- Ptr<const Packet> payload,
- const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
-
- virtual void
- DidSendOutData (const Ptr<NdnFace> &face,
- Ptr<const NdnContentObjectHeader> header,
- Ptr<const Packet> payload,
- const Ptr<const Packet> &packet);
-
- virtual void
- DidReceiveUnsolicitedData (const Ptr<NdnFace> &incomingFace,
- Ptr<const NdnContentObjectHeader> header,
- Ptr<const Packet> payload);
-
- virtual bool
- ShouldSuppressIncomingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry);
-
- /**
- * @brief Event fired before actually sending out an interest
- *
- * If event returns false, then there is some kind of a problem (e.g., per-face limit reached)
- */
- virtual bool
- WillSendOutInterest (const Ptr<NdnFace> &outgoingFace,
- Ptr<NdnInterestHeader> header,
- Ptr<NdnPitEntry> pitEntry);
-
- /**
- * @brief Event fired just after sending out an interest
- */
- virtual void
- DidSendOutInterest (const Ptr<NdnFace> &outgoingFace,
- Ptr<NdnInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
-
- virtual void
- PropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
-
- /**
- * @brief Base method to propagate the interest according to the forwarding strategy
- *
- * @param pitEntry Reference to PIT entry (reference to corresponding FIB entry inside)
- * @param incomingFace Incoming face
- * @param header NdnInterestHeader
- * @param packet Original Interest packet
- * @param sendCallback Send callback
- *
- * @return true if interest was successfully propagated, false if all options have failed
- */
- virtual bool
- DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry) = 0;
-
-
- // virtual void
- // OnDataDelayed (Ptr<const NdnContentObjectHeader> header,
- // Ptr<const Packet> payload,
- // const Ptr<const Packet> &packet);
-
-protected:
- // inherited from Object class
- virtual void NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object
- virtual void DoDispose (); ///< @brief Do cleanup
-
-protected:
- Ptr<NdnPit> m_pit; ///< \brief Reference to PIT to which this forwarding strategy is associated
- Ptr<NdnFib> m_fib; ///< \brief FIB
- Ptr<NdnContentStore> m_contentStore; ///< \brief Content store (for caching purposes only)
-
- bool m_cacheUnsolicitedData;
- bool m_detectRetransmissions;
-
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<const NdnFace> > m_outInterests; ///< @brief Transmitted interests trace
-
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<const NdnFace> > m_inInterests; ///< @brief trace of incoming Interests
-
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<const NdnFace> > m_dropInterests; ///< @brief trace of dropped Interests
-
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
-
- TracedCallback<Ptr<const NdnContentObjectHeader>, Ptr<const Packet>,
- bool /*from cache*/,
- Ptr<const NdnFace> > m_outData; ///< @brief trace of outgoing Data
-
- TracedCallback<Ptr<const NdnContentObjectHeader>, Ptr<const Packet>,
- Ptr<const NdnFace> > m_inData; ///< @brief trace of incoming Data
-
- TracedCallback<Ptr<const NdnContentObjectHeader>, Ptr<const Packet>,
- Ptr<const NdnFace> > m_dropData; ///< @brief trace of dropped Data
-};
-
-} //namespace ns3
-
-#endif /* NDN_FORWARDING_STRATEGY_H */
diff --git a/model/forwarding-strategy/best-route.cc b/model/fw/best-route.cc
similarity index 81%
rename from model/forwarding-strategy/best-route.cc
rename to model/fw/best-route.cc
index ba56979..84e74fe 100644
--- a/model/forwarding-strategy/best-route.cc
+++ b/model/fw/best-route.cc
@@ -33,19 +33,18 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnSimBestRoute");
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.BestRoute");
namespace ns3 {
-namespace ndnSIM {
-
-using namespace __ndn_private;
+namespace ndn {
+namespace fw {
NS_OBJECT_ENSURE_REGISTERED (BestRoute);
TypeId
BestRoute::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::ndnSIM::BestRoute")
+ static TypeId tid = TypeId ("ns3::ndn::fw::BestRoute")
.SetGroupName ("Ndn")
.SetParent <GreenYellowRed> ()
.AddConstructor <BestRoute> ()
@@ -58,10 +57,10 @@
}
bool
-BestRoute::DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+BestRoute::DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
@@ -72,10 +71,9 @@
return true;
int propagatedCount = 0;
-
- BOOST_FOREACH (const NdnFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
+ BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
{
- if (metricFace.m_status == NdnFibFaceMetric::NDN_FIB_RED) // all non-read faces are in front
+ if (metricFace.m_status == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in front
break;
if (metricFace.m_face == incomingFace)
@@ -103,5 +101,6 @@
return propagatedCount > 0;
}
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
diff --git a/model/forwarding-strategy/best-route.h b/model/fw/best-route.h
similarity index 85%
rename from model/forwarding-strategy/best-route.h
rename to model/fw/best-route.h
index ec86914..7326b5b 100644
--- a/model/forwarding-strategy/best-route.h
+++ b/model/fw/best-route.h
@@ -26,7 +26,8 @@
#include "green-yellow-red.h"
namespace ns3 {
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
/**
* \ingroup ndn
@@ -37,7 +38,7 @@
{
public:
static TypeId
- GetTypeId (void);
+ GetTypeId ();
/**
* @brief Default constructor
@@ -46,16 +47,17 @@
// inherited from NdnForwardingStrategy
virtual bool
- DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
private:
typedef GreenYellowRed super;
};
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
#endif // NDNSIM_BEST_ROUTE_H
diff --git a/model/forwarding-strategy/flooding.cc b/model/fw/flooding.cc
similarity index 78%
rename from model/forwarding-strategy/flooding.cc
rename to model/fw/flooding.cc
index b20854f..be969be 100644
--- a/model/forwarding-strategy/flooding.cc
+++ b/model/fw/flooding.cc
@@ -36,18 +36,17 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnSimFlooding");
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.Flooding");
namespace ns3 {
-namespace ndnSIM {
-
-using namespace __ndn_private;
+namespace ndn {
+namespace fw {
NS_OBJECT_ENSURE_REGISTERED (Flooding);
-TypeId Flooding::GetTypeId (void)
+TypeId Flooding::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::ndnSIM::Flooding")
+ static TypeId tid = TypeId ("ns3::ndn::fw::Flooding")
.SetGroupName ("Ndn")
.SetParent <Nacks> ()
.AddConstructor <Flooding> ()
@@ -60,19 +59,19 @@
}
bool
-Flooding::DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+Flooding::DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
int propagatedCount = 0;
- BOOST_FOREACH (const NdnFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
+ BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
{
NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));
- if (metricFace.m_status == NdnFibFaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
+ if (metricFace.m_status == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
if (metricFace.m_face == incomingFace)
@@ -99,5 +98,6 @@
return propagatedCount > 0;
}
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
diff --git a/model/forwarding-strategy/flooding.h b/model/fw/flooding.h
similarity index 81%
rename from model/forwarding-strategy/flooding.h
rename to model/fw/flooding.h
index 32fa7ae..d6a83e0 100644
--- a/model/forwarding-strategy/flooding.h
+++ b/model/fw/flooding.h
@@ -25,7 +25,8 @@
#include "nacks.h"
namespace ns3 {
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
/**
* \ingroup ndn
@@ -37,7 +38,7 @@
public Nacks
{
public:
- static TypeId GetTypeId (void);
+ static TypeId GetTypeId ();
/**
* @brief Default constructor
@@ -45,18 +46,19 @@
Flooding ();
protected:
- // inherited from Nacks/NdnForwardingStrategy
+ // inherited from Nacks/ForwardingStrategy
virtual bool
- DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
private:
typedef Nacks super;
};
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
#endif // NDNSIM_FLOODING
diff --git a/model/forwarding-strategy/fw-stats.cc b/model/fw/fw-stats.cc
similarity index 78%
rename from model/forwarding-strategy/fw-stats.cc
rename to model/fw/fw-stats.cc
index af344e4..de30473 100644
--- a/model/forwarding-strategy/fw-stats.cc
+++ b/model/fw/fw-stats.cc
@@ -36,17 +36,21 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnSimFwStats");
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.Stats");
namespace ns3 {
-namespace ndnSIM {
+namespace ndn {
+
+using namespace ndnSIM;
+
+namespace fw {
NS_OBJECT_ENSURE_REGISTERED (FwStats);
TypeId
FwStats::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::ndnSIM::FwStats")
+ static TypeId tid = TypeId ("ns3::ndn::fw::Stats")
.SetGroupName ("Ndn")
.SetParent <BestRoute> ()
.AddConstructor <FwStats> ()
@@ -69,8 +73,8 @@
}
void
-FwStats::OnInterest (const Ptr<NdnFace> &face,
- Ptr<NdnInterestHeader> &header,
+FwStats::OnInterest (const Ptr<Face> &face,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &packet)
{
super::OnInterest (face, header, packet);
@@ -81,8 +85,8 @@
}
void
-FwStats::OnData (const Ptr<NdnFace> &face,
- Ptr<NdnContentObjectHeader> &header,
+FwStats::OnData (const Ptr<Face> &face,
+ Ptr<ContentObjectHeader> &header,
Ptr<Packet> &payload,
const Ptr<const Packet> &packet)
{
@@ -95,8 +99,8 @@
void
-FwStats::FailedToCreatePitEntry (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+FwStats::FailedToCreatePitEntry (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet)
{
super::FailedToCreatePitEntry (incomingFace, header, packet);
@@ -110,10 +114,10 @@
}
void
-FwStats::DidCreatePitEntry (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+FwStats::DidCreatePitEntry (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
super::DidCreatePitEntry (incomingFace, header, packet, pitEntry);
@@ -124,8 +128,8 @@
}
void
-FwStats::WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry)
+FwStats::WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry)
{
super::WillSatisfyPendingInterest (incomingFace, pitEntry);
@@ -135,10 +139,10 @@
}
void
-FwStats::DidSendOutInterest (const Ptr<NdnFace> &outgoingFace,
- Ptr<NdnInterestHeader> header,
+FwStats::DidSendOutInterest (const Ptr<Face> &outgoingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
super::DidSendOutInterest (outgoingFace, header, packet, pitEntry);
@@ -149,8 +153,8 @@
}
void
-FwStats::DidSendOutData (const Ptr<NdnFace> &face,
- Ptr<const NdnContentObjectHeader> header,
+FwStats::DidSendOutData (const Ptr<Face> &face,
+ Ptr<const ContentObjectHeader> header,
Ptr<const Packet> payload,
const Ptr<const Packet> &packet)
{
@@ -163,7 +167,7 @@
void
-FwStats::WillErasePendingInterest (Ptr<NdnPitEntry> pitEntry)
+FwStats::WillErasePendingInterest (Ptr<pit::Entry> pitEntry)
{
super::WillErasePendingInterest (pitEntry);
@@ -194,7 +198,7 @@
}
void
-FwStats::RemoveFace (Ptr<NdnFace> face)
+FwStats::RemoveFace (Ptr<Face> face)
{
m_stats.RemoveFace (face);
@@ -202,5 +206,6 @@
}
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
diff --git a/model/forwarding-strategy/fw-stats.h b/model/fw/fw-stats.h
similarity index 64%
rename from model/forwarding-strategy/fw-stats.h
rename to model/fw/fw-stats.h
index 2b1d337..2b8cae9 100644
--- a/model/forwarding-strategy/fw-stats.h
+++ b/model/fw/fw-stats.h
@@ -28,7 +28,8 @@
#include "../../utils/stats-tree.h"
namespace ns3 {
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
/**
* \ingroup ndn
@@ -39,7 +40,7 @@
{
public:
static TypeId
- GetTypeId (void);
+ GetTypeId ();
/**
* @brief Default constructor
@@ -47,53 +48,53 @@
FwStats ();
inline
- const StatsTree &
+ const ndnSIM::StatsTree &
GetStatsTree () const;
virtual void
- OnInterest (const Ptr<NdnFace> &face,
- Ptr<NdnInterestHeader> &header,
+ OnInterest (const Ptr<Face> &face,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &p);
virtual void
- OnData (const Ptr<NdnFace> &face,
- Ptr<NdnContentObjectHeader> &header,
+ OnData (const Ptr<Face> &face,
+ Ptr<ContentObjectHeader> &header,
Ptr<Packet> &payload,
const Ptr<const Packet> &packet);
virtual void
- RemoveFace (Ptr<NdnFace> face);
+ RemoveFace (Ptr<Face> face);
protected:
virtual void
- DidCreatePitEntry (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ DidCreatePitEntry (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
virtual void
- FailedToCreatePitEntry (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ FailedToCreatePitEntry (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet);
virtual void
- WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry);
+ WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry);
virtual void
- DidSendOutInterest (const Ptr<NdnFace> &outgoingFace,
- Ptr<NdnInterestHeader> header,
+ DidSendOutInterest (const Ptr<Face> &outgoingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
virtual void
- DidSendOutData (const Ptr<NdnFace> &face,
- Ptr<const NdnContentObjectHeader> header,
+ DidSendOutData (const Ptr<Face> &face,
+ Ptr<const ContentObjectHeader> header,
Ptr<const Packet> payload,
const Ptr<const Packet> &packet);
virtual void
- WillErasePendingInterest (Ptr<NdnPitEntry> pitEntry);
+ WillErasePendingInterest (Ptr<pit::Entry> pitEntry);
// from Object
void
@@ -107,22 +108,23 @@
ScheduleRefreshingIfNecessary ();
private:
- StatsTree m_stats;
+ ndnSIM::StatsTree m_stats;
EventId m_statsRefreshEvent;
- TracedCallback< Ptr<NdnForwardingStrategy>,
- const StatsTree & > m_statsTrace;
+ TracedCallback< Ptr<ForwardingStrategy>,
+ const ndnSIM::StatsTree & > m_statsTrace;
typedef BestRoute super;
};
-const StatsTree &
+const ndnSIM::StatsTree &
FwStats::GetStatsTree () const
{
return m_stats;
}
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
#endif // NDNSIM_FW_STATS_H
diff --git a/model/forwarding-strategy/green-yellow-red.cc b/model/fw/green-yellow-red.cc
similarity index 71%
rename from model/forwarding-strategy/green-yellow-red.cc
rename to model/fw/green-yellow-red.cc
index 5d497a6..3f0653f 100644
--- a/model/forwarding-strategy/green-yellow-red.cc
+++ b/model/fw/green-yellow-red.cc
@@ -43,20 +43,18 @@
#include <boost/tuple/tuple.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnSimGreenYellowRed");
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.GreenYellowRed");
namespace ns3 {
-
-using namespace __ndn_private;
-
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
NS_OBJECT_ENSURE_REGISTERED (GreenYellowRed);
TypeId
GreenYellowRed::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::ndnSIM::GreenYellowRed")
+ static TypeId tid = TypeId ("ns3::ndn::fw::GreenYellowRed")
.SetGroupName ("Ndn")
.SetParent<Nacks> ()
@@ -65,20 +63,20 @@
}
bool
-GreenYellowRed::DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+GreenYellowRed::DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
NS_ASSERT_MSG (m_pit != 0, "PIT should be aggregated with forwarding strategy");
int propagatedCount = 0;
- BOOST_FOREACH (const NdnFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
+ BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
{
- if (metricFace.m_status == NdnFibFaceMetric::NDN_FIB_RED ||
- metricFace.m_status == NdnFibFaceMetric::NDN_FIB_YELLOW)
+ if (metricFace.m_status == fib::FaceMetric::NDN_FIB_RED ||
+ metricFace.m_status == fib::FaceMetric::NDN_FIB_YELLOW)
break; //propagate only to green faces
if (pitEntry->GetIncoming ().find (metricFace.m_face) != pitEntry->GetIncoming ().end ())
@@ -103,32 +101,33 @@
}
void
-GreenYellowRed::WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry)
+GreenYellowRed::WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry)
{
if (incomingFace != 0)
{
// Update metric status for the incoming interface in the corresponding FIB entry
- pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_GREEN);
+ pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, fib::FaceMetric::NDN_FIB_GREEN);
}
super::WillSatisfyPendingInterest (incomingFace, pitEntry);
}
void
-GreenYellowRed::DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
+GreenYellowRed::DidReceiveValidNack (const Ptr<Face> &incomingFace,
uint32_t nackCode,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
super::DidReceiveValidNack (incomingFace, nackCode, pitEntry);
if (incomingFace != 0 &&
- nackCode != NdnInterestHeader::NACK_LOOP)
+ nackCode != InterestHeader::NACK_LOOP)
{
- pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW);
+ pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, fib::FaceMetric::NDN_FIB_YELLOW);
}
}
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
diff --git a/model/forwarding-strategy/green-yellow-red.h b/model/fw/green-yellow-red.h
similarity index 75%
rename from model/forwarding-strategy/green-yellow-red.h
rename to model/fw/green-yellow-red.h
index 67263ee..f324376 100644
--- a/model/forwarding-strategy/green-yellow-red.h
+++ b/model/fw/green-yellow-red.h
@@ -24,7 +24,8 @@
#include "nacks.h"
namespace ns3 {
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
/**
* \ingroup ndn
@@ -37,24 +38,25 @@
protected:
virtual void
- WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry);
+ WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry);
virtual bool
- DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
virtual void
- DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
+ DidReceiveValidNack (const Ptr<Face> &incomingFace,
uint32_t nackCode,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
private:
typedef Nacks super;
};
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
#endif // NDNSIM_GREEN_YELLOW_RED
diff --git a/model/forwarding-strategy/nacks.cc b/model/fw/nacks.cc
similarity index 79%
rename from model/forwarding-strategy/nacks.cc
rename to model/fw/nacks.cc
index 4cc8287..a148794 100644
--- a/model/forwarding-strategy/nacks.cc
+++ b/model/fw/nacks.cc
@@ -42,19 +42,20 @@
#include <boost/tuple/tuple.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnSimNacks");
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.Nacks");
namespace ns3 {
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
NS_OBJECT_ENSURE_REGISTERED (Nacks);
TypeId
Nacks::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::ndnSIM::Nacks")
+ static TypeId tid = TypeId ("ns3::ndn::fw::Nacks")
.SetGroupName ("Ndn")
- .SetParent<NdnForwardingStrategy> ()
+ .SetParent<ForwardingStrategy> ()
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
@@ -72,8 +73,8 @@
}
void
-Nacks::OnInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> &header,
+Nacks::OnInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &packet)
{
if (header->GetNack () > 0)
@@ -83,8 +84,8 @@
}
void
-Nacks::OnNack (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> &header,
+Nacks::OnNack (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &packet)
{
NS_ASSERT (m_nacksEnabled);
@@ -92,7 +93,7 @@
// NS_LOG_FUNCTION (incomingFace << header << packet);
m_inNacks (header, incomingFace);
- Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
+ Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
if (pitEntry == 0)
{
// somebody is doing something bad
@@ -119,7 +120,7 @@
}
Ptr<Packet> nonNackInterest = Create<Packet> ();
- header->SetNack (NdnInterestHeader::NORMAL_INTEREST);
+ header->SetNack (InterestHeader::NORMAL_INTEREST);
nonNackInterest->AddHeader (*header);
bool propagated = DoPropagateInterest (incomingFace, header, nonNackInterest, pitEntry);
@@ -130,17 +131,17 @@
}
void
-Nacks::DidReceiveDuplicateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> &header,
+Nacks::DidReceiveDuplicateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
super::DidReceiveDuplicateInterest (incomingFace, header, packet, pitEntry);
if (m_nacksEnabled)
{
NS_LOG_DEBUG ("Sending NACK_LOOP");
- header->SetNack (NdnInterestHeader::NACK_LOOP);
+ header->SetNack (InterestHeader::NACK_LOOP);
Ptr<Packet> nack = Create<Packet> ();
nack->AddHeader (*header);
@@ -150,20 +151,20 @@
}
void
-Nacks::DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+Nacks::DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
super::DidExhaustForwardingOptions (incomingFace, header, packet, pitEntry);
if (m_nacksEnabled)
{
Ptr<Packet> packet = Create<Packet> ();
- header->SetNack (NdnInterestHeader::NACK_GIVEUP_PIT);
+ header->SetNack (InterestHeader::NACK_GIVEUP_PIT);
packet->AddHeader (*header);
- BOOST_FOREACH (const NdnPitEntryIncomingFace &incoming, pitEntry->GetIncoming ())
+ BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
{
NS_LOG_DEBUG ("Send NACK for " << boost::cref (header->GetName ()) << " to " << boost::cref (*incoming.m_face));
incoming.m_face->Send (packet->Copy ());
@@ -183,19 +184,20 @@
}
void
-Nacks::DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
+Nacks::DidReceiveValidNack (const Ptr<Face> &incomingFace,
uint32_t nackCode,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
// If NACK is NACK_GIVEUP_PIT, then neighbor gave up trying to and removed it's PIT entry.
// So, if we had an incoming entry to this neighbor, then we can remove it now
- if (nackCode == NdnInterestHeader::NACK_GIVEUP_PIT)
+ if (nackCode == InterestHeader::NACK_GIVEUP_PIT)
{
pitEntry->RemoveIncoming (incomingFace);
}
- pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW);
+ pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, fib::FaceMetric::NDN_FIB_YELLOW);
}
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
diff --git a/model/forwarding-strategy/nacks.h b/model/fw/nacks.h
similarity index 61%
rename from model/forwarding-strategy/nacks.h
rename to model/fw/nacks.h
index 074f5ab..e9226ad 100644
--- a/model/forwarding-strategy/nacks.h
+++ b/model/fw/nacks.h
@@ -23,19 +23,19 @@
#include "ns3/ndn-forwarding-strategy.h"
namespace ns3 {
-
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
/**
* \ingroup ndn
* \brief Abstract base class for Ndn forwarding strategies
*/
class Nacks :
- public NdnForwardingStrategy
+ public ForwardingStrategy
{
public:
static TypeId
- GetTypeId (void);
+ GetTypeId ();
/**
* \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
@@ -46,52 +46,53 @@
* @param packet original packet
*/
virtual void
- OnInterest (const Ptr<NdnFace> &face,
- Ptr<NdnInterestHeader> &header,
+ OnInterest (const Ptr<Face> &face,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &p);
protected:
// using NdnForwardingStrategy::PropagateInterest; // some strange c++ cheating
virtual void
- DidReceiveDuplicateInterest (const Ptr<NdnFace> &face,
- Ptr<NdnInterestHeader> &header,
+ DidReceiveDuplicateInterest (const Ptr<Face> &face,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
virtual void
- DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
virtual void
- OnNack (const Ptr<NdnFace> &face,
- Ptr<NdnInterestHeader> &header,
+ OnNack (const Ptr<Face> &face,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &p);
virtual void
- DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
+ DidReceiveValidNack (const Ptr<Face> &incomingFace,
uint32_t nackCode,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
protected:
bool m_nacksEnabled;
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<const NdnFace> > m_outNacks; ///< @brief trace of outgoing NACKs
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<const Face> > m_outNacks; ///< @brief trace of outgoing NACKs
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<const NdnFace> > m_inNacks; ///< @brief trace of incoming NACKs
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<const Face> > m_inNacks; ///< @brief trace of incoming NACKs
- TracedCallback<Ptr<const NdnInterestHeader>,
- Ptr<const NdnFace> > m_dropNacks; ///< @brief trace of dropped NACKs
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<const Face> > m_dropNacks; ///< @brief trace of dropped NACKs
private:
- typedef NdnForwardingStrategy super;
+ typedef ForwardingStrategy super;
};
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
#endif // NDNSIM_NACKS
diff --git a/model/forwarding-strategy/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
similarity index 71%
rename from model/forwarding-strategy/ndn-forwarding-strategy.cc
rename to model/fw/ndn-forwarding-strategy.cc
index dedd60f..f1c92bd 100644
--- a/model/forwarding-strategy/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -44,77 +44,76 @@
#include <boost/tuple/tuple.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnForwardingStrategy");
+NS_LOG_COMPONENT_DEFINE ("ndn.ForwardingStrategy");
namespace ns3 {
+namespace ndn {
-using namespace __ndn_private;
+NS_OBJECT_ENSURE_REGISTERED (ForwardingStrategy);
-NS_OBJECT_ENSURE_REGISTERED (NdnForwardingStrategy);
-
-TypeId NdnForwardingStrategy::GetTypeId (void)
+TypeId ForwardingStrategy::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnForwardingStrategy")
+ static TypeId tid = TypeId ("ns3::ndn::ForwardingStrategy")
.SetGroupName ("Ndn")
.SetParent<Object> ()
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
- .AddTraceSource ("OutInterests", "OutInterests", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_outInterests))
- .AddTraceSource ("InInterests", "InInterests", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_inInterests))
- .AddTraceSource ("DropInterests", "DropInterests", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_dropInterests))
+ .AddTraceSource ("OutInterests", "OutInterests", MakeTraceSourceAccessor (&ForwardingStrategy::m_outInterests))
+ .AddTraceSource ("InInterests", "InInterests", MakeTraceSourceAccessor (&ForwardingStrategy::m_inInterests))
+ .AddTraceSource ("DropInterests", "DropInterests", MakeTraceSourceAccessor (&ForwardingStrategy::m_dropInterests))
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
- .AddTraceSource ("OutData", "OutData", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_outData))
- .AddTraceSource ("InData", "InData", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_inData))
- .AddTraceSource ("DropData", "DropData", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_dropData))
+ .AddTraceSource ("OutData", "OutData", MakeTraceSourceAccessor (&ForwardingStrategy::m_outData))
+ .AddTraceSource ("InData", "InData", MakeTraceSourceAccessor (&ForwardingStrategy::m_inData))
+ .AddTraceSource ("DropData", "DropData", MakeTraceSourceAccessor (&ForwardingStrategy::m_dropData))
.AddAttribute ("CacheUnsolicitedData", "Cache overheard data that have not been requested",
BooleanValue (false),
- MakeBooleanAccessor (&NdnForwardingStrategy::m_cacheUnsolicitedData),
+ MakeBooleanAccessor (&ForwardingStrategy::m_cacheUnsolicitedData),
MakeBooleanChecker ())
.AddAttribute ("DetectRetransmissions", "If non-duplicate interest is received on the same face more than once, "
"it is considered a retransmission",
BooleanValue (true),
- MakeBooleanAccessor (&NdnForwardingStrategy::m_detectRetransmissions),
+ MakeBooleanAccessor (&ForwardingStrategy::m_detectRetransmissions),
MakeBooleanChecker ())
;
return tid;
}
-NdnForwardingStrategy::NdnForwardingStrategy ()
+ForwardingStrategy::ForwardingStrategy ()
{
}
-NdnForwardingStrategy::~NdnForwardingStrategy ()
+ForwardingStrategy::~ForwardingStrategy ()
{
}
void
-NdnForwardingStrategy::NotifyNewAggregate ()
+ForwardingStrategy::NotifyNewAggregate ()
{
if (m_pit == 0)
{
- m_pit = GetObject<NdnPit> ();
+ m_pit = GetObject<Pit> ();
}
if (m_fib == 0)
{
- m_fib = GetObject<NdnFib> ();
+ m_fib = GetObject<Fib> ();
}
if (m_contentStore == 0)
{
- m_contentStore = GetObject<NdnContentStore> ();
+ m_contentStore = GetObject<ContentStore> ();
}
Object::NotifyNewAggregate ();
}
void
-NdnForwardingStrategy::DoDispose ()
+ForwardingStrategy::DoDispose ()
{
m_pit = 0;
m_contentStore = 0;
@@ -124,13 +123,13 @@
}
void
-NdnForwardingStrategy::OnInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> &header,
+ForwardingStrategy::OnInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &packet)
{
m_inInterests (header, incomingFace);
- Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
+ Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
if (pitEntry == 0)
{
pitEntry = m_pit->Create (header);
@@ -159,7 +158,7 @@
}
Ptr<Packet> contentObject;
- Ptr<const NdnContentObjectHeader> contentObjectHeader; // used for tracing
+ Ptr<const ContentObjectHeader> contentObjectHeader; // used for tracing
Ptr<const Packet> payload; // used for tracing
boost::tie (contentObject, contentObjectHeader, payload) = m_contentStore->Lookup (header);
if (contentObject != 0)
@@ -192,8 +191,8 @@
}
void
-NdnForwardingStrategy::OnData (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnContentObjectHeader> &header,
+ForwardingStrategy::OnData (const Ptr<Face> &incomingFace,
+ Ptr<ContentObjectHeader> &header,
Ptr<Packet> &payload,
const Ptr<const Packet> &packet)
{
@@ -201,7 +200,7 @@
m_inData (header, payload, incomingFace);
// Lookup PIT entry
- Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
+ Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
if (pitEntry == 0)
{
DidReceiveUnsolicitedData (incomingFace, header, payload);
@@ -228,10 +227,10 @@
void
-NdnForwardingStrategy::DidReceiveDuplicateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> &header,
+ForwardingStrategy::DidReceiveDuplicateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> &header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << boost::cref (*incomingFace));
/////////////////////////////////////////////////////////////////////////////////////////
@@ -244,18 +243,18 @@
}
void
-NdnForwardingStrategy::DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ForwardingStrategy::DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << boost::cref (*incomingFace));
m_dropInterests (header, incomingFace);
}
void
-NdnForwardingStrategy::FailedToCreatePitEntry (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ForwardingStrategy::FailedToCreatePitEntry (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet)
{
NS_LOG_FUNCTION (this);
@@ -263,18 +262,18 @@
}
void
-NdnForwardingStrategy::DidCreatePitEntry (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ForwardingStrategy::DidCreatePitEntry (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntrypitEntry)
+ Ptr<pit::Entry> pitEntrypitEntry)
{
}
bool
-NdnForwardingStrategy::DetectRetransmittedInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry)
+ForwardingStrategy::DetectRetransmittedInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry)
{
- NdnPitEntry::in_iterator inFace = pitEntry->GetIncoming ().find (incomingFace);
+ pit::Entry::in_iterator inFace = pitEntry->GetIncoming ().find (incomingFace);
bool isRetransmitted = false;
@@ -288,17 +287,17 @@
}
void
-NdnForwardingStrategy::SatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<const NdnContentObjectHeader> header,
+ForwardingStrategy::SatisfyPendingInterest (const Ptr<Face> &incomingFace,
+ Ptr<const ContentObjectHeader> header,
Ptr<const Packet> payload,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
if (incomingFace != 0)
pitEntry->RemoveIncoming (incomingFace);
//satisfy all pending incoming Interests
- BOOST_FOREACH (const NdnPitEntryIncomingFace &incoming, pitEntry->GetIncoming ())
+ BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
{
bool ok = incoming.m_face->Send (packet->Copy ());
if (ok)
@@ -328,8 +327,8 @@
}
void
-NdnForwardingStrategy::DidReceiveUnsolicitedData (const Ptr<NdnFace> &incomingFace,
- Ptr<const NdnContentObjectHeader> header,
+ForwardingStrategy::DidReceiveUnsolicitedData (const Ptr<Face> &incomingFace,
+ Ptr<const ContentObjectHeader> header,
Ptr<const Packet> payload)
{
if (m_cacheUnsolicitedData)
@@ -348,10 +347,10 @@
}
void
-NdnForwardingStrategy::WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry)
+ForwardingStrategy::WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry)
{
- NdnPitEntry::out_iterator out = pitEntry->GetOutgoing ().find (incomingFace);
+ pit::Entry::out_iterator out = pitEntry->GetOutgoing ().find (incomingFace);
// If we have sent interest for this data via this face, then update stats.
if (out != pitEntry->GetOutgoing ().end ())
@@ -361,8 +360,8 @@
}
bool
-NdnForwardingStrategy::ShouldSuppressIncomingInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnPitEntry> pitEntry)
+ForwardingStrategy::ShouldSuppressIncomingInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry)
{
bool isNew = pitEntry->GetIncoming ().size () == 0 && pitEntry->GetOutgoing ().size () == 0;
@@ -382,7 +381,7 @@
// ?? not sure if we need to do that ?? ...
- // pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW);
+ // pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, fib::FaceMetric::NDN_FIB_YELLOW);
}
else
if (!isNew && !isRetransmitted)
@@ -394,10 +393,10 @@
}
void
-NdnForwardingStrategy::PropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ForwardingStrategy::PropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
bool isRetransmitted = m_detectRetransmissions && // a small guard
DetectRetransmittedInterest (incomingFace, pitEntry);
@@ -427,11 +426,11 @@
}
bool
-NdnForwardingStrategy::WillSendOutInterest (const Ptr<NdnFace> &outgoingFace,
- Ptr<NdnInterestHeader> header,
- Ptr<NdnPitEntry> pitEntry)
+ForwardingStrategy::WillSendOutInterest (const Ptr<Face> &outgoingFace,
+ Ptr<InterestHeader> header,
+ Ptr<pit::Entry> pitEntry)
{
- NdnPitEntryOutgoingFaceContainer::type::iterator outgoing =
+ pit::Entry::out_iterator outgoing =
pitEntry->GetOutgoing ().find (outgoingFace);
if (outgoing != pitEntry->GetOutgoing ().end () &&
@@ -451,33 +450,34 @@
}
void
-NdnForwardingStrategy::DidSendOutInterest (const Ptr<NdnFace> &outgoingFace,
- Ptr<NdnInterestHeader> header,
+ForwardingStrategy::DidSendOutInterest (const Ptr<Face> &outgoingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
m_outInterests (header, outgoingFace);
}
void
-NdnForwardingStrategy::DidSendOutData (const Ptr<NdnFace> &face,
- Ptr<const NdnContentObjectHeader> header,
+ForwardingStrategy::DidSendOutData (const Ptr<Face> &face,
+ Ptr<const ContentObjectHeader> header,
Ptr<const Packet> payload,
const Ptr<const Packet> &packet)
{
}
void
-NdnForwardingStrategy::WillErasePendingInterest (Ptr<NdnPitEntry> pitEntry)
+ForwardingStrategy::WillErasePendingInterest (Ptr<pit::Entry> pitEntry)
{
// do nothing for now. may be need to do some logging
}
void
-NdnForwardingStrategy::RemoveFace (Ptr<NdnFace> face)
+ForwardingStrategy::RemoveFace (Ptr<Face> face)
{
// do nothing here
}
-} //namespace ns3
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fw/ndn-forwarding-strategy.h b/model/fw/ndn-forwarding-strategy.h
new file mode 100644
index 0000000..1d4111e
--- /dev/null
+++ b/model/fw/ndn-forwarding-strategy.h
@@ -0,0 +1,231 @@
+/* -*- 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>
+ * Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+#ifndef NDN_FORWARDING_STRATEGY_H
+#define NDN_FORWARDING_STRATEGY_H
+
+#include "ns3/packet.h"
+#include "ns3/callback.h"
+#include "ns3/object.h"
+#include "ns3/traced-callback.h"
+
+namespace ns3 {
+namespace ndn {
+
+class Face;
+class InterestHeader;
+class ContentObjectHeader;
+class Pit;
+namespace pit { class Entry; }
+class FibFaceMetric;
+class Fib;
+class ContentStore;
+
+/**
+ * \ingroup ndn
+ * \brief Abstract base class for Ndn forwarding strategies
+ */
+class ForwardingStrategy :
+ public Object
+{
+public:
+ static TypeId GetTypeId (void);
+
+ /**
+ * @brief Default constructor
+ */
+ ForwardingStrategy ();
+ virtual ~ForwardingStrategy ();
+
+ /**
+ * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
+ *
+ * Processing Interest packets
+ * @param face incoming face
+ * @param header deserialized Interest header
+ * @param packet original packet
+ */
+ virtual void
+ OnInterest (const Ptr<Face> &face,
+ Ptr<InterestHeader> &header,
+ const Ptr<const Packet> &p);
+
+ /**
+ * \brief Actual processing of incoming Ndn content objects
+ *
+ * Processing ContentObject packets
+ * @param face incoming face
+ * @param header deserialized ContentObject header
+ * @param payload data packet payload
+ * @param packet original packet
+ */
+ virtual void
+ OnData (const Ptr<Face> &face,
+ Ptr<ContentObjectHeader> &header,
+ Ptr<Packet> &payload,
+ const Ptr<const Packet> &packet);
+
+ virtual void
+ WillErasePendingInterest (Ptr<pit::Entry> pitEntry);
+
+ virtual void
+ RemoveFace (Ptr<Face> face);
+
+protected:
+ // events
+ virtual void
+ DidReceiveDuplicateInterest (const Ptr<Face> &face,
+ Ptr<InterestHeader> &header,
+ const Ptr<const Packet> &packet,
+ Ptr<pit::Entry> pitEntry);
+
+ virtual void
+ DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
+ const Ptr<const Packet> &packet,
+ Ptr<pit::Entry> pitEntry);
+
+ virtual void
+ FailedToCreatePitEntry (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
+ const Ptr<const Packet> &packet);
+
+ virtual void
+ DidCreatePitEntry (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
+ const Ptr<const Packet> &packet,
+ Ptr<pit::Entry> pitEntry);
+
+ virtual bool
+ DetectRetransmittedInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry);
+
+ // makes sense only for data received from network
+ // When Interest is satisfied from the cache, incoming face is 0
+ virtual void
+ WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry);
+
+ // for data received both from network and cache
+ virtual void
+ SatisfyPendingInterest (const Ptr<Face> &incomingFace, // 0 allowed (from cache)
+ Ptr<const ContentObjectHeader> header,
+ Ptr<const Packet> payload,
+ const Ptr<const Packet> &packet,
+ Ptr<pit::Entry> pitEntry);
+
+ virtual void
+ DidSendOutData (const Ptr<Face> &face,
+ Ptr<const ContentObjectHeader> header,
+ Ptr<const Packet> payload,
+ const Ptr<const Packet> &packet);
+
+ virtual void
+ DidReceiveUnsolicitedData (const Ptr<Face> &incomingFace,
+ Ptr<const ContentObjectHeader> header,
+ Ptr<const Packet> payload);
+
+ virtual bool
+ ShouldSuppressIncomingInterest (const Ptr<Face> &incomingFace,
+ Ptr<pit::Entry> pitEntry);
+
+ /**
+ * @brief Event fired before actually sending out an interest
+ *
+ * If event returns false, then there is some kind of a problem (e.g., per-face limit reached)
+ */
+ virtual bool
+ WillSendOutInterest (const Ptr<Face> &outgoingFace,
+ Ptr<InterestHeader> header,
+ Ptr<pit::Entry> pitEntry);
+
+ /**
+ * @brief Event fired just after sending out an interest
+ */
+ virtual void
+ DidSendOutInterest (const Ptr<Face> &outgoingFace,
+ Ptr<InterestHeader> header,
+ const Ptr<const Packet> &packet,
+ Ptr<pit::Entry> pitEntry);
+
+ virtual void
+ PropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
+ const Ptr<const Packet> &packet,
+ Ptr<pit::Entry> pitEntry);
+
+ /**
+ * @brief Base method to propagate the interest according to the forwarding strategy
+ *
+ * @param pitEntry Reference to PIT entry (reference to corresponding FIB entry inside)
+ * @param incomingFace Incoming face
+ * @param header InterestHeader
+ * @param packet Original Interest packet
+ * @param sendCallback Send callback
+ *
+ * @return true if interest was successfully propagated, false if all options have failed
+ */
+ virtual bool
+ DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
+ const Ptr<const Packet> &packet,
+ Ptr<pit::Entry> pitEntry) = 0;
+
+protected:
+ // inherited from Object class
+ virtual void NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object
+ virtual void DoDispose (); ///< @brief Do cleanup
+
+protected:
+ Ptr<Pit> m_pit; ///< \brief Reference to PIT to which this forwarding strategy is associated
+ Ptr<Fib> m_fib; ///< \brief FIB
+ Ptr<ContentStore> m_contentStore; ///< \brief Content store (for caching purposes only)
+
+ bool m_cacheUnsolicitedData;
+ bool m_detectRetransmissions;
+
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<const Face> > m_outInterests; ///< @brief Transmitted interests trace
+
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<const Face> > m_inInterests; ///< @brief trace of incoming Interests
+
+ TracedCallback<Ptr<const InterestHeader>,
+ Ptr<const Face> > m_dropInterests; ///< @brief trace of dropped Interests
+
+ ////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////
+
+ TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
+ bool /*from cache*/,
+ Ptr<const Face> > m_outData; ///< @brief trace of outgoing Data
+
+ TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
+ Ptr<const Face> > m_inData; ///< @brief trace of incoming Data
+
+ TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
+ Ptr<const Face> > m_dropData; ///< @brief trace of dropped Data
+};
+
+} // namespace ndn
+} // namespace ns3
+
+#endif /* NDN_FORWARDING_STRATEGY_H */
diff --git a/model/forwarding-strategy/smart-flooding.cc b/model/fw/smart-flooding.cc
similarity index 80%
rename from model/forwarding-strategy/smart-flooding.cc
rename to model/fw/smart-flooding.cc
index 58a56a2..53272e9 100644
--- a/model/forwarding-strategy/smart-flooding.cc
+++ b/model/fw/smart-flooding.cc
@@ -35,20 +35,18 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnSimSmartFlooding");
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.SmartFlooding");
namespace ns3 {
-
-using namespace __ndn_private;
-
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
NS_OBJECT_ENSURE_REGISTERED (SmartFlooding);
TypeId
SmartFlooding::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::ndnSIM::SmartFloodingy")
+ static TypeId tid = TypeId ("ns3::ndn::fw::SmartFlooding")
.SetGroupName ("Ndn")
.SetParent <GreenYellowRed> ()
.AddConstructor <SmartFlooding> ()
@@ -61,10 +59,10 @@
}
bool
-SmartFlooding::DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+SmartFlooding::DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
@@ -75,10 +73,10 @@
int propagatedCount = 0;
- BOOST_FOREACH (const NdnFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
+ BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
{
NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));
- if (metricFace.m_status == NdnFibFaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
+ if (metricFace.m_status == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
if (metricFace.m_face == incomingFace)
@@ -105,5 +103,6 @@
return propagatedCount > 0;
}
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
diff --git a/model/forwarding-strategy/smart-flooding.h b/model/fw/smart-flooding.h
similarity index 83%
rename from model/forwarding-strategy/smart-flooding.h
rename to model/fw/smart-flooding.h
index c939015..a228d3e 100644
--- a/model/forwarding-strategy/smart-flooding.h
+++ b/model/fw/smart-flooding.h
@@ -24,7 +24,8 @@
#include "green-yellow-red.h"
namespace ns3 {
-namespace ndnSIM {
+namespace ndn {
+namespace fw {
/**
* \ingroup ccnx
@@ -33,7 +34,7 @@
public GreenYellowRed
{
public:
- static TypeId GetTypeId (void);
+ static TypeId GetTypeId ();
/**
* @brief Default constructor
@@ -42,16 +43,17 @@
// inherited
virtual bool
- DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
- Ptr<NdnInterestHeader> header,
+ DoPropagateInterest (const Ptr<Face> &incomingFace,
+ Ptr<InterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<NdnPitEntry> pitEntry);
+ Ptr<pit::Entry> pitEntry);
private:
typedef GreenYellowRed super;
};
-} // namespace ndnSIM
+} // namespace fw
+} // namespace ndn
} // namespace ns3
#endif // NDNSIM_SMART_FLOODING_H
diff --git a/model/ndn-app-face.cc b/model/ndn-app-face.cc
index 55cee9b..538b10c 100644
--- a/model/ndn-app-face.cc
+++ b/model/ndn-app-face.cc
@@ -34,25 +34,25 @@
#include "ndn-interest-header.h"
#include "ndn-content-object-header.h"
-NS_LOG_COMPONENT_DEFINE ("NdnAppFace");
+NS_LOG_COMPONENT_DEFINE ("ndn.AppFace");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnAppFace);
+NS_OBJECT_ENSURE_REGISTERED (AppFace);
TypeId
-NdnAppFace::GetTypeId ()
+AppFace::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::NdnAppFace")
- .SetParent<NdnFace> ()
+ static TypeId tid = TypeId ("ns3::ndn::AppFace")
+ .SetParent<Face> ()
.SetGroupName ("Ndn")
;
return tid;
}
-NdnAppFace::NdnAppFace (Ptr<NdnApp> app)
- : NdnFace (app->GetNode ())
+AppFace::AppFace (Ptr<App> app)
+ : Face (app->GetNode ())
, m_app (app)
{
NS_LOG_FUNCTION (this << app);
@@ -60,50 +60,50 @@
NS_ASSERT (m_app != 0);
}
-NdnAppFace::~NdnAppFace ()
+AppFace::~AppFace ()
{
NS_LOG_FUNCTION_NOARGS ();
}
-NdnAppFace::NdnAppFace ()
- : NdnFace (0)
+AppFace::AppFace ()
+ : Face (0)
{
}
-NdnAppFace::NdnAppFace (const NdnAppFace &)
- : NdnFace (0)
+AppFace::AppFace (const AppFace &)
+ : Face (0)
{
}
-NdnAppFace& NdnAppFace::operator= (const NdnAppFace &)
+AppFace& AppFace::operator= (const AppFace &)
{
- return *((NdnAppFace*)0);
+ return *((AppFace*)0);
}
void
-NdnAppFace::RegisterProtocolHandler (ProtocolHandler handler)
+AppFace::RegisterProtocolHandler (ProtocolHandler handler)
{
NS_LOG_FUNCTION (this);
- NdnFace::RegisterProtocolHandler (handler);
+ Face::RegisterProtocolHandler (handler);
- m_app->RegisterProtocolHandler (MakeCallback (&NdnFace::Receive, this));
+ m_app->RegisterProtocolHandler (MakeCallback (&Face::Receive, this));
}
bool
-NdnAppFace::SendImpl (Ptr<Packet> p)
+AppFace::SendImpl (Ptr<Packet> p)
{
NS_LOG_FUNCTION (this << p);
try
{
- NdnHeaderHelper::Type type = NdnHeaderHelper::GetNdnHeaderType (p);
+ HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (p);
switch (type)
{
- case NdnHeaderHelper::INTEREST:
+ case HeaderHelper::INTEREST:
{
- Ptr<NdnInterestHeader> header = Create<NdnInterestHeader> ();
+ Ptr<InterestHeader> header = Create<InterestHeader> ();
p->RemoveHeader (*header);
if (header->GetNack () > 0)
@@ -113,10 +113,10 @@
break;
}
- case NdnHeaderHelper::CONTENT_OBJECT:
+ case HeaderHelper::CONTENT_OBJECT:
{
- static NdnContentObjectTail tail;
- Ptr<NdnContentObjectHeader> header = Create<NdnContentObjectHeader> ();
+ static ContentObjectTail tail;
+ Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
p->RemoveHeader (*header);
p->RemoveTrailer (tail);
m_app->OnContentObject (header, p/*payload*/);
@@ -127,7 +127,7 @@
return true;
}
- catch (NdnUnknownHeaderException)
+ catch (UnknownHeaderException)
{
NS_LOG_ERROR ("Unknown header type");
return false;
@@ -135,11 +135,12 @@
}
std::ostream&
-NdnAppFace::Print (std::ostream& os) const
+AppFace::Print (std::ostream& os) const
{
os << "dev=local(" << GetId() << ")";
return os;
}
-}; // namespace ns3
+} // namespace ndn
+} // namespace ns3
diff --git a/model/ndn-app-face.h b/model/ndn-app-face.h
index 9a9d2c5..2e58705 100644
--- a/model/ndn-app-face.h
+++ b/model/ndn-app-face.h
@@ -25,13 +25,15 @@
#include "ndn-face.h"
#include "ns3/traced-callback.h"
-namespace ns3
-{
+namespace ns3 {
-class NdnInterestHeader;
-class NdnContentObjectHeader;
class Packet;
-class NdnApp;
+
+namespace ndn {
+
+class InterestHeader;
+class ContentObjectHeader;
+class App;
/**
* \ingroup ndn-face
@@ -41,9 +43,9 @@
* component responsible for actual delivery of data packet to and
* from Ndn stack
*
- * \see NdnAppFace, NdnNetDeviceFace, NdnIpv4Face, NdnUdpFace
+ * \see AppFace, NdnNetDeviceFace, NdnIpv4Face, NdnUdpFace
*/
-class NdnAppFace : public NdnFace
+class AppFace : public Face
{
public:
static TypeId
@@ -52,11 +54,11 @@
/**
* \brief Default constructor
*/
- NdnAppFace (Ptr<NdnApp> app);
- virtual ~NdnAppFace();
+ AppFace (Ptr<App> app);
+ virtual ~AppFace();
////////////////////////////////////////////////////////////////////
- // methods overloaded from NdnFace
+ // methods overloaded from Face
virtual void
RegisterProtocolHandler (ProtocolHandler handler);
@@ -70,14 +72,15 @@
////////////////////////////////////////////////////////////////////
private:
- NdnAppFace ();
- NdnAppFace (const NdnAppFace &); ///< \brief Disabled copy constructor
- NdnAppFace& operator= (const NdnAppFace &); ///< \brief Disabled copy operator
+ AppFace ();
+ AppFace (const AppFace &); ///< \brief Disabled copy constructor
+ AppFace& operator= (const AppFace &); ///< \brief Disabled copy operator
private:
- Ptr<NdnApp> m_app;
+ Ptr<App> m_app;
};
+} // namespace ndn
} // namespace ns3
#endif // NDN_APP_FACE_H
diff --git a/model/ndn-content-object-header.cc b/model/ndn-content-object-header.cc
index 2a480d8..1a31abb 100644
--- a/model/ndn-content-object-header.cc
+++ b/model/ndn-content-object-header.cc
@@ -25,76 +25,76 @@
#include "../helper/ndn-encoding-helper.h"
#include "../helper/ndn-decoding-helper.h"
-#include "../helper/ccnb-parser/ccnb-parser-common.h"
-#include "../helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.h"
-#include "../helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.h"
-#include "../helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.h"
-#include "../helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.h"
-#include "../helper/ccnb-parser/visitors/ccnb-parser-string-visitor.h"
-#include "../helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h"
-#include "../helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h"
+#include "../helper/ccnb-parser/common.h"
+#include "../helper/ccnb-parser/visitors/void-depth-first-visitor.h"
+#include "../helper/ccnb-parser/visitors/name-components-visitor.h"
+#include "../helper/ccnb-parser/visitors/non-negative-integer-visitor.h"
+#include "../helper/ccnb-parser/visitors/timestamp-visitor.h"
+#include "../helper/ccnb-parser/visitors/string-visitor.h"
+#include "../helper/ccnb-parser/visitors/uint32t-blob-visitor.h"
+#include "../helper/ccnb-parser/visitors/content-type-visitor.h"
-#include "../helper/ccnb-parser/syntax-tree/ccnb-parser-block.h"
-#include "../helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.h"
+#include "../helper/ccnb-parser/syntax-tree/block.h"
+#include "../helper/ccnb-parser/syntax-tree/dtag.h"
#include <boost/foreach.hpp>
-NS_LOG_COMPONENT_DEFINE ("NdnContentObjectHeader");
+NS_LOG_COMPONENT_DEFINE ("ndn.ContentObjectHeader");
-using namespace ns3::CcnbParser;
+namespace ns3 {
+namespace ndn {
-namespace ns3
-{
+using namespace CcnbParser;
-const std::string NdnContentObjectHeader::Signature::DefaultDigestAlgorithm = "2.16.840.1.101.3.4.2.1";
+const std::string ContentObjectHeader::Signature::DefaultDigestAlgorithm = "2.16.840.1.101.3.4.2.1";
-NS_OBJECT_ENSURE_REGISTERED (NdnContentObjectHeader);
-NS_OBJECT_ENSURE_REGISTERED (NdnContentObjectTail);
+NS_OBJECT_ENSURE_REGISTERED (ContentObjectHeader);
+NS_OBJECT_ENSURE_REGISTERED (ContentObjectTail);
TypeId
-NdnContentObjectHeader::GetTypeId (void)
+ContentObjectHeader::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnContentObjectHeader")
- .SetGroupName ("ndn")
+ static TypeId tid = TypeId ("ns3::ndn::ContentObjectHeader")
+ .SetGroupName ("Ndn")
.SetParent<Header> ()
- .AddConstructor<NdnContentObjectHeader> ()
+ .AddConstructor<ContentObjectHeader> ()
;
return tid;
}
-NdnContentObjectHeader::NdnContentObjectHeader ()
+ContentObjectHeader::ContentObjectHeader ()
{
}
void
-NdnContentObjectHeader::SetName (const Ptr<NdnNameComponents> &name)
+ContentObjectHeader::SetName (const Ptr<NameComponents> &name)
{
m_name = name;
}
-const NdnNameComponents&
-NdnContentObjectHeader::GetName () const
+const NameComponents&
+ContentObjectHeader::GetName () const
{
- if (m_name==0) throw NdnContentObjectHeaderException();
+ if (m_name==0) throw ContentObjectHeaderException();
return *m_name;
}
-Ptr<const NdnNameComponents>
-NdnContentObjectHeader::GetNamePtr () const
+Ptr<const NameComponents>
+ContentObjectHeader::GetNamePtr () const
{
return m_name;
}
-#define CCNB NdnEncodingHelper // just to simplify writing
+#define CCNB EncodingHelper // just to simplify writing
void
-NdnContentObjectHeader::Serialize (Buffer::Iterator start) const
+ContentObjectHeader::Serialize (Buffer::Iterator start) const
{
size_t written = 0;
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_ContentObject, CcnbParser::CCN_DTAG); // <ContentObject>
+ written += CCNB::AppendBlockHeader (start, CCN_DTAG_ContentObject, CCN_DTAG); // <ContentObject>
// fake signature
- written += CCNB::AppendBlockHeader (start, CCN_DTAG_Signature, CcnbParser::CCN_DTAG); // <Signature>
+ written += CCNB::AppendBlockHeader (start, CCN_DTAG_Signature, CCN_DTAG); // <Signature>
// Signature ::= √DigestAlgorithm?
// Witness?
// √SignatureBits
@@ -159,11 +159,11 @@
written += CCNB::AppendBlockHeader (start, CCN_DTAG_Content, CCN_DTAG); // <Content>
// there are no closing tags !!!
- // The closing tag is handled by NdnContentObjectTail
+ // The closing tag is handled by ContentObjectTail
}
uint32_t
-NdnContentObjectHeader::GetSerializedSize () const
+ContentObjectHeader::GetSerializedSize () const
{
size_t written = 0;
written += CCNB::EstimateBlockHeader (CCN_DTAG_ContentObject); // <ContentObject>
@@ -232,7 +232,7 @@
written += CCNB::EstimateBlockHeader (CCN_DTAG_Content); // <Content>
// there are no closing tags !!!
- // The closing tag is handled by NdnContentObjectTail
+ // The closing tag is handled by ContentObjectTail
return written;
}
#undef CCNB
@@ -240,7 +240,7 @@
class ContentObjectVisitor : public VoidDepthFirstVisitor
{
public:
- virtual void visit (Dtag &n, boost::any param/*should be NdnContentObjectHeader* */)
+ virtual void visit (Dtag &n, boost::any param/*should be ContentObjectHeader* */)
{
// uint32_t n.m_dtag;
// std::list<Ptr<Block> > n.m_nestedBlocks;
@@ -251,7 +251,7 @@
static Uint32tBlobVisitor uint32tBlobVisitor;
static ContentTypeVisitor contentTypeVisitor;
- NdnContentObjectHeader &contentObject = *(boost::any_cast<NdnContentObjectHeader*> (param));
+ ContentObjectHeader &contentObject = *(boost::any_cast<ContentObjectHeader*> (param));
switch (n.m_dtag)
{
@@ -265,7 +265,7 @@
case CCN_DTAG_Name:
{
// process name components
- Ptr<NdnNameComponents> name = Create<NdnNameComponents> ();
+ Ptr<NameComponents> name = Create<NameComponents> ();
BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
{
@@ -337,7 +337,7 @@
throw CcnbDecodingException ();
contentObject.GetSignedInfo ().SetContentType
- (static_cast<NdnContentObjectHeader::ContentType>
+ (static_cast<ContentObjectHeader::ContentType>
(boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
(contentTypeVisitor))));
break;
@@ -372,7 +372,7 @@
throw CcnbDecodingException ();
// process name components
- Ptr<NdnNameComponents> name = Create<NdnNameComponents> ();
+ Ptr<NameComponents> name = Create<NameComponents> ();
BOOST_FOREACH (Ptr<Block> block, nameTag->m_nestedTags)
{
@@ -394,25 +394,25 @@
};
uint32_t
-NdnContentObjectHeader::Deserialize (Buffer::Iterator start)
+ContentObjectHeader::Deserialize (Buffer::Iterator start)
{
static ContentObjectVisitor contentObjectVisitor;
Buffer::Iterator i = start;
- Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
+ Ptr<Block> root = Block::ParseBlock (i);
root->accept (contentObjectVisitor, this);
return i.GetDistanceFrom (start);
}
TypeId
-NdnContentObjectHeader::GetInstanceTypeId (void) const
+ContentObjectHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
void
-NdnContentObjectHeader::Print (std::ostream &os) const
+ContentObjectHeader::Print (std::ostream &os) const
{
os << "D: " << GetName ();
// os << "<ContentObject><Name>" << GetName () << "</Name><Content>";
@@ -420,40 +420,40 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-NdnContentObjectTail::NdnContentObjectTail ()
+ContentObjectTail::ContentObjectTail ()
{
}
TypeId
-NdnContentObjectTail::GetTypeId (void)
+ContentObjectTail::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnContentObjectTail")
+ static TypeId tid = TypeId ("ns3::ndn::ContentObjectTail")
.SetParent<Trailer> ()
- .AddConstructor<NdnContentObjectTail> ()
+ .AddConstructor<ContentObjectTail> ()
;
return tid;
}
TypeId
-NdnContentObjectTail::GetInstanceTypeId (void) const
+ContentObjectTail::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
void
-NdnContentObjectTail::Print (std::ostream &os) const
+ContentObjectTail::Print (std::ostream &os) const
{
os << "</Content></ContentObject>";
}
uint32_t
-NdnContentObjectTail::GetSerializedSize (void) const
+ContentObjectTail::GetSerializedSize (void) const
{
return 2;
}
void
-NdnContentObjectTail::Serialize (Buffer::Iterator start) const
+ContentObjectTail::Serialize (Buffer::Iterator start) const
{
Buffer::Iterator i = start;
i.Prev (2); // Trailer interface requires us to go backwards
@@ -463,7 +463,7 @@
}
uint32_t
-NdnContentObjectTail::Deserialize (Buffer::Iterator start)
+ContentObjectTail::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
i.Prev (2); // Trailer interface requires us to go backwards
@@ -481,7 +481,7 @@
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
-NdnContentObjectHeader::SignedInfo::SignedInfo ()
+ContentObjectHeader::SignedInfo::SignedInfo ()
: m_publisherPublicKeyDigest (0)
// , m_timestamp
, m_type (DATA)
@@ -492,63 +492,64 @@
}
void
-NdnContentObjectHeader::SignedInfo::SetPublisherPublicKeyDigest (uint32_t digest)
+ContentObjectHeader::SignedInfo::SetPublisherPublicKeyDigest (uint32_t digest)
{
m_publisherPublicKeyDigest = digest;
}
uint32_t
-NdnContentObjectHeader::SignedInfo::GetPublisherPublicKeyDigest () const
+ContentObjectHeader::SignedInfo::GetPublisherPublicKeyDigest () const
{
return m_publisherPublicKeyDigest;
}
void
-NdnContentObjectHeader::SignedInfo::SetTimestamp (const Time ×tamp)
+ContentObjectHeader::SignedInfo::SetTimestamp (const Time ×tamp)
{
m_timestamp = timestamp;
}
Time
-NdnContentObjectHeader::SignedInfo::GetTimestamp () const
+ContentObjectHeader::SignedInfo::GetTimestamp () const
{
return m_timestamp;
}
void
-NdnContentObjectHeader::SignedInfo::SetContentType (NdnContentObjectHeader::ContentType type)
+ContentObjectHeader::SignedInfo::SetContentType (ContentObjectHeader::ContentType type)
{
m_type = type;
}
-NdnContentObjectHeader::ContentType
-NdnContentObjectHeader::SignedInfo::GetContentType () const
+ContentObjectHeader::ContentType
+ContentObjectHeader::SignedInfo::GetContentType () const
{
return m_type;
}
void
-NdnContentObjectHeader::SignedInfo::SetFreshness (const Time &freshness)
+ContentObjectHeader::SignedInfo::SetFreshness (const Time &freshness)
{
m_freshness = freshness;
}
Time
-NdnContentObjectHeader::SignedInfo::GetFreshness () const
+ContentObjectHeader::SignedInfo::GetFreshness () const
{
return m_freshness;
}
void
-NdnContentObjectHeader::SignedInfo::SetKeyLocator (Ptr<const NdnNameComponents> keyLocator)
+ContentObjectHeader::SignedInfo::SetKeyLocator (Ptr<const NameComponents> keyLocator)
{
m_keyLocator = keyLocator;
}
-Ptr<const NdnNameComponents>
-NdnContentObjectHeader::SignedInfo::GetKeyLocator () const
+Ptr<const NameComponents>
+ContentObjectHeader::SignedInfo::GetKeyLocator () const
{
return m_keyLocator;
}
+} // namespace ndn
} // namespace ns3
diff --git a/model/ndn-content-object-header.h b/model/ndn-content-object-header.h
index 0266cc9..64fc3e5 100644
--- a/model/ndn-content-object-header.h
+++ b/model/ndn-content-object-header.h
@@ -34,8 +34,8 @@
#include "ndn-name-components.h"
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
/**
* Ndn XML definition of ContentObject
@@ -51,7 +51,7 @@
* "<ContentObject><Signature>..</Signature><Name>...</Name><SignedInfo>...</SignedInfo><Content>"
*
*/
-class NdnContentObjectHeader : public SimpleRefCount<NdnContentObjectHeader,Header>
+class ContentObjectHeader : public SimpleRefCount<ContentObjectHeader,Header>
{
public:
////////////////////////////////////////////////////////////////////////////
@@ -195,14 +195,14 @@
* Note that only <KeyName> option for the key locator is supported
*/
void
- SetKeyLocator (Ptr<const NdnNameComponents> keyLocator);
+ SetKeyLocator (Ptr<const NameComponents> keyLocator);
/**
* @brief Get key locator
*
* Note that only <KeyName> option for the key locator is supported
*/
- Ptr<const NdnNameComponents>
+ Ptr<const NameComponents>
GetKeyLocator () const;
private:
@@ -211,7 +211,7 @@
ContentType m_type;
Time m_freshness;
// FinalBlockID
- Ptr<const NdnNameComponents> m_keyLocator; // support only <KeyName> option for KeyLocator
+ Ptr<const NameComponents> m_keyLocator; // support only <KeyName> option for KeyLocator
};
////////////////////////////////////////////////////////////////////////////
@@ -226,26 +226,26 @@
*
* Creates a null header
**/
- NdnContentObjectHeader ();
+ ContentObjectHeader ();
/**
* \brief Set content object name
*
- * Sets name of the content object. For example, SetName( NdnNameComponents("prefix")("postfix") );
+ * Sets name of the content object. For example, SetName( NameComponents("prefix")("postfix") );
**/
void
- SetName (const Ptr<NdnNameComponents> &name);
+ SetName (const Ptr<NameComponents> &name);
/**
* @brief Get name of the content object
*/
- const NdnNameComponents&
+ const NameComponents&
GetName () const;
/**
* @brief Get smart pointer to the interest name (to avoid extra memory usage)
*/
- Ptr<const NdnNameComponents>
+ Ptr<const NameComponents>
GetNamePtr () const;
/**
@@ -283,7 +283,7 @@
private:
Signature m_signature;
- Ptr<NdnNameComponents> m_name;
+ Ptr<NameComponents> m_name;
SignedInfo m_signedInfo;
};
@@ -291,10 +291,10 @@
* ContentObjectTail should always be 2 bytes, representing two closing tags:
* "</Content><ContentObject>"
*/
-class NdnContentObjectTail : public Trailer
+class ContentObjectTail : public Trailer
{
public:
- NdnContentObjectTail ();
+ ContentObjectTail ();
//////////////////////////////////////////////////////////////////
static TypeId GetTypeId (void); ///< @brief Get TypeId
@@ -306,66 +306,68 @@
};
-NdnContentObjectHeader::Signature::Signature ()
+ContentObjectHeader::Signature::Signature ()
: m_digestAlgorithm ("99.0")
, m_signatureBits (0)
{
}
const std::string &
-NdnContentObjectHeader::Signature::GetDigestAlgorithm () const
+ContentObjectHeader::Signature::GetDigestAlgorithm () const
{
return m_digestAlgorithm;
}
void
-NdnContentObjectHeader::Signature::SetDigestAlgorithm (const std::string &digestAlgorithm)
+ContentObjectHeader::Signature::SetDigestAlgorithm (const std::string &digestAlgorithm)
{
m_digestAlgorithm = digestAlgorithm;
}
uint32_t
-NdnContentObjectHeader::Signature::GetSignatureBits () const
+ContentObjectHeader::Signature::GetSignatureBits () const
{
return m_signatureBits;
}
inline void
-NdnContentObjectHeader::Signature::SetSignatureBits (uint32_t signature)
+ContentObjectHeader::Signature::SetSignatureBits (uint32_t signature)
{
m_signatureBits = signature;
}
-NdnContentObjectHeader::Signature &
-NdnContentObjectHeader::GetSignature ()
+ContentObjectHeader::Signature &
+ContentObjectHeader::GetSignature ()
{
return m_signature;
}
-const NdnContentObjectHeader::Signature &
-NdnContentObjectHeader::GetSignature () const
+const ContentObjectHeader::Signature &
+ContentObjectHeader::GetSignature () const
{
return m_signature;
}
-NdnContentObjectHeader::SignedInfo &
-NdnContentObjectHeader::GetSignedInfo ()
+ContentObjectHeader::SignedInfo &
+ContentObjectHeader::GetSignedInfo ()
{
return m_signedInfo;
}
-const NdnContentObjectHeader::SignedInfo &
-NdnContentObjectHeader::GetSignedInfo () const
+const ContentObjectHeader::SignedInfo &
+ContentObjectHeader::GetSignedInfo () const
{
return m_signedInfo;
}
/**
+ * @ingroup ndn-exceptions
* @brief Class for ContentObject parsing exception
*/
-class NdnContentObjectHeaderException {};
+class ContentObjectHeaderException {};
+} // namespace ndn
} // namespace ns3
#endif // _NDN_CONTENT_OBJECT_HEADER_H_
diff --git a/model/ndn-face.cc b/model/ndn-face.cc
index 316b1df..936021d 100644
--- a/model/ndn-face.cc
+++ b/model/ndn-face.cc
@@ -35,49 +35,50 @@
#include <boost/ref.hpp>
-NS_LOG_COMPONENT_DEFINE ("NdnFace");
+NS_LOG_COMPONENT_DEFINE ("ndn.Face");
namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnFace);
+NS_OBJECT_ENSURE_REGISTERED (Face);
TypeId
-NdnFace::GetTypeId ()
+Face::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::NdnFace")
+ static TypeId tid = TypeId ("ns3::ndn::Face")
.SetParent<Object> ()
.SetGroupName ("Ndn")
.AddAttribute ("Id", "Face id (unique integer for the Ndn stack on this node)",
TypeId::ATTR_GET, // allow only getting it.
UintegerValue (0),
- MakeUintegerAccessor (&NdnFace::m_id),
+ MakeUintegerAccessor (&Face::m_id),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("BucketMax", "Maximum size of leaky bucket",
DoubleValue (-1.0),
- MakeDoubleAccessor (&NdnFace::m_bucketMax),
+ MakeDoubleAccessor (&Face::m_bucketMax),
MakeDoubleChecker<double> ())
.AddAttribute ("BucketLeak", "Normalized bucket leak size",
DoubleValue (0.0),
- MakeDoubleAccessor (&NdnFace::m_bucketLeak),
+ MakeDoubleAccessor (&Face::m_bucketLeak),
MakeDoubleChecker<double> ())
.AddAttribute ("RandomizeLimitChecking", "Whether or not to randomize the limit checking procedure. false (persistent) by default",
BooleanValue (false),
- MakeBooleanAccessor (&NdnFace::m_randomizeLimitChecking),
+ MakeBooleanAccessor (&Face::m_randomizeLimitChecking),
MakeBooleanChecker ())
// .AddAttribute ("MetricTagging", "Enable metric tagging (path-stretch calculation)",
// BooleanValue (false),
- // MakeBooleanAccessor (&NdnFace::m_enableMetricTagging),
+ // MakeBooleanAccessor (&Face::m_enableMetricTagging),
// MakeBooleanChecker ())
.AddTraceSource ("NdnTx", "Transmitted packet trace",
- MakeTraceSourceAccessor (&NdnFace::m_ndnTxTrace))
+ MakeTraceSourceAccessor (&Face::m_txTrace))
.AddTraceSource ("NdnRx", "Received packet trace",
- MakeTraceSourceAccessor (&NdnFace::m_ndnRxTrace))
+ MakeTraceSourceAccessor (&Face::m_rxTrace))
.AddTraceSource ("NdnDrop", "Dropped packet trace",
- MakeTraceSourceAccessor (&NdnFace::m_ndnDropTrace))
+ MakeTraceSourceAccessor (&Face::m_dropTrace))
;
return tid;
}
@@ -87,12 +88,12 @@
* with no IP addresses. Before becoming useable, the user must
* invoke SetUp on them once an Ndn address and mask have been set.
*/
-NdnFace::NdnFace (Ptr<Node> node)
+Face::Face (Ptr<Node> node)
: m_node (node)
, m_bucket (0.0)
, m_bucketMax (-1.0)
, m_bucketLeak (0.0)
- , m_protocolHandler (MakeNullCallback<void,const Ptr<NdnFace>&,const Ptr<const Packet>&> ())
+ , m_protocolHandler (MakeNullCallback<void,const Ptr<Face>&,const Ptr<const Packet>&> ())
, m_ifup (false)
, m_id ((uint32_t)-1)
, m_lastLeakTime (0)
@@ -104,28 +105,28 @@
NS_ASSERT_MSG (node != 0, "node cannot be NULL. Check the code");
}
-NdnFace::~NdnFace ()
+Face::~Face ()
{
NS_LOG_FUNCTION_NOARGS ();
}
-NdnFace::NdnFace (const NdnFace &)
+Face::Face (const Face &)
{
}
-NdnFace& NdnFace::operator= (const NdnFace &)
+Face& Face::operator= (const Face &)
{
return *this;
}
Ptr<Node>
-NdnFace::GetNode () const
+Face::GetNode () const
{
return m_node;
}
void
-NdnFace::RegisterProtocolHandler (ProtocolHandler handler)
+Face::RegisterProtocolHandler (ProtocolHandler handler)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -133,14 +134,14 @@
}
bool
-NdnFace::IsBelowLimit ()
+Face::IsBelowLimit ()
{
NS_LOG_FUNCTION_NOARGS ();
/// \todo Implement tracing, if requested
if (!IsUp ()){
- NS_LOG_INFO("NdnFace is not up.");
+ NS_LOG_INFO("Face is not up.");
return false;
}
@@ -182,14 +183,14 @@
}
bool
-NdnFace::Send (Ptr<Packet> packet)
+Face::Send (Ptr<Packet> packet)
{
NS_LOG_FUNCTION (boost::cref (*this) << packet << packet->GetSize ());
NS_LOG_DEBUG (*packet);
if (!IsUp ())
{
- m_ndnDropTrace (packet);
+ m_dropTrace (packet);
return false;
}
@@ -214,18 +215,18 @@
bool ok = SendImpl (packet);
if (ok)
{
- m_ndnTxTrace (packet);
+ m_txTrace (packet);
return true;
}
else
{
- m_ndnDropTrace (packet);
+ m_dropTrace (packet);
return false;
}
}
bool
-NdnFace::Receive (const Ptr<const Packet> &packet)
+Face::Receive (const Ptr<const Packet> &packet)
{
NS_LOG_FUNCTION (boost::cref (*this) << packet << packet->GetSize ());
@@ -235,14 +236,14 @@
return false;
}
- m_ndnRxTrace (packet);
+ m_rxTrace (packet);
m_protocolHandler (this, packet);
return true;
}
void
-NdnFace::LeakBucket ()
+Face::LeakBucket ()
{
if (m_lastLeakTime.IsZero ())
{
@@ -262,28 +263,28 @@
}
void
-NdnFace::SetBucketMax (double bucket)
+Face::SetBucketMax (double bucket)
{
NS_LOG_FUNCTION (this << bucket);
m_bucketMax = bucket;
}
void
-NdnFace::SetBucketLeak (double leak)
+Face::SetBucketLeak (double leak)
{
NS_LOG_FUNCTION (this << leak);
m_bucketLeak = leak;
}
void
-NdnFace::SetMetric (uint16_t metric)
+Face::SetMetric (uint16_t metric)
{
NS_LOG_FUNCTION (metric);
m_metric = metric;
}
uint16_t
-NdnFace::GetMetric (void) const
+Face::GetMetric (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_metric;
@@ -296,21 +297,21 @@
*/
bool
-NdnFace::IsUp (void) const
+Face::IsUp (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_ifup;
}
void
-NdnFace::SetUp (bool up/* = true*/)
+Face::SetUp (bool up/* = true*/)
{
NS_LOG_FUNCTION_NOARGS ();
m_ifup = up;
}
bool
-NdnFace::operator== (const NdnFace &face) const
+Face::operator== (const Face &face) const
{
NS_ASSERT_MSG (m_node->GetId () == face.m_node->GetId (),
"Faces of different nodes should not be compared to each other");
@@ -319,7 +320,7 @@
}
bool
-NdnFace::operator< (const NdnFace &face) const
+Face::operator< (const Face &face) const
{
NS_ASSERT_MSG (m_node->GetId () == face.m_node->GetId (),
"Faces of different nodes should not be compared to each other");
@@ -328,18 +329,19 @@
}
std::ostream&
-NdnFace::Print (std::ostream &os) const
+Face::Print (std::ostream &os) const
{
os << "id=" << GetId ();
return os;
}
std::ostream&
-operator<< (std::ostream& os, const NdnFace &face)
+operator<< (std::ostream& os, const Face &face)
{
face.Print (os);
return os;
}
-}; // namespace ns3
+} // namespace ndn
+} // namespace ns3
diff --git a/model/ndn-face.h b/model/ndn-face.h
index e785ac9..0e98905 100644
--- a/model/ndn-face.h
+++ b/model/ndn-face.h
@@ -33,22 +33,24 @@
class Packet;
class Node;
-
+
+namespace ndn {
+
/**
* \ingroup ndn
* \defgroup ndn-face Faces
*/
/**
* \ingroup ndn-face
- * \brief Virtual class defining Ndn face
+ * \brief Virtual class defining NDN face
*
- * This class defines basic functionality of Ndn face. Face is core
+ * This class defines basic functionality of NDN face. Face is core
* component responsible for actual delivery of data packet to and
- * from Ndn stack
+ * from NDN stack
*
- * \see NdnLocalFace, NdnNetDeviceFace, NdnIpv4Face, NdnUdpFace
+ * \see ndn::LocalFace, ndn::NetDeviceFace, ndn::Ipv4Face, ndn::UdpFace
*/
-class NdnFace : public Object
+class Face : public Object
{
public:
static TypeId
@@ -60,13 +62,13 @@
* \param face Face from which packet has been received
* \param packet Original packet
*/
- typedef Callback<void,const Ptr<NdnFace>&,const Ptr<const Packet>& > ProtocolHandler;
+ typedef Callback<void,const Ptr<Face>&,const Ptr<const Packet>& > ProtocolHandler;
/**
* \brief Default constructor
*/
- NdnFace (Ptr<Node> node);
- virtual ~NdnFace();
+ Face (Ptr<Node> node);
+ virtual ~Face();
/**
* @brief Get node to which this face is associated
@@ -201,7 +203,7 @@
* Internal index is used for comparison.
*/
bool
- operator== (const NdnFace &face) const;
+ operator== (const Face &face) const;
/**
* \brief Compare two faces. Only two faces on the same node could be compared.
@@ -209,7 +211,7 @@
* Internal index is used for comparison.
*/
inline bool
- operator!= (const NdnFace &face) const;
+ operator!= (const Face &face) const;
/**
* \brief Compare two faces. Only two faces on the same node could be compared.
@@ -217,7 +219,7 @@
* Internal index is used for comparison.
*/
bool
- operator< (const NdnFace &face) const;
+ operator< (const Face &face) const;
protected:
/**
@@ -229,8 +231,8 @@
SendImpl (Ptr<Packet> p) = 0;
private:
- NdnFace (const NdnFace &); ///< \brief Disabled copy constructor
- NdnFace& operator= (const NdnFace &); ///< \brief Disabled copy operator
+ Face (const Face &); ///< \brief Disabled copy constructor
+ Face& operator= (const Face &); ///< \brief Disabled copy operator
protected:
// uint16_t m_metric; ///< \brief Routing/forwarding metric
@@ -250,38 +252,38 @@
// bool m_enableMetricTagging;
- TracedCallback<Ptr<const Packet> > m_ndnTxTrace;
- TracedCallback<Ptr<const Packet> > m_ndnRxTrace;
- TracedCallback<Ptr<const Packet> > m_ndnDropTrace;
+ TracedCallback<Ptr<const Packet> > m_txTrace;
+ TracedCallback<Ptr<const Packet> > m_rxTrace;
+ TracedCallback<Ptr<const Packet> > m_dropTrace;
};
-std::ostream& operator<< (std::ostream& os, const NdnFace &face);
+std::ostream& operator<< (std::ostream& os, const Face &face);
inline bool
-operator < (const Ptr<NdnFace> &lhs, const Ptr<NdnFace> &rhs)
+operator < (const Ptr<Face> &lhs, const Ptr<Face> &rhs)
{
return *lhs < *rhs;
}
void
-NdnFace::SetId (uint32_t id)
+Face::SetId (uint32_t id)
{
m_id = id;
}
uint32_t
-NdnFace::GetId () const
+Face::GetId () const
{
return m_id;
}
inline bool
-NdnFace::operator!= (const NdnFace &face) const
+Face::operator!= (const Face &face) const
{
return !(*this == face);
}
-
+} // namespace ndn
} // namespace ns3
-#endif //NDN_FACE_H
+#endif // NDN_FACE_H
diff --git a/model/ndn-global-router.cc b/model/ndn-global-router.cc
index 816dc88..8020f43 100644
--- a/model/ndn-global-router.cc
+++ b/model/ndn-global-router.cc
@@ -20,7 +20,7 @@
#include "ndn-global-router.h"
-#include "ns3/ndn.h"
+#include "ns3/ndn-l3-protocol.h"
#include "ns3/ndn-face.h"
#include "ns3/ndn-name-components.h"
@@ -29,78 +29,79 @@
using namespace boost;
namespace ns3 {
+namespace ndn {
-uint32_t NdnGlobalRouter::m_idCounter = 0;
+uint32_t GlobalRouter::m_idCounter = 0;
-NS_OBJECT_ENSURE_REGISTERED (NdnGlobalRouter);
+NS_OBJECT_ENSURE_REGISTERED (GlobalRouter);
TypeId
-NdnGlobalRouter::GetTypeId ()
+GlobalRouter::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::NdnGlobalRouter")
+ static TypeId tid = TypeId ("ns3::ndn::GlobalRouter")
.SetGroupName ("Ndn")
.SetParent<Object> ()
;
return tid;
}
-NdnGlobalRouter::NdnGlobalRouter ()
+GlobalRouter::GlobalRouter ()
{
m_id = m_idCounter;
m_idCounter ++;
}
void
-NdnGlobalRouter::NotifyNewAggregate ()
+GlobalRouter::NotifyNewAggregate ()
{
if (m_ndn == 0)
{
- m_ndn = GetObject<Ndn> ();
+ m_ndn = GetObject<L3Protocol> ();
}
Object::NotifyNewAggregate ();
}
uint32_t
-NdnGlobalRouter::GetId () const
+GlobalRouter::GetId () const
{
return m_id;
}
-Ptr<Ndn>
-NdnGlobalRouter::GetNdn () const
+Ptr<L3Protocol>
+GlobalRouter::GetL3Protocol () const
{
return m_ndn;
}
void
-NdnGlobalRouter::AddLocalPrefix (Ptr< NdnNameComponents > prefix)
+GlobalRouter::AddLocalPrefix (Ptr< NameComponents > prefix)
{
m_localPrefixes.push_back (prefix);
}
void
-NdnGlobalRouter::AddIncidency (Ptr< NdnFace > face, Ptr< NdnGlobalRouter > gr)
+GlobalRouter::AddIncidency (Ptr< Face > face, Ptr< GlobalRouter > gr)
{
m_incidencies.push_back (make_tuple (this, face, gr));
}
-NdnGlobalRouter::IncidencyList &
-NdnGlobalRouter::GetIncidencies ()
+GlobalRouter::IncidencyList &
+GlobalRouter::GetIncidencies ()
{
return m_incidencies;
}
-const NdnGlobalRouter::LocalPrefixList &
-NdnGlobalRouter::GetLocalPrefixes () const
+const GlobalRouter::LocalPrefixList &
+GlobalRouter::GetLocalPrefixes () const
{
return m_localPrefixes;
}
// void
-// NdnGlobalRouter::AddIncidencyChannel (Ptr< NdnFace > face, Ptr< Channel > channel)
+// GlobalRouter::AddIncidencyChannel (Ptr< NdnFace > face, Ptr< Channel > channel)
// {
// m_incidenciesChannel.push_back (make_tuple (face, channel));
// }
-}
-
+} // namespace ndn
+} // namespace ns3
diff --git a/model/ndn-global-router.h b/model/ndn-global-router.h
index f1475a3..d277bb8 100644
--- a/model/ndn-global-router.h
+++ b/model/ndn-global-router.h
@@ -30,20 +30,23 @@
namespace ns3 {
class Channel;
-class Ndn;
-class NdnFace;
-class NdnNameComponents;
+
+namespace ndn {
+
+class L3Protocol;
+class Face;
+class NameComponents;
/**
* @brief Class representing global router interface for ndnSIM
*/
-class NdnGlobalRouter : public Object
+class GlobalRouter : public Object
{
public:
/**
* @brief Graph edge
*/
- typedef boost::tuple< Ptr< NdnGlobalRouter >, Ptr< NdnFace >, Ptr< NdnGlobalRouter > > Incidency;
+ typedef boost::tuple< Ptr< GlobalRouter >, Ptr< Face >, Ptr< GlobalRouter > > Incidency;
/**
* @brief List of graph edges
*/
@@ -51,7 +54,7 @@
/**
* @brief List of locally exported prefixes
*/
- typedef std::list< Ptr<NdnNameComponents> > LocalPrefixList;
+ typedef std::list< Ptr<NameComponents> > LocalPrefixList;
/**
* \brief Interface ID
@@ -64,7 +67,7 @@
/**
* @brief Default constructor
*/
- NdnGlobalRouter ();
+ GlobalRouter ();
/**
* @brief Get numeric ID of the node (internally assigned)
@@ -73,25 +76,25 @@
GetId () const;
/**
- * @brief Helper function to get smart pointer to Ndn object (basically, self)
+ * @brief Helper function to get smart pointer to ndn::L3Protocol object (basically, self)
*/
- Ptr<Ndn>
- GetNdn () const;
+ Ptr<L3Protocol>
+ GetL3Protocol () const;
/**
* @brief Add new locally exported prefix
* @param prefix Prefix
*/
void
- AddLocalPrefix (Ptr< NdnNameComponents > prefix);
+ AddLocalPrefix (Ptr< NameComponents > prefix);
/**
* @brief Add edge to the node
* @param face Face of the edge
- * @param ndn NdnGlobalRouter of another node
+ * @param ndn GlobalRouter of another node
*/
void
- AddIncidency (Ptr< NdnFace > face, Ptr< NdnGlobalRouter > ndn);
+ AddIncidency (Ptr< Face > face, Ptr< GlobalRouter > ndn);
/**
* @brief Get list of edges that are connected to this node
@@ -113,7 +116,7 @@
private:
uint32_t m_id;
- Ptr<Ndn> m_ndn;
+ Ptr<L3Protocol> m_ndn;
LocalPrefixList m_localPrefixes;
IncidencyList m_incidencies;
@@ -121,8 +124,8 @@
};
inline bool
-operator == (const NdnGlobalRouter::Incidency &a,
- const NdnGlobalRouter::Incidency &b)
+operator == (const GlobalRouter::Incidency &a,
+ const GlobalRouter::Incidency &b)
{
return a.get<0> () == b.get<0> () &&
a.get<1> () == b.get<1> () &&
@@ -130,12 +133,13 @@
}
inline bool
-operator != (const NdnGlobalRouter::Incidency &a,
- const NdnGlobalRouter::Incidency &b)
+operator != (const GlobalRouter::Incidency &a,
+ const GlobalRouter::Incidency &b)
{
return ! (a == b);
}
-}
+} // namespace ndn
+} // namespace ns3
#endif // NDN_GLOBAL_ROUTER_H
diff --git a/model/ndn-interest-header.cc b/model/ndn-interest-header.cc
index 192cae5..bb6c329 100644
--- a/model/ndn-interest-header.cc
+++ b/model/ndn-interest-header.cc
@@ -30,26 +30,26 @@
#include "../helper/ndn-encoding-helper.h"
#include "../helper/ndn-decoding-helper.h"
-NS_LOG_COMPONENT_DEFINE ("NdnInterestHeader");
+NS_LOG_COMPONENT_DEFINE ("ndn.InterestHeader");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnInterestHeader);
+NS_OBJECT_ENSURE_REGISTERED (InterestHeader);
TypeId
-NdnInterestHeader::GetTypeId (void)
+InterestHeader::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnInterestHeader")
+ static TypeId tid = TypeId ("ns3::ndn::InterestHeader")
.SetGroupName ("Ndn")
.SetParent<Header> ()
- .AddConstructor<NdnInterestHeader> ()
+ .AddConstructor<InterestHeader> ()
;
return tid;
}
-NdnInterestHeader::NdnInterestHeader ()
+InterestHeader::InterestHeader ()
: m_minSuffixComponents (-1)
, m_maxSuffixComponents (-1)
, m_childSelector (false)
@@ -62,168 +62,168 @@
}
void
-NdnInterestHeader::SetName (const Ptr<NdnNameComponents> &name)
+InterestHeader::SetName (const Ptr<NameComponents> &name)
{
m_name = name;
}
-const NdnNameComponents&
-NdnInterestHeader::GetName () const
+const NameComponents&
+InterestHeader::GetName () const
{
- if (m_name==0) throw NdnInterestHeaderException();
+ if (m_name==0) throw InterestHeaderException();
return *m_name;
}
-Ptr<const NdnNameComponents>
-NdnInterestHeader::GetNamePtr () const
+Ptr<const NameComponents>
+InterestHeader::GetNamePtr () const
{
return m_name;
}
void
-NdnInterestHeader::SetMinSuffixComponents (int32_t value)
+InterestHeader::SetMinSuffixComponents (int32_t value)
{
m_minSuffixComponents = value;
}
int32_t
-NdnInterestHeader::GetMinSuffixComponents () const
+InterestHeader::GetMinSuffixComponents () const
{
return m_minSuffixComponents;
}
void
-NdnInterestHeader::SetMaxSuffixComponents (int32_t value)
+InterestHeader::SetMaxSuffixComponents (int32_t value)
{
m_maxSuffixComponents = value;
}
int32_t
-NdnInterestHeader::GetMaxSuffixComponents () const
+InterestHeader::GetMaxSuffixComponents () const
{
return m_maxSuffixComponents;
}
void
-NdnInterestHeader::SetExclude (const Ptr<NdnNameComponents> &exclude)
+InterestHeader::SetExclude (const Ptr<NameComponents> &exclude)
{
m_exclude = exclude;
}
bool
-NdnInterestHeader::IsEnabledExclude () const
+InterestHeader::IsEnabledExclude () const
{
return m_exclude!=0;
}
-const NdnNameComponents&
-NdnInterestHeader::GetExclude () const
+const NameComponents&
+InterestHeader::GetExclude () const
{
- if (m_exclude==0) throw NdnInterestHeaderException();
+ if (m_exclude==0) throw InterestHeaderException();
return *m_exclude;
}
void
-NdnInterestHeader::SetChildSelector (bool value)
+InterestHeader::SetChildSelector (bool value)
{
m_childSelector = value;
}
bool
-NdnInterestHeader::IsEnabledChildSelector () const
+InterestHeader::IsEnabledChildSelector () const
{
return m_childSelector;
}
void
-NdnInterestHeader::SetAnswerOriginKind (bool value)
+InterestHeader::SetAnswerOriginKind (bool value)
{
m_answerOriginKind = value;
}
bool
-NdnInterestHeader::IsEnabledAnswerOriginKind () const
+InterestHeader::IsEnabledAnswerOriginKind () const
{
return m_answerOriginKind;
}
void
-NdnInterestHeader::SetScope (int8_t scope)
+InterestHeader::SetScope (int8_t scope)
{
m_scope = scope;
}
int8_t
-NdnInterestHeader::GetScope () const
+InterestHeader::GetScope () const
{
return m_scope;
}
void
-NdnInterestHeader::SetInterestLifetime (Time lifetime)
+InterestHeader::SetInterestLifetime (Time lifetime)
{
m_interestLifetime = lifetime;
}
Time
-NdnInterestHeader::GetInterestLifetime () const
+InterestHeader::GetInterestLifetime () const
{
return m_interestLifetime;
}
void
-NdnInterestHeader::SetNonce (uint32_t nonce)
+InterestHeader::SetNonce (uint32_t nonce)
{
m_nonce = nonce;
}
uint32_t
-NdnInterestHeader::GetNonce () const
+InterestHeader::GetNonce () const
{
return m_nonce;
}
void
-NdnInterestHeader::SetNack (uint32_t nackType)
+InterestHeader::SetNack (uint32_t nackType)
{
m_nackType = nackType;
}
uint32_t
-NdnInterestHeader::GetNack () const
+InterestHeader::GetNack () const
{
return m_nackType;
}
uint32_t
-NdnInterestHeader::GetSerializedSize (void) const
+InterestHeader::GetSerializedSize (void) const
{
// unfortunately, we don't know exact header size in advance
- return NdnEncodingHelper::GetSerializedSize (*this);
+ return EncodingHelper::GetSerializedSize (*this);
}
void
-NdnInterestHeader::Serialize (Buffer::Iterator start) const
+InterestHeader::Serialize (Buffer::Iterator start) const
{
- size_t size = NdnEncodingHelper::Serialize (start, *this);
+ size_t size = EncodingHelper::Serialize (start, *this);
NS_UNUSED (size);
NS_LOG_INFO ("Serialize size = " << size);
}
uint32_t
-NdnInterestHeader::Deserialize (Buffer::Iterator start)
+InterestHeader::Deserialize (Buffer::Iterator start)
{
- return NdnDecodingHelper::Deserialize (start, *this); // \todo Debugging is necessary
+ return DecodingHelper::Deserialize (start, *this); // \todo Debugging is necessary
}
TypeId
-NdnInterestHeader::GetInstanceTypeId (void) const
+InterestHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
void
-NdnInterestHeader::Print (std::ostream &os) const
+InterestHeader::Print (std::ostream &os) const
{
os << "I: " << GetName ();
@@ -265,4 +265,6 @@
os << "</Interest>";
}
-}
+} // namespace ndn
+} // namespace ns3
+
diff --git a/model/ndn-interest-header.h b/model/ndn-interest-header.h
index 9b52ca2..c87ff32 100644
--- a/model/ndn-interest-header.h
+++ b/model/ndn-interest-header.h
@@ -33,8 +33,8 @@
#include "ndn-name-components.h"
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
/**
* Ndn XML definition of Interest
@@ -126,7 +126,7 @@
* - InterestLifetime: ?
* - Nonce: 32 bit random integer. If value is 0, will not be serialized
**/
-class NdnInterestHeader : public SimpleRefCount<NdnInterestHeader,Header>
+class InterestHeader : public SimpleRefCount<InterestHeader, Header>
{
public:
/**
@@ -134,7 +134,7 @@
*
* Creates a null header
**/
- NdnInterestHeader ();
+ InterestHeader ();
/**
* \brief Set interest name
@@ -143,7 +143,7 @@
* @param[in] name const pointer to ndnNameComponents object that contains an interest name
**/
void
- SetName (const Ptr<NdnNameComponents> &name);
+ SetName (const Ptr<NameComponents> &name);
/**
@@ -151,13 +151,13 @@
*
* Gets name of the interest.
**/
- const NdnNameComponents&
+ const NameComponents&
GetName () const;
/**
* @brief Get smart pointer to the interest name (to avoid extra memory usage)
*/
- Ptr<const NdnNameComponents>
+ Ptr<const NameComponents>
GetNamePtr () const;
/**
@@ -210,7 +210,7 @@
* @param[in] exclude const pointer to ndnNameComponents to be excluded
**/
void
- SetExclude (const Ptr<NdnNameComponents> &exclude);
+ SetExclude (const Ptr<NameComponents> &exclude);
/**
* \brief Check if interest conatins exclude filter
@@ -222,7 +222,7 @@
/**
* \brief Get exclude filter
*/
- const NdnNameComponents&
+ const NameComponents&
GetExclude () const;
/**
@@ -381,23 +381,25 @@
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
- Ptr<NdnNameComponents> m_name; ///< Interest name
- int32_t m_minSuffixComponents; ///< Minimum suffix components. not used if negative
- int32_t m_maxSuffixComponents; ///< Maximum suffix components. not used if negative
- Ptr<NdnNameComponents> m_exclude; ///< Exclude filter
- bool m_childSelector; ///< Default value for ChildSelector is false
- bool m_answerOriginKind; ///< Default value for AnswerOriginKind is false
- int8_t m_scope; ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood
- Time m_interestLifetime; ///< InterestLifetime
- uint32_t m_nonce; ///< Nonce. not used if zero
- uint32_t m_nackType; ///< Negative Acknowledgement type
+ Ptr<NameComponents> m_name; ///< Interest name
+ int32_t m_minSuffixComponents; ///< Minimum suffix components. not used if negative
+ int32_t m_maxSuffixComponents; ///< Maximum suffix components. not used if negative
+ Ptr<NameComponents> m_exclude; ///< Exclude filter
+ bool m_childSelector; ///< Default value for ChildSelector is false
+ bool m_answerOriginKind; ///< Default value for AnswerOriginKind is false
+ int8_t m_scope; ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood
+ Time m_interestLifetime; ///< InterestLifetime
+ uint32_t m_nonce; ///< Nonce. not used if zero
+ uint32_t m_nackType; ///< Negative Acknowledgement type
};
/**
+ * @ingroup ndn-exceptions
* @brief Class for Interest parsing exception
*/
-class NdnInterestHeaderException {};
+class InterestHeaderException {};
+} // namespace ndn
} // namespace ns3
#endif // _NDN_INTEREST_HEADER_H_
diff --git a/model/ndn-l3-protocol.cc b/model/ndn-l3-protocol.cc
index 62c6241..315ad63 100644
--- a/model/ndn-l3-protocol.cc
+++ b/model/ndn-l3-protocol.cc
@@ -40,43 +40,41 @@
#include "ns3/ndn-face.h"
#include "ns3/ndn-forwarding-strategy.h"
-// #include "fib/ndn-fib-impl.h"
-
#include "ndn-net-device-face.h"
#include <boost/foreach.hpp>
-NS_LOG_COMPONENT_DEFINE ("NdnL3Protocol");
+NS_LOG_COMPONENT_DEFINE ("ndn.L3Protocol");
namespace ns3 {
+namespace ndn {
-const uint16_t NdnL3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
+const uint16_t L3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
-NS_OBJECT_ENSURE_REGISTERED (NdnL3Protocol);
+NS_OBJECT_ENSURE_REGISTERED (L3Protocol);
TypeId
-NdnL3Protocol::GetTypeId (void)
+L3Protocol::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::NdnL3Protocol")
- .SetParent<Ndn> ()
+ static TypeId tid = TypeId ("ns3::ndn::L3Protocol")
.SetGroupName ("ndn")
- .AddConstructor<NdnL3Protocol> ()
+ .AddConstructor<L3Protocol> ()
.AddAttribute ("FaceList", "List of faces associated with ndn stack",
ObjectVectorValue (),
- MakeObjectVectorAccessor (&NdnL3Protocol::m_faces),
- MakeObjectVectorChecker<NdnFace> ())
+ MakeObjectVectorAccessor (&L3Protocol::m_faces),
+ MakeObjectVectorChecker<Face> ())
;
return tid;
}
-NdnL3Protocol::NdnL3Protocol()
+L3Protocol::L3Protocol()
: m_faceCounter (0)
{
NS_LOG_FUNCTION (this);
}
-NdnL3Protocol::~NdnL3Protocol ()
+L3Protocol::~L3Protocol ()
{
NS_LOG_FUNCTION (this);
}
@@ -86,7 +84,7 @@
* by setting the node in the ndn stack
*/
void
-NdnL3Protocol::NotifyNewAggregate ()
+L3Protocol::NotifyNewAggregate ()
{
// not really efficient, but this will work only once
if (m_node == 0)
@@ -95,37 +93,37 @@
if (m_node != 0)
{
// NS_ASSERT_MSG (m_pit != 0 && m_fib != 0 && m_contentStore != 0 && m_forwardingStrategy != 0,
- // "PIT, FIB, and ContentStore should be aggregated before NdnL3Protocol");
+ // "PIT, FIB, and ContentStore should be aggregated before L3Protocol");
NS_ASSERT_MSG (m_forwardingStrategy != 0,
- "Forwarding strategy should be aggregated before NdnL3Protocol");
+ "Forwarding strategy should be aggregated before L3Protocol");
}
}
// if (m_pit == 0)
// {
- // m_pit = GetObject<NdnPit> ();
+ // m_pit = GetObject<Pit> ();
// }
// if (m_fib == 0)
// {
- // m_fib = GetObject<NdnFib> ();
+ // m_fib = GetObject<Fib> ();
// }
if (m_forwardingStrategy == 0)
{
- m_forwardingStrategy = GetObject<NdnForwardingStrategy> ();
+ m_forwardingStrategy = GetObject<ForwardingStrategy> ();
}
// if (m_contentStore == 0)
// {
- // m_contentStore = GetObject<NdnContentStore> ();
+ // m_contentStore = GetObject<ContentStore> ();
// }
- Ndn::NotifyNewAggregate ();
+ Object::NotifyNewAggregate ();
}
void
-NdnL3Protocol::DoDispose (void)
+L3Protocol::DoDispose (void)
{
NS_LOG_FUNCTION (this);
- for (NdnFaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
+ for (FaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
{
*i = 0;
}
@@ -135,18 +133,18 @@
// Force delete on objects
m_forwardingStrategy = 0; // there is a reference to PIT stored in here
- Ndn::DoDispose ();
+ Object::DoDispose ();
}
uint32_t
-NdnL3Protocol::AddFace (const Ptr<NdnFace> &face)
+L3Protocol::AddFace (const Ptr<Face> &face)
{
NS_LOG_FUNCTION (this << &face);
face->SetId (m_faceCounter); // sets a unique ID of the face. This ID serves only informational purposes
// ask face to register in lower-layer stack
- face->RegisterProtocolHandler (MakeCallback (&NdnL3Protocol::Receive, this));
+ face->RegisterProtocolHandler (MakeCallback (&L3Protocol::Receive, this));
m_faces.push_back (face);
m_faceCounter++;
@@ -154,15 +152,15 @@
}
void
-NdnL3Protocol::RemoveFace (Ptr<NdnFace> face)
+L3Protocol::RemoveFace (Ptr<Face> face)
{
// ask face to register in lower-layer stack
- face->RegisterProtocolHandler (MakeNullCallback<void,const Ptr<NdnFace>&,const Ptr<const Packet>&> ());
- Ptr<NdnPit> pit = GetObject<NdnPit> ();
+ face->RegisterProtocolHandler (MakeNullCallback<void,const Ptr<Face>&,const Ptr<const Packet>&> ());
+ Ptr<Pit> pit = GetObject<Pit> ();
// just to be on a safe side. Do the process in two steps
- std::list< Ptr<NdnPitEntry> > entriesToRemoves;
- for (Ptr<NdnPitEntry> pitEntry = pit->Begin (); pitEntry != 0; pitEntry = pit->Next (pitEntry))
+ std::list< Ptr<pit::Entry> > entriesToRemoves;
+ for (Ptr<pit::Entry> pitEntry = pit->Begin (); pitEntry != 0; pitEntry = pit->Next (pitEntry))
{
pitEntry->RemoveAllReferencesToFace (face);
@@ -174,20 +172,20 @@
entriesToRemoves.push_back (pitEntry);
}
}
- BOOST_FOREACH (Ptr<NdnPitEntry> removedEntry, entriesToRemoves)
+ BOOST_FOREACH (Ptr<pit::Entry> removedEntry, entriesToRemoves)
{
pit->MarkErased (removedEntry);
}
- NdnFaceList::iterator face_it = find (m_faces.begin(), m_faces.end(), face);
+ FaceList::iterator face_it = find (m_faces.begin(), m_faces.end(), face);
NS_ASSERT_MSG (face_it != m_faces.end (), "Attempt to remove face that doesn't exist");
m_faces.erase (face_it);
}
-Ptr<NdnFace>
-NdnL3Protocol::GetFace (uint32_t index) const
+Ptr<Face>
+L3Protocol::GetFace (uint32_t index) const
{
- BOOST_FOREACH (const Ptr<NdnFace> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
+ BOOST_FOREACH (const Ptr<Face> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
{
if (face->GetId () == index)
return face;
@@ -195,12 +193,12 @@
return 0;
}
-Ptr<NdnFace>
-NdnL3Protocol::GetFaceByNetDevice (Ptr<NetDevice> netDevice) const
+Ptr<Face>
+L3Protocol::GetFaceByNetDevice (Ptr<NetDevice> netDevice) const
{
- BOOST_FOREACH (const Ptr<NdnFace> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
+ BOOST_FOREACH (const Ptr<Face> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
{
- Ptr<NdnNetDeviceFace> netDeviceFace = DynamicCast<NdnNetDeviceFace> (face);
+ Ptr<NetDeviceFace> netDeviceFace = DynamicCast<NetDeviceFace> (face);
if (netDeviceFace == 0) continue;
if (netDeviceFace->GetNetDevice () == netDevice)
@@ -210,14 +208,14 @@
}
uint32_t
-NdnL3Protocol::GetNFaces (void) const
+L3Protocol::GetNFaces (void) const
{
return m_faces.size ();
}
// Callback from lower layer
void
-NdnL3Protocol::Receive (const Ptr<NdnFace> &face, const Ptr<const Packet> &p)
+L3Protocol::Receive (const Ptr<Face> &face, const Ptr<const Packet> &p)
{
if (!face->IsUp ())
return;
@@ -229,12 +227,12 @@
Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
try
{
- NdnHeaderHelper::Type type = NdnHeaderHelper::GetNdnHeaderType (p);
+ HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (p);
switch (type)
{
- case NdnHeaderHelper::INTEREST:
+ case HeaderHelper::INTEREST:
{
- Ptr<NdnInterestHeader> header = Create<NdnInterestHeader> ();
+ Ptr<InterestHeader> header = Create<InterestHeader> ();
// Deserialization. Exception may be thrown
packet->RemoveHeader (*header);
@@ -247,11 +245,11 @@
// OnInterest (face, header, p/*original packet*/);
break;
}
- case NdnHeaderHelper::CONTENT_OBJECT:
+ case HeaderHelper::CONTENT_OBJECT:
{
- Ptr<NdnContentObjectHeader> header = Create<NdnContentObjectHeader> ();
+ Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
- static NdnContentObjectTail contentObjectTrailer; //there is no data in this object
+ static ContentObjectTail contentObjectTrailer; //there is no data in this object
// Deserialization. Exception may be thrown
packet->RemoveHeader (*header);
@@ -264,413 +262,14 @@
// exception will be thrown if packet is not recognized
}
- catch (NdnUnknownHeaderException)
+ catch (UnknownHeaderException)
{
- NS_ASSERT_MSG (false, "Unknown Ndn header. Should not happen");
- NS_LOG_ERROR ("Unknown Ndn header. Should not happen");
+ NS_ASSERT_MSG (false, "Unknown NDN header. Should not happen");
+ NS_LOG_ERROR ("Unknown NDN header. Should not happen");
return;
}
}
-// void
-// NdnL3Protocol::OnNack (const Ptr<NdnFace> &incomingFace,
-// Ptr<NdnInterestHeader> &header,
-// const Ptr<const Packet> &packet)
-// {
-// NS_LOG_FUNCTION (incomingFace << header << packet);
-// m_inNacks (header, incomingFace);
-// Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
-// if (pitEntry == 0)
-// {
-// // somebody is doing something bad
-// m_dropNacks (header, NON_DUPLICATED, incomingFace);
-// return;
-// }
-
-// // NdnPitEntryIncomingFaceContainer::type::iterator inFace = pitEntry->GetIncoming ().find (incomingFace);
-// NdnPitEntryOutgoingFaceContainer::type::iterator outFace = pitEntry->GetOutgoing ().find (incomingFace);
-
-// if (outFace == pitEntry->GetOutgoing ().end ())
-// {
-// // NS_ASSERT_MSG (false,
-// // "Node " << GetObject<Node> ()->GetId () << ", outgoing entry should exist for face " << boost::cref(*incomingFace) << "\n" <<
-// // "size: " << pitEntry.GetOutgoing ().size ());
-
-// // m_dropNacks (header, NON_DUPLICATE, incomingFace);
-// return;
-// }
-
-// // This was done in error. Never, never do anything, except normal leakage. This way we ensure that we will not have losses,
-// // at least when there is only one client
-// //
-// // incomingFace->LeakBucketByOnePacket ();
-
-// NS_LOG_ERROR ("Nack on " << boost::cref(*incomingFace));
-
-// pitEntry->SetWaitingInVain (outFace);
-
-// // If NACK is NACK_GIVEUP_PIT, then neighbor gave up trying to and removed it's PIT entry.
-// // So, if we had an incoming entry to this neighbor, then we can remove it now
-
-// if (header->GetNack () == NdnInterestHeader::NACK_GIVEUP_PIT)
-// {
-// pitEntry->RemoveIncoming (incomingFace);
-// }
-
-// pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW);
-// // StaticCast<NdnFibImpl> (m_fib)->modify (pitEntry->GetFibEntry (),
-// // ll::bind (&NdnFibEntry::UpdateStatus,
-// // ll::_1, incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW));
-
-// if (pitEntry->GetIncoming ().size () == 0) // interest was actually satisfied
-// {
-// // no need to do anything
-// m_dropNacks (header, AFTER_SATISFIED, incomingFace);
-// return;
-// }
-
-// if (!pitEntry->AreAllOutgoingInVain ()) // not all ougtoing are in vain
-// {
-// NS_LOG_DEBUG ("Not all outgoing are in vain");
-// // suppress
-// // Don't do anything, we are still expecting data from some other face
-// m_dropNacks (header, SUPPRESSED, incomingFace);
-// return;
-// }
-
-// Ptr<Packet> nonNackInterest = Create<Packet> ();
-// header->SetNack (NdnInterestHeader::NORMAL_INTEREST);
-// nonNackInterest->AddHeader (*header);
-
-// bool propagated = m_forwardingStrategy->
-// PropagateInterest (pitEntry, incomingFace, header, nonNackInterest);
-
-// // // ForwardingStrategy will try its best to forward packet to at least one interface.
-// // // If no interests was propagated, then there is not other option for forwarding or
-// // // ForwardingStrategy failed to find it.
-// if (!propagated)
-// {
-// m_dropNacks (header, NO_FACES, incomingFace); // this headers doesn't have NACK flag set
-// GiveUpInterest (pitEntry, header);
-// }
-// }
-
-// Processing Interests
-//
-// // !!! Key point.
-// // !!! All interests should be answerred!!! Either later with data, immediately with data, or immediately with NACK
-// void NdnL3Protocol::OnInterest (const Ptr<NdnFace> &incomingFace,
-// Ptr<NdnInterestHeader> &header,
-// const Ptr<const Packet> &packet)
-// {
-// m_inInterests (header, incomingFace);
-
-// Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
-// if (pitEntry == 0)
-// {
-// pitEntry = m_pit->Create (header);
-// }
-
-// if (pitEntry == 0)
-// {
-// // if it is still not created, then give up processing
-// m_dropInterests (header, PIT_LIMIT, incomingFace);
-// return;
-// }
-
-// bool isNew = pitEntry->GetIncoming ().size () == 0 && pitEntry->GetOutgoing ().size () == 0;
-// bool isDuplicated = true;
-// if (!pitEntry->IsNonceSeen (header->GetNonce ()))
-// {
-// pitEntry->AddSeenNonce (header->GetNonce ());
-// isDuplicated = false;
-// }
-
-// NS_LOG_FUNCTION (header->GetName () << header->GetNonce () << boost::cref (*incomingFace) << isDuplicated);
-
-// /////////////////////////////////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////////////////////////
-// // //
-// // !!!! IMPORTANT CHANGE !!!! Duplicate interests will create incoming face entry !!!! //
-// // //
-// /////////////////////////////////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////////////////////////
-
-// // Data is not in cache
-// NdnPitEntry::in_iterator inFace = pitEntry->GetIncoming ().find (incomingFace);
-// NdnPitEntry::out_iterator outFace = pitEntry->GetOutgoing ().find (incomingFace);
-
-// bool isRetransmitted = false;
-
-// if (inFace != pitEntry->GetIncoming ().end ())
-// {
-// // NdnPitEntryIncomingFace.m_arrivalTime keeps track arrival time of the first packet... why?
-
-// isRetransmitted = true;
-// // this is almost definitely a retransmission. But should we trust the user on that?
-// }
-// else
-// {
-// inFace = pitEntry->AddIncoming (incomingFace);
-// }
-// //////////////////////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////////////////////
-
-// if (isDuplicated)
-// {
-// NS_LOG_DEBUG ("Received duplicatie interest on " << *incomingFace);
-// m_dropInterests (header, DUPLICATED, incomingFace);
-
-// /**
-// * This condition will handle "routing" loops and also recently satisfied interests.
-// * Every time interest is satisfied, PIT entry (with empty incoming and outgoing faces)
-// * is kept for another small chunk of time.
-// */
-
-// if (m_nacksEnabled)
-// {
-// NS_LOG_DEBUG ("Sending NACK_LOOP");
-// header->SetNack (NdnInterestHeader::NACK_LOOP);
-// Ptr<Packet> nack = Create<Packet> ();
-// nack->AddHeader (*header);
-
-// incomingFace->Send (nack);
-// m_outNacks (header, incomingFace);
-// }
-
-// return;
-// }
-
-// Ptr<Packet> contentObject;
-// Ptr<const NdnContentObjectHeader> contentObjectHeader; // used for tracing
-// Ptr<const Packet> payload; // used for tracing
-// tie (contentObject, contentObjectHeader, payload) = m_contentStore->Lookup (header);
-// if (contentObject != 0)
-// {
-// NS_ASSERT (contentObjectHeader != 0);
-// NS_LOG_LOGIC("Found in cache");
-
-// OnDataDelayed (contentObjectHeader, payload, contentObject);
-// return;
-// }
-
-// // update PIT entry lifetime
-// pitEntry->UpdateLifetime (header->GetInterestLifetime ());
-
-// if (outFace != pitEntry->GetOutgoing ().end ())
-// {
-// NS_LOG_DEBUG ("Non duplicate interests from the face we have sent interest to. Don't suppress");
-// // got a non-duplicate interest from the face we have sent interest to
-// // Probably, there is no point in waiting data from that face... Not sure yet
-
-// // If we're expecting data from the interface we got the interest from ("producer" asks us for "his own" data)
-// // Mark interface YELLOW, but keep a small hope that data will come eventually.
-
-// // ?? not sure if we need to do that ?? ...
-
-// pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW);
-// // StaticCast<NdnFibImpl> (m_fib)->modify(pitEntry->GetFibEntry (),
-// // ll::bind (&NdnFibEntry::UpdateStatus,
-// // ll::_1, incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW));
-// }
-// else
-// if (!isNew && !isRetransmitted)
-// {
-// // Suppress this interest if we're still expecting data from some other face
-// NS_LOG_DEBUG ("Suppress interests");
-// m_dropInterests (header, SUPPRESSED, incomingFace);
-// return;
-// }
-
-// /////////////////////////////////////////////////////////////////////
-// // Propagate
-// /////////////////////////////////////////////////////////////////////
-
-// bool propagated = m_forwardingStrategy->
-// PropagateInterest (pitEntry, incomingFace, header, packet);
-
-// if (!propagated && isRetransmitted) //give another chance if retransmitted
-// {
-// // increase max number of allowed retransmissions
-// pitEntry->IncreaseAllowedRetxCount ();
-
-// // try again
-// propagated = m_forwardingStrategy->
-// PropagateInterest (pitEntry, incomingFace, header, packet);
-// }
-
-// // ForwardingStrategy will try its best to forward packet to at least one interface.
-// // If no interests was propagated, then there is not other option for forwarding or
-// // ForwardingStrategy failed to find it.
-// if (!propagated)
-// {
-// NS_LOG_DEBUG ("Not propagated");
-// m_dropInterests (header, NO_FACES, incomingFace);
-// GiveUpInterest (pitEntry, header);
-// }
-// }
-
-// void
-// NdnL3Protocol::OnDataDelayed (Ptr<const NdnContentObjectHeader> header,
-// Ptr<const Packet> payload,
-// const Ptr<const Packet> &packet)
-// {
-// // 1. Lookup PIT entry
-// Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
-// if (pitEntry != 0)
-// {
-// //satisfy all pending incoming Interests
-// BOOST_FOREACH (const NdnPitEntryIncomingFace &incoming, pitEntry->GetIncoming ())
-// {
-// incoming.m_face->Send (packet->Copy ());
-// m_outData (header, payload, false, incoming.m_face);
-// NS_LOG_DEBUG ("Satisfy " << *incoming.m_face);
-
-// // successfull forwarded data trace
-// }
-
-// if (pitEntry->GetIncoming ().size () > 0)
-// {
-// // All incoming interests are satisfied. Remove them
-// pitEntry->ClearIncoming ();
-
-// // Remove all outgoing faces
-// pitEntry->ClearOutgoing ();
-
-// // Set pruning timout on PIT entry (instead of deleting the record)
-// m_pit->MarkErased (pitEntry);
-// }
-// }
-// else
-// {
-// NS_LOG_DEBUG ("Pit entry not found (was satisfied and removed before)");
-// return; // do not process unsoliced data packets
-// }
-// }
-
-// // Processing ContentObjects
-// void
-// NdnL3Protocol::OnData (const Ptr<NdnFace> &incomingFace,
-// Ptr<NdnContentObjectHeader> &header,
-// Ptr<Packet> &payload,
-// const Ptr<const Packet> &packet)
-// {
-
-// NS_LOG_FUNCTION (incomingFace << header->GetName () << payload << packet);
-// m_inData (header, payload, incomingFace);
-
-// // 1. Lookup PIT entry
-// Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
-// if (pitEntry != 0)
-// {
-// // Note that with MultiIndex we need to modify entries indirectly
-
-// NdnPitEntry::out_iterator out = pitEntry->GetOutgoing ().find (incomingFace);
-
-// // If we have sent interest for this data via this face, then update stats.
-// if (out != pitEntry->GetOutgoing ().end ())
-// {
-// pitEntry->GetFibEntry ()->UpdateFaceRtt (incomingFace, Simulator::Now () - out->m_sendTime);
-// // StaticCast<NdnFibImpl> (m_fib)->modify (pitEntry->GetFibEntry (),
-// // ll::bind (&NdnFibEntry::UpdateFaceRtt,
-// // ll::_1,
-// // incomingFace,
-// // Simulator::Now () - out->m_sendTime));
-// }
-// else
-// {
-// // Unsolicited data, but we're interested in it... should we get it?
-// // Potential hole for attacks
-
-// if (m_cacheUnsolicitedData)
-// {
-// // Optimistically add or update entry in the content store
-// m_contentStore->Add (header, payload);
-// }
-// else
-// {
-// NS_LOG_ERROR ("Node "<< m_node->GetId() <<
-// ". PIT entry for "<< header->GetName ()<<" is valid, "
-// "but outgoing entry for interface "<< boost::cref(*incomingFace) <<" doesn't exist\n");
-// }
-// // ignore unsolicited data
-// return;
-// }
-
-// // Update metric status for the incoming interface in the corresponding FIB entry
-// pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_GREEN);
-// // StaticCast<NdnFibImpl>(m_fib)->modify (pitEntry->GetFibEntry (),
-// // ll::bind (&NdnFibEntry::UpdateStatus, ll::_1,
-// // incomingFace, NdnFibFaceMetric::NDN_FIB_GREEN));
-
-// // Add or update entry in the content store
-// m_contentStore->Add (header, payload);
-
-// pitEntry->RemoveIncoming (incomingFace);
-
-// if (pitEntry->GetIncoming ().size () == 0)
-// {
-// // Set pruning timout on PIT entry (instead of deleting the record)
-// m_pit->MarkErased (pitEntry);
-// }
-// else
-// {
-// OnDataDelayed (header, payload, packet);
-// }
-// }
-// else
-// {
-// NS_LOG_DEBUG ("Pit entry not found");
-// if (m_cacheUnsolicitedData)
-// {
-// // Optimistically add or update entry in the content store
-// m_contentStore->Add (header, payload);
-// }
-// else
-// {
-// // Drop data packet if PIT entry is not found
-// // (unsolicited data packets should not "poison" content store)
-
-// //drop dulicated or not requested data packet
-// m_dropData (header, payload, UNSOLICITED, incomingFace);
-// }
-// return; // do not process unsoliced data packets
-// }
-// }
-
-// void
-// NdnL3Protocol::GiveUpInterest (Ptr<NdnPitEntry> pitEntry,
-// Ptr<NdnInterestHeader> header)
-// {
-// NS_LOG_FUNCTION (this);
-
-// if (m_nacksEnabled)
-// {
-// Ptr<Packet> packet = Create<Packet> ();
-// header->SetNack (NdnInterestHeader::NACK_GIVEUP_PIT);
-// packet->AddHeader (*header);
-
-// BOOST_FOREACH (const NdnPitEntryIncomingFace &incoming, pitEntry->GetIncoming ())
-// {
-// NS_LOG_DEBUG ("Send NACK for " << boost::cref (header->GetName ()) << " to " << boost::cref (*incoming.m_face));
-// incoming.m_face->Send (packet->Copy ());
-
-// m_outNacks (header, incoming.m_face);
-// }
-
-// // All incoming interests cannot be satisfied. Remove them
-// pitEntry->ClearIncoming ();
-
-// // Remove also outgoing
-// pitEntry->ClearOutgoing ();
-
-// // Set pruning timout on PIT entry (instead of deleting the record)
-// m_pit->MarkErased (pitEntry);
-// }
-// }
-
+} //namespace ndn
} //namespace ns3
diff --git a/model/ndn-l3-protocol.h b/model/ndn-l3-protocol.h
index 3b1897d..372ac6a 100644
--- a/model/ndn-l3-protocol.h
+++ b/model/ndn-l3-protocol.h
@@ -28,42 +28,43 @@
#include "ns3/net-device.h"
#include "ns3/nstime.h"
-// #include "ndn-content-store.h"
-// #include "ndn-pit.h"
-// #include "ndn-fib.h"
-
-#include "ndn.h"
-
namespace ns3 {
class Packet;
class NetDevice;
class Node;
-class NdnFace;
-class NdnRoute;
-class NdnForwardingStrategy;
class Header;
-class NdnInterestHeader;
-class NdnContentObjectHeader;
-
+namespace ndn {
+
+class Face;
+class ForwardingStrategy;
+class InterestHeader;
+class ContentObjectHeader;
+
+/**
+ * \defgroup ndn ndnSIM: NDN simulation module
+ *
+ * This is a simplified modular implementation of NDN protocol
+ */
/**
* \ingroup ndn
- * \brief Actual implementation of the Ndn network layer
- *
- * \todo This description is incorrect. Should be changed accordingly
+ * \brief Implementation network-layer of NDN stack
*
- * This class contains two distinct groups of trace sources. The
- * trace sources 'Rx' and 'Tx' are called, respectively, immediately
- * after receiving from the NetDevice and immediately before sending
- * to a NetDevice for transmitting a packet. These are low level
- * trace sources that include the NdnHeader already serialized into
- * the packet. In contrast, the Drop, SendOutgoing, UnicastForward,
- * and LocalDeliver trace sources are slightly higher-level and pass
- * around the NdnHeader as an explicit parameter and not as part of
- * the packet.
+ * This class defines the API to manipulate the following aspects of
+ * the NDN stack implementation:
+ * -# register a face (Face-derived object) for use by the NDN
+ * layer
+ *
+ * Each Face-derived object has conceptually a single NDN
+ * interface associated with it.
+ *
+ * In addition, this class defines NDN packet coding constants
+ *
+ * \see Face, ForwardingStrategy
*/
-class NdnL3Protocol : public Ndn
+class L3Protocol :
+ public Object
{
public:
/**
@@ -80,72 +81,52 @@
/**
* \brief Default constructor. Creates an empty stack without forwarding strategy set
*/
- NdnL3Protocol();
- virtual ~NdnL3Protocol ();
+ L3Protocol();
+ virtual ~L3Protocol ();
- ////////////////////////////////////////////////////////////////////
- // functions defined in base class Ndn
-
+ /**
+ * \brief Add face to Ndn stack
+ *
+ * \param face smart pointer to NdnFace-derived object
+ * (NdnLocalFace, NdnNetDeviceFace, NdnUdpFace) \returns the
+ * index of the Ndn interface added.
+ *
+ * \see NdnLocalFace, NdnNetDeviceFace, NdnUdpFace
+ */
virtual uint32_t
- AddFace (const Ptr<NdnFace> &face);
+ AddFace (const Ptr<Face> &face);
+ /**
+ * \brief Get current number of faces added to Ndn stack
+ *
+ * \returns the number of faces
+ */
virtual uint32_t
GetNFaces () const;
- virtual Ptr<NdnFace>
+ /**
+ * \brief Get face by face index
+ * \param face The face number of an Ndn interface.
+ * \returns The NdnFace associated with the Ndn face number.
+ */
+ virtual Ptr<Face>
GetFace (uint32_t face) const;
+ /**
+ * \brief Remove face from ndn stack (remove callbacks)
+ */
virtual void
- RemoveFace (Ptr<NdnFace> face);
+ RemoveFace (Ptr<Face> face);
- virtual Ptr<NdnFace>
+ /**
+ * \brief Get face for NetDevice
+ */
+ virtual Ptr<Face>
GetFaceByNetDevice (Ptr<NetDevice> netDevice) const;
-
- // void ScheduleLeakage();
+
private:
void
- Receive (const Ptr<NdnFace> &face, const Ptr<const Packet> &p);
-
- // /**
- // * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
- // *
- // * Processing Interest packets
- // * @param face incoming face
- // * @param header deserialized Interest header
- // * @param packet original packet
- // */
- // void
- // OnInterest (const Ptr<NdnFace> &face,
- // Ptr<NdnInterestHeader> &header,
- // const Ptr<const Packet> &p);
-
- // /**
- // * \brief Processing of incoming Ndn NACKs. Note, these packets, like interests, do not have payload
- // *
- // * Processing NACK packets
- // * @param face incoming face
- // * @param header deserialized Interest header
- // * @param packet original packet
- // */
- // void
- // OnNack (const Ptr<NdnFace> &face,
- // Ptr<NdnInterestHeader> &header,
- // const Ptr<const Packet> &p);
-
- // /**
- // * \brief Actual processing of incoming Ndn content objects
- // *
- // * Processing ContentObject packets
- // * @param face incoming face
- // * @param header deserialized ContentObject header
- // * @param payload data packet payload
- // * @param packet original packet
- // */
- // void
- // OnData (const Ptr<NdnFace> &face,
- // Ptr<NdnContentObjectHeader> &header,
- // Ptr<Packet> &payload,
- // const Ptr<const Packet> &packet);
+ Receive (const Ptr<Face> &face, const Ptr<const Packet> &p);
protected:
virtual void DoDispose (void); ///< @brief Do cleanup
@@ -157,31 +138,20 @@
virtual void NotifyNewAggregate ();
private:
- NdnL3Protocol(const NdnL3Protocol &); ///< copy constructor is disabled
- NdnL3Protocol &operator = (const NdnL3Protocol &); ///< copy operator is disabled
-
- // void
- // GiveUpInterest (Ptr<NdnPitEntry> pitEntry,
- // Ptr<NdnInterestHeader> header);
-
- // void
- // OnDataDelayed (Ptr<const NdnContentObjectHeader> header,
- // Ptr<const Packet> payload,
- // const Ptr<const Packet> &packet);
+ L3Protocol(const L3Protocol &); ///< copy constructor is disabled
+ L3Protocol &operator = (const L3Protocol &); ///< copy operator is disabled
private:
uint32_t m_faceCounter; ///< \brief counter of faces. Increased every time a new face is added to the stack
- typedef std::vector<Ptr<NdnFace> > NdnFaceList;
- NdnFaceList m_faces; ///< \brief list of faces that belongs to ndn stack on this node
+ typedef std::vector<Ptr<Face> > FaceList;
+ FaceList m_faces; ///< \brief list of faces that belongs to ndn stack on this node
// These objects are aggregated, but for optimization, get them here
Ptr<Node> m_node; ///< \brief node on which ndn stack is installed
- Ptr<NdnForwardingStrategy> m_forwardingStrategy; ///< \brief smart pointer to the selected forwarding strategy
-
- // bool m_nacksEnabled;
- // bool m_cacheUnsolicitedData;
+ Ptr<ForwardingStrategy> m_forwardingStrategy; ///< \brief smart pointer to the selected forwarding strategy
};
-
-} // Namespace ns3
+
+} // namespace ndn
+} // namespace ns3
#endif /* NDN_L3_PROTOCOL_H */
diff --git a/model/ndn-name-components-hash-helper.h b/model/ndn-name-components-hash-helper.h
deleted file mode 100644
index c773580..0000000
--- a/model/ndn-name-components-hash-helper.h
+++ /dev/null
@@ -1,63 +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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#ifndef NDN_HASH_HELPER_H
-#define NDN_HASH_HELPER_H
-
-#include <string>
-#include <boost/foreach.hpp>
-#include "ndn-name-components.h"
-
-namespace ns3
-{
-
-/**
- * \ingroup ndn-helpers
- * \brief Helper providing hash value for the name prefix
- *
- * The whole prefix is considered as a long string with '/' delimiters
- *
- * \todo Testing is required to determine if this hash function
- * actually provides good hash results
- */
-struct NdnPrefixHash : public std::unary_function<NdnNameComponents, std::size_t>
-{
- /**
- * @brief Compute hash of the name prefix
- */
- std::size_t
- operator() (const NdnNameComponents &prefix) const
- {
- std::size_t hash = 23;
- BOOST_FOREACH (const std::string &str, prefix.GetComponents ())
- {
- hash += str.size ();
- hash = ((hash << 6) ^ (hash >> 27)) + '/';
- BOOST_FOREACH (char c, str)
- {
- hash = ((hash << 6) ^ (hash >> 27)) + c;
- }
- }
- return hash;
- }
-};
-} // namespace ns3
-
-#endif // NDN_HASH_HELPER_H
diff --git a/model/ndn-name-components.cc b/model/ndn-name-components.cc
index 96d40ec..d5ac498 100644
--- a/model/ndn-name-components.cc
+++ b/model/ndn-name-components.cc
@@ -27,17 +27,18 @@
using namespace std;
-NS_LOG_COMPONENT_DEFINE ("NdnNameComponents");
+NS_LOG_COMPONENT_DEFINE ("ndn.NameComponents");
namespace ns3 {
+namespace ndn {
-ATTRIBUTE_HELPER_CPP (NdnNameComponents);
+ATTRIBUTE_HELPER_CPP (NameComponents);
-NdnNameComponents::NdnNameComponents (/* root */)
+NameComponents::NameComponents (/* root */)
{
}
-NdnNameComponents::NdnNameComponents (const std::list<boost::reference_wrapper<const std::string> > &components)
+NameComponents::NameComponents (const std::list<boost::reference_wrapper<const std::string> > &components)
{
BOOST_FOREACH (const boost::reference_wrapper<const std::string> &component, components)
{
@@ -45,13 +46,13 @@
}
}
-NdnNameComponents::NdnNameComponents (const std::string &prefix)
+NameComponents::NameComponents (const std::string &prefix)
{
istringstream is (prefix);
is >> *this;
}
-NdnNameComponents::NdnNameComponents (const char *prefix)
+NameComponents::NameComponents (const char *prefix)
{
NS_ASSERT (prefix != 0);
@@ -60,13 +61,13 @@
}
const std::list<std::string> &
-NdnNameComponents::GetComponents () const
+NameComponents::GetComponents () const
{
return m_prefix;
}
std::string
-NdnNameComponents::GetLastComponent () const
+NameComponents::GetLastComponent () const
{
if (m_prefix.size () == 0)
{
@@ -77,7 +78,7 @@
}
std::list<boost::reference_wrapper<const std::string> >
-NdnNameComponents::GetSubComponents (size_t num) const
+NameComponents::GetSubComponents (size_t num) const
{
NS_ASSERT_MSG (0<=num && num<=m_prefix.size (), "Invalid number of subcomponents requested");
@@ -91,10 +92,10 @@
return subComponents;
}
-NdnNameComponents
-NdnNameComponents::cut (size_t minusComponents) const
+NameComponents
+NameComponents::cut (size_t minusComponents) const
{
- NdnNameComponents retval;
+ NameComponents retval;
std::list<std::string>::const_iterator component = m_prefix.begin ();
for (uint32_t i = 0; i < m_prefix.size () - minusComponents; i++, component++)
{
@@ -105,7 +106,7 @@
}
void
-NdnNameComponents::Print (std::ostream &os) const
+NameComponents::Print (std::ostream &os) const
{
for (const_iterator i=m_prefix.begin(); i!=m_prefix.end(); i++)
{
@@ -115,14 +116,14 @@
}
std::ostream &
-operator << (std::ostream &os, const NdnNameComponents &components)
+operator << (std::ostream &os, const NameComponents &components)
{
components.Print (os);
return os;
}
std::istream &
-operator >> (std::istream &is, NdnNameComponents &components)
+operator >> (std::istream &is, NameComponents &components)
{
istream_iterator<char> eos; // end of stream
@@ -148,5 +149,5 @@
return is;
}
-}
-
+} // ndn
+} // ns3
diff --git a/model/ndn-name-components.h b/model/ndn-name-components.h
index 553c140..4a479ac 100644
--- a/model/ndn-name-components.h
+++ b/model/ndn-name-components.h
@@ -34,6 +34,7 @@
#include <boost/ref.hpp>
namespace ns3 {
+namespace ndn {
/**
* \ingroup ndn
@@ -44,7 +45,7 @@
* There are no restrictions on what byte sequences may be used.
* The Name element in an Interest is often referred to with the term name prefix or simply prefix.
*/
-class NdnNameComponents : public SimpleRefCount<NdnNameComponents>
+class NameComponents : public SimpleRefCount<NameComponents>
{
public:
typedef std::list<std::string>::iterator iterator;
@@ -54,28 +55,28 @@
* \brief Constructor
* Creates a prefix with zero components (can be looked as root "/")
*/
- NdnNameComponents ();
+ NameComponents ();
/**
* \brief Constructor
* Creates a prefix from a list of strings where every string represents a prefix component
* @param[in] components A list of strings
*/
- NdnNameComponents (const std::list<boost::reference_wrapper<const std::string> > &components);
+ NameComponents (const std::list<boost::reference_wrapper<const std::string> > &components);
/**
* @brief Constructor
* Creates a prefix from the string (string is parsed using operator>>)
* @param[in] prefix A string representation of a prefix
*/
- NdnNameComponents (const std::string &prefix);
+ NameComponents (const std::string &prefix);
/**
* @brief Constructor
* Creates a prefix from the string (string is parsed using operator>>)
* @param[in] prefix A string representation of a prefix
*/
- NdnNameComponents (const char *prefix);
+ NameComponents (const char *prefix);
/**
* \brief Generic Add method
@@ -91,7 +92,7 @@
* The object of type T will be appended to the list of components
*/
template<class T>
- inline NdnNameComponents&
+ inline NameComponents&
operator () (const T &value);
/**
@@ -117,7 +118,7 @@
/**
* @brief Get prefix of the name, containing less minusComponents right components
*/
- NdnNameComponents
+ NameComponents
cut (size_t minusComponents) const;
/**
@@ -127,7 +128,7 @@
void Print (std::ostream &os) const;
/**
- * \brief Returns the size of NdnNameComponents
+ * \brief Returns the size of NameComponents
*/
inline size_t
size () const;
@@ -157,16 +158,16 @@
end () const;
/**
- * \brief Equality operator for NdnNameComponents
+ * \brief Equality operator for NameComponents
*/
inline bool
- operator== (const NdnNameComponents &prefix) const;
+ operator== (const NameComponents &prefix) const;
/**
- * \brief Less than operator for NdnNameComponents
+ * \brief Less than operator for NameComponents
*/
inline bool
- operator< (const NdnNameComponents &prefix) const;
+ operator< (const NameComponents &prefix) const;
typedef std::string partial_type;
@@ -178,26 +179,26 @@
* \brief Print out name components separated by slashes, e.g., /first/second/third
*/
std::ostream &
-operator << (std::ostream &os, const NdnNameComponents &components);
+operator << (std::ostream &os, const NameComponents &components);
/**
* \brief Read components from input and add them to components. Will read input stream till eof
* Substrings separated by slashes will become separate components
*/
std::istream &
-operator >> (std::istream &is, NdnNameComponents &components);
+operator >> (std::istream &is, NameComponents &components);
/**
- * \brief Returns the size of NdnNameComponents object
+ * \brief Returns the size of NameComponents object
*/
size_t
-NdnNameComponents::size () const
+NameComponents::size () const
{
return m_prefix.size ();
}
-NdnNameComponents::iterator
-NdnNameComponents::begin ()
+NameComponents::iterator
+NameComponents::begin ()
{
return m_prefix.begin ();
}
@@ -205,8 +206,8 @@
/**
* @brief Get read-only begin() iterator
*/
-NdnNameComponents::const_iterator
-NdnNameComponents::begin () const
+NameComponents::const_iterator
+NameComponents::begin () const
{
return m_prefix.begin ();
}
@@ -214,8 +215,8 @@
/**
* @brief Get read-write end() iterator
*/
-NdnNameComponents::iterator
-NdnNameComponents::end ()
+NameComponents::iterator
+NameComponents::end ()
{
return m_prefix.end ();
}
@@ -223,8 +224,8 @@
/**
* @brief Get read-only end() iterator
*/
-NdnNameComponents::const_iterator
-NdnNameComponents::end () const
+NameComponents::const_iterator
+NameComponents::end () const
{
return m_prefix.end ();
}
@@ -235,8 +236,8 @@
* The object of type T will be appended to the list of components
*/
template<class T>
-NdnNameComponents&
-NdnNameComponents::operator () (const T &value)
+NameComponents&
+NameComponents::operator () (const T &value)
{
Add (value);
return *this;
@@ -249,7 +250,7 @@
*/
template<class T>
void
-NdnNameComponents::Add (const T &value)
+NameComponents::Add (const T &value)
{
std::ostringstream os;
os << value;
@@ -257,10 +258,10 @@
}
/**
- * \brief Equality operator for NdnNameComponents
+ * \brief Equality operator for NameComponents
*/
bool
-NdnNameComponents::operator== (const NdnNameComponents &prefix) const
+NameComponents::operator== (const NameComponents &prefix) const
{
if (m_prefix.size () != prefix.m_prefix.size ())
return false;
@@ -269,17 +270,19 @@
}
/**
- * \brief Less than operator for NdnNameComponents
+ * \brief Less than operator for NameComponents
*/
bool
-NdnNameComponents::operator< (const NdnNameComponents &prefix) const
+NameComponents::operator< (const NameComponents &prefix) const
{
return std::lexicographical_compare (m_prefix.begin (), m_prefix.end (),
prefix.m_prefix.begin (), prefix.m_prefix.end ());
}
-ATTRIBUTE_HELPER_HEADER (NdnNameComponents);
+ATTRIBUTE_HELPER_HEADER (NameComponents);
+
+} // namespace ndn
} // namespace ns3
#endif // _NDN_NAME_COMPONENTS_H_
diff --git a/model/ndn-net-device-face.cc b/model/ndn-net-device-face.cc
index 7baa363..f5f38a0 100644
--- a/model/ndn-net-device-face.cc
+++ b/model/ndn-net-device-face.cc
@@ -28,19 +28,21 @@
#include "ns3/node.h"
#include "ns3/pointer.h"
+// #include "ns3/address.h"
#include "ns3/point-to-point-net-device.h"
#include "ns3/channel.h"
#include "ns3/ndn-name-components.h"
-NS_LOG_COMPONENT_DEFINE ("NdnNetDeviceFace");
+NS_LOG_COMPONENT_DEFINE ("ndn.NetDeviceFace");
namespace ns3 {
+namespace ndn {
TypeId
-NdnNetDeviceFace::GetTypeId ()
+NetDeviceFace::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::NdnNetDeviceFace")
- .SetParent<NdnFace> ()
+ static TypeId tid = TypeId ("ns3::ndn::NetDeviceFace")
+ .SetParent<Face> ()
.SetGroupName ("Ndn")
;
return tid;
@@ -50,46 +52,46 @@
* By default, Ndn face are created in the "down" state. Before
* becoming useable, the user must invoke SetUp on the face
*/
-NdnNetDeviceFace::NdnNetDeviceFace (Ptr<Node> node, const Ptr<NetDevice> &netDevice)
- : NdnFace (node)
+NetDeviceFace::NetDeviceFace (Ptr<Node> node, const Ptr<NetDevice> &netDevice)
+ : Face (node)
, m_netDevice (netDevice)
{
NS_LOG_FUNCTION (this << netDevice);
SetMetric (1); // default metric
- NS_ASSERT_MSG (m_netDevice != 0, "NdnNetDeviceFace needs to be assigned a valid NetDevice");
+ NS_ASSERT_MSG (m_netDevice != 0, "NetDeviceFace needs to be assigned a valid NetDevice");
}
-NdnNetDeviceFace::~NdnNetDeviceFace ()
+NetDeviceFace::~NetDeviceFace ()
{
NS_LOG_FUNCTION_NOARGS ();
}
-NdnNetDeviceFace& NdnNetDeviceFace::operator= (const NdnNetDeviceFace &)
+NetDeviceFace& NetDeviceFace::operator= (const NetDeviceFace &)
{
return *this;
}
Ptr<NetDevice>
-NdnNetDeviceFace::GetNetDevice () const
+NetDeviceFace::GetNetDevice () const
{
return m_netDevice;
}
void
-NdnNetDeviceFace::RegisterProtocolHandler (ProtocolHandler handler)
+NetDeviceFace::RegisterProtocolHandler (ProtocolHandler handler)
{
NS_LOG_FUNCTION (this);
- NdnFace::RegisterProtocolHandler (handler);
+ Face::RegisterProtocolHandler (handler);
- m_node->RegisterProtocolHandler (MakeCallback (&NdnNetDeviceFace::ReceiveFromNetDevice, this),
- NdnL3Protocol::ETHERNET_FRAME_TYPE, m_netDevice, true/*promiscuous mode*/);
+ m_node->RegisterProtocolHandler (MakeCallback (&NetDeviceFace::ReceiveFromNetDevice, this),
+ L3Protocol::ETHERNET_FRAME_TYPE, m_netDevice, true/*promiscuous mode*/);
}
bool
-NdnNetDeviceFace::SendImpl (Ptr<Packet> packet)
+NetDeviceFace::SendImpl (Ptr<Packet> packet)
{
NS_LOG_FUNCTION (this << packet);
@@ -99,18 +101,18 @@
<< " for Ndn; fragmentation not supported");
bool ok = m_netDevice->Send (packet, m_netDevice->GetBroadcast (),
- NdnL3Protocol::ETHERNET_FRAME_TYPE);
+ L3Protocol::ETHERNET_FRAME_TYPE);
return ok;
}
// callback
void
-NdnNetDeviceFace::ReceiveFromNetDevice (Ptr<NetDevice> device,
- Ptr<const Packet> p,
- uint16_t protocol,
- const Address &from,
- const Address &to,
- NetDevice::PacketType packetType)
+NetDeviceFace::ReceiveFromNetDevice (Ptr<NetDevice> device,
+ Ptr<const Packet> p,
+ uint16_t protocol,
+ const Address &from,
+ const Address &to,
+ NetDevice::PacketType packetType)
{
NS_LOG_FUNCTION (device << p << protocol << from << to << packetType);
Receive (p);
@@ -118,15 +120,20 @@
std::ostream&
-NdnNetDeviceFace::Print (std::ostream& os) const
+NetDeviceFace::Print (std::ostream& os) const
{
+#ifdef NS3_LOG_ENABLE
os << "dev[" << GetNode ()->GetId () << "]=net(" << GetId () << ",";
os << DynamicCast<PointToPointNetDevice> (m_netDevice)->GetChannel ()->GetDevice (0)->GetNode ()->GetId ();
os << "-";
os << DynamicCast<PointToPointNetDevice> (m_netDevice)->GetChannel ()->GetDevice (1)->GetNode ()->GetId ();
os << ")";
+#else
+ os << "dev=net(" << GetId () << ")";
+#endif
return os;
}
-}; // namespace ns3
+} // namespace ndnsim
+} // namespace ns3
diff --git a/model/ndn-net-device-face.h b/model/ndn-net-device-face.h
index bc132f7..651a7ae 100644
--- a/model/ndn-net-device-face.h
+++ b/model/ndn-net-device-face.h
@@ -25,8 +25,7 @@
#include "ns3/net-device.h"
namespace ns3 {
-
-class Address;
+namespace ndn {
/**
* \ingroup ndn-face
@@ -42,7 +41,7 @@
*
* \see NdnAppFace, NdnNetDeviceFace, NdnIpv4Face, NdnUdpFace
*/
-class NdnNetDeviceFace : public NdnFace
+class NetDeviceFace : public Face
{
public:
static TypeId
@@ -55,8 +54,8 @@
* @param netDevice a smart pointer to NetDevice object to which
* this face will be associate
*/
- NdnNetDeviceFace (Ptr<Node> node, const Ptr<NetDevice> &netDevice);
- virtual ~NdnNetDeviceFace();
+ NetDeviceFace (Ptr<Node> node, const Ptr<NetDevice> &netDevice);
+ virtual ~NetDeviceFace();
////////////////////////////////////////////////////////////////////
// methods overloaded from NdnFace
@@ -84,8 +83,8 @@
Ptr<NetDevice> GetNetDevice () const;
private:
- NdnNetDeviceFace (const NdnNetDeviceFace &); ///< \brief Disabled copy constructor
- NdnNetDeviceFace& operator= (const NdnNetDeviceFace &); ///< \brief Disabled copy operator
+ NetDeviceFace (const NetDeviceFace &); ///< \brief Disabled copy constructor
+ NetDeviceFace& operator= (const NetDeviceFace &); ///< \brief Disabled copy operator
/// \brief callback from lower layers
void ReceiveFromNetDevice (Ptr<NetDevice> device,
@@ -99,6 +98,7 @@
Ptr<NetDevice> m_netDevice; ///< \brief Smart pointer to NetDevice
};
+} // namespace ndn
} // namespace ns3
#endif //NDN_NET_DEVICE_FACE_H
diff --git a/model/ndn.cc b/model/ndn.cc
deleted file mode 100644
index 1083992..0000000
--- a/model/ndn.cc
+++ /dev/null
@@ -1,49 +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 "ns3/assert.h"
-#include "ns3/node.h"
-#include "ns3/boolean.h"
-
-#include "ndn.h"
-#include "ndn-face.h"
-#include "forwarding-strategy/ndn-forwarding-strategy.h"
-#include "ndn-interest-header.h"
-#include "ndn-content-object-header.h"
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (Ndn);
-
-TypeId
-Ndn::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::Ndn")
- .SetGroupName ("Ndn")
- .SetParent<Object> ()
- ;
- return tid;
-}
-
-Ndn::~Ndn ()
-{
-}
-
-} // namespace ns3
diff --git a/model/ndn.h b/model/ndn.h
deleted file mode 100644
index 55c5722..0000000
--- a/model/ndn.h
+++ /dev/null
@@ -1,152 +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>
- */
-
-#ifndef _NDN_H_
-#define _NDN_H_
-
-#include "ns3/object.h"
-#include "ns3/callback.h"
-#include "ns3/traced-callback.h"
-
-namespace ns3 {
-
-class Node;
-class NetDevice;
-class Packet;
-class NdnForwardingStrategy;
-class NdnFace;
-class NdnContentObjectHeader;
-class NdnInterestHeader;
-class NdnPit;
-
-/// @cond include_hidden
-/**
- * \internal
- * \brief Private namespace for Ndn content store implementation
- */
-namespace __ndn_private
-{
-class i_face {};
-class i_metric {};
-class i_nth {};
-class i_prefix {};
-class i_ordered {}; ///< tag for Boost.MultiIndex container (ordered by prefix)
-class i_mru {};
-}
-/// @endcond
-
-// default data size
-// #define NDN_DEFAULT_DATA_SIZE 1024
-// #define NDN_INTEREST_RESET_PERIOD (10*MILLI_SECOND)
-
-/**
- * \defgroup ndn NDN abstraction
- *
- * This is an abstract implementation of NDN protocol
- */
-/**
- * \ingroup ndn
- * \brief Interface to manage Ndn stack
- *
- * This class defines the API to manipulate the following aspects of
- * the Ndn stack implementation:
- * -# register a face (NdnFace-derived object) for use by the Ndn
- * layer
- * -# register forwarding strategy (NdnForwardingStrategy-derived
- * object) to use by Ndn stack
- * -# export Ndn configuration attributes
- *
- * Each NdnFace-derived object has conceptually a single Ndn
- * interface associated with it.
- *
- * In addition, this class defines Ndn packet coding constants
- *
- * \see NdnFace, NdnForwardingStrategy
- */
-class Ndn : public Object
-{
-public:
- /**
- * \brief Interface ID
- *
- * \return interface ID
- */
- static TypeId GetTypeId ();
- virtual ~Ndn ();
-
- /**
- * \brief Add face to Ndn stack
- *
- * \param face smart pointer to NdnFace-derived object
- * (NdnLocalFace, NdnNetDeviceFace, NdnUdpFace) \returns the
- * index of the Ndn interface added.
- *
- * \see NdnLocalFace, NdnNetDeviceFace, NdnUdpFace
- */
- virtual uint32_t
- AddFace (const Ptr<NdnFace> &face) = 0;
-
- /**
- * \brief Get current number of faces added to Ndn stack
- *
- * \returns the number of faces
- */
- virtual uint32_t
- GetNFaces (void) const = 0;
-
- /**
- * \brief Get face by face index
- * \param face The face number of an Ndn interface.
- * \returns The NdnFace associated with the Ndn face number.
- */
- virtual Ptr<NdnFace>
- GetFace (uint32_t face) const = 0;
-
- /**
- * \brief Remove face from ndn stack (remove callbacks)
- */
- virtual void
- RemoveFace (Ptr<NdnFace> face) = 0;
-
- /**
- * \brief Get face for NetDevice
- */
- virtual Ptr<NdnFace>
- GetFaceByNetDevice (Ptr<NetDevice> netDevice) const = 0;
-
- // /**
- // * \enum DropReason
- // * \brief A reason why the packet has been dropped
- // */
- // enum DropReason
- // {
- // DUPLICATED, // Interests
- // SUPPRESSED, // Interests and Nacks
- // NO_FACES, // Interests
- // NON_DUPLICATED, // Nacks
- // AFTER_SATISFIED, // Nacks
- // UNSOLICITED, // data
- // PIT_LIMIT // PIT limit reached
- // };
- };
-
-} // namespace ns3
-
-#endif /* _NDN_H_ */
diff --git a/model/pit/ndn-pit-entry-impl.h b/model/pit/ndn-pit-entry-impl.h
index 13cceb5..85c94f1 100644
--- a/model/pit/ndn-pit-entry-impl.h
+++ b/model/pit/ndn-pit-entry-impl.h
@@ -22,29 +22,30 @@
#define _NDN_PIT_ENTRY_IMPL_H_
namespace ns3 {
+namespace ndn {
-class NdnPit;
-class NdnInterestHeader;
-class NdnFibEntry;
+class Pit;
+
+namespace pit {
template<class Pit>
-class NdnPitEntryImpl : public NdnPitEntry
+class EntryImpl : public Entry
{
- typedef NdnPitEntry super;
+ typedef Entry super;
#define CONTAINER static_cast<Pit&> (m_container)
public:
- NdnPitEntryImpl (NdnPit &pit,
- Ptr<const NdnInterestHeader> header,
- Ptr<NdnFibEntry> fibEntry)
- : NdnPitEntry (pit, header, fibEntry)
+ EntryImpl (Pit &pit,
+ Ptr<const InterestHeader> header,
+ Ptr<fib::Entry> fibEntry)
+ : Entry (pit, header, fibEntry)
, item_ (0)
{
CONTAINER.i_time.insert (*this);
CONTAINER.RescheduleCleaning ();
}
- virtual ~NdnPitEntryImpl ()
+ virtual ~EntryImpl ()
{
CONTAINER.i_time.erase (Pit::time_index::s_iterator_to (*this));
@@ -86,6 +87,8 @@
}
};
-} // ns3
+} // namespace pit
+} // namespace ndn
+} // namespace ns3
#endif
diff --git a/model/pit/ndn-pit-entry-incoming-face.cc b/model/pit/ndn-pit-entry-incoming-face.cc
index 28408ed..5a7f518 100644
--- a/model/pit/ndn-pit-entry-incoming-face.cc
+++ b/model/pit/ndn-pit-entry-incoming-face.cc
@@ -23,15 +23,17 @@
#include "ns3/simulator.h"
namespace ns3 {
+namespace ndn {
+namespace pit {
-NdnPitEntryIncomingFace::NdnPitEntryIncomingFace (Ptr<NdnFace> face)
+IncomingFace::IncomingFace (Ptr<Face> face)
: m_face (face)
, m_arrivalTime (Simulator::Now ())
// , m_nonce (nonce)
{
}
-NdnPitEntryIncomingFace::NdnPitEntryIncomingFace ()
+IncomingFace::IncomingFace ()
: m_face (0)
, m_arrivalTime (0)
{
@@ -40,12 +42,14 @@
/**
* @brie Copy operator
*/
-NdnPitEntryIncomingFace &
-NdnPitEntryIncomingFace::operator = (NdnPitEntryIncomingFace &other)
+IncomingFace &
+IncomingFace::operator = (IncomingFace &other)
{
m_face = other.m_face;
m_arrivalTime = other.m_arrivalTime;
return *this;
}
+} // namespace pit
+} // namespace ndn
} // namespace ns3
diff --git a/model/pit/ndn-pit-entry-incoming-face.h b/model/pit/ndn-pit-entry-incoming-face.h
index 947271b..8ff7947 100644
--- a/model/pit/ndn-pit-entry-incoming-face.h
+++ b/model/pit/ndn-pit-entry-incoming-face.h
@@ -25,17 +25,18 @@
#include "ns3/ptr.h"
#include "ns3/ndn-face.h"
-// #include <iostream>
namespace ns3 {
+namespace ndn {
+namespace pit {
/**
* \ingroup ndn
* \brief PIT state component for each incoming interest (not including duplicates)
*/
-struct NdnPitEntryIncomingFace
+struct IncomingFace
{
- Ptr<NdnFace> m_face; ///< \brief face of the incoming Interest
+ Ptr< Face > m_face; ///< \brief face of the incoming Interest
Time m_arrivalTime; ///< \brief arrival time of the incoming Interest
public:
@@ -44,36 +45,37 @@
* \param face face of the incoming interest
* \param lifetime lifetime of the incoming interest
*/
- NdnPitEntryIncomingFace (Ptr<NdnFace> face);
+ IncomingFace (Ptr<Face> face);
/**
* @brief Default constructor, necessary for Python bindings, but should not be used anywhere else.
*/
- NdnPitEntryIncomingFace ();
+ IncomingFace ();
/**
* @brie Copy operator
*/
- NdnPitEntryIncomingFace &
- operator = (NdnPitEntryIncomingFace &other);
+ IncomingFace &
+ operator = (IncomingFace &other);
/**
- * @brief Compare two NdnPitEntryIncomingFace
+ * @brief Compare two PitEntryIncomingFace
*/
- bool operator== (const NdnPitEntryIncomingFace &dst) { return *m_face==*(dst.m_face); }
+ bool operator== (const IncomingFace &dst) { return *m_face==*(dst.m_face); }
/**
- * @brief Compare NdnPitEntryIncomingFace with NdnFace
+ * @brief Compare PitEntryIncomingFace with Face
*/
- bool operator== (Ptr<NdnFace> face) { return *m_face==*face; }
+ bool operator== (Ptr<Face> face) { return *m_face==*face; }
/**
* \brief Comparison operator used by boost::multi_index::identity<>
*/
bool
- operator< (const NdnPitEntryIncomingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face
+ operator< (const IncomingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face
};
-
+} // namespace pit
+} // namespace ndn
} // namespace ns3
#endif /* NDN_PIT_ENTRY_INCOMING_FACE_H */
diff --git a/model/pit/ndn-pit-entry-outgoing-face.cc b/model/pit/ndn-pit-entry-outgoing-face.cc
index 9829eaa..265529c 100644
--- a/model/pit/ndn-pit-entry-outgoing-face.cc
+++ b/model/pit/ndn-pit-entry-outgoing-face.cc
@@ -23,8 +23,10 @@
#include "ns3/simulator.h"
namespace ns3 {
+namespace ndn {
+namespace pit {
-NdnPitEntryOutgoingFace::NdnPitEntryOutgoingFace (Ptr<NdnFace> face)
+OutgoingFace::OutgoingFace (Ptr<Face> face)
: m_face (face)
, m_sendTime (Simulator::Now ())
, m_retxCount (0)
@@ -33,11 +35,13 @@
}
void
-NdnPitEntryOutgoingFace::UpdateOnRetransmit ()
+OutgoingFace::UpdateOnRetransmit ()
{
m_sendTime = Simulator::Now ();
m_retxCount++;
m_waitingInVain = false;
}
+} // namespace pit
+} // namespace ndn
} // namespace ns3
diff --git a/model/pit/ndn-pit-entry-outgoing-face.h b/model/pit/ndn-pit-entry-outgoing-face.h
index c9d1357..1a4d8b5 100644
--- a/model/pit/ndn-pit-entry-outgoing-face.h
+++ b/model/pit/ndn-pit-entry-outgoing-face.h
@@ -27,14 +27,16 @@
#include "ns3/ndn-face.h"
namespace ns3 {
+namespace ndn {
+namespace pit {
/**
* \ingroup ndn
* \brief PIT state component for each outgoing interest
*/
-struct NdnPitEntryOutgoingFace
+struct OutgoingFace
{
- Ptr<NdnFace> m_face; ///< \brief face of the outgoing Interest
+ Ptr<Face> m_face; ///< \brief face of the outgoing Interest
Time m_sendTime; ///< \brief time when the first outgoing interest is sent (for RTT measurements)
///< \todo handle problem of retransmitted interests... Probably, we should include something similar
///< to TimeStamp TCP option for retransmitted (i.e., only lost interests will suffer)
@@ -43,10 +45,10 @@
public:
/**
- * @brief Constructor to create NdnPitEntryOutgoingFace
+ * @brief Constructor to create PitEntryOutgoingFace
* \param face face of the outgoing interest
*/
- NdnPitEntryOutgoingFace (Ptr<NdnFace> face);
+ OutgoingFace (Ptr<Face> face);
/**
* @brief Update outgoing entry upon retransmission
@@ -55,23 +57,24 @@
UpdateOnRetransmit ();
/**
- * @brief Compare to NdnPitEntryOutgoingFace
+ * @brief Compare to PitEntryOutgoingFace
*/
- bool operator== (const NdnPitEntryOutgoingFace &dst) { return *m_face==*dst.m_face; }
+ bool operator== (const OutgoingFace &dst) { return *m_face==*dst.m_face; }
/**
- * @brief Compare NdnPitEntryOutgoingFace with NdnFace
+ * @brief Compare PitEntryOutgoingFace with Face
*/
- bool operator== (Ptr<NdnFace> face) { return *m_face==*face; }
+ bool operator== (Ptr<Face> face) { return *m_face==*face; }
/**
* \brief Comparison operator used by boost::multi_index::identity<>
*/
bool
- operator< (const NdnPitEntryOutgoingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face
+ operator< (const OutgoingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face
};
-
+} // namespace pit
+} // namespace ndn
} // namespace ns3
#endif /* NDN_PIT_ENTRY_OUTGOING_FACE_H */
diff --git a/model/pit/ndn-pit-entry.cc b/model/pit/ndn-pit-entry.cc
index bc6ca0e..b578c0e 100644
--- a/model/pit/ndn-pit-entry.cc
+++ b/model/pit/ndn-pit-entry.cc
@@ -32,14 +32,15 @@
#include <boost/foreach.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("NdnPitEntry");
+NS_LOG_COMPONENT_DEFINE ("ndn.pit.Entry");
-namespace ns3
-{
+namespace ns3 {
+namespace ndn {
+namespace pit {
-NdnPitEntry::NdnPitEntry (NdnPit &container,
- Ptr<const NdnInterestHeader> header,
- Ptr<NdnFibEntry> fibEntry)
+Entry::Entry (Pit &container,
+ Ptr<const InterestHeader> header,
+ Ptr<fib::Entry> fibEntry)
: m_container (container)
, m_prefix (header->GetNamePtr ())
, m_fibEntry (fibEntry)
@@ -52,7 +53,7 @@
}
void
-NdnPitEntry::UpdateLifetime (const Time &offsetTime)
+Entry::UpdateLifetime (const Time &offsetTime)
{
NS_LOG_FUNCTION (offsetTime.ToDouble (Time::S));
@@ -63,11 +64,11 @@
NS_LOG_INFO ("Updated lifetime to " << m_expireTime.ToDouble (Time::S));
}
-NdnPitEntry::in_iterator
-NdnPitEntry::AddIncoming (Ptr<NdnFace> face)
+Entry::in_iterator
+Entry::AddIncoming (Ptr<Face> face)
{
std::pair<in_iterator,bool> ret =
- m_incoming.insert (NdnPitEntryIncomingFace (face));
+ m_incoming.insert (IncomingFace (face));
// NS_ASSERT_MSG (ret.second, "Something is wrong");
@@ -75,29 +76,29 @@
}
void
-NdnPitEntry::RemoveIncoming (Ptr<NdnFace> face)
+Entry::RemoveIncoming (Ptr<Face> face)
{
m_incoming.erase (face);
}
-NdnPitEntry::out_iterator
-NdnPitEntry::AddOutgoing (Ptr<NdnFace> face)
+Entry::out_iterator
+Entry::AddOutgoing (Ptr<Face> face)
{
std::pair<out_iterator,bool> ret =
- m_outgoing.insert (NdnPitEntryOutgoingFace (face));
+ m_outgoing.insert (OutgoingFace (face));
if (!ret.second)
{ // outgoing face already exists
m_outgoing.modify (ret.first,
- ll::bind (&NdnPitEntryOutgoingFace::UpdateOnRetransmit, ll::_1));
+ ll::bind (&OutgoingFace::UpdateOnRetransmit, ll::_1));
}
return ret.first;
}
void
-NdnPitEntry::RemoveAllReferencesToFace (Ptr<NdnFace> face)
+Entry::RemoveAllReferencesToFace (Ptr<Face> face)
{
in_iterator incoming = m_incoming.find (face);
@@ -112,16 +113,16 @@
}
// void
-// NdnPitEntry::SetWaitingInVain (NdnPitEntry::out_iterator face)
+// Entry::SetWaitingInVain (Entry::out_iterator face)
// {
// NS_LOG_DEBUG (boost::cref (*face->m_face));
// m_outgoing.modify (face,
-// (&ll::_1)->*&NdnPitEntryOutgoingFace::m_waitingInVain = true);
+// (&ll::_1)->*&EntryOutgoingFace::m_waitingInVain = true);
// }
void
-NdnPitEntry::SetWaitingInVain (Ptr<NdnFace> face)
+Entry::SetWaitingInVain (Ptr<Face> face)
{
// NS_LOG_DEBUG (boost::cref (*face->m_face));
@@ -130,37 +131,37 @@
return;
m_outgoing.modify (item,
- (&ll::_1)->*&NdnPitEntryOutgoingFace::m_waitingInVain = true);
+ (&ll::_1)->*&OutgoingFace::m_waitingInVain = true);
}
bool
-NdnPitEntry::AreAllOutgoingInVain () const
+Entry::AreAllOutgoingInVain () const
{
NS_LOG_DEBUG (m_outgoing.size ());
bool inVain = true;
std::for_each (m_outgoing.begin (), m_outgoing.end (),
- ll::var(inVain) &= (&ll::_1)->*&NdnPitEntryOutgoingFace::m_waitingInVain);
+ ll::var(inVain) &= (&ll::_1)->*&OutgoingFace::m_waitingInVain);
NS_LOG_DEBUG ("inVain " << inVain);
return inVain;
}
bool
-NdnPitEntry::AreTherePromisingOutgoingFacesExcept (Ptr<NdnFace> face) const
+Entry::AreTherePromisingOutgoingFacesExcept (Ptr<Face> face) const
{
bool inVain = true;
std::for_each (m_outgoing.begin (), m_outgoing.end (),
ll::var(inVain) &=
- ((&ll::_1)->*&NdnPitEntryOutgoingFace::m_face == face ||
- (&ll::_1)->*&NdnPitEntryOutgoingFace::m_waitingInVain));
+ ((&ll::_1)->*&OutgoingFace::m_face == face ||
+ (&ll::_1)->*&OutgoingFace::m_waitingInVain));
return !inVain;
}
void
-NdnPitEntry::IncreaseAllowedRetxCount ()
+Entry::IncreaseAllowedRetxCount ()
{
NS_LOG_ERROR (this);
if (Simulator::Now () - m_lastRetransmission >= MilliSeconds (100))
@@ -172,12 +173,12 @@
}
}
-std::ostream& operator<< (std::ostream& os, const NdnPitEntry &entry)
+std::ostream& operator<< (std::ostream& os, const Entry &entry)
{
os << "Prefix: " << *entry.m_prefix << "\n";
os << "In: ";
bool first = true;
- BOOST_FOREACH (const NdnPitEntryIncomingFace &face, entry.m_incoming)
+ BOOST_FOREACH (const IncomingFace &face, entry.m_incoming)
{
if (!first)
os << ",";
@@ -189,7 +190,7 @@
os << "\nOut: ";
first = true;
- BOOST_FOREACH (const NdnPitEntryOutgoingFace &face, entry.m_outgoing)
+ BOOST_FOREACH (const OutgoingFace &face, entry.m_outgoing)
{
if (!first)
os << ",";
@@ -214,4 +215,6 @@
}
-}
+} // namespace pit
+} // namespace ndn
+} // namespace ns3
diff --git a/model/pit/ndn-pit-entry.h b/model/pit/ndn-pit-entry.h
index c14b93c..8dc5d24 100644
--- a/model/pit/ndn-pit-entry.h
+++ b/model/pit/ndn-pit-entry.h
@@ -25,8 +25,9 @@
#include "ns3/simple-ref-count.h"
#include "ns3/ndn-fib.h"
-#include "ndn-pit-entry-incoming-face.h"
-#include "ndn-pit-entry-outgoing-face.h"
+
+#include "ns3/ndn-pit-entry-incoming-face.h"
+#include "ns3/ndn-pit-entry-outgoing-face.h"
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/tag.hpp>
@@ -38,39 +39,38 @@
#include <set>
namespace ns3 {
+namespace ndn {
-class NdnFace;
-class NdnNameComponents;
-class NdnPit;
+class Pit;
+
+namespace pit {
/// @cond include_hidden
-namespace __ndn_private
-{
+class i_face {};
class i_retx {};
-}
/// @endcond
/**
* \ingroup ndn
- * \brief Typedef for indexed face container of NdnPitEntryOutgoingFace
+ * \brief Typedef for indexed face container of PitEntryOutgoingFace
*
* Indexes:
* - by face (may be it will be possible to replace with just the std::map)
*/
-struct NdnPitEntryOutgoingFaceContainer
+struct OutgoingFaceContainer
{
/// @cond include_hidden
typedef boost::multi_index::multi_index_container<
- NdnPitEntryOutgoingFace,
+ OutgoingFace,
boost::multi_index::indexed_by<
// For fast access to elements using NdnFace
boost::multi_index::ordered_unique<
- boost::multi_index::tag<__ndn_private::i_face>,
- boost::multi_index::member<NdnPitEntryOutgoingFace, Ptr<NdnFace>, &NdnPitEntryOutgoingFace::m_face>
+ boost::multi_index::tag<i_face>,
+ boost::multi_index::member<OutgoingFace, Ptr<Face>, &OutgoingFace::m_face>
>,
boost::multi_index::ordered_non_unique<
- boost::multi_index::tag<__ndn_private::i_retx>,
- boost::multi_index::member<NdnPitEntryOutgoingFace, uint32_t, &NdnPitEntryOutgoingFace::m_retxCount>
+ boost::multi_index::tag<i_retx>,
+ boost::multi_index::member<OutgoingFace, uint32_t, &OutgoingFace::m_retxCount>
>
>
> type;
@@ -84,13 +84,13 @@
*
* All set-methods are virtual, in case index rearrangement is necessary in the derived classes
*/
-class NdnPitEntry : public SimpleRefCount<NdnPitEntry>
+class Entry : public SimpleRefCount<Entry>
{
public:
- typedef std::set< NdnPitEntryIncomingFace > in_container; ///< @brief incoming faces container type
+ typedef std::set< IncomingFace > in_container; ///< @brief incoming faces container type
typedef in_container::iterator in_iterator; ///< @brief iterator to incoming faces
- typedef NdnPitEntryOutgoingFaceContainer::type out_container; ///< @brief outgoing faces container type
+ typedef OutgoingFaceContainer::type out_container; ///< @brief outgoing faces container type
typedef out_container::iterator out_iterator; ///< @brief iterator to outgoing faces
typedef std::set< uint32_t > nonce_container; ///< @brief nonce container type
@@ -101,12 +101,12 @@
* \param offsetTime Relative time to the current moment, representing PIT entry lifetime
* \param fibEntry A FIB entry associated with the PIT entry
*/
- NdnPitEntry (NdnPit &container, Ptr<const NdnInterestHeader> header, Ptr<NdnFibEntry> fibEntry);
+ Entry (Pit &container, Ptr<const InterestHeader> header, Ptr<fib::Entry> fibEntry);
/**
* @brief Virtual destructor
*/
- virtual ~NdnPitEntry () {}
+ virtual ~Entry () {}
/**
* @brief Update lifetime of PIT entry
@@ -122,7 +122,7 @@
/**
* @brief Get prefix of the PIT entry
*/
- const NdnNameComponents &
+ const NameComponents &
GetPrefix () const
{ return *m_prefix; }
@@ -162,13 +162,13 @@
* @returns iterator to the added entry
*/
virtual in_iterator
- AddIncoming (Ptr<NdnFace> face);
+ AddIncoming (Ptr<Face> face);
/**
* @brief Remove incoming entry for face `face`
*/
virtual void
- RemoveIncoming (Ptr<NdnFace> face);
+ RemoveIncoming (Ptr<Face> face);
/**
* @brief Clear all incoming faces either after all of them were satisfied or NACKed
@@ -184,7 +184,7 @@
* @returns iterator to the added entry
*/
virtual out_iterator
- AddOutgoing (Ptr<NdnFace> face);
+ AddOutgoing (Ptr<Face> face);
/**
* @brief Clear all incoming faces either after all of them were satisfied or NACKed
@@ -200,7 +200,7 @@
* Face is removed from the lists of incoming and outgoing faces
*/
virtual void
- RemoveAllReferencesToFace (Ptr<NdnFace> face);
+ RemoveAllReferencesToFace (Ptr<Face> face);
/**
* @brief Flag outgoing face as hopeless
@@ -208,7 +208,7 @@
// virtual void
// SetWaitingInVain (out_iterator face);
virtual void
- SetWaitingInVain (Ptr<NdnFace> face);
+ SetWaitingInVain (Ptr<Face> face);
/**
* @brief Check if all outgoing faces are NACKed
@@ -221,7 +221,7 @@
* \see AreAllOutgoingInVain
**/
bool
- AreTherePromisingOutgoingFacesExcept (Ptr<NdnFace> face) const;
+ AreTherePromisingOutgoingFacesExcept (Ptr<Face> face) const;
/**
* @brief Increase maximum limit of allowed retransmission per outgoing face
@@ -229,7 +229,7 @@
virtual void
IncreaseAllowedRetxCount ();
- Ptr<NdnFibEntry>
+ Ptr<fib::Entry>
GetFibEntry () { return m_fibEntry; };
const in_container &
@@ -242,13 +242,13 @@
GetMaxRetxCount () const { return m_maxRetxCount; }
private:
- friend std::ostream& operator<< (std::ostream& os, const NdnPitEntry &entry);
+ friend std::ostream& operator<< (std::ostream& os, const Entry &entry);
protected:
- NdnPit &m_container; ///< @brief Reference to the container (to rearrange indexes, if necessary)
+ Pit &m_container; ///< @brief Reference to the container (to rearrange indexes, if necessary)
- Ptr<const NdnNameComponents> m_prefix; ///< \brief Prefix of the PIT entry
- Ptr<NdnFibEntry> m_fibEntry; ///< \brief FIB entry related to this prefix
+ Ptr<const NameComponents> m_prefix; ///< \brief Prefix of the PIT entry
+ Ptr<fib::Entry> m_fibEntry; ///< \brief FIB entry related to this prefix
nonce_container m_seenNonces; ///< \brief map of nonces that were seen for this prefix
in_container m_incoming; ///< \brief container for incoming interests
@@ -260,8 +260,10 @@
uint32_t m_maxRetxCount; ///< @brief Maximum allowed number of retransmissions via outgoing faces
};
-std::ostream& operator<< (std::ostream& os, const NdnPitEntry &entry);
+std::ostream& operator<< (std::ostream& os, const Entry &entry);
+} // namespace pit
+} // namespace ndn
} // namespace ns3
#endif // _NDN_PIT_ENTRY_H_
diff --git a/model/pit/ndn-pit-impl.cc b/model/pit/ndn-pit-impl.cc
index 090f1d6..bb8e42a 100644
--- a/model/pit/ndn-pit-impl.cc
+++ b/model/pit/ndn-pit-impl.cc
@@ -37,7 +37,7 @@
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
-NS_LOG_COMPONENT_DEFINE ("NdnPitImpl");
+NS_LOG_COMPONENT_DEFINE ("ndn.pit.PitImpl");
using namespace boost::tuples;
using namespace boost;
@@ -53,23 +53,24 @@
} x_ ## type ## templ ## RegistrationVariable
namespace ns3 {
+namespace ndn {
+namespace pit {
using namespace ndnSIM;
-
template<>
TypeId
-NdnPitImpl<persistent_policy_traits>::GetTypeId ()
+PitImpl<persistent_policy_traits>::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::NdnPit")
+ static TypeId tid = TypeId ("ns3::ndn::pit::Persistent")
.SetGroupName ("Ndn")
- .SetParent<NdnPit> ()
- .AddConstructor< NdnPitImpl< persistent_policy_traits > > ()
+ .SetParent<Pit> ()
+ .AddConstructor< PitImpl< persistent_policy_traits > > ()
.AddAttribute ("MaxSize",
"Set maximum number of entries in PIT. If 0, limit is not enforced",
StringValue ("0"),
- MakeUintegerAccessor (&NdnPitImpl< persistent_policy_traits >::GetMaxSize,
- &NdnPitImpl< persistent_policy_traits >::SetMaxSize),
+ MakeUintegerAccessor (&PitImpl< persistent_policy_traits >::GetMaxSize,
+ &PitImpl< persistent_policy_traits >::SetMaxSize),
MakeUintegerChecker<uint32_t> ())
;
@@ -78,17 +79,17 @@
template<>
TypeId
-NdnPitImpl<random_policy_traits>::GetTypeId ()
+PitImpl<random_policy_traits>::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::NdnPitRandom")
+ static TypeId tid = TypeId ("ns3::ndn::pit::Random")
.SetGroupName ("Ndn")
- .SetParent<NdnPit> ()
- .AddConstructor< NdnPitImpl< random_policy_traits > > ()
+ .SetParent<Pit> ()
+ .AddConstructor< PitImpl< random_policy_traits > > ()
.AddAttribute ("MaxSize",
"Set maximum number of entries in PIT. If 0, limit is not enforced",
StringValue ("0"),
- MakeUintegerAccessor (&NdnPitImpl< random_policy_traits >::GetMaxSize,
- &NdnPitImpl< random_policy_traits >::SetMaxSize),
+ MakeUintegerAccessor (&PitImpl< random_policy_traits >::GetMaxSize,
+ &PitImpl< random_policy_traits >::SetMaxSize),
MakeUintegerChecker<uint32_t> ())
;
@@ -97,17 +98,17 @@
template<>
TypeId
-NdnPitImpl<lru_policy_traits>::GetTypeId ()
+PitImpl<lru_policy_traits>::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::NdnPitLru")
+ static TypeId tid = TypeId ("ns3::ndn::pit::Lru")
.SetGroupName ("Ndn")
- .SetParent<NdnPit> ()
- .AddConstructor< NdnPitImpl< lru_policy_traits > > ()
+ .SetParent<Pit> ()
+ .AddConstructor< PitImpl< lru_policy_traits > > ()
.AddAttribute ("MaxSize",
"Set maximum number of entries in PIT. If 0, limit is not enforced",
StringValue ("0"),
- MakeUintegerAccessor (&NdnPitImpl< lru_policy_traits >::GetMaxSize,
- &NdnPitImpl< lru_policy_traits >::SetMaxSize),
+ MakeUintegerAccessor (&PitImpl< lru_policy_traits >::GetMaxSize,
+ &PitImpl< lru_policy_traits >::SetMaxSize),
MakeUintegerChecker<uint32_t> ())
;
@@ -115,60 +116,60 @@
}
template<class Policy>
-NdnPitImpl<Policy>::NdnPitImpl ()
+PitImpl<Policy>::PitImpl ()
{
}
template<class Policy>
-NdnPitImpl<Policy>::~NdnPitImpl ()
+PitImpl<Policy>::~PitImpl ()
{
}
template<class Policy>
uint32_t
-NdnPitImpl<Policy>::GetMaxSize () const
+PitImpl<Policy>::GetMaxSize () const
{
return super::getPolicy ().get_max_size ();
}
template<class Policy>
void
-NdnPitImpl<Policy>::SetMaxSize (uint32_t maxSize)
+PitImpl<Policy>::SetMaxSize (uint32_t maxSize)
{
super::getPolicy ().set_max_size (maxSize);
}
template<class Policy>
void
-NdnPitImpl<Policy>::NotifyNewAggregate ()
+PitImpl<Policy>::NotifyNewAggregate ()
{
if (m_fib == 0)
{
- m_fib = GetObject<NdnFib> ();
+ m_fib = GetObject<Fib> ();
}
if (m_forwardingStrategy == 0)
{
- m_forwardingStrategy = GetObject<NdnForwardingStrategy> ();
+ m_forwardingStrategy = GetObject<ForwardingStrategy> ();
}
- NdnPit::NotifyNewAggregate ();
+ Pit::NotifyNewAggregate ();
}
template<class Policy>
void
-NdnPitImpl<Policy>::DoDispose ()
+PitImpl<Policy>::DoDispose ()
{
super::clear ();
m_forwardingStrategy = 0;
m_fib = 0;
- NdnPit::DoDispose ();
+ Pit::DoDispose ();
}
template<class Policy>
void
-NdnPitImpl<Policy>::RescheduleCleaning ()
+PitImpl<Policy>::RescheduleCleaning ()
{
m_cleanEvent.Cancel ();
if (i_time.empty ())
@@ -185,12 +186,12 @@
// i_time.begin ()->GetExpireTime () << "s abs time");
m_cleanEvent = Simulator::Schedule (nextEvent,
- &NdnPitImpl<Policy>::CleanExpired, this);
+ &PitImpl<Policy>::CleanExpired, this);
}
template<class Policy>
void
-NdnPitImpl<Policy>::CleanExpired ()
+PitImpl<Policy>::CleanExpired ()
{
NS_LOG_LOGIC ("Cleaning PIT. Total: " << i_time.size ());
Time now = Simulator::Now ();
@@ -218,8 +219,8 @@
}
template<class Policy>
-Ptr<NdnPitEntry>
-NdnPitImpl<Policy>::Lookup (const NdnContentObjectHeader &header)
+Ptr<Entry>
+PitImpl<Policy>::Lookup (const ContentObjectHeader &header)
{
/// @todo use predicate to search with exclude filters
typename super::iterator item = super::longest_prefix_match (header.GetName ());
@@ -231,8 +232,8 @@
}
template<class Policy>
-Ptr<NdnPitEntry>
-NdnPitImpl<Policy>::Lookup (const NdnInterestHeader &header)
+Ptr<Entry>
+PitImpl<Policy>::Lookup (const InterestHeader &header)
{
// NS_LOG_FUNCTION (header.GetName ());
NS_ASSERT_MSG (m_fib != 0, "FIB should be set");
@@ -249,10 +250,10 @@
}
template<class Policy>
-Ptr<NdnPitEntry>
-NdnPitImpl<Policy>::Create (Ptr<const NdnInterestHeader> header)
+Ptr<Entry>
+PitImpl<Policy>::Create (Ptr<const InterestHeader> header)
{
- Ptr<NdnFibEntry> fibEntry = m_fib->LongestPrefixMatch (*header);
+ Ptr<fib::Entry> fibEntry = m_fib->LongestPrefixMatch (*header);
if (fibEntry == 0)
return 0;
@@ -283,7 +284,7 @@
template<class Policy>
void
-NdnPitImpl<Policy>::MarkErased (Ptr<NdnPitEntry> item)
+PitImpl<Policy>::MarkErased (Ptr<Entry> item)
{
// entry->SetExpireTime (Simulator::Now () + m_PitEntryPruningTimout);
super::erase (StaticCast< entry > (item)->to_iterator ());
@@ -292,7 +293,7 @@
template<class Policy>
void
-NdnPitImpl<Policy>::Print (std::ostream& os) const
+PitImpl<Policy>::Print (std::ostream& os) const
{
// !!! unordered_set imposes "random" order of item in the same level !!!
typename super::parent_trie::const_recursive_iterator item (super::getTrie ()), end (0);
@@ -306,14 +307,14 @@
template<class Policy>
uint32_t
-NdnPitImpl<Policy>::GetSize () const
+PitImpl<Policy>::GetSize () const
{
return super::getPolicy ().size ();
}
template<class Policy>
-Ptr<NdnPitEntry>
-NdnPitImpl<Policy>::Begin ()
+Ptr<Entry>
+PitImpl<Policy>::Begin ()
{
typename super::parent_trie::recursive_iterator item (super::getTrie ()), end (0);
for (; item != end; item++)
@@ -329,15 +330,15 @@
}
template<class Policy>
-Ptr<NdnPitEntry>
-NdnPitImpl<Policy>::End ()
+Ptr<Entry>
+PitImpl<Policy>::End ()
{
return 0;
}
template<class Policy>
-Ptr<NdnPitEntry>
-NdnPitImpl<Policy>::Next (Ptr<NdnPitEntry> from)
+Ptr<Entry>
+PitImpl<Policy>::Next (Ptr<Entry> from)
{
if (from == 0) return 0;
@@ -359,13 +360,14 @@
// explicit instantiation and registering
-template class NdnPitImpl<persistent_policy_traits>;
-template class NdnPitImpl<random_policy_traits>;
-template class NdnPitImpl<lru_policy_traits>;
+template class PitImpl<persistent_policy_traits>;
+template class PitImpl<random_policy_traits>;
+template class PitImpl<lru_policy_traits>;
-NS_OBJECT_ENSURE_REGISTERED_TEMPL(NdnPitImpl, persistent_policy_traits);
-NS_OBJECT_ENSURE_REGISTERED_TEMPL(NdnPitImpl, random_policy_traits);
-NS_OBJECT_ENSURE_REGISTERED_TEMPL(NdnPitImpl, lru_policy_traits);
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(PitImpl, persistent_policy_traits);
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(PitImpl, random_policy_traits);
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(PitImpl, lru_policy_traits);
-
+} // namespace pit
+} // namespace ndn
} // namespace ns3
diff --git a/model/pit/ndn-pit-impl.h b/model/pit/ndn-pit-impl.h
index 4673bdb..64e1fc0 100644
--- a/model/pit/ndn-pit-impl.h
+++ b/model/pit/ndn-pit-impl.h
@@ -30,26 +30,31 @@
#include "ns3/ndn-name-components.h"
namespace ns3 {
+namespace ndn {
+
+class ForwardingStrategy;
+
+namespace pit {
/**
* \ingroup ndn
* \brief Class implementing Pending Interests Table
*/
template<class Policy>
-class NdnPitImpl : public NdnPit
- , protected ndnSIM::trie_with_policy<NdnNameComponents,
- ndnSIM::smart_pointer_payload_traits<NdnPitEntryImpl< NdnPitImpl< Policy > > >,
- // ndnSIM::persistent_policy_traits
- Policy
- >
+class PitImpl : public Pit
+ , protected ndnSIM::trie_with_policy<NameComponents,
+ ndnSIM::smart_pointer_payload_traits< EntryImpl< PitImpl< Policy > > >,
+ // ndnSIM::persistent_policy_traits
+ Policy
+ >
{
public:
- typedef ndnSIM::trie_with_policy<NdnNameComponents,
- ndnSIM::smart_pointer_payload_traits<NdnPitEntryImpl< NdnPitImpl< Policy > > >,
+ typedef ndnSIM::trie_with_policy<NameComponents,
+ ndnSIM::smart_pointer_payload_traits< EntryImpl< PitImpl< Policy > > >,
// ndnSIM::persistent_policy_traits
Policy
> super;
- typedef NdnPitEntryImpl< NdnPitImpl< Policy > > entry;
+ typedef EntryImpl< PitImpl< Policy > > entry;
/**
* \brief Interface ID
@@ -61,25 +66,25 @@
/**
* \brief PIT constructor
*/
- NdnPitImpl ();
+ PitImpl ();
/**
* \brief Destructor
*/
- virtual ~NdnPitImpl ();
+ virtual ~PitImpl ();
- // inherited from NdnPit
- virtual Ptr<NdnPitEntry>
- Lookup (const NdnContentObjectHeader &header);
+ // inherited from Pit
+ virtual Ptr<Entry>
+ Lookup (const ContentObjectHeader &header);
- virtual Ptr<NdnPitEntry>
- Lookup (const NdnInterestHeader &header);
+ virtual Ptr<Entry>
+ Lookup (const InterestHeader &header);
- virtual Ptr<NdnPitEntry>
- Create (Ptr<const NdnInterestHeader> header);
+ virtual Ptr<Entry>
+ Create (Ptr<const InterestHeader> header);
virtual void
- MarkErased (Ptr<NdnPitEntry> entry);
+ MarkErased (Ptr<Entry> entry);
virtual void
Print (std::ostream &os) const;
@@ -87,14 +92,14 @@
virtual uint32_t
GetSize () const;
- virtual Ptr<NdnPitEntry>
+ virtual Ptr<Entry>
Begin ();
- virtual Ptr<NdnPitEntry>
+ virtual Ptr<Entry>
End ();
- virtual Ptr<NdnPitEntry>
- Next (Ptr<NdnPitEntry>);
+ virtual Ptr<Entry>
+ Next (Ptr<Entry>);
protected:
void RescheduleCleaning ();
@@ -113,8 +118,8 @@
private:
EventId m_cleanEvent;
- Ptr<NdnFib> m_fib; ///< \brief Link to FIB table
- Ptr<NdnForwardingStrategy> m_forwardingStrategy;
+ Ptr<Fib> m_fib; ///< \brief Link to FIB table
+ Ptr<ForwardingStrategy> m_forwardingStrategy;
// indexes
typedef
@@ -126,9 +131,11 @@
> time_index;
time_index i_time;
- friend class NdnPitEntryImpl< NdnPitImpl >;
+ friend class EntryImpl< PitImpl >;
};
+} // namespace pit
+} // namespace ndn
} // namespace ns3
#endif /* NDN_PIT_IMPL_H */
diff --git a/model/pit/ndn-pit.cc b/model/pit/ndn-pit.cc
index 1f1bcde..48a1747 100644
--- a/model/pit/ndn-pit.cc
+++ b/model/pit/ndn-pit.cc
@@ -31,37 +31,37 @@
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
-NS_LOG_COMPONENT_DEFINE ("NdnPit");
+NS_LOG_COMPONENT_DEFINE ("ndn.Pit");
namespace ns3 {
+namespace ndn {
-NS_OBJECT_ENSURE_REGISTERED (NdnPit);
-
-using namespace __ndn_private;
+NS_OBJECT_ENSURE_REGISTERED (Pit);
TypeId
-NdnPit::GetTypeId ()
+Pit::GetTypeId ()
{
- static TypeId tid = TypeId ("ns3::private::NdnPit")
+ static TypeId tid = TypeId ("ns3::ndn::Pit")
.SetGroupName ("Ndn")
.SetParent<Object> ()
.AddAttribute ("PitEntryPruningTimout",
"Timeout for PIT entry to live after being satisfied. To make sure recently satisfied interest will not be satisfied again",
StringValue ("100ms"),
- MakeTimeAccessor (&NdnPit::m_PitEntryPruningTimout),
+ MakeTimeAccessor (&Pit::m_PitEntryPruningTimout),
MakeTimeChecker ())
;
return tid;
}
-NdnPit::NdnPit ()
+Pit::Pit ()
{
}
-NdnPit::~NdnPit ()
+Pit::~Pit ()
{
}
+} // namespace ndn
} // namespace ns3
diff --git a/model/pit/ndn-pit.h b/model/pit/ndn-pit.h
index 6a0556b..f8eeafb 100644
--- a/model/pit/ndn-pit.h
+++ b/model/pit/ndn-pit.h
@@ -28,11 +28,12 @@
#include "ndn-pit-entry.h"
namespace ns3 {
+namespace ndn {
-class Ndn;
-class NdnFace;
-class NdnContentObjectHeader;
-class NdnInterestHeader;
+class L3Protocol;
+class Face;
+class ContentObjectHeader;
+class InterestHeader;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@@ -41,7 +42,7 @@
* \ingroup ndn
* \brief Class implementing Pending Interests Table
*/
-class NdnPit : public Object
+class Pit : public Object
{
public:
/**
@@ -54,12 +55,12 @@
/**
* \brief PIT constructor
*/
- NdnPit ();
+ Pit ();
/**
* \brief Destructor
*/
- virtual ~NdnPit ();
+ virtual ~Pit ();
/**
* \brief Find corresponding PIT entry for the given content name
@@ -72,8 +73,8 @@
* \returns smart pointer to PIT entry. If record not found,
* returns 0
*/
- virtual Ptr<NdnPitEntry>
- Lookup (const NdnContentObjectHeader &header) = 0;
+ virtual Ptr<pit::Entry>
+ Lookup (const ContentObjectHeader &header) = 0;
/**
* \brief Find a PIT entry for the given content interest
@@ -81,8 +82,8 @@
* \returns iterator to Pit entry. If record not found,
* return end() iterator
*/
- virtual Ptr<NdnPitEntry>
- Lookup (const NdnInterestHeader &header) = 0;
+ virtual Ptr<pit::Entry>
+ Lookup (const InterestHeader &header) = 0;
/**
* @brief Creates a PIT entry for the given interest
@@ -92,8 +93,8 @@
*
* Note. This call assumes that the entry does not exist (i.e., there was a Lookup call before)
*/
- virtual Ptr<NdnPitEntry>
- Create (Ptr<const NdnInterestHeader> header) = 0;
+ virtual Ptr<pit::Entry>
+ Create (Ptr<const InterestHeader> header) = 0;
/**
* @brief Mark PIT entry deleted
@@ -103,7 +104,7 @@
* lifetime +m_PitEntryDefaultLifetime from Now ()
*/
virtual void
- MarkErased (Ptr<NdnPitEntry> entry) = 0;
+ MarkErased (Ptr<pit::Entry> entry) = 0;
/**
* @brief Print out PIT contents for debugging purposes
@@ -122,20 +123,20 @@
/**
* @brief Return first element of FIB (no order guaranteed)
*/
- virtual Ptr<NdnPitEntry>
+ virtual Ptr<pit::Entry>
Begin () = 0;
/**
* @brief Return item next after last (no order guaranteed)
*/
- virtual Ptr<NdnPitEntry>
+ virtual Ptr<pit::Entry>
End () = 0;
/**
* @brief Advance the iterator
*/
- virtual Ptr<NdnPitEntry>
- Next (Ptr<NdnPitEntry>) = 0;
+ virtual Ptr<pit::Entry>
+ Next (Ptr<pit::Entry>) = 0;
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
@@ -144,8 +145,8 @@
/**
* @brief Static call to cheat python bindings
*/
- static inline Ptr<NdnPit>
- GetNdnPit (Ptr<Object> node);
+ static inline Ptr<Pit>
+ GetPit (Ptr<Object> node);
protected:
// configuration variables. Check implementation of GetTypeId for more details
@@ -156,19 +157,19 @@
///////////////////////////////////////////////////////////////////////////////
inline std::ostream&
-operator<< (std::ostream& os, const NdnPit &pit)
+operator<< (std::ostream& os, const Pit &pit)
{
pit.Print (os);
return os;
}
-inline Ptr<NdnPit>
-NdnPit::GetNdnPit (Ptr<Object> node)
+inline Ptr<Pit>
+Pit::GetPit (Ptr<Object> node)
{
- return node->GetObject<NdnPit> ();
+ return node->GetObject<Pit> ();
}
-
+} // namespace ndn
} // namespace ns3
#endif /* NDN_PIT_H */
diff --git a/test/ndnSIM-pit.cc b/test/ndnSIM-pit.cc
index 8593baf..38016e4 100644
--- a/test/ndnSIM-pit.cc
+++ b/test/ndnSIM-pit.cc
@@ -24,7 +24,7 @@
#include <boost/lexical_cast.hpp>
-NS_LOG_COMPONENT_DEFINE ("NdnPitTest");
+NS_LOG_COMPONENT_DEFINE ("ndn.PitTest");
namespace ns3
{
diff --git a/test/ndnSIM-serialization.cc b/test/ndnSIM-serialization.cc
index 244aae8..9342317 100644
--- a/test/ndnSIM-serialization.cc
+++ b/test/ndnSIM-serialization.cc
@@ -29,7 +29,7 @@
namespace ns3
{
-NS_LOG_COMPONENT_DEFINE ("NdnSimSerialization");
+NS_LOG_COMPONENT_DEFINE ("ndn.Serialization");
void
InterestSerializationTest::DoRun ()
diff --git a/test/ndnSIM-stats-tree.cc b/test/ndnSIM-stats-tree.cc
index deac543..298c492 100644
--- a/test/ndnSIM-stats-tree.cc
+++ b/test/ndnSIM-stats-tree.cc
@@ -27,7 +27,7 @@
#include <boost/lexical_cast.hpp>
-NS_LOG_COMPONENT_DEFINE ("NdnStatsTreeTest");
+NS_LOG_COMPONENT_DEFINE ("ndn.StatsTreeTest");
namespace ns3
{
diff --git a/utils/counting-policy.h b/utils/counting-policy.h
index d8cfe07..ffa2d1a 100644
--- a/utils/counting-policy.h
+++ b/utils/counting-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for policy that just keeps track of number of elements
@@ -105,6 +104,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // COUNTING_POLICY_H_
diff --git a/utils/detail/functor-hook.h b/utils/detail/functor-hook.h
index 63dcffd..f34969c 100644
--- a/utils/detail/functor-hook.h
+++ b/utils/detail/functor-hook.h
@@ -23,12 +23,10 @@
#include <boost/intrusive/parent_from_member.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
-namespace detail
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
+namespace detail {
template<class BaseHook, class ValueType, int N>
struct FunctorHook
@@ -66,6 +64,7 @@
} // detail
} // ndnSIM
+} // ndn
} // ns3
#endif // FUNCTOR_HOOK_H_
diff --git a/utils/detail/multi-policy-container.h b/utils/detail/multi-policy-container.h
index 7272a01..35119cb 100644
--- a/utils/detail/multi-policy-container.h
+++ b/utils/detail/multi-policy-container.h
@@ -24,12 +24,10 @@
#include <boost/mpl/inherit_linearly.hpp>
#include <boost/mpl/at.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
-namespace detail
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
+namespace detail {
template< class Base, class Value >
struct policy_wrap
@@ -160,6 +158,7 @@
} // detail
} // ndnSIM
+} // ndn
} // ns3
#endif // MULTI_POLICY_CONTAINER_H_
diff --git a/utils/detail/multi-type-container.h b/utils/detail/multi-type-container.h
index 24bf17c..d4971c4 100644
--- a/utils/detail/multi-type-container.h
+++ b/utils/detail/multi-type-container.h
@@ -25,12 +25,10 @@
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/at.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
-namespace detail
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
+namespace detail {
template <class T>
struct wrap
@@ -82,6 +80,7 @@
} // detail
} // ndnSIM
+} // ndn
} // ns3
#endif // MULTI_TYPE_CONTAINER_H_
diff --git a/utils/empty-policy.h b/utils/empty-policy.h
index 04bc676..a50b9e8 100644
--- a/utils/empty-policy.h
+++ b/utils/empty-policy.h
@@ -21,10 +21,9 @@
#ifndef EMPTY_POLICY_H_
#define EMPTY_POLICY_H_
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for empty (bogus) replacement policy
@@ -54,6 +53,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // EMPTY_POLICY_H_
diff --git a/utils/fifo-policy.h b/utils/fifo-policy.h
index 1943e06..77d4ce2 100644
--- a/utils/fifo-policy.h
+++ b/utils/fifo-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for First In First Out replacement policy
@@ -123,6 +122,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif
diff --git a/utils/load-stats-face.cc b/utils/load-stats-face.cc
index de202ee..df48f2b 100644
--- a/utils/load-stats-face.cc
+++ b/utils/load-stats-face.cc
@@ -28,12 +28,11 @@
using namespace boost::mpl;
using namespace boost::tuples;
-NS_LOG_COMPONENT_DEFINE ("LoadStatsFace");
+NS_LOG_COMPONENT_DEFINE ("ndn.LoadStatsFace");
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
std::ostream &
operator << (std::ostream &os, const LoadStats::stats_tuple &tuple);
@@ -147,6 +146,7 @@
return os;
}
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
diff --git a/utils/load-stats-face.h b/utils/load-stats-face.h
index b8202f9..70a4c36 100644
--- a/utils/load-stats-face.h
+++ b/utils/load-stats-face.h
@@ -23,10 +23,9 @@
#include "load-stats.h"
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
class LoadStatsFace
{
@@ -132,7 +131,8 @@
std::ostream &
operator << (std::ostream &os, const LoadStatsFace &stats);
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
#endif // LOAD_STATS_FACE_H
diff --git a/utils/load-stats-node.cc b/utils/load-stats-node.cc
index 86a149d..39e9d60 100644
--- a/utils/load-stats-node.cc
+++ b/utils/load-stats-node.cc
@@ -26,12 +26,11 @@
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("LoadStatsNode");
+NS_LOG_COMPONENT_DEFINE ("ndn.LoadStatsNode");
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
void
LoadStatsNode::Step ()
@@ -62,13 +61,13 @@
}
void
-LoadStatsNode::AddIncoming (ns3::Ptr<ns3::NdnFace> face)
+LoadStatsNode::AddIncoming (ns3::Ptr<Face> face)
{
m_incoming [face].count ()++;
}
void
-LoadStatsNode::AddOutgoing (ns3::Ptr<ns3::NdnFace> face)
+LoadStatsNode::AddOutgoing (ns3::Ptr<Face> face)
{
m_outgoing [face].count ()++;
}
@@ -114,14 +113,14 @@
}
void
-LoadStatsNode::Rx (ns3::Ptr<ns3::NdnFace> face, uint32_t amount)
+LoadStatsNode::Rx (ns3::Ptr<Face> face, uint32_t amount)
{
m_pit.rx () += amount;
m_incoming [face].rx () += amount;
}
void
-LoadStatsNode::Tx (ns3::Ptr<ns3::NdnFace> face, uint32_t amount)
+LoadStatsNode::Tx (ns3::Ptr<Face> face, uint32_t amount)
{
m_pit.tx () += amount;
m_outgoing [face].tx () += amount;
@@ -187,7 +186,7 @@
void
-LoadStatsNode::RemoveFace (ns3::Ptr<ns3::NdnFace> face)
+LoadStatsNode::RemoveFace (ns3::Ptr<Face> face)
{
NS_LOG_FUNCTION (this);
m_incoming.erase (face);
@@ -213,5 +212,6 @@
}
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
diff --git a/utils/load-stats-node.h b/utils/load-stats-node.h
index 5989a23..365db55 100644
--- a/utils/load-stats-node.h
+++ b/utils/load-stats-node.h
@@ -25,9 +25,10 @@
#include <map>
#include "ns3/ptr.h"
-namespace ns3
-{
-class NdnFace;
+namespace ns3 {
+namespace ndn {
+
+class Face;
namespace ndnSIM
{
@@ -37,7 +38,7 @@
class LoadStatsNode
{
public:
- typedef std::map< ns3::Ptr<ns3::NdnFace>, LoadStatsFace > stats_container;
+ typedef std::map< ns3::Ptr<Face>, LoadStatsFace > stats_container;
LoadStatsNode () {}
LoadStatsNode (const LoadStatsNode &) {}
@@ -55,13 +56,13 @@
* Increment counter to incoming list
*/
void
- AddIncoming (ns3::Ptr<ns3::NdnFace> face);
+ AddIncoming (ns3::Ptr<Face> face);
/**
* Increment counter to outgoing list
*/
void
- AddOutgoing (ns3::Ptr<ns3::NdnFace> face);
+ AddOutgoing (ns3::Ptr<Face> face);
/**
* Increment counter to both incoming and outgoing lists, for all faces
@@ -79,13 +80,13 @@
* Increment counter for Tx amount
*/
void
- Rx (ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
+ Rx (ns3::Ptr<Face> face, uint32_t amount);
/**
* Increment counter for Tx amount
*/
void
- Tx (ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
+ Tx (ns3::Ptr<Face> face, uint32_t amount);
LoadStatsNode &
operator += (const LoadStatsNode &stats);
@@ -119,7 +120,7 @@
}
void
- RemoveFace (ns3::Ptr<ns3::NdnFace> face);
+ RemoveFace (ns3::Ptr<Face> face);
private:
LoadStatsFace m_pit;
@@ -152,6 +153,7 @@
operator << (std::ostream &os, const LoadStatsNode &node);
} // ndnSIM
+} // ndn
} // ns3
#endif
diff --git a/utils/load-stats.cc b/utils/load-stats.cc
index 166a906..3bc2897 100644
--- a/utils/load-stats.cc
+++ b/utils/load-stats.cc
@@ -29,12 +29,11 @@
const double EXP_2 = exp (-1.0/30.0); /* 1/exp(1sec/30sec) */
const double EXP_3 = exp (-1.0/60.0); /* 1/exp(1sec/60sec) */
-NS_LOG_COMPONENT_DEFINE ("LoadStats");
+NS_LOG_COMPONENT_DEFINE ("ndn.LoadStats");
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
const double LoadStats::PRECISION = 0.1;
@@ -104,5 +103,6 @@
return os;
}
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
diff --git a/utils/load-stats.h b/utils/load-stats.h
index 2b2db89..3e71753 100644
--- a/utils/load-stats.h
+++ b/utils/load-stats.h
@@ -24,10 +24,9 @@
#include "ns3/nstime.h"
#include <boost/tuple/tuple.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
class LoadStats
{
@@ -76,7 +75,8 @@
std::ostream &
operator << (std::ostream &os, const LoadStats &stats);
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
#endif // LOAD_STATS_H
diff --git a/utils/lru-policy.h b/utils/lru-policy.h
index bddb281..15b482f 100644
--- a/utils/lru-policy.h
+++ b/utils/lru-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for Least Recently Used replacement policy
@@ -128,6 +127,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif
diff --git a/utils/multi-policy.h b/utils/multi-policy.h
index b50119a..386cb2e 100644
--- a/utils/multi-policy.h
+++ b/utils/multi-policy.h
@@ -34,10 +34,9 @@
#include <boost/intrusive/options.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
template<typename Policies> // e.g., mpl::vector1< lru_policy_traits >
struct multi_policy_traits
@@ -128,6 +127,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // MULTI_POLICY_H_
diff --git a/utils/payload-policy.h b/utils/payload-policy.h
index 76cf2cf..a474afd 100644
--- a/utils/payload-policy.h
+++ b/utils/payload-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for policy that keeps items in a sorted order using payload member
@@ -129,6 +128,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // PAYLOAD_POLICY_H
diff --git a/utils/payload-with-policy.h b/utils/payload-with-policy.h
index 4cfe975..7db278b 100644
--- a/utils/payload-with-policy.h
+++ b/utils/payload-with-policy.h
@@ -21,10 +21,9 @@
#ifndef PAYLOAD_WITH_INDEX_H_
#define PAYLOAD_WITH_INDEX_H_
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
template<typename PayloadTraits,
typename IndexTraits>
@@ -102,6 +101,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // PAYLOAD_WITH_POLICY_H_
diff --git a/utils/persistent-policy.h b/utils/persistent-policy.h
index c7add54..95c7d8f 100644
--- a/utils/persistent-policy.h
+++ b/utils/persistent-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for persistent replacement policy
@@ -123,6 +122,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // PERSISTENT_POLICY_H_
diff --git a/utils/random-policy.h b/utils/random-policy.h
index 3bfb6e2..9e0dde6 100644
--- a/utils/random-policy.h
+++ b/utils/random-policy.h
@@ -26,10 +26,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/set.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for random replacement policy
@@ -161,6 +160,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // RANDOM_POLICY_H
diff --git a/utils/stats-tree.cc b/utils/stats-tree.cc
index aff2e93..5893861 100644
--- a/utils/stats-tree.cc
+++ b/utils/stats-tree.cc
@@ -22,14 +22,11 @@
#include "ns3/ndn-face.h"
#include "ns3/log.h"
-using namespace ns3;
+NS_LOG_COMPONENT_DEFINE ("ndn.StatsTree");
-NS_LOG_COMPONENT_DEFINE ("StatsTree");
-
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
StatsTree::StatsTree ()
: m_tree ("")
@@ -50,7 +47,7 @@
}
void
-StatsTree::NewPitEntry (const ns3::NdnNameComponents &key)
+StatsTree::NewPitEntry (const NameComponents &key)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -58,7 +55,7 @@
}
void
-StatsTree::Incoming (const NdnNameComponents &key, Ptr<NdnFace> face)
+StatsTree::Incoming (const NameComponents &key, Ptr<Face> face)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -66,7 +63,7 @@
}
void
-StatsTree::Outgoing (const NdnNameComponents &key, Ptr<NdnFace> face)
+StatsTree::Outgoing (const NameComponents &key, Ptr<Face> face)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -74,7 +71,7 @@
}
void
-StatsTree::Satisfy (const NdnNameComponents &key)
+StatsTree::Satisfy (const NameComponents &key)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -82,7 +79,7 @@
}
void
-StatsTree::Timeout (const NdnNameComponents &key)
+StatsTree::Timeout (const NameComponents &key)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -90,7 +87,7 @@
}
void
-StatsTree::Rx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount)
+StatsTree::Rx (const NameComponents &key, Ptr<Face> face, uint32_t amount)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -98,7 +95,7 @@
}
void
-StatsTree::Tx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount)
+StatsTree::Tx (const NameComponents &key, Ptr<Face> face, uint32_t amount)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -106,9 +103,9 @@
}
// const LoadStatsNode &
-// StatsTree::Get (const ns3::NdnNameComponents &key) const
+// StatsTree::Get (const NameComponents &key) const
const LoadStatsNode &
-StatsTree::operator [] (const ns3::NdnNameComponents &key) const
+StatsTree::operator [] (const NameComponents &key) const
{
tree_type::iterator foundItem, lastItem;
bool reachLast;
@@ -140,7 +137,7 @@
}
void
-StatsTree::RemoveFace (ns3::Ptr<ns3::NdnFace> face)
+StatsTree::RemoveFace (Ptr<Face> face)
{
tree_type::recursive_iterator item (&m_tree), end;
for (; item != end; item ++)
@@ -158,6 +155,7 @@
}
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
diff --git a/utils/stats-tree.h b/utils/stats-tree.h
index c92d4bb..0b13e2c 100644
--- a/utils/stats-tree.h
+++ b/utils/stats-tree.h
@@ -26,15 +26,14 @@
#include "ns3/ndn-name-components.h"
#include "ns3/ptr.h"
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
class StatsTree
{
public:
- typedef trie< ns3::NdnNameComponents,
+ typedef trie< NameComponents,
non_pointer_traits< LoadStatsNode >, void* > tree_type;
StatsTree ();
@@ -43,33 +42,33 @@
Step ();
void
- NewPitEntry (const ns3::NdnNameComponents &key);
+ NewPitEntry (const NameComponents &key);
void
- Incoming (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face);
+ Incoming (const NameComponents &key, Ptr<Face> face);
void
- Outgoing (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face);
+ Outgoing (const NameComponents &key, Ptr<Face> face);
void
- Satisfy (const ns3::NdnNameComponents &key);
+ Satisfy (const NameComponents &key);
void
- Timeout (const ns3::NdnNameComponents &key);
+ Timeout (const NameComponents &key);
void
- Rx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
+ Rx (const NameComponents &key, Ptr<Face> face, uint32_t amount);
void
- Tx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
+ Tx (const NameComponents &key, Ptr<Face> face, uint32_t amount);
// const LoadStatsNode &
- // Get (const ns3::NdnNameComponents &key) const;
+ // Get (const NameComponents &key) const;
const LoadStatsNode &
- operator [] (const ns3::NdnNameComponents &key) const;
+ operator [] (const NameComponents &key) const;
void
- RemoveFace (ns3::Ptr<ns3::NdnFace> face);
+ RemoveFace (Ptr<Face> face);
private:
const LoadStatsNode &
@@ -86,7 +85,8 @@
std::ostream &
operator << (std::ostream &os, const StatsTree &tree);
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
#endif // STATS_TREE_H
diff --git a/utils/trie-with-policy.h b/utils/trie-with-policy.h
index 12168ea..8afa6f8 100644
--- a/utils/trie-with-policy.h
+++ b/utils/trie-with-policy.h
@@ -23,10 +23,9 @@
#include "trie.h"
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
template<typename FullKey,
typename PayloadTraits,
@@ -236,6 +235,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // TRIE_WITH_POLICY_H_
diff --git a/utils/trie.h b/utils/trie.h
index fe52d59..4592fa5 100644
--- a/utils/trie.h
+++ b/utils/trie.h
@@ -32,10 +32,9 @@
#include <boost/foreach.hpp>
#include <boost/mpl/if.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/////////////////////////////////////////////////////
// Allow customization for payload
@@ -642,6 +641,7 @@
} // ndnSIM
+} // ndn
} // ns3
#endif // TRIE_H_
diff --git a/wscript b/wscript
index 70cb770..b741e15 100644
--- a/wscript
+++ b/wscript
@@ -71,22 +71,27 @@
"apps/ndn-app.h",
- "model/ndn.h",
- "model/pit/ndn-pit.h",
- "model/pit/ndn-pit-entry.h",
- "model/pit/ndn-pit-entry-incoming-face.h",
- "model/pit/ndn-pit-entry-outgoing-face.h",
- "model/content-store/ndn-content-store.h",
- "model/fib/ndn-fib.h",
- "model/fib/ndn-fib-entry.h",
- "model/forwarding-strategy/ndn-forwarding-strategy.h",
+ "model/ndn-l3-protocol.h",
"model/ndn-face.h",
"model/ndn-app-face.h",
"model/ndn-net-device-face.h",
"model/ndn-interest-header.h",
"model/ndn-content-object-header.h",
"model/ndn-name-components.h",
- # "model/ndn-name-components-hash-helper.h",
+
+ "model/cs/ndn-content-store.h",
+
+ "model/fib/ndn-fib.h",
+ "model/fib/ndn-fib-entry.h",
+
+ "model/pit/ndn-pit.h",
+ "model/pit/ndn-pit-entry.h",
+ "model/pit/ndn-pit-entry-incoming-face.h",
+ "model/pit/ndn-pit-entry-outgoing-face.h",
+
+
+
+ "model/fw/ndn-forwarding-strategy.h",
"utils/batches.h",
# "utils/weights-path-stretch-tag.h",