On Thu, 21 Nov 2002, Gerald Combs <[EMAIL PROTECTED]> wrote:
> On Thu, 21 Nov 2002, Paul Smith wrote:
[..]
> > struct udp
> > {
> > unsigned short source_port;
> > unsigned short destination_port
> > unsigned short length;
> > unsigned short checksum;
> > }
> >
> > struct udp_header *udp_hdr;
> >
> > udp_hdr=(struct udp_header*)data_buffer
>
> This will fail if:
>
> - One of the structure members isn't properly aligned on a 32-bit
> boundary, and your processor doesn't like that, e.g. SPARC or
> MIPS. Alphas and PowerPCs might be subject to this as well.
Gerald,
I have this same question since I read README.developer, so I'll jump in
to ask.
what's wrong with this:
struct foo {
....
} __attribute__ packed
I think the only problem is that __attribute__ is a ggcism and is not
portable, right?
> - Your processor's host byte order differs from network byte order,
> e.g. IA32.
Should be enough to always use ntohs() and ntohl(), right?
[..]
thanks
marco