On 8/20/07, Ákos Maróy <[EMAIL PROTECTED]> wrote:
> David Gay wrote:
> > On 8/20/07, Ákos Maróy <[EMAIL PROTECTED]> wrote:
> >> I wonder if it would be better to have specificy types defined for these
> >> different purposes. that way, API usage would be more straightforward,
> >> as one would know right away what is contained in what type..
> >
> > While I understand your concern, this scheme with multiple embedded
> > types follows the standard(*) scheme for a layered network stack: each
> > layer has a packet layout (aka type) which is embedded in the "data"
> > field of the packet layout of the layer below.
>
> but, in such circumstances, all the layers have an aptly (and
> differently!) named structure. it's not like all OSI layers use the same
> data structure, packed one into another...
>
> > *: "standard" here does really mean "essentially the whole world does
> > it this way" (e.g., TCP/IP, but I can't think of a counterexample at
> > this point ;-)).
>
> well, TCP/IP does not define the whole stack. for example, ethernet
> packets transport TCP, UDP, etc. packets inside.
>
> but, all these structure have their corresponding names. no one assumes
> that an ethernet message structure would contain another strucutre of
> the same type...
>
> and also there's a reason for defining types in the first place, instead
> of just working with void pointers - type safety...

If you think of tmsg_t as "generic message buffer", not as "Active
Message Packet",  it makes more sense.

It's true that it would help from a type-checking perspective to have
a separate type for each packet kind (with an embedded message buffer
;-)), that would be expected by the various mig-generated functions.
Maybe in a future version... (if you're in the mood, you can hack
/usr/lib/ncc/genc.pm to do that...)

David Gay

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to