Changing internals. PIT, FIB, CS, and ForwardingStrategy now are aggregated onto the node
Also, CcnxStackHelper provide an easy way to set up individual
parameters for them.
diff --git a/helper/ccnx-stack-helper.cc b/helper/ccnx-stack-helper.cc
index 85cef6c..c7c4908 100644
--- a/helper/ccnx-stack-helper.cc
+++ b/helper/ccnx-stack-helper.cc
@@ -60,24 +60,103 @@
: m_limitsEnabled (false)
, m_needSetDefaultRoutes (false)
{
- m_strategyFactory.SetTypeId ("ns3::CcnxFloodingStrategy");
+ m_ccnxFactory. SetTypeId ("ns3::CcnxL3Protocol");
+ m_strategyFactory. SetTypeId ("ns3::CcnxFloodingStrategy");
m_contentStoreFactory.SetTypeId ("ns3::CcnxContentStoreLru");
+ m_fibFactory. SetTypeId ("ns3::CcnxFib");
+ m_pitFactory. SetTypeId ("ns3::CcnxPit");
}
CcnxStackHelper::~CcnxStackHelper ()
{
}
+void
+CcnxStackHelper::SetCcnxAttributes (const std::string &attr1, const std::string &value1,
+ const std::string &attr2, const std::string &value2,
+ const std::string &attr3, const std::string &value3,
+ const std::string &attr4, const std::string &value4)
+{
+ if (attr1 != "")
+ m_ccnxFactory.Set (attr1, StringValue (value1));
+ if (attr2 != "")
+ m_ccnxFactory.Set (attr2, StringValue (value2));
+ if (attr3 != "")
+ m_ccnxFactory.Set (attr3, StringValue (value3));
+ if (attr4 != "")
+ m_ccnxFactory.Set (attr4, StringValue (value4));
+}
+
void
-CcnxStackHelper::SetForwardingStrategy (const std::string &strategy)
+CcnxStackHelper::SetForwardingStrategy (const std::string &strategy,
+ const std::string &attr1, const std::string &value1,
+ const std::string &attr2, const std::string &value2,
+ const std::string &attr3, const std::string &value3,
+ const std::string &attr4, const std::string &value4)
{
m_strategyFactory.SetTypeId (strategy);
+ if (attr1 != "")
+ m_strategyFactory.Set (attr1, StringValue (value1));
+ if (attr2 != "")
+ m_strategyFactory.Set (attr2, StringValue (value2));
+ if (attr3 != "")
+ m_strategyFactory.Set (attr3, StringValue (value3));
+ if (attr4 != "")
+ m_strategyFactory.Set (attr4, StringValue (value4));
}
void
-CcnxStackHelper::SetContentStore (const std::string &contentStore)
+CcnxStackHelper::SetContentStore (const std::string &contentStore,
+ const std::string &attr1, const std::string &value1,
+ const std::string &attr2, const std::string &value2,
+ const std::string &attr3, const std::string &value3,
+ const std::string &attr4, const std::string &value4)
{
m_contentStoreFactory.SetTypeId (contentStore);
+ if (attr1 != "")
+ m_contentStoreFactory.Set (attr1, StringValue (value1));
+ if (attr2 != "")
+ m_contentStoreFactory.Set (attr2, StringValue (value2));
+ if (attr3 != "")
+ m_contentStoreFactory.Set (attr3, StringValue (value3));
+ if (attr4 != "")
+ m_contentStoreFactory.Set (attr4, StringValue (value4));
+}
+
+void
+CcnxStackHelper::SetPit (const std::string &pitClass,
+ const std::string &attr1, const std::string &value1,
+ const std::string &attr2, const std::string &value2,
+ const std::string &attr3, const std::string &value3,
+ const std::string &attr4, const std::string &value4)
+{
+ m_pitFactory.SetTypeId (pitClass);
+ if (attr1 != "")
+ m_pitFactory.Set (attr1, StringValue (value1));
+ if (attr2 != "")
+ m_pitFactory.Set (attr2, StringValue (value2));
+ if (attr3 != "")
+ m_pitFactory.Set (attr3, StringValue (value3));
+ if (attr4 != "")
+ m_pitFactory.Set (attr4, StringValue (value4));
+}
+
+void
+CcnxStackHelper::SetFib (const std::string &fibClass,
+ const std::string &attr1, const std::string &value1,
+ const std::string &attr2, const std::string &value2,
+ const std::string &attr3, const std::string &value3,
+ const std::string &attr4, const std::string &value4)
+{
+ m_fibFactory.SetTypeId (fibClass);
+ if (attr1 != "")
+ m_fibFactory.Set (attr1, StringValue (value1));
+ if (attr2 != "")
+ m_fibFactory.Set (attr2, StringValue (value2));
+ if (attr3 != "")
+ m_fibFactory.Set (attr3, StringValue (value3));
+ if (attr4 != "")
+ m_fibFactory.Set (attr4, StringValue (value4));
}
void
@@ -130,17 +209,23 @@
return 0;
}
- Ptr<CcnxFib> fib = CreateObject<CcnxFib> ();
- node->AggregateObject (fib);
+ // Create CcnxL3Protocol
+ Ptr<Ccnx> ccnx = m_ccnxFactory.Create<Ccnx> ();
- Ptr<CcnxL3Protocol> ccnx = CreateObject<CcnxL3Protocol> ();
+ // Create and aggregate FIB
+ ccnx->AggregateObject (m_fibFactory.Create<CcnxFib> ());
+
+ // Create and aggregate PIT
+ ccnx->AggregateObject (m_pitFactory.Create<CcnxPit> ());
+
+ // Create and aggregate forwarding strategy
+ ccnx->AggregateObject (m_strategyFactory.Create<CcnxForwardingStrategy> ());
+
+ // Create and aggregate content store
+ ccnx->AggregateObject (m_contentStoreFactory.Create<CcnxContentStore> ());
+
+ // Aggregate CcnxL3Protocol on node
node->AggregateObject (ccnx);
-
- // Create and set forwarding strategy
- ccnx->SetForwardingStrategy (m_strategyFactory.Create<CcnxForwardingStrategy> ());
-
- // Create and set content store
- node->AggregateObject (m_contentStoreFactory.Create ());
for (uint32_t index=0; index < node->GetNDevices (); index++)
{
diff --git a/helper/ccnx-stack-helper.h b/helper/ccnx-stack-helper.h
index afd797b..764a982 100644
--- a/helper/ccnx-stack-helper.h
+++ b/helper/ccnx-stack-helper.h
@@ -68,24 +68,64 @@
virtual ~CcnxStackHelper ();
/**
- * @brief Set forwarding strategy class
- * @param forwardingStrategy string containing name of the forwarding strategy class
+ * @brief Set parameters of CcnxL3Protocol
+ */
+ void
+ SetCcnxAttributes (const std::string &attr1 = "", const std::string &value1 = "",
+ const std::string &attr2 = "", const std::string &value2 = "",
+ const std::string &attr3 = "", const std::string &value3 = "",
+ const std::string &attr4 = "", const std::string &value4 = "");
+
+
+ /**
+ * @brief Set forwarding strategy class and its attributes
+ * @param forwardingStrategyClass string containing name of the forwarding strategy class
*
* Valid options are "ns3::CcnxFloodingStrategy" (default) and "ns3::CcnxBestRouteStrategy"
*
* Other strategies can be implemented, inheriting ns3::CcnxForwardingStrategy class
*/
void
- SetForwardingStrategy (const std::string &forwardingStrategy);
+ SetForwardingStrategy (const std::string &forwardingStrategyClass,
+ const std::string &attr1 = "", const std::string &value1 = "",
+ const std::string &attr2 = "", const std::string &value2 = "",
+ const std::string &attr3 = "", const std::string &value3 = "",
+ const std::string &attr4 = "", const std::string &value4 = "");
/**
- * @brief Set content store class
- * @param contentStore string, representing class of the content store
+ * @brief Set content store class and its attributes
+ * @param contentStoreClass string, representing class of the content store
*/
void
- SetContentStore (const std::string &contentStore);
+ SetContentStore (const std::string &contentStoreClass,
+ const std::string &attr1 = "", const std::string &value1 = "",
+ const std::string &attr2 = "", const std::string &value2 = "",
+ const std::string &attr3 = "", const std::string &value3 = "",
+ const std::string &attr4 = "", const std::string &value4 = "");
+
+ /**
+ * @brief Set PIT class and its attributes
+ * @param pitClass string, representing class of PIT
+ */
+ void
+ SetPit (const std::string &pitClass,
+ const std::string &attr1 = "", const std::string &value1 = "",
+ const std::string &attr2 = "", const std::string &value2 = "",
+ const std::string &attr3 = "", const std::string &value3 = "",
+ const std::string &attr4 = "", const std::string &value4 = "");
/**
+ * @brief Set FIB class and its attributes
+ * @param pitClass string, representing class of FIB
+ */
+ void
+ SetFib (const std::string &fibClass,
+ const std::string &attr1 = "", const std::string &value1 = "",
+ const std::string &attr2 = "", const std::string &value2 = "",
+ const std::string &attr3 = "", const std::string &value3 = "",
+ const std::string &attr4 = "", const std::string &value4 = "");
+
+ /**
* @brief Enable Interest limits (disabled by default)
*
* @param enable Enable or disable limits
@@ -181,8 +221,12 @@
CcnxStackHelper &operator = (const CcnxStackHelper &o);
private:
+ ObjectFactory m_ccnxFactory;
ObjectFactory m_strategyFactory;
ObjectFactory m_contentStoreFactory;
+ ObjectFactory m_pitFactory;
+ ObjectFactory m_fibFactory;
+
bool m_limitsEnabled;
Time m_avgRtt;
uint32_t m_avgContentObjectSize;