Bugzilla – Bug 117
provide char pointer-based API extension to socket
Last modified: 2007-12-13 09:47:08 UTC
from the meeting notes: - Add Send and SendTo methods to the socket API to accept char pointers; document that the callee immediately makes a copy of it. These are non-virtual and simply immediately create a Packet and pass it on to the corresponding Send(Packet) methods. (Raj)
Created attachment 93 [details] Patch to add uint8_t* based Send API to all sockets This is a simple non-virtual public API in the socket base class that creates a Packet with the contents of a uint8_t* style buffer, the forwards this along to the pure virtual Send(Packet p).
(In reply to comment #1) > Created an attachment (id=93) [edit] > Patch to add uint8_t* based Send API to all sockets > > This is a simple non-virtual public API in the socket base class that creates a > Packet with the contents of a uint8_t* style buffer, the forwards this along to > the pure virtual Send(Packet p). I thought you wanted to support the idiom of calling the Send method with a zero pointer: maybe you should add the necessary if statement to the Send method ? Also, it would be nice to add the necessary doxygen to this new method which documents the bahavior in case the pointer is zero and/or the size is zero.
Created attachment 94 [details] Patch to add uint8_t* based Send API to all sockets (update 1) Additions: * Doxygen and support for dummy data sending on buf=0 calls * SendTo(Address&, uint8_t*, uint32_t). Comments: I didn't document what happens when size=0 because I'm not sure. It comes down to what the behavior of Buffer::AddAtStart(0) is. I didn't try too hard to understand the Buffer implementation...I'm hoping Mathieu could answer about the behavior of this call.
(In reply to comment #3) > I didn't document what happens when size=0 because I'm not sure. It comes down > to what the behavior of Buffer::AddAtStart(0) is. I didn't try too hard to > understand the Buffer implementation...I'm hoping Mathieu could answer about > the behavior of this call. It should not do anything.
this patch seems fine to commit now (TCP will depend on this) except that it should align with the coding std that has space between function name and first parenthesis
Created attachment 97 [details] Patch to add uint8_t* based Send API to all sockets (update 2, final) I've made cosmetic changes to spacing for alignment with the coding style. I'll merge this into ns-3-dev after 5:00 PM EST unless there further comments.
Closing out bug (patch pushed).