All CCNx faces are now available through FaceList object attribute
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index ec35d8b..3e39384 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -25,6 +25,8 @@
#include "ns3/log.h"
#include "ns3/node.h"
#include "ns3/assert.h"
+#include "ns3/uinteger.h"
+#include "ns3/double.h"
#include <boost/ref.hpp>
@@ -38,6 +40,21 @@
static TypeId tid = TypeId ("ns3::CcnxFace")
.SetParent<Object> ()
.SetGroupName ("Ccnx")
+ .AddAttribute ("Id", "Face id (unique integer for the CCNx stack on this node)",
+ TypeId::ATTR_GET, // allow only getting it.
+ UintegerValue (0),
+ MakeUintegerAccessor (&CcnxFace::m_id),
+ MakeUintegerChecker<uint32_t> ())
+
+ .AddAttribute ("BucketMax", "Maximum size of leaky bucket",
+ DoubleValue (-1.0),
+ MakeDoubleAccessor (&CcnxFace::m_bucketMax),
+ MakeDoubleChecker<double> ())
+ .AddAttribute ("BucketLeak", "Normalized bucket leak size",
+ DoubleValue (0.0),
+ MakeDoubleAccessor (&CcnxFace::m_bucketLeak),
+ MakeDoubleChecker<double> ())
+
;
return tid;
}
@@ -108,35 +125,6 @@
return true;
}
-void
-CcnxFace::LeakBucket (const Time &interval)
-{
- const double leak = m_bucketLeak * interval.ToDouble (Time::S);
- m_bucket = std::max (0.0, m_bucket - leak);
-
- // NS_LOG_DEBUG ("max: " << m_bucketMax << ", Current bucket: " << m_bucket << ", leak size: " << leak << ", interval: " << interval << ", " << m_bucketLeak);
-}
-
-void
-CcnxFace::SetBucketMax (double bucket)
-{
- NS_LOG_FUNCTION (this << bucket);
- m_bucketMax = bucket;
-}
-
-void
-CcnxFace::SetBucketLeak (double leak)
-{
- NS_LOG_FUNCTION (this << leak);
- m_bucketLeak = leak;
-}
-
-void
-CcnxFace::LeakBucketByOnePacket ()
-{
- m_bucket = std::max (0.0, m_bucket-1.0);
-}
-
bool
CcnxFace::Send (Ptr<Packet> packet)
{
@@ -166,6 +154,35 @@
return true;
}
+void
+CcnxFace::LeakBucket (const Time &interval)
+{
+ const double leak = m_bucketLeak * interval.ToDouble (Time::S);
+ m_bucket = std::max (0.0, m_bucket - leak);
+
+ // NS_LOG_DEBUG ("max: " << m_bucketMax << ", Current bucket: " << m_bucket << ", leak size: " << leak << ", interval: " << interval << ", " << m_bucketLeak);
+}
+
+void
+CcnxFace::SetBucketMax (double bucket)
+{
+ NS_LOG_FUNCTION (this << bucket);
+ m_bucketMax = bucket;
+}
+
+void
+CcnxFace::SetBucketLeak (double leak)
+{
+ NS_LOG_FUNCTION (this << leak);
+ m_bucketLeak = leak;
+}
+
+void
+CcnxFace::LeakBucketByOnePacket ()
+{
+ m_bucket = std::max (0.0, m_bucket-1.0);
+}
+
// void
// CcnxFace::SetMetric (uint16_t metric)
// {
diff --git a/model/ccnx-forwarding-strategy.h b/model/ccnx-forwarding-strategy.h
index aff0909..bb11ec6 100644
--- a/model/ccnx-forwarding-strategy.h
+++ b/model/ccnx-forwarding-strategy.h
@@ -96,6 +96,7 @@
protected:
Ptr<CcnxPit> m_pit;
+ Ptr<Ccnx> m_ccnx; // just for tracing purposes. Should not be used in any other way
};
} //namespace ns3
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index f05a80f..fb1e5e4 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -28,6 +28,7 @@
#include "ns3/uinteger.h"
#include "ns3/trace-source-accessor.h"
#include "ns3/object-vector.h"
+#include "ns3/pointer.h"
#include "ns3/boolean.h"
#include "ns3/string.h"
@@ -63,13 +64,23 @@
.SetParent<Ccnx> ()
.SetGroupName ("Ccnx")
.AddConstructor<CcnxL3Protocol> ()
+ .AddAttribute ("FaceList", "List of faces associated with CCNx stack",
+ ObjectVectorValue (),
+ MakeObjectVectorAccessor (&CcnxL3Protocol::m_faces),
+ MakeObjectVectorChecker<CcnxFace> ())
+
+ .AddAttribute ("ForwardingStrategy", "Forwarding strategy used by CCNx stack",
+ PointerValue (),
+ MakePointerAccessor (&CcnxL3Protocol::SetForwardingStrategy, &CcnxL3Protocol::GetForwardingStrategy),
+ MakePointerChecker<CcnxForwardingStrategy> ())
+
.AddAttribute ("BucketLeakInterval",
"Interval to leak buckets",
StringValue ("10ms"),
MakeTimeAccessor (&CcnxL3Protocol::GetBucketLeakInterval,
&CcnxL3Protocol::SetBucketLeakInterval),
MakeTimeChecker ())
-
+
.AddTraceSource ("TransmittedInterestTrace", "Interests that were transmitted",
MakeTraceSourceAccessor (&CcnxL3Protocol::m_transmittedInterestsTrace))
diff --git a/model/ccnx-local-face.cc b/model/ccnx-local-face.cc
index 1571106..a3267bd 100644
--- a/model/ccnx-local-face.cc
+++ b/model/ccnx-local-face.cc
@@ -38,6 +38,16 @@
namespace ns3
{
+TypeId
+CcnxLocalFace::GetTypeId ()
+{
+ static TypeId tid = TypeId ("ns3::CcnxLocalFace")
+ .SetParent<CcnxFace> ()
+ .SetGroupName ("Ccnx")
+ ;
+ return tid;
+}
+
CcnxLocalFace::CcnxLocalFace (Ptr<CcnxApp> app)
: CcnxFace (app->GetNode ())
, m_app (app)
diff --git a/model/ccnx-local-face.h b/model/ccnx-local-face.h
index 996d969..8855b75 100644
--- a/model/ccnx-local-face.h
+++ b/model/ccnx-local-face.h
@@ -45,6 +45,9 @@
class CcnxLocalFace : public CcnxFace
{
public:
+ static TypeId
+ GetTypeId ();
+
/**
* \brief Default constructor
*/
diff --git a/model/ccnx-net-device-face.cc b/model/ccnx-net-device-face.cc
index d42515f..d4af70f 100644
--- a/model/ccnx-net-device-face.cc
+++ b/model/ccnx-net-device-face.cc
@@ -32,6 +32,16 @@
namespace ns3 {
+TypeId
+CcnxNetDeviceFace::GetTypeId ()
+{
+ static TypeId tid = TypeId ("ns3::CcnxNetDeviceFace")
+ .SetParent<CcnxFace> ()
+ .SetGroupName ("Ccnx")
+ ;
+ return tid;
+}
+
/**
* By default, Ccnx face are created in the "down" state. Before
* becoming useable, the user must invoke SetUp on the face
diff --git a/model/ccnx-net-device-face.h b/model/ccnx-net-device-face.h
index 482d5d3..148da39 100644
--- a/model/ccnx-net-device-face.h
+++ b/model/ccnx-net-device-face.h
@@ -45,6 +45,9 @@
class CcnxNetDeviceFace : public CcnxFace
{
public:
+ static TypeId
+ GetTypeId ();
+
/**
* \brief Constructor
*