summaryrefslogtreecommitdiff
path: root/deps/cares/include
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2016-02-04 16:34:47 -0500
committerFedor Indutny <fedor@indutny.com>2016-02-08 14:44:19 -0500
commit1258b0166dc6e68c2592be3410e54d5cb19bc04b (patch)
tree5f21d4a0c2789b78c231e6b2c9fbd6ac29ddac4c /deps/cares/include
parent106c6cfe98db21cc62d339056710491550f69565 (diff)
downloadnode-new-1258b0166dc6e68c2592be3410e54d5cb19bc04b.tar.gz
deps: sync with upstream bagder/c-ares@2bae2d5
PR-URL: https://github.com/nodejs/node/pull/5090 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Diffstat (limited to 'deps/cares/include')
-rw-r--r--deps/cares/include/ares.h50
-rw-r--r--deps/cares/include/ares_build.h117
-rw-r--r--deps/cares/include/ares_rules.h130
3 files changed, 291 insertions, 6 deletions
diff --git a/deps/cares/include/ares.h b/deps/cares/include/ares.h
index f9abe854d5..fcbcecfc49 100644
--- a/deps/cares/include/ares.h
+++ b/deps/cares/include/ares.h
@@ -19,6 +19,8 @@
#define ARES__H
#include "ares_version.h" /* c-ares version defines */
+#include "ares_build.h" /* c-ares build definitions */
+#include "ares_rules.h" /* c-ares rules enforcement */
/*
* Define WIN32 when build target is Win32 API
@@ -29,9 +31,6 @@
# define WIN32
#endif
-/* Data type definition of ares_socklen_t. */
-typedef unsigned ares_socklen_t;
-
#include <sys/types.h>
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
@@ -297,6 +296,13 @@ typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd,
CARES_EXTERN int ares_library_init(int flags);
+CARES_EXTERN int ares_library_init_mem(int flags,
+ void *(*amalloc)(size_t size),
+ void (*afree)(void *ptr),
+ void *(*arealloc)(void *ptr, size_t size));
+
+CARES_EXTERN int ares_library_initialized(void);
+
CARES_EXTERN void ares_library_cleanup(void);
CARES_EXTERN const char *ares_version(int *version);
@@ -338,6 +344,9 @@ CARES_EXTERN void ares_set_socket_callback(ares_channel channel,
ares_sock_create_callback callback,
void *user_data);
+CARES_EXTERN int ares_set_sortlist(ares_channel channel,
+ const char *sortstr);
+
CARES_EXTERN void ares_send(ares_channel channel,
const unsigned char *qbuf,
int qlen,
@@ -473,8 +482,17 @@ struct ares_txt_reply {
struct ares_txt_reply *next;
unsigned char *txt;
size_t length; /* length excludes null termination */
- unsigned char record_start; /* 1 - if start of new record
- * 0 - if a chunk in the same record */
+};
+
+/* NOTE: This structure is a superset of ares_txt_reply
+ */
+struct ares_txt_ext {
+ struct ares_txt_ext *next;
+ unsigned char *txt;
+ size_t length;
+ /* 1 - if start of new record
+ * 0 - if a chunk in the same record */
+ unsigned char record_start;
};
struct ares_naptr_reply {
@@ -540,6 +558,10 @@ CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf,
int alen,
struct ares_txt_reply** txt_out);
+CARES_EXTERN int ares_parse_txt_reply_ext(const unsigned char* abuf,
+ int alen,
+ struct ares_txt_ext** txt_out);
+
CARES_EXTERN int ares_parse_naptr_reply(const unsigned char* abuf,
int alen,
struct ares_naptr_reply** naptr_out);
@@ -556,7 +578,6 @@ 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;
@@ -566,15 +587,32 @@ struct ares_addr_node {
} addr;
};
+struct ares_addr_port_node {
+ struct ares_addr_port_node *next;
+ int family;
+ union {
+ struct in_addr addr4;
+ struct ares_in6_addr addr6;
+ } addr;
+ int udp_port;
+ int tcp_port;
+};
+
CARES_EXTERN int ares_set_servers(ares_channel channel,
struct ares_addr_node *servers);
+CARES_EXTERN int ares_set_servers_ports(ares_channel channel,
+ struct ares_addr_port_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_set_servers_ports_csv(ares_channel channel,
+ const char* servers);
CARES_EXTERN int ares_get_servers(ares_channel channel,
struct ares_addr_node **servers);
+CARES_EXTERN int ares_get_servers_ports(ares_channel channel,
+ struct ares_addr_port_node **servers);
CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst,
ares_socklen_t size);
diff --git a/deps/cares/include/ares_build.h b/deps/cares/include/ares_build.h
new file mode 100644
index 0000000000..199eae8b8e
--- /dev/null
+++ b/deps/cares/include/ares_build.h
@@ -0,0 +1,117 @@
+/* ares_build.h. Generated from ares_build.h.in by configure. */
+#ifndef __CARES_BUILD_H
+#define __CARES_BUILD_H
+
+
+/* Copyright (C) 2009 by Daniel Stenberg et al
+ *
+ * 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.
+ */
+
+/* ================================================================ */
+/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * Nothing in this file is intended to be modified or adjusted by the
+ * c-ares library user nor by the c-ares library builder.
+ *
+ * If you think that something actually needs to be changed, adjusted
+ * or fixed in this file, then, report it on the c-ares development
+ * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
+ *
+ * This header file shall only export symbols which are 'cares' or 'CARES'
+ * prefixed, otherwise public name space would be polluted.
+ *
+ * NOTE 2:
+ * -------
+ *
+ * Right now you might be staring at file ares_build.h.in or ares_build.h,
+ * this is due to the following reason:
+ *
+ * On systems capable of running the configure script, the configure process
+ * will overwrite the distributed ares_build.h file with one that is suitable
+ * and specific to the library being configured and built, which is generated
+ * from the ares_build.h.in template file.
+ *
+ */
+
+/* ================================================================ */
+/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
+/* ================================================================ */
+
+#ifdef CARES_SIZEOF_LONG
+# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
+ Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
+#endif
+
+#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
+# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
+ Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
+#endif
+
+#ifdef CARES_SIZEOF_ARES_SOCKLEN_T
+# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
+ Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
+#endif
+
+/* ================================================================ */
+/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
+/* ================================================================ */
+
+/* Configure process defines this to 1 when it finds out that system */
+/* header file ws2tcpip.h must be included by the external interface. */
+
+#ifdef WIN32
+# define CARES_PULL_WS2TCPIP_H 1
+#else
+# define CARES_PULL_SYS_TYPES_H 1
+# define CARES_PULL_SYS_SOCKET_H 1
+#endif
+
+/* #undef CARES_PULL_WS2TCPIP_H */
+#ifdef CARES_PULL_WS2TCPIP_H
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#endif
+
+/* Configure process defines this to 1 when it finds out that system */
+/* header file sys/types.h must be included by the external interface. */
+#ifdef CARES_PULL_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+/* Configure process defines this to 1 when it finds out that system */
+/* header file sys/socket.h must be included by the external interface. */
+#ifdef CARES_PULL_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+
+/* The size of `long', as computed by sizeof. */
+/* #undef CARES_SIZEOF_LONG */
+
+/* Integral data type used for ares_socklen_t. */
+#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
+
+/* The size of `ares_socklen_t', as computed by sizeof. */
+#define CARES_SIZEOF_ARES_SOCKLEN_T 4
+
+/* Data type definition of ares_socklen_t. */
+typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
+
+#endif /* __CARES_BUILD_H */
diff --git a/deps/cares/include/ares_rules.h b/deps/cares/include/ares_rules.h
new file mode 100644
index 0000000000..44f08f807c
--- /dev/null
+++ b/deps/cares/include/ares_rules.h
@@ -0,0 +1,130 @@
+#ifndef __CARES_RULES_H
+#define __CARES_RULES_H
+
+
+/* Copyright (C) 2009 by Daniel Stenberg et al
+ *
+ * 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.
+ */
+
+/* ================================================================ */
+/* COMPILE TIME SANITY CHECKS */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * All checks done in this file are intentionally placed in a public
+ * header file which is pulled by ares.h when an application is
+ * being built using an already built c-ares library. Additionally
+ * this file is also included and used when building the library.
+ *
+ * If compilation fails on this file it is certainly sure that the
+ * problem is elsewhere. It could be a problem in the ares_build.h
+ * header file, or simply that you are using different compilation
+ * settings than those used to build the library.
+ *
+ * Nothing in this file is intended to be modified or adjusted by the
+ * c-ares library user nor by the c-ares library builder.
+ *
+ * Do not deactivate any check, these are done to make sure that the
+ * library is properly built and used.
+ *
+ * You can find further help on the c-ares development mailing list:
+ * http://cool.haxx.se/mailman/listinfo/c-ares/
+ *
+ * NOTE 2
+ * ------
+ *
+ * Some of the following compile time checks are based on the fact
+ * that the dimension of a constant array can not be a negative one.
+ * In this way if the compile time verification fails, the compilation
+ * will fail issuing an error. The error description wording is compiler
+ * dependent but it will be quite similar to one of the following:
+ *
+ * "negative subscript or subscript is too large"
+ * "array must have at least one element"
+ * "-1 is an illegal array size"
+ * "size of array is negative"
+ *
+ * If you are building an application which tries to use an already
+ * built c-ares library and you are getting this kind of errors on
+ * this file, it is a clear indication that there is a mismatch between
+ * how the library was built and how you are trying to use it for your
+ * application. Your already compiled or binary library provider is the
+ * only one who can give you the details you need to properly use it.
+ */
+
+/*
+ * Verify that some macros are actually defined.
+ */
+
+#ifndef CARES_TYPEOF_ARES_SOCKLEN_T
+# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
+ Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
+#endif
+
+#ifndef CARES_SIZEOF_ARES_SOCKLEN_T
+# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!"
+ Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing
+#endif
+
+/*
+ * Macros private to this header file.
+ */
+
+#define CareschkszEQ(t, s) sizeof(t) == s ? 1 : -1
+
+#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
+
+/*
+ * Verify that the size previously defined and expected for
+ * ares_socklen_t is actually the the same as the one reported
+ * by sizeof() at compile time.
+ */
+
+typedef char
+ __cares_rule_02__
+ [CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)];
+
+/*
+ * Verify at compile time that the size of ares_socklen_t as reported
+ * by sizeof() is greater or equal than the one reported for int for
+ * the current compilation.
+ */
+
+typedef char
+ __cares_rule_03__
+ [CareschkszGE(ares_socklen_t, int)];
+
+/* ================================================================ */
+/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
+/* ================================================================ */
+
+/*
+ * Get rid of macros private to this header file.
+ */
+
+#undef CareschkszEQ
+#undef CareschkszGE
+
+/*
+ * Get rid of macros not intended to exist beyond this point.
+ */
+
+#undef CARES_PULL_WS2TCPIP_H
+#undef CARES_PULL_SYS_TYPES_H
+#undef CARES_PULL_SYS_SOCKET_H
+
+#undef CARES_TYPEOF_ARES_SOCKLEN_T
+
+#endif /* __CARES_RULES_H */