I expect ONE is some kind of NESCC generic innovation
mainly used to obfuscate the function of any code "one"
would like interpret.

You are correct that the body of that function does pointer
arithmetic in what appears to be the most convoluted way
possible as well. From the names in the function it would
seem that it should return a pointer to the cc2420_header
of the given msg. This could be misleading as those-who-
assigned-names might have been in some altered state. Is
there any doc that indicates what result should actually
be expected?

The confusing thing is that it appears to me that the
function returns the msg pointer itself in every case,
unless there is some sleight of hand in header stacking.

I expect that what you want is a pointer to your message
struct payload? There are getPayload sorts of accessors
hidden in various places of various versions of various
interfaces, but my most reliable technique is simply:

        mystruct* ms = (mystruct*) msg->data;

I realize that this is much to simple and might fail if
there are nested headers unknown to my application. But
if that's the case I'll accept the consequences...

MS


[email protected] wrote:
> Hello again,
> 
> I defined a new CC2420 Packet-Headerformat and now I'm trying to use  
> the message_t that's handed
> down from "unique send" in CC2420ActiveMessageP.nc and create a new  
> radiopacket with the original payload, but new header. I included the  
> new headerformat in the union platform_message.h.
> 
> The way I understand TEP 111, the next step would be to create a  
> packet interface for my new header. Is this correct? Or can I acces  
> those fields directly in CC2420ActiveMessageP.nc for simplicity?
> 
> To this effect I tried to understand what the following command from  
> CC2420PacketP.nc does:
> 
>    /***************** CC2420PacketBody Commands ****************/
>    async command cc2420_header_t * ONE CC2420PacketBody.getHeader(  
> message_t* ONE msg ) {
>      return TCAST(cc2420_header_t* ONE, (uint8_t *)msg +  
> offsetof(message_t, data) - sizeof( cc2420_header_t ));
>    }
> 
> Could someone please explain? What does ONE mean, what happens here? I  
> believe this is some pointer-arithmetic to find the beginning of the  
> header in the platform_message-Union which is right-justified to the  
> data, but I'm not sure.
> 
> Lastly how can I distinguish between headerformats when passing the  
> new packet to CC2420CsmaP??
> 
> Thank you
> 
> Tobias
> 
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to