model+helper: Converting L3Protocol and StackHelper to use NFD codebase
diff --git a/model/ndn-l3-protocol.hpp b/model/ndn-l3-protocol.hpp
index 03618d5..63e4ff2 100644
--- a/model/ndn-l3-protocol.hpp
+++ b/model/ndn-l3-protocol.hpp
@@ -30,6 +30,13 @@
#include "ns3/ptr.h"
#include "ns3/net-device.h"
#include "ns3/nstime.h"
+#include "ns3/traced-callback.h"
+
+namespace nfd {
+class Forwarder;
+class FibManager;
+class StrategyChoiceManager;
+} // namespace nfd
namespace ns3 {
@@ -60,7 +67,7 @@
*
* \see Face, ForwardingStrategy
*/
-class L3Protocol : public Object {
+class L3Protocol : boost::noncopyable, public Object {
public:
/**
* \brief Interface ID
@@ -81,52 +88,60 @@
virtual ~L3Protocol();
/**
- * \brief Add face to Ndn stack
- *
- * \param face smart pointer to NdnFace-derived object
- * (NdnLocalFace, NdnNetDeviceFace, NdnUdpFace) \returns the
- * index of the Ndn interface added.
- *
- * \see NdnLocalFace, NdnNetDeviceFace, NdnUdpFace
+ * \brief Initialize NFD instance
*/
- virtual uint32_t
- AddFace(const shared_ptr<Face>& face);
+ void
+ initialize();
/**
- * \brief Get current number of faces added to Ndn stack
- *
- * \returns the number of faces
+ * \brief Get smart pointer to nfd::Forwarder installed on the node
*/
- virtual uint32_t
- GetNFaces() const;
+ shared_ptr<nfd::Forwarder>
+ getForwarder();
/**
- * \brief Get face by face index
- * \param face The face number (number in face list)
- * \returns The NdnFace associated with the Ndn face number.
+ * \brief Get smart pointer to nfd::FibManager, used by node's NFD
*/
- virtual shared_ptr<Face>
- GetFace(uint32_t face) const;
+ shared_ptr<nfd::FibManager>
+ getFibManager();
+
+ /**
+ * \brief Get smart pointer to nfd::StrategyChoiceManager, used by node's NFD
+ */
+ shared_ptr<nfd::StrategyChoiceManager>
+ getStrategyChoiceManager();
+
+
+ /**
+ * \brief Add face to NDN stack
+ *
+ * \param face smart pointer to Face-derived object (AppFace, NetDeviceFace)
+ * \return nfd::FaceId
+ *
+ * \see AppFace, NetDeviceFace
+ */
+ nfd::FaceId
+ addFace(shared_ptr<Face> face);
/**
* \brief Get face by face ID
* \param face The face ID number
- * \returns The NdnFace associated with the Ndn face number.
+ * \returns The Face associated with the Ndn face number.
*/
- virtual shared_ptr<Face>
- GetFaceById(uint32_t face) const;
+ shared_ptr<Face>
+ getFaceById(nfd::FaceId face) const;
- /**
- * \brief Remove face from ndn stack (remove callbacks)
- */
- virtual void
- RemoveFace(shared_ptr<Face> face);
+ // /**
+ // * \brief Remove face from ndn stack (remove callbacks)
+ // */
+ // virtual void
+ // removeFace(shared_ptr<Face> face);
/**
* \brief Get face for NetDevice
*/
- virtual shared_ptr<Face>
- GetFaceByNetDevice(Ptr<NetDevice> netDevice) const;
+ shared_ptr<Face>
+ getFaceByNetDevice(Ptr<NetDevice> netDevice) const;
protected:
virtual void
@@ -142,13 +157,23 @@
NotifyNewAggregate();
private:
- L3Protocol(const L3Protocol&); ///< copy constructor is disabled
-
- L3Protocol&
- operator=(const L3Protocol&); ///< copy operator is disabled
+ void
+ initializeManagement();
private:
+ class Impl;
+ std::unique_ptr<Impl> m_impl;
+
+ // These objects are aggregated, but for optimization, get them here
Ptr<Node> m_node; ///< \brief node on which ndn stack is installed
+
+ TracedCallback<const Interest&, const Face&>
+ m_inInterests; ///< @brief trace of incoming Interests
+ TracedCallback<const Interest&, const Face&>
+ m_outInterests; ///< @brief Transmitted interests trace
+
+ TracedCallback<const Data&, const Face&> m_outData; ///< @brief trace of outgoing Data
+ TracedCallback<const Data&, const Face&> m_inData; ///< @brief trace of incoming Data
};
} // namespace ndn