Re: Including arpa/nameser_compat.h
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=v+tl0BalzzP/UefIWXMYA/hWrzNyfVba69V4veE49IE=; b=HK9DwylDtwDIaIES+thyywygKWfiJuy5hNTfdPQ0+LDmN+Ga/a8Mz/JRcWZ+6/n7vdnJoy0JwZjJHWirXl0PM2LnhNOXTfZv/gsMwouC0o4nCQdtr6v6s6PZL1a/EYSoi2S+26Gg5oukM2oqyEGy9FBme9d76bKVD+ZGZ7xgGzQ= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZW1rGMBNxVVYckxv27q5keQocXUV4UJTpdFM3i+HGh9y1CK21iISNr4C02SGjLuHCIe7wV682Aosy0aywEbBroqkMJjiaPSiw9dfxFwM9qerssLwIX6ONde52qhR2qy6M0RXJqTCeIp2+5vv+wAHEK9zrQHpex4L4pwoGML/CkA= 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 <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>
#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/resolv...)
-- 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 (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... This email sent to site_archiver@lists.apple.com
participants (1)
-
Bhavesh Davda