First step of refactoring code (ccnx prefix => ndn prefix)
diff --git a/model/forwarding-strategy/best-route.cc b/model/forwarding-strategy/best-route.cc
index 867527f..ba56979 100644
--- a/model/forwarding-strategy/best-route.cc
+++ b/model/forwarding-strategy/best-route.cc
@@ -21,9 +21,9 @@
#include "best-route.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
#include "ns3/assert.h"
#include "ns3/log.h"
@@ -38,7 +38,7 @@
namespace ns3 {
namespace ndnSIM {
-using namespace __ccnx_private;
+using namespace __ndn_private;
NS_OBJECT_ENSURE_REGISTERED (BestRoute);
@@ -46,7 +46,7 @@
BestRoute::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ndnSIM::BestRoute")
- .SetGroupName ("Ccnx")
+ .SetGroupName ("Ndn")
.SetParent <GreenYellowRed> ()
.AddConstructor <BestRoute> ()
;
@@ -58,10 +58,10 @@
}
bool
-BestRoute::DoPropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+BestRoute::DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
NS_LOG_FUNCTION (this);
@@ -73,9 +73,9 @@
int propagatedCount = 0;
- BOOST_FOREACH (const CcnxFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
+ BOOST_FOREACH (const NdnFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
{
- if (metricFace.m_status == CcnxFibFaceMetric::NDN_FIB_RED) // all non-read faces are in front
+ if (metricFace.m_status == NdnFibFaceMetric::NDN_FIB_RED) // all non-read faces are in front
break;
if (metricFace.m_face == incomingFace)
diff --git a/model/forwarding-strategy/best-route.h b/model/forwarding-strategy/best-route.h
index 01c9493..ec86914 100644
--- a/model/forwarding-strategy/best-route.h
+++ b/model/forwarding-strategy/best-route.h
@@ -29,7 +29,7 @@
namespace ndnSIM {
/**
- * \ingroup ccnx
+ * \ingroup ndn
* \brief Best route strategy
*/
class BestRoute :
@@ -44,12 +44,12 @@
*/
BestRoute ();
- // inherited from CcnxForwardingStrategy
+ // inherited from NdnForwardingStrategy
virtual bool
- DoPropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+ DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
private:
typedef GreenYellowRed super;
diff --git a/model/forwarding-strategy/ccnx-forwarding-strategy.h b/model/forwarding-strategy/ccnx-forwarding-strategy.h
deleted file mode 100644
index ff0dcef..0000000
--- a/model/forwarding-strategy/ccnx-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 CCNX_FORWARDING_STRATEGY_H
-#define CCNX_FORWARDING_STRATEGY_H
-
-#include "ns3/packet.h"
-#include "ns3/callback.h"
-#include "ns3/object.h"
-#include "ns3/traced-callback.h"
-
-namespace ns3 {
-
-class CcnxFace;
-class CcnxInterestHeader;
-class CcnxContentObjectHeader;
-class CcnxPit;
-class CcnxPitEntry;
-class CcnxFibFaceMetric;
-class CcnxFib;
-class CcnxContentStore;
-
-/**
- * \ingroup ccnx
- * \brief Abstract base class for CCNx forwarding strategies
- */
-class CcnxForwardingStrategy :
- public Object
-{
-public:
- static TypeId GetTypeId (void);
-
- /**
- * @brief Default constructor
- */
- CcnxForwardingStrategy ();
- virtual ~CcnxForwardingStrategy ();
-
- /**
- * \brief Actual processing of incoming CCNx 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<CcnxFace> &face,
- Ptr<CcnxInterestHeader> &header,
- const Ptr<const Packet> &p);
-
- /**
- * \brief Actual processing of incoming CCNx 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<CcnxFace> &face,
- Ptr<CcnxContentObjectHeader> &header,
- Ptr<Packet> &payload,
- const Ptr<const Packet> &packet);
-
- virtual void
- WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry);
-
- virtual void
- RemoveFace (Ptr<CcnxFace> face);
-
-protected:
- // events
- virtual void
- DidReceiveDuplicateInterest (const Ptr<CcnxFace> &face,
- Ptr<CcnxInterestHeader> &header,
- const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
-
- virtual void
- DidExhaustForwardingOptions (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
-
- virtual void
- FailedToCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
- const Ptr<const Packet> &packet);
-
- virtual void
- DidCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
-
- virtual bool
- DetectRetransmittedInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> 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<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> pitEntry);
-
- // for data received both from network and cache
- virtual void
- SatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace, // 0 allowed (from cache)
- Ptr<const CcnxContentObjectHeader> header,
- Ptr<const Packet> payload,
- const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
-
- virtual void
- DidSendOutData (const Ptr<CcnxFace> &face,
- Ptr<const CcnxContentObjectHeader> header,
- Ptr<const Packet> payload,
- const Ptr<const Packet> &packet);
-
- virtual void
- DidReceiveUnsolicitedData (const Ptr<CcnxFace> &incomingFace,
- Ptr<const CcnxContentObjectHeader> header,
- Ptr<const Packet> payload);
-
- virtual bool
- ShouldSuppressIncomingInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> 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<CcnxFace> &outgoingFace,
- Ptr<CcnxInterestHeader> header,
- Ptr<CcnxPitEntry> pitEntry);
-
- /**
- * @brief Event fired just after sending out an interest
- */
- virtual void
- DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
- Ptr<CcnxInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
-
- virtual void
- PropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> 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 CcnxInterestHeader
- * @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<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry) = 0;
-
-
- // virtual void
- // OnDataDelayed (Ptr<const CcnxContentObjectHeader> 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<CcnxPit> m_pit; ///< \brief Reference to PIT to which this forwarding strategy is associated
- Ptr<CcnxFib> m_fib; ///< \brief FIB
- Ptr<CcnxContentStore> m_contentStore; ///< \brief Content store (for caching purposes only)
-
- bool m_cacheUnsolicitedData;
- bool m_detectRetransmissions;
-
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<const CcnxFace> > m_outInterests; ///< @brief Transmitted interests trace
-
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<const CcnxFace> > m_inInterests; ///< @brief trace of incoming Interests
-
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<const CcnxFace> > m_dropInterests; ///< @brief trace of dropped Interests
-
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
-
- TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
- bool /*from cache*/,
- Ptr<const CcnxFace> > m_outData; ///< @brief trace of outgoing Data
-
- TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
- Ptr<const CcnxFace> > m_inData; ///< @brief trace of incoming Data
-
- TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
- Ptr<const CcnxFace> > m_dropData; ///< @brief trace of dropped Data
-};
-
-} //namespace ns3
-
-#endif /* CCNX_FORWARDING_STRATEGY_H */
diff --git a/model/forwarding-strategy/flooding.cc b/model/forwarding-strategy/flooding.cc
index 176122d..b20854f 100644
--- a/model/forwarding-strategy/flooding.cc
+++ b/model/forwarding-strategy/flooding.cc
@@ -21,9 +21,9 @@
#include "flooding.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
#include "ns3/assert.h"
#include "ns3/log.h"
@@ -41,14 +41,14 @@
namespace ns3 {
namespace ndnSIM {
-using namespace __ccnx_private;
+using namespace __ndn_private;
NS_OBJECT_ENSURE_REGISTERED (Flooding);
TypeId Flooding::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ndnSIM::Flooding")
- .SetGroupName ("Ccnx")
+ .SetGroupName ("Ndn")
.SetParent <Nacks> ()
.AddConstructor <Flooding> ()
;
@@ -60,19 +60,19 @@
}
bool
-Flooding::DoPropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+Flooding::DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
NS_LOG_FUNCTION (this);
int propagatedCount = 0;
- BOOST_FOREACH (const CcnxFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
+ BOOST_FOREACH (const NdnFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
{
NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));
- if (metricFace.m_status == CcnxFibFaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
+ if (metricFace.m_status == NdnFibFaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
if (metricFace.m_face == incomingFace)
diff --git a/model/forwarding-strategy/flooding.h b/model/forwarding-strategy/flooding.h
index 71665c7..32fa7ae 100644
--- a/model/forwarding-strategy/flooding.h
+++ b/model/forwarding-strategy/flooding.h
@@ -28,7 +28,7 @@
namespace ndnSIM {
/**
- * \ingroup ccnx
+ * \ingroup ndn
* \brief Flooding strategy
*
* \todo Describe
@@ -45,12 +45,12 @@
Flooding ();
protected:
- // inherited from Nacks/CcnxForwardingStrategy
+ // inherited from Nacks/NdnForwardingStrategy
virtual bool
- DoPropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+ DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
private:
typedef Nacks super;
diff --git a/model/forwarding-strategy/fw-stats.cc b/model/forwarding-strategy/fw-stats.cc
index 38f03c8..af344e4 100644
--- a/model/forwarding-strategy/fw-stats.cc
+++ b/model/forwarding-strategy/fw-stats.cc
@@ -21,10 +21,10 @@
#include "fw-stats.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
#include "ns3/assert.h"
#include "ns3/log.h"
@@ -47,7 +47,7 @@
FwStats::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ndnSIM::FwStats")
- .SetGroupName ("Ccnx")
+ .SetGroupName ("Ndn")
.SetParent <BestRoute> ()
.AddConstructor <FwStats> ()
@@ -69,8 +69,8 @@
}
void
-FwStats::OnInterest (const Ptr<CcnxFace> &face,
- Ptr<CcnxInterestHeader> &header,
+FwStats::OnInterest (const Ptr<NdnFace> &face,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &packet)
{
super::OnInterest (face, header, packet);
@@ -81,8 +81,8 @@
}
void
-FwStats::OnData (const Ptr<CcnxFace> &face,
- Ptr<CcnxContentObjectHeader> &header,
+FwStats::OnData (const Ptr<NdnFace> &face,
+ Ptr<NdnContentObjectHeader> &header,
Ptr<Packet> &payload,
const Ptr<const Packet> &packet)
{
@@ -95,8 +95,8 @@
void
-FwStats::FailedToCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+FwStats::FailedToCreatePitEntry (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet)
{
super::FailedToCreatePitEntry (incomingFace, header, packet);
@@ -110,10 +110,10 @@
}
void
-FwStats::DidCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+FwStats::DidCreatePitEntry (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
super::DidCreatePitEntry (incomingFace, header, packet, pitEntry);
@@ -124,8 +124,8 @@
}
void
-FwStats::WillSatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> pitEntry)
+FwStats::WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnPitEntry> pitEntry)
{
super::WillSatisfyPendingInterest (incomingFace, pitEntry);
@@ -135,10 +135,10 @@
}
void
-FwStats::DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
- Ptr<CcnxInterestHeader> header,
+FwStats::DidSendOutInterest (const Ptr<NdnFace> &outgoingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
super::DidSendOutInterest (outgoingFace, header, packet, pitEntry);
@@ -149,8 +149,8 @@
}
void
-FwStats::DidSendOutData (const Ptr<CcnxFace> &face,
- Ptr<const CcnxContentObjectHeader> header,
+FwStats::DidSendOutData (const Ptr<NdnFace> &face,
+ Ptr<const NdnContentObjectHeader> header,
Ptr<const Packet> payload,
const Ptr<const Packet> &packet)
{
@@ -163,7 +163,7 @@
void
-FwStats::WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry)
+FwStats::WillErasePendingInterest (Ptr<NdnPitEntry> pitEntry)
{
super::WillErasePendingInterest (pitEntry);
@@ -194,7 +194,7 @@
}
void
-FwStats::RemoveFace (Ptr<CcnxFace> face)
+FwStats::RemoveFace (Ptr<NdnFace> face)
{
m_stats.RemoveFace (face);
diff --git a/model/forwarding-strategy/fw-stats.h b/model/forwarding-strategy/fw-stats.h
index 69149f3..1d7140f 100644
--- a/model/forwarding-strategy/fw-stats.h
+++ b/model/forwarding-strategy/fw-stats.h
@@ -31,7 +31,7 @@
namespace ndnSIM {
/**
- * \ingroup ccnx
+ * \ingroup ndn
* \brief Strategy based on best route and adding statistics gathering capabilities
*/
class FwStats :
@@ -51,49 +51,49 @@
GetStatsTree () const;
virtual void
- OnInterest (const Ptr<CcnxFace> &face,
- Ptr<CcnxInterestHeader> &header,
+ OnInterest (const Ptr<NdnFace> &face,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &p);
virtual void
- OnData (const Ptr<CcnxFace> &face,
- Ptr<CcnxContentObjectHeader> &header,
+ OnData (const Ptr<NdnFace> &face,
+ Ptr<NdnContentObjectHeader> &header,
Ptr<Packet> &payload,
const Ptr<const Packet> &packet);
virtual void
- RemoveFace (Ptr<CcnxFace> face);
+ RemoveFace (Ptr<NdnFace> face);
protected:
virtual void
- DidCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+ DidCreatePitEntry (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
virtual void
- FailedToCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+ FailedToCreatePitEntry (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet);
virtual void
- WillSatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> pitEntry);
+ WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnPitEntry> pitEntry);
virtual void
- DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
- Ptr<CcnxInterestHeader> header,
+ DidSendOutInterest (const Ptr<NdnFace> &outgoingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
virtual void
- DidSendOutData (const Ptr<CcnxFace> &face,
- Ptr<const CcnxContentObjectHeader> header,
+ DidSendOutData (const Ptr<NdnFace> &face,
+ Ptr<const NdnContentObjectHeader> header,
Ptr<const Packet> payload,
const Ptr<const Packet> &packet);
virtual void
- WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry);
+ WillErasePendingInterest (Ptr<NdnPitEntry> pitEntry);
// from Object
void
@@ -110,7 +110,7 @@
::ndnSIM::StatsTree m_stats;
EventId m_statsRefreshEvent;
- TracedCallback< Ptr<CcnxForwardingStrategy>,
+ TracedCallback< Ptr<NdnForwardingStrategy>,
const ::ndnSIM::StatsTree & > m_statsTrace;
typedef BestRoute super;
diff --git a/model/forwarding-strategy/green-yellow-red.cc b/model/forwarding-strategy/green-yellow-red.cc
index c00e6d8..5d497a6 100644
--- a/model/forwarding-strategy/green-yellow-red.cc
+++ b/model/forwarding-strategy/green-yellow-red.cc
@@ -21,13 +21,13 @@
#include "green-yellow-red.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-pit-entry.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-fib.h"
-#include "ns3/ccnx-content-store.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-fib.h"
+#include "ns3/ndn-content-store.h"
#include "ns3/assert.h"
#include "ns3/ptr.h"
@@ -47,7 +47,7 @@
namespace ns3 {
-using namespace __ccnx_private;
+using namespace __ndn_private;
namespace ndnSIM {
@@ -57,7 +57,7 @@
GreenYellowRed::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ndnSIM::GreenYellowRed")
- .SetGroupName ("Ccnx")
+ .SetGroupName ("Ndn")
.SetParent<Nacks> ()
;
@@ -65,20 +65,20 @@
}
bool
-GreenYellowRed::DoPropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+GreenYellowRed::DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
NS_LOG_FUNCTION (this);
NS_ASSERT_MSG (m_pit != 0, "PIT should be aggregated with forwarding strategy");
int propagatedCount = 0;
- BOOST_FOREACH (const CcnxFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
+ BOOST_FOREACH (const NdnFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
{
- if (metricFace.m_status == CcnxFibFaceMetric::NDN_FIB_RED ||
- metricFace.m_status == CcnxFibFaceMetric::NDN_FIB_YELLOW)
+ if (metricFace.m_status == NdnFibFaceMetric::NDN_FIB_RED ||
+ metricFace.m_status == NdnFibFaceMetric::NDN_FIB_YELLOW)
break; //propagate only to green faces
if (pitEntry->GetIncoming ().find (metricFace.m_face) != pitEntry->GetIncoming ().end ())
@@ -103,29 +103,29 @@
}
void
-GreenYellowRed::WillSatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> pitEntry)
+GreenYellowRed::WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnPitEntry> pitEntry)
{
if (incomingFace != 0)
{
// Update metric status for the incoming interface in the corresponding FIB entry
- pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN);
+ pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_GREEN);
}
super::WillSatisfyPendingInterest (incomingFace, pitEntry);
}
void
-GreenYellowRed::DidReceiveValidNack (const Ptr<CcnxFace> &incomingFace,
+GreenYellowRed::DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
uint32_t nackCode,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
super::DidReceiveValidNack (incomingFace, nackCode, pitEntry);
if (incomingFace != 0 &&
- nackCode != CcnxInterestHeader::NACK_LOOP)
+ nackCode != NdnInterestHeader::NACK_LOOP)
{
- pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW);
+ pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW);
}
}
diff --git a/model/forwarding-strategy/green-yellow-red.h b/model/forwarding-strategy/green-yellow-red.h
index 71002b9..67263ee 100644
--- a/model/forwarding-strategy/green-yellow-red.h
+++ b/model/forwarding-strategy/green-yellow-red.h
@@ -27,7 +27,7 @@
namespace ndnSIM {
/**
- * \ingroup ccnx
+ * \ingroup ndn
*/
class GreenYellowRed :
public Nacks
@@ -37,18 +37,18 @@
protected:
virtual void
- WillSatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> pitEntry);
+ WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnPitEntry> pitEntry);
virtual bool
- DoPropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+ DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
virtual void
- DidReceiveValidNack (const Ptr<CcnxFace> &incomingFace,
+ DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
uint32_t nackCode,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
private:
typedef Nacks super;
diff --git a/model/forwarding-strategy/nacks.cc b/model/forwarding-strategy/nacks.cc
index b0a193e..4cc8287 100644
--- a/model/forwarding-strategy/nacks.cc
+++ b/model/forwarding-strategy/nacks.cc
@@ -20,13 +20,13 @@
#include "nacks.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-pit-entry.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-fib.h"
-#include "ns3/ccnx-content-store.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-fib.h"
+#include "ns3/ndn-content-store.h"
#include "ns3/assert.h"
#include "ns3/ptr.h"
@@ -53,8 +53,8 @@
Nacks::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ndnSIM::Nacks")
- .SetGroupName ("Ccnx")
- .SetParent<CcnxForwardingStrategy> ()
+ .SetGroupName ("Ndn")
+ .SetParent<NdnForwardingStrategy> ()
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
@@ -72,8 +72,8 @@
}
void
-Nacks::OnInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> &header,
+Nacks::OnInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &packet)
{
if (header->GetNack () > 0)
@@ -83,8 +83,8 @@
}
void
-Nacks::OnNack (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> &header,
+Nacks::OnNack (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &packet)
{
NS_ASSERT (m_nacksEnabled);
@@ -92,7 +92,7 @@
// NS_LOG_FUNCTION (incomingFace << header << packet);
m_inNacks (header, incomingFace);
- Ptr<CcnxPitEntry> pitEntry = m_pit->Lookup (*header);
+ Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
if (pitEntry == 0)
{
// somebody is doing something bad
@@ -119,7 +119,7 @@
}
Ptr<Packet> nonNackInterest = Create<Packet> ();
- header->SetNack (CcnxInterestHeader::NORMAL_INTEREST);
+ header->SetNack (NdnInterestHeader::NORMAL_INTEREST);
nonNackInterest->AddHeader (*header);
bool propagated = DoPropagateInterest (incomingFace, header, nonNackInterest, pitEntry);
@@ -130,17 +130,17 @@
}
void
-Nacks::DidReceiveDuplicateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> &header,
+Nacks::DidReceiveDuplicateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
super::DidReceiveDuplicateInterest (incomingFace, header, packet, pitEntry);
if (m_nacksEnabled)
{
NS_LOG_DEBUG ("Sending NACK_LOOP");
- header->SetNack (CcnxInterestHeader::NACK_LOOP);
+ header->SetNack (NdnInterestHeader::NACK_LOOP);
Ptr<Packet> nack = Create<Packet> ();
nack->AddHeader (*header);
@@ -150,20 +150,20 @@
}
void
-Nacks::DidExhaustForwardingOptions (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+Nacks::DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
super::DidExhaustForwardingOptions (incomingFace, header, packet, pitEntry);
if (m_nacksEnabled)
{
Ptr<Packet> packet = Create<Packet> ();
- header->SetNack (CcnxInterestHeader::NACK_GIVEUP_PIT);
+ header->SetNack (NdnInterestHeader::NACK_GIVEUP_PIT);
packet->AddHeader (*header);
- BOOST_FOREACH (const CcnxPitEntryIncomingFace &incoming, pitEntry->GetIncoming ())
+ 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 ());
@@ -183,18 +183,18 @@
}
void
-Nacks::DidReceiveValidNack (const Ptr<CcnxFace> &incomingFace,
+Nacks::DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
uint32_t nackCode,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> 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 == CcnxInterestHeader::NACK_GIVEUP_PIT)
+ if (nackCode == NdnInterestHeader::NACK_GIVEUP_PIT)
{
pitEntry->RemoveIncoming (incomingFace);
}
- pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW);
+ pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW);
}
} // namespace ndnSIM
diff --git a/model/forwarding-strategy/nacks.h b/model/forwarding-strategy/nacks.h
index 81e478c..074f5ab 100644
--- a/model/forwarding-strategy/nacks.h
+++ b/model/forwarding-strategy/nacks.h
@@ -20,25 +20,25 @@
#ifndef NDNSIM_NACKS_H
#define NDNSIM_NACKS_H
-#include "ns3/ccnx-forwarding-strategy.h"
+#include "ns3/ndn-forwarding-strategy.h"
namespace ns3 {
namespace ndnSIM {
/**
- * \ingroup ccnx
- * \brief Abstract base class for CCNx forwarding strategies
+ * \ingroup ndn
+ * \brief Abstract base class for Ndn forwarding strategies
*/
class Nacks :
- public CcnxForwardingStrategy
+ public NdnForwardingStrategy
{
public:
static TypeId
GetTypeId (void);
/**
- * \brief Actual processing of incoming CCNx interests. Note, interests do not have payload
+ * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
*
* Processing Interest packets
* @param face incoming face
@@ -46,49 +46,49 @@
* @param packet original packet
*/
virtual void
- OnInterest (const Ptr<CcnxFace> &face,
- Ptr<CcnxInterestHeader> &header,
+ OnInterest (const Ptr<NdnFace> &face,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &p);
protected:
- // using CcnxForwardingStrategy::PropagateInterest; // some strange c++ cheating
+ // using NdnForwardingStrategy::PropagateInterest; // some strange c++ cheating
virtual void
- DidReceiveDuplicateInterest (const Ptr<CcnxFace> &face,
- Ptr<CcnxInterestHeader> &header,
+ DidReceiveDuplicateInterest (const Ptr<NdnFace> &face,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
virtual void
- DidExhaustForwardingOptions (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+ DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
virtual void
- OnNack (const Ptr<CcnxFace> &face,
- Ptr<CcnxInterestHeader> &header,
+ OnNack (const Ptr<NdnFace> &face,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &p);
virtual void
- DidReceiveValidNack (const Ptr<CcnxFace> &incomingFace,
+ DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
uint32_t nackCode,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
protected:
bool m_nacksEnabled;
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<const CcnxFace> > m_outNacks; ///< @brief trace of outgoing NACKs
+ TracedCallback<Ptr<const NdnInterestHeader>,
+ Ptr<const NdnFace> > m_outNacks; ///< @brief trace of outgoing NACKs
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<const CcnxFace> > m_inNacks; ///< @brief trace of incoming NACKs
+ TracedCallback<Ptr<const NdnInterestHeader>,
+ Ptr<const NdnFace> > m_inNacks; ///< @brief trace of incoming NACKs
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<const CcnxFace> > m_dropNacks; ///< @brief trace of dropped NACKs
+ TracedCallback<Ptr<const NdnInterestHeader>,
+ Ptr<const NdnFace> > m_dropNacks; ///< @brief trace of dropped NACKs
private:
- typedef CcnxForwardingStrategy super;
+ typedef NdnForwardingStrategy super;
};
} // namespace ndnSIM
diff --git a/model/forwarding-strategy/ccnx-forwarding-strategy.cc b/model/forwarding-strategy/ndn-forwarding-strategy.cc
similarity index 70%
rename from model/forwarding-strategy/ccnx-forwarding-strategy.cc
rename to model/forwarding-strategy/ndn-forwarding-strategy.cc
index ddc4e51..dedd60f 100644
--- a/model/forwarding-strategy/ccnx-forwarding-strategy.cc
+++ b/model/forwarding-strategy/ndn-forwarding-strategy.cc
@@ -19,16 +19,16 @@
* Ilya Moiseenko <iliamo@cs.ucla.edu>
*/
-#include "ccnx-forwarding-strategy.h"
+#include "ndn-forwarding-strategy.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-pit-entry.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-fib.h"
-#include "ns3/ccnx-content-store.h"
-#include "ns3/ccnx-face.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-fib.h"
+#include "ns3/ndn-content-store.h"
+#include "ns3/ndn-face.h"
#include "ns3/assert.h"
#include "ns3/ptr.h"
@@ -44,77 +44,77 @@
#include <boost/tuple/tuple.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("CcnxForwardingStrategy");
+NS_LOG_COMPONENT_DEFINE ("NdnForwardingStrategy");
namespace ns3 {
-using namespace __ccnx_private;
+using namespace __ndn_private;
-NS_OBJECT_ENSURE_REGISTERED (CcnxForwardingStrategy);
+NS_OBJECT_ENSURE_REGISTERED (NdnForwardingStrategy);
-TypeId CcnxForwardingStrategy::GetTypeId (void)
+TypeId NdnForwardingStrategy::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::CcnxForwardingStrategy")
- .SetGroupName ("Ccnx")
+ static TypeId tid = TypeId ("ns3::NdnForwardingStrategy")
+ .SetGroupName ("Ndn")
.SetParent<Object> ()
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
- .AddTraceSource ("OutInterests", "OutInterests", MakeTraceSourceAccessor (&CcnxForwardingStrategy::m_outInterests))
- .AddTraceSource ("InInterests", "InInterests", MakeTraceSourceAccessor (&CcnxForwardingStrategy::m_inInterests))
- .AddTraceSource ("DropInterests", "DropInterests", MakeTraceSourceAccessor (&CcnxForwardingStrategy::m_dropInterests))
+ .AddTraceSource ("OutInterests", "OutInterests", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_outInterests))
+ .AddTraceSource ("InInterests", "InInterests", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_inInterests))
+ .AddTraceSource ("DropInterests", "DropInterests", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_dropInterests))
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
- .AddTraceSource ("OutData", "OutData", MakeTraceSourceAccessor (&CcnxForwardingStrategy::m_outData))
- .AddTraceSource ("InData", "InData", MakeTraceSourceAccessor (&CcnxForwardingStrategy::m_inData))
- .AddTraceSource ("DropData", "DropData", MakeTraceSourceAccessor (&CcnxForwardingStrategy::m_dropData))
+ .AddTraceSource ("OutData", "OutData", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_outData))
+ .AddTraceSource ("InData", "InData", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_inData))
+ .AddTraceSource ("DropData", "DropData", MakeTraceSourceAccessor (&NdnForwardingStrategy::m_dropData))
.AddAttribute ("CacheUnsolicitedData", "Cache overheard data that have not been requested",
BooleanValue (false),
- MakeBooleanAccessor (&CcnxForwardingStrategy::m_cacheUnsolicitedData),
+ MakeBooleanAccessor (&NdnForwardingStrategy::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 (&CcnxForwardingStrategy::m_detectRetransmissions),
+ MakeBooleanAccessor (&NdnForwardingStrategy::m_detectRetransmissions),
MakeBooleanChecker ())
;
return tid;
}
-CcnxForwardingStrategy::CcnxForwardingStrategy ()
+NdnForwardingStrategy::NdnForwardingStrategy ()
{
}
-CcnxForwardingStrategy::~CcnxForwardingStrategy ()
+NdnForwardingStrategy::~NdnForwardingStrategy ()
{
}
void
-CcnxForwardingStrategy::NotifyNewAggregate ()
+NdnForwardingStrategy::NotifyNewAggregate ()
{
if (m_pit == 0)
{
- m_pit = GetObject<CcnxPit> ();
+ m_pit = GetObject<NdnPit> ();
}
if (m_fib == 0)
{
- m_fib = GetObject<CcnxFib> ();
+ m_fib = GetObject<NdnFib> ();
}
if (m_contentStore == 0)
{
- m_contentStore = GetObject<CcnxContentStore> ();
+ m_contentStore = GetObject<NdnContentStore> ();
}
Object::NotifyNewAggregate ();
}
void
-CcnxForwardingStrategy::DoDispose ()
+NdnForwardingStrategy::DoDispose ()
{
m_pit = 0;
m_contentStore = 0;
@@ -124,13 +124,13 @@
}
void
-CcnxForwardingStrategy::OnInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> &header,
+NdnForwardingStrategy::OnInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &packet)
{
m_inInterests (header, incomingFace);
- Ptr<CcnxPitEntry> pitEntry = m_pit->Lookup (*header);
+ Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
if (pitEntry == 0)
{
pitEntry = m_pit->Create (header);
@@ -159,7 +159,7 @@
}
Ptr<Packet> contentObject;
- Ptr<const CcnxContentObjectHeader> contentObjectHeader; // used for tracing
+ Ptr<const NdnContentObjectHeader> 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 +192,8 @@
}
void
-CcnxForwardingStrategy::OnData (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxContentObjectHeader> &header,
+NdnForwardingStrategy::OnData (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnContentObjectHeader> &header,
Ptr<Packet> &payload,
const Ptr<const Packet> &packet)
{
@@ -201,7 +201,7 @@
m_inData (header, payload, incomingFace);
// Lookup PIT entry
- Ptr<CcnxPitEntry> pitEntry = m_pit->Lookup (*header);
+ Ptr<NdnPitEntry> pitEntry = m_pit->Lookup (*header);
if (pitEntry == 0)
{
DidReceiveUnsolicitedData (incomingFace, header, payload);
@@ -228,10 +228,10 @@
void
-CcnxForwardingStrategy::DidReceiveDuplicateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> &header,
+NdnForwardingStrategy::DidReceiveDuplicateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> &header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
NS_LOG_FUNCTION (this << boost::cref (*incomingFace));
/////////////////////////////////////////////////////////////////////////////////////////
@@ -244,18 +244,18 @@
}
void
-CcnxForwardingStrategy::DidExhaustForwardingOptions (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+NdnForwardingStrategy::DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
NS_LOG_FUNCTION (this << boost::cref (*incomingFace));
m_dropInterests (header, incomingFace);
}
void
-CcnxForwardingStrategy::FailedToCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+NdnForwardingStrategy::FailedToCreatePitEntry (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet)
{
NS_LOG_FUNCTION (this);
@@ -263,18 +263,18 @@
}
void
-CcnxForwardingStrategy::DidCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+NdnForwardingStrategy::DidCreatePitEntry (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntrypitEntry)
+ Ptr<NdnPitEntry> pitEntrypitEntry)
{
}
bool
-CcnxForwardingStrategy::DetectRetransmittedInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> pitEntry)
+NdnForwardingStrategy::DetectRetransmittedInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnPitEntry> pitEntry)
{
- CcnxPitEntry::in_iterator inFace = pitEntry->GetIncoming ().find (incomingFace);
+ NdnPitEntry::in_iterator inFace = pitEntry->GetIncoming ().find (incomingFace);
bool isRetransmitted = false;
@@ -288,17 +288,17 @@
}
void
-CcnxForwardingStrategy::SatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<const CcnxContentObjectHeader> header,
+NdnForwardingStrategy::SatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<const NdnContentObjectHeader> header,
Ptr<const Packet> payload,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
if (incomingFace != 0)
pitEntry->RemoveIncoming (incomingFace);
//satisfy all pending incoming Interests
- BOOST_FOREACH (const CcnxPitEntryIncomingFace &incoming, pitEntry->GetIncoming ())
+ BOOST_FOREACH (const NdnPitEntryIncomingFace &incoming, pitEntry->GetIncoming ())
{
bool ok = incoming.m_face->Send (packet->Copy ());
if (ok)
@@ -328,8 +328,8 @@
}
void
-CcnxForwardingStrategy::DidReceiveUnsolicitedData (const Ptr<CcnxFace> &incomingFace,
- Ptr<const CcnxContentObjectHeader> header,
+NdnForwardingStrategy::DidReceiveUnsolicitedData (const Ptr<NdnFace> &incomingFace,
+ Ptr<const NdnContentObjectHeader> header,
Ptr<const Packet> payload)
{
if (m_cacheUnsolicitedData)
@@ -348,10 +348,10 @@
}
void
-CcnxForwardingStrategy::WillSatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> pitEntry)
+NdnForwardingStrategy::WillSatisfyPendingInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnPitEntry> pitEntry)
{
- CcnxPitEntry::out_iterator out = pitEntry->GetOutgoing ().find (incomingFace);
+ 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 ())
@@ -361,8 +361,8 @@
}
bool
-CcnxForwardingStrategy::ShouldSuppressIncomingInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxPitEntry> pitEntry)
+NdnForwardingStrategy::ShouldSuppressIncomingInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnPitEntry> pitEntry)
{
bool isNew = pitEntry->GetIncoming ().size () == 0 && pitEntry->GetOutgoing ().size () == 0;
@@ -382,7 +382,7 @@
// ?? not sure if we need to do that ?? ...
- // pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW);
+ // pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, NdnFibFaceMetric::NDN_FIB_YELLOW);
}
else
if (!isNew && !isRetransmitted)
@@ -394,10 +394,10 @@
}
void
-CcnxForwardingStrategy::PropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+NdnForwardingStrategy::PropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
bool isRetransmitted = m_detectRetransmissions && // a small guard
DetectRetransmittedInterest (incomingFace, pitEntry);
@@ -427,11 +427,11 @@
}
bool
-CcnxForwardingStrategy::WillSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
- Ptr<CcnxInterestHeader> header,
- Ptr<CcnxPitEntry> pitEntry)
+NdnForwardingStrategy::WillSendOutInterest (const Ptr<NdnFace> &outgoingFace,
+ Ptr<NdnInterestHeader> header,
+ Ptr<NdnPitEntry> pitEntry)
{
- CcnxPitEntryOutgoingFaceContainer::type::iterator outgoing =
+ NdnPitEntryOutgoingFaceContainer::type::iterator outgoing =
pitEntry->GetOutgoing ().find (outgoingFace);
if (outgoing != pitEntry->GetOutgoing ().end () &&
@@ -451,31 +451,31 @@
}
void
-CcnxForwardingStrategy::DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
- Ptr<CcnxInterestHeader> header,
+NdnForwardingStrategy::DidSendOutInterest (const Ptr<NdnFace> &outgoingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
m_outInterests (header, outgoingFace);
}
void
-CcnxForwardingStrategy::DidSendOutData (const Ptr<CcnxFace> &face,
- Ptr<const CcnxContentObjectHeader> header,
+NdnForwardingStrategy::DidSendOutData (const Ptr<NdnFace> &face,
+ Ptr<const NdnContentObjectHeader> header,
Ptr<const Packet> payload,
const Ptr<const Packet> &packet)
{
}
void
-CcnxForwardingStrategy::WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry)
+NdnForwardingStrategy::WillErasePendingInterest (Ptr<NdnPitEntry> pitEntry)
{
// do nothing for now. may be need to do some logging
}
void
-CcnxForwardingStrategy::RemoveFace (Ptr<CcnxFace> face)
+NdnForwardingStrategy::RemoveFace (Ptr<NdnFace> face)
{
// do nothing here
}
diff --git a/model/forwarding-strategy/ndn-forwarding-strategy.h b/model/forwarding-strategy/ndn-forwarding-strategy.h
new file mode 100644
index 0000000..c2fa296
--- /dev/null
+++ b/model/forwarding-strategy/ndn-forwarding-strategy.h
@@ -0,0 +1,235 @@
+/* -*- 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/smart-flooding.cc b/model/forwarding-strategy/smart-flooding.cc
index a7d0167..58a56a2 100644
--- a/model/forwarding-strategy/smart-flooding.cc
+++ b/model/forwarding-strategy/smart-flooding.cc
@@ -20,9 +20,9 @@
#include "smart-flooding.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-pit.h"
-#include "ns3/ccnx-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
#include "ns3/assert.h"
#include "ns3/log.h"
@@ -39,7 +39,7 @@
namespace ns3 {
-using namespace __ccnx_private;
+using namespace __ndn_private;
namespace ndnSIM {
@@ -49,7 +49,7 @@
SmartFlooding::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ndnSIM::SmartFloodingy")
- .SetGroupName ("Ccnx")
+ .SetGroupName ("Ndn")
.SetParent <GreenYellowRed> ()
.AddConstructor <SmartFlooding> ()
;
@@ -61,10 +61,10 @@
}
bool
-SmartFlooding::DoPropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+SmartFlooding::DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry)
+ Ptr<NdnPitEntry> pitEntry)
{
NS_LOG_FUNCTION (this);
@@ -75,10 +75,10 @@
int propagatedCount = 0;
- BOOST_FOREACH (const CcnxFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
+ BOOST_FOREACH (const NdnFibFaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<i_metric> ())
{
NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));
- if (metricFace.m_status == CcnxFibFaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
+ if (metricFace.m_status == NdnFibFaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
if (metricFace.m_face == incomingFace)
diff --git a/model/forwarding-strategy/smart-flooding.h b/model/forwarding-strategy/smart-flooding.h
index 840ce6a..c939015 100644
--- a/model/forwarding-strategy/smart-flooding.h
+++ b/model/forwarding-strategy/smart-flooding.h
@@ -42,10 +42,10 @@
// inherited
virtual bool
- DoPropagateInterest (const Ptr<CcnxFace> &incomingFace,
- Ptr<CcnxInterestHeader> header,
+ DoPropagateInterest (const Ptr<NdnFace> &incomingFace,
+ Ptr<NdnInterestHeader> header,
const Ptr<const Packet> &packet,
- Ptr<CcnxPitEntry> pitEntry);
+ Ptr<NdnPitEntry> pitEntry);
private:
typedef GreenYellowRed super;