Re: Including arpa/nameser_compat.h
Re: Including arpa/nameser_compat.h
- Subject: Re: Including arpa/nameser_compat.h
- From: Marc Majka <email@hidden>
- Date: Tue, 18 Sep 2007 13:46:08 -0700
I should mention (and promote!) the APIs in <dns.h> and <dns_util.h>.
There's a nice parser in there. See dns_parse_packet(). Only in Mac
OS / Darwin, however.
-- Marc
On 18 Sep, 2007, at 13:40, Bhavesh Davda wrote:
Thanks Marc!
Guess I should have asked before I spent all the effort hand parsing
the DNS message, huh? :)
Oh well... May be the code will get cleaner and more portable across
different OSes doing it this way instead.
- Bhavesh
On 9/18/07, Marc Majka <email@hidden> wrote:
BIND 9 replaced the visible HEADER struct with a new struct named
ns_msg,
and set of accessor macros in <nameser.h>
#define ns_msg_id(handle) ((handle)._id + 0)
#define ns_msg_base(handle) ((handle)._msg + 0)
#define ns_msg_end(handle) ((handle)._eom + 0)
#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
The "handle" here is an ns_msg struct. Pass the message bytes,
length of
the packet, and a pointer to an ns_msg to ns_initparse (see
<resolv.h>). It
fills in the ns_msg handle and you can pull out the parts with the
accessor
macros.
See, for example, res_pquery() in res_debug.c
(http://www.opensource.apple.com/darwinsource/10.4.9.ppc/netinfo-369.5/resolver/res_debug.c
)
--
Marc Majka
On 18 Sep, 2007, at 13:10, Bhavesh Davda wrote:
So I just noticed that Mac OS X 10.4 uses bind 9 headers in
arpa/nameser.h, and includes arpa/nameser8_compat.h if BIND_8_COMPAT
is defined.
I also saw some older posts to this mailing list indicating that
programs should stay away from using BIND_8_COMPAT because it is
being
deprecated.
So what should I do as a programmer who needs the definition of
struct
HEADER from arpa/nameser_compat.h (also in arpa/nameser8_compat.h)?
Thanks
--
Bhavesh P. Davda
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Bhavesh P. Davda
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden