Commit Graph

71 Commits

Author SHA1 Message Date
Andrew Ayer 11e37a92ef Add ares_set_socket_configure_callback()
This function sets a callback that is invoked after the socket is
created, but before the connection is established.  This is an ideal
time to customize various socket options.
2016-02-09 10:05:04 -08:00
David Drysdale 7972adc5d7 api: Add entrypoints to allow use of per-server ports
Add user-visible entrypoints ares_{get,set}_servers_ports(3), which
take struct ares_addr_port_node rather than struct ares_addr_node.
This structure includes a UDP and TCP port number; if this is set
to zero, the channel-wide port values are used as before.

Similarly, add a new ares_set_servers_ports_csv(3) entrypoint, which
is analogous to ares_set_servers(3) except it doesn't ignore any
specified port information; instead, any per-server specified port
is used as both the UDP and TCP port for that server.

The internal struct ares_addr is extended to hold the UDP/TCP ports,
stored in network order, with the convention that a value of zero
indicates that the channel-wide UDP/TCP port should be used.

For the internal implementation of ares_dup(3), shift to use the
_ports() version of the get/set functions, so port information is
transferred correctly to the new channel.

Update manpages, and add missing ares_set_servers_csv to the lists
while we're at it
2016-02-02 10:13:46 +00:00
David Drysdale f1bcfa1122 api: Allow injection of user-specified malloc/free functions
Add a new ares_library_init_mem() initialization function for the
library which allows the library user to specify their own malloc,
realloc & free equivalents for use library-wide.

Store these function pointers in library-wide global variables,
defaulting to libc's malloc(), realloc() and free().

Change all calls to malloc, realloc and free to use the function pointer
instead.  Also ensure that ares_strdup() is always available
(even if the local environment includes strdup(3)), and change the
library code to always use it.

Convert calls to calloc() to use ares_malloc() + memset
2016-02-02 10:05:07 +00:00
David Drysdale d493e9b17c api: Add option to expose some internal functions
Purely for testing, add --enable-expose-statics option to configure
which converts some static internal functions to be externally visible.
2016-02-02 10:05:07 +00:00
David Drysdale b619d13693 api: Expose the ares_library_initialized() function 2016-02-02 10:05:07 +00:00
Daniel Stenberg efdd616118 timeoffset: made static and private
ares__timeoffset() was only used once within this single source file
2013-08-27 13:06:57 +02:00
Daniel Stenberg 30c9031afa timeadd: make static
ares__timeadd() was only ever used from within the same source
2013-08-27 13:02:35 +02:00
Daniel Stenberg 9c03cc118c ares__generate_new_id: moved to ares_query.c
... and ares__rc4 is turned into a local static function.
2013-02-13 14:58:04 +01:00
Yang Tse 4718066ea4 ares_private.h: use again memdebug.h instead of curl_memdebug.h 2013-01-04 12:30:52 +01:00
Yang Tse 5b5066d6bc ares_private.h: use curl_memdebug.h instead of memdebug.h 2012-12-28 20:18:14 +01:00
Yang Tse a1035276c1 Header inclusion clean-up
Remove header inclusions already done in setup_once.h
2012-12-14 18:25:56 +01:00
hpopescu@ixiacom.com 90364defb0 Added new feature (rfc2671) 2012-08-17 00:54:47 +02:00
Yang Tse a831da792d fix MSVC compiler warning 'conditional expression is constant' 2011-09-04 17:23:39 +02:00
David Stuart 6518b56a5e IPv6-on-windows: find DNS servers correctly 2011-05-17 11:53:13 +02:00
Yang Tse 5b6a188909 build: move platform stuff to ares_platform.c and ares_platform.h 2011-03-24 11:31:50 +01:00
Yang Tse bd066ab8ef build: find out windows platform using GetVersionEx() 2011-03-23 20:53:28 +01:00
Yang Tse 822fd0f877 build: use getenv() replacement function for systems which lack it 2011-03-23 13:44:42 +01:00
Guenter Knauf 28ff9336d5 Replaced uint32_t with unsigned int to fix broken builds on a couple of platforms. 2010-07-29 23:27:46 +02:00
Ben Greear e3b04e5a47 local-bind: Support binding to local interface/IPs
Add 3 new functions to set the local binding for the out-going
socket connection, and add ares_set_servers_csv() to set a
list of servers at once as a comma-separated string.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2010-07-18 23:58:39 +02:00
Daniel Stenberg 63627fa5ab remove all $Id$ lines 2010-03-27 19:42:02 +01:00
Yang Tse 8fe746fcf2 Added IPv6 name servers support 2010-03-05 20:01:47 +00:00
Yang Tse 91031e8ce4 Make header inclusion depend on HAVE_*_H definition 2009-11-09 12:56:50 +00:00
Yang Tse f3346ca16b Fix compiler warning 2009-10-08 18:38:29 +00:00
Yang Tse f34c2a879b sclose() function-like macro definition used to close a socket,
now solely based on HAVE_CLOSESOCKET and HAVE_CLOSESOCKET_CAMEL
config file preprocessor definitions.
2009-06-19 00:41:03 +00:00
Yang Tse 546ef23c3e fix comment 2009-06-13 00:20:41 +00:00
Yang Tse ea46b347bb Revert last change, it is inappropriate. 2009-06-12 23:50:33 +00:00
Gisle Vanem 51a10c962a Replace CURLDEBUG with DEBUGBUILD. 2009-06-12 14:15:13 +00:00
Yang Tse cf3301f024 Make ares_init(), ares_dup() and ares_init_options() return ARES_ENOTINITIALIZED
if library initialization has not been performed calling ares_library_init().
2009-05-26 18:00:14 +00:00
Daniel Stenberg 8362245c42 - Phil Blundell added the internal function ares__expand_name_for_response()
that is now used by the ares_parse_*_reply() functions instead of the
  ares_expand_name() simply to easier return ARES_EBADRESP for the cases where
  the name expansion fails as in responses that really isn't expected.
