On Aug 4, 2009, at 1:59 PM, Jacob Sorber wrote:

> So, the problem is that Packet.clear does different things in
> SerialActiveMessageP and XE1205SendReceiveP.  In the first it just
> clears the headers, in the later it clears the entire message_t.  So,
> instead of resetting the headers as is intended in BaseStation, it
> blows away the payload it is trying to forward.
>
> Nice.  What are the semantics for the Packet.clear command supposed to
> be?  From the comments in Packet.nc (tos/interfaces) it seems that the
> XE1205SendReceiveP has it right and BaseStation is using clear
> incorrectly, but since it isn't completely explicit, I guess it could
> go either way.
>
> I'll hack something up for myself, but I am interested to know what
> the "right" way to fix it is.

I've checked in the fix. Basically, you need to change the function  
from clearing the entire buffer to clearing only the protocol header,  
footer, and metadata. So,

     command void Packet.clear(message_t* msg) {
         memset(msg, 0, sizeof(message_t));
     }

becomes

     command void Packet.clear(message_t* msg) {
       memset(getHeader(msg), 0, sizeof(xe1205_header_t));
       memset(getFooter(msg), 0, sizeof(xe1205_footer_t));
       memset(getMetadata(msg), 0, sizeof(xe1205_metadata_t));
     }

Does that make sense?

Phil

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to