First step of refactoring code (ccnx prefix => ndn prefix)
diff --git a/model/fib/ccnx-fib-entry.cc b/model/fib/ndn-fib-entry.cc
similarity index 66%
rename from model/fib/ccnx-fib-entry.cc
rename to model/fib/ndn-fib-entry.cc
index c0c575a..965886f 100644
--- a/model/fib/ccnx-fib-entry.cc
+++ b/model/fib/ndn-fib-entry.cc
@@ -18,9 +18,9 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnx-fib-entry.h"
+#include "ndn-fib-entry.h"
-#include "ns3/ccnx-name-components.h"
+#include "ns3/ndn-name-components.h"
#include "ns3/log.h"
#define NDN_RTO_ALPHA 0.125
@@ -32,7 +32,7 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("CcnxFibEntry");
+NS_LOG_COMPONENT_DEFINE ("NdnFibEntry");
namespace ns3
{
@@ -40,11 +40,11 @@
//////////////////////////////////////////////////////////////////////
// Helpers
//////////////////////////////////////////////////////////////////////
-namespace __ccnx_private {
+namespace __ndn_private {
-struct CcnxFibFaceMetricByFace
+struct NdnFibFaceMetricByFace
{
- typedef CcnxFibFaceMetricContainer::type::index<i_face>::type
+ typedef NdnFibFaceMetricContainer::type::index<i_face>::type
type;
};
@@ -52,10 +52,10 @@
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
-using namespace __ccnx_private;
+using namespace __ndn_private;
void
-CcnxFibFaceMetric::UpdateRtt (const Time &rttSample)
+NdnFibFaceMetric::UpdateRtt (const Time &rttSample)
{
// const Time & this->m_rttSample
@@ -78,56 +78,56 @@
/////////////////////////////////////////////////////////////////////
void
-CcnxFibEntry::UpdateFaceRtt (Ptr<CcnxFace> face, const Time &sample)
+NdnFibEntry::UpdateFaceRtt (Ptr<NdnFace> face, const Time &sample)
{
- CcnxFibFaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
+ NdnFibFaceMetricByFace::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 (&CcnxFibFaceMetric::UpdateRtt, ll::_1, sample));
+ ll::bind (&NdnFibFaceMetric::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
-CcnxFibEntry::UpdateStatus (Ptr<CcnxFace> face, CcnxFibFaceMetric::Status status)
+NdnFibEntry::UpdateStatus (Ptr<NdnFace> face, NdnFibFaceMetric::Status status)
{
NS_LOG_FUNCTION (this << boost::cref(*face) << status);
- CcnxFibFaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
+ NdnFibFaceMetricByFace::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)->*&CcnxFibFaceMetric::m_status = status);
+ (&ll::_1)->*&NdnFibFaceMetric::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
-CcnxFibEntry::AddOrUpdateRoutingMetric (Ptr<CcnxFace> face, int32_t metric)
+NdnFibEntry::AddOrUpdateRoutingMetric (Ptr<NdnFace> face, int32_t metric)
{
NS_LOG_FUNCTION (this);
NS_ASSERT_MSG (face != NULL, "Trying to Add or Update NULL face");
- CcnxFibFaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
+ NdnFibFaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
if (record == m_faces.get<i_face> ().end ())
{
- m_faces.insert (CcnxFibFaceMetric (face, metric));
+ m_faces.insert (NdnFibFaceMetric (face, metric));
}
else
{
// don't update metric to higher value
- if (record->m_routingCost > metric || record->m_status == CcnxFibFaceMetric::NDN_FIB_RED)
+ if (record->m_routingCost > metric || record->m_status == NdnFibFaceMetric::NDN_FIB_RED)
{
m_faces.modify (record,
- (&ll::_1)->*&CcnxFibFaceMetric::m_routingCost = metric);
+ (&ll::_1)->*&NdnFibFaceMetric::m_routingCost = metric);
m_faces.modify (record,
- (&ll::_1)->*&CcnxFibFaceMetric::m_status = CcnxFibFaceMetric::NDN_FIB_YELLOW);
+ (&ll::_1)->*&NdnFibFaceMetric::m_status = NdnFibFaceMetric::NDN_FIB_YELLOW);
}
}
@@ -136,31 +136,31 @@
}
void
-CcnxFibEntry::Invalidate ()
+NdnFibEntry::Invalidate ()
{
- for (CcnxFibFaceMetricByFace::type::iterator face = m_faces.begin ();
+ for (NdnFibFaceMetricByFace::type::iterator face = m_faces.begin ();
face != m_faces.end ();
face++)
{
m_faces.modify (face,
- (&ll::_1)->*&CcnxFibFaceMetric::m_routingCost = std::numeric_limits<uint16_t>::max ());
+ (&ll::_1)->*&NdnFibFaceMetric::m_routingCost = std::numeric_limits<uint16_t>::max ());
m_faces.modify (face,
- (&ll::_1)->*&CcnxFibFaceMetric::m_status = CcnxFibFaceMetric::NDN_FIB_RED);
+ (&ll::_1)->*&NdnFibFaceMetric::m_status = NdnFibFaceMetric::NDN_FIB_RED);
}
}
-const CcnxFibFaceMetric &
-CcnxFibEntry::FindBestCandidate (uint32_t skip/* = 0*/) const
+const NdnFibFaceMetric &
+NdnFibEntry::FindBestCandidate (uint32_t skip/* = 0*/) const
{
- if (m_faces.size () == 0) throw CcnxFibEntry::NoFaces ();
+ if (m_faces.size () == 0) throw NdnFibEntry::NoFaces ();
skip = skip % m_faces.size();
return m_faces.get<i_nth> () [skip];
}
-std::ostream& operator<< (std::ostream& os, const CcnxFibEntry &entry)
+std::ostream& operator<< (std::ostream& os, const NdnFibEntry &entry)
{
- for (CcnxFibFaceMetricContainer::type::index<i_nth>::type::iterator metric =
+ for (NdnFibFaceMetricContainer::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 +173,7 @@
return os;
}
-std::ostream& operator<< (std::ostream& os, const CcnxFibFaceMetric &metric)
+std::ostream& operator<< (std::ostream& os, const NdnFibFaceMetric &metric)
{
static const std::string statusString[] = {"","g","y","r"};
diff --git a/model/fib/ccnx-fib-entry.h b/model/fib/ndn-fib-entry.h
similarity index 67%
rename from model/fib/ccnx-fib-entry.h
rename to model/fib/ndn-fib-entry.h
index 9aa75cb..cf8cbe6 100644
--- a/model/fib/ccnx-fib-entry.h
+++ b/model/fib/ndn-fib-entry.h
@@ -18,13 +18,13 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef _CCNX_FIB_ENTRY_H_
-#define _CCNX_FIB_ENTRY_H_
+#ifndef _NDN_FIB_ENTRY_H_
+#define _NDN_FIB_ENTRY_H_
#include "ns3/ptr.h"
#include "ns3/nstime.h"
-#include "ns3/ccnx.h"
-#include "ns3/ccnx-face.h"
+#include "ns3/ndn.h"
+#include "ns3/ndn-face.h"
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/tag.hpp>
@@ -38,13 +38,13 @@
namespace ns3
{
-class CcnxNameComponents;
+class NdnNameComponents;
/**
- * \ingroup ccnx
+ * \ingroup ndn
* \brief Structure holding various parameters associated with a (FibEntry, Face) tuple
*/
-class CcnxFibFaceMetric
+class NdnFibFaceMetric
{
public:
/**
@@ -60,7 +60,7 @@
* \param face Face for which metric
* \param cost Initial value for routing cost
*/
- CcnxFibFaceMetric (Ptr<CcnxFace> face, int32_t cost)
+ NdnFibFaceMetric (Ptr<NdnFace> face, int32_t cost)
: m_face (face)
, m_status (NDN_FIB_YELLOW)
, m_routingCost (cost)
@@ -72,18 +72,18 @@
* \brief Comparison operator used by boost::multi_index::identity<>
*/
bool
- operator< (const CcnxFibFaceMetric &fm) const { return *m_face < *fm.m_face; } // return identity of the face
+ operator< (const NdnFibFaceMetric &fm) const { return *m_face < *fm.m_face; } // return identity of the face
/**
- * @brief Comparison between CcnxFibFaceMetric and CcnxFace
+ * @brief Comparison between NdnFibFaceMetric and NdnFace
*/
bool
- operator< (const Ptr<CcnxFace> &face) const { return *m_face < *face; }
+ operator< (const Ptr<NdnFace> &face) const { return *m_face < *face; }
/**
- * @brief Return CcnxFace associated with CcnxFibFaceMetric
+ * @brief Return NdnFace associated with NdnFibFaceMetric
*/
- Ptr<CcnxFace>
+ Ptr<NdnFace>
GetFace () const { return m_face; }
/**
@@ -94,9 +94,9 @@
UpdateRtt (const Time &rttSample);
private:
- friend std::ostream& operator<< (std::ostream& os, const CcnxFibFaceMetric &metric);
+ friend std::ostream& operator<< (std::ostream& os, const NdnFibFaceMetric &metric);
public:
- Ptr<CcnxFace> m_face; ///< Face
+ Ptr<NdnFace> m_face; ///< Face
Status m_status; ///< \brief Status of the next hop:
///< - NDN_FIB_GREEN
@@ -110,8 +110,8 @@
};
/**
- * \ingroup ccnx
- * \brief Typedef for indexed face container of CcnxFibEntry
+ * \ingroup ndn
+ * \brief Typedef for indexed face container of NdnFibEntry
*
* Currently, there are 2 indexes:
* - by face (used to find record and update metric)
@@ -119,31 +119,31 @@
* - random access index (for fast lookup on nth face). Order is
* maintained manually to be equal to the 'by metric' order
*/
-struct CcnxFibFaceMetricContainer
+struct NdnFibFaceMetricContainer
{
/// @cond include_hidden
typedef boost::multi_index::multi_index_container<
- CcnxFibFaceMetric,
+ NdnFibFaceMetric,
boost::multi_index::indexed_by<
- // For fast access to elements using CcnxFace
+ // For fast access to elements using NdnFace
boost::multi_index::ordered_unique<
- boost::multi_index::tag<__ccnx_private::i_face>,
- boost::multi_index::member<CcnxFibFaceMetric,Ptr<CcnxFace>,&CcnxFibFaceMetric::m_face>
+ boost::multi_index::tag<__ndn_private::i_face>,
+ boost::multi_index::member<NdnFibFaceMetric,Ptr<NdnFace>,&NdnFibFaceMetric::m_face>
>,
// List of available faces ordered by (status, m_routingCost)
boost::multi_index::ordered_non_unique<
- boost::multi_index::tag<__ccnx_private::i_metric>,
+ boost::multi_index::tag<__ndn_private::i_metric>,
boost::multi_index::composite_key<
- CcnxFibFaceMetric,
- boost::multi_index::member<CcnxFibFaceMetric,CcnxFibFaceMetric::Status,&CcnxFibFaceMetric::m_status>,
- boost::multi_index::member<CcnxFibFaceMetric,int32_t,&CcnxFibFaceMetric::m_routingCost>
+ NdnFibFaceMetric,
+ boost::multi_index::member<NdnFibFaceMetric,NdnFibFaceMetric::Status,&NdnFibFaceMetric::m_status>,
+ boost::multi_index::member<NdnFibFaceMetric,int32_t,&NdnFibFaceMetric::m_routingCost>
>
>,
// To optimize nth candidate selection (sacrifice a little bit space to gain speed)
boost::multi_index::random_access<
- boost::multi_index::tag<__ccnx_private::i_nth>
+ boost::multi_index::tag<__ndn_private::i_nth>
>
>
> type;
@@ -151,11 +151,11 @@
};
/**
- * \ingroup ccnx
+ * \ingroup ndn
* \brief Structure for FIB table entry, holding indexed list of
* available faces and their respective metrics
*/
-class CcnxFibEntry : public SimpleRefCount<CcnxFibEntry>
+class NdnFibEntry : public SimpleRefCount<NdnFibEntry>
{
public:
class NoFaces {}; ///< @brief Exception class for the case when FIB entry is not found
@@ -164,7 +164,7 @@
* \brief Constructor
* \param prefix smart pointer to the prefix for the FIB entry
*/
- CcnxFibEntry (const Ptr<const CcnxNameComponents> &prefix)
+ NdnFibEntry (const Ptr<const NdnNameComponents> &prefix)
: m_prefix (prefix)
, m_needsProbing (false)
{ }
@@ -173,14 +173,14 @@
* \brief Update status of FIB next hop
* \param status Status to set on the FIB entry
*/
- void UpdateStatus (Ptr<CcnxFace> face, CcnxFibFaceMetric::Status status);
+ void UpdateStatus (Ptr<NdnFace> face, NdnFibFaceMetric::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<CcnxFace> face, int32_t metric);
+ void AddOrUpdateRoutingMetric (Ptr<NdnFace> face, int32_t metric);
/**
* @brief Invalidate face
@@ -194,44 +194,44 @@
* @brief Update RTT averages for the face
*/
void
- UpdateFaceRtt (Ptr<CcnxFace> face, const Time &sample);
+ UpdateFaceRtt (Ptr<NdnFace> face, const Time &sample);
/**
* \brief Get prefix for the FIB entry
*/
- const CcnxNameComponents&
+ const NdnNameComponents&
GetPrefix () const { return *m_prefix; }
/**
* \brief Find "best route" candidate, skipping `skip' first candidates (modulo # of faces)
*
- * throws CcnxFibEntry::NoFaces if m_faces.size()==0
+ * throws NdnFibEntry::NoFaces if m_faces.size()==0
*/
- const CcnxFibFaceMetric &
+ const NdnFibFaceMetric &
FindBestCandidate (uint32_t skip = 0) const;
/**
* @brief Remove record associated with `face`
*/
void
- RemoveFace (const Ptr<CcnxFace> &face)
+ RemoveFace (const Ptr<NdnFace> &face)
{
m_faces.erase (face);
}
private:
- friend std::ostream& operator<< (std::ostream& os, const CcnxFibEntry &entry);
+ friend std::ostream& operator<< (std::ostream& os, const NdnFibEntry &entry);
public:
- Ptr<const CcnxNameComponents> m_prefix; ///< \brief Prefix of the FIB entry
- CcnxFibFaceMetricContainer::type m_faces; ///< \brief Indexed list of faces
+ Ptr<const NdnNameComponents> m_prefix; ///< \brief Prefix of the FIB entry
+ NdnFibFaceMetricContainer::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 CcnxFibEntry &entry);
-std::ostream& operator<< (std::ostream& os, const CcnxFibFaceMetric &metric);
+std::ostream& operator<< (std::ostream& os, const NdnFibEntry &entry);
+std::ostream& operator<< (std::ostream& os, const NdnFibFaceMetric &metric);
} // ns3
-#endif // _CCNX_FIB_ENTRY_H_
+#endif // _NDN_FIB_ENTRY_H_
diff --git a/model/fib/ccnx-fib-impl.cc b/model/fib/ndn-fib-impl.cc
similarity index 71%
rename from model/fib/ccnx-fib-impl.cc
rename to model/fib/ndn-fib-impl.cc
index 90f0cd8..747c689 100644
--- a/model/fib/ccnx-fib-impl.cc
+++ b/model/fib/ndn-fib-impl.cc
@@ -18,11 +18,11 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnx-fib-impl.h"
+#include "ndn-fib-impl.h"
-#include "ns3/ccnx.h"
-#include "ns3/ccnx-face.h"
-#include "ns3/ccnx-interest-header.h"
+#include "ns3/ndn.h"
+#include "ns3/ndn-face.h"
+#include "ns3/ndn-interest-header.h"
#include "ns3/node.h"
#include "ns3/assert.h"
@@ -34,43 +34,43 @@
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("CcnxFibImpl");
+NS_LOG_COMPONENT_DEFINE ("NdnFibImpl");
namespace ns3 {
-NS_OBJECT_ENSURE_REGISTERED (CcnxFibImpl);
+NS_OBJECT_ENSURE_REGISTERED (NdnFibImpl);
TypeId
-CcnxFibImpl::GetTypeId (void)
+NdnFibImpl::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::CcnxFib") // cheating ns3 object system
- .SetParent<CcnxFib> ()
- .SetGroupName ("Ccnx")
- .AddConstructor<CcnxFibImpl> ()
+ static TypeId tid = TypeId ("ns3::NdnFib") // cheating ns3 object system
+ .SetParent<NdnFib> ()
+ .SetGroupName ("Ndn")
+ .AddConstructor<NdnFibImpl> ()
;
return tid;
}
-CcnxFibImpl::CcnxFibImpl ()
+NdnFibImpl::NdnFibImpl ()
{
}
void
-CcnxFibImpl::NotifyNewAggregate ()
+NdnFibImpl::NotifyNewAggregate ()
{
Object::NotifyNewAggregate ();
}
void
-CcnxFibImpl::DoDispose (void)
+NdnFibImpl::DoDispose (void)
{
clear ();
Object::DoDispose ();
}
-Ptr<CcnxFibEntry>
-CcnxFibImpl::LongestPrefixMatch (const CcnxInterestHeader &interest)
+Ptr<NdnFibEntry>
+NdnFibImpl::LongestPrefixMatch (const NdnInterestHeader &interest)
{
super::iterator item = super::longest_prefix_match (interest.GetName ());
// @todo use predicate to search with exclude filters
@@ -82,14 +82,14 @@
}
-Ptr<CcnxFibEntry>
-CcnxFibImpl::Add (const CcnxNameComponents &prefix, Ptr<CcnxFace> face, int32_t metric)
+Ptr<NdnFibEntry>
+NdnFibImpl::Add (const NdnNameComponents &prefix, Ptr<NdnFace> face, int32_t metric)
{
- return Add (Create<CcnxNameComponents> (prefix), face, metric);
+ return Add (Create<NdnNameComponents> (prefix), face, metric);
}
-Ptr<CcnxFibEntry>
-CcnxFibImpl::Add (const Ptr<const CcnxNameComponents> &prefix, Ptr<CcnxFace> face, int32_t metric)
+Ptr<NdnFibEntry>
+NdnFibImpl::Add (const Ptr<const NdnNameComponents> &prefix, Ptr<NdnFace> face, int32_t metric)
{
NS_LOG_FUNCTION (this->GetObject<Node> ()->GetId () << boost::cref(*prefix) << boost::cref(*face) << metric);
@@ -99,13 +99,13 @@
{
if (result.second)
{
- Ptr<CcnxFibEntryImpl> newEntry = Create<CcnxFibEntryImpl> (prefix);
+ Ptr<NdnFibEntryImpl> newEntry = Create<NdnFibEntryImpl> (prefix);
newEntry->SetTrie (result.first);
result.first->set_payload (newEntry);
}
super::modify (result.first,
- ll::bind (&CcnxFibEntry::AddOrUpdateRoutingMetric, ll::_1, face, metric));
+ ll::bind (&NdnFibEntry::AddOrUpdateRoutingMetric, ll::_1, face, metric));
return result.first->payload ();
}
@@ -114,7 +114,7 @@
}
void
-CcnxFibImpl::Remove (const Ptr<const CcnxNameComponents> &prefix)
+NdnFibImpl::Remove (const Ptr<const NdnNameComponents> &prefix)
{
NS_LOG_FUNCTION (this->GetObject<Node> ()->GetId () << boost::cref(*prefix));
@@ -122,7 +122,7 @@
}
// void
-// CcnxFibImpl::Invalidate (const Ptr<const CcnxNameComponents> &prefix)
+// NdnFibImpl::Invalidate (const Ptr<const NdnNameComponents> &prefix)
// {
// NS_LOG_FUNCTION (this->GetObject<Node> ()->GetId () << boost::cref(*prefix));
@@ -134,11 +134,11 @@
// return; // nothing to invalidate
// super::modify (lastItem,
-// ll::bind (&CcnxFibEntry::Invalidate, ll::_1));
+// ll::bind (&NdnFibEntry::Invalidate, ll::_1));
// }
void
-CcnxFibImpl::InvalidateAll ()
+NdnFibImpl::InvalidateAll ()
{
NS_LOG_FUNCTION (this->GetObject<Node> ()->GetId ());
@@ -149,28 +149,28 @@
if (item->payload () == 0) continue;
super::modify (&(*item),
- ll::bind (&CcnxFibEntry::Invalidate, ll::_1));
+ ll::bind (&NdnFibEntry::Invalidate, ll::_1));
}
}
void
-CcnxFibImpl::RemoveFace (super::parent_trie &item, Ptr<CcnxFace> face)
+NdnFibImpl::RemoveFace (super::parent_trie &item, Ptr<NdnFace> face)
{
if (item.payload () == 0) return;
NS_LOG_FUNCTION (this);
super::modify (&item,
- ll::bind (&CcnxFibEntry::RemoveFace, ll::_1, face));
+ ll::bind (&NdnFibEntry::RemoveFace, ll::_1, face));
}
void
-CcnxFibImpl::RemoveFromAll (Ptr<CcnxFace> face)
+NdnFibImpl::RemoveFromAll (Ptr<NdnFace> face)
{
NS_LOG_FUNCTION (this);
std::for_each (super::parent_trie::recursive_iterator (super::getTrie ()),
super::parent_trie::recursive_iterator (0),
- ll::bind (&CcnxFibImpl::RemoveFace,
+ ll::bind (&NdnFibImpl::RemoveFace,
this, ll::_1, face));
super::parent_trie::recursive_iterator trieNode (super::getTrie ());
@@ -187,7 +187,7 @@
}
void
-CcnxFibImpl::Print (std::ostream &os) const
+NdnFibImpl::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 +201,13 @@
}
uint32_t
-CcnxFibImpl::GetSize () const
+NdnFibImpl::GetSize () const
{
return super::getPolicy ().size ();
}
-Ptr<const CcnxFibEntry>
-CcnxFibImpl::Begin ()
+Ptr<const NdnFibEntry>
+NdnFibImpl::Begin ()
{
super::parent_trie::const_recursive_iterator item (super::getTrie ());
super::parent_trie::const_recursive_iterator end (0);
@@ -223,18 +223,18 @@
return item->payload ();
}
-Ptr<const CcnxFibEntry>
-CcnxFibImpl::End ()
+Ptr<const NdnFibEntry>
+NdnFibImpl::End ()
{
return 0;
}
-Ptr<const CcnxFibEntry>
-CcnxFibImpl::Next (Ptr<const CcnxFibEntry> from)
+Ptr<const NdnFibEntry>
+NdnFibImpl::Next (Ptr<const NdnFibEntry> from)
{
if (from == 0) return 0;
- super::parent_trie::const_recursive_iterator item (*StaticCast<const CcnxFibEntryImpl> (from)->to_iterator ());
+ super::parent_trie::const_recursive_iterator item (*StaticCast<const NdnFibEntryImpl> (from)->to_iterator ());
super::parent_trie::const_recursive_iterator end (0);
for (item++; item != end; item++)
{
diff --git a/model/fib/ccnx-fib-impl.h b/model/fib/ndn-fib-impl.h
similarity index 62%
rename from model/fib/ccnx-fib-impl.h
rename to model/fib/ndn-fib-impl.h
index e6da99b..562f06e 100644
--- a/model/fib/ccnx-fib-impl.h
+++ b/model/fib/ndn-fib-impl.h
@@ -18,28 +18,28 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef _CCNX_FIB_IMPL_H_
-#define _CCNX_FIB_IMPL_H_
+#ifndef _NDN_FIB_IMPL_H_
+#define _NDN_FIB_IMPL_H_
-#include "ns3/ccnx-fib.h"
-#include "ns3/ccnx-name-components.h"
+#include "ns3/ndn-fib.h"
+#include "ns3/ndn-name-components.h"
#include "../../utils/trie-with-policy.h"
#include "../../utils/counting-policy.h"
namespace ns3 {
-class CcnxFibEntryImpl : public CcnxFibEntry
+class NdnFibEntryImpl : public NdnFibEntry
{
public:
typedef ndnSIM::trie_with_policy<
- CcnxNameComponents,
- ndnSIM::smart_pointer_payload_traits<CcnxFibEntryImpl>,
+ NdnNameComponents,
+ ndnSIM::smart_pointer_payload_traits<NdnFibEntryImpl>,
ndnSIM::counting_policy_traits
> trie;
- CcnxFibEntryImpl (const Ptr<const CcnxNameComponents> &prefix)
- : CcnxFibEntry (prefix)
+ NdnFibEntryImpl (const Ptr<const NdnNameComponents> &prefix)
+ : NdnFibEntry (prefix)
, item_ (0)
{
}
@@ -57,24 +57,24 @@
trie::iterator item_;
};
-struct CcnxFibEntryContainer
+struct NdnFibEntryContainer
{
typedef ndnSIM::trie_with_policy<
- CcnxNameComponents,
- ndnSIM::smart_pointer_payload_traits<CcnxFibEntryImpl>,
+ NdnNameComponents,
+ ndnSIM::smart_pointer_payload_traits<NdnFibEntryImpl>,
ndnSIM::counting_policy_traits
> type;
};
/**
- * \ingroup ccnx
+ * \ingroup ndn
* \brief Class implementing FIB functionality
*/
-class CcnxFibImpl : public CcnxFib,
- private CcnxFibEntryContainer::type
+class NdnFibImpl : public NdnFib,
+ private NdnFibEntryContainer::type
{
public:
- typedef CcnxFibEntryContainer::type super;
+ typedef NdnFibEntryContainer::type super;
/**
* \brief Interface ID
@@ -86,25 +86,25 @@
/**
* \brief Constructor
*/
- CcnxFibImpl ();
+ NdnFibImpl ();
- virtual Ptr<CcnxFibEntry>
- LongestPrefixMatch (const CcnxInterestHeader &interest);
+ virtual Ptr<NdnFibEntry>
+ LongestPrefixMatch (const NdnInterestHeader &interest);
- virtual Ptr<CcnxFibEntry>
- Add (const CcnxNameComponents &prefix, Ptr<CcnxFace> face, int32_t metric);
+ virtual Ptr<NdnFibEntry>
+ Add (const NdnNameComponents &prefix, Ptr<NdnFace> face, int32_t metric);
- virtual Ptr<CcnxFibEntry>
- Add (const Ptr<const CcnxNameComponents> &prefix, Ptr<CcnxFace> face, int32_t metric);
+ virtual Ptr<NdnFibEntry>
+ Add (const Ptr<const NdnNameComponents> &prefix, Ptr<NdnFace> face, int32_t metric);
virtual void
- Remove (const Ptr<const CcnxNameComponents> &prefix);
+ Remove (const Ptr<const NdnNameComponents> &prefix);
virtual void
InvalidateAll ();
virtual void
- RemoveFromAll (Ptr<CcnxFace> face);
+ RemoveFromAll (Ptr<NdnFace> face);
virtual void
Print (std::ostream &os) const;
@@ -112,23 +112,23 @@
virtual uint32_t
GetSize () const;
- virtual Ptr<const CcnxFibEntry>
+ virtual Ptr<const NdnFibEntry>
Begin ();
- virtual Ptr<const CcnxFibEntry>
+ virtual Ptr<const NdnFibEntry>
End ();
- virtual Ptr<const CcnxFibEntry>
- Next (Ptr<const CcnxFibEntry> item);
+ virtual Ptr<const NdnFibEntry>
+ Next (Ptr<const NdnFibEntry> item);
// /**
// * @brief Modify element in container
// */
// template<typename Modifier>
// bool
- // modify (Ptr<CcnxFibEntry> item, Modifier mod)
+ // modify (Ptr<NdnFibEntry> item, Modifier mod)
// {
- // return super::modify (StaticCast<CcnxFibEntryImpl> (item)->to_iterator (), mod);
+ // return super::modify (StaticCast<NdnFibEntryImpl> (item)->to_iterator (), mod);
// }
protected:
@@ -142,7 +142,7 @@
* entry will be removed
*/
void
- RemoveFace (super::parent_trie &item, Ptr<CcnxFace> face);
+ RemoveFace (super::parent_trie &item, Ptr<NdnFace> face);
private:
Ptr<Node> m_node;
@@ -150,4 +150,4 @@
} // namespace ns3
-#endif /* _CCNX_FIB_IMPL_H_ */
+#endif /* _NDN_FIB_IMPL_H_ */
diff --git a/model/fib/ccnx-fib.cc b/model/fib/ndn-fib.cc
similarity index 76%
rename from model/fib/ccnx-fib.cc
rename to model/fib/ndn-fib.cc
index fdd1aea..7046634 100644
--- a/model/fib/ccnx-fib.cc
+++ b/model/fib/ndn-fib.cc
@@ -18,14 +18,14 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnx-fib.h"
+#include "ndn-fib.h"
-#include "ccnx-fib-impl.h"
+#include "ndn-fib-impl.h"
-#include "ns3/ccnx.h"
-#include "ns3/ccnx-face.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-name-components.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"
@@ -37,19 +37,19 @@
namespace ns3 {
-using namespace __ccnx_private;
+using namespace __ndn_private;
TypeId
-CcnxFib::GetTypeId (void)
+NdnFib::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::private::CcnxFib") // cheating ns3 object system
+ static TypeId tid = TypeId ("ns3::private::NdnFib") // cheating ns3 object system
.SetParent<Object> ()
- .SetGroupName ("Ccnx")
+ .SetGroupName ("Ndn")
;
return tid;
}
-std::ostream& operator<< (std::ostream& os, const CcnxFib &fib)
+std::ostream& operator<< (std::ostream& os, const NdnFib &fib)
{
os << "Node " << Names::FindName (fib.GetObject<Node>()) << "\n";
os << " Dest prefix Interfaces(Costs) \n";
diff --git a/model/fib/ccnx-fib.h b/model/fib/ndn-fib.h
similarity index 78%
rename from model/fib/ccnx-fib.h
rename to model/fib/ndn-fib.h
index eae0c65..12a6148 100644
--- a/model/fib/ccnx-fib.h
+++ b/model/fib/ndn-fib.h
@@ -18,23 +18,23 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef _CCNX_FIB_H_
-#define _CCNX_FIB_H_
+#ifndef _NDN_FIB_H_
+#define _NDN_FIB_H_
#include "ns3/simple-ref-count.h"
#include "ns3/node.h"
-#include "ns3/ccnx-fib-entry.h"
+#include "ns3/ndn-fib-entry.h"
namespace ns3 {
-class CcnxInterestHeader;
+class NdnInterestHeader;
/**
- * \ingroup ccnx
+ * \ingroup ndn
* \brief Class implementing FIB functionality
*/
-class CcnxFib : public Object
+class NdnFib : public Object
{
public:
/**
@@ -46,12 +46,12 @@
/**
* @brief Default constructor
*/
- CcnxFib () {}
+ NdnFib () {}
/**
* @brief Virtual destructor
*/
- virtual ~CcnxFib () { };
+ virtual ~NdnFib () { };
/**
* \brief Perform longest prefix match
@@ -61,8 +61,8 @@
* \param interest Interest packet header
* \returns If entry found a valid iterator will be returned, otherwise end ()
*/
- virtual Ptr<CcnxFibEntry>
- LongestPrefixMatch (const CcnxInterestHeader &interest) = 0;
+ virtual Ptr<NdnFibEntry>
+ LongestPrefixMatch (const NdnInterestHeader &interest) = 0;
/**
* \brief Add or update FIB entry
@@ -75,8 +75,8 @@
* @param face Forwarding face
* @param metric Routing metric
*/
- virtual Ptr<CcnxFibEntry>
- Add (const CcnxNameComponents &prefix, Ptr<CcnxFace> face, int32_t metric) = 0;
+ virtual Ptr<NdnFibEntry>
+ Add (const NdnNameComponents &prefix, Ptr<NdnFace> face, int32_t metric) = 0;
/**
* \brief Add or update FIB entry using smart pointer to prefix
@@ -89,8 +89,8 @@
* @param face Forwarding face
* @param metric Routing metric
*/
- virtual Ptr<CcnxFibEntry>
- Add (const Ptr<const CcnxNameComponents> &prefix, Ptr<CcnxFace> face, int32_t metric) = 0;
+ virtual Ptr<NdnFibEntry>
+ Add (const Ptr<const NdnNameComponents> &prefix, Ptr<NdnFace> face, int32_t metric) = 0;
/**
* @brief Remove FIB entry
@@ -101,7 +101,7 @@
* @param name Smart pointer to prefix
*/
virtual void
- Remove (const Ptr<const CcnxNameComponents> &prefix) = 0;
+ Remove (const Ptr<const NdnNameComponents> &prefix) = 0;
// /**
// * @brief Invalidate FIB entry ("Safe" version of Remove)
@@ -110,7 +110,7 @@
// * @param name Smart pointer to prefix
// */
// virtual void
- // Invalidate (const Ptr<const CcnxNameComponents> &prefix) = 0;
+ // Invalidate (const Ptr<const NdnNameComponents> &prefix) = 0;
/**
* @brief Invalidate all FIB entries
@@ -123,7 +123,7 @@
* this FIB entry will be removed.
*/
virtual void
- RemoveFromAll (Ptr<CcnxFace> face) = 0;
+ RemoveFromAll (Ptr<NdnFace> face) = 0;
/**
* @brief Print out entries in FIB
@@ -140,20 +140,20 @@
/**
* @brief Return first element of FIB (no order guaranteed)
*/
- virtual Ptr<const CcnxFibEntry>
+ virtual Ptr<const NdnFibEntry>
Begin () = 0;
/**
* @brief Return item next after last (no order guaranteed)
*/
- virtual Ptr<const CcnxFibEntry>
+ virtual Ptr<const NdnFibEntry>
End () = 0;
/**
* @brief Advance the iterator
*/
- virtual Ptr<const CcnxFibEntry>
- Next (Ptr<const CcnxFibEntry>) = 0;
+ virtual Ptr<const NdnFibEntry>
+ Next (Ptr<const NdnFibEntry>) = 0;
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
@@ -162,28 +162,28 @@
/**
* @brief Static call to cheat python bindings
*/
- static inline Ptr<CcnxFib>
- GetCcnxFib (Ptr<Object> node);
+ static inline Ptr<NdnFib>
+ GetNdnFib (Ptr<Object> node);
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
private:
- CcnxFib(const CcnxFib&) {} ; ///< \brief copy constructor is disabled
+ NdnFib(const NdnFib&) {} ; ///< \brief copy constructor is disabled
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-std::ostream& operator<< (std::ostream& os, const CcnxFib &fib);
+std::ostream& operator<< (std::ostream& os, const NdnFib &fib);
-Ptr<CcnxFib>
-CcnxFib::GetCcnxFib (Ptr<Object> node)
+Ptr<NdnFib>
+NdnFib::GetNdnFib (Ptr<Object> node)
{
- return node->GetObject<CcnxFib> ();
+ return node->GetObject<NdnFib> ();
}
} // namespace ns3
-#endif // _CCNX_FIB_H_
+#endif // _NDN_FIB_H_