Bugzilla – Bug 213
Socket::RecvFrom come back
Last modified: 2008-07-01 13:32:36 UTC
Thread here: http://www.nabble.com/Missing-Socket::RecvFrom-td17667357.html
Created attachment 149 [details] patch
but I thought it would be named RecvFrom() ?
(In reply to comment #2) > but I thought it would be named RecvFrom() ? So did I! :-S It was a mistake; thanks for catching it! :-/
Created attachment 154 [details] patch with correct name
Created attachment 159 [details] 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
add a repo for this http://code.nsnam.org/tomh/ns-3-dev-bug-213
merged tom's repo.