Bug 117

Summary: provide char pointer-based API extension to socket
Product: ns-3 Reporter: Tom Henderson <tomh>
Component: internetAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: raj.b
Priority: P3    
Version: pre-release   
Hardware: All   
OS: All   
Attachments: Patch to add uint8_t* based Send API to all sockets
Patch to add uint8_t* based Send API to all sockets (update 1)
Patch to add uint8_t* based Send API to all sockets (update 2, final)

Description Tom Henderson 2007-12-05 02:15: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)
Comment 1 Rajib Bhattacharjea 2007-12-05 11:50:01 UTC
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).
Comment 2 Mathieu Lacage 2007-12-05 12:04:00 UTC
(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.

Comment 3 Rajib Bhattacharjea 2007-12-06 13:09:50 UTC
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.
Comment 4 Mathieu Lacage 2007-12-07 02:07:29 UTC
(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.


Comment 5 Tom Henderson 2007-12-12 02:09:38 UTC
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
Comment 6 Rajib Bhattacharjea 2007-12-12 13:59:59 UTC
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.
Comment 7 Rajib Bhattacharjea 2007-12-13 09:47:08 UTC
Closing out bug (patch pushed).