[Doxygen] fd-net-device module fixes

This commit is contained in:
Tommaso Pecorella
2015-05-24 09:58:19 +02:00
parent 06835eb89d
commit f5147ff55e
10 changed files with 114 additions and 34 deletions

View File

@@ -38,6 +38,7 @@
namespace ns3 {
/// Flag to enable / disable verbose log mode
int gVerbose = 0;
/**

View File

@@ -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

View File

@@ -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.

View File

@@ -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<NetDevice> InstallPriv (Ptr<Node> 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;

View File

@@ -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<NetDevice> InstallPriv (Ptr<Node> 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<OutputStreamWrapper> stream,
std::string prefix,
Ptr<NetDevice> nd,
bool explicitFilename);
ObjectFactory m_deviceFactory;
ObjectFactory m_deviceFactory; //!< factory for the NetDevices
};
} // namespace ns3

View File

@@ -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<NetDevice> InstallPriv (Ptr<Node> node) const;
/**

View File

@@ -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

View File

@@ -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<NetDevice> InstallPriv (Ptr<Node> node) const;
/**

View File

@@ -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)
{

View File

@@ -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<Packet> p);
/**
* Notify that the link is up and ready
*/
void NotifyLinkUp (void);
/**
@@ -215,7 +238,7 @@ private:
*/
Ptr<Node> 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;
/**