summaryrefslogtreecommitdiff
path: root/deps/cares/include
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2012-08-06 21:27:47 +0200
committerBert Belder <bertbelder@gmail.com>2012-08-07 01:49:02 +0200
commit81791ff33cc5413b7711c957406635ed780d0b4e (patch)
tree1158e2ee76b926e6f3b4c58f439737597139b1fa /deps/cares/include
parent4c150ca0d0cc4bd8dc6d182e0bf850daf27a2422 (diff)
downloadandroid-node-v8-81791ff33cc5413b7711c957406635ed780d0b4e.tar.gz
android-node-v8-81791ff33cc5413b7711c957406635ed780d0b4e.tar.bz2
android-node-v8-81791ff33cc5413b7711c957406635ed780d0b4e.zip
Add c-ares dependency
This is the c-ares code that used to live in the libuv source tree. It is based on c-ares 1.9.0.
Diffstat (limited to 'deps/cares/include')
-rw-r--r--deps/cares/include/ares.h622
-rw-r--r--deps/cares/include/ares_version.h24
-rw-r--r--deps/cares/include/nameser.h203
3 files changed, 849 insertions, 0 deletions
diff --git a/deps/cares/include/ares.h b/deps/cares/include/ares.h
new file mode 100644
index 0000000000..96eccabdae
--- /dev/null
+++ b/deps/cares/include/ares.h
@@ -0,0 +1,622 @@
+
+/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2007-2011 by Daniel Stenberg
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#ifndef ARES__H
+#define ARES__H
+
+#include "ares_version.h" /* c-ares version defines */
+
+/*
+ * Define WIN32 when build target is Win32 API
+ */
+
+#if (defined(_WIN32) || defined(__WIN32__)) && \
+ !defined(WIN32) && !defined(__SYMBIAN32__)
+# define WIN32
+#endif
+
+/*************************** libuv patch ***************/
+
+/*
+ * We want to avoid autoconf altogether since there are a finite number of
+ * operating systems and simply build c-ares. Therefore we do not want the
+ * configurations provided by ares_build.h since we are always statically
+ * linking c-ares into libuv. Having a system dependent ares_build.h forces
+ * all users of ares.h to include the correct ares_build.h. We do not care
+ * about the linking checks provided by ares_rules.h. This would complicate
+ * the libuv build process.
+ */
+
+
+#if defined(WIN32)
+/* Configure process defines this to 1 when it finds out that system */
+/* header file ws2tcpip.h must be included by the external interface. */
+/* #undef CARES_PULL_WS2TCPIP_H */
+# include <winsock2.h>
+# include <ws2tcpip.h>
+# include <windows.h>
+
+#else /* Not Windows */
+
+# include <sys/time.h>
+# include <sys/types.h>
+# include <sys/socket.h>
+#endif
+
+#if 0
+/* The size of `long', as computed by sizeof. */
+#define CARES_SIZEOF_LONG 4
+#endif
+
+/* Integral data type used for ares_socklen_t. */
+#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
+
+#if 0
+/* The size of `ares_socklen_t', as computed by sizeof. */
+#define CARES_SIZEOF_ARES_SOCKLEN_T 4
+#endif
+
+/* Data type definition of ares_socklen_t. */
+typedef int ares_socklen_t;
+
+#if 0 /* libuv disabled */
+#include "ares_rules.h" /* c-ares rules enforcement */
+#endif
+
+/*********************** end libuv patch ***************/
+
+#include <sys/types.h>
+
+/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
+ libc5-based Linux systems. Only include it on system that are known to
+ require it! */
+#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
+ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
+ defined(ANDROID) || defined(__ANDROID__)
+#include <sys/select.h>
+#endif
+#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
+#include <sys/bsdskt.h>
+#endif
+
+#if defined(WATT32)
+# include <netinet/in.h>
+# include <sys/socket.h>
+# include <tcp.h>
+#elif defined(_WIN32_WCE)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+# include <winsock.h>
+#elif defined(WIN32)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#else
+# include <sys/socket.h>
+# include <netinet/in.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** c-ares external API function linkage decorations.
+*/
+
+#if !defined(CARES_STATICLIB) && \
+ (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
+ /* __declspec function decoration for Win32 and Symbian DLL's */
+# if defined(CARES_BUILDING_LIBRARY)
+# define CARES_EXTERN __declspec(dllexport)
+# else
+# define CARES_EXTERN __declspec(dllimport)
+# endif
+#else
+ /* visibility function decoration for other cases */
+# if !defined(CARES_SYMBOL_HIDING) || \
+ defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
+# define CARES_EXTERN
+# else
+# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
+# endif
+#endif
+
+
+#define ARES_SUCCESS 0
+
+/* Server error codes (ARES_ENODATA indicates no relevant answer) */
+#define ARES_ENODATA 1
+#define ARES_EFORMERR 2
+#define ARES_ESERVFAIL 3
+#define ARES_ENOTFOUND 4
+#define ARES_ENOTIMP 5
+#define ARES_EREFUSED 6
+
+/* Locally generated error codes */
+#define ARES_EBADQUERY 7
+#define ARES_EBADNAME 8
+#define ARES_EBADFAMILY 9
+#define ARES_EBADRESP 10
+#define ARES_ECONNREFUSED 11
+#define ARES_ETIMEOUT 12
+#define ARES_EOF 13
+#define ARES_EFILE 14
+#define ARES_ENOMEM 15
+#define ARES_EDESTRUCTION 16
+#define ARES_EBADSTR 17
+
+/* ares_getnameinfo error codes */
+#define ARES_EBADFLAGS 18
+
+/* ares_getaddrinfo error codes */
+#define ARES_ENONAME 19
+#define ARES_EBADHINTS 20
+
+/* Uninitialized library error code */
+#define ARES_ENOTINITIALIZED 21 /* introduced in 1.7.0 */
+
+/* ares_library_init error codes */
+#define ARES_ELOADIPHLPAPI 22 /* introduced in 1.7.0 */
+#define ARES_EADDRGETNETWORKPARAMS 23 /* introduced in 1.7.0 */
+
+/* More error codes */
+#define ARES_ECANCELLED 24 /* introduced in 1.7.0 */
+
+/* Flag values */
+#define ARES_FLAG_USEVC (1 << 0)
+#define ARES_FLAG_PRIMARY (1 << 1)
+#define ARES_FLAG_IGNTC (1 << 2)
+#define ARES_FLAG_NORECURSE (1 << 3)
+#define ARES_FLAG_STAYOPEN (1 << 4)
+#define ARES_FLAG_NOSEARCH (1 << 5)
+#define ARES_FLAG_NOALIASES (1 << 6)
+#define ARES_FLAG_NOCHECKRESP (1 << 7)
+
+/* Option mask values */
+#define ARES_OPT_FLAGS (1 << 0)
+#define ARES_OPT_TIMEOUT (1 << 1)
+#define ARES_OPT_TRIES (1 << 2)
+#define ARES_OPT_NDOTS (1 << 3)
+#define ARES_OPT_UDP_PORT (1 << 4)
+#define ARES_OPT_TCP_PORT (1 << 5)
+#define ARES_OPT_SERVERS (1 << 6)
+#define ARES_OPT_DOMAINS (1 << 7)
+#define ARES_OPT_LOOKUPS (1 << 8)
+#define ARES_OPT_SOCK_STATE_CB (1 << 9)
+#define ARES_OPT_SORTLIST (1 << 10)
+#define ARES_OPT_SOCK_SNDBUF (1 << 11)
+#define ARES_OPT_SOCK_RCVBUF (1 << 12)
+#define ARES_OPT_TIMEOUTMS (1 << 13)
+#define ARES_OPT_ROTATE (1 << 14)
+
+/* Nameinfo flag values */
+#define ARES_NI_NOFQDN (1 << 0)
+#define ARES_NI_NUMERICHOST (1 << 1)
+#define ARES_NI_NAMEREQD (1 << 2)
+#define ARES_NI_NUMERICSERV (1 << 3)
+#define ARES_NI_DGRAM (1 << 4)
+#define ARES_NI_TCP 0
+#define ARES_NI_UDP ARES_NI_DGRAM
+#define ARES_NI_SCTP (1 << 5)
+#define ARES_NI_DCCP (1 << 6)
+#define ARES_NI_NUMERICSCOPE (1 << 7)
+#define ARES_NI_LOOKUPHOST (1 << 8)
+#define ARES_NI_LOOKUPSERVICE (1 << 9)
+/* Reserved for future use */
+#define ARES_NI_IDN (1 << 10)
+#define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11)
+#define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12)
+
+/* Addrinfo flag values */
+#define ARES_AI_CANONNAME (1 << 0)
+#define ARES_AI_NUMERICHOST (1 << 1)
+#define ARES_AI_PASSIVE (1 << 2)
+#define ARES_AI_NUMERICSERV (1 << 3)
+#define ARES_AI_V4MAPPED (1 << 4)
+#define ARES_AI_ALL (1 << 5)
+#define ARES_AI_ADDRCONFIG (1 << 6)
+/* Reserved for future use */
+#define ARES_AI_IDN (1 << 10)
+#define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11)
+#define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12)
+#define ARES_AI_CANONIDN (1 << 13)
+
+#define ARES_AI_MASK (ARES_AI_CANONNAME|ARES_AI_NUMERICHOST|ARES_AI_PASSIVE| \
+ ARES_AI_NUMERICSERV|ARES_AI_V4MAPPED|ARES_AI_ALL| \
+ ARES_AI_ADDRCONFIG)
+#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about this
+ many sockets */
+#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
+#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
+ ARES_GETSOCK_MAXNUM)))
+
+/* c-ares library initialization flag values */
+#define ARES_LIB_INIT_NONE (0)
+#define ARES_LIB_INIT_WIN32 (1 << 0)
+#define ARES_LIB_INIT_ALL (ARES_LIB_INIT_WIN32)
+
+
+/*
+ * Typedef our socket type
+ */
+
+#ifndef ares_socket_typedef
+#ifdef WIN32
+typedef SOCKET ares_socket_t;
+#define ARES_SOCKET_BAD INVALID_SOCKET
+#else
+typedef int ares_socket_t;
+#define ARES_SOCKET_BAD -1
+#endif
+#define ares_socket_typedef
+#endif /* ares_socket_typedef */
+
+typedef void (*ares_sock_state_cb)(void *data,
+ ares_socket_t socket_fd,
+ int readable,
+ int writable);
+
+struct apattern;
+
+/* NOTE about the ares_options struct to users and developers.
+
+ This struct will remain looking like this. It will not be extended nor
+ shrunk in future releases, but all new options will be set by ares_set_*()
+ options instead of with the ares_init_options() function.
+
+ Eventually (in a galaxy far far away), all options will be settable by
+ ares_set_*() options and the ares_init_options() function will become
+ deprecated.
+
+ When new options are added to c-ares, they are not added to this
+ struct. And they are not "saved" with the ares_save_options() function but
+ instead we encourage the use of the ares_dup() function. Needless to say,
+ if you add config options to c-ares you need to make sure ares_dup()
+ duplicates this new option.
+
+ */
+struct ares_options {
+ int flags;
+ int timeout; /* in seconds or milliseconds, depending on options */
+ int tries;
+ int ndots;
+ unsigned short udp_port;
+ unsigned short tcp_port;
+ int socket_send_buffer_size;
+ int socket_receive_buffer_size;
+ struct in_addr *servers;
+ int nservers;
+ char **domains;
+ int ndomains;
+ char *lookups;
+ ares_sock_state_cb sock_state_cb;
+ void *sock_state_cb_data;
+ struct apattern *sortlist;
+ int nsort;
+};
+
+struct hostent;
+struct timeval;
+struct sockaddr;
+struct ares_channeldata;
+
+typedef struct ares_channeldata *ares_channel;
+
+typedef void (*ares_callback)(void *arg,
+ int status,
+ int timeouts,
+ unsigned char *abuf,
+ int alen);
+
+typedef void (*ares_host_callback)(void *arg,
+ int status,
+ int timeouts,
+ struct hostent *hostent);
+
+typedef void (*ares_nameinfo_callback)(void *arg,
+ int status,
+ int timeouts,
+ char *node,
+ char *service);
+
+typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd,
+ int type,
+ void *data);
+
+CARES_EXTERN int ares_library_init(int flags);
+
+CARES_EXTERN void ares_library_cleanup(void);
+
+CARES_EXTERN const char *ares_version(int *version);
+
+CARES_EXTERN int ares_init(ares_channel *channelptr);
+
+CARES_EXTERN int ares_init_options(ares_channel *channelptr,
+ struct ares_options *options,
+ int optmask);
+
+CARES_EXTERN int ares_save_options(ares_channel channel,
+ struct ares_options *options,
+ int *optmask);
+
+CARES_EXTERN void ares_destroy_options(struct ares_options *options);
+
+CARES_EXTERN int ares_dup(ares_channel *dest,
+ ares_channel src);
+
+CARES_EXTERN void ares_destroy(ares_channel channel);
+
+CARES_EXTERN void ares_cancel(ares_channel channel);
+
+/* These next 3 configure local binding for the out-going socket
+ * connection. Use these to specify source IP and/or network device
+ * on multi-homed systems.
+ */
+CARES_EXTERN void ares_set_local_ip4(ares_channel channel, unsigned int local_ip);
+
+/* local_ip6 should be 16 bytes in length */
+CARES_EXTERN void ares_set_local_ip6(ares_channel channel,
+ const unsigned char* local_ip6);
+
+/* local_dev_name should be null terminated. */
+CARES_EXTERN void ares_set_local_dev(ares_channel channel,
+ const char* local_dev_name);
+
+CARES_EXTERN void ares_set_socket_callback(ares_channel channel,
+ ares_sock_create_callback callback,
+ void *user_data);
+
+CARES_EXTERN void ares_send(ares_channel channel,
+ const unsigned char *qbuf,
+ int qlen,
+ ares_callback callback,
+ void *arg);
+
+CARES_EXTERN void ares_query(ares_channel channel,
+ const char *name,
+ int dnsclass,
+ int type,
+ ares_callback callback,
+ void *arg);
+
+CARES_EXTERN void ares_search(ares_channel channel,
+ const char *name,
+ int dnsclass,
+ int type,
+ ares_callback callback,
+ void *arg);
+
+CARES_EXTERN void ares_gethostbyname(ares_channel channel,
+ const char *name,
+ int family,
+ ares_host_callback callback,
+ void *arg);
+
+CARES_EXTERN int ares_gethostbyname_file(ares_channel channel,
+ const char *name,
+ int family,
+ struct hostent **host);
+
+CARES_EXTERN void ares_gethostbyaddr(ares_channel channel,
+ const void *addr,
+ int addrlen,
+ int family,
+ ares_host_callback callback,
+ void *arg);
+
+CARES_EXTERN void ares_getnameinfo(ares_channel channel,
+ const struct sockaddr *sa,
+ ares_socklen_t salen,
+ int flags,
+ ares_nameinfo_callback callback,
+ void *arg);
+
+CARES_EXTERN int ares_fds(ares_channel channel,
+ fd_set *read_fds,
+ fd_set *write_fds);
+
+CARES_EXTERN int ares_getsock(ares_channel channel,
+ ares_socket_t *socks,
+ int numsocks);
+
+CARES_EXTERN struct timeval *ares_timeout(ares_channel channel,
+ struct timeval *maxtv,
+ struct timeval *tv);
+
+CARES_EXTERN void ares_process(ares_channel channel,
+ fd_set *read_fds,
+ fd_set *write_fds);
+
+CARES_EXTERN void ares_process_fd(ares_channel channel,
+ ares_socket_t read_fd,
+ ares_socket_t write_fd);
+
+CARES_EXTERN int ares_mkquery(const char *name,
+ int dnsclass,
+ int type,
+ unsigned short id,
+ int rd,
+ unsigned char **buf,
+ int *buflen);
+
+CARES_EXTERN int ares_expand_name(const unsigned char *encoded,
+ const unsigned char *abuf,
+ int alen,
+ char **s,
+ long *enclen);
+
+CARES_EXTERN int ares_expand_string(const unsigned char *encoded,
+ const unsigned char *abuf,
+ int alen,
+ unsigned char **s,
+ long *enclen);
+
+/*
+ * NOTE: before c-ares 1.7.0 we would most often use the system in6_addr
+ * struct below when ares itself was built, but many apps would use this
+ * private version since the header checked a HAVE_* define for it. Starting
+ * with 1.7.0 we always declare and use our own to stop relying on the
+ * system's one.
+ */
+struct ares_in6_addr {
+ union {
+ unsigned char _S6_u8[16];
+ } _S6_un;
+};
+
+struct ares_addrttl {
+ struct in_addr ipaddr;
+ int ttl;
+};
+
+struct ares_addr6ttl {
+ struct ares_in6_addr ip6addr;
+ int ttl;
+};
+
+struct ares_srv_reply {
+ struct ares_srv_reply *next;
+ char *host;
+ unsigned short priority;
+ unsigned short weight;
+ unsigned short port;
+};
+
+struct ares_mx_reply {
+ struct ares_mx_reply *next;
+ char *host;
+ unsigned short priority;
+};
+
+struct ares_txt_reply {
+ struct ares_txt_reply *next;
+ unsigned char *txt;
+ size_t length; /* length excludes null termination */
+};
+
+struct ares_naptr_reply {
+ struct ares_naptr_reply *next;
+ unsigned char *flags;
+ unsigned char *service;
+ unsigned char *regexp;
+ char *replacement;
+ unsigned short order;
+ unsigned short preference;
+};
+
+struct ares_soa_reply {
+ char *nsname;
+ char *hostmaster;
+ unsigned int serial;
+ unsigned int refresh;
+ unsigned int retry;
+ unsigned int expire;
+ unsigned int minttl;
+};
+
+/*
+** Parse the buffer, starting at *abuf and of length alen bytes, previously
+** obtained from an ares_search call. Put the results in *host, if nonnull.
+** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with
+** their TTLs in that array, and set *naddrttls to the number of addresses
+** so written.
+*/
+
+CARES_EXTERN int ares_parse_a_reply(const unsigned char *abuf,
+ int alen,
+ struct hostent **host,
+ struct ares_addrttl *addrttls,
+ int *naddrttls);
+
+CARES_EXTERN int ares_parse_aaaa_reply(const unsigned char *abuf,
+ int alen,
+ struct hostent **host,
+ struct ares_addr6ttl *addrttls,
+ int *naddrttls);
+
+CARES_EXTERN int ares_parse_ptr_reply(const unsigned char *abuf,
+ int alen,
+ const void *addr,
+ int addrlen,
+ int family,
+ struct hostent **host);
+
+CARES_EXTERN int ares_parse_ns_reply(const unsigned char *abuf,
+ int alen,
+ struct hostent **host);
+
+CARES_EXTERN int ares_parse_srv_reply(const unsigned char* abuf,
+ int alen,
+ struct ares_srv_reply** srv_out);
+
+CARES_EXTERN int ares_parse_mx_reply(const unsigned char* abuf,
+ int alen,
+ struct ares_mx_reply** mx_out);
+
+CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf,
+ int alen,
+ struct ares_txt_reply** txt_out);
+
+CARES_EXTERN int ares_parse_naptr_reply(const unsigned char* abuf,
+ int alen,
+ struct ares_naptr_reply** naptr_out);
+
+CARES_EXTERN int ares_parse_soa_reply(const unsigned char* abuf,
+ int alen,
+ struct ares_soa_reply** soa_out);
+
+CARES_EXTERN void ares_free_string(void *str);
+
+CARES_EXTERN void ares_free_hostent(struct hostent *host);
+
+CARES_EXTERN void ares_free_soa(struct ares_soa_reply *soa);
+
+CARES_EXTERN void ares_free_data(void *dataptr);
+
+CARES_EXTERN const char *ares_strerror(int code);
+
+/* TODO: Hold port here as well. */
+struct ares_addr_node {
+ struct ares_addr_node *next;
+ int family;
+ union {
+ struct in_addr addr4;
+ struct ares_in6_addr addr6;
+ } addr;
+};
+
+CARES_EXTERN int ares_set_servers(ares_channel channel,
+ struct ares_addr_node *servers);
+
+/* Incomming string format: host[:port][,host[:port]]... */
+CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
+ const char* servers);
+
+CARES_EXTERN int ares_get_servers(ares_channel channel,
+ struct ares_addr_node **servers);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ARES__H */
diff --git a/deps/cares/include/ares_version.h b/deps/cares/include/ares_version.h
new file mode 100644
index 0000000000..84b97cd085
--- /dev/null
+++ b/deps/cares/include/ares_version.h
@@ -0,0 +1,24 @@
+
+#ifndef ARES__VERSION_H
+#define ARES__VERSION_H
+
+/* This is the global package copyright */
+#define ARES_COPYRIGHT "2004 - 2012 Daniel Stenberg, <daniel@haxx.se>."
+
+#define ARES_VERSION_MAJOR 1
+#define ARES_VERSION_MINOR 9
+#define ARES_VERSION_PATCH 0
+#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
+ (ARES_VERSION_MINOR<<8)|\
+ (ARES_VERSION_PATCH))
+#define ARES_VERSION_STR "1.9.0-DEV"
+
+#if (ARES_VERSION >= 0x010700)
+# define CARES_HAVE_ARES_LIBRARY_INIT 1
+# define CARES_HAVE_ARES_LIBRARY_CLEANUP 1
+#else
+# undef CARES_HAVE_ARES_LIBRARY_INIT
+# undef CARES_HAVE_ARES_LIBRARY_CLEANUP
+#endif
+
+#endif
diff --git a/deps/cares/include/nameser.h b/deps/cares/include/nameser.h
new file mode 100644
index 0000000000..45f1e3eb80
--- /dev/null
+++ b/deps/cares/include/nameser.h
@@ -0,0 +1,203 @@
+
+#ifndef ARES_NAMESER_H
+#define ARES_NAMESER_H
+
+/* header file provided by liren@vivisimo.com */
+
+#ifndef HAVE_ARPA_NAMESER_H
+
+#define NS_PACKETSZ 512 /* maximum packet size */
+#define NS_MAXDNAME 256 /* maximum domain name */
+#define NS_MAXCDNAME 255 /* maximum compressed domain name */
+#define NS_MAXLABEL 63
+#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
+#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
+#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
+#define NS_INT16SZ 2
+#define NS_INADDRSZ 4
+#define NS_IN6ADDRSZ 16
+#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
+#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
+
+typedef enum __ns_class {
+ ns_c_invalid = 0, /* Cookie. */
+ ns_c_in = 1, /* Internet. */
+ ns_c_2 = 2, /* unallocated/unsupported. */
+ ns_c_chaos = 3, /* MIT Chaos-net. */
+ ns_c_hs = 4, /* MIT Hesiod. */
+ /* Query class values which do not appear in resource records */
+ ns_c_none = 254, /* for prereq. sections in update requests */
+ ns_c_any = 255, /* Wildcard match. */
+ ns_c_max = 65536
+} ns_class;
+
+typedef enum __ns_type {
+ ns_t_invalid = 0, /* Cookie. */
+ ns_t_a = 1, /* Host address. */
+ ns_t_ns = 2, /* Authoritative server. */
+ ns_t_md = 3, /* Mail destination. */
+ ns_t_mf = 4, /* Mail forwarder. */
+ ns_t_cname = 5, /* Canonical name. */
+ ns_t_soa = 6, /* Start of authority zone. */
+ ns_t_mb = 7, /* Mailbox domain name. */
+ ns_t_mg = 8, /* Mail group member. */
+ ns_t_mr = 9, /* Mail rename name. */
+ ns_t_null = 10, /* Null resource record. */
+ ns_t_wks = 11, /* Well known service. */
+ ns_t_ptr = 12, /* Domain name pointer. */
+ ns_t_hinfo = 13, /* Host information. */
+ ns_t_minfo = 14, /* Mailbox information. */
+ ns_t_mx = 15, /* Mail routing information. */
+ ns_t_txt = 16, /* Text strings. */
+ ns_t_rp = 17, /* Responsible person. */
+ ns_t_afsdb = 18, /* AFS cell database. */
+ ns_t_x25 = 19, /* X_25 calling address. */
+ ns_t_isdn = 20, /* ISDN calling address. */
+ ns_t_rt = 21, /* Router. */
+ ns_t_nsap = 22, /* NSAP address. */
+ ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
+ ns_t_sig = 24, /* Security signature. */
+ ns_t_key = 25, /* Security key. */
+ ns_t_px = 26, /* X.400 mail mapping. */
+ ns_t_gpos = 27, /* Geographical position (withdrawn). */
+ ns_t_aaaa = 28, /* Ip6 Address. */
+ ns_t_loc = 29, /* Location Information. */
+ ns_t_nxt = 30, /* Next domain (security). */
+ ns_t_eid = 31, /* Endpoint identifier. */
+ ns_t_nimloc = 32, /* Nimrod Locator. */
+ ns_t_srv = 33, /* Server Selection. */
+ ns_t_atma = 34, /* ATM Address */
+ ns_t_naptr = 35, /* Naming Authority PoinTeR */
+ ns_t_kx = 36, /* Key Exchange */
+ ns_t_cert = 37, /* Certification record */
+ ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
+ ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
+ ns_t_sink = 40, /* Kitchen sink (experimentatl) */
+ ns_t_opt = 41, /* EDNS0 option (meta-RR) */
+ ns_t_apl = 42, /* Address prefix list (RFC3123) */
+ ns_t_ds = 43, /* Delegation Signer (RFC4034) */
+ ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */
+ ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */
+ ns_t_nsec = 47, /* Next Secure (RFC4034) */
+ ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */
+ ns_t_tkey = 249, /* Transaction key */
+ ns_t_tsig = 250, /* Transaction signature. */
+ ns_t_ixfr = 251, /* Incremental zone transfer. */
+ ns_t_axfr = 252, /* Transfer zone of authority. */
+ ns_t_mailb = 253, /* Transfer mailbox records. */
+ ns_t_maila = 254, /* Transfer mail agent records. */
+ ns_t_any = 255, /* Wildcard match. */
+ ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
+ ns_t_max = 65536
+} ns_type;
+
+typedef enum __ns_opcode {
+ ns_o_query = 0, /* Standard query. */
+ ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */
+ ns_o_status = 2, /* Name server status query (unsupported). */
+ /* Opcode 3 is undefined/reserved. */
+ ns_o_notify = 4, /* Zone change notification. */
+ ns_o_update = 5, /* Zone update message. */
+ ns_o_max = 6
+} ns_opcode;
+
+typedef enum __ns_rcode {
+ ns_r_noerror = 0, /* No error occurred. */
+ ns_r_formerr = 1, /* Format error. */
+ ns_r_servfail = 2, /* Server failure. */
+ ns_r_nxdomain = 3, /* Name error. */
+ ns_r_notimpl = 4, /* Unimplemented. */
+ ns_r_refused = 5, /* Operation refused. */
+ /* these are for BIND_UPDATE */
+ ns_r_yxdomain = 6, /* Name exists */
+ ns_r_yxrrset = 7, /* RRset exists */
+ ns_r_nxrrset = 8, /* RRset does not exist */
+ ns_r_notauth = 9, /* Not authoritative for zone */
+ ns_r_notzone = 10, /* Zone of record different from zone section */
+ ns_r_max = 11,
+ /* The following are TSIG extended errors */
+ ns_r_badsig = 16,
+ ns_r_badkey = 17,
+ ns_r_badtime = 18
+} ns_rcode;
+
+#endif /* HAVE_ARPA_NAMESER_H */
+
+#ifndef HAVE_ARPA_NAMESER_COMPAT_H
+
+#define PACKETSZ NS_PACKETSZ
+#define MAXDNAME NS_MAXDNAME
+#define MAXCDNAME NS_MAXCDNAME
+#define MAXLABEL NS_MAXLABEL
+#define HFIXEDSZ NS_HFIXEDSZ
+#define QFIXEDSZ NS_QFIXEDSZ
+#define RRFIXEDSZ NS_RRFIXEDSZ
+#define INDIR_MASK NS_CMPRSFLGS
+#define NAMESERVER_PORT NS_DEFAULTPORT
+
+#define QUERY ns_o_query
+
+#define SERVFAIL ns_r_servfail
+#define NOTIMP ns_r_notimpl
+#define REFUSED ns_r_refused
+#undef NOERROR /* it seems this is already defined in winerror.h */
+#define NOERROR ns_r_noerror
+#define FORMERR ns_r_formerr
+#define NXDOMAIN ns_r_nxdomain
+
+#define C_IN ns_c_in
+#define C_CHAOS ns_c_chaos
+#define C_HS ns_c_hs
+#define C_NONE ns_c_none
+#define C_ANY ns_c_any
+
+#define T_A ns_t_a
+#define T_NS ns_t_ns
+#define T_MD ns_t_md
+#define T_MF ns_t_mf
+#define T_CNAME ns_t_cname
+#define T_SOA ns_t_soa
+#define T_MB ns_t_mb
+#define T_MG ns_t_mg
+#define T_MR ns_t_mr
+#define T_NULL ns_t_null
+#define T_WKS ns_t_wks
+#define T_PTR ns_t_ptr
+#define T_HINFO ns_t_hinfo
+#define T_MINFO ns_t_minfo
+#define T_MX ns_t_mx
+#define T_TXT ns_t_txt
+#define T_RP ns_t_rp
+#define T_AFSDB ns_t_afsdb
+#define T_X25 ns_t_x25
+#define T_ISDN ns_t_isdn
+#define T_RT ns_t_rt
+#define T_NSAP ns_t_nsap
+#define T_NSAP_PTR ns_t_nsap_ptr
+#define T_SIG ns_t_sig
+#define T_KEY ns_t_key
+#define T_PX ns_t_px
+#define T_GPOS ns_t_gpos
+#define T_AAAA ns_t_aaaa
+#define T_LOC ns_t_loc
+#define T_NXT ns_t_nxt
+#define T_EID ns_t_eid
+#define T_NIMLOC ns_t_nimloc
+#define T_SRV ns_t_srv
+#define T_ATMA ns_t_atma
+#define T_NAPTR ns_t_naptr
+#define T_DS ns_t_ds
+#define T_SSHFP ns_t_sshfp
+#define T_RRSIG ns_t_rrsig
+#define T_NSEC ns_t_nsec
+#define T_DNSKEY ns_t_dnskey
+#define T_TSIG ns_t_tsig
+#define T_IXFR ns_t_ixfr
+#define T_AXFR ns_t_axfr
+#define T_MAILB ns_t_mailb
+#define T_MAILA ns_t_maila
+#define T_ANY ns_t_any
+
+#endif /* HAVE_ARPA_NAMESER_COMPAT_H */
+
+#endif /* ARES_NAMESER_H */