site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com -- 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 #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) -- 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. Thanks -- Bhavesh P. Davda _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/majka%40apple.com This email sent to majka@apple.com -- Bhavesh P. Davda _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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. On 9/18/07, Marc Majka <majka@apple.com> wrote: BIND 9 replaced the visible HEADER struct with a new struct named ns_msg, and set of accessor macros in <nameser.h> 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/resolv... ) 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)? This email sent to site_archiver@lists.apple.com