Commit 62ba929b authored by Jason Madden's avatar Jason Madden

Update c-ares to 1.14. Fixes #1105.

parent 1c8c7375
......@@ -72,6 +72,7 @@
- Make :meth:`gevent.socket.socket.sendall` up to ten times faster on
PyPy3, through the same change that was applied in gevent 1.1b3 for PyPy2.
- Update c-ares to 1.14.0. See :issue:`1105`.
1.3a1 (2018-01-27)
==================
......
- Modify the c-ares Makefile.in[c] to empty out the MANPAGES variables
so that we don't have to ship those in the sdist.
......@@ -37,6 +37,7 @@ Frederic Germain
Geert Uytterhoeven
George Neill
Gisle Vanem
Google LLC
Gregor Jasny
Guenter Knauf
Guilherme Balena Versiani
......@@ -45,6 +46,7 @@ Henrik Stoerner
Jakub Hrozek
James Bursa
Jérémy Lal
John Schember
Keith Shaw
Lei Shi
Marko Kreen
......
This diff is collapsed.
This diff is collapsed.
# c-ares license
Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS
file.
Copyright 1998 by the Massachusetts Institute of Technology.
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.
......@@ -55,9 +55,10 @@ noinst_PROGRAMS =$(PROGS)
EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \
TODO ares_build.h.in cares.rc README.msvc $(MSVCFILES) \
$(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL.md \
README.md LICENSE.md
CMakeLists.txt ares_build.h.cmake ares_config.h.cmake c-ares-config.cmake.in \
libcares.pc.cmake README.md LICENSE.md RELEASE-PROCEDURE.md
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
......
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -165,8 +165,9 @@ libcares_la_LIBADD =
am__objects_1 = libcares_la-ares__close_sockets.lo \
libcares_la-ares__get_hostent.lo \
libcares_la-ares__read_line.lo libcares_la-ares__timeval.lo \
libcares_la-ares_cancel.lo libcares_la-ares_data.lo \
libcares_la-ares_destroy.lo libcares_la-ares_expand_name.lo \
libcares_la-ares_android.lo libcares_la-ares_cancel.lo \
libcares_la-ares_data.lo libcares_la-ares_destroy.lo \
libcares_la-ares_expand_name.lo \
libcares_la-ares_expand_string.lo libcares_la-ares_fds.lo \
libcares_la-ares_free_hostent.lo \
libcares_la-ares_free_string.lo libcares_la-ares_getenv.lo \
......@@ -547,9 +548,10 @@ MSVCFILES = vc/vc6aws.dsw vc/acountry/vc6acountry.dsp vc/adig/vc6adig.dsp \
EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \
TODO ares_build.h.in cares.rc README.msvc $(MSVCFILES) \
$(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL.md \
README.md LICENSE.md
CMakeLists.txt ares_build.h.cmake ares_config.h.cmake c-ares-config.cmake.in \
libcares.pc.cmake README.md LICENSE.md RELEASE-PROCEDURE.md
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
DISTCLEANFILES = ares_build.h
......@@ -597,6 +599,7 @@ CSOURCES = ares__close_sockets.c \
ares__get_hostent.c \
ares__read_line.c \
ares__timeval.c \
ares_android.c \
ares_cancel.c \
ares_data.c \
ares_destroy.c \
......@@ -665,59 +668,7 @@ HHEADERS = ares.h \
ares_setup.h \
setup_once.h
MANPAGES = ares_cancel.3 \
ares_destroy.3 \
ares_destroy_options.3 \
ares_dup.3 \
ares_expand_name.3 \
ares_expand_string.3 \
ares_fds.3 \
ares_free_data.3 \
ares_free_hostent.3 \
ares_free_string.3 \
ares_get_servers.3 \
ares_get_servers_ports.3 \
ares_gethostbyaddr.3 \
ares_gethostbyname.3 \
ares_gethostbyname_file.3 \
ares_getnameinfo.3 \
ares_getsock.3 \
ares_init.3 \
ares_init_options.3 \
ares_library_cleanup.3 \
ares_library_init.3 \
ares_library_initialized.3 \
ares_mkquery.3 \
ares_create_query.3 \
ares_parse_a_reply.3 \
ares_parse_aaaa_reply.3 \
ares_parse_mx_reply.3 \
ares_parse_naptr_reply.3 \
ares_parse_ns_reply.3 \
ares_parse_ptr_reply.3 \
ares_parse_soa_reply.3 \
ares_parse_srv_reply.3 \
ares_parse_txt_reply.3 \
ares_process.3 \
ares_query.3 \
ares_save_options.3 \
ares_search.3 \
ares_send.3 \
ares_set_local_dev.3 \
ares_set_local_ip4.3 \
ares_set_local_ip6.3 \
ares_set_servers.3 \
ares_set_servers_csv.3 \
ares_set_servers_ports.3 \
ares_set_servers_ports_csv.3 \
ares_set_socket_callback.3 \
ares_set_socket_configure_callback.3 \
ares_set_sortlist.3 \
ares_strerror.3 \
ares_timeout.3 \
ares_version.3 \
ares_inet_pton.3 \
ares_inet_ntop.3
MANPAGES =
HTMLPAGES = ares_cancel.html \
ares_destroy.html \
......@@ -1005,6 +956,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__get_hostent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__read_line.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__timeval.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_android.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_cancel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_create_query.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_data.Plo@am__quote@
......@@ -1102,6 +1054,13 @@ libcares_la-ares__timeval.lo: ares__timeval.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__timeval.lo `test -f 'ares__timeval.c' || echo '$(srcdir)/'`ares__timeval.c
libcares_la-ares_android.lo: ares_android.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_android.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_android.Tpo -c -o libcares_la-ares_android.lo `test -f 'ares_android.c' || echo '$(srcdir)/'`ares_android.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_android.Tpo $(DEPDIR)/libcares_la-ares_android.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_android.c' object='libcares_la-ares_android.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_android.lo `test -f 'ares_android.c' || echo '$(srcdir)/'`ares_android.c
libcares_la-ares_cancel.lo: ares_cancel.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_cancel.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_cancel.Tpo -c -o libcares_la-ares_cancel.lo `test -f 'ares_cancel.c' || echo '$(srcdir)/'`ares_cancel.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_cancel.Tpo $(DEPDIR)/libcares_la-ares_cancel.Plo
......@@ -1846,7 +1805,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
......@@ -1872,7 +1831,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
......@@ -1890,7 +1849,7 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
......@@ -1900,7 +1859,7 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
......
......@@ -3,6 +3,7 @@ CSOURCES = ares__close_sockets.c \
ares__get_hostent.c \
ares__read_line.c \
ares__timeval.c \
ares_android.c \
ares_cancel.c \
ares_data.c \
ares_destroy.c \
......@@ -71,59 +72,7 @@ HHEADERS = ares.h \
ares_setup.h \
setup_once.h
MANPAGES = ares_cancel.3 \
ares_destroy.3 \
ares_destroy_options.3 \
ares_dup.3 \
ares_expand_name.3 \
ares_expand_string.3 \
ares_fds.3 \
ares_free_data.3 \
ares_free_hostent.3 \
ares_free_string.3 \
ares_get_servers.3 \
ares_get_servers_ports.3 \
ares_gethostbyaddr.3 \
ares_gethostbyname.3 \
ares_gethostbyname_file.3 \
ares_getnameinfo.3 \
ares_getsock.3 \
ares_init.3 \
ares_init_options.3 \
ares_library_cleanup.3 \
ares_library_init.3 \
ares_library_initialized.3 \
ares_mkquery.3 \
ares_create_query.3 \
ares_parse_a_reply.3 \
ares_parse_aaaa_reply.3 \
ares_parse_mx_reply.3 \
ares_parse_naptr_reply.3 \
ares_parse_ns_reply.3 \
ares_parse_ptr_reply.3 \
ares_parse_soa_reply.3 \
ares_parse_srv_reply.3 \
ares_parse_txt_reply.3 \
ares_process.3 \
ares_query.3 \
ares_save_options.3 \
ares_search.3 \
ares_send.3 \
ares_set_local_dev.3 \
ares_set_local_ip4.3 \
ares_set_local_ip6.3 \
ares_set_servers.3 \
ares_set_servers_csv.3 \
ares_set_servers_ports.3 \
ares_set_servers_ports_csv.3 \
ares_set_socket_callback.3 \
ares_set_socket_configure_callback.3 \
ares_set_sortlist.3 \
ares_strerror.3 \
ares_timeout.3 \
ares_version.3 \
ares_inet_pton.3 \
ares_inet_ntop.3
MANPAGES =
HTMLPAGES = ares_cancel.html \
ares_destroy.html \
......
......@@ -87,11 +87,10 @@ USE_WATT32 = 0
!ENDIF
# ------------------------------------------------------------------
# Base subdir is the common root from which other subdirs will hang,
# the name depends on MSVC version being used when building c-ares.
# Base subdir is the common root from which other subdirs will hang.
# ------------------------------------------------------------------
BASE_DIR = .\$(CC_VERS_STR)
BASE_DIR = .\msvc
# ----------------------------------------
# Subdir holding sources for all projects
......@@ -189,9 +188,9 @@ EX_LIBS_REL = ws2_32.lib advapi32.lib kernel32.lib
EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib
!ENDIF
# -----------------------------------------
# Switches that depend on compiler version
# -----------------------------------------
# -------------------------------------------------
# Switches that depend on ancient compiler versions
# -------------------------------------------------
!IF $(CC_VERS_NUM) == 60
PDB_NONE = /pdb:none
......
......@@ -5,6 +5,7 @@ c-ares
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/03i7151772eq3wn3/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares)
[![Coverage Status](https://coveralls.io/repos/c-ares/c-ares/badge.svg?branch=master&service=github)](https://coveralls.io/github/c-ares/c-ares?branch=master)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/291/badge)](https://bestpractices.coreinfrastructure.org/projects/291)
[![Releases](https://coderelease.io/badge/c-ares/c-ares)](https://coderelease.io/github/repository/c-ares/c-ares)
This is c-ares, an asynchronous resolver library. It is intended for
applications which need to perform DNS queries without blocking, or need to
......
c-ares version 1.13.0
c-ares version 1.14.0
Changes:
o cmake build system support added
o Add virtual function set for socket IO: ares_set_socket_functions [5]
o android: Introduce new ares_library_init_android() call for Oreo support. [5]
Bug fixes:
o CVE-2017-1000381: c-ares NAPTR parser out of bounds access [1]
o macos: do not set HAVE_CLOCK_GETTIME_MONOTONIC
o test: check ares_create_query with too-long name
o dist: add ares_library_initialized.* to the tarball
o fix build on OpenBSD
o dist: ship msvc_ver.inc too [2]
o test: Add gTest/gMock files to SOURCES
o test: add fuzz entrypoint for ares_create_query()
o configure: clock_gettime workaround [3]
o docs: convert INSTALL to MarkDown & tweak [4]
o ares_process: fix return type of socket_create function (win32 warning)
o docs: fixed references to ares_set_local_ip4 and ares_set_local_ip6
o Windows DNS server sorting [6]
o Use ares_socklen_t instead of socket_t [7]
o ares_create_query: use ares_free not naked free
o msvc_ver.inc support most recent Visual Studio 2017 [8]
o acountry: Convert char from ISO-8859-1 to UTF-8 [9]
o ares_expand_name: limit number of indirections
o configure: do not check for ar if specified manually [10]
o Added support for Windows DNS Suffix Search List [11]
o ares.h: support compiling with QNX [12]
o Fix patch for CVE-2017-1000381 to not be overly aggressive. [1]
o win32: Preserve DNS server order returned by Windows when sorting and exclude
DNS servers in legacy subnets. [2] [4]
o win32: Support most recent Visual Studio 2017
o gethostbyaddr should fail with ECANCELLED not ENOTFOUND when ares_cancel
is called. [3]
o win32: Exclude legacy ipv6 subnets [4]
o android: Applications compiled for Oreo can no longer use
__system_property_get and must use Java calls to retrieve DNS servers.
[5] [7]
o win32: Force use of ANSI functions [6]
o CMake minimum version is now 3.1
o ares_gethostbyname.3: fix callback status values [8]
o docs: Document WSAStartup requirement [9]
o Fix a typo in init_by_resolv_conf [10]
o Android JNI code leaks local references in some cases [11]
o Force using the ANSI versions of WinAPI functions [12]
Thanks go to these friendly people for their efforts and contributions:
Aaron Bieber, Andrew Sullivan, Brad House, Bruce Stephens, Calle Wilund,
Chris Araman, Christian Ammer, Daniel Stenberg, David Drysdale, David Hotham,
Dionna Glaze, Gregor Jasny, Michael Osei, Mulle kybernetiK, noiz at github,
Sergii Pylypenko, Stephen Sorley, Thomas Köckerbauer,
AC Thompson, Anna Henningsen, Antonio Tajuelo, Brad House, Brad Spencer,
Christian Ammer, Daniel Stenberg, David Drysdale, David Hotham, Felix Yan,
Gergely Nagy, Gregor Jasny, Jakub Hrozek, John Schember,
Konstantinos Sofokleous, Roman Teterin, Sergey Kolomenkin, Sheel Bedi,
(18 contributors)
References to bug reports and discussions on issues:
[1] = https://c-ares.haxx.se/adv_20170620.html
[2] = https://github.com/c-ares/c-ares/issues/69
[3] = https://github.com/c-ares/c-ares/issues/71
[4] = https://github.com/c-ares/c-ares/issues/83
[5] = https://github.com/c-ares/c-ares/issues/72
[6] = https://github.com/c-ares/c-ares/issues/81
[7] = https://github.com/c-ares/c-ares/issues/92
[8] = https://github.com/c-ares/c-ares/issues/101
[9] = https://github.com/c-ares/c-ares/issues/97
[10] = https://github.com/c-ares/c-ares/issues/62
[11] = https://github.com/c-ares/c-ares/issues/93
[12] = https://github.com/c-ares/c-ares/issues/113
[1] = https://github.com/c-ares/c-ares/commit/18ea99
[2] = https://github.com/c-ares/c-ares/issues/150
[3] = https://github.com/c-ares/c-ares/pull/138
[4] = https://github.com/c-ares/c-ares/pull/144
[5] = https://github.com/c-ares/c-ares/pull/148
[6] = https://github.com/c-ares/c-ares/pull/142
[7] = https://github.com/c-ares/c-ares/pull/175
[8] = https://c-ares.haxx.se/mail/c-ares-archive-2011-06/0012.shtml
[9] = https://github.com/c-ares/c-ares/pull/180
[10] = https://github.com/c-ares/c-ares/pull/160
[11] = https://github.com/c-ares/c-ares/pull/175
[12] = https://github.com/c-ares/c-ares/pull/142
# generated automatically by aclocal 1.15 -*- Autoconf -*-
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2014 Free Software Foundation, Inc.
# Copyright (C) 2002-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.15'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.15], [],
m4_if([$1], [1.15.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
......@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.15])dnl
[AM_AUTOMAKE_VERSION([1.15.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -408,7 +408,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -605,7 +605,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -626,7 +626,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
# Copyright (C) 2003-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -648,7 +648,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -683,7 +683,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -733,7 +733,7 @@ rm -f confinc confmf
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -772,7 +772,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -801,7 +801,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -848,7 +848,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -867,7 +867,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -948,7 +948,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1008,7 +1008,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1036,7 +1036,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2014 Free Software Foundation, Inc.
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1055,7 +1055,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2014 Free Software Foundation, Inc.
# Copyright (C) 2004-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......
......@@ -68,6 +68,10 @@
# include <netinet/in.h>
#endif
#if defined(ANDROID) || defined(__ANDROID__)
#include <jni.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
......@@ -307,6 +311,12 @@ CARES_EXTERN int ares_library_init_mem(int flags,
void (*afree)(void *ptr),
void *(*arealloc)(void *ptr, size_t size));
#if defined(ANDROID) || defined(__ANDROID__)
CARES_EXTERN void ares_library_init_jvm(JavaVM *jvm);
CARES_EXTERN int ares_library_init_android(jobject connectivity_manager);
CARES_EXTERN int ares_library_android_initialized(void);
#endif
CARES_EXTERN int ares_library_initialized(void);
CARES_EXTERN void ares_library_cleanup(void);
......
This diff is collapsed.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_CANCEL 3 "31 March 2004"
.SH NAME
ares_cancel \- Cancel a resolve
.SH SYNOPSIS
.nf
#include <ares.h>
void ares_cancel(ares_channel \fIchannel\fP)
.fi
.SH DESCRIPTION
The \fBares_cancel(3)\fP function cancels all lookups/requests made on the the
name service channel identified by \fIchannel\fP. \fBares_cancel(3)\fP
invokes the callbacks for each pending query on the channel, passing a status
of
.BR ARES_ECANCELLED .
These calls give the callbacks a chance to clean up any state which might have
been stored in their arguments. If such a callback invocation adds a new
request to the channel, that request will \fInot\fP be cancelled by the
current invocation of \fBares_cancel(3)\fP.
.SH SEE ALSO
.BR ares_init (3)
.BR ares_destroy (3)
.SH NOTES
This function was added in c-ares 1.2.0
c-ares 1.6.0 and earlier pass a status of
.BR ARES_ETIMEOUT
instead of
.BR ARES_ECANCELLED .
.SH AUTHOR
Dirk Manske
......@@ -337,6 +337,9 @@
/* Define to 1 if you have the ws2tcpip.h header file. */
#undef HAVE_WS2TCPIP_H
/* Define if __system_property_get exists. */
#undef HAVE___SYSTEM_PROPERTY_GET
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
......
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_CREATE_QUERY 3 "17 Aug 2012"
.SH NAME
ares_create_query \- Compose a single-question DNS query buffer
.SH SYNOPSIS
.nf
#include <ares.h>
int ares_create_query(const char *\fIname\fP,
int \fIdnsclass\fP,
int \fItype\fP,
unsigned short \fIid\fP,
int \fIrd\fP,
unsigned char **\fIbuf\fP,
int *\fIbuflen\fP,
int \fImax_udp_size\fP)
.fi
.SH DESCRIPTION
The \fIares_create_query(3)\fP function composes a DNS query with a single
question. The parameter \fIname\fP gives the query name as a NUL-terminated C
string of period-separated labels optionally ending with a period; periods and
backslashes within a label must be escaped with a backlash.
The parameters \fIdnsclass\fP and \fItype\fP give the class and type of the
query using the values defined in \fB<arpa/nameser.h>\fP.
The parameter \fIid\fP gives a 16-bit identifier for the query.
The parameter \fIrd\fP should be nonzero if recursion is desired, zero if not.
The query will be placed in an allocated buffer, a pointer to which will be
stored in the variable pointed to by \fIbuf\fP, and the length of which will
be stored in the variable pointed to by \fIbuflen\fP.
It is the caller's responsibility to free this buffer using
\fIares_free_string(3)\fP when it is no longer needed. The parameter
\fImax_udp_size\fP should be nonzero to activate EDNS. Usage of
\fIares_create_query(3)\fP\ with \fImax_udp_size\fP set to zero is equivalent
to using \fIares_mkquery(3)\fP.
.SH RETURN VALUES
.B ares_create_query
can return any of the following values:
.TP 15
.B ARES_SUCCESS
Construction of the DNS query succeeded.
.TP 15
.B ARES_EBADNAME
The query name
.I name
could not be encoded as a domain name, either because it contained a
zero-length label or because it contained a label of more than 63
characters.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH AVAILABILITY
Added in c-ares 1.10.0
.SH SEE ALSO
.BR ares_expand_name (3),
.BR ares_free_string (3),
.BR ares_mkquery (3)
.SH AUTHOR
......@@ -40,10 +40,9 @@
void ares_free_data(void *dataptr)
{
while (dataptr != NULL) {
struct ares_data *ptr;
if (!dataptr)
return;
void *next_data = NULL;
#ifdef __INTEL_COMPILER
# pragma warning(push)
......@@ -65,7 +64,7 @@ void ares_free_data(void *dataptr)
case ARES_DATATYPE_MX_REPLY:
if (ptr->data.mx_reply.next)
ares_free_data(ptr->data.mx_reply.next);
next_data = ptr->data.mx_reply.next;
if (ptr->data.mx_reply.host)
ares_free(ptr->data.mx_reply.host);
break;
......@@ -73,7 +72,7 @@ void ares_free_data(void *dataptr)
case ARES_DATATYPE_SRV_REPLY:
if (ptr->data.srv_reply.next)
ares_free_data(ptr->data.srv_reply.next);
next_data = ptr->data.srv_reply.next;
if (ptr->data.srv_reply.host)
ares_free(ptr->data.srv_reply.host);
break;
......@@ -82,7 +81,7 @@ void ares_free_data(void *dataptr)
case ARES_DATATYPE_TXT_EXT:
if (ptr->data.txt_reply.next)
ares_free_data(ptr->data.txt_reply.next);
next_data = ptr->data.txt_reply.next;
if (ptr->data.txt_reply.txt)
ares_free(ptr->data.txt_reply.txt);
break;
......@@ -90,19 +89,19 @@ void ares_free_data(void *dataptr)
case ARES_DATATYPE_ADDR_NODE:
if (ptr->data.addr_node.next)
ares_free_data(ptr->data.addr_node.next);
next_data = ptr->data.addr_node.next;
break;
case ARES_DATATYPE_ADDR_PORT_NODE:
if (ptr->data.addr_port_node.next)
ares_free_data(ptr->data.addr_port_node.next);
next_data = ptr->data.addr_port_node.next;
break;
case ARES_DATATYPE_NAPTR_REPLY:
if (ptr->data.naptr_reply.next)
ares_free_data(ptr->data.naptr_reply.next);
next_data = ptr->data.naptr_reply.next;
if (ptr->data.naptr_reply.flags)
ares_free(ptr->data.naptr_reply.flags);
if (ptr->data.naptr_reply.service)
......@@ -125,6 +124,8 @@ void ares_free_data(void *dataptr)
}
ares_free(ptr);
dataptr = next_data;
}
}
......
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_DESTROY 3 "7 December 2004"
.SH NAME
ares_destroy \- Destroy a resolver channel
.SH SYNOPSIS
.nf
#include <ares.h>
void ares_destroy(ares_channel \fIchannel\fP)
.fi
.SH DESCRIPTION
The \fBares_destroy(3)\fP function destroys the name service channel
identified by \fIchannel\fP, freeing all memory and closing all sockets used
by the channel.
\fBares_destroy(3)\fP invokes the callbacks for each pending query on the
channel, passing a status of \fIARES_EDESTRUCTION\fP. These calls give the
callbacks a chance to clean up any state which might have been stored in their
arguments. A callback must not add new requests to a channel being destroyed.
.SH SEE ALSO
.BR ares_init (3),
.BR ares_cancel (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_DESTROY_OPTIONS 3 "1 June 2007"
.SH NAME
ares_destroy_options \- Destroy options initialized with ares_save_options
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_destroy_options(struct ares_options *\fIoptions\fP)
.fi
.SH DESCRIPTION
The \fBares_destroy_options(3)\fP function destroys the options struct
identified by \Ioptions\fP, freeing all memory allocated by
\fBares_save_options(3)\fP.
.SH SEE ALSO
.BR ares_save_options (3),
.BR ares_init_options (3)
.SH AUTHOR
Brad House
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Copyright (C) 2004-2009 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.
.\"
.TH ARES_DUP 3 "26 May 2009"
.SH NAME
ares_dup \- Duplicate a resolver channel
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_dup(ares_channel *\fIdest\fP, ares_channel \fIsource\fP)
.fi
.SH DESCRIPTION
The \fBares_dup(3)\fP function duplicates an existing communications channel
for name service lookups. If it returns successfully, \fBares_dup(3)\fP will
set the variable pointed to by \fIdest\fP to a handle used to identify the
name service channel. The caller should invoke \fIares_destroy(3)\fP on the
handle when the channel is no longer needed.
.SH SEE ALSO
.BR ares_destroy(3),
.BR ares_init(3),
.BR ares_library_init(3)
.SH AVAILABILITY
\fIares_dup(3)\fP was added in c-ares 1.6.0
.SH AUTHOR
Daniel Stenberg
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_EXPAND_NAME 3 "20 Nov 2009"
.SH NAME
ares_expand_name \- Expand a DNS-encoded domain name
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_expand_name(const unsigned char *\fIencoded\fP,
.B const unsigned char *\fIabuf\fP, int \fIalen\fP, char **\fIs\fP,
.B long *\fIenclen\fP)
.fi
.SH DESCRIPTION
The
.B ares_expand_name
function converts a DNS-encoded domain name to a dot-separated C
string. The argument
.I encoded
gives the beginning of the encoded domain name, and the arguments
.I abuf
and
.I alen
give the containing message buffer (necessary for the processing of
indirection pointers within the encoded domain name). The result is
placed in a NUL-terminated allocated buffer, a pointer to which is
stored in the variable pointed to by
.IR s .
The length of the encoded name is stored in the variable pointed to by
.I enclen
so that the caller can advance past the encoded domain name to read
further data in the message.
Use \fIares_free_string(3)\fP to free the allocated hostname.
.SH RETURN VALUES
.B ares_expand_name
can return any of the following values:
.TP 15
.B ARES_SUCCESS
Expansion of the encoded name succeeded.
.TP 15
.B ARES_EBADNAME
The encoded domain name was malformed and could not be expanded.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_mkquery (3), ares_free_string (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_EXPAND_NAME 3 "20 Nov 2009"
.SH NAME
ares_expand_string \- Expand a length encoded string
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_expand_string(const unsigned char *\fIencoded\fP,
.B const unsigned char *\fIabuf\fP, int \fIalen\fP, unsigned char **\fIs\fP,
.B long *\fIenclen\fP)
.fi
.SH DESCRIPTION
The
.B ares_expand_string
function converts a length encoded string to a NUL-terminated C
string. The argument
.I encoded
gives the beginning of the encoded string, and the arguments
.I abuf
and
.I alen
give the containing message buffer (necessary for the processing of
indirection pointers within the encoded domain name). The result is
placed in a NUL-terminated allocated buffer, a pointer to which is
stored in the variable pointed to by
.IR s .
The length of the encoded string is stored in the variable pointed to by
.I enclen
so that the caller can advance past the encoded string to read
further data in the message.
.SH RETURN VALUES
.B ares_expand_string
can return any of the following values:
.TP 15
.B ARES_SUCCESS
Expansion of the encoded string succeeded.
.TP 15
.B ARES_EBADSTR
The encoded string was malformed and could not be expanded.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_free_string (3)
.SH AUTHOR
Dominick Meglio
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_FDS 3 "23 July 1998"
.SH NAME
ares_fds \- return file descriptors to select on
.SH SYNOPSIS
.nf
#include <ares.h>
int ares_fds(ares_channel \fIchannel\fP,
fd_set *\fIread_fds\fP,
fd_set *\fIwrite_fds\fP)
.fi
.SH DESCRIPTION
The \fBares_fds(3)\fP function retrieves the set of file descriptors which the
calling application should select on for reading and writing for the
processing of name service queries pending on the name service channel
identified by \fIchannel\fP.
File descriptors will be set in the file descriptor sets pointed to by
\fIread_fds\fP and \fIwrite_fds\fP as appropriate. File descriptors already
set in \fIread_fds\fP and \fIwrite_fds\fP will remain set; initialization of
the file descriptor sets (using \fBFD_ZERO\fP) is the responsibility of the
caller.
.SH RETURN VALUES
\fBares_fds(3)\fP returns a value that is one greater than the number of the
highest socket set in either \fIread_fds\fP or \fIwrite_fds\fP. If no queries
are active, \fBares_fds(3)\fP returns 0.
.SH SEE ALSO
.BR ares_timeout (3),
.BR ares_process (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\" Copyright (C) 2004-2010 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.
.\"
.TH ARES_FREE_DATA 3 "5 March 2010"
.SH NAME
ares_free_data \- Free data allocated by several c-ares functions
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_free_data(void *\fIdataptr\fP)
.PP
.B cc file.c -lcares
.fi
.SH DESCRIPTION
.PP
The
.B ares_free_data(3)
function frees one or more data structures allocated and returned
by several c-ares functions. Specifically the data returned by the
following list of functions must be deallocated using this function.
.TP 5
.B ares_get_servers(3)
When used to free the data returned by ares_get_servers(3) this
will free the whole linked list of ares_addr_node structures returned
by ares_get_servers(3).
.TP
.B ares_parse_srv_reply(3)
When used to free the data returned by ares_parse_srv_reply(3) this
will free the whole linked list of ares_srv_reply structures returned
by ares_parse_srv_reply(3), along with any additional storage
associated with those structures.
.TP
.B ares_parse_mx_reply(3)
When used to free the data returned by ares_parse_mx_reply(3) this
will free the whole linked list of ares_mx_reply structures returned
by ares_parse_mx_reply(3), along with any additional storage
associated with those structures.
.TP
.B ares_parse_txt_reply(3)
When used to free the data returned by ares_parse_txt_reply(3) this
will free the whole linked list of ares_txt_reply structures returned
by ares_parse_txt_reply(3), along with any additional storage
associated with those structures.
.TP
.B ares_parse_soa_reply(3)
When used to free the data returned by ares_parse_soa_reply(3) this
will free the ares_soa_reply structure, along with any additional storage
associated with those structure.
.SH RETURN VALUE
The ares_free_data() function does not return a value.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.7.0.
.SH SEE ALSO
.BR ares_get_servers(3),
.BR ares_parse_srv_reply(3),
.BR ares_parse_mx_reply(3),
.BR ares_parse_txt_reply(3),
.BR ares_parse_soa_reply(3)
.SH AUTHOR
Yang Tse
.PP
Copyright 1998 by the Massachusetts Institute of Technology.
.br
Copyright (C) 2004-2010 by Daniel Stenberg.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_FREE_HOSTENT 3 "23 July 1998"
.SH NAME
ares_free_hostent \- Free host structure allocated by ares functions
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_free_hostent(struct hostent *\fIhost\fP)
.fi
.SH DESCRIPTION
The
.I ares_free_hostent
function frees a
.B struct hostent
allocated by one of the functions \fIares_parse_a_reply(3)\fP,
\fIares_parse_aaaa_reply(3)\fP, or \fIares_parse_ptr_reply(3)\fP.
.SH NOTES
It is not necessary (and is not correct) to free the host structure passed to
the callback functions for \fIares_gethostbyname(3)\fP or
\fIares_gethostbyaddr(3)\fP. c-ares will automatically free such host
structures when the callback returns.
.SH SEE ALSO
.BR ares_parse_a_reply (3),
.BR ares_parse_aaaa_reply (3),
.BR ares_parse_ptr_reply (3),
.BR ares_parse_ns_reply (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 2000 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_FREE_STRING 3 "4 February 2004"
.SH NAME
ares_free_string \- Free strings allocated by ares functions
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_free_string(void *\fIstr\fP)
.fi
.SH DESCRIPTION
The \fIares_free_string(3)\fP function frees a string allocated by an ares
function.
.SH SEE ALSO
.BR ares_mkquery (3)
.BR ares_expand_string (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 2000 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\" Copyright (C) 2008-2010 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.
.\"
.TH ARES_GET_SERVERS 3 "5 March 2010"
.SH NAME
ares_get_servers, ares_get_servers_ports \- Retrieve name servers from an initialized ares_channel
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_get_servers(ares_channel \fIchannel\fP, struct ares_addr_node **\fIservers\fP)
.B int ares_get_servers_ports(ares_channel \fIchannel\fP, struct ares_addr_port_node **\fIservers\fP)
.fi
.SH DESCRIPTION
The \fBares_get_servers(3)\fP function retrieves name servers configuration
from the
channel data identified by
.IR channel ,
as a linked list of ares_addr_node structs storing a pointer to the first
node at the address specified by
.IR servers .
The \fBares_get_servers_ports(3)\fP function also retrieves any per-server
port information that may have been previously configured, returning a linked
list of ares_addr_port structures.
Function caller may traverse the returned name server linked list, or may use
it directly as suitable input for the \fBares_set_servers(3)\fP /
\fBares_set_servers_ports(3)\fP functions, but
shall not shrink or extend the list on its own.
Each node of the name server linked list is stored in memory dynamically
allocated and managed by c-ares. It is the caller's responsibility to free
the resulting linked list, using \fBares_free_data(3)\fP , once the caller
does not need it any longer.
This function is capable of handling IPv4 and IPv6 name server
addresses simultaneously, rendering \fBares_save_options(3)\fP with
optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
IPv4-only name server usage.
.SH RETURN VALUES
This function may return any of the following values:
.TP 15
.B ARES_SUCCESS
The name servers configuration was successfully retrieved
.TP 15
.B ARES_ENOMEM
The memory was exhausted
.TP 15
.B ARES_ENODATA
The channel data identified by
.IR channel
was invalid.
.SH SEE ALSO
.BR ares_set_servers (3),
.BR ares_init_options (3),
.BR ares_save_options(3)
.SH AVAILABILITY
\fBares_get_servers(3)\fP was added in c-ares 1.7.1;
\fBares_get_servers_ports(3)\fP was added in c-ares 1.11.0.
.SH AUTHOR
Implementation of this function and associated library internals are based
on code, comments and feedback provided in November and December of 2008 by
Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
shuffled all the bits and this function popped out.
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.br
Copyright (C) 2008-2010 by Daniel Stenberg
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_GETHOSTBYADDR 3 "24 July 1998"
.SH NAME
ares_gethostbyaddr \- Initiate a host query by address
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
.B int \fItimeouts\fP, struct hostent *\fIhostent\fP)
.PP
.B void ares_gethostbyaddr(ares_channel \fIchannel\fP, const void *\fIaddr\fP,
.B int \fIaddrlen\fP, int \fIfamily\fP, ares_host_callback \fIcallback\fP,
.B void *\fIarg\fP)
.fi
.SH DESCRIPTION
The
.B ares_gethostbyaddr
function initiates a host query by address on the name service channel
identified by
.IR channel .
The parameters
.I addr
and
.I addrlen
give the address as a series of bytes, and
.I family
gives the type of address. When the query is complete or has failed, the ares
library will invoke \fIcallback\fP. Completion or failure of the query may
happen immediately, or may happen during a later call to
\fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
.PP
The callback argument
.I arg
is copied from the
.B ares_gethostbyaddr
argument
.IR arg .
The callback argument
.I status
indicates whether the query succeeded and, if not, how it failed. It
may have any of the following values:
.TP 19
.B ARES_SUCCESS
The host lookup completed successfully.
.TP 19
.B ARES_ENOTIMP
The ares library does not know how to look up addresses of type
.IR family .
.TP 19
.B ARES_ENOTFOUND
The address
.I addr
was not found.
.TP 19
.B ARES_ENOMEM
Memory was exhausted.
.TP 19
.B ARES_ECANCELLED
The query was cancelled.
.TP 19
.B ARES_EDESTRUCTION
The name service channel
.I channel
is being destroyed; the query will not be completed.
.PP
The callback argument
.I timeouts
reports how many times a query timed out during the execution of the
given request.
.PP
On successful completion of the query, the callback argument
.I hostent
points to a
.B struct hostent
containing the name of the host returned by the query. The callback
need not and should not attempt to free the memory pointed to by
.IR hostent ;
the ares library will free it when the callback returns. If the query
did not complete successfully,
.I hostent
will be
.BR NULL .
.SH SEE ALSO
.BR ares_process (3),
.BR ares_gethostbyname (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
......@@ -157,7 +157,7 @@ static void addr_callback(void *arg, int status, int timeouts,
}
end_aquery(aquery, status, host);
}
else if (status == ARES_EDESTRUCTION)
else if (status == ARES_EDESTRUCTION || status == ARES_ECANCELLED)
end_aquery(aquery, status, NULL);
else
next_lookup(aquery);
......@@ -190,18 +190,18 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host)
char tmp[MAX_PATH];
HKEY hkeyHosts;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
&hkeyHosts) == ERROR_SUCCESS)
{
DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts);
}
}
else if (platform == WIN_9X)
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH);
else
return ARES_ENOTFOUND;
......
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_GETHOSTBYNAME 3 "25 July 1998"
.SH NAME
ares_gethostbyname \- Initiate a host query by name
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
.B int \fItimeouts\fP, struct hostent *\fIhostent\fP)
.PP
.B void ares_gethostbyname(ares_channel \fIchannel\fP, const char *\fIname\fP,
.B int \fIfamily\fP, ares_host_callback \fIcallback\fP, void *\fIarg\fP)
.fi
.SH DESCRIPTION
The
.B ares_gethostbyname
function initiates a host query by name on the name service channel
identified by
.IR channel .
The parameter
.I name
gives the hostname as a NUL-terminated C string, and
.I family
gives the desired type of address for the resulting host entry. When the
query is complete or has failed, the ares library will invoke \fIcallback\fP.
Completion or failure of the query may happen immediately, or may happen
during a later call to \fIares_process(3)\fP, \fIares_destroy(3)\fP or
\fIares_cancel(3)\fP.
.PP
The callback argument
.I arg
is copied from the
.B ares_gethostbyname
argument
.IR arg .
The callback argument
.I status
indicates whether the query succeeded and, if not, how it failed. It
may have any of the following values:
.TP 19
.B ARES_SUCCESS
The host lookup completed successfully.
.TP 19
.B ARES_ENOTIMP
The ares library does not know how to find addresses of type
.IR family .
.TP 19
.B ARES_EBADNAME
The hostname
.B name
is composed entirely of numbers and periods, but is not a valid
representation of an Internet address.
.TP 19
.B ARES_ENOTFOUND
The address
.I addr
was not found.
.TP 19
.B ARES_ENOMEM
Memory was exhausted.
.TP 19
.B ARES_ECANCELLED
The query was cancelled.
.TP 19
.B ARES_EDESTRUCTION
The name service channel
.I channel
is being destroyed; the query will not be completed.
.PP
The callback argument
.I timeouts
reports how many times a query timed out during the execution of the
given request.
.PP
On successful completion of the query, the callback argument
.I hostent
points to a
.B struct hostent
containing the name of the host returned by the query. The callback
need not and should not attempt to free the memory pointed to by
.IR hostent ;
the ares library will free it when the callback returns. If the query
did not complete successfully,
.I hostent
will be
.BR NULL .
.SH SEE ALSO
.BR ares_process (3),
.BR ares_gethostbyaddr (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
......@@ -351,18 +351,18 @@ static int file_lookup(const char *name, int family, struct hostent **host)
char tmp[MAX_PATH];
HKEY hkeyHosts;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
&hkeyHosts) == ERROR_SUCCESS)
{
DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts);
}
}
else if (platform == WIN_9X)
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH);
else
return ARES_ENOTFOUND;
......
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_GETHOSTBYNAME 3 "25 July 1998"
.SH NAME
ares_gethostbyname_file \- Lookup a name in the system's hosts file
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_gethostbyname_file(ares_channel \fIchannel\fP, const char *\fIname\fP,
.B int \fIfamily\fP, struct hostent **host)
.fi
.SH DESCRIPTION
The
.B ares_gethostbyname_file
function performs a host lookup by name against the system's hosts file (or equivalent local hostname database).
The
.IR channel
parameter is required, but no asynchronous queries are performed. Instead, the
lookup is done via the same mechanism used to perform 'f' lookups
(see the
.I lookups
options field in \fIares_init_options(3)\fP).
The parameter
.I name
gives the hostname as a NUL-terminated C string, and
.I family
gives the desired type of address for the resulting host entry.
.PP
The return value indicates whether the query succeeded and, if not, how it
failed. It may have any of the following values:
.TP 19
.B ARES_SUCCESS
The host lookup completed successfully and
.I host
now points to the result (and must be freed with \fIares_free_hostent(3)\fP).
.TP 19
.B ARES_ENOTFOUND
The hostname
.I name
was not found.
.TP 19
.B ARES_EFILE
There was a file I/O error while performing the lookup.
.TP 19
.B ARES_ENOMEM
Memory was exhausted.
.PP
On successful completion of the query, the pointer pointed to by
.I host
points to a
.B struct hostent
containing the address of the host returned by the lookup. The user must
free the memory pointed to by
.IR host
when finished with it by calling \fIares_free_hostent(3)\fP. If the lookup did
not complete successfully,
.I host
will be
.BR NULL .
.SH AVAILABILITY
Added in c-ares 1.5.4
.SH SEE ALSO
.BR ares_gethostbyname (3),
.BR ares_free_hostent (3),
.BR ares_init_options (3)
.SH AUTHOR
Brad Spencer
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 2005 by Dominick Meglio.
.\"
.\" 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.
.\"
.TH ARES_GETNAMEINFO 3 "1 May 2009"
.SH NAME
ares_getnameinfo \- Address-to-nodename translation in protocol-independent manner
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B typedef void (*ares_nameinfo_callback)(void *\fIarg\fP, int \fIstatus\fP,
.B int \fItimeouts\fP, char *\fInode\fP, char *\fIservice\fP)
.PP
.B void ares_getnameinfo(ares_channel \fIchannel\fP, const struct sockaddr *\fIsa\fP,
.B ares_socklen_t \fIsalen\fP, int \fIflags\fP, ares_nameinfo_callback \fIcallback\fP,
.B void *\fIarg\fP)
.fi
.SH DESCRIPTION
The
.B ares_getnameinfo
function is defined for protocol-independent address translation. The function
is a combination of \fIares_gethostbyaddr(3)\fP and \fIgetservbyport(3)\fP. The function will
translate the address either by executing a host query on the name service channel
identified by
.IR channel
or it will attempt to resolve it locally if possible.
The parameters
.I sa
and
.I len
give the address as a sockaddr structure, and
.I flags
gives the options that the function will use. Valid flags are listed below:
.TP 19
.B ARES_NI_NOFQDN
Only the nodename portion of the FQDN is returned for local hosts.
.TP 19
.B ARES_NI_NUMERICHOST
The numeric form of the hostname is returned rather than the name.
.TP 19
.B ARES_NI_NAMEREQD
An error is returned if the hostname cannot be found in the DNS.
.TP 19
.B ARES_NI_NUMERICSERV
The numeric form of the service is returned rather than the name.
.TP 19
.B ARES_NI_TCP
The service name is to be looked up for the TCP protocol.
.TP 19
.B ARES_NI_UDP
The service name is to be looked up for the UDP protocol.
.TP 19
.B ARES_NI_SCTP
The service name is to be looked up for the SCTP protocol.
.TP 19
.B ARES_NI_DCCP
The service name is to be looked up for the DCCP protocol.
.TP 19
.B ARES_NI_NUMERICSCOPE
The numeric form of the scope ID is returned rather than the name.
.TP 19
.B ARES_NI_LOOKUPHOST
A hostname lookup is being requested.
.TP 19
.B ARES_NI_LOOKUPSERVICE
A service name lookup is being requested.
.PP
When the query
is complete or has
failed, the ares library will invoke \fIcallback\fP. Completion or failure of
the query may happen immediately, or may happen during a later call to
\fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
.PP
The callback argument
.I arg
is copied from the
.B ares_getnameinfo
argument
.IR arg .
The callback argument
.I status
indicates whether the query succeeded and, if not, how it failed. It
may have any of the following values:
.TP 19
.B ARES_SUCCESS
The host lookup completed successfully.
.TP 19
.B ARES_ENOTIMP
The ares library does not know how to look up addresses of type
.IR family .
.TP 19
.B ARES_ENOTFOUND
The address
.I addr
was not found.
.TP 19
.B ARES_ENOMEM
Memory was exhausted.
.TP 19
.B ARES_ECANCELLED
The query was cancelled.
.TP 19
.B ARES_EDESTRUCTION
The name service channel
.I channel
is being destroyed; the query will not be completed.
.TP 19
.B ARES_EBADFLAGS
The
.I flags
parameter contains an illegal value.
.PP
The callback argument
.I timeouts
reports how many times a query timed out during the execution of the
given request.
.PP
On successful completion of the query, the callback argument
.I node
contains a string representing the hostname (assuming
.B ARES_NI_LOOKUPHOST
was specified). Additionally,
.I service
contains a string representing the service name (assuming
.B ARES_NI_LOOKUPSERVICE
was specified).
If the query did not complete successfully, or one of the values
was not requested,
.I node
or
.I service
will be
.BR NULL .
.SH SEE ALSO
.BR ares_process (3),
.SH AUTHOR
Dominick Meglio
.br
Copyright 2005 by Dominick Meglio.
.\"
.\" Copyright 1998 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.
.\"
.TH ARES_GETSOCK 3 "11 March 2010"
.SH NAME
ares_getsock \- get socket descriptors to wait on
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_getsock(ares_channel \fIchannel\fP, ares_socket_t *\fIsocks\fP,
.B int \fInumsocks\fP);
.fi
.SH DESCRIPTION
The
.B ares_getsock
function retrieves the set of socket descriptors which the calling
application should wait on for reading and/or writing for the
processing of name service queries pending on the name service channel
identified by
.IR channel .
Socket descriptors will be set in the socket descriptor array pointed to by
\fIsocks\fP.
\fInumsocks\fP is the size of the given array in number of ints.
This function can only return information about up to 16 sockets. If more are
in use (however unlikely that is), they are simply not reported back.
.SH RETURN VALUES
\fBares_getsock\fP returns a bitmask for what actions to wait for on the
different sockets. The ares.h header file provides these convenience macros to
extract the information appropriately:
.nf
#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)))
.fi
.SH NOTES
This function was added in c-ares 1.3.1
.SH SEE ALSO
.BR ares_timeout (3),
.BR ares_fds (3),
.BR ares_process (3)
.\"
.\" Copyright (C) 2013 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.
.\"
.TH ARES_INET_NTOP 3 "17 Feb 2013"
.SH NAME
ares_inet_ntop \- convert a network format address to presentation format
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B const char *
.B ares_inet_ntop(int af, const void *src, char *dst, ares_socklen_t size);
.fi
.SH DESCRIPTION
This is a portable version with the identical functionality of the commonly
available \fIinet_ntop\fP.
The ares_inet_ntop() function converts a numeric address into a text string
suitable for presentation. The \fBaf\fP argument shall specify the family of
the address. This can be AF_INET or AF_INET6. The \fBsrc\fP argument points
to a buffer holding an IPv4 address if the af argument is AF_INET, or an IPv6
address if the af argument is AF_INET6; the address must be in network byte
order. The \fBdst\fP argument points to a buffer where the function stores the
resulting text string; it shall not be NULL. The \fBsize\fP argument specifies
the size of this buffer, which shall be large enough to hold the text string
(INET_ADDRSTRLEN (16) characters for IPv4, INET6_ADDRSTRLEN (46) characters
for IPv6).
.SH SEE ALSO
.BR ares_init(3),
.BR ares_inet_pton(3)
.SH AVAILABILITY
made properly publicly available in c-ares for real in version 1.10.0
.SH AUTHOR
Daniel Stenberg
.\"
.\" Copyright (C) 2013 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.
.\"
.TH ARES_INET_PTON 3 "17 Feb 2013"
.SH NAME
ares_inet_pton \- convert an IPv4 or IPv6 address from text to binary form
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B const char *ares_inet_pton(int af, const char *src, void *dst);
.fi
.SH DESCRIPTION
This is a portable version with the identical functionality of the commonly
available \fIinet_pton\fP.
The ares_inet_pton() function converts the address in its standard text
presentation form into its numeric binary form. The \fBaf\fP argument shall
specify the family of the address. The AF_INET and AF_INET6 address families
shall be supported. The \fBsrc\fP argument points to the string being passed
in. The \fBdst\fP argument points to a buffer into which the function stores
the numeric address; this shall be large enough to hold the numeric address
(32 bits for AF_INET, 128 bits for AF_INET6).
.SH SEE ALSO
.BR ares_init(3),
.BR ares_inet_ntop(3)
.SH AVAILABILITY
made properly publicly available in c-ares for real in version 1.10.0
.SH AUTHOR
Daniel Stenberg
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\" Copyright (C) 2004-2010 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.
.\"
.TH ARES_INIT 3 "5 March 2010"
.SH NAME
ares_init \- Initialize a resolver channel
.SH SYNOPSIS
.nf
#include <ares.h>
int ares_init(ares_channel *\fIchannelptr\fP)
.fi
.SH DESCRIPTION
The \fBares_init(3)\fP function initializes a communications channel for name
service lookups. If it returns successfully, \fBares_init(3)\fP will set the
variable pointed to by \fIchannelptr\fP to a handle used to identify the name
service channel. The caller should invoke \fIares_destroy(3)\fP on the handle
when the channel is no longer needed.
The \fIares_init_options(3)\fP function is provide to offer more init
alternatives.
.SH RETURN VALUES
\fIares_init(3)\fP can return any of the following values:
.TP 14
.B ARES_SUCCESS
Initialization succeeded.
.TP 14
.B ARES_EFILE
A configuration file could not be read.
.TP 14
.B ARES_ENOMEM
The process's available memory was exhausted.
.TP 14
.B ARES_ENOTINITIALIZED
c-ares library initialization not yet performed.
.SH NOTES
When initializing from
.B /etc/resolv.conf,
.BR ares_init (3)
reads the
.I domain
and
.I search
directives to allow lookups of short names relative to the domains
specified. The
.I domain
and
.I search
directives override one another. If more that one instance of either
.I domain
or
.I search
directives is specified, the last occurrence wins. For more information,
please see the
.BR resolv.conf (5)
manual page.
.SH SEE ALSO
.BR ares_init_options(3),
.BR ares_destroy(3),
.BR ares_dup(3),
.BR ares_library_init(3),
.BR ares_set_servers(3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.br
Copyright (C) 2004-2010 by Daniel Stenberg.
This diff is collapsed.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\" Copyright (C) 2004-2010 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.
.\"
.TH ARES_INIT 3 "5 March 2010"
.SH NAME
ares_init_options \- Initialize a resolver channel
.SH SYNOPSIS
.nf
#include <ares.h>
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;
int ednspsz;
};
int ares_init_options(ares_channel *\fIchannelptr\fP,
struct ares_options *\fIoptions\fP,
int \fIoptmask\fP)
.fi
.SH DESCRIPTION
The \fBares_init_options(3)\fP function initializes a communications channel
for name service lookups. If it returns successfully,
\fBares_init_options(3)\fP will set the variable pointed to by
\fIchannelptr\fP to a handle used to identify the name service channel. The
caller should invoke \fIares_destroy(3)\fP on the handle when the channel is
no longer needed.
The \fIoptmask\fP parameter generally specifies which fields in the structure pointed to
by \fIoptions\fP are set, as follows:
.TP 18
.B ARES_OPT_FLAGS
.B int \fIflags\fP;
.br
Flags controlling the behavior of the resolver. See below for a
description of possible flag values.
.TP 18
.B ARES_OPT_TIMEOUT
.B int \fItimeout\fP;
.br
The number of seconds each name server is given to respond to a query on the
first try. (After the first try, the timeout algorithm becomes more
complicated, but scales linearly with the value of \fItimeout\fP.) The
default is five seconds. This option is being deprecated by
\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2.
.TP 18
.B ARES_OPT_TIMEOUTMS
.B int \fItimeout\fP;
.br
The number of milliseconds each name server is given to respond to a query on
the first try. (After the first try, the timeout algorithm becomes more
complicated, but scales linearly with the value of \fItimeout\fP.) The
default is five seconds. Note that this option is specified with the same
struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits
that tell c-ares how to interpret the number. This option was added in c-ares
1.5.2.
.TP 18
.B ARES_OPT_TRIES
.B int \fItries\fP;
.br
The number of tries the resolver will try contacting each name server
before giving up. The default is four tries.
.TP 18
.B ARES_OPT_NDOTS
.B int \fIndots\fP;
.br
The number of dots which must be present in a domain name for it to be
queried for "as is" prior to querying for it with the default domain
extensions appended. The default value is 1 unless set otherwise by
resolv.conf or the RES_OPTIONS environment variable.
.TP 18
.B ARES_OPT_UDP_PORT
.B unsigned short \fIudp_port\fP;
.br
The port to use for queries over UDP, in network byte order.
The default value is 53 (in network byte order), the standard name
service port.
.TP 18
.B ARES_OPT_TCP_PORT
.B unsigned short \fItcp_port\fP;
.br
The port to use for queries over TCP, in network byte order.
The default value is 53 (in network byte order), the standard name
service port.
.TP 18
.B ARES_OPT_SERVERS
.B struct in_addr *\fIservers\fP;
.br
.B int \fInservers\fP;
.br
The list of IPv4 servers to contact, instead of the servers specified in
resolv.conf or the local named. In order to allow specification of either
IPv4 or IPv6 name servers, the
.BR ares_set_servers(3)
function must be used instead.
.TP 18
.B ARES_OPT_DOMAINS
.B char **\fIdomains\fP;
.br
.B int \fIndomains\fP;
.br
The domains to search, instead of the domains specified in resolv.conf
or the domain derived from the kernel hostname variable.
.TP 18
.B ARES_OPT_LOOKUPS
.B char *\fIlookups\fP;
.br
The lookups to perform for host queries.
.I lookups
should be set to a string of the characters "b" or "f", where "b"
indicates a DNS lookup and "f" indicates a lookup in the hosts file.
.TP 18
.B ARES_OPT_SOCK_STATE_CB
.B void (*\fIsock_state_cb\fP)(void *data, int s, int read, int write);
.br
.B void *\fIsock_state_cb_data\fP;
.br
A callback function to be invoked when a socket changes state.
.I s
will be passed the socket whose state has changed;
.I read
will be set to true if the socket should listen for read events, and
.I write
will be set to true if the socket should listen for write events.
The value of
.I sock_state_cb_data
will be passed as the
.I data
argument.
.TP 18
.B ARES_OPT_SORTLIST
.B struct apattern *\fIsortlist\fP;
.br
.B int \fInsort\fP;
.br
A list of IP address ranges that specifies the order of preference that
results from \fIares_gethostbyname\fP should be returned in. Note that
this can only be used with a sortlist retrieved via
\fBares_save_options(3)\fP (because
.B struct apattern
is opaque); to set a fresh sort list, use \fBares_set_sortlist(3)\fP.
.TP 18
.B ARES_OPT_SOCK_SNDBUF
.B int \fIsocket_send_buffer_size\fP;
.br
The send buffer size to set for the socket.
.TP 18
.B ARES_OPT_SOCK_RCVBUF
.B int \fIsocket_receive_buffer_size\fP;
.br
The receive buffer size to set for the socket.
.TP 18
.B ARES_OPT_EDNSPSZ
.B int \fIednspsz\fP;
.br
The message size to be advertized in EDNS; only takes effect if the
.B ARES_FLAG_EDNS
flag is set.
.br
.PP
The \fIoptmask\fP parameter also includes options without a corresponding
field in the
.B ares_options
structure, as follows:
.TP 23
.B ARES_OPT_ROTATE
Perform round-robin selection of the nameservers configured for the channel
for each resolution.
.TP 23
.B ARES_OPT_NOROTATE
Do not perform round-robin nameserver selection; always use the list of
nameservers in the same order.
.PP
The
.I flags
field should be the bitwise or of some subset of the following values:
.TP 23
.B ARES_FLAG_USEVC
Always use TCP queries (the "virtual circuit") instead of UDP
queries. Normally, TCP is only used if a UDP query yields a truncated
result.
.TP 23
.B ARES_FLAG_PRIMARY
Only query the first server in the list of servers to query.
.TP 23
.B ARES_FLAG_IGNTC
If a truncated response to a UDP query is received, do not fall back
to TCP; simply continue on with the truncated response.
.TP 23
.B ARES_FLAG_NORECURSE
Do not set the "recursion desired" bit on outgoing queries, so that the name
server being contacted will not try to fetch the answer from other servers if
it doesn't know the answer locally. Be aware that ares will not do the
recursion for you. Recursion must be handled by the application calling ares
if \fIARES_FLAG_NORECURSE\fP is set.
.TP 23
.B ARES_FLAG_STAYOPEN
Do not close communications sockets when the number of active queries
drops to zero.
.TP 23
.B ARES_FLAG_NOSEARCH
Do not use the default search domains; only query hostnames as-is or
as aliases.
.TP 23
.B ARES_FLAG_NOALIASES
Do not honor the HOSTALIASES environment variable, which normally
specifies a file of hostname translations.
.TP 23
.B ARES_FLAG_NOCHECKRESP
Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED
response code or responses whose questions don't match the questions
in the request. Primarily useful for writing clients which might be
used to test or debug name servers.
.TP 23
.B ARES_FLAG_EDNS
Include an EDNS pseudo-resource record (RFC 2671) in generated requests.
.SH RETURN VALUES
\fBares_init_options(3)\fP can return any of the following values:
.TP 14
.B ARES_SUCCESS
Initialization succeeded.
.TP 14
.B ARES_EFILE
A configuration file could not be read.
.TP 14
.B ARES_ENOMEM
The process's available memory was exhausted.
.TP 14
.B ARES_ENOTINITIALIZED
c-ares library initialization not yet performed.
.SH NOTES
When initializing from
.B /etc/resolv.conf,
\fBares_init_options(3)\fP reads the \fIdomain\fP and \fIsearch\fP directives
to allow lookups of short names relative to the domains specified. The
\fIdomain\fP and \fIsearch\fP directives override one another. If more that
one instance of either \fIdomain\fP or \fIsearch\fP directives is specified,
the last occurrence wins. For more information, please see the
.BR resolv.conf (5)
manual page.
.SH SEE ALSO
.BR ares_init(3),
.BR ares_destroy(3),
.BR ares_dup(3),
.BR ares_library_init(3),
.BR ares_save_options(3),
.BR ares_set_servers(3),
.BR ares_set_sortlist(3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.br
Copyright (C) 2004-2010 by Daniel Stenberg.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\" Copyright (C) 2004-2009 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.
.\"
.TH ARES_LIBRARY_CLEANUP 3 "19 May 2009"
.SH NAME
ares_library_cleanup \- c-ares library deinitialization
.SH SYNOPSIS
.nf
#include <ares.h>
void ares_library_cleanup(void)
.fi
.SH DESCRIPTION
.PP
The
.B ares_library_cleanup
function uninitializes the c-ares library, freeing all resources
previously acquired by \fIares_library_init(3)\fP when the library
was initialized, provided there was only one single previous call to
\fIares_library_init(3)\fP. If there was more than one previous call to
\fIares_library_init(3)\fP, this function uninitializes the c-ares
library only if it is the call matching the call to
\fIares_library_init(3)\fP which initialized the library
(usually the very first call to \fIares_library_init(3)\fP).
Other calls to \fIares_library_cleanup(3)\fP have no effect other than
decrementing an internal counter.
.PP
This function must be called when the program using c-ares will
no longer need any c-ares function. Once the program has called
\fIares_library_cleanup(3)\fP sufficiently often such that the
library is uninitialised, it shall not make any further call to any
c-ares function.
.PP
This function does not cancel any pending c-ares lookups or requests
previously done. Program must use \fIares_cancel(3)\fP for this purpose.
.PP
.B This function is not thread safe.
You have to call it once the program is about to terminate, but this call must
be done once the program has terminated every single thread that it could have
initiated. This is required to avoid potential race conditions in library
deinitialization, and also due to the fact that \fIares_library_cleanup(3)\fP
might call functions from other libraries that are thread unsafe, and could
conflict with any other thread that is already using these other libraries.
.PP
Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from
the DllMain function. Doing so will produce deadlocks and other problems.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.7.0 along with the
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an
indication of the availability of this function. Reference counting in
\fIares_library_init()\fP and \fIares_library_cleanup()\fP, which requires
calls to the former function to match calls to the latter, is present since
c-ares version 1.10.0.
Earlier versions would deinitialize the library on the first call
to \fIares_library_cleanup()\fP.
.PP
Since the introduction of this function, it is absolutely mandatory to call it
for any Win32/64 program using c-ares.
.PP
Non-Win32/64 systems can still use c-ares version 1.7.0 without calling
\fIares_library_cleanup(3)\fP due to the fact that \fIcurrently\fP it is nearly
a do-nothing function on non-Win32/64 platforms.
.SH SEE ALSO
.BR ares_library_init(3),
.BR ares_cancel(3)
.SH AUTHOR
Yang Tse
.PP
Copyright 1998 by the Massachusetts Institute of Technology.
.br
Copyright (C) 2004-2009 by Daniel Stenberg.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\" Copyright (C) 2004-2009 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.
.\"
.TH ARES_LIBRARY_INIT 3 "19 May 2009"
.SH NAME
ares_library_init \- c-ares library initialization
.SH SYNOPSIS
.nf
#include <ares.h>
int ares_library_init(int \fIflags\fP)
int ares_library_init_mem(int \fIflags\fP,
void *(*\fIamalloc\fP)(size_t),
void (*\fIafree\fP)(void *ptr),
void (*\fIarealloc\fP)(void *ptr, size_t size))
.fi
.SH DESCRIPTION
.PP
The
.B ares_library_init
function performs initializations internally required by the c-ares
library that must take place before any other function provided by
c-ares can be used in a program.
.PP
This function must be called at least once within the life of a program,
before the program actually executes any other c-ares library function.
Initializations done by this function remain effective until a number of
calls to \fIares_library_cleanup(3)\fP equal to the number of calls to
this function are performed.
.PP
Successive calls to this function do nothing further, only the first
call done when c-ares is in an uninitialized state is actually
effective.
.PP
The
.I flags
parameter is a bit pattern that tells c-ares exactly which features
should be initialized, as described below. Set the desired bits by
ORing the values together. In normal operation you should specify
\fIARES_LIB_INIT_ALL\fP. Don't use any other value unless you are
familiar with it and trying to control some internal c-ares feature.
.PP
The
.B ares_library_init_mem
function allows the caller to provide memory management functions that the
c-ares library will be use instead of \fImalloc(3)\fP, \fIfree(3)\fP and
\fIrealloc(3)\fP.
.PP
.B This function is not thread safe.
You have to call it once the program has started, but this call must be done
before the program starts any other thread. This is required to avoid
potential race conditions in library initialization, and also due to the fact
that \fIares_library_init(3)\fP might call functions from other libraries that
are thread unsafe, and could conflict with any other thread that is already
using these other libraries.
.PP
Win32/64 application DLLs shall not call \fIares_library_init(3)\fP from the
DllMain function. Doing so will produce deadlocks and other problems.
.SH FLAGS
.TP 5
.B ARES_LIB_INIT_ALL
Initialize everything possible. This sets all known bits.
.TP
.B ARES_LIB_INIT_WIN32
Initialize Win32/64 specific libraries.
.TP
.B ARES_LIB_INIT_NONE
Initialize nothing extra. This sets no bit.
.SH RETURN VALUE
Upon successful completion, ares_library_init() will return 0. Otherwise, a
non-zero error number will be returned to indicate the error. Except for
\fIares_strerror(3)\fP, you shall not call any other c-ares function upon
\fIares_library_init(3)\fP failure.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.7.0 along with the
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_INIT\fP as an
indication of the availability of this function. Its recursive behavior,
which requires a matching number of calls to \fIares_library_cleanup()\fP
in order to deinitialize the library, is present since c-ares version
1.10.0. Earlier versions would deinitialize the library on the first call
to \fIares_library_cleanup()\fP.
.PP
Since the introduction of this function it is absolutely mandatory to
call it for any Win32/64 program using c-ares.
.PP
Non-Win32/64 systems can still use c-ares version 1.7.0 without calling
\fIares_library_init(3)\fP due to the fact that \fIcurrently\fP it is nearly
a do-nothing function on non-Win32/64 platforms at this point.
.SH SEE ALSO
.BR ares_library_cleanup(3),
.BR ares_strerror(3)
.SH AUTHOR
Yang Tse
.PP
Copyright 1998 by the Massachusetts Institute of Technology.
.br
Copyright (C) 2004-2009 by Daniel Stenberg.
......@@ -30,6 +30,10 @@ fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses = ZERO_NULL;
fpGetBestRoute2_t ares_fpGetBestRoute2 = ZERO_NULL;
#endif
#if defined(ANDROID) || defined(__ANDROID__)
#include "ares_android.h"
#endif
/* library-private global vars with source visibility restricted to this file */
static unsigned int ares_initialized;
......@@ -160,6 +164,10 @@ void ares_library_cleanup(void)
if (ares_init_flags & ARES_LIB_INIT_WIN32)
ares_win32_cleanup();
#if defined(ANDROID) || defined(__ANDROID__)
ares_library_cleanup_android();
#endif
ares_init_flags = ARES_LIB_INIT_NONE;
ares_malloc = malloc;
ares_realloc = realloc;
......
.\"
.\" Copyright (C) 2016 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.
.\"
.TH ARES_LIBRARY_INITIALIZED 3 "29 Sep 2016"
.SH NAME
ares_library_initialized \- get the initialization state
.SH SYNOPSIS
.nf
#include <ares.h>
int ares_library_initialized(void)
.fi
.SH DESCRIPTION
Returns information if c-ares needs to get initialized.
.SH RETURN VALUE
\fIARES_ENOTINITIALIZED\fP if not initialized and \fIARES_SUCCESS\fP if no
initialization is needed.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.11.0
.SH SEE ALSO
.BR ares_library_init(3),
.BR ares_library_cleanup(3)
.\"
.\" Copyright 1998, 2000 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_MKQUERY 3 "20 Nov 2009"
.SH NAME
ares_mkquery \- Compose a single-question DNS query buffer
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
.B unsigned short \fIid\fP, int \fIrd\fP, unsigned char **\fIbuf\fP,
.B int *\fIbuflen\fP)
.fi
.SH DESCRIPTION
Deprecated function. See \fIares_create_query(3)\fP instead!
The
.B ares_mkquery
function composes a DNS query with a single question.
The parameter
.I name
gives the query name as a NUL-terminated C string of period-separated
labels optionally ending with a period; periods and backslashes within
a label must be escaped with a backlash. The parameters
.I dnsclass
and
.I type
give the class and type of the query using the values defined in
.BR <arpa/nameser.h> .
The parameter
.I id
gives a 16-bit identifier for the query. The parameter
.I rd
should be nonzero if recursion is desired, zero if not. The query
will be placed in an allocated buffer, a pointer to which will be
stored in the variable pointed to by
.IR buf ,
and the length of which will be stored in the variable pointed to by
.IR buflen .
It is the caller's responsibility to free this buffer using
\fIares_free_string(3)\fP when it is no longer needed.
Usage of \fIares_mkquery(3)\fP is deprecated, whereas the function is
equivalent to \fIares_create_query(3)\fP with \fBmax_udp_size\fP set to
0.
.SH RETURN VALUES
.B ares_mkquery
can return any of the following values:
.TP 15
.B ARES_SUCCESS
Construction of the DNS query succeeded.
.TP 15
.B ARES_EBADNAME
The query name
.I name
could not be encoded as a domain name, either because it contained a
zero-length label or because it contained a label of more than 63
characters.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_expand_name (3),
.BR ares_free_string (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998, 2000 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_PARSE_A_REPLY 3 "25 July 1998"
.SH NAME
ares_parse_a_reply \- Parse a reply to a DNS query of type A
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_a_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
.B struct hostent **\fIhost\fP,
.B struct ares_addrttl *\fIaddrttls\fP, int *\fInaddrttls\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_a_reply
function parses the response to a query of type A into a
.BR "struct hostent"
and/or an array of
.BR "struct ares_addrttls" .
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR host ,
if host is nonnull.
It is the caller's responsibility to free the resulting host structure
using
.BR ares_free_hostent (3)
when it is no longer needed.
.PP
If
.IR addrttls
and
.IR naddrttls
are both nonnull,
then up to *naddrttls
.BR "struct ares_addrttl"
records are stored in the array pointed to by addrttls,
and then *naddrttls is set to the number of records so stored.
Note that the memory for these records is supplied by the caller.
.SH RETURN VALUES
.B ares_parse_a_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_gethostbyname (3),
.BR ares_free_hostent (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 2005 by Dominick Meglio.
.\"
.\" 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.
.\"
.TH ARES_PARSE_AAAA_REPLY 3 "20 Nov 2009"
.SH NAME
ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_aaaa_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
.B struct hostent **\fIhost\fP,
.B struct ares_addr6ttl *\fIaddrttls\fP, int *\fInaddrttls\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_aaaa_reply
function parses the response to a query of type AAAA into a
.BR "struct hostent"
and/or an array of
.BR "struct ares_addr6ttl" .
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR host ,
if host is nonnull.
It is the caller's responsibility to free the resulting host structure
using
.BR ares_free_hostent (3)
when it is no longer needed.
.PP
If
.IR addrttls
and
.IR naddrttls
are both nonnull,
then up to *naddrttls
.BR "struct ares_addr6ttl"
records are stored in the array pointed to by addrttls,
and then *naddrttls is set to the number of records so stored.
Note that the memory for these records is supplied by the caller.
.SH RETURN VALUES
.B ares_parse_aaaa_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_gethostbyname (3),
.BR ares_free_hostent (3)
.SH AUTHOR
Dominick Meglio
.br
Copyright 2005 by Dominick Meglio.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_PARSE_MX_REPLY 3 "4 August 2009"
.SH NAME
ares_parse_mx_reply \- Parse a reply to a DNS query of type MX
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_mx_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
.B struct ares_mx_reply** \fImx_out\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_mx_reply
function parses the response to a query of type MX into a
linked list of
.I struct ares_mx_reply
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR mx_out .
It is the caller's responsibility to free the resulting
.IR mx_out
structure when it is no longer needed using the function
.B ares_free_data
.PP
The structure
.I ares_mx_reply
contains the following fields:
.sp
.in +4n
.nf
struct ares_mx_reply {
struct ares_mx_reply *next;
char *host;
unsigned short priority;
};
.fi
.in
.PP
.SH RETURN VALUES
.B ares_parse_mx_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.7.2.
.SH SEE ALSO
.BR ares_query (3)
.BR ares_free_data (3)
.SH AUTHOR
Written by Jeremy Lal <kapouer@melix.org>
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_PARSE_NAPTR_REPLY 3 "23 February 2012"
.SH NAME
ares_parse_naptr_reply \- Parse a reply to a DNS query of type NAPTR
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_naptr_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
.B struct ares_naptr_reply** \fInaptr_out\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_naptr_reply
function parses the response to a query of type NAPTR into a
linked list of
.I struct ares_naptr_reply
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR naptr_out .
It is the caller's responsibility to free the resulting
.IR naptr_out
structure when it is no longer needed using the function
.B ares_free_data
.PP
The structure
.I ares_naptr_reply
contains the following fields:
.sp
.in +4n
.nf
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;
};
.fi
.in
.PP
.SH RETURN VALUES
.B ares_parse_naptr_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.7.6.
.SH SEE ALSO
.BR ares_query (3)
.BR ares_free_data (3)
.SH AUTHOR
Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com
......@@ -110,6 +110,12 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen,
status = ARES_EBADRESP;
break;
}
/* Check if we are really looking at a NAPTR record */
if (rr_class == C_IN && rr_type == T_NAPTR)
{
/* parse the NAPTR record itself */
/* RR must contain at least 7 bytes = 2 x int16 + 3 x name */
if (rr_len < 7)
{
......@@ -117,11 +123,6 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen,
break;
}
/* Check if we are really looking at a NAPTR record */
if (rr_class == C_IN && rr_type == T_NAPTR)
{
/* parse the NAPTR record itself */
/* Allocate storage for this NAPTR answer appending it to the list */
naptr_curr = ares_malloc_data(ARES_DATATYPE_NAPTR_REPLY);
if (!naptr_curr)
......
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_PARSE_NS_REPLY 3 "10 February 2007"
.SH NAME
ares_parse_ns_reply \- Parse a reply to a DNS query of type NS into a hostent
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_ns_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
.B struct hostent **\fIhost\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_ns_reply
function parses the response to a query of type NS into a
.BR "struct hostent" .
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR host .
The nameservers are stored into the
.BR aliases
field of the
.IR host
structure.
It is the caller's responsibility to free the resulting host structure
using
.BR ares_free_hostent (3)
when it is no longer needed.
.SH RETURN VALUES
.B ares_parse_ns_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_query (3),
.BR ares_free_hostent (3)
.SH AUTHOR
Written by Vlad Dinulescu <vlad.dinulescu@avira.com>, on behalf of AVIRA Gmbh http://www.avira.com
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_PARSE_PTR_REPLY 3 "25 July 1998"
.SH NAME
ares_parse_ptr_reply \- Parse a reply to a DNS query of type PTR into a hostent
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_ptr_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
.B const void *\fIaddr\fP, int \fIaddrlen\fP, int \fIfamily\fP,
.B struct hostent **\fIhost\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_ptr_reply
function parses the response to a query of type PTR into a
.BR "struct hostent" .
The parameters
.I abuf
and
.I alen
give the contents of the response. The parameters
.IR addr ,
.IR addrlen ,
and
.I family
specify which address was queried for; they are not used to verify the
response, merely used to fill in the address of the
.BR "struct hostent" .
The resulting
.B struct hostent
is stored in allocated memory and a pointer to it stored into the
variable pointed to by
.IR host .
It is the caller's responsibility to free the resulting host structure
using
.BR ares_free_hostent (3)
when it is no longer needed.
.SH RETURN VALUES
.B ares_parse_ptr_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_gethostbyaddr (3),
.BR ares_free_hostent (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_PARSE_SOA_REPLY 3 "29 May 2012"
.SH NAME
ares_parse_soa_reply \- Parse a reply to a DNS query of type SOA
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_soa_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
.B struct ares_soa_reply** \fIsoa_out\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_soa_reply
function parses the response to a query of type SOA into a
.IR struct\ ares_soa_reply .
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR soa_out .
It is the caller's responsibility to free the resulting
.IR soa_out
structure when it is no longer needed using the function
.B ares_free_data
.PP
The structure
.I ares_soa_reply
contains the following fields:
.sp
.in +4n
.nf
struct ares_soa_reply {
char *nsname;
char *hostmaster;
unsigned int serial;
unsigned int refresh;
unsigned int retry;
unsigned int expire;
unsigned int minttl;
};
.fi
.in
.PP
.SH RETURN VALUES
.B ares_parse_soa_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.9.0.
.SH SEE ALSO
.BR ares_query (3)
.BR ares_free_data (3)
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" 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.
.\"
.TH ARES_PARSE_SRV_REPLY 3 "4 August 2009"
.SH NAME
ares_parse_srv_reply \- Parse a reply to a DNS query of type SRV
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_srv_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
.B struct ares_srv_reply** \fIsrv_out\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_srv_reply
function parses the response to a query of type SRV into a
linked list of
.I struct ares_srv_reply
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR srv_out .
It is the caller's responsibility to free the resulting
.IR srv_out
structure when it is no longer needed using the function
.B ares_free_data
.PP
The structure
.I ares_srv_reply
contains the following fields:
.sp
.in +4n
.nf
struct ares_srv_reply {
struct ares_srv_reply *next;
unsigned short weight;
unsigned short priority;
unsigned short port;
char *host;
};
.fi
.in
.PP
.SH RETURN VALUES
.B ares_parse_srv_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.7.0.
.SH SEE ALSO
.BR ares_query (3)
.BR ares_free_data (3)
.SH AUTHOR
Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com
This diff is collapsed.
......@@ -36,6 +36,10 @@ win_platform ares__getplatform(void)
memset(&OsvEx, 0, sizeof(OsvEx));
OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4996) /* warning C4996: 'GetVersionExW': was declared deprecated */
#endif
if (!GetVersionEx((void *)&OsvEx))
{
memset(&OsvEx, 0, sizeof(OsvEx));
......@@ -43,6 +47,9 @@ win_platform ares__getplatform(void)
if (!GetVersionEx((void *)&OsvEx))
return WIN_UNKNOWN;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
switch(OsvEx.dwPlatformId)
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.\"
.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
.\"
.\" 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.
.\"
.TH ARES_SET_LOCAL_DEV 3 "30 June 2010"
.SH NAME
ares_set_local_dev \- Bind to a specific network device when creating sockets.
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_set_local_dev(ares_channel \fIchannel\fP, const char* \fIlocal_dev_name\fP)
.fi
.SH DESCRIPTION
The \fBares_set_local_dev\fP function causes all future sockets
to be bound to this device with SO_BINDTODEVICE. This forces communications
to go over a certain interface, which can be useful on multi-homed machines.
This option is only supported on Linux, and root privileges are required
for the option to work. If SO_BINDTODEVICE is not supported or the
setsocktop call fails (probably because of permissions), the error is
silently ignored.
.SH SEE ALSO
.BR ares_set_local_ip4 (3)
.BR ares_set_local_ip6 (3)
.SH NOTES
This function was added in c-ares 1.7.4
.SH AUTHOR
Ben Greear
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment