--- a/src/node/socket.cc Tue Apr 22 22:29:16 2008 -0700
+++ b/src/node/socket.cc Tue Apr 22 22:39:17 2008 -0700
@@ -86,6 +86,12 @@
m_receivedData = receivedData;
}
+int Socket::Listen (uint32_t queueLimit)
+{
+ return 0; //XXX the base class version does nothing
+}
+
+
int Socket::Send (const uint8_t* buf, uint32_t size)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -116,12 +122,6 @@
return SendTo (address,p);
}
-int Socket::Listen(uint32_t queueLimit)
-{
- return 0; //XXX the base class version does nothing
-}
-
-
void
Socket::NotifyCloseCompleted (void)
{
--- a/src/node/socket.h Tue Apr 22 22:29:16 2008 -0700
+++ b/src/node/socket.h Tue Apr 22 22:39:17 2008 -0700
@@ -38,9 +38,11 @@
* \brief Define a Socket API based on the BSD Socket API.
*
* Contrary to the original BSD socket API, this API is asynchronous:
- * it does not contain blocking calls. Other than that, it tries to stick
- * to the BSD API to make it easier those who know the BSD API to use
- * this API.
+ * it does not contain blocking calls. It also uses class ns3::Packet
+ * as a fancy byte buffer, allowing data to be passed across the API
+ * using an ns3::Packet instead of a raw data pointer. Other than that,
+ * it tries to stick to the BSD API to make it easier for those who know
+ * the BSD API to use this API.
*/
class Socket : public Object
{
@@ -94,8 +96,8 @@
* Or when I call Close ?
*/
void SetConnectCallback (Callback<void, Ptr<Socket> > connectionSucceeded,
- Callback<void, Ptr<Socket> > connectionFailed,
- Callback<void, Ptr<Socket> > halfClose);
+ Callback<void, Ptr<Socket> > connectionFailed,
+ Callback<void, Ptr<Socket> > halfClose);
/**
* \brief Accept connection requests from remote hosts
* \param connectionRequest Callback for connection request from peer.
@@ -138,10 +140,8 @@
*
* This callback is intended to notify a
* socket that would have been blocked in a blocking socket model
- * that some data has been acked and removed from the transmit
- * buffer, and that it can call send again. The semantics for
- * reliable stream sockets are that when data is acked and removed
- * from the transmit buffer, this callback is invoked.
+ * that space is available in the transmit buffer and that it
+ * can call Send() again.
*
* \param sendCb Callback for the event that the socket transmit buffer
* fill level has decreased. This callback is passed a pointer to
@@ -179,7 +179,7 @@
* After the Close call, the socket is no longer valid, and cannot
* safely be used for subsequent operations.
*/
- virtual int Close(void) = 0;
+ virtual int Close (void) = 0;
/**
* \returns zero on success, -1 on failure.
@@ -201,9 +201,16 @@
* \brief Initiate a connection to a remote host
* \param address Address of remote.
*/
- virtual int Connect(const Address &address) = 0;
+ virtual int Connect (const Address &address) = 0;
/**
+ * \brief Listen for incoming connections.
+ * \param queueLimit maximum number of incoming request to queue
+ * \returns XXX an error code
+ */
+ virtual int Listen (uint32_t queueLimit);
+
+ /**
* \brief Send data (or dummy data) to the remote host
* \param p packet to send
* \returns -1 in case of error or the number of bytes copied in the
@@ -229,14 +236,7 @@
* \returns -1 in case of error or the number of bytes copied in the
* internal buffer and accepted for transmission.
*/
- virtual int SendTo(const Address &address,Ptr<Packet> p) = 0;
-
- /**
- * \brief Listen for incoming connections.
- * \param queueLimit maximum number of incoming request to queue
- * \returns XXX an error code
- */
- virtual int Listen(uint32_t queueLimit);
+ virtual int SendTo (const Address &address,Ptr<Packet> p) = 0;
/**
* \brief Send data to a specified peer.
@@ -250,7 +250,7 @@
* This is provided so as to have an API which is closer in appearance
* to that of real network or BSD sockets.
*/
- int SendTo(const Address &address, const uint8_t* buf, uint32_t size);
+ int SendTo (const Address &address, const uint8_t* buf, uint32_t size);
protected:
void NotifyCloseCompleted (void);