bug 203: Listen must be implemented for Udp and Packet sockets.
1.1 --- a/src/internet-node/udp-socket-impl.cc Wed Jun 04 09:18:44 2008 -0700
1.2 +++ b/src/internet-node/udp-socket-impl.cc Wed Jun 04 09:19:16 2008 -0700
1.3 @@ -217,6 +217,13 @@
1.4 }
1.5
1.6 int
1.7 +UdpSocketImpl::Listen (uint32_t queueLimit)
1.8 +{
1.9 + m_errno = Socket::ERROR_OPNOTSUPP;
1.10 + return -1;
1.11 +}
1.12 +
1.13 +int
1.14 UdpSocketImpl::Send (Ptr<Packet> p)
1.15 {
1.16 NS_LOG_FUNCTION (this << p);
2.1 --- a/src/internet-node/udp-socket-impl.h Wed Jun 04 09:18:44 2008 -0700
2.2 +++ b/src/internet-node/udp-socket-impl.h Wed Jun 04 09:19:16 2008 -0700
2.3 @@ -57,6 +57,7 @@
2.4 virtual int ShutdownSend (void);
2.5 virtual int ShutdownRecv (void);
2.6 virtual int Connect(const Address &address);
2.7 + virtual int Listen (uint32_t queueLimit);
2.8 virtual int Send (Ptr<Packet> p);
2.9 virtual int SendTo (Ptr<Packet> p, const Address &address);
2.10 virtual uint32_t GetTxAvailable (void) const;
3.1 --- a/src/node/packet-socket.cc Wed Jun 04 09:18:44 2008 -0700
3.2 +++ b/src/node/packet-socket.cc Wed Jun 04 09:19:16 2008 -0700
3.3 @@ -220,6 +220,12 @@
3.4 NotifyConnectionFailed ();
3.5 return -1;
3.6 }
3.7 +int
3.8 +PacketSocket::Listen(uint32_t queueLimit)
3.9 +{
3.10 + m_errno = Socket::ERROR_OPNOTSUPP;
3.11 + return -1;
3.12 +}
3.13
3.14 int
3.15 PacketSocket::Send (Ptr<Packet> p)
4.1 --- a/src/node/packet-socket.h Wed Jun 04 09:18:44 2008 -0700
4.2 +++ b/src/node/packet-socket.h Wed Jun 04 09:19:16 2008 -0700
4.3 @@ -71,6 +71,8 @@
4.4 * The fields "physical address", device, and protocol are filled.
4.5 *
4.6 * - Accept: not allowed
4.7 + *
4.8 + * - Listen: returns -1 (OPNOTSUPP)
4.9 */
4.10 class PacketSocket : public Socket
4.11 {
4.12 @@ -90,6 +92,7 @@
4.13 virtual int ShutdownSend (void);
4.14 virtual int ShutdownRecv (void);
4.15 virtual int Connect(const Address &address);
4.16 + virtual int Listen(uint32_t queueLimit);
4.17 virtual int Send (Ptr<Packet> p);
4.18 virtual uint32_t GetTxAvailable (void) const;
4.19
5.1 --- a/src/node/socket.cc Wed Jun 04 09:18:44 2008 -0700
5.2 +++ b/src/node/socket.cc Wed Jun 04 09:19:16 2008 -0700
5.3 @@ -103,12 +103,6 @@
5.4 m_receivedData = receivedData;
5.5 }
5.6
5.7 -int Socket::Listen (uint32_t queueLimit)
5.8 -{
5.9 - return 0; //XXX the base class version does nothing
5.10 -}
5.11 -
5.12 -
5.13 int Socket::Send (const uint8_t* buf, uint32_t size)
5.14 {
5.15 NS_LOG_FUNCTION_NOARGS ();
6.1 --- a/src/node/socket.h Wed Jun 04 09:18:44 2008 -0700
6.2 +++ b/src/node/socket.h Wed Jun 04 09:19:16 2008 -0700
6.3 @@ -231,9 +231,9 @@
6.4 /**
6.5 * \brief Listen for incoming connections.
6.6 * \param queueLimit maximum number of incoming request to queue
6.7 - * \returns XXX an error code
6.8 + * \returns 0 on success, -1 on error (in which case errno is set).
6.9 */
6.10 - virtual int Listen (uint32_t queueLimit);
6.11 + virtual int Listen (uint32_t queueLimit) = 0;
6.12
6.13 /**
6.14 * \brief Send data (or dummy data) to the remote host