diff --git a/src/fd-net-device/helper/creator-utils.cc b/src/fd-net-device/helper/creator-utils.cc index f03f22c63..81b21a2c0 100644 --- a/src/fd-net-device/helper/creator-utils.cc +++ b/src/fd-net-device/helper/creator-utils.cc @@ -38,6 +38,7 @@ namespace ns3 { +/// Flag to enable / disable verbose log mode int gVerbose = 0; /** diff --git a/src/fd-net-device/helper/creator-utils.h b/src/fd-net-device/helper/creator-utils.h index 907115f4a..884eb05e3 100644 --- a/src/fd-net-device/helper/creator-utils.h +++ b/src/fd-net-device/helper/creator-utils.h @@ -54,6 +54,7 @@ extern int gVerbose; } /** + * \ingroup fd-net-device * \brief Send the file descriptor back to the code that invoked the creation. * * \param path The socket address information from the Unix socket we use diff --git a/src/fd-net-device/helper/emu-fd-net-device-helper.cc b/src/fd-net-device/helper/emu-fd-net-device-helper.cc index a402d00cb..fd6fc182f 100644 --- a/src/fd-net-device/helper/emu-fd-net-device-helper.cc +++ b/src/fd-net-device/helper/emu-fd-net-device-helper.cc @@ -339,7 +339,7 @@ EmuFdNetDeviceHelper::CreateFileDescriptor (void) const // // First, we're going to allocate a buffer on the stack to receive our // data array (that contains the socket). Sometimes you'll see this called - // an "ancillary element" but the msghdr uses the control message termimology + // an "ancillary element" but the msghdr uses the control message terminology // so we call it "control." // size_t msg_size = sizeof(int); @@ -350,7 +350,7 @@ EmuFdNetDeviceHelper::CreateFileDescriptor (void) const // passed to recvmsg (which we will use to receive our ancillary data). // This structure uses terminology corresponding to control messages, so // you'll see msg_control, which is the pointer to the ancillary data and - // controllen which is the size of the ancillary data array. + // controller which is the size of the ancillary data array. // // So, initialize the message header that describes the ancillary/control // data we expect to receive and point it to buffer. diff --git a/src/fd-net-device/helper/emu-fd-net-device-helper.h b/src/fd-net-device/helper/emu-fd-net-device-helper.h index 21adfc205..089bea6e3 100644 --- a/src/fd-net-device/helper/emu-fd-net-device-helper.h +++ b/src/fd-net-device/helper/emu-fd-net-device-helper.h @@ -32,6 +32,7 @@ namespace ns3 { /** + * \ingroup fd-net-device * \brief build a set of FdNetDevice objects attached to a physical network * interface * @@ -63,6 +64,13 @@ public: protected: + /** + * This method creates an ns3::FdNetDevice attached to a physical network + * interface + * + * \param node The node to install the device in + * \returns A container holding the added net device. + */ Ptr InstallPriv (Ptr node) const; /** @@ -73,6 +81,7 @@ protected: /** * Call out to a separate process running as suid root in order to get a raw * socket. We do this to avoid having the entire simulation running as root. + * \return the rawSocket number */ virtual int CreateFileDescriptor (void) const; diff --git a/src/fd-net-device/helper/fd-net-device-helper.h b/src/fd-net-device/helper/fd-net-device-helper.h index ba412f077..e1447fa2d 100644 --- a/src/fd-net-device/helper/fd-net-device-helper.h +++ b/src/fd-net-device/helper/fd-net-device-helper.h @@ -34,6 +34,7 @@ namespace ns3 { /** + * \ingroup fd-net-device * \brief build a set of FdNetDevice objects * Normally we eschew multiple inheritance, however, the classes * PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are @@ -91,6 +92,12 @@ public: protected: + /** + * This method creates an ns3::FdNetDevice and associates it to a node + * + * \param node The node to install the device in + * \returns A container holding the added net device. + */ virtual Ptr InstallPriv (Ptr node) const; private: @@ -116,13 +123,14 @@ private: * \param stream The output stream object to use when logging ascii traces. * \param prefix Filename prefix to use for ascii trace files. * \param nd Net device for which you want to enable tracing. + * \param explicitFilename Treat the prefix as an explicit filename if true */ virtual void EnableAsciiInternal (Ptr stream, std::string prefix, Ptr nd, bool explicitFilename); - ObjectFactory m_deviceFactory; + ObjectFactory m_deviceFactory; //!< factory for the NetDevices }; } // namespace ns3 diff --git a/src/fd-net-device/helper/planetlab-fd-net-device-helper.h b/src/fd-net-device/helper/planetlab-fd-net-device-helper.h index 33fba259f..9494a5a3e 100644 --- a/src/fd-net-device/helper/planetlab-fd-net-device-helper.h +++ b/src/fd-net-device/helper/planetlab-fd-net-device-helper.h @@ -36,6 +36,7 @@ namespace ns3 { /** + * \ingroup fd-net-device * \brief build a set of FdNetDevice objects attached to a virtual TAP network * interface * @@ -67,6 +68,13 @@ public: protected: + /** + * This method creates an ns3::FdNetDevice attached to a virtual TAP network + * interface + * + * \param node The node to install the device in + * \returns A container holding the added net device. + */ Ptr InstallPriv (Ptr node) const; /** diff --git a/src/fd-net-device/helper/tap-device-creator.cc b/src/fd-net-device/helper/tap-device-creator.cc index 39b572202..056bfea01 100644 --- a/src/fd-net-device/helper/tap-device-creator.cc +++ b/src/fd-net-device/helper/tap-device-creator.cc @@ -52,10 +52,13 @@ using namespace ns3; +/** + * Struct holding IPv6 address data + */ struct in6_ifreq { - struct in6_addr ifr6_addr; - uint32_t ifr6_prefixlen; - int32_t ifr6_ifindex; + struct in6_addr ifr6_addr; //!< IPv6 address + uint32_t ifr6_prefixlen; //!< IPv6 prefix length + int32_t ifr6_ifindex; //!< interface index }; char diff --git a/src/fd-net-device/helper/tap-fd-net-device-helper.h b/src/fd-net-device/helper/tap-fd-net-device-helper.h index 9d328a716..ece818e0b 100644 --- a/src/fd-net-device/helper/tap-fd-net-device-helper.h +++ b/src/fd-net-device/helper/tap-fd-net-device-helper.h @@ -34,7 +34,8 @@ namespace ns3 { /** - * \brief build a set of FdNetDevice objects attached to a virtua TAP network + * \ingroup fd-net-device + * \brief build a set of FdNetDevice objects attached to a virtual TAP network * interface * */ @@ -93,6 +94,13 @@ public: protected: + /** + * This method creates an ns3::FdNetDevice attached to a virtual TAP network + * interface + * + * \param node The node to install the device in + * \returns A container holding the added net device. + */ Ptr InstallPriv (Ptr node) const; /** diff --git a/src/fd-net-device/model/fd-net-device.cc b/src/fd-net-device/model/fd-net-device.cc index d1ccf6dc4..5cbe9d060 100644 --- a/src/fd-net-device/model/fd-net-device.cc +++ b/src/fd-net-device/model/fd-net-device.cc @@ -303,9 +303,16 @@ FdNetDevice::ReceiveCallback (uint8_t *buf, ssize_t len) } } -/// \todo Consider having a instance member m_packetBuffer and using memmove -/// instead of memcpy to add the PI header. -/// It might be faster in this case to use memmove and avoid the extra mallocs. +/** + * \ingroup fd-net-device + * \brief Synthesize PI header for the kernel + * \param buf the buffer to add the header to + * \param len the buffer length + * + * \todo Consider having a instance member m_packetBuffer and using memmove + * instead of memcpy to add the PI header. It might be faster in this case + * to use memmove and avoid the extra mallocs. + */ static void AddPIHeader (uint8_t *&buf, ssize_t &len) { @@ -342,6 +349,12 @@ AddPIHeader (uint8_t *&buf, ssize_t &len) buf = buf2; } +/** + * \ingroup fd-net-device + * \brief Removes PI header + * \param buf the buffer to add the header to + * \param len the buffer length + */ static void RemovePIHeader (uint8_t *&buf, ssize_t &len) { diff --git a/src/fd-net-device/model/fd-net-device.h b/src/fd-net-device/model/fd-net-device.h index 38d653539..2ba02431d 100644 --- a/src/fd-net-device/model/fd-net-device.h +++ b/src/fd-net-device/model/fd-net-device.h @@ -40,27 +40,6 @@ namespace ns3 { -class FdNetDeviceFdReader : public FdReader -{ -public: - /** - * Constructor for the FdNetDevice. - */ - FdNetDeviceFdReader (); - - /** - * Set size of the read buffer. - * - */ - void SetBufferSize (uint32_t bufferSize); - -private: - FdReader::Data DoRead (void); - - uint32_t m_bufferSize; -}; - -class Node; /** * \defgroup fd-net-device File Descriptor Network Device @@ -68,6 +47,31 @@ class Node; * For a generic functional description, please refer to the ns-3 manual. */ +/** + * \ingroup fd-net-device + * \brief This class performs the actual data reading from the sockets. + */ +class FdNetDeviceFdReader : public FdReader +{ +public: + FdNetDeviceFdReader (); + + /** + * Set size of the read buffer. + */ + void SetBufferSize (uint32_t bufferSize); + +private: + /** + * Reads data from the socket + */ + FdReader::Data DoRead (void); + + uint32_t m_bufferSize; //!< size of the read buffer +}; + +class Node; + /** * \ingroup fd-net-device * @@ -82,6 +86,10 @@ class Node; class FdNetDevice : public NetDevice { public: + /** + * \brief Get the type ID. + * \return the object TypeId + */ static TypeId GetTypeId (void); /** @@ -170,15 +178,27 @@ public: virtual bool SupportsSendFrom () const; virtual Address GetMulticast (Ipv6Address addr) const; + /** + * Set if the NetDevice is able to send Broadcast messages + * \param broadcast true if the NetDevice can send Broadcast + */ virtual void SetIsBroadcast (bool broadcast); + /** + * Set if the NetDevice is able to send Multicast messages + * \param multicast true if the NetDevice can send Multicast + */ virtual void SetIsMulticast (bool multicast); protected: virtual void DoDispose (void); private: - // private copy constructor as sugested in: - // http://www.nsnam.org/wiki/NS-3_Python_Bindings#.22invalid_use_of_incomplete_type.22 + /** + * \brief Copy constructor + * + * Defined and unimplemented to avoid misuse as suggested in + * http://www.nsnam.org/wiki/NS-3_Python_Bindings#.22invalid_use_of_incomplete_type.22 + */ FdNetDevice (FdNetDevice const &); /** @@ -208,6 +228,9 @@ private: */ bool TransmitStart (Ptr p); + /** + * Notify that the link is up and ready + */ void NotifyLinkUp (void); /** @@ -215,7 +238,7 @@ private: */ Ptr m_node; - /* + /** * a copy of the node id so the read thread doesn't have to GetNode() in * in order to find the node ID. Thread unsafe reference counting in * multithreaded apps is not a good thing. @@ -301,7 +324,13 @@ private: */ Time m_tStop; + /** + * NetDevice start event + */ EventId m_startEvent; + /** + * NetDevice stop event + */ EventId m_stopEvent; /**