diff --git i/src/point-to-point/helper/point-to-point-helper.h w/src/point-to-point/helper/point-to-point-helper.h index 55dea00..6b09507 100644 --- i/src/point-to-point/helper/point-to-point-helper.h +++ w/src/point-to-point/helper/point-to-point-helper.h @@ -42,7 +42,8 @@ class Node; * PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are * "mixins". */ -class PointToPointHelper : public PcapHelperForDevice, public AsciiTraceHelperForDevice +class PointToPointHelper : public PcapHelperForDevice, + public AsciiTraceHelperForDevice { public: /** @@ -102,6 +103,7 @@ public: /** * \param c a set of nodes + * \return a NetDeviceContainer for nodes * * This method creates a ns3::PointToPointChannel with the * attributes configured by PointToPointHelper::SetChannelAttribute, @@ -115,6 +117,7 @@ public: /** * \param a first node * \param b second node + * \return a NetDeviceContainer for nodes * * Saves you from having to construct a temporary NodeContainer. * Also, if MPI is enabled, for distributed simulations, @@ -125,6 +128,7 @@ public: /** * \param a first node * \param bName name of second node + * \return a NetDeviceContainer for nodes * * Saves you from having to construct a temporary NodeContainer. */ @@ -133,6 +137,7 @@ public: /** * \param aName Name of first node * \param b second node + * \return a NetDeviceContainer for nodes * * Saves you from having to construct a temporary NodeContainer. */ @@ -141,6 +146,7 @@ public: /** * \param aNode Name of first node * \param bNode Name of second node + * \return a NetDeviceContainer for nodes * * Saves you from having to construct a temporary NodeContainer. */ @@ -178,10 +184,10 @@ private: Ptr nd, bool explicitFilename); - ObjectFactory m_queueFactory; - ObjectFactory m_channelFactory; - ObjectFactory m_remoteChannelFactory; - ObjectFactory m_deviceFactory; + ObjectFactory m_queueFactory; //!< Queue Factory + ObjectFactory m_channelFactory; //!< Channel Factory + ObjectFactory m_remoteChannelFactory; //!< Remote Channel Factory + ObjectFactory m_deviceFactory; //!< Device Factory }; } // namespace ns3 diff --git i/src/point-to-point/model/point-to-point-channel.h w/src/point-to-point/model/point-to-point-channel.h index 4b0b777..1b88a49 100644 --- i/src/point-to-point/model/point-to-point-channel.h +++ w/src/point-to-point/model/point-to-point-channel.h @@ -43,17 +43,25 @@ class Packet; * There are two "wires" in the channel. The first device connected gets the * [0] wire to transmit on. The second device gets the [1] wire. There is a * state (IDLE, TRANSMITTING) associated with each wire. + * + * \see Attach + * \see TransmitStart */ -class PointToPointChannel : public Channel +class PointToPointChannel : public Channel { public: + /** + * \brief Get the TypeId + * + * \return The TypeId for this class + */ static TypeId GetTypeId (void); /** * \brief Create a PointToPointChannel * - * By default, you get a channel that - * has zero transmission delay. + * By default, you get a channel that has an "infitely" fast + * transmission speed and zero delay. */ PointToPointChannel (); @@ -78,14 +86,14 @@ public: */ virtual uint32_t GetNDevices (void) const; - /* + /** * \brief Get PointToPointNetDevice corresponding to index i on this channel * \param i Index number of the device requested * \returns Ptr to PointToPointNetDevice requested */ Ptr GetPointToPointDevice (uint32_t i) const; - /* + /** * \brief Get NetDevice corresponding to index i on this channel * \param i Index number of the device requested * \returns Ptr to NetDevice requested @@ -93,19 +101,19 @@ public: virtual Ptr GetDevice (uint32_t i) const; protected: - /* + /** * \brief Get the delay associated with this channel * \returns Time delay */ Time GetDelay (void) const; - /* + /** * \brief Check to make sure the link is initialized * \returns true if initialized, asserts otherwise */ bool IsInitialized (void) const; - /* + /** * \brief Get the net-device source * \param i the link requested * \returns Ptr to PointToPointNetDevice source for the @@ -113,7 +121,7 @@ protected: */ Ptr GetSource (uint32_t i) const; - /* + /** * \brief Get the net-device destination * \param i the link requested * \returns Ptr to PointToPointNetDevice destination for @@ -122,11 +130,11 @@ protected: Ptr GetDestination (uint32_t i) const; private: - // Each point to point link has exactly two net devices - static const int N_DEVICES = 2; + static const int N_DEVICES = 2; //!< Each point to point link has + // exactly two net devices - Time m_delay; - int32_t m_nDevices; + Time m_delay; //!< Propagation delay + int32_t m_nDevices; //!< Devices of this channel /** * The trace source for the packet transmission animation events that the @@ -135,7 +143,7 @@ private: * net device, receiving net device, transmission time and * packet receipt time. * - * @see class CallBackTraceSource + * \see class CallBackTraceSource */ TracedCallback, // Packet being transmitted Ptr, // Transmitting NetDevice @@ -144,24 +152,36 @@ private: Time // Last bit receive time (relative to now) > m_txrxPointToPoint; + /** \brief Wire states + * + */ enum WireState { - INITIALIZING, - IDLE, - TRANSMITTING, - PROPAGATING + INITIALIZING, //!< Initializing state + IDLE, //!< Idle state (no transmission from NetDevice) + TRANSMITTING, //!< Transmitting state (data being transmitted from + // NetDevice + PROPAGATING //!< Propagating state (data is being propagated in the + // channel }; + /** + * \brief Wire model for the PointToPointChannel + */ class Link { -public: + public: + /** \brief Create the link, it will be in INITIALIZING state + * + */ Link() : m_state (INITIALIZING), m_src (0), m_dst (0) {} - WireState m_state; - Ptr m_src; - Ptr m_dst; + + WireState m_state; //!< State of the link + Ptr m_src; //!< First NetDevice + Ptr m_dst; //!< Second NetDevice }; - Link m_link[N_DEVICES]; + Link m_link[N_DEVICES]; //!< Link model }; } // namespace ns3 diff --git i/src/point-to-point/model/point-to-point-net-device.h w/src/point-to-point/model/point-to-point-net-device.h index 896b3dc..c8705f8 100644 --- i/src/point-to-point/model/point-to-point-net-device.h +++ w/src/point-to-point/model/point-to-point-net-device.h @@ -39,7 +39,11 @@ class ErrorModel; /** * \defgroup point-to-point Point-To-Point Network Device - * This section documents the API of the ns-3 point-to-point module. For a generic functional description, please refer to the ns-3 manual. + * This section documents the API of the ns-3 point-to-point module. For a + * functional description, please refer to the ns-3 manual here: + * http://www.nsnam.org/docs/models/html/point-to-point.html + * + * Be sure to read the manual BEFORE going down to the API. */ /** @@ -54,10 +58,20 @@ class ErrorModel; * Key parameters or objects that can be specified for this device * include a queue, data rate, and interframe transmission gap (the * propagation delay is set in the PointToPointChannel). + * + * \see SetDataRate + * \see SetInterframeGap + * \see SetReceiveErrorModel + * */ class PointToPointNetDevice : public NetDevice { public: + /** + * \brief Get the TypeId + * + * \return The TypeId for this class + */ static TypeId GetTypeId (void); /** @@ -81,8 +95,8 @@ public: * set in the Attach () method from the corresponding field in the channel * to which the device is attached. It can be overridden using this method. * - * @see Attach () - * @param bps the data rate at which this object operates + * \see Attach () + * \param bps the data rate at which this object operates */ void SetDataRate (DataRate bps); @@ -90,14 +104,15 @@ public: * Set the interframe gap used to separate packets. The interframe gap * defines the minimum space required between packets sent by this device. * - * @param t the interframe gap time + * \param t the interframe gap time */ void SetInterframeGap (Time t); /** * Attach the device to a channel. * - * @param ch Ptr to the channel to which this object is being attached. + * \param ch Ptr to the channel to which this object is being attached. + * \return true if the operation was successfull (always true actually) */ bool Attach (Ptr ch); @@ -107,16 +122,16 @@ public: * The PointToPointNetDevice "owns" a queue that implements a queueing * method such as DropTail or RED. * - * @see Queue - * @see DropTailQueue - * @param queue Ptr to the new queue. + * \see Queue + * \see DropTailQueue + * \param queue Ptr to the new queue. */ void SetQueue (Ptr queue); /** * Get a copy of the attached Queue. * - * @returns Ptr to the queue. + * \returns Ptr to the queue. */ Ptr GetQueue (void) const; @@ -126,8 +141,8 @@ public: * The PointToPointNetDevice may optionally include an ErrorModel in * the packet receive chain. * - * @see ErrorModel - * @param em Ptr to the ErrorModel. + * \see ErrorModel + * \param em Ptr to the ErrorModel. */ void SetReceiveErrorModel (Ptr em); @@ -139,8 +154,8 @@ public: * used by the channel to indicate that the last bit of a packet has * arrived at the device. * - * @see PointToPointChannel - * @param p Ptr to the received packet. + * \see PointToPointChannel + * \param p Ptr to the received packet. */ void Receive (Ptr p); @@ -186,13 +201,37 @@ public: virtual bool SupportsSendFrom (void) const; protected: + /** + * \brief Handler for MPI receive event + * + * \param p Packet received + */ void DoMpiReceive (Ptr p); private: - PointToPointNetDevice& operator = (const PointToPointNetDevice &); - PointToPointNetDevice (const PointToPointNetDevice &); + /** + * \brief Assign operator + * + * The method is private, so it is DISABLED. + * + * \param o Other NetDevice + * \return New instance of the NetDevice + */ + PointToPointNetDevice& operator = (const PointToPointNetDevice &o); + /** + * \brief Copy constructor + * + * The method is private, so it is DISABLED. + + * \param o Other NetDevice + */ + PointToPointNetDevice (const PointToPointNetDevice &o); + + /** + * \brief Dispose of the object + */ virtual void DoDispose (void); private: @@ -231,10 +270,10 @@ private: * started sending signals. An event is scheduled for the time at which * the bits have been completely transmitted. * - * @see PointToPointChannel::TransmitStart () - * @see TransmitCompleteEvent () - * @param p a reference to the packet to send - * @returns true if success, false on failure + * \see PointToPointChannel::TransmitStart () + * \see TransmitCompleteEvent () + * \param p a reference to the packet to send + * \returns true if success, false on failure */ bool TransmitStart (Ptr p); @@ -246,6 +285,11 @@ private: */ void TransmitComplete (void); + /** + * \brief Make the link up and running + * + * It calls also the linkChange callback. + */ void NotifyLinkUp (void); /** @@ -258,28 +302,28 @@ private: }; /** * The state of the Net Device transmit state machine. - * @see TxMachineState + * \see TxMachineState */ TxMachineState m_txMachineState; /** * The data rate that the Net Device uses to simulate packet transmission * timing. - * @see class DataRate + * \see class DataRate */ DataRate m_bps; /** * The interframe gap that the Net Device uses to throttle packet * transmission - * @see class Time + * \see class Time */ Time m_tInterframeGap; /** * The PointToPointChannel to which this PointToPointNetDevice has been * attached. - * @see class PointToPointChannel + * \see class PointToPointChannel */ Ptr m_channel; @@ -287,8 +331,8 @@ private: * The Queue which this PointToPointNetDevice uses as a packet source. * Management of this Queue has been delegated to the PointToPointNetDevice * and it has the responsibility for deletion. - * @see class Queue - * @see class DropTailQueue + * \see class Queue + * \see class DropTailQueue */ Ptr m_queue; @@ -431,25 +475,28 @@ private: */ TracedCallback > m_promiscSnifferTrace; - Ptr m_node; - Mac48Address m_address; - NetDevice::ReceiveCallback m_rxCallback; - NetDevice::PromiscReceiveCallback m_promiscCallback; - uint32_t m_ifIndex; - bool m_linkUp; - TracedCallback<> m_linkChangeCallbacks; + Ptr m_node; //!< Node owning this NetDevice + Mac48Address m_address; //!< Address of this NetDevice + NetDevice::ReceiveCallback m_rxCallback; //!< Receive callback + NetDevice::PromiscReceiveCallback m_promiscCallback; //!< Receive callback + // (promisc data) + uint32_t m_ifIndex; //!< Index of the interface + bool m_linkUp; //!< Identify if the link is up or not + TracedCallback<> m_linkChangeCallbacks; //!< Callback for the link change event - static const uint16_t DEFAULT_MTU = 1500; + static const uint16_t DEFAULT_MTU = 1500; //!< Default MTU /** - * The Maximum Transmission Unit. This corresponds to the maximum + * \brief The Maximum Transmission Unit + * + * This corresponds to the maximum * number of bytes that can be transmitted as seen from higher layers. * This corresponds to the 1500 byte MTU size often seen on IP over * Ethernet. */ uint32_t m_mtu; - Ptr m_currentPkt; + Ptr m_currentPkt; //!< Current packet processed /** * \brief PPP to Ethernet protocol number mapping diff --git i/src/point-to-point/model/point-to-point-remote-channel.h w/src/point-to-point/model/point-to-point-remote-channel.h index 450cd15..fd1a9a8 100644 --- i/src/point-to-point/model/point-to-point-remote-channel.h +++ w/src/point-to-point/model/point-to-point-remote-channel.h @@ -31,16 +31,46 @@ namespace ns3 { /** * \ingroup point-to-point + * + * \brief A Remote Point-To-Point Channel + * + * This object connects two point-to-point net devices where at least one + * is not local to this simulator object. It simply override the transmit + * method and uses an MPI Send operation instead. */ class PointToPointRemoteChannel : public PointToPointChannel { public: + /** + * \brief Get the TypeId + * + * \return The TypeId for this class + */ static TypeId GetTypeId (void); + + /** + * \brief Constructor + */ PointToPointRemoteChannel (); + + /** + * \brief Deconstructor + */ ~PointToPointRemoteChannel (); - virtual bool TransmitStart (Ptr p, Ptr src, Time txTime); + + /** + * \brief Transmit the packet + * + * \param p Packet to transmit + * \param src Source PointToPointNetDevice + * \param txTime Transmit time to apply + * \returns true if successful (currently always true) + */ + virtual bool TransmitStart (Ptr p, Ptr src, + Time txTime); }; -} + +} // namespace ns3 #endif diff --git i/src/point-to-point/model/ppp-header.h w/src/point-to-point/model/ppp-header.h index c881296..06b2f02 100644 --- i/src/point-to-point/model/ppp-header.h +++ w/src/point-to-point/model/ppp-header.h @@ -45,7 +45,7 @@ namespace ns3 { * to the packet. The ns-3 way to do this is via a class that inherits from * class Header. */ -class PppHeader : public Header +class PppHeader : public Header { public: @@ -59,8 +59,21 @@ public: */ virtual ~PppHeader (); + /** + * \brief Get the TypeId + * + * \return The TypeId for this class + */ static TypeId GetTypeId (void); + + /** + * \brief Get the TypeId of the instance + * + * \return The TypeId for this instance + */ virtual TypeId GetInstanceTypeId (void) const; + + virtual void Print (std::ostream &os) const; virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); diff --git i/src/point-to-point/test/point-to-point-test.cc w/src/point-to-point/test/point-to-point-test.cc index 42b83fd..a284337 100644 --- i/src/point-to-point/test/point-to-point-test.cc +++ w/src/point-to-point/test/point-to-point-test.cc @@ -6,14 +6,31 @@ using namespace ns3; +/** + * \brief Test class for PointToPoint model + * + * It tries to send one packet from one NetDevice to another, over a + * PointToPointChannel. + */ class PointToPointTest : public TestCase { public: + /** + * \brief Create the test + */ PointToPointTest (); + /** + * \brief Run the test + */ virtual void DoRun (void); private: + /** + * \brief Send one packet to the device specified + * + * \param device NetDevice to send to + */ void SendOnePacket (Ptr device); }; @@ -55,10 +72,16 @@ PointToPointTest::DoRun (void) Simulator::Destroy (); } -//----------------------------------------------------------------------------- + +/** + * \brief TestSuite for PointToPoint module + */ class PointToPointTestSuite : public TestSuite { public: + /** + * \brief Constructor + */ PointToPointTestSuite (); }; @@ -68,4 +91,4 @@ PointToPointTestSuite::PointToPointTestSuite () AddTestCase (new PointToPointTest, TestCase::QUICK); } -static PointToPointTestSuite g_pointToPointTestSuite; +static PointToPointTestSuite g_pointToPointTestSuite; //!< The testsuite