Looks like the compiler is "helping" you by putting in a pad byte between
seq and src_addr to get the 16bit thingie aligned on an even boundary.
There may be a no-padding option someplace, because it doesn't really
hurt on Intel architectures, but the easiest thing would be to put
in another byte to round out the uint8's...

MS


ricardo tiago wrote:
Hi

I'm using tossim and sf to inject packets in my simulation. I have injected this packet: " 00 00 11 7d 0e 13 01 03 03 02 02 00 09 05 02 07 00 02 00"

Here's what i get in tossim:
/.../
0: Received message: (The first 5 bytes are from TOS_Msg Header)
00 00 11 7d 0e 13 01 03 03 02 02 00 09 05 02 07 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00
0: AM_type = 17
0: ReceiveMsg.receive
0: RTP_MSG:
trid:19 (uint8_t - 13 - Ok)
type:1 (uint8_t - 01 - Ok)
seq:3 (uint8_t - 03 - Ok)
src_addr:514 (uint16_t - 02 02 - Wrong , i should have i got 03 02 (515) )
check_sum:2304 (uint16_t 00 09 - Wrong , it should have been 02 00)

What happened to the 9th byte (03) ??

Packet Format:
typedef struct RtpMsg {
    uint8_t trid;
    uint8_t type;
    uint8_t seq;
    uint16_t src_addr;
    uint16_t check_sum;
    uint8_t payload[22];
} RtpMsg;

Implementation :
/.../
event TOS_MsgPtr ReceiveMsg.receive[uint8_t id](TOS_MsgPtr m) {
    RtpMsg *in = (RtpMsg *)m->data;
       dbg(DBG_USR1,"ReceiveMsg.receive\n");
dbg(DBG_USR1,"RTP_MSG:\n trid:%d\n type:%d\n seq:%d\n src_addr:%d\n check_sum:%d\n",in->trid,in->type,in->seq,in->src_addr,in->check_sum);
/.../
}

.. can anyone help me out?

Tks,
Ricardo

_________________________________________________________________
MSN Messenger: converse com os seus amigos online. http://messenger.msn.com.br

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to