2009-01-11 13:49:13 +00:00
Daniel Stenberg f61fa37f40 Gregor Jasny provided the patch that introduces ares_set_socket_callback(),
and I edited it to also get duped by ares_dup().
2008-12-04 12:53:03 +00:00
Daniel Stenberg f31add0695 Convert the public config struct to the same binary size/construct as in the
latest releases to remain ABI compatible.
2008-12-01 19:06:24 +00:00
Yang Tse aa1534eb20 In preparation for the upcomming IPv6 nameservers patch, the internal
ares_addr union is now changed into an internal struct which also holds
the address family.
2008-11-25 16:26:58 +00:00
Daniel Stenberg acf5ca090a use unsigned short better intead of mixing with ints to prevent compiler
warnings
2008-11-20 07:50:48 +00:00
Daniel Stenberg 1a1b4eb4f2 - Carlo Contavalli added support for the glibc "rotate" option, as documented
in man resolv.conf:

  causes round robin selection of nameservers from among those listed.  This
  has the effect of spreading the query load among all listed servers, rather
  than having all clients try the first listed server first every time.

  You can enable it with ARES_OPT_ROTATE
2008-11-01 18:35:19 +00:00
Yang Tse 1a9795b401 rearrange to allow internal/private use of ares_writev to any system
that lacks the writev function.
2008-09-16 16:42:48 +00:00
Yang Tse 746f3e2942 rearrange to allow internal/private use of ares_strcasecmp to any system that
lacks the strcasecmp function.
2008-09-15 15:28:26 +00:00
Yang Tse 797372b0f4 strdup() clone for systems/configurations which lack it 2008-09-11 04:02:49 +00:00
Yang Tse 2265b9281c fix compiler warning 2008-07-10 08:21:48 +00:00
Yang Tse 0129767bf9 if'def out private function ares__tvdiff(), it is not in use yet. 2008-05-20 01:24:19 +00:00
Daniel Stenberg 46dbd9461a - Introducing millisecond resolution support for the timeout option. See
ares_init_options()'s ARES_OPT_TIMEOUTMS.
2008-05-13 20:48:48 +00:00
Yang Tse 0848b4fdaa Use monotonic time source if available. 2008-05-09 16:30:24 +00:00
Yang Tse 7cd35ce698 Define WIN32 when build target is Win32 API.
This also defines it for WinCE even though it is a subset of WIN32.
2007-11-08 18:13:54 +00:00
Yang Tse 343d6f221f Avoid inline C99ism, and move c-ares routines for managing doubly-linked lists. 2007-10-02 02:18:01 +00:00
Steinar H. Gunderson 04e49e09dc Previously, processing a large batch of timeouts was O(n^2) in the number of
outstanding queries, and processing a DNS response packet was O(n) in the
number of outstanding queries. To speed things up in Google, we added a few circular,
doubly-linked lists of queries that are hash-bucketed based on
the attributes we care about, so most important operations are now O(1).

It might be that the number of buckets are higher than most people would need,
but on a quick calculation it should only be 100kB or so even on a 64-bit
system, so I've let it stay as-is.
2007-09-29 18:18:47 +00:00
Steinar H. Gunderson 50ba81cd23 Make the query callbacks return the number of timeouts that happened during the execution of a query, and update documentation accordingly. (Patch from the Google tree.) 2007-09-28 14:46:51 +00:00
Steinar H. Gunderson b669e17544 Three fixes in one commit (sorry): a) Take care of the tcpbuf if it ends while queued for transmission, note broken servers and close them in the main loop, and store TCP socket generation number in order not to send the same query twice over the same socket. 2007-09-28 14:28:14 +00:00
Daniel Stenberg 7a77f24d26 Shmulik Regev brought cryptographically secure transaction IDs 2007-05-30 21:11:10 +00:00
Gisle Vanem f34c89a9a2 Moved select_s() to Makefile.dj since select() is used in applications. 2006-11-07 13:29:15 +00:00
Gisle Vanem 8e881e02f5 Added definition of select() for Watt32. 2006-10-31 17:25:48 +00:00
Yang Tse bed83eaf82 Provide multiple header inclusion prevention definition __ARES_PRIVATE_H 2006-07-26 10:54:08 +00:00