A few minor cleanups to socket.h/cc

This commit is contained in:
Tom Henderson
2008-04-22 22:39:17 -07:00
parent 3752943c22
commit b998a05cce
2 changed files with 26 additions and 26 deletions

View File

@@ -86,6 +86,12 @@ Socket::SetRecvCallback (Callback<void, Ptr<Socket>, Ptr<Packet>,const Address&>
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 @@ int Socket::SendTo (const Address &address, const uint8_t* buf, uint32_t size)
return SendTo (address,p);
}
int Socket::Listen(uint32_t queueLimit)
{
return 0; //XXX the base class version does nothing
}
void
Socket::NotifyCloseCompleted (void)
{

View File

@@ -38,9 +38,11 @@ class Packet;
* \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 @@ public:
* 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 @@ public:
*
* 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 @@ public:
* 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,8 +201,15 @@ public:
* \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
@@ -229,14 +236,7 @@ public:
* \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 @@ public:
* 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);