Correcting python bindings (+ rescan)
Removing obsolete and unnecessary code
diff --git a/model/annotated-topology-reader.cc b/model/annotated-topology-reader.cc
index 239b6a3..86918f7 100644
--- a/model/annotated-topology-reader.cc
+++ b/model/annotated-topology-reader.cc
@@ -129,7 +129,7 @@
Ptr<ConstantPositionMobilityModel> loc = CreateObject<ConstantPositionMobilityModel> ();
node->AggregateObject (loc);
- loc->SetPosition (Vector (latitude, longitude, 0));
+ loc->SetPosition (Vector (2*longitude, -2*latitude, 0));
Names::Add (m_path, name, node);
nodes.Add (node);
diff --git a/model/ccnx-fib.cc b/model/ccnx-fib.cc
index 89e5231..5bb81c3 100644
--- a/model/ccnx-fib.cc
+++ b/model/ccnx-fib.cc
@@ -170,9 +170,8 @@
void
CcnxFib::DoDispose (void)
{
- clear ();
+ m_fib.clear ();
m_node = 0;
- clear ();
Object::DoDispose ();
}
@@ -186,12 +185,12 @@
componentsCount--)
{
CcnxNameComponents subPrefix (name.GetSubComponents (componentsCount));
- CcnxFibEntryContainer::type::iterator match = find (subPrefix);
- if (match != end())
+ CcnxFibEntryContainer::type::iterator match = m_fib.find (subPrefix);
+ if (match != m_fib.end())
return match;
}
- return end ();
+ return m_fib.end ();
}
@@ -200,16 +199,16 @@
{
// CcnxFibFaceMetric
NS_LOG_FUNCTION(this << prefix << face << metric);
- CcnxFibEntryContainer::type::iterator entry = find (prefix);
- if (entry == end ())
+ CcnxFibEntryContainer::type::iterator entry = m_fib.find (prefix);
+ if (entry == m_fib.end ())
{
- entry = insert (end (), CcnxFibEntry (prefix));
+ entry = m_fib.insert (m_fib.end (), CcnxFibEntry (prefix));
// insert new
}
NS_ASSERT_MSG (face != NULL, "Trying to modify NULL face");
- modify (entry,
- ll::bind (&CcnxFibEntry::AddOrUpdateRoutingMetric, ll::_1, face, metric));
+ m_fib.modify (entry,
+ ll::bind (&CcnxFibEntry::AddOrUpdateRoutingMetric, ll::_1, face, metric));
return entry;
}
@@ -219,11 +218,11 @@
{
NS_LOG_FUNCTION (this);
- modify (iterator_to (entry),
- ll::bind (&CcnxFibEntry::RemoveFace, ll::_1, face));
+ m_fib.modify (m_fib.iterator_to (entry),
+ ll::bind (&CcnxFibEntry::RemoveFace, ll::_1, face));
if (entry.m_faces.size () == 0)
{
- erase (iterator_to (entry));
+ m_fib.erase (m_fib.iterator_to (entry));
}
}
@@ -232,11 +231,27 @@
{
NS_LOG_FUNCTION (this);
- for_each (begin (), end (), ll::bind (&CcnxFib::Remove, this, ll::_1, face));
- // BOOST_FOREACH (const CcnxFibEntry &entry, *this)
- // {
- // Remove (entry, face);
- // }
+ for_each (m_fib.begin (), m_fib.end (),
+ ll::bind (&CcnxFib::Remove, this, ll::_1, face));
+}
+
+/**
+ * \brief Get number of FIB entry (for python bindings)
+ */
+uint32_t
+CcnxFib::GetCcnxFibEntryCount () const
+{
+ return m_fib.size ();
+}
+
+/**
+ * \brief Get FIB entry by index (for python bindings)
+ */
+const CcnxFibEntry &
+CcnxFib::GetCcnxFibEntry (uint32_t index)
+{
+ NS_ASSERT (0 <= index && index < m_fib.size ());
+ return m_fib.get <i_nth> () [index];
}
@@ -246,19 +261,17 @@
os << " Dest prefix Interfaces(Costs) \n";
os << "+-------------+--------------------------------------+\n";
- for (CcnxFibEntryContainer::type::iterator entry = fib.begin ();
- entry != fib.end ();
+ for (CcnxFibEntryContainer::type::iterator entry = fib.m_fib.begin ();
+ entry != fib.m_fib.end ();
entry++)
{
- os << *entry << "\n";
+ os << entry->GetPrefix () << "\t" << *entry << "\n";
}
return os;
}
std::ostream& operator<< (std::ostream& os, const CcnxFibEntry &entry)
{
- os << *entry.m_prefix << "\t";
-
for (CcnxFibFaceMetricContainer::type::index<i_nth>::type::iterator metric =
entry.m_faces.get<i_nth> ().begin ();
metric != entry.m_faces.get<i_nth> ().end ();
diff --git a/model/ccnx-fib.h b/model/ccnx-fib.h
index 3e7807b..f383961 100644
--- a/model/ccnx-fib.h
+++ b/model/ccnx-fib.h
@@ -234,18 +234,20 @@
boost::multi_index::const_mem_fun<CcnxFibEntry,
const CcnxNameComponents&,
&CcnxFibEntry::GetPrefix>,
- CcnxPrefixHash>
+ CcnxPrefixHash>,
- // other indexes?
- >
- > type;
+ boost::multi_index::random_access<
+ boost::multi_index::tag<__ccnx_private::i_nth>
+ >
+ >
+ > type;
};
/**
* \ingroup ccnx
* \brief Class implementing FIB functionality
*/
-class CcnxFib : public Object, public CcnxFibEntryContainer::type
+class CcnxFib : public Object
{
public:
/**
@@ -300,6 +302,21 @@
void
RemoveFromAll (Ptr<CcnxFace> face);
+ /**
+ * \brief Get number of FIB entry (for python bindings)
+ */
+ uint32_t
+ GetCcnxFibEntryCount () const;
+
+ /**
+ * \brief Get FIB entry by index (for python bindings)
+ */
+ const CcnxFibEntry &
+ GetCcnxFibEntry (uint32_t index);
+
+public:
+ CcnxFibEntryContainer::type m_fib;
+
protected:
// inherited from Object class
virtual void NotifyNewAggregate ();
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 49031c7..bffc917 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -29,6 +29,7 @@
#include "ns3/trace-source-accessor.h"
#include "ns3/object-vector.h"
#include "ns3/boolean.h"
+#include "ns3/string.h"
#include "ns3/ccnx-header-helper.h"
@@ -52,6 +53,7 @@
const uint16_t CcnxL3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
+
NS_OBJECT_ENSURE_REGISTERED (CcnxL3Protocol);
TypeId
@@ -339,9 +341,9 @@
ll::bind (&CcnxPitEntry::RemoveIncoming, ll::_1, incomingFace));
}
- m_fib->modify (m_fib->iterator_to (pitEntry.m_fibEntry),
- ll::bind (&CcnxFibEntry::UpdateStatus,
- ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
+ m_fib->m_fib.modify (m_fib->m_fib.iterator_to (pitEntry.m_fibEntry),
+ ll::bind (&CcnxFibEntry::UpdateStatus,
+ ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
if (pitEntry.m_incoming.size () == 0) // interest was actually satisfied
{
@@ -469,9 +471,9 @@
// ?? not sure if we need to do that ?? ...
- m_fib->modify(m_fib->iterator_to (pitEntry.m_fibEntry),
- ll::bind (&CcnxFibEntry::UpdateStatus,
- ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
+ m_fib->m_fib.modify(m_fib->m_fib.iterator_to (pitEntry.m_fibEntry),
+ ll::bind (&CcnxFibEntry::UpdateStatus,
+ ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
}
if (!isRetransmitted &&
@@ -559,11 +561,11 @@
// If we have sent interest for this data via this face, then update stats.
if (out != pitEntry.m_outgoing.end ())
{
- m_fib->modify (m_fib->iterator_to (pitEntry.m_fibEntry),
- ll::bind (&CcnxFibEntry::UpdateFaceRtt,
- ll::_1,
- incomingFace,
- Simulator::Now () - out->m_sendTime));
+ m_fib->m_fib.modify (m_fib->m_fib.iterator_to (pitEntry.m_fibEntry),
+ ll::bind (&CcnxFibEntry::UpdateFaceRtt,
+ ll::_1,
+ incomingFace,
+ Simulator::Now () - out->m_sendTime));
}
else
{
@@ -579,9 +581,9 @@
}
// Update metric status for the incoming interface in the corresponding FIB entry
- m_fib->modify (m_fib->iterator_to (pitEntry.m_fibEntry),
- ll::bind (&CcnxFibEntry::UpdateStatus, ll::_1,
- incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN));
+ m_fib->m_fib.modify (m_fib->m_fib.iterator_to (pitEntry.m_fibEntry),
+ ll::bind (&CcnxFibEntry::UpdateStatus, ll::_1,
+ incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN));
// Add or update entry in the content store
m_contentStore->Add (header, payload);
diff --git a/model/ccnx-l3-protocol.h b/model/ccnx-l3-protocol.h
index f5c19d9..13bdf94 100644
--- a/model/ccnx-l3-protocol.h
+++ b/model/ccnx-l3-protocol.h
@@ -32,7 +32,6 @@
#include "ns3/ccnx-producer-helper.h"
#include "ccnx-content-store.h"
-#include "ccnx-rit.h"
#include "ccnx-pit.h"
#include "ccnx-fib.h"
@@ -78,8 +77,8 @@
static TypeId GetTypeId ();
static const uint16_t ETHERNET_FRAME_TYPE; ///< \brief Ethernet Frame Type of CCNx
- static const uint16_t IP_PROTOCOL_TYPE; ///< \brief IP protocol type of CCNx
- static const uint16_t UDP_PORT; ///< \brief UDP port of CCNx
+ // static const uint16_t IP_PROTOCOL_TYPE; ///< \brief IP protocol type of CCNx
+ // static const uint16_t UDP_PORT; ///< \brief UDP port of CCNx
/**
* \brief Default constructor. Creates an empty stack without forwarding strategy set
diff --git a/model/ccnx-local-face.cc b/model/ccnx-local-face.cc
index 0f8ef27..1571106 100644
--- a/model/ccnx-local-face.cc
+++ b/model/ccnx-local-face.cc
@@ -52,6 +52,22 @@
NS_LOG_FUNCTION_NOARGS ();
}
+CcnxLocalFace::CcnxLocalFace ()
+ : CcnxFace (0)
+{
+}
+
+CcnxLocalFace::CcnxLocalFace (const CcnxLocalFace &)
+ : CcnxFace (0)
+{
+}
+
+CcnxLocalFace& CcnxLocalFace::operator= (const CcnxLocalFace &)
+{
+ return *((CcnxLocalFace*)0);
+}
+
+
void
CcnxLocalFace::RegisterProtocolHandler (ProtocolHandler handler)
{
diff --git a/model/ccnx-local-face.h b/model/ccnx-local-face.h
index c8c4515..996d969 100644
--- a/model/ccnx-local-face.h
+++ b/model/ccnx-local-face.h
@@ -66,6 +66,7 @@
////////////////////////////////////////////////////////////////////
private:
+ CcnxLocalFace ();
CcnxLocalFace (const CcnxLocalFace &); ///< \brief Disabled copy constructor
CcnxLocalFace& operator= (const CcnxLocalFace &); ///< \brief Disabled copy operator
diff --git a/model/ccnx-name-components.cc b/model/ccnx-name-components.cc
index a7066de..323a3f8 100644
--- a/model/ccnx-name-components.cc
+++ b/model/ccnx-name-components.cc
@@ -77,6 +77,7 @@
{
os << "/" << *i;
}
+ if (m_prefix.size ()==0) os << "/";
}
std::ostream &
diff --git a/model/ccnx-pit-entry.h b/model/ccnx-pit-entry.h
index 162d7a5..c07eeda 100644
--- a/model/ccnx-pit-entry.h
+++ b/model/ccnx-pit-entry.h
@@ -232,6 +232,10 @@
private:
friend std::ostream& operator<< (std::ostream& os, const CcnxPitEntry &entry);
+ /**
+ * \brief Default constructor
+ */
+ CcnxPitEntry () : m_fibEntry(*((CcnxFibEntry*)0)) {};
public:
Ptr<CcnxNameComponents> m_prefix; ///< \brief Prefix of the PIT entry
diff --git a/model/ccnx-pit.cc b/model/ccnx-pit.cc
index 1cfa3f9..e9c1f1b 100644
--- a/model/ccnx-pit.cc
+++ b/model/ccnx-pit.cc
@@ -166,7 +166,7 @@
if (entry == end ())
{
CcnxFibEntryContainer::type::iterator fibEntry = m_fib->LongestPrefixMatch (header);
- NS_ASSERT_MSG (fibEntry != m_fib->end (),
+ NS_ASSERT_MSG (fibEntry != m_fib->m_fib.end (),
"There should be at least default route set");
entry = insert (end (),
diff --git a/model/ccnx-pit.cpp b/model/ccnx-pit.cpp
deleted file mode 100644
index 5d10b90..0000000
--- a/model/ccnx-pit.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-//
-// Copyright (c) 2010,2011 UCLA
-//
-// 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:
-//
-
-#include "ccnx-pit.h"
-#include <algorithm>
-
-CcnxPit::CcnxPit( Ccnx &node )
-: _node(node)
-{
-};
-
-CcnxPit::~CcnxPit( ) { }
-
-//Find corresponding CS entry for the given content name
-PitIterator CcnxPit::lookup( const string &prefix )
-{
- QNThreadLock lock( &_pitMutex );
-
- PitIterator entry=_pit.find( prefix );
- return entry;
-}
-
-// add new PIT entry
-bool CcnxPit::add( const string &name, const PitIncomingInterest &interest )
-{
- QNThreadLock lock( &_pitMutex );
-
- PitEntry *entry=NULL;
-
- PitIterator existent_entry = _pit.find( name );
- if( isValid(existent_entry) )
- {
- if( VALUE(existent_entry).timerExpired )
- {
- _node.fillAvailableInterfacesInPitEntry( VALUE(existent_entry) );
- }
-
- add( VALUE(existent_entry), interest );
- }
- else
- {
- PitEntry &entry = _pit[ name ];
- entry.contentName = name;
-
- _node.fillAvailableInterfacesInPitEntry( entry );
-
- add( entry, interest );
- }
-}
-
-// Remove expired records from PIT
-void CcnxPit::cleanExpired( clocktype time )
-{
- QNThreadLock lock( &_pitMutex );
-
- while( !_pitExpirationList.empty() )
- {
- PitExpirationIterator entry = _pitExpirationList.begin( );
-
- if( VALUE(entry)->expireTime <= time )
- {
- deleteIncomingInterest( *(KEY(entry)), VALUE(entry)->interfaceIndex );
-
- // delete entry if all incoming interests expired
- if( KEY(entry)->incomingInterests.size()==0 )
- {
- _pit.erase( KEY(entry)->contentName );
- }
- }
- else
- break;
- }
-}
-
-//delete PIT entry
-void CcnxPit::erase( const string &name )
-{
- // should not call `lookup' method !!!
-
- QNThreadLock lock( &_pitMutex );
-
- PitIterator pe = _pit.find( name );
-
- if( !isValid(pe) ) return;
-
- if( VALUE(pe).timerMsg ) MESSAGE_CancelSelfMsg( _node.getNode(), VALUE(pe).timerMsg );
-
- PitIncomingIterator it = VALUE(pe).incomingInterests.begin();
- while( it!=VALUE(pe).incomingInterests.end() )
- {
- deleteIncomingInterest( VALUE(pe), it );
-
- it = VALUE(pe).incomingInterests.begin();
- }
-
- resetPendingState( VALUE(pe) );
-
- _pit.erase( name );
-}
-
-//delete incoming interest from PIT entry
-//return 0 if interest does not exist, 1 otherwise
-bool CcnxPit::deleteIncomingInterest( PitEntry &pe, int interfaceIndex )
-{
- // should not lock thread !!! Otherwise there will be a deadlock
- if( pe.incomingInterests.size()==0 ) return false; //nothing to delete. Can happen when duplicate data arrives to the node
-
- PitIncomingIterator it = findIncoming( pe, interfaceIndex );
-
- if( !isValid(pe, it) ) return false;
-
- deleteIncomingInterest( pe, it );
-
- return true;
-}
-
-void CcnxPit::deleteAllIncomingInterests( PitEntry &pe )
-{
- PitIncomingIterator it = pe.incomingInterests.begin();
- while( it!=pe.incomingInterests.end() )
- {
- deleteIncomingInterest( pe, it );
-
- it = pe.incomingInterests.begin();
- }
-}
-
-void CcnxPit::deleteIncomingInterest( PitEntry &pe, PitIncomingIterator it )
-{
- assert( KEY(it->expirationPosition)==&pe );
- assert( VALUE(it->expirationPosition)->interfaceIndex==it->interfaceIndex );
-
- _pitExpirationList.erase( it->expirationPosition );
- pe.incomingInterests.erase( it );
-}
-
-//add new incoming interest to PIT entry
-//returns false if interface already exists, true otherwise
-bool CcnxPit::add( PitEntry &pe, const PitIncomingInterest &interest )
-{
- pe.availableInterfaces.remove( interest.interfaceIndex );
-
- PitIncomingIterator it=findIncoming( pe, interest.interfaceIndex );
-
- if( isValid(pe, it) )
- {
- //update expiration time
- it->expireTime = interest.expireTime;
- it->nonce = interest.nonce;
-
- //move Interest to the end of the node's Interest list
- _pitExpirationList.erase( it->expirationPosition );
- _pitExpirationList.push_back( PitExpirationEntry(&pe,&(*it)) );
-
- it->expirationPosition = --_pitExpirationList.end();
- return false;
- }
-
- pe.incomingInterests.push_back( interest );
- PitIncomingInterest *incoming = &pe.incomingInterests.back();
-
- //Add to the end of the node's Interest list
- _pitExpirationList.push_back( PitExpirationEntry(&pe,incoming) );
- incoming->expirationPosition = -- _pitExpirationList.end();
-
- return true;
-}
-
-//add new outgoing interest to PIT entry
-//returns false interface limit reached or interest exists and is still marked as outstanding (nonce will not be changed)
-// true otherwise
-int CcnxPit::add( PitEntry &pe, const PitOutgoingInterest &interest )
-{
- if( _node.isRateLimit && _bucketsPerInterface[interest.interfaceIndex]+1.0 >= maxBucketsPerInterface[interest.interfaceIndex] )
- {
-// printf( "DEBUG: bucket overflow. Should not forward anything to interface %d\n", interest.interfaceIndex );
- return false;
- }
-
- _bucketsPerInterface[interest.interfaceIndex] = _bucketsPerInterface[interest.interfaceIndex] + 1.0;
- pe.availableInterfaces.remove( interest.interfaceIndex );
-
- PitOutgoingIterator it = findOutgoing(pe, interest.interfaceIndex);
- if( isValid(pe, it) )
- {
- if( it->outstanding ) return false;
-
- it->retxNum ++;
- it->nonce = interest.nonce;
- it->outstanding = true;
- it->waitingInVain = false;
- }
- else
- {
- //add to the head of the list
- pe.outgoingInterests.push_front( interest );
- }
-
- return true;
-}
-
-void CcnxPit::resetPendingState( PitEntry &pe )
-{
- for( PitOutgoingIterator it = pe.outgoingInterests.begin();
- it != pe.outgoingInterests.end();
- it++ )
- {
- it->outstanding = false;
- }
-}
-
-void CcnxPit::leakBuckets( )
-{
- for( PitBucketIterator it=_bucketsPerInterface.begin();
- it != _bucketsPerInterface.end();
- it++ )
- {
- it->second = max( 0.0, it->second - leakSize[it->first] );
- }
-}
-
-void CcnxPit::leakBucket( int interface, int amount )
-{
- _bucketsPerInterface[interface] =
- max( 0.0, _bucketsPerInterface[interface] - amount );
-}
diff --git a/model/ccnx-pit.h b/model/ccnx-pit.h
index 0d1132e..2fbafaa 100644
--- a/model/ccnx-pit.h
+++ b/model/ccnx-pit.h
@@ -89,12 +89,6 @@
> type;
};
-// typedef std::map<int,int> PitCounter;
-// typedef std::map<int,int>::iterator PitCounterIterator;
-
-typedef std::map<int,double> PitBucket;
-typedef std::map<int,double>::iterator PitBucketIterator;
-
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
diff --git a/model/ccnx-rit.cc b/model/ccnx-rit.cc
deleted file mode 100644
index 2a1b7f0..0000000
--- a/model/ccnx-rit.cc
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ccnx-rit.h"
-
-#include "ns3/log.h"
-#include "ns3/simulator.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/assert.h"
-
-#include <utility>
-
-NS_LOG_COMPONENT_DEFINE ("CcnxRit");
-
-namespace ns3 {
-
-using namespace __ccnx_private_rit;
-
-NS_OBJECT_ENSURE_REGISTERED (CcnxRit);
-
-TypeId
-CcnxRit::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::CcnxRit")
- .SetGroupName ("Ccnx")
- .SetParent<Object> ()
- .AddConstructor<CcnxRit> ()
- .AddAttribute ("RitTimeout",
- "Timeout defining how long records should be kept in RIT",
- TimeValue (Seconds (1)),
- MakeTimeAccessor (&CcnxRit::GetRitTimeout, &CcnxRit::SetRitTimeout),
- MakeTimeChecker ())
- .AddAttribute ("CleanupTimeout",
- "Timeout defining how frequent RIT should be cleaned up",
- TimeValue (Seconds (1)),
- MakeTimeAccessor (&CcnxRit::GetCleanupTimeout, &CcnxRit::SetCleanupTimeout),
- MakeTimeChecker ())
- ;
-
- return tid;
-}
-
-// /**
-// * \ingroup ccnx
-// * \brief Typedef for prefix hash index of RIT container
-// */
-// struct CcnxRitByTimestamp
-// {
-// typedef
-// CcnxRitContainer::type::index<timestamp>::type
-// type;
-// };
-
-//////////////////////////////////////////////////////////////////////
-
-
-CcnxRit::CcnxRit( )
-{
-}
-
-CcnxRit::~CcnxRit( )
-{
- NS_LOG_FUNCTION_NOARGS ();
-
- if (m_cleanupEvent.IsRunning ())
- m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
-
- clear ();
-}
-
-void
-CcnxRit::NotifyNewAggregate ()
-{
-}
-
-void
-CcnxRit::DoDispose ()
-{
- if (m_cleanupEvent.IsRunning ())
- m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
-
- clear ();
-}
-
-void
-CcnxRit::SetRitTimeout (const Time &timeout)
-{
- m_ritTimeout = timeout;
-}
-
-Time
-CcnxRit::GetRitTimeout () const
-{
- return m_ritTimeout;
-}
-
-void
-CcnxRit::SetCleanupTimeout (const Time &timeout)
-{
- m_cleanupTimeout = timeout;
- if (m_cleanupEvent.IsRunning ())
- m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
-
- // schedule even with new timeout
- m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
- &CcnxRit::CleanExpired, this);
-}
-
-Time
-CcnxRit::GetCleanupTimeout () const
-{
- return m_cleanupTimeout;
-}
-
-bool
-CcnxRit::WasRecentlySatisfied (const CcnxInterestHeader &header)
-{
- // NS_LOG_FUNCTION_NOARGS ();
- std::pair<CcnxRitByNonce::type::iterator,CcnxRitByNonce::type::iterator>
- entries = get<nonce> ().equal_range (header.GetNonce ());
-
- if (entries.first == end ())
- return false;
-
- // check all entries if the name of RIT entry matches the name of interest
- for (CcnxRitByNonce::type::iterator it = entries.first; it != entries.second; it++)
- {
- // NS_LOG_DEBUG (it->m_prefix << " vs " << header.GetName () << " = " << (it->m_prefix == header.GetName ()));
- if (it->m_prefix == header.GetName ())
- return true;
- }
-
- return false;
-}
-
-void
-CcnxRit::SetRecentlySatisfied (const CcnxInterestHeader &header)
-{
- // NS_LOG_FUNCTION_NOARGS ();
- NS_ASSERT_MSG (!WasRecentlySatisfied (header), "Duplicate recent interest should not be added to RIT");
-
- get<timestamp> ().push_back (
- CcnxRitEntry(header.GetName (),
- header.GetNonce (),
- Simulator::Now ()+m_ritTimeout)
- );
-}
-
-
-void CcnxRit::CleanExpired ()
-{
- NS_LOG_LOGIC ("Cleaning RIT, total: " << size ());
- Time now = Simulator::Now ();
-
- while( !empty() )
- {
- if( get<timestamp> ().front ().m_expireTime <= now ) // is the record stale?
- {
- get<timestamp> ().pop_front( );
- }
- else
- break; // nothing else to do. All later records will not be stale
- }
-
- // schedule next even
- m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
- &CcnxRit::CleanExpired, this);
-}
-
-} //namespace ns3
diff --git a/model/ccnx-rit.h b/model/ccnx-rit.h
deleted file mode 100644
index 501f409..0000000
--- a/model/ccnx-rit.h
+++ /dev/null
@@ -1,224 +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 _CCNX_RIT_H_
-#define _CCNX_RIT_H_
-
-#include <list>
-#include "ns3/nstime.h"
-#include "ns3/ccnx-name-components.h"
-#include "ns3/object.h"
-#include "ns3/nstime.h"
-#include "ns3/event-id.h"
-
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/tag.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
-#include <boost/multi_index/hashed_index.hpp>
-#include <boost/multi_index/member.hpp>
-
-namespace ns3 {
-
-class CcnxInterestHeader;
-
-/**
- * \ingroup ccnx
- * \brief Recently satisfied interest
- *
- * This entry holds information about recently satisfied interest
- *
- * RIT entries will stay in the table for a while before being cleaned out
- */
-struct CcnxRitEntry
-{
- CcnxNameComponents m_prefix; ///< \brief Prefix of the recently satisfied interest
- uint32_t m_nonce; ///< \brief Nonce of the recently satisfied interest
- Time m_expireTime; ///< \brief Time when the record should be removed
-
- CcnxRitEntry (const CcnxNameComponents &prefix, uint32_t nonce, const Time &timeout)
- : m_prefix (prefix)
- , m_nonce (nonce)
- , m_expireTime (timeout)
- { }
-};
-
-/**
- * \ingroup ccnx
- * \brief Private namespace for CCNx RIT implementation
- */
-namespace __ccnx_private_rit
-{
-class nonce {}; ///< tag for nonce hash
-class timestamp {}; ///< tag for timestamp-ordered records (for cleanup optimization)
-};
-
-/**
- * \ingroup ccnx
- * \brief Typedef for RIT container implemented as a Boost.MultiIndex container
- *
- * - First index (tag<nonce>) is a non-unique hash index based on
- * nonce (there could be several records with the same nonce,
- * provided that the prefixes are different
- * - Second index (tag<timestamp>) is a sequenced index based on
- * arrival order (for clean-up optimizations)
- *
- * Container allows having non-unique nonce values. In the
- * implementation it is allowed only if prefixes are different. During
- * the lookup process, the nonce field is checked first and, if a
- * match found, the prefix field will be checked to match prefix of
- * the interest.
- *
- * \see http://www.boost.org/doc/libs/1_46_1/libs/multi_index/doc/ for more information on Boost.MultiIndex library
- */
-struct CcnxRitContainer
-{
- typedef
- boost::multi_index::multi_index_container<
- CcnxRitEntry,
- boost::multi_index::indexed_by<
- boost::multi_index::hashed_non_unique<
- boost::multi_index::tag<__ccnx_private_rit::nonce>,
- boost::multi_index::member<CcnxRitEntry, uint32_t, &CcnxRitEntry::m_nonce>
- >,
- boost::multi_index::sequenced<
- boost::multi_index::tag<__ccnx_private_rit::timestamp> >
- >
- > type;
-};
-
-
-
-/**
- * \ingroup ccnx
- * \brief Recently satisfied interest storage
- *
- * This storage holds information about all recently satisfied
- * interests (prefix and nonce).
- *
- * There is no hard limit on number of entries (limited by the amount
- * of the available memory). Entries are removed after preconfigured
- * amount of time (RitTimeout, default is 1 second).
- */
-class CcnxRit : public CcnxRitContainer::type, public Object
-{
-public:
- /**
- * \brief Interface ID
- *
- * \return interface ID
- */
- static TypeId GetTypeId ();
-
- /**
- * \brief Default constructor
- */
- CcnxRit ();
- virtual ~CcnxRit( );
-
- /**
- * \brief Find corresponding RIT entry for the given content name
- *
- * This check consists of two steps. First, we find records with
- * the same nonce. Then check prefixes of all found records and if
- * prefix of any of them matched prefix of the interest, this
- * function returns true. In all other cases, it will return false.
- *
- * \param header header of the interest packet in question
- *
- * \returns true if the same interest was recently satisfied
- */
- bool WasRecentlySatisfied (const CcnxInterestHeader &header);
-
- /**
- * \brief Add a new RIT entry
- *
- * This function asserts (only in debug) if the same interest is
- * already present in RIT. The caller is responsible of calling
- * WasRecentlySatisfied before calling SetRecentlySatisfied.
- *
- * \param header header of the interest packet in question
- */
- void SetRecentlySatisfied (const CcnxInterestHeader &header);
-
- /**
- * \brief Set RIT entries lifetime
- *
- * \param lifetime of RIT entries timeout
- */
- void SetRitTimeout (const Time &timeout);
-
- /**
- * \brief Get RIT entries lifetime
- *
- * \returns lifetime of RIT entries timeout
- */
- Time GetRitTimeout () const;
-
- /**
- * \brief Set cleanup timeout
- *
- * Side effect: current clean up even (if any) will be cancelled and a new event started
- *
- * \param timeout cleanup timeout
- */
- void SetCleanupTimeout (const Time &timeout);
-
- /**
- * \brief Get cleanup timeout
- *
- * \returns cleanup timeout
- */
- Time GetCleanupTimeout () const;
-
-protected:
- // inherited from Object class
- virtual void NotifyNewAggregate ();
- virtual void DoDispose ();
-
-private:
- /**
- * \brief Periodic even to clean up stalled entries
- */
- void CleanExpired ();
-
-private:
- Time m_ritTimeout; ///< \brief Configurable timeout of RIT entries
- Time m_cleanupTimeout; ///< \brief Configurable timeout of how often cleanup events are working
- EventId m_cleanupEvent; ///< \brief Cleanup event
-};
-
-//////////////////////////////////////////////////////////////////////
-// Helper classes
-//////////////////////////////////////////////////////////////////////
-/**
- * \ingroup ccnx
- * \brief Typedef for nonce hash index of RIT container
- */
-struct CcnxRitByNonce
-{
- typedef
- CcnxRitContainer::type::index<__ccnx_private_rit::nonce>::type
- type;
-};
-
-} // namespace ns3
-
-#endif // _CCNX_RIT_H_
diff --git a/model/ccnx-route.cc b/model/ccnx-route.cc
deleted file mode 100644
index a3b0224..0000000
--- a/model/ccnx-route.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2009 University of Washington
- *
- * 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
- *
- */
-
-#include "ccnx-route.h"
-
-#include "ns3/ccnx-face.h"
-#include "ns3/assert.h"
-
-namespace ns3 {
-
-CcnxRoute::CcnxRoute ()
-{
-}
-
-void
-CcnxRoute::SetPrefix (const Ptr<CcnxNameComponents> &prefix)
-{
- m_prefix = prefix;
-}
-
-const CcnxNameComponents&
-CcnxRoute::GetPrefix (void) const
-{
- return *m_prefix;
-}
-
-void
-CcnxRoute::SetOutputFace (Ptr<CcnxFace> outputFace)
-{
- m_outputFace = outputFace;
-}
-
-Ptr<CcnxFace>
-CcnxRoute::GetOutputFace (void) const
-{
- return m_outputFace;
-}
-
-std::ostream& operator<< (std::ostream& os, CcnxRoute const& route)
-{
- os << "prefix=" << route.GetPrefix () << ", " << route.GetOutputFace ();
- return os;
-}
-
-} //namespace ns3
diff --git a/model/ccnx-route.h b/model/ccnx-route.h
deleted file mode 100644
index 65fed46..0000000
--- a/model/ccnx-route.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2009 University of Washington
- *
- * 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
- *
- */
-#ifndef CCNX_ROUTE_H
-#define CCNX_ROUTE_H
-
-#include <list>
-#include <map>
-#include <ostream>
-
-#include "ns3/ptr.h"
-#include "ns3/simple-ref-count.h"
-#include "ns3/ccnx-name-components.h"
-
-namespace ns3 {
-
-class CcnxFace;
-
-/**
- * \ingroup ccnxRouting
- *
- *\brief Ccnx route cache entry (similar to Linux struct rtable)
- *
- * This is a reference counted object. In the future, we will add other
- * entries from struct dst_entry, struct rtable, and struct dst_ops as needed.
- */
-class CcnxRoute : public SimpleRefCount<CcnxRoute>
-{
-public:
- CcnxRoute ();
-
- /**
- * \param dest Destination CcnxAddress
- */
- void SetPrefix (const Ptr<CcnxNameComponents> &dest);
- /**
- * \return Destination CcnxAddress of the route
- */
- const CcnxNameComponents& GetPrefix (void) const;
-
- /**
- * Equivalent in Linux to dst_entry.dev
- *
- * \param outputDevice pointer to NetDevice for outgoing packets
- */
- void SetOutputFace (Ptr<CcnxFace> outputDevice);
- /**
- * \return pointer to NetDevice for outgoing packets
- */
- Ptr<CcnxFace> GetOutputFace (void) const;
-
-private:
- Ptr<CcnxNameComponents> m_prefix;
- Ptr<CcnxFace> m_outputFace;
-};
-
-std::ostream& operator<< (std::ostream& os, CcnxRoute const& route);
-
-} //namespace ns3
-
-#endif /* CCNX_ROUTE_H */
diff --git a/model/ipv4-global-routing-ordered-nexthops.cc b/model/ipv4-global-routing-ordered-nexthops.cc
deleted file mode 100644
index a01c044..0000000
--- a/model/ipv4-global-routing-ordered-nexthops.cc
+++ /dev/null
@@ -1,308 +0,0 @@
-// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2008 University of Washington
-//
-// 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
-//
-
-#include "ns3/names.h"
-#include "ns3/node.h"
-#include "ns3/log.h"
-#include "ns3/simulator.h"
-#include "ns3/object.h"
-#include "ns3/packet.h"
-#include "ns3/net-device.h"
-#include "ns3/ipv4-route.h"
-#include "ipv4-global-routing-ordered-nexthops.h"
-
-#include <boost/lambda/lambda.hpp>
-#include <iomanip>
-
-NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRoutingOrderedNexthops");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (Ipv4GlobalRoutingOrderedNexthops);
-
-TypeId
-Ipv4GlobalRoutingOrderedNexthops::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::Ipv4GlobalRoutingOrderedNexthops")
- .SetParent<Ipv4GlobalRouting> ()
- .AddConstructor<Ipv4GlobalRoutingOrderedNexthops> ()
- ;
- return tid;
-}
-
-Ipv4GlobalRoutingOrderedNexthops::Ipv4GlobalRoutingOrderedNexthops ()
-{
-}
-
-void
-Ipv4GlobalRoutingOrderedNexthops::AddRouteTo (Ipv4Address dest,
- Ipv4Mask destMask,
- Ipv4Address nextHop,
- uint32_t interface,
- uint32_t metric/*=0*/)
-{
- // if (m_ipv4->GetObject<Node> ()->GetId ()!=3) return;
- NS_LOG_FUNCTION (dest << destMask << nextHop << interface << metric);
-
- // First, make sure we don't try to add route to ourselves
- int32_t iface = m_ipv4->GetInterfaceForPrefix (dest, destMask);
- NS_LOG_LOGIC ("Iface " << iface << " for " << dest);
- if (destMask != Ipv4Mask::GetZero () && iface >= 0)
- {
- NS_LOG_LOGIC ("Do not add route to ourselves");
- return;
- }
-
- // Second, there is no reason to add p2p route that equals to the next hop
- if (destMask == Ipv4Mask::GetOnes () && dest == nextHop)
- {
- NS_LOG_LOGIC ("Ignore route to nexthop via nexhop");
- return;
- }
-
- Ptr<EntryContainer> nextHops = 0;
-
- Ipv4AddressTrieMap::iterator route =
- m_routes.find (dest.CombineMask (destMask));
- if (route == m_routes.end ())
- {
- nextHops = Create<EntryContainer> ();
- m_routes[dest.CombineMask (destMask)] = nextHops;
- }
- else
- {
- nextHops = route->second;
- }
-
- std::pair<EntryContainer::iterator,bool> result =
- nextHops->insert (Ipv4RoutingTableEntry::CreateNetworkRouteTo (dest, destMask, nextHop, interface, metric));
- if (!result.second)
- {
- NS_LOG_LOGIC ("Entry for the interface already exists");
- if (result.first->GetMetric () > metric)
- {
- NS_LOG_LOGIC ("Update metric");
- nextHops->modify (result.first,
- boost::bind(&Ipv4RoutingTableEntry::SetMetric, boost::lambda::_1, metric));
- }
- }
-
- nextHops->get<i_index> ().rearrange (nextHops->get<i_metric> ().begin ());
-}
-
-Ptr<Ipv4Route>
-Ipv4GlobalRoutingOrderedNexthops::LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif)
-{
- NS_LOG_FUNCTION (this << dest << oif);
-
- Ipv4AddressTrieMap::const_iterator longest_prefix_map = m_routes.longest_prefix_match (dest);
- if (longest_prefix_map == m_routes.end ())
- {
- return 0;
- }
-
- const Ipv4RoutingTableEntry & entry = longest_prefix_map->second->get<i_index> ()[0];
-
- if (oif != 0 && oif == m_ipv4->GetNetDevice (entry.GetInterface ()))
- {
- NS_LOG_LOGIC ("Route points to the incoming interface. Return empty route");
- return 0;
- }
-
- // create a Ipv4Route object from the selected routing table entry
- Ptr<Ipv4Route> rtentry = Create<Ipv4Route> ();
- rtentry->SetDestination (entry.GetDest ());
- rtentry->SetSource (m_ipv4->GetAddress (entry.GetInterface (), 0).GetLocal ());
- rtentry->SetGateway (entry.GetGateway ());
- rtentry->SetOutputDevice (m_ipv4->GetNetDevice (entry.GetInterface ()));
- return rtentry;
-}
-
-const Ptr<Ipv4GlobalRoutingOrderedNexthops::EntryContainer>
-Ipv4GlobalRoutingOrderedNexthops::Lookup (Ipv4Address dest)
-{
- NS_LOG_FUNCTION (this << dest);
-
- Ipv4AddressTrieMap::const_iterator longest_prefix_map = m_routes.longest_prefix_match (dest);
- if (longest_prefix_map == m_routes.end ())
- {
- return 0;
- }
-
- return longest_prefix_map->second;
-}
-
-
-void
-Ipv4GlobalRoutingOrderedNexthops::DeleteRoutes ()
-{
- m_routes.clear ();
-}
-
-void
-Ipv4GlobalRoutingOrderedNexthops::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
-{
- std::ostream* os = stream->GetStream ();
- if (m_routes.size () > 0)
- {
- *os << "Destination Iface(Metric),...,Iface(Metric)" << std::endl;
- for (Ipv4AddressTrieMap::const_iterator i=m_routes.begin (); i != m_routes.end (); i++)
- {
- std::ostringstream dest, gw;
- const Ipv4RoutingTableEntry &route = i->second->get<i_index> ()[0];
- dest << route.GetDest () << "/" << route.GetDestNetworkMask().GetPrefixLength ();
- gw << route.GetGateway ();
-
- *os << std::setiosflags (std::ios::left) << std::setw (15) << dest.str ();
-
- for (EntryContainer::index<i_metric>::type::iterator metric = i->second->get<i_metric> ().begin ();
- metric != i->second->get<i_metric> ().end ();
- metric ++)
- {
- if (metric != i->second->get<i_metric> ().begin ())
- *os << ",";
- *os << metric->GetInterface () << "(" << metric->GetMetric () << ")";
- }
-
- // for (EntryContainer::iterator metric = i->second->begin ();
- // metric != i->second->end ();
- // metric ++)
- // {
- // if (metric != i->second->begin ())
- // *os << ",";
- // *os << metric->GetInterface () << "(" << metric->GetMetric () << ")";
- // }
-
- *os << std::endl;
- }
- }
-}
-
-Ptr<Ipv4Route>
-Ipv4GlobalRoutingOrderedNexthops::RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
- Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
-{
-//
-// First, see if this is a multicast packet we have a route for. If we
-// have a route, then send the packet down each of the specified interfaces.
-//
- if (header.GetDestination ().IsMulticast ())
- {
- NS_LOG_LOGIC ("Multicast destination-- returning false");
- return 0; // Let other routing protocols try to handle this
- }
-//
-// See if this is a unicast packet we have a route for.
-//
- NS_LOG_LOGIC ("Unicast destination- looking up");
- Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination (), oif);
- if (rtentry)
- {
- sockerr = Socket::ERROR_NOTERROR;
- }
- else
- {
- sockerr = Socket::ERROR_NOROUTETOHOST;
- }
- return rtentry;
-}
-
-bool
-Ipv4GlobalRoutingOrderedNexthops::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
- Ptr<const NetDevice> idev,
- UnicastForwardCallback ucb, MulticastForwardCallback mcb,
- LocalDeliverCallback lcb, ErrorCallback ecb)
-{
-
- NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev);
- // Check if input device supports IP
- NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
- uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
-
- if (header.GetDestination ().IsMulticast ())
- {
- NS_LOG_LOGIC ("Multicast destination-- returning false");
- return false; // Let other routing protocols try to handle this
- }
-
- if (header.GetDestination ().IsBroadcast ())
- {
- NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
- // TODO: Local Deliver for broadcast
- // TODO: Forward broadcast
- }
-
- // TODO: Configurable option to enable RFC 1222 Strong End System Model
- // Right now, we will be permissive and allow a source to send us
- // a packet to one of our other interface addresses; that is, the
- // destination unicast address does not match one of the iif addresses,
- // but we check our other interfaces. This could be an option
- // (to remove the outer loop immediately below and just check iif).
- for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
- {
- for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
- {
- Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
- Ipv4Address addr = iaddr.GetLocal ();
- if (addr.IsEqual (header.GetDestination ()))
- {
- if (j == iif)
- {
- NS_LOG_LOGIC ("For me (destination " << addr << " match)");
- }
- else
- {
- NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
- }
- lcb (p, header, iif);
- return true;
- }
- if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
- {
- NS_LOG_LOGIC ("For me (interface broadcast address)");
- lcb (p, header, iif);
- return true;
- }
- NS_LOG_LOGIC ("Address "<< addr << " not a match");
- }
- }
- // Check if input device supports IP forwarding
- if (m_ipv4->IsForwarding (iif) == false)
- {
- NS_LOG_LOGIC ("Forwarding disabled for this interface");
- ecb (p, header, Socket::ERROR_NOROUTETOHOST);
- return false;
- }
- // Next, try to find a route
- NS_LOG_LOGIC ("Unicast destination- looking up global route");
- Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination ());
- if (rtentry != 0)
- {
- NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
- ucb (rtentry, p, header);
- return true;
- }
- else
- {
- NS_LOG_LOGIC ("Did not find unicast destination- returning false");
- return false; // Let other routing protocols try to handle this
- // route request.
- }
-}
-
-} // namespace ns3
diff --git a/model/ipv4-global-routing-ordered-nexthops.h b/model/ipv4-global-routing-ordered-nexthops.h
deleted file mode 100644
index 1ae8713..0000000
--- a/model/ipv4-global-routing-ordered-nexthops.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2008 University of Washington
-//
-// 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
-//
-//
-
-#ifndef IPV4_GLOBAL_ROUTING_ORDERED_NEXTHOPS_H
-#define IPV4_GLOBAL_ROUTING_ORDERED_NEXTHOPS_H
-
-#include "ns3/ipv4-global-routing.h"
-#include "ns3/trie.h"
-#include "ns3/ipv4-routing-table-entry.h"
-#include "ns3/simple-ref-count.h"
-
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/tag.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/mem_fun.hpp>
-#include <boost/multi_index/random_access_index.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
-
-namespace ns3 {
-
-/**
- * \brief Global routing protocol for IP version 4 stacks.
- *
- * Each prefix entry stores a list of ordered by metric next-hops
- *
- * This class deals with Ipv4 unicast routes only.
- *
- * \see Ipv4GlobalRouting
- * \see Ipv4RoutingProtocol
- * \see GlobalRouteManager
- */
-class Ipv4GlobalRoutingOrderedNexthops : public Ipv4GlobalRouting
-{
-public:
- class i_iface {};
- class i_metric {};
- class i_index {};
-
- class EntryContainer
- : public SimpleRefCount<EntryContainer>
- , public
- boost::multi_index::multi_index_container<
- Ipv4RoutingTableEntry,
- boost::multi_index::indexed_by<
- // Access elements by interface
-
- // boost::multi_index::sequenced<
- // boost::multi_index::tag<i_metric>
- // >,
-
- boost::multi_index::ordered_unique<
- boost::multi_index::tag<i_iface>,
- BOOST_MULTI_INDEX_CONST_MEM_FUN (Ipv4RoutingTableEntry,uint32_t,GetInterface)
- >,
-
- // Keep entries sorted by metric
- boost::multi_index::ordered_non_unique<
- boost::multi_index::tag<i_metric>,
- BOOST_MULTI_INDEX_CONST_MEM_FUN (Ipv4RoutingTableEntry,uint32_t,GetMetric)
- >,
-
- // Access elements by metric order
- boost::multi_index::random_access<
- boost::multi_index::tag<i_index>
- >
- >
- >
- {
- };
-
-public:
- static TypeId GetTypeId (void);
-
- Ipv4GlobalRoutingOrderedNexthops ();
-
- // These methods inherited from base class
- // from Ipv4RoutingProtocol
- virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
- Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
-
- virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
- UnicastForwardCallback ucb, MulticastForwardCallback mcb,
- LocalDeliverCallback lcb, ErrorCallback ecb);
-
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
-
- // from Ipv4GlobalRouting
- virtual void AddRouteTo (Ipv4Address dest,
- Ipv4Mask destMask,
- Ipv4Address nextHop,
- uint32_t interface,
- uint32_t metric=0);
-
- virtual void DeleteRoutes ();
-
- const Ptr<EntryContainer>
- Lookup (Ipv4Address dest);
-
-protected:
- virtual Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif = 0);
-
-private:
- typedef Ipv4AddressTrie<Ptr<EntryContainer> > Ipv4AddressTrieMap;
- Ipv4AddressTrieMap m_routes;
-};
-
-} // Namespace ns3
-
-#endif /* IPV4_GLOBAL_ROUTING_ORDERED_NEXTHOPS_H */
diff --git a/model/ipv4-global-routing-unordered-nexthops.cc b/model/ipv4-global-routing-unordered-nexthops.cc
deleted file mode 100644
index 0fdce0b..0000000
--- a/model/ipv4-global-routing-unordered-nexthops.cc
+++ /dev/null
@@ -1,315 +0,0 @@
-// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2008 University of Washington
-//
-// 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
-//
-
-#include "ns3/names.h"
-#include "ns3/node.h"
-#include "ns3/log.h"
-#include "ns3/simulator.h"
-#include "ns3/object.h"
-#include "ns3/packet.h"
-#include "ns3/net-device.h"
-#include "ns3/ipv4-route.h"
-#include "ipv4-global-routing-unordered-nexthops.h"
-
-#include <iomanip>
-
-#ifndef UINT32_MAX
-# define UINT32_MAX (4294967295U)
-#endif
-
-NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRoutingUnorderedNexthops");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (Ipv4GlobalRoutingUnorderedNexthops);
-
-TypeId
-Ipv4GlobalRoutingUnorderedNexthops::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::Ipv4GlobalRoutingUnorderedNexthops")
- .SetParent<Ipv4GlobalRouting> ()
- .AddConstructor<Ipv4GlobalRoutingUnorderedNexthops> ()
- ;
- return tid;
-}
-
-Ipv4GlobalRoutingUnorderedNexthops::Ipv4GlobalRoutingUnorderedNexthops ()
-: m_numLogicalEntries (1)
-{
-}
-
-void
-Ipv4GlobalRoutingUnorderedNexthops::FixRoutes ()
-{
- for (Ipv4AddressTrieMap::iterator route = m_routes.begin ();
- route != m_routes.end ();
- route ++)
- {
- if (route->second->size () < m_numLogicalEntries)
- {
- NS_LOG_WARN ("Not all entries got a new routing entry. Making one based on previous set");
- route->second->push_back (route->second->back ());
- route->second->back ().SetMetric (UINT32_MAX); // just to ensure we have consistency across the sets
- }
- }
- m_numLogicalEntries ++;
-}
-
-void
-Ipv4GlobalRoutingUnorderedNexthops::AddRouteTo (Ipv4Address dest,
- Ipv4Mask destMask,
- Ipv4Address nextHop,
- uint32_t interface,
- uint32_t metric/*=0*/)
-{
- NS_LOG_FUNCTION (dest << destMask << nextHop << interface << metric);
-
- // First, make sure we don't try to add route to ourselves
- int32_t iface = m_ipv4->GetInterfaceForPrefix (dest, destMask);
- NS_LOG_LOGIC ("Iface " << iface << " for " << dest);
- if (destMask != Ipv4Mask::GetZero () && iface >= 0)
- {
- NS_LOG_LOGIC ("Do not add route to ourselves");
- return;
- }
-
- // Second, there is no reason to add p2p route that equals to the next hop
- if (destMask == Ipv4Mask::GetOnes () && dest == nextHop)
- {
- NS_LOG_LOGIC ("Ignore route to nexthop via nexhop");
- return;
- }
-
- Ptr<EntryContainer> nextHops = 0;
-
- Ipv4AddressTrieMap::iterator route =
- m_routes.find (dest.CombineMask (destMask));
- if (route == m_routes.end ())
- {
- nextHops = Create<EntryContainer> ();
- m_routes[dest.CombineMask (destMask)] = nextHops;
- }
- else
- {
- nextHops = route->second;
- }
-
- // NS_LOG_ERROR ("numLogicalEntries: " << m_numLogicalEntries << ", nextHops->size: " << nextHops->size ());
- NS_ASSERT_MSG (nextHops->size ()==m_numLogicalEntries ||
- nextHops->size ()==m_numLogicalEntries-1,
- "Number of entries in nextHops should be either equal to number of logical entries, or one smaller");
-
- if (nextHops->size ()==m_numLogicalEntries-1)
- {
- // new entry
- nextHops->push_back (Ipv4RoutingTableEntry::CreateNetworkRouteTo (dest, destMask, nextHop, interface, metric));
- }
- else
- {
- if (nextHops->back ().GetMetric () > metric)
- {
- // update entry if new metric is smaller
- nextHops->back () = Ipv4RoutingTableEntry::CreateNetworkRouteTo (dest, destMask, nextHop, interface, metric);
- }
- }
-}
-
-Ptr<Ipv4Route>
-Ipv4GlobalRoutingUnorderedNexthops::LookupGlobal (uint32_t entryNum, Ipv4Address dest, Ptr<NetDevice> oif)
-{
- NS_LOG_FUNCTION_NOARGS ();
- NS_LOG_LOGIC ("Looking for route for destination " << dest);
-
- NS_ASSERT_MSG (m_numLogicalEntries > 0,
- "Number of logical entries should be at least one");
-
- NS_ASSERT_MSG (entryNum < m_numLogicalEntries,
- "Number of requested logical entry should be smaller than total number of logical entries");
-
- Ipv4AddressTrieMap::const_iterator longest_prefix_map = m_routes.longest_prefix_match (dest);
- if (longest_prefix_map == m_routes.end ())
- {
- return 0;
- }
-
- const Ipv4RoutingTableEntry & entry = (*longest_prefix_map->second)[entryNum];
-
- if (oif != 0 && oif == m_ipv4->GetNetDevice (entry.GetInterface ()))
- {
- NS_LOG_LOGIC ("Route points to the incoming interface. Return empty route");
- return 0;
- }
-
- // create a Ipv4Route object from the selected routing table entry
- Ptr<Ipv4Route> rtentry = Create<Ipv4Route> ();
- rtentry->SetDestination (entry.GetDest ());
- rtentry->SetSource (m_ipv4->GetAddress (entry.GetInterface (), 0).GetLocal ());
- rtentry->SetGateway (entry.GetGateway ());
- rtentry->SetOutputDevice (m_ipv4->GetNetDevice (entry.GetInterface ()));
- return rtentry;
-}
-
-void
-Ipv4GlobalRoutingUnorderedNexthops::DeleteRoutes ()
-{
- m_routes.clear ();
-}
-
-void
-Ipv4GlobalRoutingUnorderedNexthops::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
-{
- std::ostream* os = stream->GetStream ();
- if (m_routes.size () > 0)
- {
- *os << "Destination Iface(Metric),...,Iface(Metric)" << std::endl;
- for (Ipv4AddressTrieMap::const_iterator i=m_routes.begin (); i != m_routes.end (); i++)
- {
- if (i->second->size ()==0) continue;
- const Ipv4RoutingTableEntry &route = i->second->front ();
-
- std::ostringstream dest;
- dest << route.GetDest () << "/" << route.GetDestNetworkMask().GetPrefixLength ();
- *os << std::setiosflags (std::ios::left) << std::setw (15) << dest.str ();
-
- for (EntryContainer::iterator entry = i->second->begin ();
- entry != i->second->end ();
- entry ++)
- {
- if (entry != i->second->begin ())
- *os << ",";
- *os << entry->GetInterface () << "(" << entry->GetMetric () << ")";
- }
-
- *os << std::endl;
- }
- }
-}
-
-Ptr<Ipv4Route>
-Ipv4GlobalRoutingUnorderedNexthops::RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
- Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
-{
-//
-// First, see if this is a multicast packet we have a route for. If we
-// have a route, then send the packet down each of the specified interfaces.
-//
- if (header.GetDestination ().IsMulticast ())
- {
- NS_LOG_LOGIC ("Multicast destination-- returning false");
- return 0; // Let other routing protocols try to handle this
- }
-//
-// See if this is a unicast packet we have a route for.
-//
- NS_LOG_LOGIC ("Unicast destination- looking up");
- Ptr<Ipv4Route> rtentry = LookupGlobal (0, header.GetDestination (), oif);
- if (rtentry)
- {
- sockerr = Socket::ERROR_NOTERROR;
- }
- else
- {
- sockerr = Socket::ERROR_NOROUTETOHOST;
- }
- return rtentry;
-}
-
-bool
-Ipv4GlobalRoutingUnorderedNexthops::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
- Ptr<const NetDevice> idev,
- UnicastForwardCallback ucb, MulticastForwardCallback mcb,
- LocalDeliverCallback lcb, ErrorCallback ecb)
-{
-
- NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev);
- // Check if input device supports IP
- NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
- uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
-
- if (header.GetDestination ().IsMulticast ())
- {
- NS_LOG_LOGIC ("Multicast destination-- returning false");
- return false; // Let other routing protocols try to handle this
- }
-
- if (header.GetDestination ().IsBroadcast ())
- {
- NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
- // TODO: Local Deliver for broadcast
- // TODO: Forward broadcast
- }
-
- // TODO: Configurable option to enable RFC 1222 Strong End System Model
- // Right now, we will be permissive and allow a source to send us
- // a packet to one of our other interface addresses; that is, the
- // destination unicast address does not match one of the iif addresses,
- // but we check our other interfaces. This could be an option
- // (to remove the outer loop immediately below and just check iif).
- for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
- {
- for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
- {
- Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
- Ipv4Address addr = iaddr.GetLocal ();
- if (addr.IsEqual (header.GetDestination ()))
- {
- if (j == iif)
- {
- NS_LOG_LOGIC ("For me (destination " << addr << " match)");
- }
- else
- {
- NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
- }
- lcb (p, header, iif);
- return true;
- }
- if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
- {
- NS_LOG_LOGIC ("For me (interface broadcast address)");
- lcb (p, header, iif);
- return true;
- }
- NS_LOG_LOGIC ("Address "<< addr << " not a match");
- }
- }
- // Check if input device supports IP forwarding
- if (m_ipv4->IsForwarding (iif) == false)
- {
- NS_LOG_LOGIC ("Forwarding disabled for this interface");
- ecb (p, header, Socket::ERROR_NOROUTETOHOST);
- return false;
- }
- // Next, try to find a route
- NS_LOG_LOGIC ("Unicast destination- looking up global route");
- Ptr<Ipv4Route> rtentry = LookupGlobal (0, header.GetDestination ());
- if (rtentry != 0)
- {
- NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
- ucb (rtentry, p, header);
- return true;
- }
- else
- {
- NS_LOG_LOGIC ("Did not find unicast destination- returning false");
- return false; // Let other routing protocols try to handle this
- // route request.
- }
-}
-
-} // namespace ns3
diff --git a/model/ipv4-global-routing-unordered-nexthops.h b/model/ipv4-global-routing-unordered-nexthops.h
deleted file mode 100644
index bb137b2..0000000
--- a/model/ipv4-global-routing-unordered-nexthops.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2008 University of Washington
-//
-// 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
-//
-//
-
-#ifndef IPV4_GLOBAL_ROUTING_UNORDERED_NEXTHOPS_H
-#define IPV4_GLOBAL_ROUTING_UNORDERED_NEXTHOPS_H
-
-#include "ns3/ipv4-global-routing.h"
-#include "ns3/trie.h"
-#include "ns3/ipv4-routing-table-entry.h"
-#include "ns3/simple-ref-count.h"
-
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/tag.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/mem_fun.hpp>
-#include <boost/multi_index/random_access_index.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
-
-namespace ns3 {
-
-/**
- * \brief Global routing protocol for IP version 4 stacks.
- *
- * Each prefix entry stores a list of ordered by metric next-hops
- *
- * This class deals with Ipv4 unicast routes only.
- *
- * \see Ipv4GlobalRouting
- * \see Ipv4RoutingProtocol
- * \see GlobalRouteManager
- */
-class Ipv4GlobalRoutingUnorderedNexthops : public Ipv4GlobalRouting
-{
-private:
- class EntryContainer
- : public SimpleRefCount<EntryContainer>
- , public
- std::vector<Ipv4RoutingTableEntry>
- {
- };
-
-public:
- static TypeId GetTypeId (void);
-
- Ipv4GlobalRoutingUnorderedNexthops ();
-
- // These methods inherited from base class
- // from Ipv4RoutingProtocol
- virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
- Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
-
- virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
- UnicastForwardCallback ucb, MulticastForwardCallback mcb,
- LocalDeliverCallback lcb, ErrorCallback ecb);
-
- virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
-
- // from Ipv4GlobalRouting
- virtual void AddRouteTo (Ipv4Address dest,
- Ipv4Mask destMask,
- Ipv4Address nextHop,
- uint32_t interface,
- uint32_t metric=0);
-
- virtual void DeleteRoutes ();
-
- virtual void FixRoutes ();
-
-protected:
- virtual Ptr<Ipv4Route> LookupGlobal (uint32_t entryNum, Ipv4Address dest, Ptr<NetDevice> oif = 0);
-
-private:
- typedef Ipv4AddressTrie<Ptr<EntryContainer> > Ipv4AddressTrieMap;
- Ipv4AddressTrieMap m_routes;
-
- uint32_t m_numLogicalEntries;
-};
-
-} // Namespace ns3
-
-#endif /* IPV4_GLOBAL_ROUTING_UNORDERED_NEXTHOPS_H */
diff --git a/model/ndnabstraction-header.cc b/model/ndnabstraction-header.cc
deleted file mode 100644
index 4cbd9f0..0000000
--- a/model/ndnabstraction-header.cc
+++ /dev/null
@@ -1,23 +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>
- */
-
-#include "ndnabstraction-header.h"
-
-#include "ns3/assert.h"
diff --git a/model/ndnabstraction-header.h b/model/ndnabstraction-header.h
deleted file mode 100644
index 2bc30ec..0000000
--- a/model/ndnabstraction-header.h
+++ /dev/null
@@ -1,34 +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 NDNABSTRACTION_HEADER_H
-#define NDNABSTRACTION_HEADER_H
-
-#include <stdint.h>
-#include <vector>
-
-#include "ns3/header.h"
-#include "ns3/ipv4-address.h"
-#include "ns3/nstime.h"
-
-namespace ns3 {
-}
-
-#endif
diff --git a/model/rocketfuel-weights-reader.cc b/model/rocketfuel-weights-reader.cc
index 30d0780..246d1b0 100644
--- a/model/rocketfuel-weights-reader.cc
+++ b/model/rocketfuel-weights-reader.cc
@@ -19,14 +19,37 @@
* Ilya Moiseenko <iliamo@cs.ucla.edu>
*/
-#include <fstream>
-#include <cstdlib>
-#include <iostream>
-#include <sstream>
+#include "rocketfuel-weights-reader.h"
+
+#include "ns3/nstime.h"
+#include "ns3/log.h"
+#include "ns3/assert.h"
+#include "ns3/names.h"
+#include "ns3/net-device-container.h"
+#include "ns3/point-to-point-helper.h"
+#include "ns3/point-to-point-net-device.h"
+#include "ns3/internet-stack-helper.h"
+#include "ns3/ipv4-address-helper.h"
+#include "ns3/ipv4-global-routing-helper.h"
+#include "ns3/drop-tail-queue.h"
+#include "ns3/ipv4-interface.h"
+#include "ns3/ipv4.h"
+#include "ns3/string.h"
+#include "ns3/pointer.h"
+#include "ns3/uinteger.h"
+#include "ns3/ipv4-address.h"
+
+#include "ns3/constant-position-mobility-model.h"
+#include "ns3/random-variable.h"
+
#include <regex.h>
-#include "ns3/log.h"
-#include "rocketfuel-weights-reader.h"
+#include <boost/foreach.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include <iomanip>
+#include <set>
+
namespace ns3 {
diff --git a/model/rocketfuel-weights-reader.h b/model/rocketfuel-weights-reader.h
index 9b89a92..21c2144 100644
--- a/model/rocketfuel-weights-reader.h
+++ b/model/rocketfuel-weights-reader.h
@@ -22,28 +22,8 @@
#ifndef ROCKETFUEL_TOPOLOGY_READER_H
#define ROCKETFUEL_TOPOLOGY_READER_H
-#include "ns3/nstime.h"
-#include "ns3/net-device-container.h"
#include "ns3/topology-reader.h"
-
-
-#include "ns3/point-to-point-helper.h"
-#include "ns3/point-to-point-net-device.h"
-#include "ns3/internet-stack-helper.h"
-#include "ns3/ipv4-address-helper.h"
-#include "ns3/ipv4-global-routing-helper.h"
-#include "ns3/drop-tail-queue.h"
-#include "ns3/ipv4-interface.h"
-#include "ns3/ipv4.h"
-#include "ns3/string.h"
-#include "ns3/pointer.h"
-#include "ns3/uinteger.h"
-#include <string>
-#include <fstream>
-#include <cstdlib>
-#include <iostream>
-#include <sstream>
-#include <iomanip>
+#include "ns3/net-device-container.h"
namespace ns3 {