bug 203: Listen must be implemented for Udp and Packet sockets.
--- a/src/internet-node/udp-socket-impl.cc Wed Jun 04 09:18:44 2008 -0700
+++ b/src/internet-node/udp-socket-impl.cc Wed Jun 04 09:19:16 2008 -0700
@@ -217,6 +217,13 @@
}
int
+UdpSocketImpl::Listen (uint32_t queueLimit)
+{
+ m_errno = Socket::ERROR_OPNOTSUPP;
+ return -1;
+}
+
+int
UdpSocketImpl::Send (Ptr<Packet> p)
{
NS_LOG_FUNCTION (this << p);
--- a/src/internet-node/udp-socket-impl.h Wed Jun 04 09:18:44 2008 -0700
+++ b/src/internet-node/udp-socket-impl.h Wed Jun 04 09:19:16 2008 -0700
@@ -57,6 +57,7 @@
virtual int ShutdownSend (void);
virtual int ShutdownRecv (void);
virtual int Connect(const Address &address);
+ virtual int Listen (uint32_t queueLimit);
virtual int Send (Ptr<Packet> p);
virtual int SendTo (Ptr<Packet> p, const Address &address);
virtual uint32_t GetTxAvailable (void) const;
--- a/src/node/packet-socket.cc Wed Jun 04 09:18:44 2008 -0700
+++ b/src/node/packet-socket.cc Wed Jun 04 09:19:16 2008 -0700
@@ -220,6 +220,12 @@
NotifyConnectionFailed ();
return -1;
}
+int
+PacketSocket::Listen(uint32_t queueLimit)
+{
+ m_errno = Socket::ERROR_OPNOTSUPP;
+ return -1;
+}
int
PacketSocket::Send (Ptr<Packet> p)
--- a/src/node/packet-socket.h Wed Jun 04 09:18:44 2008 -0700
+++ b/src/node/packet-socket.h Wed Jun 04 09:19:16 2008 -0700
@@ -71,6 +71,8 @@
* The fields "physical address", device, and protocol are filled.
*
* - Accept: not allowed
+ *
+ * - Listen: returns -1 (OPNOTSUPP)
*/
class PacketSocket : public Socket
{
@@ -90,6 +92,7 @@
virtual int ShutdownSend (void);
virtual int ShutdownRecv (void);
virtual int Connect(const Address &address);
+ virtual int Listen(uint32_t queueLimit);
virtual int Send (Ptr<Packet> p);
virtual uint32_t GetTxAvailable (void) const;
--- a/src/node/socket.cc Wed Jun 04 09:18:44 2008 -0700
+++ b/src/node/socket.cc Wed Jun 04 09:19:16 2008 -0700
@@ -103,12 +103,6 @@
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 ();
--- a/src/node/socket.h Wed Jun 04 09:18:44 2008 -0700
+++ b/src/node/socket.h Wed Jun 04 09:19:16 2008 -0700
@@ -231,9 +231,9 @@
/**
* \brief Listen for incoming connections.
* \param queueLimit maximum number of incoming request to queue
- * \returns XXX an error code
+ * \returns 0 on success, -1 on error (in which case errno is set).
*/
- virtual int Listen (uint32_t queueLimit);
+ virtual int Listen (uint32_t queueLimit) = 0;
/**
* \brief Send data (or dummy data) to the remote host