model+apps+utils+examples+ci+docs: Update code for changes in ns-2.23
- Replace removed RandomVariable with RandomVariableStream
- Replace deprecated usages of AddTraceSource
- Update changed LogComponent interface
ci: This commit also integrates a script for Jenkins and Travis CI to
clone NS-3 and pybindgen repositories, so the code can be built.
docs: Update to reflect new home of ndnSIM and related sources
Change-Id: Ic14e1269bf15366b0041fd670c577053b6704dc7
Refs: #3122, #3123
diff --git a/model/cs/content-store-impl.hpp b/model/cs/content-store-impl.hpp
index 9c55053..5765120 100644
--- a/model/cs/content-store-impl.hpp
+++ b/model/cs/content-store-impl.hpp
@@ -137,6 +137,9 @@
return super::getPolicy();
}
+public:
+ typedef void (*CsEntryCallback)(Ptr<const Entry>);
+
private:
void
SetMaxSize(uint32_t maxSize);
@@ -157,8 +160,7 @@
//////////////////////////////////////////
template<class Policy>
-LogComponent
- ContentStoreImpl<Policy>::g_log = LogComponent(("ndn.cs." + Policy::GetName()).c_str());
+LogComponent ContentStoreImpl<Policy>::g_log = LogComponent(("ndn.cs." + Policy::GetName()).c_str(), __FILE__);
template<class Policy>
TypeId
@@ -177,7 +179,8 @@
.AddTraceSource("DidAddEntry",
"Trace fired every time entry is successfully added to the cache",
- MakeTraceSourceAccessor(&ContentStoreImpl<Policy>::m_didAddEntry));
+ MakeTraceSourceAccessor(&ContentStoreImpl<Policy>::m_didAddEntry),
+ "ns3::ndn::cs::ContentStoreImpl::CsEntryCallback");
return tid;
}
diff --git a/model/cs/content-store-with-freshness.hpp b/model/cs/content-store-with-freshness.hpp
index 3d4d980..4cfa700 100644
--- a/model/cs/content-store-with-freshness.hpp
+++ b/model/cs/content-store-with-freshness.hpp
@@ -78,7 +78,7 @@
template<class Policy>
LogComponent ContentStoreWithFreshness<Policy>::g_log = LogComponent(("ndn.cs.Freshness."
- + Policy::GetName()).c_str());
+ + Policy::GetName()).c_str(), __FILE__);
template<class Policy>
TypeId
diff --git a/model/cs/content-store-with-stats.hpp b/model/cs/content-store-with-stats.hpp
index 979a5e5..3b84ac2 100644
--- a/model/cs/content-store-with-stats.hpp
+++ b/model/cs/content-store-with-stats.hpp
@@ -63,6 +63,9 @@
virtual inline void
Print(std::ostream& os) const;
+public:
+ typedef void (*RemoveCsEntryCallback)(Ptr<const Entry>, Time);
+
private:
static LogComponent g_log; ///< @brief Logging variable
@@ -77,7 +80,7 @@
template<class Policy>
LogComponent ContentStoreWithStats<Policy>::g_log = LogComponent(("ndn.cs.Stats."
- + Policy::GetName()).c_str());
+ + Policy::GetName()).c_str(), __FILE__);
template<class Policy>
TypeId
@@ -91,7 +94,8 @@
.AddTraceSource("WillRemoveEntry",
"Trace called just before content store entry will be removed",
- MakeTraceSourceAccessor(&ContentStoreWithStats<Policy>::m_willRemoveEntry))
+ MakeTraceSourceAccessor(&ContentStoreWithStats<Policy>::m_willRemoveEntry),
+ "ns3::ndn::cs::ContentStoreWithStats::RemoveCsEntryCallback")
// trace stuff here
;
diff --git a/model/cs/custom-policies/probability-policy.hpp b/model/cs/custom-policies/probability-policy.hpp
index 7ad6fd0..8bfb1c6 100644
--- a/model/cs/custom-policies/probability-policy.hpp
+++ b/model/cs/custom-policies/probability-policy.hpp
@@ -27,7 +27,7 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-#include <ns3/random-variable.h>
+#include <ns3/random-variable-stream.h>
namespace ns3 {
namespace ndn {
@@ -65,6 +65,7 @@
: base_(base)
, max_size_(100)
, probability_(1.0)
+ , ns3_rand_(CreateObject<UniformRandomVariable>())
{
}
@@ -76,7 +77,7 @@
inline bool
insert(typename parent_trie::iterator item)
{
- if (ns3_rand_.GetValue() < probability_) {
+ if (ns3_rand_->GetValue() < probability_) {
policy_container::push_back(*item);
// allow caching
@@ -138,7 +139,7 @@
Base& base_;
size_t max_size_;
double probability_;
- UniformVariable ns3_rand_;
+ Ptr<UniformRandomVariable> ns3_rand_;
};
};
};
diff --git a/model/cs/ndn-content-store.cpp b/model/cs/ndn-content-store.cpp
index 02a13cb..416bde3 100644
--- a/model/cs/ndn-content-store.cpp
+++ b/model/cs/ndn-content-store.cpp
@@ -38,10 +38,12 @@
.SetParent<Object>()
.AddTraceSource("CacheHits", "Trace called every time there is a cache hit",
- MakeTraceSourceAccessor(&ContentStore::m_cacheHitsTrace))
+ MakeTraceSourceAccessor(&ContentStore::m_cacheHitsTrace),
+ "ns3::ndn::ContentStore::CacheHitsCallback")
.AddTraceSource("CacheMisses", "Trace called every time there is a cache miss",
- MakeTraceSourceAccessor(&ContentStore::m_cacheMissesTrace));
+ MakeTraceSourceAccessor(&ContentStore::m_cacheMissesTrace),
+ "ns3::ndn::ContentStrore::CacheMissesCallback");
return tid;
}
diff --git a/model/cs/ndn-content-store.hpp b/model/cs/ndn-content-store.hpp
index cdbb1ea..36994f8 100644
--- a/model/cs/ndn-content-store.hpp
+++ b/model/cs/ndn-content-store.hpp
@@ -183,6 +183,10 @@
static inline Ptr<ContentStore>
GetContentStore(Ptr<Object> node);
+public:
+ typedef void (*CacheHitsCallback)(shared_ptr<const Interest>, shared_ptr<const Data>);
+ typedef void (*CacheMissesCallback)(shared_ptr<const Interest>);
+
protected:
TracedCallback<shared_ptr<const Interest>,
shared_ptr<const Data>> m_cacheHitsTrace; ///< @brief trace of cache hits
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index dd9f4dc..d45e84a 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -28,7 +28,6 @@
#include "ns3/object-vector.h"
#include "ns3/pointer.h"
#include "ns3/simulator.h"
-#include "ns3/random-variable.h"
#include "ndn-face.hpp"
@@ -70,21 +69,27 @@
.AddConstructor<L3Protocol>()
.AddTraceSource("OutInterests", "OutInterests",
- MakeTraceSourceAccessor(&L3Protocol::m_outInterests))
+ MakeTraceSourceAccessor(&L3Protocol::m_outInterests),
+ "ns3::ndn::L3Protocol::InterestTraceCallback")
.AddTraceSource("InInterests", "InInterests",
- MakeTraceSourceAccessor(&L3Protocol::m_inInterests))
+ MakeTraceSourceAccessor(&L3Protocol::m_inInterests),
+ "ns3::ndn::L3Protocol::InterestTraceCallback")
////////////////////////////////////////////////////////////////////
- .AddTraceSource("OutData", "OutData", MakeTraceSourceAccessor(&L3Protocol::m_outData))
- .AddTraceSource("InData", "InData", MakeTraceSourceAccessor(&L3Protocol::m_inData))
+ .AddTraceSource("OutData", "OutData", MakeTraceSourceAccessor(&L3Protocol::m_outData),
+ "ns3::ndn::L3Protocol::DataTraceCallback")
+ .AddTraceSource("InData", "InData", MakeTraceSourceAccessor(&L3Protocol::m_inData),
+ "ns3::ndn::L3Protocol::DataTraceCallback")
////////////////////////////////////////////////////////////////////
.AddTraceSource("SatisfiedInterests", "SatisfiedInterests",
- MakeTraceSourceAccessor(&L3Protocol::m_satisfiedInterests))
+ MakeTraceSourceAccessor(&L3Protocol::m_satisfiedInterests),
+ "ns3::ndn::L3Protocol::SatisfiedInterestsCallback")
.AddTraceSource("TimedOutInterests", "TimedOutInterests",
- MakeTraceSourceAccessor(&L3Protocol::m_timedOutInterests))
+ MakeTraceSourceAccessor(&L3Protocol::m_timedOutInterests),
+ "ns3::ndn::L3Protocol::TimedOutInterestsCallback")
;
return tid;
}
diff --git a/model/ndn-l3-protocol.hpp b/model/ndn-l3-protocol.hpp
index ffd3bc2..9b63255 100644
--- a/model/ndn-l3-protocol.hpp
+++ b/model/ndn-l3-protocol.hpp
@@ -158,6 +158,13 @@
static Ptr<L3Protocol>
getL3Protocol(Ptr<Object> node);
+public:
+ typedef void (*InterestTraceCallback)(const Interest&, const Face&);
+ typedef void (*DataTraceCallback)(const Data&, const Face&);
+
+ typedef void (*SatisfiedInterestsCallback)(const nfd::pit::Entry& pitEntry, const Face& inFace, const Data& data);
+ typedef void (*TimedOutInterestsCallback)(const nfd::pit::Entry& pitEntry);
+
protected:
virtual void
DoDispose(void); ///< @brief Do cleanup