diff --git a/src/internet-node/udp-impl.h b/src/internet-node/udp-impl.h index 3cccb0f31..7981335da 100644 --- a/src/internet-node/udp-impl.h +++ b/src/internet-node/udp-impl.h @@ -28,12 +28,26 @@ namespace ns3 { class UdpL4Protocol; +/** + * \brief Object to create UDP socket instances + * + * This class implements the API for UDP sockets. + * It is a socket factory (deriving from class SocketFactory) and can + * also hold global variables used to initialize newly created sockets, + * such as values that are set through the sysctl or proc interfaces in Linux. + */ class UdpImpl : public Udp { public: UdpImpl (Ptr udp); virtual ~UdpImpl (); + /** + * \return smart pointer to Socket + * + * Implements a method to create a UdpImpl-based socket and return + * a base class smart pointer to the socket. + */ virtual Ptr CreateSocket (void); protected: diff --git a/src/node/socket-factory.h b/src/node/socket-factory.h index 09b8c9cda..ae999adf3 100644 --- a/src/node/socket-factory.h +++ b/src/node/socket-factory.h @@ -28,6 +28,22 @@ namespace ns3 { class Socket; +/** + * \brief Object to create transport layer instances that provide a + * socket API to applications. + * + * This base class defines the API for creating sockets. + * The socket factory also can hold the global variables used to + * initialize newly created sockets, such as values that are + * set through the sysctl or proc interfaces in Linux. + + * If you want to write a new transport protocol accessible through + * sockets, you need to subclass this factory class, implement CreateSocket, + * instantiate the object, and aggregate it to the node. + * + * \see Udp + * \see UdpImpl + */ class SocketFactory : public Object { public: @@ -35,6 +51,11 @@ public: SocketFactory (); + /** + * \return smart pointer to Socket + * + * Base class method for creating socket instances. + */ virtual Ptr CreateSocket (void) = 0; }; diff --git a/src/node/udp.h b/src/node/udp.h index 408d77caf..d67dce768 100644 --- a/src/node/udp.h +++ b/src/node/udp.h @@ -27,6 +27,19 @@ namespace ns3 { class Socket; +/** + * \brief API to create UDP socket instances + * + * This abstract class defines the API for UDP sockets. + * This class also can hold the global default variables used to + * initialize newly created sockets, such as values that are + * set through the sysctl or proc interfaces in Linux. + + * All UDP implementations must provide an implementation of CreateSocket + * below. + * + * \see UdpImpl + */ class Udp : public SocketFactory { public: @@ -34,6 +47,12 @@ public: Udp (); + /** + * \return smart pointer to Socket + * + * API for creating socket instances; must be implemented by UDP + * implementations.. + */ virtual Ptr CreateSocket (void) = 0; };