[Tinyos Core WG] Issues with getPayload

Jan Hauer jan.hauer at gmail.com
Wed Nov 28 09:25:42 PST 2007


> 1) getPayload() does not consider the packet's footer size.
> getPayload() is "can I send a payload this big" not "can I get a
> payload this big without blowing away lower layer fields in the
> existing format."
>
> 2) getPayload() does consider the footer size. This requires that you
> call clear() before putting in a new payload.

A sort-of related question: upon receiving a packet I call
N=getPayloadLength() and then inspect the payload with
P1=getPayload(message,N). I now decide that I want to send a/the
message with a bigger (smaller) payload of size M and call
P2=getPayload(message,M) -- will P1==P2 ? I.e. can  I rely that the
additional M-N (N-M) are (de)allocated at (from) the end of my message
? The interface definition doesn't say... Returning pointers based on
the length parameter makes it more complicated for the app, but then
it allows to use variable header sizes (e.g. in IEEE 802.15.4, when
the next higher layer wants to send more then the "safe payload" size,
it can try and succeed as long as the variable sized header fits in
front, but which cannot be decided when I call getPayload()). If we go
down this road (P1==P2 is not guaranteed), then we should probably
choose option 2).

Jan


On Nov 3, 2007 2:22 AM, Philip Levis <pal at cs.stanford.edu> wrote:
> So here's the problem. I have a link estimation layer called LEEP
> with a fixed length header and variable length footer.
>
> [ hdr | payload | footer ... ]
>
> The header has bits which say how long the footer is. When a user
> calls send, this layer sees how much space the payload leaves, and
> fills in a footer to take up that space. No problems there.
>
> The question is whether the size of the header should be respected
> when you call getPayload(). This is an issue when you receive a
> packet and then want to forward it with a larger payload. LEEP is
> going to fill in new footer fields. But when you call getPayload(),
> does it take the size of the received footer into account? If it
> does, then you can't send a larger payload unless there's some way to
> clear the header.
>
> We talked about it on the call, and saw two solutions:
>
> 1) getPayload() does not consider the packet's footer size.
> getPayload() is "can I send a payload this big" not "can I get a
> payload this big without blowing away lower layer fields in the
> existing format."
>
> 2) getPayload() does consider the footer size. This requires that you
> call clear() before putting in a new payload.
>
> Phil
>
>
> _______________________________________________
> Tinyos-2.0wg mailing list
> Tinyos-2.0wg at Mail.Millennium.Berkeley.EDU
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-2.0wg
>


More information about the Tinyos-2.0wg mailing list