[Ns-bugs] [Bug 213] Socket::RecvFrom come back

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Mon Jun 9 06:17:55 PDT 2008


http://www.nsnam.org/bugzilla/show_bug.cgi?id=213





------- Comment #5 from tomh at tomh.org  2008-06-09 09:17 -------
Created an attachment (id=159)
 --> (http://www.nsnam.org/bugzilla/attachment.cgi?id=159&action=view)
revised RecvFrom patch with additional cleanup

In the course of working on RecvFrom, I also did some additional cleanup which
resulted in (IMO) minor API change:  addition of "flags" argument to some Send
calls, and rename the Address tag to make it apply to sending and receiving
calls.

The attached patch is big, so here is a brief summary of proposed socket API
changes

--- ns-3-dev/src/node/socket.h  2008-06-07 07:20:22.000000000 -0700
+++ ns-3-dev-bug-213/src/node/socket.h  2008-06-07 07:09:33.000000000 -0700

1.  Add flags argument to Send and SendTo methods.  This will be needed
    to support MSG_DONTROUTE option in future.

-  virtual int Send (Ptr<Packet> p) = 0;
+  virtual int Send (Ptr<Packet> p, uint32_t flags) = 0;

-  virtual int SendTo (Ptr<Packet> p, const Address &address) = 0;
+  virtual int SendTo (Ptr<Packet> p, uint32_t flags,
+    const Address &toAddress) = 0;

-  int Send (const uint8_t* buf, uint32_t size);
+  int Send (const uint8_t* buf, uint32_t size, uint32_t flags);

-  int SendTo (const uint8_t* buf, uint32_t size, const Address &address);
+  int SendTo (const uint8_t* buf, uint32_t size, uint32_t flags,
+              const Address &toAddress);

2.  Restore previous API (for the Send() method), allowing for flags to
    be an optional argument if it is zero (typically)

+  int Send (Ptr<Packet> p);

3. Add RecvFrom()

+  virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags,
+    Address &fromAddress) = 0;

+  int RecvFrom (uint8_t* buf, uint32_t size, uint32_t flags,
+                Address &fromAddress);

4.  Add version with no flags and maxSize arguments, similar to the
    Recv() variant.

+  Ptr<Packet> RecvFrom (Address &fromAddress);

5.  Rename SocketRxAddressTag to SocketAddressTag, since it could
    be used for sending an address

-class SocketRxAddressTag : public Tag
+class SocketAddressTag : public Tag


-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Ns-bugs mailing list