Hello everybody:

I am seeking advice about the best practices to design message
structures for MSP430-based systems. I am having some of the problems
described in:
https://mail.millennium.berkeley.edu/pipermail/tinyos-devel/2004-April/000338.html

For instance, on the platform we are working with, initially our
TOS_Msg header had an odd number of bytes. After porting
MultiHopRouter (from tos/lib/Route, by providing a qsort()
implementation) I suppose some things may not work correctly as its
first field in the header is a uint16_t -- so I pad the TOS_Msg header
to an even number of bytes. MultiHopRouter, in turn, also has a 7-byte
header, if the application on top of it starts with a 16-bit field
(...) repeat the same process?

My conclusion from what I have seen so far is that all protocol layers
should strive to declare even-sized headers, so that their payload
fields are word-aligned... Insights from whoever "been there done
that" are very much appreciated.
-- 
/dima

PS: While on this topic, I'd like to know if anyone has horror stories
with C bit-fields to share, especially in data that goes directly
through networks or storage. I need to convice a colleague that they
are evil >:-}

Reply via email to