your header should be the part of the actual payload, then it could look
like this:

  command void* Packet.getPayload(message_t* msg, uint8_t len) {
    void* payload = call SubPacket.getPayload(msg, len +
sizeof(your_header_t)*no_of_entries);

    if (payload != NULL) {
      payload +=  sizeof(your_header_t)*no_of_entries
    }
    return payload;
  }


On Wed, Dec 8, 2010 at 7:19 PM, Xiaohui Liu <[email protected]> wrote:

> Hi everyone,
>
> My packet has the following format:
> lower-layer header | my header | payload
>
> There exists a nx_union filed in the header, thus the header length is not
> fixed and the typical implementation of Packet.getPayload() may not work:
>
> command void* Packet.getPayload(message_t* msg, uint8_t len) {
> uint8_t* payload = call SubPacket.getPayload(msg, len +
> sizeof(data_header_t));
>  if (payload != NULL) {
>   payload += sizeof(data_header_t);
>  }
> return payload;
> }
>
> Can anyone give me some suggestion on how Packet.getPayload() can be
> implemented on variable length header? Thanks.
>
> --
> -Xiaohui Liu
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Wasif Masood
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to