Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lack of packed structures with mDNSCore



Hiya,

After a small amount of pain, I've managed to massage the code in mDNSCore
to be able to compile and run on a system without packed structures.

Whilst I doubt that this is of too much interest to people, it might be
useful to know that the lack of packed structures in a compiler doesn't
prevent it from being made to work.

One thing that did concern me slightly was the bold claim that the code
was 'completely 100% portable C' and then went ahead and relied on the
structures being packed by the compiler (which isn't defined in C

Is there any interest in the changes which I required to make the sources
work on a system without packed structures ?

My rationale for claiming that it's not portable C to require packed
structures is based on C99 6.7.2.1 clause 12 - "Each non-bitfield member
of a structure or union object is aligned in an implementation defined
manner appropriate to its type". (also noted in J.3.9)

As I'm on the subject, the changes necessary are not huge, but I have not
tested the full functionality of the library modified in this manner. At
present registration of services, name collision detection and other
simple things work fine - no query functions have been tested and this may
uncover other problems.

rdataSRV and therefore RDataBody are slightly larger than expected because
the structure declared for an Opaque object 16bits long is allocated as
32bits wide on this system.

DNSMessageHeader and therefore DNSMessage is larger than expected. This is
a more amusing change as it means that (initially) packets going in and
out of the core must be transformed from the internal representation to
the form which can be sent on the wire. The secondary problem is that
domain label compession means that labels must be counted slightly
differently because the packet alignment in its 'in-memory' form is
distinctly different to that of the 'on the wire' form. This requires a
minor update (which is very ugly) to the code which processes these
strings.

-- 
Gerph <http://gerph.org/>
... Going over and over in my mind. I relive it one second at a time.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Rendezvous-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/rendezvous-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.