Hello om_p :
yes , you are right , when the user send the data , he does not put the
data at the beginning of the payload of the message_t , but an offset whose
length is the size of the ctp_header . i understand .
another question :
maybe i have asked the question to someone , but i can't find it . you
use " nx_uint8_t data[0] " in ctp_data_header , what is the function of
this field ? because it's size is zero . is it similar to a pointer ?
thank you !
2008/7/11 Omprakash Gnawali <[EMAIL PROTECTED]>:
> On Wed, Jul 9, 2008 at 8:15 PM, jiwen zhang <[EMAIL PROTECTED]>
> wrote:
> > Hello Omprakash :
> >
> > I have a question about the code in the file CtpForwardingEngineP.nc
> >
> > In the implementation of Send.send , you use "hdr = getHeader(msg)"
> to
> > make hdr point to the payload field of the msg in order to inset the ctp
> > header before the "user's data" , and then you give the values to the
> > fields of the data structure of ctp_data_header_t . does these
> operations
> > will destroy the "user's data" ?
> > becase the CTP works well , so i think the "user's data" is not destroied
> ,
> > i don't know why .
> > because the function of getHeader is :
> > ctp_data_header_t* getHeader(message_t* m) {
> > return (ctp_data_header_t*)call SubPacket.getPayload(m,
> > sizeof(ctp_data_header_t));
> > }
> > so the returned pointer points to the user's data , so when you evaluate
> to
> > the fields , it shoud destroy the original datas according to my
> > understanding to the pointer . why ? can you give me an explain ?
>
> CTP data header is in the payload section of the link layer packet.
> What the code fragment above does is get a pointer to the link layer
> payload (SubPacket gives you access to the link layer packet) and cast
> the return value as a ctp_data_header_t. The user data would appear
> immediately after the CTP data header in the link layer payload
> section so by assigning values to the fields of CTP data header, we
> are not touching the user data.
>
> - om_p
>
--
zhang jiwen
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help