Solving compilation problems, adding more comments. Modified ccnx-test example
diff --git a/model/ccnx-face.h b/model/ccnx-face.h
index 787bfa0..4370ab9 100644
--- a/model/ccnx-face.h
+++ b/model/ccnx-face.h
@@ -31,9 +31,10 @@
class Packet;
class Node;
+
/**
* \ingroup ccnx
- * \defgroup ccnx-face
+ * \defgroup ccnx-face Faces
*/
/**
* \ingroup ccnx-face
@@ -54,7 +55,7 @@
* \param face Face from which packet has been received
* \param packet Received packet
*/
- typedef Callback<void,const Ptr<CcnxFace>&,const Ptr<Packet>& > ProtocolHandler;
+ typedef Callback<void,const Ptr<CcnxFace>&,const Ptr<const Packet>& > ProtocolHandler;
/**
* \brief Interface ID
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 07bf848..ff3f926 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -155,7 +155,7 @@
m_faces.push_back (face);
m_faceCounter ++;
- return m_faceCounter;
+ return face->GetId ();
}
Ptr<CcnxFace>
@@ -177,7 +177,7 @@
// Callback from lower layer
void
-CcnxL3Protocol::Receive (const Ptr<CcnxFace> &face, const Ptr<Packet> &p)
+CcnxL3Protocol::Receive (const Ptr<CcnxFace> &face, const Ptr<const Packet> &p)
{
NS_LOG_LOGIC ("Packet from face " << &face << " received on node " << m_node->GetId ());
diff --git a/model/ccnx-l3-protocol.h b/model/ccnx-l3-protocol.h
index 4743bdd..145051f 100644
--- a/model/ccnx-l3-protocol.h
+++ b/model/ccnx-l3-protocol.h
@@ -105,7 +105,7 @@
Ptr<CcnxForwardingStrategy> GetForwardingStrategy () const;
virtual void Send (const Ptr<CcnxFace> &face, const Ptr<Packet> &packet);
- virtual void Receive (const Ptr<CcnxFace> &device, const Ptr<Packet> &p);
+ virtual void Receive (const Ptr<CcnxFace> &face, const Ptr<const Packet> &p);
virtual uint32_t AddFace (const Ptr<CcnxFace> &face);
virtual uint32_t GetNFaces () const;
@@ -113,7 +113,7 @@
protected:
/**
- * Actual processing of incoming CCNx packets. Also processing packets coming from local apps
+ * \brief Actual processing of incoming CCNx interests
*
* Processing Interest packets
*/
@@ -124,7 +124,7 @@
/**
- * Actual processing of incoming CCNx packets. Also processing packets coming from local apps
+ * \brief Actual processing of incoming CCNx content objects
*
* Processing ContentObject packets
*/
@@ -153,12 +153,12 @@
ReceiveAndProcess (Ptr<CcnxFace> face, Ptr<Header> header, Ptr<Packet> p);
private:
- uint32_t m_faceCounter; ///< counter of faces. Increased every time a new face is added to the stack
+ uint32_t m_faceCounter; ///< \brief counter of faces. Increased every time a new face is added to the stack
typedef std::vector<Ptr<CcnxFace> > CcnxFaceList;
- CcnxFaceList m_faces;
+ CcnxFaceList m_faces; ///< \brief list of faces that belongs to ccnx stack on this node
- Ptr<Node> m_node;
- Ptr<CcnxForwardingStrategy> m_forwardingStrategy;
+ Ptr<Node> m_node; ///< \brief node on which ccnx stack is installed
+ Ptr<CcnxForwardingStrategy> m_forwardingStrategy; ///< \brief smart pointer to the selected forwarding strategy
// TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_sendOutgoingTrace;
// TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_unicastForwardTrace;
diff --git a/model/ccnx-net-device-face.cc b/model/ccnx-net-device-face.cc
index 37a3555..b5816a4 100644
--- a/model/ccnx-net-device-face.cc
+++ b/model/ccnx-net-device-face.cc
@@ -44,14 +44,14 @@
}
/**
- * By default, Ccnx face are created in the "down" state
- * with no IP addresses. Before becoming useable, the user must
- * invoke SetUp on them once an Ccnx address and mask have been set.
+ * By default, Ccnx face are created in the "down" state. Before
+ * becoming useable, the user must invoke SetUp on the face
*/
-CcnxNetDeviceFace::CcnxNetDeviceFace ()
- : m_netDevice (0)
+CcnxNetDeviceFace::CcnxNetDeviceFace (const Ptr<NetDevice> &netDevice)
{
NS_LOG_FUNCTION (this);
+
+ m_netDevice = netDevice;
}
CcnxNetDeviceFace::~CcnxNetDeviceFace ()
@@ -77,12 +77,6 @@
Object::DoDispose ();
}
-void
-CcnxNetDeviceFace::SetNetDevice (Ptr<NetDevice> netDevice)
-{
- m_netDevice = netDevice;
-}
-
Ptr<NetDevice>
CcnxNetDeviceFace::GetNetDevice () const
{
@@ -127,7 +121,7 @@
const Address &to,
NetDevice::PacketType packetType)
{
- // bla bla bla
+ m_protocolHandler (Ptr<CcnxFace>(this), p);
}
diff --git a/model/ccnx-net-device-face.h b/model/ccnx-net-device-face.h
index 397d6c1..baf6a48 100644
--- a/model/ccnx-net-device-face.h
+++ b/model/ccnx-net-device-face.h
@@ -36,6 +36,10 @@
* component responsible for actual delivery of data packet to and
* from CCNx stack
*
+ * CcnxNetDevice face is permanently associated with one NetDevice
+ * object and this object cannot be changed for the lifetime of the
+ * face
+ *
* \see CcnxLocalFace, CcnxNetDeviceFace, CcnxIpv4Face, CcnxUdpFace
*/
class CcnxNetDeviceFace : public CcnxFace
@@ -49,9 +53,12 @@
static TypeId GetTypeId (void);
/**
- * \brief Default constructor
+ * \brief Constructor
+ *
+ * \param netDevice a smart pointer to NetDevice object to which
+ * this face will be associate
*/
- CcnxNetDeviceFace ();
+ CcnxNetDeviceFace (const Ptr<NetDevice> &netDevice);
virtual ~CcnxNetDeviceFace();
////////////////////////////////////////////////////////////////////
@@ -64,13 +71,6 @@
////////////////////////////////////////////////////////////////////
/**
- * \brief Associate NetDevice object with face
- *
- * \param node smart pointer to a NetDevice object
- */
- void SetNetDevice (Ptr<NetDevice> node);
-
- /**
* \brief Get NetDevice associated with the face
*
* \returns smart pointer to NetDevice associated with the face
@@ -84,7 +84,7 @@
CcnxNetDeviceFace (const CcnxNetDeviceFace &); ///< \brief Disabled copy constructor
CcnxNetDeviceFace& operator= (const CcnxNetDeviceFace &); ///< \brief Disabled copy operator
- // callback
+ /// \brief callback from lower layers
void ReceiveFromNetDevice (Ptr<NetDevice> device,
Ptr<const Packet> p,
uint16_t protocol,
diff --git a/model/ccnx.h b/model/ccnx.h
index 1cbe428..412fd2e 100644
--- a/model/ccnx.h
+++ b/model/ccnx.h
@@ -90,7 +90,7 @@
* \param p the packet
*/
virtual void
- Receive (const Ptr<CcnxFace> &device, const Ptr<Packet> &p) = 0;
+ Receive (const Ptr<CcnxFace> &face, const Ptr<const Packet> &p) = 0;
/**
* \brief Register a new forwarding strategy to be used by this Ccnx