mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
deps: update c-ares to v1.34.1
PR-URL: https://github.com/nodejs/node/pull/55369 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
parent
7a7c2b3d09
commit
0581ccf99e
17
deps/cares/CMakeLists.txt
vendored
17
deps/cares/CMakeLists.txt
vendored
|
|
@ -12,7 +12,7 @@ INCLUDE (CheckCSourceCompiles)
|
|||
INCLUDE (CheckStructHasMember)
|
||||
INCLUDE (CheckLibraryExists)
|
||||
|
||||
PROJECT (c-ares LANGUAGES C VERSION "1.33.1" )
|
||||
PROJECT (c-ares LANGUAGES C VERSION "1.34.1" )
|
||||
|
||||
# Set this version before release
|
||||
SET (CARES_VERSION "${PROJECT_VERSION}")
|
||||
|
|
@ -30,7 +30,7 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w
|
|||
# For example, a version of 4:0:2 would generate output such as:
|
||||
# libname.so -> libname.so.2
|
||||
# libname.so.2 -> libname.so.2.2.0
|
||||
SET (CARES_LIB_VERSIONINFO "20:1:18")
|
||||
SET (CARES_LIB_VERSIONINFO "21:1:19")
|
||||
|
||||
|
||||
OPTION (CARES_STATIC "Build as a static library" OFF)
|
||||
|
|
@ -406,7 +406,7 @@ ENDIF ()
|
|||
|
||||
CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C)
|
||||
|
||||
|
||||
CHECK_SYMBOL_EXISTS (memmem "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_MEMMEM)
|
||||
CHECK_SYMBOL_EXISTS (closesocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET)
|
||||
CHECK_SYMBOL_EXISTS (CloseSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET_CAMEL)
|
||||
CHECK_SYMBOL_EXISTS (connect "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONNECT)
|
||||
|
|
@ -443,6 +443,7 @@ CHECK_SYMBOL_EXISTS (IoctlSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IOCTLSO
|
|||
CHECK_SYMBOL_EXISTS (recv "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_RECV)
|
||||
CHECK_SYMBOL_EXISTS (recvfrom "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_RECVFROM)
|
||||
CHECK_SYMBOL_EXISTS (send "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SEND)
|
||||
CHECK_SYMBOL_EXISTS (sendto "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SENDTO)
|
||||
CHECK_SYMBOL_EXISTS (setsockopt "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SETSOCKOPT)
|
||||
CHECK_SYMBOL_EXISTS (socket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKET)
|
||||
CHECK_SYMBOL_EXISTS (strcasecmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRCASECMP)
|
||||
|
|
@ -500,7 +501,10 @@ IF (CARES_THREADS)
|
|||
CARES_EXTRAINCLUDE_IFSET (HAVE_PTHREAD_NP_H pthread_np.h)
|
||||
CHECK_SYMBOL_EXISTS (pthread_init "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_PTHREAD_INIT)
|
||||
# Make sure libcares.pc.cmake knows about thread libraries on static builds
|
||||
LIST (APPEND CARES_DEPENDENT_LIBS ${CMAKE_THREAD_LIBS_INIT})
|
||||
# The variable set by FIND_PACKAGE(Threads) has a -l prefix on it, we need
|
||||
# to strip that first since CARES_DEPENDENT_LIBS doesn't expect that.
|
||||
STRING (REPLACE "-l" "" CARES_THREAD_LIBRARY "${CMAKE_THREAD_LIBS_INIT}")
|
||||
LIST (APPEND CARES_DEPENDENT_LIBS ${CARES_THREAD_LIBRARY})
|
||||
ELSE ()
|
||||
MESSAGE (WARNING "Threading support not found, disabling...")
|
||||
SET (CARES_THREADS OFF)
|
||||
|
|
@ -688,7 +692,6 @@ IF (HAVE_ARPA_NAMESER_COMPAT_H)
|
|||
SET (CARES_HAVE_ARPA_NAMESER_COMPAT_H 1)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Coverage
|
||||
IF (CARES_COVERAGE)
|
||||
# set compiler flags
|
||||
|
|
@ -755,9 +758,6 @@ IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS)
|
|||
ADD_SUBDIRECTORY (test)
|
||||
ENDIF ()
|
||||
|
||||
|
||||
|
||||
|
||||
# Export targets
|
||||
IF (CARES_INSTALL)
|
||||
SET (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
||||
|
|
@ -781,7 +781,6 @@ IF (CARES_INSTALL)
|
|||
INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcares.pc" COMPONENT Devel DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
ENDIF ()
|
||||
|
||||
|
||||
# Legacy chain-building variables (provided for compatibility with old code).
|
||||
# Don't use these, external code should be updated to refer to the aliases directly (e.g., Cares::cares).
|
||||
SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND")
|
||||
|
|
|
|||
5
deps/cares/Makefile.Watcom
vendored
5
deps/cares/Makefile.Watcom
vendored
|
|
@ -43,7 +43,8 @@ CP = copy
|
|||
|
||||
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -aa &
|
||||
-wcd=201 -bt=nt -d+ -dCARES_BUILDING_LIBRARY &
|
||||
-dNTDDI_VERSION=0x06020000 -I. -I.\include -I.\src\lib $(SYS_INCL)
|
||||
-dNTDDI_VERSION=0x06020000 -I. -I.\include -I.\src\lib -I.\src\lib\include &
|
||||
$(SYS_INCL)
|
||||
|
||||
LFLAGS = option quiet, map, caseexact, eliminate
|
||||
|
||||
|
|
@ -124,7 +125,7 @@ $(LIBNAME).lib: $(OBJS_STAT) $(LIB_ARG)
|
|||
$(OBJ_BASE)\tools\ares_getopt.obj:
|
||||
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\tools\ares_getopt.c -fo=$^@
|
||||
|
||||
adig.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib
|
||||
adig.exe: $(LIBNAME).lib
|
||||
$(CC) $(CFLAGS) src\tools\adig.c -fo=$(OBJ_BASE)\tools\adig.obj
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\adig.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib
|
||||
|
||||
|
|
|
|||
2
deps/cares/Makefile.dj
vendored
2
deps/cares/Makefile.dj
vendored
|
|
@ -23,7 +23,7 @@ VPATH = src/lib src/tools
|
|||
WATT32_ROOT = $(realpath $(WATT_ROOT))
|
||||
WATT32_LIB = $(WATT32_ROOT)/lib/libwatt.a
|
||||
|
||||
CFLAGS = -g -O2 -I./include -I./src/lib \
|
||||
CFLAGS = -g -O2 -I./include -I./src/lib -I./src/lib/include \
|
||||
-I$(WATT32_ROOT)/inc \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
|
|
|
|||
2
deps/cares/Makefile.m32
vendored
2
deps/cares/Makefile.m32
vendored
|
|
@ -19,7 +19,7 @@ RANLIB = $(CROSSPREFIX)ranlib
|
|||
#RM = rm -f
|
||||
CP = cp -afv
|
||||
|
||||
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0602
|
||||
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -I./src/lib/include -D_WIN32_WINNT=0x0602
|
||||
CFLAGS += -DCARES_STATICLIB
|
||||
LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
|
||||
LIBS = -lws2_32 -liphlpapi
|
||||
|
|
|
|||
11
deps/cares/Makefile.msvc
vendored
11
deps/cares/Makefile.msvc
vendored
|
|
@ -192,7 +192,7 @@ EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib iphlpapi.lib
|
|||
|
||||
CC_CMD_REL = cl.exe /nologo $(RTLIB) /DNDEBUG /O2
|
||||
CC_CMD_DBG = cl.exe /nologo $(RTLIBD) /D_DEBUG /Od /Zi /RTCsu
|
||||
CC_CFLAGS = $(CFLAGS) /D_REENTRANT /I.\src\lib /I.\include /W3 /EHsc /FD
|
||||
CC_CFLAGS = $(CFLAGS) /D_REENTRANT /I.\src\lib /I.\include /I.\src\lib\include /W3 /EHsc /FD
|
||||
|
||||
RC_CMD_REL = rc.exe /l 0x409 /d "NDEBUG"
|
||||
RC_CMD_DBG = rc.exe /l 0x409 /d "_DEBUG"
|
||||
|
|
@ -344,15 +344,6 @@ PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj
|
|||
{$(SRCDIR)\src\tools}.c{$(PROG3_OBJDIR)}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(PROG3_OBJDIR)\ /c $<
|
||||
|
||||
# Hack Alert! we reference ../lib/str files in the Makefile.inc for tools as they
|
||||
# share some files with the library itself. We need to hack around that here.
|
||||
|
||||
{$(SRCDIR)\src\lib\str}.c{$(PROG2_OBJDIR)\..\lib\str}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\str\$(@F) /Fd$(PROG2_OBJDIR)\str\ /c $<
|
||||
|
||||
{$(SRCDIR)\src\lib\str}.c{$(PROG3_OBJDIR)\..\lib\str}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG3_OBJDIR)\str\$(@F) /Fd$(PROG3_OBJDIR)\str\ /c $<
|
||||
|
||||
# ------------------------------------------------------------- #
|
||||
# ------------------------------------------------------------- #
|
||||
# Default target when no CFG library type has been specified, #
|
||||
|
|
|
|||
9
deps/cares/README.md
vendored
9
deps/cares/README.md
vendored
|
|
@ -82,7 +82,7 @@ to sign releases):
|
|||
|
||||
```bash
|
||||
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2 # Daniel Stenberg
|
||||
gpg --keyserver hkps://keys.openpgp.org --recv-keys DA7D64E4C82C6294CB73A20E22E3D13B5411B7CA # Brad House
|
||||
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys DA7D64E4C82C6294CB73A20E22E3D13B5411B7CA # Brad House
|
||||
```
|
||||
|
||||
### Verifying signatures
|
||||
|
|
@ -109,8 +109,11 @@ gpg: binary signature, digest algorithm SHA512, key algorithm rsa2048
|
|||
```
|
||||
|
||||
## Features
|
||||
|
||||
See [Features](FEATURES.md)
|
||||
|
||||
### Supported RFCs and Proposals
|
||||
- [RFC1035](https://datatracker.ietf.org/doc/html/rfc7873).
|
||||
- [RFC1035](https://datatracker.ietf.org/doc/html/rfc1035).
|
||||
Initial/Base DNS RFC
|
||||
- [RFC2671](https://datatracker.ietf.org/doc/html/rfc2671),
|
||||
[RFC6891](https://datatracker.ietf.org/doc/html/rfc6891).
|
||||
|
|
@ -151,3 +154,5 @@ gpg: binary signature, digest algorithm SHA512, key algorithm rsa2048
|
|||
IPv6 address sorting as used by `ares_getaddrinfo()`.
|
||||
- [RFC7413](https://datatracker.ietf.org/doc/html/rfc7413).
|
||||
TCP FastOpen (TFO) for 0-RTT TCP Connection Resumption.
|
||||
- [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986).
|
||||
Uniform Resource Identifier (URI). Used for server configuration.
|
||||
|
|
|
|||
89
deps/cares/RELEASE-NOTES.md
vendored
89
deps/cares/RELEASE-NOTES.md
vendored
|
|
@ -1,65 +1,60 @@
|
|||
## c-ares version 1.33.1 - August 23 2024
|
||||
## c-ares version 1.34.1 - Octover 9 2024
|
||||
|
||||
This is a bugfix release.
|
||||
This release fixes a packaging issue.
|
||||
|
||||
Bugfixes:
|
||||
* Work around systemd-resolved quirk that returns unexpected codes for single
|
||||
label names. Also adds test cases to validate the work around works and
|
||||
will continue to work in future releases.
|
||||
[PR #863](https://github.com/c-ares/c-ares/pull/863),
|
||||
See Also https://github.com/systemd/systemd/issues/34101
|
||||
* Fix sysconfig ndots default value, also adds containerized test case to
|
||||
prevent future regressions.
|
||||
[PR #862](https://github.com/c-ares/c-ares/pull/862)
|
||||
* Fix blank DNS name returning error code rather than valid record for
|
||||
commands like: `adig -t SOA .`. Also adds test case to prevent future
|
||||
regressions.
|
||||
[9e574af](https://github.com/c-ares/c-ares/commit/9e574af)
|
||||
* Fix calculation of query times > 1s.
|
||||
[2b2eae7](https://github.com/c-ares/c-ares/commit/2b2eae7)
|
||||
* Fix building on old Linux releases that don't have `TCP_FASTOPEN_CONNECT`.
|
||||
[b7a89b9](https://github.com/c-ares/c-ares/commit/b7a89b9)
|
||||
* Fix minor Android build warnings.
|
||||
[PR #848](https://github.com/c-ares/c-ares/pull/848)
|
||||
|
||||
Thanks go to these friendly people for their efforts and contributions for this
|
||||
release:
|
||||
* Brad House (@bradh352)
|
||||
* Erik Lax (@eriklax)
|
||||
* Hans-Christian Egtvedt (@egtvedt)
|
||||
* Mikael Lindemann (@mikaellindemann)
|
||||
* Nodar Chkuaselidze (@nodech)
|
||||
|
||||
## c-ares version 1.33.0 - August 2 2024
|
||||
## c-ares version 1.34.0 - October 9 2024
|
||||
|
||||
This is a feature and bugfix release.
|
||||
|
||||
Features:
|
||||
* Add DNS cookie support (RFC7873 + RFC9018) to help prevent off-path cache
|
||||
poisoning attacks. [PR #833](https://github.com/c-ares/c-ares/pull/833)
|
||||
* Implement TCP FastOpen (TFO) RFC7413, which will make TCP reconnects 0-RTT
|
||||
on supported systems. [PR #840](https://github.com/c-ares/c-ares/pull/840)
|
||||
* adig: read arguments from adigrc.
|
||||
[PR #856](https://github.com/c-ares/c-ares/pull/856)
|
||||
* Add new pending write callback optimization via `ares_set_pending_write_cb`.
|
||||
[PR #857](https://github.com/c-ares/c-ares/pull/857)
|
||||
* New function `ares_process_fds()`.
|
||||
[PR #875](https://github.com/c-ares/c-ares/pull/875)
|
||||
* Failed servers should be probed rather than redirecting queries which could
|
||||
cause unexpected latency.
|
||||
[PR #877](https://github.com/c-ares/c-ares/pull/877)
|
||||
* adig: rework command line arguments to mimic dig from bind.
|
||||
[PR #890](https://github.com/c-ares/c-ares/pull/890)
|
||||
* Add new method for overriding network functions
|
||||
`ares_set_socket_function_ex()` to properly support all new functionality.
|
||||
[PR #894](https://github.com/c-ares/c-ares/pull/894)
|
||||
* Fix regression with custom socket callbacks due to DNS cookie support.
|
||||
[PR #895](https://github.com/c-ares/c-ares/pull/895)
|
||||
* ares_socket: set IP_BIND_ADDRESS_NO_PORT on ares_set_local_ip* tcp sockets
|
||||
[PR #887](https://github.com/c-ares/c-ares/pull/887)
|
||||
* URI parser/writer for ares_set_servers_csv()/ares_get_servers_csv().
|
||||
[PR #882](https://github.com/c-ares/c-ares/pull/882)
|
||||
|
||||
Changes:
|
||||
* Reorganize source tree. [PR #822](https://github.com/c-ares/c-ares/pull/822)
|
||||
* Refactoring of connection handling to prevent code duplication.
|
||||
[PR #839](https://github.com/c-ares/c-ares/pull/839)
|
||||
* New dynamic array data structure to prevent simple logic flaws in array
|
||||
handling in various code paths.
|
||||
[PR #841](https://github.com/c-ares/c-ares/pull/841)
|
||||
* Connection handling modularization.
|
||||
[PR #857](https://github.com/c-ares/c-ares/pull/857),
|
||||
[PR #876](https://github.com/c-ares/c-ares/pull/876)
|
||||
* Expose library/utility functions to tools.
|
||||
[PR #860](https://github.com/c-ares/c-ares/pull/860)
|
||||
* Remove `ares__` prefix, just use `ares_` for internal functions.
|
||||
[PR #872](https://github.com/c-ares/c-ares/pull/872)
|
||||
|
||||
|
||||
Bugfixes:
|
||||
* `ares_destroy()` race condition during shutdown due to missing lock.
|
||||
[PR #831](https://github.com/c-ares/c-ares/pull/831)
|
||||
* Android: Preserve thread name after attaching it to JVM.
|
||||
[PR #838](https://github.com/c-ares/c-ares/pull/838)
|
||||
* Windows UWP (Store) support fix.
|
||||
[PR #845](https://github.com/c-ares/c-ares/pull/845)
|
||||
* fix: potential WIN32_LEAN_AND_MEAN redefinition.
|
||||
[PR #869](https://github.com/c-ares/c-ares/pull/869)
|
||||
* Fix googletest v1.15 compatibility.
|
||||
[PR #874](https://github.com/c-ares/c-ares/pull/874)
|
||||
* Fix pkgconfig thread dependencies.
|
||||
[PR #884](https://github.com/c-ares/c-ares/pull/884)
|
||||
|
||||
|
||||
Thanks go to these friendly people for their efforts and contributions for this
|
||||
release:
|
||||
|
||||
* Brad House (@bradh352)
|
||||
* Yauheni Khnykin (@Hsilgos)
|
||||
* Cristian Rodríguez (@crrodriguez)
|
||||
* Georg (@tacerus)
|
||||
* @lifenjoiner
|
||||
* Shelley Vohr (@codebytere)
|
||||
* 前进,前进,进 (@leleliu008)
|
||||
|
||||
|
|
|
|||
2
deps/cares/aminclude_static.am
vendored
2
deps/cares/aminclude_static.am
vendored
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# aminclude_static.am generated automatically by Autoconf
|
||||
# from AX_AM_MACROS_STATIC on Fri Aug 23 09:37:25 EDT 2024
|
||||
# from AX_AM_MACROS_STATIC on Wed Oct 9 20:58:25 EDT 2024
|
||||
|
||||
|
||||
# Code coverage
|
||||
|
|
|
|||
81
deps/cares/cares.gyp
vendored
81
deps/cares/cares.gyp
vendored
|
|
@ -6,16 +6,14 @@
|
|||
'include/ares_dns_record.h',
|
||||
'include/ares_nameser.h',
|
||||
'include/ares_version.h',
|
||||
'src/lib/ares__addrinfo2hostent.c',
|
||||
'src/lib/ares__addrinfo_localhost.c',
|
||||
'src/lib/ares__close_sockets.c',
|
||||
'src/lib/ares__hosts_file.c',
|
||||
'src/lib/ares__parse_into_addrinfo.c',
|
||||
'src/lib/ares__socket.c',
|
||||
'src/lib/ares__sortaddrinfo.c',
|
||||
'src/lib/ares_addrinfo2hostent.c',
|
||||
'src/lib/ares_addrinfo_localhost.c',
|
||||
'src/lib/ares_android.c',
|
||||
'src/lib/ares_android.h',
|
||||
'src/lib/ares_cancel.c',
|
||||
'src/lib/ares_close_sockets.c',
|
||||
'src/lib/ares_conn.c',
|
||||
'src/lib/ares_conn.h',
|
||||
'src/lib/ares_cookie.c',
|
||||
'src/lib/ares_data.c',
|
||||
'src/lib/ares_data.h',
|
||||
|
|
@ -29,43 +27,43 @@
|
|||
'src/lib/ares_gethostbyaddr.c',
|
||||
'src/lib/ares_gethostbyname.c',
|
||||
'src/lib/ares_getnameinfo.c',
|
||||
'src/lib/ares_hosts_file.c',
|
||||
'src/lib/ares_inet_net_pton.h',
|
||||
'src/lib/ares_init.c',
|
||||
'src/lib/ares_ipv6.h',
|
||||
'src/lib/ares_library_init.c',
|
||||
'src/lib/ares_metrics.c',
|
||||
'src/lib/ares_options.c',
|
||||
'src/lib/ares_platform.c',
|
||||
'src/lib/ares_platform.h',
|
||||
'src/lib/ares_parse_into_addrinfo.c',
|
||||
'src/lib/ares_private.h',
|
||||
'src/lib/ares_process.c',
|
||||
'src/lib/ares_qcache.c',
|
||||
'src/lib/ares_query.c',
|
||||
'src/lib/ares_search.c',
|
||||
'src/lib/ares_send.c',
|
||||
'src/lib/ares_set_socket_functions.c',
|
||||
'src/lib/ares_setup.h',
|
||||
'src/lib/ares_socket.c',
|
||||
'src/lib/ares_socket.h',
|
||||
'src/lib/ares_sortaddrinfo.c',
|
||||
'src/lib/ares_strerror.c',
|
||||
'src/lib/ares_sysconfig.c',
|
||||
'src/lib/ares_sysconfig_files.c',
|
||||
'src/lib/ares_timeout.c',
|
||||
'src/lib/ares_update_servers.c',
|
||||
'src/lib/ares_version.c',
|
||||
'src/lib/dsa/ares__array.c',
|
||||
'src/lib/dsa/ares__array.h',
|
||||
'src/lib/dsa/ares__htable.c',
|
||||
'src/lib/dsa/ares__htable.h',
|
||||
'src/lib/dsa/ares__htable_asvp.c',
|
||||
'src/lib/dsa/ares__htable_asvp.h',
|
||||
'src/lib/dsa/ares__htable_strvp.c',
|
||||
'src/lib/dsa/ares__htable_strvp.h',
|
||||
'src/lib/dsa/ares__htable_szvp.c',
|
||||
'src/lib/dsa/ares__htable_szvp.h',
|
||||
'src/lib/dsa/ares__htable_vpvp.c',
|
||||
'src/lib/dsa/ares__htable_vpvp.h',
|
||||
'src/lib/dsa/ares__llist.c',
|
||||
'src/lib/dsa/ares__llist.h',
|
||||
'src/lib/dsa/ares__slist.c',
|
||||
'src/lib/dsa/ares__slist.h',
|
||||
'src/lib/dsa/ares_array.c',
|
||||
'src/lib/dsa/ares_htable.c',
|
||||
'src/lib/dsa/ares_htable.h',
|
||||
'src/lib/dsa/ares_htable_asvp.c',
|
||||
'src/lib/dsa/ares_htable_dict.c',
|
||||
'src/lib/dsa/ares_htable_strvp.c',
|
||||
'src/lib/dsa/ares_htable_szvp.c',
|
||||
'src/lib/dsa/ares_htable_vpstr.c',
|
||||
'src/lib/dsa/ares_htable_vpvp.c',
|
||||
'src/lib/dsa/ares_llist.c',
|
||||
'src/lib/dsa/ares_slist.c',
|
||||
'src/lib/dsa/ares_slist.h',
|
||||
'src/lib/event/ares_event.h',
|
||||
'src/lib/event/ares_event_configchg.c',
|
||||
'src/lib/event/ares_event_epoll.c',
|
||||
|
|
@ -76,6 +74,17 @@
|
|||
'src/lib/event/ares_event_wake_pipe.c',
|
||||
'src/lib/event/ares_event_win32.c',
|
||||
'src/lib/event/ares_event_win32.h',
|
||||
'src/lib/include/ares_array.h',
|
||||
'src/lib/include/ares_buf.h',
|
||||
'src/lib/include/ares_htable_asvp.h',
|
||||
'src/lib/include/ares_htable_dict.h',
|
||||
'src/lib/include/ares_htable_strvp.h',
|
||||
'src/lib/include/ares_htable_szvp.h',
|
||||
'src/lib/include/ares_htable_vpstr.h',
|
||||
'src/lib/include/ares_htable_vpvp.h',
|
||||
'src/lib/include/ares_llist.h',
|
||||
'src/lib/include/ares_mem.h',
|
||||
'src/lib/include/ares_str.h',
|
||||
'src/lib/inet_net_pton.c',
|
||||
'src/lib/inet_ntop.c',
|
||||
'src/lib/legacy/ares_create_query.c',
|
||||
|
|
@ -102,21 +111,23 @@
|
|||
'src/lib/record/ares_dns_private.h',
|
||||
'src/lib/record/ares_dns_record.c',
|
||||
'src/lib/record/ares_dns_write.c',
|
||||
'src/lib/str/ares__buf.c',
|
||||
'src/lib/str/ares__buf.h',
|
||||
'src/lib/str/ares_buf.c',
|
||||
'src/lib/str/ares_str.c',
|
||||
'src/lib/str/ares_str.h',
|
||||
'src/lib/str/ares_strcasecmp.c',
|
||||
'src/lib/str/ares_strcasecmp.h',
|
||||
'src/lib/str/ares_strsplit.c',
|
||||
'src/lib/str/ares_strsplit.h',
|
||||
'src/lib/util/ares__iface_ips.c',
|
||||
'src/lib/util/ares__iface_ips.h',
|
||||
'src/lib/util/ares__threads.c',
|
||||
'src/lib/util/ares__threads.h',
|
||||
'src/lib/util/ares__timeval.c',
|
||||
'src/lib/util/ares_iface_ips.c',
|
||||
'src/lib/util/ares_iface_ips.h',
|
||||
'src/lib/util/ares_math.c',
|
||||
'src/lib/util/ares_math.h',
|
||||
'src/lib/util/ares_rand.c',
|
||||
'src/lib/util/ares_rand.h',
|
||||
'src/lib/util/ares_threads.c',
|
||||
'src/lib/util/ares_threads.h',
|
||||
'src/lib/util/ares_time.h',
|
||||
'src/lib/util/ares_timeval.c',
|
||||
'src/lib/util/ares_uri.c',
|
||||
'src/lib/util/ares_uri.h',
|
||||
'src/tools/ares_getopt.c',
|
||||
'src/tools/ares_getopt.h',
|
||||
],
|
||||
|
|
@ -163,7 +174,7 @@
|
|||
{
|
||||
'target_name': 'cares',
|
||||
'type': '<(library)',
|
||||
'include_dirs': [ 'include', 'src/lib' ],
|
||||
'include_dirs': [ 'include', 'src/lib', 'src/lib/include' ],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [ 'include' ],
|
||||
'cflags': [ '-Wno-error=deprecated-declarations' ],
|
||||
|
|
|
|||
743
deps/cares/configure
vendored
743
deps/cares/configure
vendored
File diff suppressed because it is too large
Load Diff
6
deps/cares/configure.ac
vendored
6
deps/cares/configure.ac
vendored
|
|
@ -2,10 +2,10 @@ dnl Copyright (C) The c-ares project and its contributors
|
|||
dnl SPDX-License-Identifier: MIT
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
AC_INIT([c-ares], [1.33.1],
|
||||
AC_INIT([c-ares], [1.34.1],
|
||||
[c-ares mailing list: http://lists.haxx.se/listinfo/c-ares])
|
||||
|
||||
CARES_VERSION_INFO="20:1:18"
|
||||
CARES_VERSION_INFO="21:1:19"
|
||||
dnl This flag accepts an argument of the form current[:revision[:age]]. So,
|
||||
dnl passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
|
||||
dnl 1.
|
||||
|
|
@ -540,9 +540,11 @@ dnl https://mailman.videolan.org/pipermail/vlc-devel/2015-March/101802.html
|
|||
dnl which would require we check each individually and provide function arguments
|
||||
dnl for the test.
|
||||
|
||||
AC_CHECK_DECL(memmem, [AC_DEFINE([HAVE_MEMMEM], 1, [Define to 1 if you have `memmem`] )], [], $cares_all_includes)
|
||||
AC_CHECK_DECL(recv, [AC_DEFINE([HAVE_RECV], 1, [Define to 1 if you have `recv`] )], [], $cares_all_includes)
|
||||
AC_CHECK_DECL(recvfrom, [AC_DEFINE([HAVE_RECVFROM], 1, [Define to 1 if you have `recvfrom`] )], [], $cares_all_includes)
|
||||
AC_CHECK_DECL(send, [AC_DEFINE([HAVE_SEND], 1, [Define to 1 if you have `send`] )], [], $cares_all_includes)
|
||||
AC_CHECK_DECL(sendto, [AC_DEFINE([HAVE_SENDTO], 1, [Define to 1 if you have `sendto`] )], [], $cares_all_includes)
|
||||
AC_CHECK_DECL(getnameinfo, [AC_DEFINE([HAVE_GETNAMEINFO], 1, [Define to 1 if you have `getnameinfo`] )], [], $cares_all_includes)
|
||||
AC_CHECK_DECL(gethostname, [AC_DEFINE([HAVE_GETHOSTNAME], 1, [Define to 1 if you have `gethostname`] )], [], $cares_all_includes)
|
||||
AC_CHECK_DECL(connect, [AC_DEFINE([HAVE_CONNECT], 1, [Define to 1 if you have `connect`] )], [], $cares_all_includes)
|
||||
|
|
|
|||
4
deps/cares/docs/Makefile.in
vendored
4
deps/cares/docs/Makefile.in
vendored
|
|
@ -457,6 +457,9 @@ MANPAGES = ares_cancel.3 \
|
|||
ares_parse_txt_reply.3 \
|
||||
ares_parse_uri_reply.3 \
|
||||
ares_process.3 \
|
||||
ares_process_fd.3 \
|
||||
ares_process_fds.3 \
|
||||
ares_process_pending_write.3 \
|
||||
ares_query.3 \
|
||||
ares_query_dnsrec.3 \
|
||||
ares_queue.3 \
|
||||
|
|
@ -471,6 +474,7 @@ MANPAGES = ares_cancel.3 \
|
|||
ares_set_local_dev.3 \
|
||||
ares_set_local_ip4.3 \
|
||||
ares_set_local_ip6.3 \
|
||||
ares_set_pending_write_cb.3 \
|
||||
ares_set_server_state_callback.3 \
|
||||
ares_set_servers.3 \
|
||||
ares_set_servers_csv.3 \
|
||||
|
|
|
|||
4
deps/cares/docs/Makefile.inc
vendored
4
deps/cares/docs/Makefile.inc
vendored
|
|
@ -114,6 +114,9 @@ MANPAGES = ares_cancel.3 \
|
|||
ares_parse_txt_reply.3 \
|
||||
ares_parse_uri_reply.3 \
|
||||
ares_process.3 \
|
||||
ares_process_fd.3 \
|
||||
ares_process_fds.3 \
|
||||
ares_process_pending_write.3 \
|
||||
ares_query.3 \
|
||||
ares_query_dnsrec.3 \
|
||||
ares_queue.3 \
|
||||
|
|
@ -128,6 +131,7 @@ MANPAGES = ares_cancel.3 \
|
|||
ares_set_local_dev.3 \
|
||||
ares_set_local_ip4.3 \
|
||||
ares_set_local_ip6.3 \
|
||||
ares_set_pending_write_cb.3 \
|
||||
ares_set_server_state_callback.3 \
|
||||
ares_set_servers.3 \
|
||||
ares_set_servers_csv.3 \
|
||||
|
|
|
|||
188
deps/cares/docs/adig.1
vendored
188
deps/cares/docs/adig.1
vendored
|
|
@ -3,65 +3,177 @@
|
|||
.\" Copyright (C) Daniel Stenberg
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.\"
|
||||
.TH ADIG "1" "April 2011" "c-ares utilities"
|
||||
.TH ADIG "1" "Sept 2024" "c-ares utilities"
|
||||
.SH NAME
|
||||
adig \- print information collected from Domain Name System (DNS) servers
|
||||
.SH SYNOPSIS
|
||||
.B adig
|
||||
[\fIOPTION\fR]... \fINAME\fR...
|
||||
\fBadig\fP [\fI@server\fR] [\fI-c class\fR] [\fI-p port#\fR] [\fI-q name\fR]
|
||||
[\fI-t type\fR] [\fI-x addr\fR] [\fIname\fR] [\fItype\fR] [\fIclass\fR]
|
||||
[\fIqueryopt\fR...]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
.\" Add any additional description here
|
||||
.PP
|
||||
Send queries to DNS servers about \fINAME\fR and print received
|
||||
information, where \fINAME\fR is a valid DNS name (e.g. www.example.com,
|
||||
Send queries to DNS servers about \fUname\fR and print received
|
||||
information, where \fIname\fR is a valid DNS name (e.g. www.example.com,
|
||||
1.2.3.10.in-addr.arpa).
|
||||
.PP
|
||||
This utility comes with the \fBc\-ares\fR asynchronous resolver library.
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
It is possible to specify default arguments for \fBadig\fR via \fB${XDG_CONFIG_HOME}/adigrc\fR.
|
||||
.SH ARGS
|
||||
.TP
|
||||
\fB@server\fR
|
||||
Server ip address. May specify multiple in comma delimited format. May be
|
||||
specified in URI format.
|
||||
.TP
|
||||
\fBname\fR
|
||||
Name of the resource record that is to be looked up
|
||||
.TP
|
||||
\fBtype\fR
|
||||
What type of query is required. e.g. - A, AAAA, MX, TXT, etc. If not
|
||||
specified, A will be used.
|
||||
.TP
|
||||
\fBclass\fR
|
||||
Sets the query class, defaults to IN. May also be HS or CH.
|
||||
|
||||
.SH FLAGS
|
||||
.TP
|
||||
\fB\-c\fR class
|
||||
Set the query class.
|
||||
Possible values for class are
|
||||
ANY, CHAOS, HS and IN (default).
|
||||
Sets the query class, defaults to IN. May also be HS or CH.
|
||||
.TP
|
||||
\fB\-d\fR
|
||||
Print some extra debugging output.
|
||||
\fB\-h\fR
|
||||
Prints the help.
|
||||
.TP
|
||||
\fB\-f\fR flag
|
||||
Add a behavior control flag.
|
||||
Possible values for flag are
|
||||
igntc - ignore query truncation, return answer as-is instead of retrying
|
||||
via tcp.
|
||||
noaliases - don't honor the HOSTALIASES environment variable,
|
||||
norecurse - don't query upstream servers recursively,
|
||||
primary - use the first server,
|
||||
stayopen - don't close the communication sockets, and
|
||||
usevc - always use TCP.
|
||||
\fB\-p\fR port
|
||||
Sends query to a port other than 53. Often recommended to set the port using
|
||||
\fI@server\fR instead.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-?\fR
|
||||
Display this help and exit.
|
||||
\fB\-q\fR name
|
||||
Specifies the domain name to query. Useful to distinguish name from other
|
||||
arguments
|
||||
.TP
|
||||
\fB\-s\fR server
|
||||
Connect to specified DNS server, instead of the system's default one(s).
|
||||
Servers are tried in round-robin, if the previous one failed.
|
||||
\fB\-r\fR
|
||||
Skip adigrc processing
|
||||
.TP
|
||||
\fB\-s\fR
|
||||
Server (alias for @server syntax), compatibility with old cmdline
|
||||
.TP
|
||||
\fB\-t\fR type
|
||||
Query records of specified type.
|
||||
Possible values for type are
|
||||
A (default), AAAA, ANY, AXFR, CNAME, HINFO, MX, NAPTR, NS, PTR, SOA, SRV, TXT,
|
||||
URI, CAA, SVCB, and HTTPS.
|
||||
Indicates resource record type to query. Useful to distinguish type from other
|
||||
arguments
|
||||
.TP
|
||||
\fB\-T\fR port
|
||||
Connect to the specified TCP port of DNS server.
|
||||
\fB\-x\fR addr
|
||||
Simplified reverse lookups. Sets the type to PTR and forms a valid in-arpa
|
||||
query string
|
||||
|
||||
.SH QUERY OPTIONS
|
||||
.TP
|
||||
\fB\-U\fR port
|
||||
Connect to the specified UDP port of DNS server.
|
||||
\fB+[no]aaonly\fR
|
||||
Sets the aa flag in the query. Default is off.
|
||||
.TP
|
||||
\fB+[no]aaflag\fR
|
||||
Alias for +[no]aaonly
|
||||
.TP
|
||||
\fB+[no]additional\fR
|
||||
Toggles printing the additional section. On by default.
|
||||
.TP
|
||||
\fB+[no]adflag\fR
|
||||
Sets the ad (authentic data) bit in the query. Default is off.
|
||||
.TP
|
||||
\fB+[no]aliases\fR
|
||||
Whether or not to honor the HOSTALIASES file. Default is on.
|
||||
.TP
|
||||
\fB+[no]all\fR
|
||||
Toggles all of +[no]cmd, +[no]stats, +[no]question, +[no]answer,
|
||||
+[no]authority, +[no]additional, +[no]comments
|
||||
.TP
|
||||
\fB+[no]answer\fR
|
||||
Toggles printing the answer. On by default.
|
||||
.TP
|
||||
\fB+[no]authority\fR
|
||||
Toggles printing the authority. On by default.
|
||||
.TP
|
||||
\fB+bufsize=\fR#
|
||||
UDP EDNS 0 packet size allowed. Defaults to 1232.
|
||||
.TP
|
||||
\fB+[no]cdflag\fR
|
||||
Sets the CD (checking disabled) bit in the query. Default is off.
|
||||
.TP
|
||||
\fB+[no]class\fR
|
||||
Display the class when printing the record. On by default.
|
||||
.TP
|
||||
\fB+[no]cmd\fR
|
||||
Toggles printing the command requested. On by default.
|
||||
.TP
|
||||
\fB+[no]comments\fR
|
||||
Toggles printing the comments. On by default
|
||||
.TP
|
||||
\fB+[no]defname\fR
|
||||
Alias for +[no]search
|
||||
.TP
|
||||
\fB+domain=somename\fR
|
||||
Sets the search list to a single domain.
|
||||
.TP
|
||||
\fB+[no]dns0x20\fR
|
||||
Whether or not to use DNS 0x20 case randomization when sending queries.
|
||||
Default is off.
|
||||
.TP
|
||||
\fB+[no]edns\fR[=#]
|
||||
Enable or disable EDNS. Only allows a value of 0 if specified. Default is to
|
||||
enable EDNS.
|
||||
.TP
|
||||
\fB+[no]ignore\fR
|
||||
Ignore truncation on UDP, by default retried on TCP.
|
||||
.TP
|
||||
\fB+[no]keepopen\fR
|
||||
Whether or not the server connection should be persistent. Default is off.
|
||||
.TP
|
||||
\fB+ndots\fR=#
|
||||
Sets the number of dots that must appear before being considered absolute.
|
||||
Defaults to 1.
|
||||
.TP
|
||||
\fB+[no]primary\fR
|
||||
Whether or not to only use a single server if more than one server is available.
|
||||
Defaults to using all servers.
|
||||
.TP
|
||||
\fB+[no]qr\fR
|
||||
Toggles printing the request query. Off by default.
|
||||
.TP
|
||||
\fB+[no]question\fR
|
||||
Toggles printing the question. On by default.
|
||||
.TP
|
||||
\fB+[no]recurse\fR
|
||||
Toggles the RD (Recursion Desired) bit. On by default.
|
||||
.TP
|
||||
\fB+retry\fR=#
|
||||
Same as +tries but does not include the initial attempt.
|
||||
.TP
|
||||
\fB+[no]search\fR
|
||||
To use or not use the search list. Search list is not used by default.
|
||||
.TP
|
||||
\fB+[no]stats\fR
|
||||
Toggles printing the statistics. On by default.
|
||||
.TP
|
||||
\fB+[no]tcp\fR
|
||||
Whether to use TCP when querying name servers. Default is UDP.
|
||||
.TP
|
||||
\fB+tries\fR=#
|
||||
Number of query tries. Defaults to 3.
|
||||
.TP
|
||||
\fB+[no]ttlid\fR
|
||||
Display the TTL when printing the record. On by default.
|
||||
.TP
|
||||
\fB+[no]vc\fR
|
||||
Alias for +[no]tcp
|
||||
|
||||
.SH FILES
|
||||
|
||||
${XDG_CONFIG_HOME}/adigrc
|
||||
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to the c-ares mailing list:
|
||||
Report bugs to the c-ares github issues tracker
|
||||
.br
|
||||
\fBhttps://lists.haxx.se/listinfo/c-ares\fR
|
||||
\fBhttps://github.com/c-ares/c-ares/issues\fR
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
ahost(1).
|
||||
|
|
|
|||
7
deps/cares/docs/ares_inet_pton.3
vendored
7
deps/cares/docs/ares_inet_pton.3
vendored
|
|
@ -9,7 +9,7 @@ ares_inet_pton \- convert an IPv4 or IPv6 address from text to binary form
|
|||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
const char *ares_inet_pton(int \fIaf\fP, const char *\fIsrc\fP, void *\fIdst\fP);
|
||||
int ares_inet_pton(int \fIaf\fP, const char *\fIsrc\fP, void *\fIdst\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
This is a portable version with the identical functionality of the commonly
|
||||
|
|
@ -22,6 +22,11 @@ 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).
|
||||
|
||||
It returns 1 if the address was valid for the specified address family, or 0
|
||||
if the address was not parseable in the specified address family, or -1 if
|
||||
some system error occurred (in which case errno will have been set).
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR ares_init (3),
|
||||
.BR ares_inet_ntop (3)
|
||||
|
|
|
|||
7
deps/cares/docs/ares_init_options.3
vendored
7
deps/cares/docs/ares_init_options.3
vendored
|
|
@ -345,7 +345,8 @@ Configure server failover retry behavior. When a DNS server fails to
|
|||
respond to a query, c-ares will deprioritize the server. On subsequent
|
||||
queries, servers with fewer consecutive failures will be selected in
|
||||
preference. However, in order to detect when such a server has recovered,
|
||||
c-ares will occasionally retry failed servers. The
|
||||
c-ares will occasionally retry failed servers by probing with a copy of
|
||||
the query, without affecting the latency of the actual requested query. The
|
||||
\fIares_server_failover_options\fP structure contains options to control this
|
||||
behavior.
|
||||
The \fIretry_chance\fP field gives the probability (1/N) of retrying a
|
||||
|
|
@ -367,7 +368,9 @@ 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.
|
||||
nameservers in the same order. The default is not to rotate servers, however
|
||||
the system configuration can specify the desire to rotate and this
|
||||
configuration value can negate such a system configuration.
|
||||
.PP
|
||||
|
||||
.SH RETURN VALUES
|
||||
|
|
|
|||
127
deps/cares/docs/ares_process.3
vendored
127
deps/cares/docs/ares_process.3
vendored
|
|
@ -4,61 +4,106 @@
|
|||
.\"
|
||||
.TH ARES_PROCESS 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_process \- Process events for name resolution
|
||||
ares_process_fds, ares_process_fd, ares_process \- Process events for name resolution
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
/*! Events used by ares_fd_events_t */
|
||||
typedef enum {
|
||||
ARES_FD_EVENT_NONE = 0, /*!< No events */
|
||||
ARES_FD_EVENT_READ = 1 << 0, /*!< Read event (including disconnect/error) */
|
||||
ARES_FD_EVENT_WRITE = 1 << 1 /*!< Write event */
|
||||
} ares_fd_eventflag_t;
|
||||
|
||||
/*! Type holding a file descriptor and mask of events, used by
|
||||
* ares_process_fds() */
|
||||
typedef struct {
|
||||
ares_socket_t fd; /*!< File descriptor */
|
||||
unsigned int events; /*!< Mask of ares_fd_event_t */
|
||||
} ares_fd_events_t;
|
||||
|
||||
typedef enum {
|
||||
ARES_PROCESS_FLAG_NONE = 0,
|
||||
ARES_PROCESS_FLAG_SKIP_NON_FD = 1 << 0
|
||||
} ares_process_flag_t;
|
||||
|
||||
|
||||
ares_status_t ares_process_fds(ares_channel_t *\fIchannel\fP,
|
||||
const ares_fd_events_t *\fIevents\fP,
|
||||
size_t \fInevents\fP,
|
||||
unsigned int \fIflags\fP)
|
||||
|
||||
void ares_process_fd(ares_channel_t *\fIchannel\fP,
|
||||
ares_socket_t \fIread_fd\fP,
|
||||
ares_socket_t \fIwrite_fd\fP)
|
||||
|
||||
void ares_process(ares_channel_t *\fIchannel\fP,
|
||||
fd_set *\fIread_fds\fP,
|
||||
fd_set *\fIwrite_fds\fP)
|
||||
|
||||
void ares_process_fd(ares_channel_t *\fIchannel\fP,
|
||||
ares_socket_t \fIread_fd\fP,
|
||||
ares_socket_t \fIwrite_fd\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_process(3)\fP function handles input/output events and timeouts
|
||||
associated with queries pending on the name service channel identified by
|
||||
.IR channel .
|
||||
The file descriptor sets pointed to by \fIread_fds\fP and \fIwrite_fds\fP
|
||||
should have file descriptors set in them according to whether the file
|
||||
descriptors specified by \fIares_fds(3)\fP are ready for reading and writing.
|
||||
(The easiest way to determine this information is to invoke \fBselect(3)\fP
|
||||
with a timeout no greater than the timeout given by \fIares_timeout(3)\fP).
|
||||
These functions must be used by integrators choosing not to use the
|
||||
EventThread enabled via \fBARES_OPT_EVENT_THREAD\fP passed to
|
||||
\fBares_init_options\fP. This assumes integrators already have their own
|
||||
event loop handling event notifications for various file descriptors and
|
||||
wish to do the same with their integration with c-ares.
|
||||
|
||||
The \fBares_process(3)\fP function will invoke callbacks for pending queries
|
||||
if they complete successfully or fail.
|
||||
The \fBares_process_fds(3)\fP function handles input/output events on file
|
||||
descriptors and timeouts associated with queries pending on the channel
|
||||
identified by \fIchannel\fP. The file descriptors to be processed are passed
|
||||
in an array of \fIares_fd_events_t\fP data structures in the \fIfd\fP member,
|
||||
and events are a bitwise mask of \fIares_fd_eventflag_t\fP in the \fIevent\fP
|
||||
member. This function can also be used to process timeouts by passing NULL
|
||||
to the \fIevents\fP member with \fInevents\fP value of 0. Flags may also be
|
||||
specified in the \fIflags\fP field and are defined in \fBares_process_flag_t\fP.
|
||||
|
||||
\fBares_process_fd(3)\fP works the same way but acts and operates only on the
|
||||
specific file descriptors (sockets) you pass in to the function. Use
|
||||
ARES_SOCKET_BAD for "no action". This function is provided to allow users of
|
||||
c-ares to avoid \fIselect(3)\fP in their applications and within c-ares.
|
||||
\fBARES_PROCESS_FLAG_SKIP_NON_FD\fP can be specified to specifically skip any
|
||||
processing unrelated to the file descriptor events passed in, examples include
|
||||
timeout processing and cleanup handling. This is useful if an integrator
|
||||
knows they will be sending multiple \fIares_process_fds(3)\fP requests and
|
||||
wants to skip that extra processing. However, the integrator must send the
|
||||
final request with the flag so that timeout and other processing gets performed
|
||||
before their event loop waits on additional events.
|
||||
|
||||
To only process possible timeout conditions without a socket event occurring,
|
||||
one may pass NULL as the values for both \fIread_fds\fP and \fIwrite_fds\fP for
|
||||
\fBares_process(3)\fP, or ARES_SOCKET_BAD for both \fIread_fd\fP and
|
||||
\fIwrite_fd\fP for \fBares_process_fd(3)\fP.
|
||||
.SH EXAMPLE
|
||||
The following code fragment waits for all pending queries on a channel
|
||||
to complete:
|
||||
It is allowable to use an \fIares_fd_events_t\fP with \fIevents\fP member of
|
||||
value \fIARES_FD_EVENT_NONE\fP (0) if there are no events for a given file
|
||||
descriptor if an integrator wishes to simply maintain an array with all
|
||||
possible file descriptors and update readiness via the \fIevent\fP member.
|
||||
|
||||
.nf
|
||||
int nfds, count;
|
||||
fd_set readers, writers;
|
||||
struct timeval tv, *tvp;
|
||||
This function will return \fIARES_ENOMEM\fP in out of memory conditions,
|
||||
otherwise will return \fIARES_SUCCESS\fP.
|
||||
|
||||
This function is recommended over \fBares_process_fd(3)\fP since it can
|
||||
handle processing of multiple file descriptors at once, thus skipping repeating
|
||||
additional logic such as timeout processing which would be required if calling
|
||||
\fBares_process_fd(3)\fP for multiple file descriptors notified at the same
|
||||
time.
|
||||
|
||||
This function is typically used with the \fIARES_OPT_SOCK_STATE_CB\fP option.
|
||||
|
||||
\fBares_timeout(3)\fP should be used to retrieve the desired timeout, and when
|
||||
the timeout expires, the integrator must call \fBares_process_fds(3)\fP with
|
||||
a NULL \fIevents\fP array. (or \fBares_process_fd(3)\fP with both sockets set
|
||||
to \fIARES_SOCKET_BAD\fP). There is no need to do this if events are also
|
||||
delivered for any file descriptors as timeout processing will automatically be
|
||||
handled by any call to \fBares_process_fds(3)\fP or \fBares_process_fd(3)\fP.
|
||||
|
||||
The \fBares_process_fd(3)\fP function is the same as \fBares_process_fds(3)\fP
|
||||
except can only process a single read and write file descriptor at a time.
|
||||
New integrators should use \fBares_process_fds(3)\fP if possible.
|
||||
|
||||
The \fBares_process(3)\fP function works in the same manner, except it works
|
||||
on \fIfd_sets\fP as is used by \fBselect(3)\fP and retrieved by
|
||||
\fBares_fds(3)\fP. This method is deprecated and should not be used in modern
|
||||
applications due to known limitations to the \fBselect(3)\fP implementation.
|
||||
|
||||
.SH AVAILABILITY
|
||||
\fBares_process_fds(3)\fP was introduced in c-ares 1.34.0.
|
||||
|
||||
while (1) {
|
||||
FD_ZERO(&readers);
|
||||
FD_ZERO(&writers);
|
||||
nfds = ares_fds(channel, &readers, &writers);
|
||||
if (nfds == 0)
|
||||
break;
|
||||
tvp = ares_timeout(channel, NULL, &tv);
|
||||
count = select(nfds, &readers, &writers, NULL, tvp);
|
||||
ares_process(channel, &readers, &writers);
|
||||
}
|
||||
.fi
|
||||
.SH SEE ALSO
|
||||
.BR ares_fds (3),
|
||||
.BR ares_timeout (3)
|
||||
.BR ares_timeout (3),
|
||||
.BR ares_init_options (3)
|
||||
with \fIARES_OPT_EVENT_THREAD\fP or \fIARES_OPT_SOCK_STATE_CB\fP
|
||||
|
|
|
|||
3
deps/cares/docs/ares_process_fd.3
vendored
Normal file
3
deps/cares/docs/ares_process_fd.3
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.\" Copyright (C) 2023 The c-ares project and its contributors.
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.so man3/ares_process.3
|
||||
3
deps/cares/docs/ares_process_fds.3
vendored
Normal file
3
deps/cares/docs/ares_process_fds.3
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.\" Copyright (C) 2023 The c-ares project and its contributors.
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.so man3/ares_process.3
|
||||
3
deps/cares/docs/ares_process_pending_write.3
vendored
Normal file
3
deps/cares/docs/ares_process_pending_write.3
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.\" Copyright (C) 2023 The c-ares project and its contributors.
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.so man3/ares_set_pending_write_cb.3
|
||||
10
deps/cares/docs/ares_set_local_dev.3
vendored
10
deps/cares/docs/ares_set_local_dev.3
vendored
|
|
@ -2,7 +2,7 @@
|
|||
.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.\"
|
||||
.TH ARES_SET_LOCAL_DEV 3 "30 June 2010"
|
||||
.TH ARES_SET_LOCAL_DEV 3 "23 September 2024"
|
||||
.SH NAME
|
||||
ares_set_local_dev \- Bind to a specific network device when creating sockets.
|
||||
.SH SYNOPSIS
|
||||
|
|
@ -15,12 +15,14 @@ void ares_set_local_dev(ares_channel_t *\fIchannel\fP, const char* \fIlocal_dev_
|
|||
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
|
||||
This option is only supported on Linux, the interface must not be already bound to the
|
||||
socket or the current effective user must have CAP_NET_RAW capability in the current
|
||||
network namespace for the option to work. If SO_BINDTODEVICE is not supported or the
|
||||
setsockopt 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)
|
||||
.BR network_namespaces (7)
|
||||
.SH NOTES
|
||||
This function was added in c-ares 1.7.4
|
||||
|
|
|
|||
62
deps/cares/docs/ares_set_pending_write_cb.3
vendored
Normal file
62
deps/cares/docs/ares_set_pending_write_cb.3
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
.\"
|
||||
.\" Copyright 2024 by the c-ares project and its contributors
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.\"
|
||||
.TH ARES_SET_NOTIFY_PENDING_WRITE_CALLBACK 3 "13 Aug 2024"
|
||||
.SH NAME
|
||||
ares_set_pending_write_cb, ares_process_pending_write \- Function
|
||||
for setting a callback which is triggered when there is potential pending data
|
||||
which needs to be written.
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
typedef void (*ares_pending_write_cb)(void *\fIdata\fP);
|
||||
|
||||
void ares_set_pending_write_cb(
|
||||
ares_channel_t *\fIchannel\fP,
|
||||
ares_pending_write_cb \fIcallback\fP,
|
||||
void *\fIuser_data\fP);
|
||||
|
||||
void ares_process_pending_write(ares_channel_t *\fIchannel\fP);
|
||||
|
||||
.fi
|
||||
|
||||
.SH DESCRIPTION
|
||||
The \fBares_set_pending_write_cb(3)\fP function sets a callback
|
||||
function \fIcallback\fP in the given ares channel handle \fIchannel\fP that
|
||||
is invoked whenever there is new pending TCP data to be written. Since TCP
|
||||
is stream based, if there are multiple queries being enqueued back to back they
|
||||
can be sent as one large buffer. Normally a \fBsend(2)\fP syscall operation
|
||||
would be triggered for each query.
|
||||
|
||||
When setting this callback, an event will be triggered when data is buffered,
|
||||
but not written. This event is used to wake the caller's event loop which
|
||||
should call \fBares_process_pending_write(3)\fP using the channel associated
|
||||
with the callback. Each time the callback is triggered must result in a call
|
||||
to \fBares_process_pending_write(3)\fP from the caller's event loop otherwise
|
||||
stalls and timeouts may occur. The callback \fBmust not\fP call
|
||||
\fBares_process_pending_write(3)\fP directly as otherwise it would invalidate
|
||||
any advantage of this use-case.
|
||||
|
||||
This is considered an optimization, especially when using TLS-based connections
|
||||
which add additional overhead to the data stream. Due to the asyncronous nature
|
||||
of c-ares, there is no way to identify when a caller may be finished enqueuing
|
||||
queries via any of the possible public API calls such as
|
||||
\fBares_getaddrinfo(3)\fP or \fBares_search_dnsrec(3)\fP, so this is an
|
||||
enhancement to try to group query send operations together and will rely on the
|
||||
singaling latency involved in waking the user's event loop.
|
||||
|
||||
If no callback is set, data will be written immediately to the socket, thus
|
||||
bypassing this optimization.
|
||||
|
||||
This option cannot be used with \fIARES_OPT_EVENT_THREAD\fP passed to
|
||||
\fBares_init_options(3)\fP since the user has no event loop. This optimization
|
||||
is automatically enabled when using the Event Thread as it sets the callback
|
||||
for its own internal signaling.
|
||||
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.34.0.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR ares_init_options (3)
|
||||
88
deps/cares/docs/ares_set_servers_csv.3
vendored
88
deps/cares/docs/ares_set_servers_csv.3
vendored
|
|
@ -29,11 +29,18 @@ simulation but unlikely to be useful in production.
|
|||
The \fBares_get_servers_csv\fP retrieves the list of servers in comma delimited
|
||||
format.
|
||||
|
||||
The input and output format is a comma separated list of servers. Each server
|
||||
entry may contain these forms:
|
||||
The input and output format is a comma separated list of servers. Two formats
|
||||
are available, the typical \fBresolv.conf(5)\fP \fInameserver\fP format, as
|
||||
well as a \fIURI\fP format. Both formats can be used at the same time in the
|
||||
provided CSV string.
|
||||
|
||||
The \fInameserver\fP format is:
|
||||
.nf
|
||||
|
||||
ip[:port][%iface]
|
||||
|
||||
.fi
|
||||
.RS 4
|
||||
The \fBip\fP may be encapsulated in square brackets ([ ]), and must be if
|
||||
using ipv6 and also specifying a port.
|
||||
|
||||
|
|
@ -42,16 +49,88 @@ The \fBport\fP is optional, and will default to 53 or the value specified in
|
|||
|
||||
The \fBiface\fP is specific to IPv6 link-local servers (fe80::/10) and should
|
||||
not otherwise be used.
|
||||
.RE
|
||||
|
||||
For example:
|
||||
\fInameserver\fP format examples:
|
||||
.nf
|
||||
|
||||
192.168.1.100
|
||||
192.168.1.101:53
|
||||
[1:2:3::4]:53
|
||||
[fe80::1]:53%eth0
|
||||
|
||||
.fi
|
||||
.PP
|
||||
|
||||
The \fIURI\fP format is is made up of these defined schemes:
|
||||
.RS 4
|
||||
\fIdns://\fP - Normal DNS server (UDP + TCP). We need to be careful not to
|
||||
conflict with query params defined in RFC4501 since we'd technically be
|
||||
extending this URI scheme. Port defaults to 53.
|
||||
|
||||
\fIdns+tls://\fP - DNS over TLS. Port defaults to 853.
|
||||
|
||||
\fIdns+https://\fP - DNS over HTTPS. Port defaults to 443.
|
||||
.RE
|
||||
|
||||
.PP
|
||||
Query parameters are defined as below. Additional parameters may be defined
|
||||
in the future.
|
||||
|
||||
.RS 4
|
||||
\fItcpport\fP - TCP port to use, only for \fIdns://\fP scheme. The port
|
||||
specified as part of the authority component of the URI will be used for both
|
||||
UDP and TCP by default, this option will override the TCP port.
|
||||
|
||||
\fIipaddr\fP - Only for \fIdns+tls://\fP and \fIdns+https://\fP. If the
|
||||
authority component of the URI contains a hostname, this is used to specify the
|
||||
ip address of the hostname. If not specified, will need to use a non-secure
|
||||
server to perform a DNS lookup to retrieve this information. It is always
|
||||
recommended to have both the ip address and fully qualified domain name
|
||||
specified.
|
||||
|
||||
\fIhostname\fP - Only for \fIdns+tls://\fP and \fIdns+https://\fP. If the
|
||||
authority component of the URI contains an ip address, this is used to specify
|
||||
the fully qualified domain name of the server. If not specified, will need to
|
||||
use a non-secure server to perform a DNS reverse lookup to retrieve this
|
||||
information. It is always recommended to have both the ip address and fully
|
||||
qualified domain name specified.
|
||||
|
||||
\fIdomain\fP - If specified, this server is a domain-specific server. Any
|
||||
queries for this domain will be routed to this server. Multiple servers may be
|
||||
tagged with the same domain.
|
||||
.RE
|
||||
|
||||
\fIURI\fP format Examples:
|
||||
.nf
|
||||
|
||||
dns://8.8.8.8
|
||||
dns://[2001:4860:4860::8888]
|
||||
dns://[fe80::b542:84df:1719:65e3%en0]
|
||||
dns://192.168.1.1:55
|
||||
dns://192.168.1.1?tcpport=1153
|
||||
dns://10.0.1.1?domain=myvpn.com
|
||||
dns+tls://8.8.8.8?hostname=dns.google
|
||||
dns+tls://one.one.one.one?ipaddr=1.1.1.1
|
||||
|
||||
.fi
|
||||
|
||||
\fBNOTE\fP: While we are defining the scheme for things like domain-specific
|
||||
servers, DNS over TLS and DNS over HTTPS, the underlying implementations for
|
||||
those features do not yet exist and therefore will result in errors if they are
|
||||
attempted to be used.
|
||||
|
||||
192.168.1.100,192.168.1.101:53,[1:2:3::4]:53,[fe80::1]:53%eth0
|
||||
.PP
|
||||
As of c-ares 1.24.0, \fBares_set_servers_csv\fP and \fBares_set_servers_ports_csv\fP
|
||||
are identical. Prior versions would simply omit ports in \fBares_set_servers_csv\fP
|
||||
but due to the addition of link local interface support, this difference was
|
||||
removed.
|
||||
|
||||
.SH EXAMPLE
|
||||
.nf
|
||||
192.168.1.100,[fe80::1]:53%eth0,dns://192.168.1.1?tcpport=1153
|
||||
.fi
|
||||
|
||||
.SH RETURN VALUES
|
||||
.B ares_set_servers_csv(3)
|
||||
and
|
||||
|
|
@ -81,3 +160,4 @@ returns a string representing the servers configured which must be freed with
|
|||
\fBares_set_servers_csv\fP was added in c-ares 1.7.2
|
||||
\fBares_set_servers_ports_csv\fP was added in c-ares 1.11.0.
|
||||
\fBares_get_servers_csv\fP was added in c-ares 1.24.0.
|
||||
\fIURI\fP support was added in c-ares 1.34.0.
|
||||
|
|
|
|||
345
deps/cares/docs/ares_set_socket_functions.3
vendored
345
deps/cares/docs/ares_set_socket_functions.3
vendored
|
|
@ -1,12 +1,63 @@
|
|||
.\" Copyright (C) Daniel Stenberg
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.TH ARES_SET_SOCKET_FUNCTIONS 3 "13 Dec 2016"
|
||||
.TH ARES_SET_SOCKET_FUNCTIONS 3 "8 Oct 2024"
|
||||
.SH NAME
|
||||
ares_set_socket_functions \- Set socket io callbacks
|
||||
ares_set_socket_functions, ares_set_socket_functions_ex \- Set socket io callbacks
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
typedef enum {
|
||||
ARES_SOCKFUNC_FLAG_NONBLOCKING = 1 << 0
|
||||
} ares_sockfunc_flags_t;
|
||||
|
||||
typedef enum {
|
||||
ARES_SOCKET_OPT_SENDBUF_SIZE,
|
||||
ARES_SOCKET_OPT_RECVBUF_SIZE,
|
||||
ARES_SOCKET_OPT_BIND_DEVICE,
|
||||
ARES_SOCKET_OPT_TCP_FASTOPEN
|
||||
} ares_socket_opt_t;
|
||||
|
||||
typedef enum {
|
||||
ARES_SOCKET_CONN_TCP_FASTOPEN = 1 << 0
|
||||
} ares_socket_connect_flags_t;
|
||||
|
||||
typedef enum {
|
||||
ARES_SOCKET_BIND_TCP = 1 << 0,
|
||||
ARES_SOCKET_BIND_CLIENT = 1 << 1
|
||||
} ares_socket_bind_flags_t;
|
||||
|
||||
struct ares_socket_functions_ex {
|
||||
unsigned int version; /* ABI Version: must be "1" */
|
||||
unsigned int flags;
|
||||
|
||||
ares_socket_t (*asocket)(int domain, int type, int protocol, void *user_data);
|
||||
int (*aclose)(ares_socket_t sock, void *user_data);
|
||||
int (*asetsockopt)(ares_socket_t sock, ares_socket_opt_t opt, const void *val,
|
||||
ares_socklen_t val_size, void *user_data);
|
||||
int (*aconnect)(ares_socket_t sock, const struct sockaddr *address,
|
||||
ares_socklen_t address_len, unsigned int flags,
|
||||
void *user_data);
|
||||
ares_ssize_t (*arecvfrom)(ares_socket_t sock, void *buffer, size_t length,
|
||||
int flags, struct sockaddr *address,
|
||||
ares_socklen_t *address_len, void *user_data);
|
||||
ares_ssize_t (*asendto)(ares_socket_t sock, const void *buffer, size_t length,
|
||||
int flags, const struct sockaddr *address,
|
||||
ares_socklen_t address_len, void *user_data);
|
||||
int (*agetsockname)(ares_socket_t sock, struct sockaddr *address,
|
||||
ares_socklen_t *address_len, void *user_data);
|
||||
int (*abind)(ares_socket_t sock, unsigned int flags,
|
||||
const struct sockaddr *address, socklen_t address_len,
|
||||
void *user_data);
|
||||
unsigned int (*aif_nametoindex)(const char *ifname, void *user_data);
|
||||
const char *(*aif_indextoname)(unsigned int ifindex, char *ifname_buf,
|
||||
size_t ifname_buf_len, void *user_data);
|
||||
};
|
||||
|
||||
ares_status_t ares_set_socket_functions_ex(ares_channel_t *channel,
|
||||
const struct ares_socket_functions_ex *funcs, void *user_data);
|
||||
|
||||
|
||||
struct ares_socket_functions {
|
||||
ares_socket_t (*\fIasocket\fP)(int, int, int, void *);
|
||||
int (*\fIaclose\fP)(ares_socket_t, void *);
|
||||
|
|
@ -22,80 +73,262 @@ void ares_set_socket_functions(ares_channel_t *\fIchannel\fP,
|
|||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This function sets a set of callback \fIfunctions\fP in the given ares channel handle.
|
||||
Cannot be used when \fBARES_OPT_EVENT_THREAD\fP is passed to \fIares_init_options(3)\fP.
|
||||
|
||||
These callback functions will be invoked to create/destroy socket objects and perform
|
||||
io, instead of the normal system calls. A client application can override normal network
|
||||
operation fully through this functionality, and provide its own transport layer. You
|
||||
can choose to only implement some of the socket functions, and provide NULL to any
|
||||
others and c-ares will use its built-in system functions in that case.
|
||||
.PP
|
||||
All callback functions are expected to operate like their system equivalents, and to
|
||||
set
|
||||
.BR errno(3)
|
||||
to an appropriate error code on failure. C-ares also expects all io functions to behave
|
||||
asynchronously, i.e. as if the socket object has been set to non-blocking mode. Thus
|
||||
read/write calls (for TCP connections) are expected to often generate
|
||||
.BR EAGAIN
|
||||
or
|
||||
.BR EWOULDBLOCK.
|
||||
\fBares_set_socket_functions_ex(3)\fP sets a set of callback \fIfunctions\fP in
|
||||
the given ares channel handle. Cannot be used when \fBARES_OPT_EVENT_THREAD\fP
|
||||
is passed to \fIares_init_options(3)\fP. This function replaces the now
|
||||
deprecated \fBares_set_socket_functions(3)\fP call.
|
||||
|
||||
These callback functions will be invoked to create/destroy socket objects and
|
||||
perform io, instead of the normal system calls. A client application can
|
||||
override normal network operation fully through this functionality, and provide
|
||||
its own transport layer.
|
||||
|
||||
Some callbacks may be optional and are documented as such below, but failing
|
||||
to implement such callbacks will disable certain features within c-ares. It
|
||||
is strongly recommended to implement all callbacks.
|
||||
|
||||
All callback functions are expected to operate like their system equivalents,
|
||||
and to set \fBerrno(2)\fP or \fBWSASetLastError(2)\fP to an appropriate error
|
||||
code on failure. It is strongly recommended that io callbacks are implemented
|
||||
to be asynchronous and indicated as such in the \fIflags\fP member. The io
|
||||
callbacks can return error codes of \fBEAGAIN\fP, \fBEWOULDBLOCK\fP, or
|
||||
\fBWSAEWOULDBLOCK\fP when they would otherwise block.
|
||||
|
||||
The \fIuser_data\fP value is provided to each callback function invocation to
|
||||
serve as context.
|
||||
|
||||
The \fBares_set_socket_functions_ex(3)\fP must provide the following structure
|
||||
members and callbacks (which are different from the
|
||||
\fBares_set_socket_functions(3)\fP members and callbacks):
|
||||
|
||||
.RS 4
|
||||
.TP 8
|
||||
.B unsigned int \fIversion\fP
|
||||
.br
|
||||
ABI Version of structure. Must be set to a value of "1".
|
||||
|
||||
.TP 8
|
||||
.B unsigned int \fIflags\fP
|
||||
.br
|
||||
Flags available are specified in \fIares_sockfunc_flags_t\fP.
|
||||
|
||||
.TP 8
|
||||
.B ares_socket_t (*\fIasocket\fP)(int \fIdomain\fP, int \fItype\fP, int \fIprotocol\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIREQUIRED\fP. Creates an endpoint for communication and returns a descriptor. \fIdomain\fP,
|
||||
\fItype\fP, and \fIprotocol\fP each correspond to the parameters of
|
||||
\fBsocket(2)\fP. Returns a handle to the newly created socket, or
|
||||
\fBARES_SOCKET_BAD\fP on error.
|
||||
|
||||
.TP 8
|
||||
.B int (*\fIaclose\fP)(ares_socket_t \fIfd\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIREQUIRED\fP. Closes the socket endpoint indicated by \fIfd\fP. See \fBclose(2)\fP.
|
||||
|
||||
.TP 8
|
||||
.B int (*\fIasetsockopt\fP)(ares_socket_t \fIfd\fP, ares_socket_opt_t \fIopt\fP, const void * \fIval\fP, ares_socklen_t \fIval_size\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIREQUIRED\fP. Set socket option. This shares a similar syntax to the BSD \fIsetsockopt(2)\fP
|
||||
call, however c-ares uses different options for portability. The value is
|
||||
a pointer to the desired value, and each option has its own data type listed
|
||||
in the options below defined in \fIares_socket_opt_t\fP.
|
||||
|
||||
.TP 8
|
||||
.B int (*\fIaconnect\fP)(ares_socket_t \fIfd\fP, const struct sockaddr * \fIaddr\fP, ares_socklen_t \fIaddr_len\fP, unsigned int \fIflags\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIREQUIRED\fP. Initiate a connection to the address indicated by \fIaddr\fP on
|
||||
a socket. Additional flags controlling behavior are in
|
||||
\fIares_socket_connect_flags_t\fP. See \fBconnect(2)\fP.
|
||||
|
||||
.TP 8
|
||||
.B ares_ssize_t (*\fIarecvfrom\fP)(ares_socket_t \fIfd\fP, void * \fIbuffer\fP, size_t \fIbuf_size\fP, int \fIflags\fP, struct sockaddr * \fIaddr\fP, ares_socklen_t * \fIaddr_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIREQUIRED\fP. Receives data from remote socket endpoint, if available. If the
|
||||
\fIaddr\fP parameter is not NULL and the connection protocol provides the source
|
||||
address, the callback should fill this in. The \fIflags\fP parameter is
|
||||
currently unused. See \fBrecvfrom(2)\fP.
|
||||
|
||||
.TP 8
|
||||
.B ares_ssize_t (*\fIasendto\fP)(ares_socket_t \fIfd\fP, const void * \fIbuffer\fP, size_t \fIlength\fP, int \fIflags\fP, const struct sockaddr * \fIaddress\fP, ares_socklen_t \fIaddress_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIREQUIRED\fP. Send data, as provided by the \fIbuffer\fP, to the socket
|
||||
endpoint. The \fIflags\fP member may be used on systems that have
|
||||
\fBMSG_NOSIGNAL\fP defined but is otherwise unused. An \fIaddress\fP is
|
||||
provided primarily to support TCP FastOpen scenarios, which will be NULL in
|
||||
other circumstances. See \fBsendto(2)\fP.
|
||||
|
||||
.TP 8
|
||||
.B int (*\fIagetsockname\fP)(ares_socket_t \fIfd\fP, struct sockaddr * \fIaddress\fP, ares_socklen_t * \fIaddress_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIOptional\fP. Retrieve the local address of a socket and store it into the provided
|
||||
\fIaddress\fP buffer. May impact DNS Cookies if not provided. See
|
||||
\fBgetsockname(2)\fP.
|
||||
|
||||
.TP 8
|
||||
.B int (*\fIabind\fP)(ares_socket_t \fIfd\fP, unsigned int \fIflags\fP, const struct sockaddr * \fIaddress\fP, ares_socklen_t \fIaddress_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIOptional\fP. Bind the socket to an address. This can be used for client
|
||||
connections to bind the source address for packets before connect, or
|
||||
for server connections to bind to an address and port before listening.
|
||||
Currently c-ares only supports client connections. \fIflags\fP from
|
||||
\fIares_socket_bind_flags_t\fP can be specified. See \fBbind(2)\fP.
|
||||
|
||||
.TP 8
|
||||
.B unsigned int (*\fIaif_nametoindex\fP)(const char * \fIifname\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIOptional\fP. Convert an interface name into the interface index. If this
|
||||
callback is not specified, then IPv6 Link-Local DNS servers cannot be used.
|
||||
See \fBif_nametoindex(2)\fP.
|
||||
|
||||
.TP 8
|
||||
.B const char * (*\fIaif_indextoname\fP)(unsigned int \fIifindex\fP, char * \fIifname_buf\fP, size_t \fIifname_buf_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
\fIOptional\fP. Convert an interface index into the interface name. If this
|
||||
callback is not specified, then IPv6 Link-Local DNS servers cannot be used.
|
||||
\fIifname_buf\fP must be at least \fBIF_NAMESIZE\fP or \fBIFNAMSIZ\fP in size.
|
||||
See \fBif_indextoname(2)\fP.
|
||||
.RE
|
||||
|
||||
.PP
|
||||
The \fIuser_data\fP value is provided to each callback function invocation to serve as
|
||||
context.
|
||||
\fBares_sockfunc_flags_t\fP values:
|
||||
|
||||
.RS 4
|
||||
.TP 8
|
||||
.B \fIARES_SOCKFUNC_FLAG_NONBLOCKING\fP
|
||||
.br
|
||||
Used to indicate the implementation of the io functions are asynchronous.
|
||||
.RE
|
||||
|
||||
.PP
|
||||
The
|
||||
.B ares_socket_functions
|
||||
must provide the following callbacks:
|
||||
.TP 18
|
||||
.B \fIasocket\fP
|
||||
.B ares_socket_t(*)(int \fIdomain\fP, int \fItype\fP, int \fIprotocol\fP, void * \fIuser_data\fP)
|
||||
\fBares_socket_opt_t\fP values:
|
||||
|
||||
.RS 4
|
||||
.TP 8
|
||||
.B \fIARES_SOCKET_OPT_SENDBUF_SIZE\fP
|
||||
.br
|
||||
Set the Send Buffer size. Value is a pointer to an int. (SO_SNDBUF).
|
||||
|
||||
.TP 8
|
||||
.B \fIARES_SOCKET_OPT_RECVBUF_SIZE\fP
|
||||
.br
|
||||
Set the Receive Buffer size. Value is a pointer to an int. (SO_RCVBUF).
|
||||
|
||||
.TP 8
|
||||
.B \fIARES_SOCKET_OPT_BIND_DEVICE\fP
|
||||
.br
|
||||
Set the network interface to use as the source for communication. Value is a C
|
||||
string. (SO_BINDTODEVICE)
|
||||
|
||||
.TP 8
|
||||
.B \fIARES_SOCKET_OPT_TCP_FASTOPEN\fP
|
||||
.br
|
||||
Enable TCP Fast Open. Value is a pointer to an \fIares_bool_t\fP. On some
|
||||
systems this could be a no-op if it is known it is on by default and
|
||||
return success. Other systems may be a no-op if known the system does
|
||||
not support the feature and returns failure with errno set to \fBENOSYS\fP or
|
||||
\fBWSASetLastError(WSAEOPNOTSUPP);\fP.
|
||||
.RE
|
||||
|
||||
.PP
|
||||
\fBares_socket_connect_flags_t\fP values:
|
||||
.RS 4
|
||||
.TP 8
|
||||
.B \fIARES_SOCKET_CONN_TCP_FASTOPEN\fP
|
||||
.br
|
||||
Connect using TCP Fast Open.
|
||||
.RE
|
||||
|
||||
.PP
|
||||
\fBares_socket_bind_flags_t\fP values:
|
||||
|
||||
.RS 4
|
||||
.TP 8
|
||||
.B \fIARES_SOCKET_BIND_TCP\fP
|
||||
.br
|
||||
Bind is for a TCP connection.
|
||||
|
||||
.TP 19
|
||||
.B \fIARES_SOCKET_BIND_CLIENT\fP
|
||||
.br
|
||||
Bind is for a client connection, not server.
|
||||
.RE
|
||||
|
||||
.PP
|
||||
|
||||
\fBares_set_socket_functions(3)\fP sets a set of callback \fIfunctions\fP in the
|
||||
given ares channel handle. Cannot be used when \fBARES_OPT_EVENT_THREAD\fP is
|
||||
passed to \fIares_init_options(3)\fP. This function is deprecated as of
|
||||
c-ares 1.34.0 in favor of \fIares_set_socket_functions_ex(3)\fP.
|
||||
|
||||
\fBares_set_socket_functions(3)\fP allows you to choose to only implement
|
||||
some of the socket functions, and provide NULL to any others and c-ares will use
|
||||
its built-in system functions in that case.
|
||||
|
||||
.PP
|
||||
All callback functions are expected to operate like their system equivalents,
|
||||
and to set \fBerrno(2)\fP or \fBWSASetLastError(2)\fP to an appropriate error
|
||||
code on failure. It is strongly recommended all io functions behave
|
||||
asynchronously and return error codes of \fBEAGAIN\fP, \fBEWOULDBLOCK\fP, or
|
||||
\fBWSAEWOULDBLOCK\fP when they would otherwise block.
|
||||
|
||||
.PP
|
||||
The \fIuser_data\fP value is provided to each callback function invocation to
|
||||
serve as context.
|
||||
.PP
|
||||
The \fBares_set_socket_functions(3)\fP must provide the following callbacks (which
|
||||
are different from the \fBares_set_socket_functions_ex(3)\fP callbacks):
|
||||
|
||||
.RS 4
|
||||
.TP 8
|
||||
.B ares_socket_t (*\fIasocket\fP)(int \fIdomain\fP, int \fItype\fP, int \fIprotocol\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Creates an endpoint for communication and returns a descriptor. \fIdomain\fP, \fItype\fP, and \fIprotocol\fP
|
||||
each correspond to the parameters of
|
||||
.BR socket(2).
|
||||
Returns ahandle to the newly created socket, or -1 on error.
|
||||
.TP 18
|
||||
.B \fIaclose\fP
|
||||
.B int(*)(ares_socket_t \fIfd\fP, void * \fIuser_data\fP)
|
||||
each correspond to the parameters of \fBsocket(2)\fP. Returns ahandle to the
|
||||
newly created socket, or ARES_SOCKET_BAD on error.
|
||||
|
||||
.TP 8
|
||||
.B int (*\fIaclose\fP)(ares_socket_t \fIfd\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Closes the socket endpoint indicated by \fIfd\fP. See
|
||||
.BR close(2)
|
||||
.TP 18
|
||||
.B \fIaconnect\fP
|
||||
.B int(*)(ares_socket_t \fIfd\fP, const struct sockaddr * \fIaddr\fP, ares_socklen_t \fIaddr_len\fP, void * \fIuser_data\fP)
|
||||
Closes the socket endpoint indicated by \fIfd\fP. See \fBclose(2)\fP.
|
||||
|
||||
.TP 8
|
||||
.B int (*\fIaconnect\fP)(ares_socket_t \fIfd\fP, const struct sockaddr * \fIaddr\fP, ares_socklen_t \fIaddr_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Initiate a connection to the address indicated by \fIaddr\fP on a socket. See
|
||||
.BR connect(2)
|
||||
\fBconnect(2)\fP
|
||||
|
||||
.TP 18
|
||||
.B \fIarecvfrom\fP
|
||||
.B ares_ssize_t(*)(ares_socket_t \fIfd\fP, void * \fIbuffer\fP, size_t \fIbuf_size\fP, int \fIflags\fP, struct sockaddr * \fIaddr\fP, ares_socklen_t * \fIaddr_len\fP, void * \fIuser_data\fP)
|
||||
.TP 8
|
||||
.B ares_ssize_t (*\fIarecvfrom\fP)(ares_socket_t \fIfd\fP, void * \fIbuffer\fP, size_t \fIbuf_size\fP, int \fIflags\fP, struct sockaddr * \fIaddr\fP, ares_socklen_t * \fIaddr_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Receives data from remote socket endpoint, if available. If the \fIaddr\fP parameter is not NULL and the connection protocol provides the source address, the callback should fill this in. See
|
||||
.BR recvfrom(2)
|
||||
Receives data from remote socket endpoint, if available. If the \fIaddr\fP
|
||||
parameter is not NULL and the connection protocol provides the source address,
|
||||
the callback should fill this in. See \fBrecvfrom(2)\fP
|
||||
|
||||
.TP 18
|
||||
.B \fIasendv\fP
|
||||
.B ares_ssize_t(*)(ares_socket_t \fIfd\fP, const struct iovec * \fIdata\fP, int \fIlen\fP, void * \fIuser_data\fP)
|
||||
.TP 8
|
||||
.B ares_ssize_t (*\fIasendv\fP)(ares_socket_t \fIfd\fP, const struct iovec * \fIdata\fP, int \fIlen\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Send data, as provided by the iovec array \fIdata\fP, to the socket endpoint. See
|
||||
.BR writev(2),
|
||||
Send data, as provided by the iovec array \fIdata\fP, to the socket endpoint.
|
||||
See \fBwritev(2)\fP
|
||||
.RE
|
||||
|
||||
.PP
|
||||
The
|
||||
.B ares_socket_functions
|
||||
struct provided is not copied but directly referenced,
|
||||
and must thus remain valid through out the channels and any created socket's lifetime.
|
||||
The \fBares_set_socket_functions(3)\fP struct provided is not copied but directly
|
||||
referenced, and must thus remain valid through out the channels and any created
|
||||
socket's lifetime. However, the \fBares_set_socket_functions_ex(3)\fP struct is
|
||||
duplicated and does not need to survive past the call to the function.
|
||||
|
||||
.SH AVAILABILITY
|
||||
Added in c-ares 1.13.0
|
||||
ares_socket_functions added in c-ares 1.13.0, ares_socket_functions_ex added in
|
||||
c-ares 1.34.0
|
||||
.SH SEE ALSO
|
||||
.BR ares_init_options (3),
|
||||
.BR socket (2),
|
||||
.BR close (2),
|
||||
.BR connect (2),
|
||||
.BR recv (2),
|
||||
.BR recvfrom (2),
|
||||
.BR send (2),
|
||||
.BR sendto (2),
|
||||
.BR bind (2),
|
||||
.BR getsockname (2),
|
||||
.BR setsockopt (2),
|
||||
.BR writev (2)
|
||||
|
|
|
|||
308
deps/cares/include/ares.h
vendored
308
deps/cares/include/ares.h
vendored
|
|
@ -460,6 +460,8 @@ typedef void (*ares_server_state_callback)(const char *server_string,
|
|||
ares_bool_t success, int flags,
|
||||
void *data);
|
||||
|
||||
typedef void (*ares_pending_write_cb)(void *data);
|
||||
|
||||
CARES_EXTERN int ares_library_init(int flags);
|
||||
|
||||
CARES_EXTERN int ares_library_init_mem(int flags, void *(*amalloc)(size_t size),
|
||||
|
|
@ -473,6 +475,9 @@ CARES_EXTERN int ares_library_init_android(jobject connectivity_manager);
|
|||
CARES_EXTERN int ares_library_android_initialized(void);
|
||||
#endif
|
||||
|
||||
#define CARES_HAVE_ARES_LIBRARY_INIT 1
|
||||
#define CARES_HAVE_ARES_LIBRARY_CLEANUP 1
|
||||
|
||||
CARES_EXTERN int ares_library_initialized(void);
|
||||
|
||||
CARES_EXTERN void ares_library_cleanup(void);
|
||||
|
|
@ -526,6 +531,12 @@ CARES_EXTERN void
|
|||
ares_server_state_callback callback,
|
||||
void *user_data);
|
||||
|
||||
CARES_EXTERN void ares_set_pending_write_cb(ares_channel_t *channel,
|
||||
ares_pending_write_cb callback,
|
||||
void *user_data);
|
||||
|
||||
CARES_EXTERN void ares_process_pending_write(ares_channel_t *channel);
|
||||
|
||||
CARES_EXTERN int ares_set_sortlist(ares_channel_t *channel,
|
||||
const char *sortstr);
|
||||
|
||||
|
|
@ -556,10 +567,251 @@ struct ares_socket_functions {
|
|||
ares_ssize_t (*asendv)(ares_socket_t, const struct iovec *, int, void *);
|
||||
};
|
||||
|
||||
CARES_EXTERN void
|
||||
ares_set_socket_functions(ares_channel_t *channel,
|
||||
const struct ares_socket_functions *funcs,
|
||||
void *user_data);
|
||||
CARES_EXTERN CARES_DEPRECATED_FOR(
|
||||
ares_set_socket_functions_ex) void ares_set_socket_functions(ares_channel_t
|
||||
*channel,
|
||||
const struct
|
||||
ares_socket_functions
|
||||
*funcs,
|
||||
void *user_data);
|
||||
|
||||
/*! Flags defining behavior of socket functions */
|
||||
typedef enum {
|
||||
/*! Strongly recommended to create sockets as non-blocking and set this
|
||||
* flag */
|
||||
ARES_SOCKFUNC_FLAG_NONBLOCKING = 1 << 0
|
||||
} ares_sockfunc_flags_t;
|
||||
|
||||
/*! Socket options in request to asetsockopt() in struct
|
||||
* ares_socket_functions_ex */
|
||||
typedef enum {
|
||||
/*! Set the send buffer size. Value is a pointer to an int. (SO_SNDBUF) */
|
||||
ARES_SOCKET_OPT_SENDBUF_SIZE,
|
||||
/*! Set the recv buffer size. Value is a pointer to an int. (SO_RCVBUF) */
|
||||
ARES_SOCKET_OPT_RECVBUF_SIZE,
|
||||
/*! Set the network interface to use as the source for communication.
|
||||
* Value is a C string. (SO_BINDTODEVICE) */
|
||||
ARES_SOCKET_OPT_BIND_DEVICE,
|
||||
/*! Enable TCP Fast Open. Value is a pointer to an ares_bool_t. On some
|
||||
* systems this could be a no-op if it is known it is on by default and
|
||||
* return success. Other systems may be a no-op if known the system does
|
||||
* not support the feature and returns failure with errno set to ENOSYS or
|
||||
* WSASetLastError(WSAEOPNOTSUPP).
|
||||
*/
|
||||
ARES_SOCKET_OPT_TCP_FASTOPEN
|
||||
} ares_socket_opt_t;
|
||||
|
||||
/*! Flags for behavior during connect */
|
||||
typedef enum {
|
||||
/*! Connect using TCP Fast Open */
|
||||
ARES_SOCKET_CONN_TCP_FASTOPEN = 1 << 0
|
||||
} ares_socket_connect_flags_t;
|
||||
|
||||
/*! Flags for behavior during bind */
|
||||
typedef enum {
|
||||
/*! Bind is for a TCP connection */
|
||||
ARES_SOCKET_BIND_TCP = 1 << 0,
|
||||
/*! Bind is for a client connection, not server */
|
||||
ARES_SOCKET_BIND_CLIENT = 1 << 1
|
||||
} ares_socket_bind_flags_t;
|
||||
|
||||
/*! Socket functions to call rather than using OS-native functions */
|
||||
struct ares_socket_functions_ex {
|
||||
/*! ABI Version: must be "1" */
|
||||
unsigned int version;
|
||||
|
||||
/*! Flags indicating behavior of the subsystem. One or more
|
||||
* ares_sockfunc_flags_t */
|
||||
unsigned int flags;
|
||||
|
||||
/*! REQUIRED. Create a new socket file descriptor. The file descriptor must
|
||||
* be opened in non-blocking mode (so that reads and writes never block).
|
||||
* Recommended other options would be to disable signals on write errors
|
||||
* (SO_NOSIGPIPE), Disable the Nagle algorithm on SOCK_STREAM (TCP_NODELAY),
|
||||
* and to automatically close file descriptors on exec (FD_CLOEXEC).
|
||||
*
|
||||
* \param[in] domain Socket domain. Valid values are AF_INET, AF_INET6.
|
||||
* \param[in] type Socket type. Valid values are SOCK_STREAM (tcp) and
|
||||
* SOCK_DGRAM (udp).
|
||||
* \param[in] protocol In general this should be ignored, may be passed as
|
||||
* 0 (use as default for type), or may be IPPROTO_UDP
|
||||
* or IPPROTO_TCP.
|
||||
* \param[in] user_data Pointer provided to ares_set_socket_functions_ex().
|
||||
* \return ARES_SOCKET_BAD on error, or socket file descriptor on success.
|
||||
* On error, it is expected to set errno (or WSASetLastError()) to an
|
||||
* appropriate reason code such as EAFNOSUPPORT / WSAAFNOSUPPORT. */
|
||||
ares_socket_t (*asocket)(int domain, int type, int protocol, void *user_data);
|
||||
|
||||
/*! REQUIRED. Close a socket file descriptor.
|
||||
* \param[in] sock Socket file descriptor returned from asocket.
|
||||
* \param[in] user_data Pointer provided to ares_set_socket_functions_ex().
|
||||
* \return 0 on success. On failure, should set errno (or WSASetLastError)
|
||||
* to an appropriate code such as EBADF / WSAEBADF */
|
||||
int (*aclose)(ares_socket_t sock, void *user_data);
|
||||
|
||||
|
||||
/*! REQUIRED. Set socket option. This shares a similar syntax to the BSD
|
||||
* setsockopt() call, however we use our own options. The value is typically
|
||||
* a pointer to the desired value and each option has its own data type it
|
||||
* will express in the documentation.
|
||||
*
|
||||
* \param[in] sock Socket file descriptor returned from asocket.
|
||||
* \param[in] opt Option to set.
|
||||
* \param[in] val Pointer to value for option.
|
||||
* \param[in] val_size Size of value.
|
||||
* \param[in] user_data Pointer provided to
|
||||
* ares_set_socket_functions_ex().
|
||||
* \return Return 0 on success, otherwise -1 should be returned with an
|
||||
* appropriate errno (or WSASetLastError()) set. If error is ENOSYS /
|
||||
* WSAEOPNOTSUPP an error will not be propagated as it will take it
|
||||
* to mean it is an intentional decision to not support the feature.
|
||||
*/
|
||||
int (*asetsockopt)(ares_socket_t sock, ares_socket_opt_t opt, const void *val,
|
||||
ares_socklen_t val_size, void *user_data);
|
||||
|
||||
/*! REQUIRED. Connect to the remote using the supplied address. For UDP
|
||||
* sockets this will bind the file descriptor to only send and receive packets
|
||||
* from the remote address provided.
|
||||
*
|
||||
* \param[in] sock Socket file descriptor returned from asocket.
|
||||
* \param[in] address Address to connect to
|
||||
* \param[in] address_len Size of address structure passed
|
||||
* \param[in] flags One or more ares_socket_connect_flags_t
|
||||
* \param[in] user_data Pointer provided to
|
||||
* ares_set_socket_functions_ex().
|
||||
* \return Return 0 upon successful establishement, otherwise -1 should be
|
||||
* returned with an appropriate errno (or WSASetLastError()) set. It
|
||||
* is generally expected that most TCP connections (not using TCP Fast Open)
|
||||
* will return -1 with an error of EINPROGRESS / WSAEINPROGRESS due to the
|
||||
* non-blocking nature of the connection. It is then the responsibility of
|
||||
* the implementation to notify of writability on the socket to indicate the
|
||||
* connection has succeeded (or readability on failure to retrieve the
|
||||
* appropriate error).
|
||||
*/
|
||||
int (*aconnect)(ares_socket_t sock, const struct sockaddr *address,
|
||||
ares_socklen_t address_len, unsigned int flags,
|
||||
void *user_data);
|
||||
|
||||
/*! REQUIRED. Attempt to read data from the remote.
|
||||
*
|
||||
* \param[in] sock Socket file descriptor returned from asocket.
|
||||
* \param[in,out] buffer Allocated buffer to place data read from
|
||||
* socket.
|
||||
* \param[in] length Size of buffer
|
||||
* \param[in] flags Unused, always 0.
|
||||
* \param[in,out] address Buffer to hold address data was received from.
|
||||
* May be NULL if address not desired.
|
||||
* \param[in,out] address_len Input size of address buffer, output actual
|
||||
* written size. Must be NULL if address is NULL.
|
||||
* \param[in] user_data Pointer provided to
|
||||
* ares_set_socket_functions_ex().
|
||||
* \return -1 on error with appropriate errno (or WSASetLastError()) set,
|
||||
* such as EWOULDBLOCK / EAGAIN / WSAEWOULDBLOCK, or ECONNRESET /
|
||||
* WSAECONNRESET.
|
||||
*/
|
||||
ares_ssize_t (*arecvfrom)(ares_socket_t sock, void *buffer, size_t length,
|
||||
int flags, struct sockaddr *address,
|
||||
ares_socklen_t *address_len, void *user_data);
|
||||
|
||||
/*! REQUIRED. Attempt to send data to the remote. Optional address may be
|
||||
* specified which may be useful on unbound UDP sockets (though currently not
|
||||
* used), and TCP FastOpen where the connection is delayed until first write.
|
||||
*
|
||||
* \param[in] sock Socket file descriptor returned from asocket.
|
||||
* \param[in] buffer Containing data to place onto wire.
|
||||
* \param[in] length Size of buffer
|
||||
* \param[in] flags Flags for writing. Currently only used flag is
|
||||
* MSG_NOSIGNAL if the host OS has such a flag. In
|
||||
* general flags can be ignored.
|
||||
* \param[in] address Buffer containing address to send data to. May
|
||||
* be NULL.
|
||||
* \param[in,out] address_len Size of address buffer. Must be 0 if address
|
||||
* is NULL.
|
||||
* \param[in] user_data Pointer provided to
|
||||
* ares_set_socket_functions_ex().
|
||||
* \return Number of bytes written. -1 on error with appropriate errno (or
|
||||
* WSASetLastError()) set.
|
||||
*/
|
||||
ares_ssize_t (*asendto)(ares_socket_t sock, const void *buffer, size_t length,
|
||||
int flags, const struct sockaddr *address,
|
||||
ares_socklen_t address_len, void *user_data);
|
||||
|
||||
/*! Optional. Retrieve the local address of the socket.
|
||||
*
|
||||
* \param[in] sock Socket file descriptor returned from asocket
|
||||
* \param[in,out] address Buffer to hold address
|
||||
* \param[in,out] address_len Size of address buffer on input, written size
|
||||
* on output.
|
||||
* \param[in] user_data Pointer provided to
|
||||
* ares_set_socket_functions_ex().
|
||||
* \return 0 on success. -1 on error with an appropriate errno (or
|
||||
* WSASetLastError()) set.
|
||||
*/
|
||||
int (*agetsockname)(ares_socket_t sock, struct sockaddr *address,
|
||||
ares_socklen_t *address_len, void *user_data);
|
||||
|
||||
/*! Optional. Bind the socket to an address. This can be used for client
|
||||
* connections to bind the source address for packets before connect, or
|
||||
* for server connections to bind to an address and port before listening.
|
||||
* Currently c-ares only supports client connections.
|
||||
*
|
||||
* \param[in] sock Socket file descriptor returned from asocket
|
||||
* \param[in] flags ares_socket_bind_flags_t flags.
|
||||
* \param[in] address Buffer containing address.
|
||||
* \param[in] address_len Size of address buffer.
|
||||
* \param[in] user_data Pointer provided to
|
||||
* ares_set_socket_functions_ex().
|
||||
* \return 0 on success. -1 on error with an appropriate errno (or
|
||||
* WSASetLastError()) set.
|
||||
*/
|
||||
int (*abind)(ares_socket_t sock, unsigned int flags,
|
||||
const struct sockaddr *address, socklen_t address_len,
|
||||
void *user_data);
|
||||
|
||||
/* Optional. Convert an interface name into the interface index. If this
|
||||
* callback is not specified, then IPv6 Link-Local DNS servers cannot be used.
|
||||
*
|
||||
* \param[in] ifname Interface Name as NULL-terminated string.
|
||||
* \param[in] user_data Pointer provided to
|
||||
* ares_set_socket_functions_ex().
|
||||
* \return 0 on failure, otherwise interface index.
|
||||
*/
|
||||
unsigned int (*aif_nametoindex)(const char *ifname, void *user_data);
|
||||
|
||||
/* Optional. Convert an interface index into the interface name. If this
|
||||
* callback is not specified, then IPv6 Link-Local DNS servers cannot be used.
|
||||
*
|
||||
* \param[in] ifindex Interface index, must be > 0
|
||||
* \param[in] ifname_buf Buffer to hold interface name. Must be at least
|
||||
* IFNAMSIZ in length or 32 bytes if IFNAMSIZ isn't
|
||||
* defined.
|
||||
* \param[in] ifname_buf_len Size of ifname_buf for verification.
|
||||
* \param[in] user_data Pointer provided to
|
||||
* ares_set_socket_functions_ex().
|
||||
* \return NULL on failure, otherwise pointer to provided ifname_buf
|
||||
*/
|
||||
const char *(*aif_indextoname)(unsigned int ifindex, char *ifname_buf,
|
||||
size_t ifname_buf_len, void *user_data);
|
||||
};
|
||||
|
||||
/*! Override the native socket functions for the OS with the provided set.
|
||||
* An optional user data thunk may be specified which will be passed to
|
||||
* each registered callback. Replaces ares_set_socket_functions().
|
||||
*
|
||||
* \param[in] channel An initialized c-ares channel.
|
||||
* \param[in] funcs Structure registering the implementations for the
|
||||
* various functions. See the structure definition.
|
||||
* This will be duplicated and does not need to exist
|
||||
* past the life of this call.
|
||||
* \param[in] user_data User data thunk which will be passed to each call of
|
||||
* the registered callbacks.
|
||||
* \return ARES_SUCCESS on success, or another error code such as ARES_EFORMERR
|
||||
* on misuse.
|
||||
*/
|
||||
CARES_EXTERN ares_status_t ares_set_socket_functions_ex(
|
||||
ares_channel_t *channel, const struct ares_socket_functions_ex *funcs,
|
||||
void *user_data);
|
||||
|
||||
|
||||
CARES_EXTERN CARES_DEPRECATED_FOR(ares_send_dnsrec) void ares_send(
|
||||
ares_channel_t *channel, const unsigned char *qbuf, int qlen,
|
||||
|
|
@ -655,12 +907,52 @@ CARES_EXTERN struct timeval *ares_timeout(const ares_channel_t *channel,
|
|||
struct timeval *maxtv,
|
||||
struct timeval *tv);
|
||||
|
||||
CARES_EXTERN CARES_DEPRECATED_FOR(ares_process_fd) void ares_process(
|
||||
CARES_EXTERN CARES_DEPRECATED_FOR(ares_process_fds) void ares_process(
|
||||
ares_channel_t *channel, fd_set *read_fds, fd_set *write_fds);
|
||||
|
||||
CARES_EXTERN void ares_process_fd(ares_channel_t *channel,
|
||||
ares_socket_t read_fd,
|
||||
ares_socket_t write_fd);
|
||||
/*! Events used by ares_fd_events_t */
|
||||
typedef enum {
|
||||
ARES_FD_EVENT_NONE = 0, /*!< No events */
|
||||
ARES_FD_EVENT_READ = 1 << 0, /*!< Read event (including disconnect/error) */
|
||||
ARES_FD_EVENT_WRITE = 1 << 1 /*!< Write event */
|
||||
} ares_fd_eventflag_t;
|
||||
|
||||
/*! Type holding a file descriptor and mask of events, used by
|
||||
* ares_process_fds() */
|
||||
typedef struct {
|
||||
ares_socket_t fd; /*!< File descriptor */
|
||||
unsigned int events; /*!< Mask of ares_fd_eventflag_t */
|
||||
} ares_fd_events_t;
|
||||
|
||||
/*! Flags used by ares_process_fds() */
|
||||
typedef enum {
|
||||
ARES_PROCESS_FLAG_NONE = 0, /*!< No flag value */
|
||||
ARES_PROCESS_FLAG_SKIP_NON_FD = 1 << 0 /*!< skip any processing unrelated to
|
||||
* the file descriptor events passed
|
||||
* in */
|
||||
} ares_process_flag_t;
|
||||
|
||||
/*! Process events on multiple file descriptors based on the event mask
|
||||
* associated with each file descriptor. Recommended over calling
|
||||
* ares_process_fd() multiple times since it would trigger additional logic
|
||||
* such as timeout processing on each call.
|
||||
*
|
||||
* \param[in] channel Initialized ares channel
|
||||
* \param[in] events Array of file descriptors with events. May be NULL if
|
||||
* no events, but may have timeouts to process.
|
||||
* \param[in] nevents Number of elements in the events array. May be 0 if
|
||||
* no events, but may have timeouts to process.
|
||||
* \param[in] flags Flags to alter behavior of the process command.
|
||||
* \return ARES_ENOMEM on out of memory, ARES_EFORMERR on misuse,
|
||||
* otherwise ARES_SUCCESS
|
||||
*/
|
||||
CARES_EXTERN ares_status_t ares_process_fds(ares_channel_t *channel,
|
||||
const ares_fd_events_t *events,
|
||||
size_t nevents, unsigned int flags);
|
||||
|
||||
CARES_EXTERN void ares_process_fd(ares_channel_t *channel,
|
||||
ares_socket_t read_fd,
|
||||
ares_socket_t write_fd);
|
||||
|
||||
CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_record_create) int ares_create_query(
|
||||
const char *name, int dnsclass, int type, unsigned short id, int rd,
|
||||
|
|
|
|||
1
deps/cares/include/ares_build.h
vendored
1
deps/cares/include/ares_build.h
vendored
|
|
@ -165,7 +165,6 @@
|
|||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(_WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
# define CARES_HAVE_WINDOWS_H 1
|
||||
# define CARES_HAVE_SYS_TYPES_H 1
|
||||
|
|
|
|||
15
deps/cares/include/ares_version.h
vendored
15
deps/cares/include/ares_version.h
vendored
|
|
@ -31,14 +31,21 @@
|
|||
#define ARES_COPYRIGHT "2004 - 2024 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
#define ARES_VERSION_MAJOR 1
|
||||
#define ARES_VERSION_MINOR 33
|
||||
#define ARES_VERSION_MINOR 34
|
||||
#define ARES_VERSION_PATCH 1
|
||||
|
||||
#define ARES_VERSION \
|
||||
((ARES_VERSION_MAJOR << 16) | (ARES_VERSION_MINOR << 8) | \
|
||||
(ARES_VERSION_PATCH))
|
||||
#define ARES_VERSION_STR "1.33.1"
|
||||
|
||||
#define CARES_HAVE_ARES_LIBRARY_INIT 1
|
||||
#define CARES_HAVE_ARES_LIBRARY_CLEANUP 1
|
||||
|
||||
/* Need a level of indirection due to argument prescan to stringify a macro
|
||||
* value. */
|
||||
#define ARES_STRINGIFY_PRE(s) #s
|
||||
#define ARES_STRINGIFY(s) ARES_STRINGIFY_PRE(s)
|
||||
|
||||
#define ARES_VERSION_STR \
|
||||
ARES_STRINGIFY(ARES_VERSION_MAJOR) \
|
||||
"." ARES_STRINGIFY(ARES_VERSION_MINOR) "." ARES_STRINGIFY(ARES_VERSION_PATCH)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
307
deps/cares/m4/libtool.m4
vendored
307
deps/cares/m4/libtool.m4
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software
|
||||
# Copyright (C) 1996-2001, 2003-2019, 2021-2024 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gordon Matzigkeit, 1996
|
||||
#
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
# modifications, as long as this notice is preserved.
|
||||
|
||||
m4_define([_LT_COPYING], [dnl
|
||||
# Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
# This is free software; see the source for copying conditions. There is NO
|
||||
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
# GNU Libtool is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of of the License, or
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
|
|
@ -32,7 +32,7 @@ m4_define([_LT_COPYING], [dnl
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
])
|
||||
|
||||
# serial 59 LT_INIT
|
||||
# serial 62 LT_INIT
|
||||
|
||||
|
||||
# LT_PREREQ(VERSION)
|
||||
|
|
@ -60,7 +60,7 @@ esac
|
|||
# LT_INIT([OPTIONS])
|
||||
# ------------------
|
||||
AC_DEFUN([LT_INIT],
|
||||
[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK
|
||||
[AC_PREREQ([2.64])dnl We use AC_PATH_PROGS_FEATURE_CHECK
|
||||
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
|
||||
AC_BEFORE([$0], [LT_LANG])dnl
|
||||
AC_BEFORE([$0], [LT_OUTPUT])dnl
|
||||
|
|
@ -616,7 +616,7 @@ m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
|
|||
# LT_OUTPUT
|
||||
# ---------
|
||||
# This macro allows early generation of the libtool script (before
|
||||
# AC_OUTPUT is called), incase it is used in configure for compilation
|
||||
# AC_OUTPUT is called), in case it is used in configure for compilation
|
||||
# tests.
|
||||
AC_DEFUN([LT_OUTPUT],
|
||||
[: ${CONFIG_LT=./config.lt}
|
||||
|
|
@ -651,9 +651,9 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
|
|||
m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
|
||||
configured by $[0], generated by m4_PACKAGE_STRING.
|
||||
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
This config.lt script is free software; the Free Software Foundation
|
||||
gives unlimited permision to copy, distribute and modify it."
|
||||
gives unlimited permission to copy, distribute and modify it."
|
||||
|
||||
while test 0 != $[#]
|
||||
do
|
||||
|
|
@ -730,7 +730,6 @@ _LT_CONFIG_SAVE_COMMANDS([
|
|||
cat <<_LT_EOF >> "$cfgfile"
|
||||
#! $SHELL
|
||||
# Generated automatically by $as_me ($PACKAGE) $VERSION
|
||||
# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
|
||||
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
||||
|
||||
# Provide generalized library-building support services.
|
||||
|
|
@ -975,6 +974,7 @@ _lt_linker_boilerplate=`cat conftest.err`
|
|||
$RM -r conftest*
|
||||
])# _LT_LINKER_BOILERPLATE
|
||||
|
||||
|
||||
# _LT_REQUIRED_DARWIN_CHECKS
|
||||
# -------------------------
|
||||
m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
|
||||
|
|
@ -1025,6 +1025,21 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
|
|||
rm -f conftest.*
|
||||
fi])
|
||||
|
||||
# Feature test to disable chained fixups since it is not
|
||||
# compatible with '-undefined dynamic_lookup'
|
||||
AC_CACHE_CHECK([for -no_fixup_chains linker flag],
|
||||
[lt_cv_support_no_fixup_chains],
|
||||
[ save_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -Wl,-no_fixup_chains"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([],[])],
|
||||
lt_cv_support_no_fixup_chains=yes,
|
||||
lt_cv_support_no_fixup_chains=no
|
||||
)
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
]
|
||||
)
|
||||
|
||||
AC_CACHE_CHECK([for -exported_symbols_list linker flag],
|
||||
[lt_cv_ld_exported_symbols_list],
|
||||
[lt_cv_ld_exported_symbols_list=no
|
||||
|
|
@ -1049,7 +1064,7 @@ _LT_EOF
|
|||
echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
|
||||
$RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
|
||||
cat > conftest.c << _LT_EOF
|
||||
int main() { return 0;}
|
||||
int main(void) { return 0;}
|
||||
_LT_EOF
|
||||
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
|
||||
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
|
||||
|
|
@ -1074,7 +1089,11 @@ _LT_EOF
|
|||
10.[[012]],*|,*powerpc*-darwin[[5-8]]*)
|
||||
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
|
||||
*)
|
||||
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
|
||||
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup'
|
||||
if test yes = "$lt_cv_support_no_fixup_chains"; then
|
||||
AS_VAR_APPEND([_lt_dar_allow_undefined], [' $wl-no_fixup_chains'])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1256,7 +1275,9 @@ lt_sysroot=
|
|||
case $with_sysroot in #(
|
||||
yes)
|
||||
if test yes = "$GCC"; then
|
||||
lt_sysroot=`$CC --print-sysroot 2>/dev/null`
|
||||
# Trim trailing / since we'll always append absolute paths and we want
|
||||
# to avoid //, if only for less confusing output for the user.
|
||||
lt_sysroot=`$CC --print-sysroot 2>/dev/null | $SED 's:/\+$::'`
|
||||
fi
|
||||
;; #(
|
||||
/*)
|
||||
|
|
@ -1368,7 +1389,7 @@ mips64*-*linux*)
|
|||
;;
|
||||
|
||||
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
|
||||
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
|
||||
s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu*)
|
||||
# Find out what ABI is being produced by ac_compile, and set linker
|
||||
# options accordingly. Note that the listed cases only cover the
|
||||
# situations where additional linker options are needed (such as when
|
||||
|
|
@ -1383,7 +1404,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
|
|||
x86_64-*kfreebsd*-gnu)
|
||||
LD="${LD-ld} -m elf_i386_fbsd"
|
||||
;;
|
||||
x86_64-*linux*)
|
||||
x86_64-*linux*|x86_64-gnu*)
|
||||
case `$FILECMD conftest.o` in
|
||||
*x86-64*)
|
||||
LD="${LD-ld} -m elf32_x86_64"
|
||||
|
|
@ -1412,7 +1433,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
|
|||
x86_64-*kfreebsd*-gnu)
|
||||
LD="${LD-ld} -m elf_x86_64_fbsd"
|
||||
;;
|
||||
x86_64-*linux*)
|
||||
x86_64-*linux*|x86_64-gnu*)
|
||||
LD="${LD-ld} -m elf_x86_64"
|
||||
;;
|
||||
powerpcle-*linux*)
|
||||
|
|
@ -1495,7 +1516,7 @@ _LT_DECL([], [AR], [1], [The archiver])
|
|||
|
||||
# Use ARFLAGS variable as AR's operation code to sync the variable naming with
|
||||
# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have
|
||||
# higher priority because thats what people were doing historically (setting
|
||||
# higher priority because that's what people were doing historically (setting
|
||||
# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS
|
||||
# variable obsoleted/removed.
|
||||
|
||||
|
|
@ -1545,7 +1566,7 @@ AC_CHECK_TOOL(STRIP, strip, :)
|
|||
test -z "$STRIP" && STRIP=:
|
||||
_LT_DECL([], [STRIP], [1], [A symbol stripping program])
|
||||
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
||||
AC_REQUIRE([AC_PROG_RANLIB])
|
||||
test -z "$RANLIB" && RANLIB=:
|
||||
_LT_DECL([], [RANLIB], [1],
|
||||
[Commands used to install an old-style archive])
|
||||
|
|
@ -1556,15 +1577,8 @@ old_postinstall_cmds='chmod 644 $oldlib'
|
|||
old_postuninstall_cmds=
|
||||
|
||||
if test -n "$RANLIB"; then
|
||||
case $host_os in
|
||||
bitrig* | openbsd*)
|
||||
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
|
||||
;;
|
||||
*)
|
||||
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
|
||||
;;
|
||||
esac
|
||||
old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
|
||||
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
|
||||
fi
|
||||
|
||||
case $host_os in
|
||||
|
|
@ -1703,7 +1717,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
|
|||
lt_cv_sys_max_cmd_len=-1;
|
||||
;;
|
||||
|
||||
cygwin* | mingw* | cegcc*)
|
||||
cygwin* | mingw* | windows* | cegcc*)
|
||||
# On Win9x/ME, this test blows up -- it succeeds, but takes
|
||||
# about 5 minutes as the teststring grows exponentially.
|
||||
# Worse, since 9x/ME are not pre-emptively multitasking,
|
||||
|
|
@ -1725,7 +1739,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
|
|||
lt_cv_sys_max_cmd_len=8192;
|
||||
;;
|
||||
|
||||
bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*)
|
||||
darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*)
|
||||
# This has been around since 386BSD, at least. Likely further.
|
||||
if test -x /sbin/sysctl; then
|
||||
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
|
||||
|
|
@ -1885,11 +1899,11 @@ else
|
|||
/* When -fvisibility=hidden is used, assume the code has been annotated
|
||||
correspondingly for the symbols needed. */
|
||||
#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
|
||||
int fnord () __attribute__((visibility("default")));
|
||||
int fnord (void) __attribute__((visibility("default")));
|
||||
#endif
|
||||
|
||||
int fnord () { return 42; }
|
||||
int main ()
|
||||
int fnord (void) { return 42; }
|
||||
int main (void)
|
||||
{
|
||||
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
|
||||
int status = $lt_dlunknown;
|
||||
|
|
@ -1946,7 +1960,7 @@ else
|
|||
lt_cv_dlopen_self=yes
|
||||
;;
|
||||
|
||||
mingw* | pw32* | cegcc*)
|
||||
mingw* | windows* | pw32* | cegcc*)
|
||||
lt_cv_dlopen=LoadLibrary
|
||||
lt_cv_dlopen_libs=
|
||||
;;
|
||||
|
|
@ -2314,7 +2328,7 @@ if test yes = "$GCC"; then
|
|||
*) lt_awk_arg='/^libraries:/' ;;
|
||||
esac
|
||||
case $host_os in
|
||||
mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
|
||||
mingw* | windows* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
|
||||
*) lt_sed_strip_eq='s|=/|/|g' ;;
|
||||
esac
|
||||
lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
|
||||
|
|
@ -2372,7 +2386,7 @@ BEGIN {RS = " "; FS = "/|\n";} {
|
|||
# AWK program above erroneously prepends '/' to C:/dos/paths
|
||||
# for these hosts.
|
||||
case $host_os in
|
||||
mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
|
||||
mingw* | windows* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
|
||||
$SED 's|/\([[A-Za-z]]:\)|\1|g'` ;;
|
||||
esac
|
||||
sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
|
||||
|
|
@ -2447,7 +2461,7 @@ aix[[4-9]]*)
|
|||
# Unfortunately, runtime linking may impact performance, so we do
|
||||
# not want this to be the default eventually. Also, we use the
|
||||
# versioned .so libs for executables only if there is the -brtl
|
||||
# linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
|
||||
# linker flag in LDFLAGS as well, or --enable-aix-soname=svr4 only.
|
||||
# To allow for filename-based versioning support, we need to create
|
||||
# libNAME.so.V as an archive file, containing:
|
||||
# *) an Import File, referring to the versioned filename of the
|
||||
|
|
@ -2541,7 +2555,7 @@ bsdi[[45]]*)
|
|||
# libtool to hard-code these into programs
|
||||
;;
|
||||
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin* | mingw* | windows* | pw32* | cegcc*)
|
||||
version_type=windows
|
||||
shrext_cmds=.dll
|
||||
need_version=no
|
||||
|
|
@ -2552,6 +2566,19 @@ cygwin* | mingw* | pw32* | cegcc*)
|
|||
# gcc
|
||||
library_names_spec='$libname.dll.a'
|
||||
# DLL is installed to $(libdir)/../bin by postinstall_cmds
|
||||
# If user builds GCC with mulitlibs enabled,
|
||||
# it should just install on $(libdir)
|
||||
# not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
|
||||
if test yes = $multilib; then
|
||||
postinstall_cmds='base_file=`basename \$file`~
|
||||
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
|
||||
dldir=$destdir/`dirname \$dlpath`~
|
||||
$install_prog $dir/$dlname $destdir/$dlname~
|
||||
chmod a+x $destdir/$dlname~
|
||||
if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
|
||||
eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
|
||||
fi'
|
||||
else
|
||||
postinstall_cmds='base_file=`basename \$file`~
|
||||
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
|
||||
dldir=$destdir/`dirname \$dlpath`~
|
||||
|
|
@ -2561,6 +2588,7 @@ cygwin* | mingw* | pw32* | cegcc*)
|
|||
if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
|
||||
eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
|
||||
fi'
|
||||
fi
|
||||
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
|
||||
dlpath=$dir/\$dldll~
|
||||
$RM \$dlpath'
|
||||
|
|
@ -2573,7 +2601,7 @@ cygwin* | mingw* | pw32* | cegcc*)
|
|||
m4_if([$1], [],[
|
||||
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
|
||||
;;
|
||||
mingw* | cegcc*)
|
||||
mingw* | windows* | cegcc*)
|
||||
# MinGW DLLs use traditional 'lib' prefix
|
||||
soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
|
||||
;;
|
||||
|
|
@ -2592,7 +2620,7 @@ m4_if([$1], [],[
|
|||
library_names_spec='$libname.dll.lib'
|
||||
|
||||
case $build_os in
|
||||
mingw*)
|
||||
mingw* | windows*)
|
||||
sys_lib_search_path_spec=
|
||||
lt_save_ifs=$IFS
|
||||
IFS=';'
|
||||
|
|
@ -2699,7 +2727,21 @@ freebsd* | dragonfly* | midnightbsd*)
|
|||
need_version=yes
|
||||
;;
|
||||
esac
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
case $host_cpu in
|
||||
powerpc64)
|
||||
# On FreeBSD bi-arch platforms, a different variable is used for 32-bit
|
||||
# binaries. See <https://man.freebsd.org/cgi/man.cgi?query=ld.so>.
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_SOURCE(
|
||||
[[int test_pointer_size[sizeof (void *) - 5];
|
||||
]])],
|
||||
[shlibpath_var=LD_LIBRARY_PATH],
|
||||
[shlibpath_var=LD_32_LIBRARY_PATH])
|
||||
;;
|
||||
*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
esac
|
||||
case $host_os in
|
||||
freebsd2.*)
|
||||
shlibpath_overrides_runpath=yes
|
||||
|
|
@ -2840,7 +2882,7 @@ linux*android*)
|
|||
version_type=none # Android doesn't support versioned libraries.
|
||||
need_lib_prefix=no
|
||||
need_version=no
|
||||
library_names_spec='$libname$release$shared_ext'
|
||||
library_names_spec='$libname$release$shared_ext $libname$shared_ext'
|
||||
soname_spec='$libname$release$shared_ext'
|
||||
finish_cmds=
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
|
|
@ -2852,8 +2894,9 @@ linux*android*)
|
|||
hardcode_into_libs=yes
|
||||
|
||||
dynamic_linker='Android linker'
|
||||
# Don't embed -rpath directories since the linker doesn't support them.
|
||||
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
|
||||
# -rpath works at least for libraries that are not overridden by
|
||||
# libraries installed in system locations.
|
||||
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
|
||||
;;
|
||||
|
||||
# This must be glibc/ELF.
|
||||
|
|
@ -2887,7 +2930,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
|
|||
# before this can be enabled.
|
||||
hardcode_into_libs=yes
|
||||
|
||||
# Ideally, we could use ldconfig to report *all* directores which are
|
||||
# Ideally, we could use ldconfig to report *all* directories which are
|
||||
# searched for libraries, however this is still not possible. Aside from not
|
||||
# being certain /sbin/ldconfig is available, command
|
||||
# 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
|
||||
|
|
@ -2944,7 +2987,7 @@ newsos6)
|
|||
dynamic_linker='ldqnx.so'
|
||||
;;
|
||||
|
||||
openbsd* | bitrig*)
|
||||
openbsd*)
|
||||
version_type=sunos
|
||||
sys_lib_dlsearch_path_spec=/usr/lib
|
||||
need_lib_prefix=no
|
||||
|
|
@ -3276,7 +3319,7 @@ if test yes = "$GCC"; then
|
|||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by $CC])
|
||||
case $host in
|
||||
*-*-mingw*)
|
||||
*-*-mingw* | *-*-windows*)
|
||||
# gcc leaves a trailing carriage return, which upsets mingw
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
|
||||
*)
|
||||
|
|
@ -3385,7 +3428,7 @@ case $reload_flag in
|
|||
esac
|
||||
reload_cmds='$LD$reload_flag -o $output$reload_objs'
|
||||
case $host_os in
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin* | mingw* | windows* | pw32* | cegcc*)
|
||||
if test yes != "$GCC"; then
|
||||
reload_cmds=false
|
||||
fi
|
||||
|
|
@ -3457,7 +3500,6 @@ lt_cv_deplibs_check_method='unknown'
|
|||
# 'none' -- dependencies not supported.
|
||||
# 'unknown' -- same as none, but documents that we really don't know.
|
||||
# 'pass_all' -- all dependencies passed with no checks.
|
||||
# 'test_compile' -- check by making test program.
|
||||
# 'file_magic [[regex]]' -- check by looking for files in library path
|
||||
# that responds to the $file_magic_cmd with a given extended regex.
|
||||
# If you have 'file' or equivalent on your system and you're not sure
|
||||
|
|
@ -3484,7 +3526,7 @@ cygwin*)
|
|||
lt_cv_file_magic_cmd='func_win32_libid'
|
||||
;;
|
||||
|
||||
mingw* | pw32*)
|
||||
mingw* | windows* | pw32*)
|
||||
# Base MSYS/MinGW do not provide the 'file' command needed by
|
||||
# func_win32_libid shell function, so use a weaker test based on 'objdump',
|
||||
# unless we find 'file', for example because we are cross-compiling.
|
||||
|
|
@ -3493,7 +3535,7 @@ mingw* | pw32*)
|
|||
lt_cv_file_magic_cmd='func_win32_libid'
|
||||
else
|
||||
# Keep this pattern in sync with the one in func_win32_libid.
|
||||
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
|
||||
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)'
|
||||
lt_cv_file_magic_cmd='$OBJDUMP -f'
|
||||
fi
|
||||
;;
|
||||
|
|
@ -3584,7 +3626,7 @@ newos6*)
|
|||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
openbsd* | bitrig*)
|
||||
openbsd*)
|
||||
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
|
||||
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
|
||||
else
|
||||
|
|
@ -3648,7 +3690,7 @@ file_magic_glob=
|
|||
want_nocaseglob=no
|
||||
if test "$build" = "$host"; then
|
||||
case $host_os in
|
||||
mingw* | pw32*)
|
||||
mingw* | windows* | pw32*)
|
||||
if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
|
||||
want_nocaseglob=yes
|
||||
else
|
||||
|
|
@ -3700,7 +3742,7 @@ else
|
|||
# Tru64's nm complains that /dev/null is an invalid object file
|
||||
# MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
|
||||
case $build_os in
|
||||
mingw*) lt_bad_file=conftest.nm/nofile ;;
|
||||
mingw* | windows*) lt_bad_file=conftest.nm/nofile ;;
|
||||
*) lt_bad_file=/dev/null ;;
|
||||
esac
|
||||
case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in
|
||||
|
|
@ -3791,7 +3833,7 @@ lt_cv_sharedlib_from_linklib_cmd,
|
|||
[lt_cv_sharedlib_from_linklib_cmd='unknown'
|
||||
|
||||
case $host_os in
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin* | mingw* | windows* | pw32* | cegcc*)
|
||||
# two different shell functions defined in ltmain.sh;
|
||||
# decide which one to use based on capabilities of $DLLTOOL
|
||||
case `$DLLTOOL --help 2>&1` in
|
||||
|
|
@ -3823,16 +3865,16 @@ _LT_DECL([], [sharedlib_from_linklib_cmd], [1],
|
|||
m4_defun([_LT_PATH_MANIFEST_TOOL],
|
||||
[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
|
||||
test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
|
||||
AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
|
||||
[lt_cv_path_mainfest_tool=no
|
||||
AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_manifest_tool],
|
||||
[lt_cv_path_manifest_tool=no
|
||||
echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
|
||||
$MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
|
||||
cat conftest.err >&AS_MESSAGE_LOG_FD
|
||||
if $GREP 'Manifest Tool' conftest.out > /dev/null; then
|
||||
lt_cv_path_mainfest_tool=yes
|
||||
lt_cv_path_manifest_tool=yes
|
||||
fi
|
||||
rm -f conftest*])
|
||||
if test yes != "$lt_cv_path_mainfest_tool"; then
|
||||
if test yes != "$lt_cv_path_manifest_tool"; then
|
||||
MANIFEST_TOOL=:
|
||||
fi
|
||||
_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
|
||||
|
|
@ -3861,7 +3903,7 @@ AC_DEFUN([LT_LIB_M],
|
|||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case $host in
|
||||
*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
|
||||
*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-mingw* | *-*-pw32* | *-*-darwin*)
|
||||
# These system don't have libm, or don't need it
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
|
|
@ -3936,7 +3978,7 @@ case $host_os in
|
|||
aix*)
|
||||
symcode='[[BCDT]]'
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin* | mingw* | windows* | pw32* | cegcc*)
|
||||
symcode='[[ABCDGISTW]]'
|
||||
;;
|
||||
hpux*)
|
||||
|
|
@ -3951,7 +3993,7 @@ osf*)
|
|||
symcode='[[BCDEGQRST]]'
|
||||
;;
|
||||
solaris*)
|
||||
symcode='[[BDRT]]'
|
||||
symcode='[[BCDRT]]'
|
||||
;;
|
||||
sco3.2v5*)
|
||||
symcode='[[DT]]'
|
||||
|
|
@ -4015,7 +4057,7 @@ $lt_c_name_lib_hook\
|
|||
# Handle CRLF in mingw tool chain
|
||||
opt_cr=
|
||||
case $build_os in
|
||||
mingw*)
|
||||
mingw* | windows*)
|
||||
opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
|
||||
;;
|
||||
esac
|
||||
|
|
@ -4066,7 +4108,7 @@ void nm_test_func(void){}
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
int main(){nm_test_var='a';nm_test_func();return(0);}
|
||||
int main(void){nm_test_var='a';nm_test_func();return(0);}
|
||||
_LT_EOF
|
||||
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
|
|
@ -4242,7 +4284,7 @@ m4_if([$1], [CXX], [
|
|||
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
|
||||
# PIC is the default for these OSes.
|
||||
;;
|
||||
mingw* | cygwin* | os2* | pw32* | cegcc*)
|
||||
mingw* | windows* | cygwin* | os2* | pw32* | cegcc*)
|
||||
# This hack is so that the source file can tell whether it is being
|
||||
# built for inclusion in a dll (and should export symbols for example).
|
||||
# Although the cygwin gcc ignores -fPIC, still need this for old-style
|
||||
|
|
@ -4318,7 +4360,7 @@ m4_if([$1], [CXX], [
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
mingw* | cygwin* | os2* | pw32* | cegcc*)
|
||||
mingw* | windows* | cygwin* | os2* | pw32* | cegcc*)
|
||||
# This hack is so that the source file can tell whether it is being
|
||||
# built for inclusion in a dll (and should export symbols for example).
|
||||
m4_if([$1], [GCJ], [],
|
||||
|
|
@ -4566,7 +4608,7 @@ m4_if([$1], [CXX], [
|
|||
# PIC is the default for these OSes.
|
||||
;;
|
||||
|
||||
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
mingw* | windows* | cygwin* | pw32* | os2* | cegcc*)
|
||||
# This hack is so that the source file can tell whether it is being
|
||||
# built for inclusion in a dll (and should export symbols for example).
|
||||
# Although the cygwin gcc ignores -fPIC, still need this for old-style
|
||||
|
|
@ -4670,7 +4712,7 @@ m4_if([$1], [CXX], [
|
|||
esac
|
||||
;;
|
||||
|
||||
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
mingw* | windows* | cygwin* | pw32* | os2* | cegcc*)
|
||||
# This hack is so that the source file can tell whether it is being
|
||||
# built for inclusion in a dll (and should export symbols for example).
|
||||
m4_if([$1], [GCJ], [],
|
||||
|
|
@ -4712,6 +4754,12 @@ m4_if([$1], [CXX], [
|
|||
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
|
||||
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
|
||||
;;
|
||||
*flang* | ftn)
|
||||
# Flang compiler.
|
||||
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
|
||||
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
|
||||
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
|
||||
;;
|
||||
# icc used to be incompatible with GCC.
|
||||
# ICC 10 doesn't accept -KPIC any more.
|
||||
icc* | ifort*)
|
||||
|
|
@ -4945,7 +4993,7 @@ m4_if([$1], [CXX], [
|
|||
pw32*)
|
||||
_LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
|
||||
;;
|
||||
cygwin* | mingw* | cegcc*)
|
||||
cygwin* | mingw* | windows* | cegcc*)
|
||||
case $cc_basename in
|
||||
cl* | icl*)
|
||||
_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
|
||||
|
|
@ -5003,7 +5051,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
|
|||
extract_expsyms_cmds=
|
||||
|
||||
case $host_os in
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin* | mingw* | windows* | pw32* | cegcc*)
|
||||
# FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++ or Intel C++ Compiler.
|
||||
|
|
@ -5015,7 +5063,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
|
|||
# we just hope/assume this is gcc and not c89 (= MSVC++ or ICC)
|
||||
with_gnu_ld=yes
|
||||
;;
|
||||
openbsd* | bitrig*)
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
|
@ -5118,7 +5166,7 @@ _LT_EOF
|
|||
fi
|
||||
;;
|
||||
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin* | mingw* | windows* | pw32* | cegcc*)
|
||||
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
|
||||
# as there is no search path for DLLs.
|
||||
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
|
||||
|
|
@ -5174,7 +5222,7 @@ _LT_EOF
|
|||
cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
|
||||
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
|
||||
emximp -o $lib $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
|
||||
_LT_TAGVAR(file_list_spec, $1)='@'
|
||||
;;
|
||||
|
|
@ -5575,7 +5623,7 @@ _LT_EOF
|
|||
_LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
|
||||
;;
|
||||
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin* | mingw* | windows* | pw32* | cegcc*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++ or Intel C++ Compiler.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
|
|
@ -5592,14 +5640,14 @@ _LT_EOF
|
|||
# Tell ltmain to make .dll files, not .so files.
|
||||
shrext_cmds=.dll
|
||||
# FIXME: Setting linknames here is a bad hack.
|
||||
_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
|
||||
_LT_TAGVAR(archive_cmds, $1)='$CC -Fe $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
|
||||
_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
|
||||
cp "$export_symbols" "$output_objdir/$soname.def";
|
||||
echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
|
||||
else
|
||||
$SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
|
||||
fi~
|
||||
$CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
|
||||
$CC -Fe $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
|
||||
linknames='
|
||||
# The linker will not automatically build a static lib if we build a DLL.
|
||||
# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
|
||||
|
|
@ -5837,7 +5885,7 @@ _LT_EOF
|
|||
*nto* | *qnx*)
|
||||
;;
|
||||
|
||||
openbsd* | bitrig*)
|
||||
openbsd*)
|
||||
if test -f /usr/libexec/ld.so; then
|
||||
_LT_TAGVAR(hardcode_direct, $1)=yes
|
||||
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
|
||||
|
|
@ -5880,7 +5928,7 @@ _LT_EOF
|
|||
cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
|
||||
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
|
||||
emximp -o $lib $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
|
||||
_LT_TAGVAR(file_list_spec, $1)='@'
|
||||
;;
|
||||
|
|
@ -6174,7 +6222,7 @@ _LT_TAGDECL([], [hardcode_direct], [0],
|
|||
_LT_TAGDECL([], [hardcode_direct_absolute], [0],
|
||||
[Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
|
||||
DIR into the resulting binary and the resulting library dependency is
|
||||
"absolute", i.e impossible to change by setting $shlibpath_var if the
|
||||
"absolute", i.e. impossible to change by setting $shlibpath_var if the
|
||||
library is relocated])
|
||||
_LT_TAGDECL([], [hardcode_minus_L], [0],
|
||||
[Set to "yes" if using the -LDIR flag during linking hardcodes DIR
|
||||
|
|
@ -6232,7 +6280,7 @@ _LT_TAGVAR(objext, $1)=$objext
|
|||
lt_simple_compile_test_code="int some_variable = 0;"
|
||||
|
||||
# Code to be used in simple link tests
|
||||
lt_simple_link_test_code='int main(){return(0);}'
|
||||
lt_simple_link_test_code='int main(void){return(0);}'
|
||||
|
||||
_LT_TAG_COMPILER
|
||||
# Save the default compiler, since it gets overwritten when the other
|
||||
|
|
@ -6421,8 +6469,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
wlarc='$wl'
|
||||
|
||||
# ancient GNU ld didn't support --whole-archive et. al.
|
||||
if eval "`$CC -print-prog-name=ld` --help 2>&1" |
|
||||
$GREP 'no-whole-archive' > /dev/null; then
|
||||
if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
|
||||
_LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
|
||||
else
|
||||
_LT_TAGVAR(whole_archive_flag_spec, $1)=
|
||||
|
|
@ -6442,7 +6489,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
# Commands to make compiler produce verbose output that lists
|
||||
# what "hidden" libraries, object files and flags are used when
|
||||
# linking a shared library.
|
||||
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
|
||||
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"'
|
||||
|
||||
else
|
||||
GXX=no
|
||||
|
|
@ -6651,7 +6698,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
esac
|
||||
;;
|
||||
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin* | mingw* | windows* | pw32* | cegcc*)
|
||||
case $GXX,$cc_basename in
|
||||
,cl* | no,cl* | ,icl* | no,icl*)
|
||||
# Native MSVC or ICC
|
||||
|
|
@ -6750,7 +6797,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
|
||||
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
|
||||
emximp -o $lib $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
|
||||
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
|
||||
_LT_TAGVAR(file_list_spec, $1)='@'
|
||||
;;
|
||||
|
|
@ -6818,7 +6865,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
# explicitly linking system object files so we need to strip them
|
||||
# from the output so that they don't get included in the library
|
||||
# dependencies.
|
||||
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
|
||||
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "[[-]]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
|
||||
;;
|
||||
*)
|
||||
if test yes = "$GXX"; then
|
||||
|
|
@ -6883,7 +6930,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
# explicitly linking system object files so we need to strip them
|
||||
# from the output so that they don't get included in the library
|
||||
# dependencies.
|
||||
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
|
||||
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "[[-]]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
|
||||
;;
|
||||
*)
|
||||
if test yes = "$GXX"; then
|
||||
|
|
@ -7131,7 +7178,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
_LT_TAGVAR(ld_shlibs, $1)=yes
|
||||
;;
|
||||
|
||||
openbsd* | bitrig*)
|
||||
openbsd*)
|
||||
if test -f /usr/libexec/ld.so; then
|
||||
_LT_TAGVAR(hardcode_direct, $1)=yes
|
||||
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
|
||||
|
|
@ -7222,7 +7269,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
# Commands to make compiler produce verbose output that lists
|
||||
# what "hidden" libraries, object files and flags are used when
|
||||
# linking a shared library.
|
||||
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
|
||||
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"'
|
||||
|
||||
else
|
||||
# FIXME: insert proper C++ library support
|
||||
|
|
@ -7306,7 +7353,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
# Commands to make compiler produce verbose output that lists
|
||||
# what "hidden" libraries, object files and flags are used when
|
||||
# linking a shared library.
|
||||
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
|
||||
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"'
|
||||
else
|
||||
# g++ 2.7 appears to require '-G' NOT '-shared' on this
|
||||
# platform.
|
||||
|
|
@ -7317,7 +7364,7 @@ if test yes != "$_lt_caught_CXX_error"; then
|
|||
# Commands to make compiler produce verbose output that lists
|
||||
# what "hidden" libraries, object files and flags are used when
|
||||
# linking a shared library.
|
||||
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
|
||||
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"'
|
||||
fi
|
||||
|
||||
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
|
||||
|
|
@ -7555,10 +7602,11 @@ if AC_TRY_EVAL(ac_compile); then
|
|||
case $prev$p in
|
||||
|
||||
-L* | -R* | -l*)
|
||||
# Some compilers place space between "-{L,R}" and the path.
|
||||
# Some compilers place space between "-{L,R,l}" and the path.
|
||||
# Remove the space.
|
||||
if test x-L = "$p" ||
|
||||
test x-R = "$p"; then
|
||||
if test x-L = x"$p" ||
|
||||
test x-R = x"$p" ||
|
||||
test x-l = x"$p"; then
|
||||
prev=$p
|
||||
continue
|
||||
fi
|
||||
|
|
@ -8216,7 +8264,7 @@ AC_SUBST([DLLTOOL])
|
|||
# ----------------
|
||||
# Check for a file(cmd) program that can be used to detect file type and magic
|
||||
m4_defun([_LT_DECL_FILECMD],
|
||||
[AC_CHECK_TOOL([FILECMD], [file], [:])
|
||||
[AC_CHECK_PROG([FILECMD], [file], [file], [:])
|
||||
_LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types])
|
||||
])# _LD_DECL_FILECMD
|
||||
|
||||
|
|
@ -8232,73 +8280,6 @@ _LT_DECL([], [SED], [1], [A sed program that does not truncate output])
|
|||
_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
|
||||
[Sed that helps us avoid accidentally triggering echo(1) options like -n])
|
||||
])# _LT_DECL_SED
|
||||
|
||||
m4_ifndef([AC_PROG_SED], [
|
||||
############################################################
|
||||
# NOTE: This macro has been submitted for inclusion into #
|
||||
# GNU Autoconf as AC_PROG_SED. When it is available in #
|
||||
# a released version of Autoconf we should remove this #
|
||||
# macro and use it instead. #
|
||||
############################################################
|
||||
|
||||
m4_defun([AC_PROG_SED],
|
||||
[AC_MSG_CHECKING([for a sed that does not truncate output])
|
||||
AC_CACHE_VAL(lt_cv_path_SED,
|
||||
[# Loop through the user's path and test for sed and gsed.
|
||||
# Then use that list of sed's as ones to test for truncation.
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for lt_ac_prog in sed gsed; do
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
|
||||
lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
lt_ac_max=0
|
||||
lt_ac_count=0
|
||||
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
|
||||
# along with /bin/sed that truncates output.
|
||||
for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
|
||||
test ! -f "$lt_ac_sed" && continue
|
||||
cat /dev/null > conftest.in
|
||||
lt_ac_count=0
|
||||
echo $ECHO_N "0123456789$ECHO_C" >conftest.in
|
||||
# Check for GNU sed and select it if it is found.
|
||||
if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
|
||||
lt_cv_path_SED=$lt_ac_sed
|
||||
break
|
||||
fi
|
||||
while true; do
|
||||
cat conftest.in conftest.in >conftest.tmp
|
||||
mv conftest.tmp conftest.in
|
||||
cp conftest.in conftest.nl
|
||||
echo >>conftest.nl
|
||||
$lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
|
||||
cmp -s conftest.out conftest.nl || break
|
||||
# 10000 chars as input seems more than enough
|
||||
test 10 -lt "$lt_ac_count" && break
|
||||
lt_ac_count=`expr $lt_ac_count + 1`
|
||||
if test "$lt_ac_count" -gt "$lt_ac_max"; then
|
||||
lt_ac_max=$lt_ac_count
|
||||
lt_cv_path_SED=$lt_ac_sed
|
||||
fi
|
||||
done
|
||||
done
|
||||
])
|
||||
SED=$lt_cv_path_SED
|
||||
AC_SUBST([SED])
|
||||
AC_MSG_RESULT([$SED])
|
||||
])#AC_PROG_SED
|
||||
])#m4_ifndef
|
||||
|
||||
# Old name:
|
||||
AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([LT_AC_PROG_SED], [])
|
||||
|
||||
|
|
@ -8345,7 +8326,7 @@ AC_CACHE_VAL(lt_cv_to_host_file_cmd,
|
|||
[case $host in
|
||||
*-*-mingw* )
|
||||
case $build in
|
||||
*-*-mingw* ) # actually msys
|
||||
*-*-mingw* | *-*-windows* ) # actually msys
|
||||
lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
|
||||
;;
|
||||
*-*-cygwin* )
|
||||
|
|
@ -8358,7 +8339,7 @@ AC_CACHE_VAL(lt_cv_to_host_file_cmd,
|
|||
;;
|
||||
*-*-cygwin* )
|
||||
case $build in
|
||||
*-*-mingw* ) # actually msys
|
||||
*-*-mingw* | *-*-windows* ) # actually msys
|
||||
lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
|
||||
;;
|
||||
*-*-cygwin* )
|
||||
|
|
@ -8384,9 +8365,9 @@ AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
|
|||
[#assume ordinary cross tools, or native build.
|
||||
lt_cv_to_tool_file_cmd=func_convert_file_noop
|
||||
case $host in
|
||||
*-*-mingw* )
|
||||
*-*-mingw* | *-*-windows* )
|
||||
case $build in
|
||||
*-*-mingw* ) # actually msys
|
||||
*-*-mingw* | *-*-windows* ) # actually msys
|
||||
lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
106
deps/cares/m4/ltoptions.m4
vendored
106
deps/cares/m4/ltoptions.m4
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free
|
||||
# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2024 Free
|
||||
# Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8 ltoptions.m4
|
||||
# serial 10 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
|
@ -128,7 +128,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
|||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
|
|
@ -323,29 +323,39 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
|||
|
||||
# _LT_WITH_AIX_SONAME([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
|
||||
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
|
||||
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
|
||||
# implement the --enable-aix-soname configure option, and support the
|
||||
# `aix-soname=aix' and `aix-soname=both' and `aix-soname=svr4' LT_INIT options.
|
||||
# DEFAULT is either `aix', `both', or `svr4'. If omitted, it defaults to `aix'.
|
||||
m4_define([_LT_WITH_AIX_SONAME],
|
||||
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
|
||||
shared_archive_member_spec=
|
||||
case $host,$enable_shared in
|
||||
power*-*-aix[[5-9]]*,yes)
|
||||
AC_MSG_CHECKING([which variant of shared library versioning to provide])
|
||||
AC_ARG_WITH([aix-soname],
|
||||
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
|
||||
AC_ARG_ENABLE([aix-soname],
|
||||
[AS_HELP_STRING([--enable-aix-soname=aix|svr4|both],
|
||||
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
|
||||
[case $withval in
|
||||
aix|svr4|both)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
|
||||
;;
|
||||
esac
|
||||
lt_cv_with_aix_soname=$with_aix_soname],
|
||||
[AC_CACHE_VAL([lt_cv_with_aix_soname],
|
||||
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
|
||||
with_aix_soname=$lt_cv_with_aix_soname])
|
||||
[case $enableval in
|
||||
aix|svr4|both)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown argument to --enable-aix-soname])
|
||||
;;
|
||||
esac
|
||||
lt_cv_with_aix_soname=$enable_aix_soname],
|
||||
[_AC_ENABLE_IF([with], [aix-soname],
|
||||
[case $withval in
|
||||
aix|svr4|both)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
|
||||
;;
|
||||
esac
|
||||
lt_cv_with_aix_soname=$with_aix_soname],
|
||||
[AC_CACHE_VAL([lt_cv_with_aix_soname],
|
||||
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)])
|
||||
enable_aix_soname=$lt_cv_with_aix_soname])
|
||||
with_aix_soname=$enable_aix_soname
|
||||
AC_MSG_RESULT([$with_aix_soname])
|
||||
if test aix != "$with_aix_soname"; then
|
||||
# For the AIX way of multilib, we name the shared archive member
|
||||
|
|
@ -376,30 +386,50 @@ LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
|
|||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
|
||||
# implement the --enable-pic flag, and support the 'pic-only' and 'no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
|
||||
[AC_ARG_ENABLE([pic],
|
||||
[AS_HELP_STRING([--enable-pic@<:@=PKGS@:>@],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[lt_p=${PACKAGE-default}
|
||||
case $withval in
|
||||
yes|no) pic_mode=$withval ;;
|
||||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for lt_pkg in $withval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[pic_mode=m4_default([$1], [default])])
|
||||
case $enableval in
|
||||
yes|no) pic_mode=$enableval ;;
|
||||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for lt_pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[dnl Continue to support --with-pic and --without-pic, for backward
|
||||
dnl compatibility.
|
||||
_AC_ENABLE_IF([with], [pic],
|
||||
[lt_p=${PACKAGE-default}
|
||||
case $withval in
|
||||
yes|no) pic_mode=$withval ;;
|
||||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for lt_pkg in $withval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[pic_mode=m4_default([$1], [default])])]
|
||||
)
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
|
|
|||
2
deps/cares/m4/ltsugar.m4
vendored
2
deps/cares/m4/ltsugar.m4
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software
|
||||
# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2024 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
|
|
|
|||
12
deps/cares/m4/ltversion.m4
vendored
12
deps/cares/m4/ltversion.m4
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation,
|
||||
# Copyright (C) 2004, 2011-2019, 2021-2024 Free Software Foundation,
|
||||
# Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
|
|
@ -10,15 +10,15 @@
|
|||
|
||||
# @configure_input@
|
||||
|
||||
# serial 4245 ltversion.m4
|
||||
# serial 4392 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.7])
|
||||
m4_define([LT_PACKAGE_REVISION], [2.4.7])
|
||||
m4_define([LT_PACKAGE_VERSION], [2.5.3])
|
||||
m4_define([LT_PACKAGE_REVISION], [2.5.3])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.7'
|
||||
macro_revision='2.4.7'
|
||||
[macro_version='2.5.3'
|
||||
macro_revision='2.5.3'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
||||
|
|
|
|||
2
deps/cares/m4/lt~obsolete.m4
vendored
2
deps/cares/m4/lt~obsolete.m4
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free
|
||||
# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2024 Free
|
||||
# Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
|
|
|
|||
2
deps/cares/src/lib/CMakeLists.txt
vendored
2
deps/cares/src/lib/CMakeLists.txt
vendored
|
|
@ -53,6 +53,7 @@ IF (CARES_SHARED)
|
|||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
TARGET_COMPILE_DEFINITIONS (${PROJECT_NAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY)
|
||||
|
|
@ -110,6 +111,7 @@ IF (CARES_STATIC)
|
|||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
TARGET_COMPILE_DEFINITIONS (${LIBNAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY)
|
||||
|
|
|
|||
3
deps/cares/src/lib/Makefile.am
vendored
3
deps/cares/src/lib/Makefile.am
vendored
|
|
@ -11,7 +11,8 @@ ACLOCAL_AMFLAGS = -I m4 --install
|
|||
AM_CPPFLAGS += -I$(top_builddir)/include \
|
||||
-I$(top_builddir)/src/lib \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src/lib
|
||||
-I$(top_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/lib/include
|
||||
|
||||
lib_LTLIBRARIES = libcares.la
|
||||
|
||||
|
|
|
|||
604
deps/cares/src/lib/Makefile.in
vendored
604
deps/cares/src/lib/Makefile.in
vendored
|
|
@ -15,7 +15,7 @@
|
|||
@SET_MAKE@
|
||||
|
||||
# aminclude_static.am generated automatically by Autoconf
|
||||
# from AX_AM_MACROS_STATIC on Fri Aug 23 09:37:25 EDT 2024
|
||||
# from AX_AM_MACROS_STATIC on Wed Oct 9 20:58:25 EDT 2024
|
||||
|
||||
# Copyright (C) The c-ares project and its contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
|
@ -162,13 +162,10 @@ am__installdirs = "$(DESTDIR)$(libdir)"
|
|||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libcares_la_LIBADD =
|
||||
am__dirstamp = $(am__leading_dot)dirstamp
|
||||
am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \
|
||||
libcares_la-ares__addrinfo_localhost.lo \
|
||||
libcares_la-ares__close_sockets.lo \
|
||||
libcares_la-ares__hosts_file.lo \
|
||||
libcares_la-ares__parse_into_addrinfo.lo \
|
||||
libcares_la-ares__socket.lo libcares_la-ares__sortaddrinfo.lo \
|
||||
am__objects_1 = libcares_la-ares_addrinfo2hostent.lo \
|
||||
libcares_la-ares_addrinfo_localhost.lo \
|
||||
libcares_la-ares_android.lo libcares_la-ares_cancel.lo \
|
||||
libcares_la-ares_close_sockets.lo libcares_la-ares_conn.lo \
|
||||
libcares_la-ares_cookie.lo libcares_la-ares_data.lo \
|
||||
libcares_la-ares_destroy.lo libcares_la-ares_free_hostent.lo \
|
||||
libcares_la-ares_free_string.lo \
|
||||
|
|
@ -176,25 +173,30 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \
|
|||
libcares_la-ares_getaddrinfo.lo libcares_la-ares_getenv.lo \
|
||||
libcares_la-ares_gethostbyaddr.lo \
|
||||
libcares_la-ares_gethostbyname.lo \
|
||||
libcares_la-ares_getnameinfo.lo libcares_la-ares_init.lo \
|
||||
libcares_la-ares_library_init.lo libcares_la-ares_metrics.lo \
|
||||
libcares_la-ares_options.lo libcares_la-ares_platform.lo \
|
||||
libcares_la-ares_getnameinfo.lo libcares_la-ares_hosts_file.lo \
|
||||
libcares_la-ares_init.lo libcares_la-ares_library_init.lo \
|
||||
libcares_la-ares_metrics.lo libcares_la-ares_options.lo \
|
||||
libcares_la-ares_parse_into_addrinfo.lo \
|
||||
libcares_la-ares_process.lo libcares_la-ares_qcache.lo \
|
||||
libcares_la-ares_query.lo libcares_la-ares_search.lo \
|
||||
libcares_la-ares_send.lo libcares_la-ares_strerror.lo \
|
||||
libcares_la-ares_sysconfig.lo \
|
||||
libcares_la-ares_send.lo \
|
||||
libcares_la-ares_set_socket_functions.lo \
|
||||
libcares_la-ares_socket.lo libcares_la-ares_sortaddrinfo.lo \
|
||||
libcares_la-ares_strerror.lo libcares_la-ares_sysconfig.lo \
|
||||
libcares_la-ares_sysconfig_files.lo \
|
||||
libcares_la-ares_sysconfig_mac.lo \
|
||||
libcares_la-ares_sysconfig_win.lo libcares_la-ares_timeout.lo \
|
||||
libcares_la-ares_update_servers.lo libcares_la-ares_version.lo \
|
||||
libcares_la-inet_net_pton.lo libcares_la-inet_ntop.lo \
|
||||
libcares_la-windows_port.lo dsa/libcares_la-ares__array.lo \
|
||||
dsa/libcares_la-ares__htable.lo \
|
||||
dsa/libcares_la-ares__htable_asvp.lo \
|
||||
dsa/libcares_la-ares__htable_strvp.lo \
|
||||
dsa/libcares_la-ares__htable_szvp.lo \
|
||||
dsa/libcares_la-ares__htable_vpvp.lo \
|
||||
dsa/libcares_la-ares__llist.lo dsa/libcares_la-ares__slist.lo \
|
||||
libcares_la-windows_port.lo dsa/libcares_la-ares_array.lo \
|
||||
dsa/libcares_la-ares_htable.lo \
|
||||
dsa/libcares_la-ares_htable_asvp.lo \
|
||||
dsa/libcares_la-ares_htable_dict.lo \
|
||||
dsa/libcares_la-ares_htable_strvp.lo \
|
||||
dsa/libcares_la-ares_htable_szvp.lo \
|
||||
dsa/libcares_la-ares_htable_vpstr.lo \
|
||||
dsa/libcares_la-ares_htable_vpvp.lo \
|
||||
dsa/libcares_la-ares_llist.lo dsa/libcares_la-ares_slist.lo \
|
||||
event/libcares_la-ares_event_configchg.lo \
|
||||
event/libcares_la-ares_event_epoll.lo \
|
||||
event/libcares_la-ares_event_kqueue.lo \
|
||||
|
|
@ -225,13 +227,12 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \
|
|||
record/libcares_la-ares_dns_parse.lo \
|
||||
record/libcares_la-ares_dns_record.lo \
|
||||
record/libcares_la-ares_dns_write.lo \
|
||||
str/libcares_la-ares__buf.lo \
|
||||
str/libcares_la-ares_strcasecmp.lo str/libcares_la-ares_str.lo \
|
||||
str/libcares_la-ares_buf.lo str/libcares_la-ares_str.lo \
|
||||
str/libcares_la-ares_strsplit.lo \
|
||||
util/libcares_la-ares__iface_ips.lo \
|
||||
util/libcares_la-ares__threads.lo \
|
||||
util/libcares_la-ares__timeval.lo \
|
||||
util/libcares_la-ares_math.lo util/libcares_la-ares_rand.lo
|
||||
util/libcares_la-ares_iface_ips.lo \
|
||||
util/libcares_la-ares_threads.lo \
|
||||
util/libcares_la-ares_timeval.lo util/libcares_la-ares_math.lo \
|
||||
util/libcares_la-ares_rand.lo util/libcares_la-ares_uri.lo
|
||||
am__objects_2 =
|
||||
am_libcares_la_OBJECTS = $(am__objects_1) $(am__objects_2)
|
||||
libcares_la_OBJECTS = $(am_libcares_la_OBJECTS)
|
||||
|
|
@ -258,15 +259,12 @@ DEFAULT_INCLUDES =
|
|||
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
|
||||
am__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = \
|
||||
./$(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares__close_sockets.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares__hosts_file.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares__socket.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_addrinfo2hostent.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_addrinfo_localhost.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_android.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_cancel.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_close_sockets.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_conn.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_cookie.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_data.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_destroy.Plo \
|
||||
|
|
@ -278,16 +276,20 @@ am__depfiles_remade = \
|
|||
./$(DEPDIR)/libcares_la-ares_gethostbyaddr.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_gethostbyname.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_getnameinfo.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_hosts_file.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_init.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_library_init.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_metrics.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_options.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_platform.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_parse_into_addrinfo.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_process.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_qcache.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_query.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_search.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_send.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_set_socket_functions.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_socket.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_sortaddrinfo.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_strerror.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_sysconfig.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_sysconfig_files.Plo \
|
||||
|
|
@ -299,14 +301,16 @@ am__depfiles_remade = \
|
|||
./$(DEPDIR)/libcares_la-inet_net_pton.Plo \
|
||||
./$(DEPDIR)/libcares_la-inet_ntop.Plo \
|
||||
./$(DEPDIR)/libcares_la-windows_port.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares__array.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares__htable.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares__htable_asvp.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares__htable_strvp.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares__htable_szvp.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares__htable_vpvp.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares__llist.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares__slist.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_array.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_htable.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_htable_asvp.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_htable_dict.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_htable_strvp.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_htable_szvp.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_htable_vpstr.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_htable_vpvp.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_llist.Plo \
|
||||
dsa/$(DEPDIR)/libcares_la-ares_slist.Plo \
|
||||
event/$(DEPDIR)/libcares_la-ares_event_configchg.Plo \
|
||||
event/$(DEPDIR)/libcares_la-ares_event_epoll.Plo \
|
||||
event/$(DEPDIR)/libcares_la-ares_event_kqueue.Plo \
|
||||
|
|
@ -337,15 +341,15 @@ am__depfiles_remade = \
|
|||
record/$(DEPDIR)/libcares_la-ares_dns_parse.Plo \
|
||||
record/$(DEPDIR)/libcares_la-ares_dns_record.Plo \
|
||||
record/$(DEPDIR)/libcares_la-ares_dns_write.Plo \
|
||||
str/$(DEPDIR)/libcares_la-ares__buf.Plo \
|
||||
str/$(DEPDIR)/libcares_la-ares_buf.Plo \
|
||||
str/$(DEPDIR)/libcares_la-ares_str.Plo \
|
||||
str/$(DEPDIR)/libcares_la-ares_strcasecmp.Plo \
|
||||
str/$(DEPDIR)/libcares_la-ares_strsplit.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares__iface_ips.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares__threads.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares__timeval.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares_iface_ips.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares_math.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares_rand.Plo
|
||||
util/$(DEPDIR)/libcares_la-ares_rand.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares_threads.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares_timeval.Plo \
|
||||
util/$(DEPDIR)/libcares_la-ares_uri.Plo
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
|
|
@ -445,7 +449,7 @@ AM_CFLAGS = @AM_CFLAGS@
|
|||
# might possibly already be installed in the system.
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_builddir)/include \
|
||||
-I$(top_builddir)/src/lib -I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src/lib
|
||||
-I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib/include
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
|
|
@ -643,15 +647,12 @@ libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY $(am__append_3) \
|
|||
libcares_la_LIBS = $(CODE_COVERAGE_LIBS)
|
||||
libcares_la_CFLAGS = $(AM_CFLAGS) $(libcares_la_CFLAGS_EXTRA)
|
||||
libcares_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcares_la_CPPFLAGS_EXTRA)
|
||||
CSOURCES = ares__addrinfo2hostent.c \
|
||||
ares__addrinfo_localhost.c \
|
||||
ares__close_sockets.c \
|
||||
ares__hosts_file.c \
|
||||
ares__parse_into_addrinfo.c \
|
||||
ares__socket.c \
|
||||
ares__sortaddrinfo.c \
|
||||
CSOURCES = ares_addrinfo2hostent.c \
|
||||
ares_addrinfo_localhost.c \
|
||||
ares_android.c \
|
||||
ares_cancel.c \
|
||||
ares_close_sockets.c \
|
||||
ares_conn.c \
|
||||
ares_cookie.c \
|
||||
ares_data.c \
|
||||
ares_destroy.c \
|
||||
|
|
@ -663,16 +664,20 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_gethostbyaddr.c \
|
||||
ares_gethostbyname.c \
|
||||
ares_getnameinfo.c \
|
||||
ares_hosts_file.c \
|
||||
ares_init.c \
|
||||
ares_library_init.c \
|
||||
ares_metrics.c \
|
||||
ares_options.c \
|
||||
ares_platform.c \
|
||||
ares_parse_into_addrinfo.c \
|
||||
ares_process.c \
|
||||
ares_qcache.c \
|
||||
ares_query.c \
|
||||
ares_search.c \
|
||||
ares_send.c \
|
||||
ares_set_socket_functions.c \
|
||||
ares_socket.c \
|
||||
ares_sortaddrinfo.c \
|
||||
ares_strerror.c \
|
||||
ares_sysconfig.c \
|
||||
ares_sysconfig_files.c \
|
||||
|
|
@ -684,14 +689,16 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
inet_net_pton.c \
|
||||
inet_ntop.c \
|
||||
windows_port.c \
|
||||
dsa/ares__array.c \
|
||||
dsa/ares__htable.c \
|
||||
dsa/ares__htable_asvp.c \
|
||||
dsa/ares__htable_strvp.c \
|
||||
dsa/ares__htable_szvp.c \
|
||||
dsa/ares__htable_vpvp.c \
|
||||
dsa/ares__llist.c \
|
||||
dsa/ares__slist.c \
|
||||
dsa/ares_array.c \
|
||||
dsa/ares_htable.c \
|
||||
dsa/ares_htable_asvp.c \
|
||||
dsa/ares_htable_dict.c \
|
||||
dsa/ares_htable_strvp.c \
|
||||
dsa/ares_htable_szvp.c \
|
||||
dsa/ares_htable_vpstr.c \
|
||||
dsa/ares_htable_vpvp.c \
|
||||
dsa/ares_llist.c \
|
||||
dsa/ares_slist.c \
|
||||
event/ares_event_configchg.c \
|
||||
event/ares_event_epoll.c \
|
||||
event/ares_event_kqueue.c \
|
||||
|
|
@ -722,42 +729,49 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
record/ares_dns_parse.c \
|
||||
record/ares_dns_record.c \
|
||||
record/ares_dns_write.c \
|
||||
str/ares__buf.c \
|
||||
str/ares_strcasecmp.c \
|
||||
str/ares_buf.c \
|
||||
str/ares_str.c \
|
||||
str/ares_strsplit.c \
|
||||
util/ares__iface_ips.c \
|
||||
util/ares__threads.c \
|
||||
util/ares__timeval.c \
|
||||
util/ares_iface_ips.c \
|
||||
util/ares_threads.c \
|
||||
util/ares_timeval.c \
|
||||
util/ares_math.c \
|
||||
util/ares_rand.c
|
||||
util/ares_rand.c \
|
||||
util/ares_uri.c
|
||||
|
||||
HHEADERS = ares_android.h \
|
||||
ares_conn.h \
|
||||
ares_data.h \
|
||||
ares_getenv.h \
|
||||
ares_inet_net_pton.h \
|
||||
ares_ipv6.h \
|
||||
ares_platform.h \
|
||||
ares_private.h \
|
||||
ares_setup.h \
|
||||
dsa/ares__array.h \
|
||||
dsa/ares__htable.h \
|
||||
dsa/ares__htable_asvp.h \
|
||||
dsa/ares__htable_strvp.h \
|
||||
dsa/ares__htable_szvp.h \
|
||||
dsa/ares__htable_vpvp.h \
|
||||
dsa/ares__llist.h \
|
||||
dsa/ares__slist.h \
|
||||
ares_socket.h \
|
||||
dsa/ares_htable.h \
|
||||
dsa/ares_slist.h \
|
||||
event/ares_event.h \
|
||||
event/ares_event_win32.h \
|
||||
include/ares_array.h \
|
||||
include/ares_buf.h \
|
||||
include/ares_htable_asvp.h \
|
||||
include/ares_htable_dict.h \
|
||||
include/ares_htable_strvp.h \
|
||||
include/ares_htable_szvp.h \
|
||||
include/ares_htable_vpstr.h \
|
||||
include/ares_htable_vpvp.h \
|
||||
include/ares_llist.h \
|
||||
include/ares_mem.h \
|
||||
include/ares_str.h \
|
||||
record/ares_dns_multistring.h \
|
||||
record/ares_dns_private.h \
|
||||
str/ares__buf.h \
|
||||
str/ares_strcasecmp.h \
|
||||
str/ares_str.h \
|
||||
str/ares_strsplit.h \
|
||||
util/ares__iface_ips.h \
|
||||
util/ares__threads.h \
|
||||
util/ares_iface_ips.h \
|
||||
util/ares_math.h \
|
||||
util/ares_rand.h \
|
||||
util/ares_time.h \
|
||||
util/ares_threads.h \
|
||||
util/ares_uri.h \
|
||||
thirdparty/apple/dnsinfo.h
|
||||
|
||||
|
||||
|
|
@ -852,21 +866,25 @@ dsa/$(am__dirstamp):
|
|||
dsa/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) dsa/$(DEPDIR)
|
||||
@: >>dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares__array.lo: dsa/$(am__dirstamp) \
|
||||
dsa/libcares_la-ares_array.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares__htable.lo: dsa/$(am__dirstamp) \
|
||||
dsa/libcares_la-ares_htable.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares__htable_asvp.lo: dsa/$(am__dirstamp) \
|
||||
dsa/libcares_la-ares_htable_asvp.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares__htable_strvp.lo: dsa/$(am__dirstamp) \
|
||||
dsa/libcares_la-ares_htable_dict.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares__htable_szvp.lo: dsa/$(am__dirstamp) \
|
||||
dsa/libcares_la-ares_htable_strvp.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares__htable_vpvp.lo: dsa/$(am__dirstamp) \
|
||||
dsa/libcares_la-ares_htable_szvp.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares__llist.lo: dsa/$(am__dirstamp) \
|
||||
dsa/libcares_la-ares_htable_vpstr.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares__slist.lo: dsa/$(am__dirstamp) \
|
||||
dsa/libcares_la-ares_htable_vpvp.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares_llist.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
dsa/libcares_la-ares_slist.lo: dsa/$(am__dirstamp) \
|
||||
dsa/$(DEPDIR)/$(am__dirstamp)
|
||||
event/$(am__dirstamp):
|
||||
@$(MKDIR_P) event
|
||||
|
|
@ -952,9 +970,7 @@ str/$(am__dirstamp):
|
|||
str/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) str/$(DEPDIR)
|
||||
@: >>str/$(DEPDIR)/$(am__dirstamp)
|
||||
str/libcares_la-ares__buf.lo: str/$(am__dirstamp) \
|
||||
str/$(DEPDIR)/$(am__dirstamp)
|
||||
str/libcares_la-ares_strcasecmp.lo: str/$(am__dirstamp) \
|
||||
str/libcares_la-ares_buf.lo: str/$(am__dirstamp) \
|
||||
str/$(DEPDIR)/$(am__dirstamp)
|
||||
str/libcares_la-ares_str.lo: str/$(am__dirstamp) \
|
||||
str/$(DEPDIR)/$(am__dirstamp)
|
||||
|
|
@ -966,16 +982,18 @@ util/$(am__dirstamp):
|
|||
util/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) util/$(DEPDIR)
|
||||
@: >>util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/libcares_la-ares__iface_ips.lo: util/$(am__dirstamp) \
|
||||
util/libcares_la-ares_iface_ips.lo: util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/libcares_la-ares__threads.lo: util/$(am__dirstamp) \
|
||||
util/libcares_la-ares_threads.lo: util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/libcares_la-ares__timeval.lo: util/$(am__dirstamp) \
|
||||
util/libcares_la-ares_timeval.lo: util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/libcares_la-ares_math.lo: util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/libcares_la-ares_rand.lo: util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/libcares_la-ares_uri.lo: util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
libcares.la: $(libcares_la_OBJECTS) $(libcares_la_DEPENDENCIES) $(EXTRA_libcares_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libcares_la_LINK) -rpath $(libdir) $(libcares_la_OBJECTS) $(libcares_la_LIBADD) $(LIBS)
|
||||
|
|
@ -998,15 +1016,12 @@ mostlyclean-compile:
|
|||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__close_sockets.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__hosts_file.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__socket.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_addrinfo2hostent.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_addrinfo_localhost.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_android.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_cancel.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_close_sockets.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_conn.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_cookie.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_data.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_destroy.Plo@am__quote@ # am--include-marker
|
||||
|
|
@ -1018,16 +1033,20 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_gethostbyaddr.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_gethostbyname.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_getnameinfo.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_hosts_file.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_init.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_library_init.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_metrics.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_options.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_platform.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_parse_into_addrinfo.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_process.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_qcache.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_query.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_search.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_send.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_set_socket_functions.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_socket.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_sortaddrinfo.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_strerror.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_sysconfig.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_sysconfig_files.Plo@am__quote@ # am--include-marker
|
||||
|
|
@ -1039,14 +1058,16 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-inet_net_pton.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-inet_ntop.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-windows_port.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares__array.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares__htable.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares__htable_asvp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares__htable_strvp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares__htable_szvp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares__htable_vpvp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares__llist.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares__slist.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_array.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_htable.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_htable_asvp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_htable_dict.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_htable_strvp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_htable_szvp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_htable_vpstr.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_htable_vpvp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_llist.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@dsa/$(DEPDIR)/libcares_la-ares_slist.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@event/$(DEPDIR)/libcares_la-ares_event_configchg.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@event/$(DEPDIR)/libcares_la-ares_event_epoll.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@event/$(DEPDIR)/libcares_la-ares_event_kqueue.Plo@am__quote@ # am--include-marker
|
||||
|
|
@ -1077,15 +1098,15 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@record/$(DEPDIR)/libcares_la-ares_dns_parse.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@record/$(DEPDIR)/libcares_la-ares_dns_record.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@record/$(DEPDIR)/libcares_la-ares_dns_write.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@str/$(DEPDIR)/libcares_la-ares__buf.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@str/$(DEPDIR)/libcares_la-ares_buf.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@str/$(DEPDIR)/libcares_la-ares_str.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@str/$(DEPDIR)/libcares_la-ares_strcasecmp.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@str/$(DEPDIR)/libcares_la-ares_strsplit.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares__iface_ips.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares__threads.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares__timeval.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares_iface_ips.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares_math.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares_rand.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares_threads.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares_timeval.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/libcares_la-ares_uri.Plo@am__quote@ # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
|
|
@ -1117,54 +1138,19 @@ am--depfiles: $(am__depfiles_remade)
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
libcares_la-ares__addrinfo2hostent.lo: ares__addrinfo2hostent.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__addrinfo2hostent.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__addrinfo2hostent.Tpo -c -o libcares_la-ares__addrinfo2hostent.lo `test -f 'ares__addrinfo2hostent.c' || echo '$(srcdir)/'`ares__addrinfo2hostent.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__addrinfo2hostent.Tpo $(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__addrinfo2hostent.c' object='libcares_la-ares__addrinfo2hostent.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
libcares_la-ares_addrinfo2hostent.lo: ares_addrinfo2hostent.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_addrinfo2hostent.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_addrinfo2hostent.Tpo -c -o libcares_la-ares_addrinfo2hostent.lo `test -f 'ares_addrinfo2hostent.c' || echo '$(srcdir)/'`ares_addrinfo2hostent.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_addrinfo2hostent.Tpo $(DEPDIR)/libcares_la-ares_addrinfo2hostent.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_addrinfo2hostent.c' object='libcares_la-ares_addrinfo2hostent.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__addrinfo2hostent.lo `test -f 'ares__addrinfo2hostent.c' || echo '$(srcdir)/'`ares__addrinfo2hostent.c
|
||||
@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_addrinfo2hostent.lo `test -f 'ares_addrinfo2hostent.c' || echo '$(srcdir)/'`ares_addrinfo2hostent.c
|
||||
|
||||
libcares_la-ares__addrinfo_localhost.lo: ares__addrinfo_localhost.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__addrinfo_localhost.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__addrinfo_localhost.Tpo -c -o libcares_la-ares__addrinfo_localhost.lo `test -f 'ares__addrinfo_localhost.c' || echo '$(srcdir)/'`ares__addrinfo_localhost.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__addrinfo_localhost.Tpo $(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__addrinfo_localhost.c' object='libcares_la-ares__addrinfo_localhost.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
libcares_la-ares_addrinfo_localhost.lo: ares_addrinfo_localhost.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_addrinfo_localhost.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_addrinfo_localhost.Tpo -c -o libcares_la-ares_addrinfo_localhost.lo `test -f 'ares_addrinfo_localhost.c' || echo '$(srcdir)/'`ares_addrinfo_localhost.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_addrinfo_localhost.Tpo $(DEPDIR)/libcares_la-ares_addrinfo_localhost.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_addrinfo_localhost.c' object='libcares_la-ares_addrinfo_localhost.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__addrinfo_localhost.lo `test -f 'ares__addrinfo_localhost.c' || echo '$(srcdir)/'`ares__addrinfo_localhost.c
|
||||
|
||||
libcares_la-ares__close_sockets.lo: ares__close_sockets.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__close_sockets.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__close_sockets.Tpo -c -o libcares_la-ares__close_sockets.lo `test -f 'ares__close_sockets.c' || echo '$(srcdir)/'`ares__close_sockets.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__close_sockets.Tpo $(DEPDIR)/libcares_la-ares__close_sockets.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__close_sockets.c' object='libcares_la-ares__close_sockets.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__close_sockets.lo `test -f 'ares__close_sockets.c' || echo '$(srcdir)/'`ares__close_sockets.c
|
||||
|
||||
libcares_la-ares__hosts_file.lo: ares__hosts_file.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__hosts_file.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__hosts_file.Tpo -c -o libcares_la-ares__hosts_file.lo `test -f 'ares__hosts_file.c' || echo '$(srcdir)/'`ares__hosts_file.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__hosts_file.Tpo $(DEPDIR)/libcares_la-ares__hosts_file.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__hosts_file.c' object='libcares_la-ares__hosts_file.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__hosts_file.lo `test -f 'ares__hosts_file.c' || echo '$(srcdir)/'`ares__hosts_file.c
|
||||
|
||||
libcares_la-ares__parse_into_addrinfo.lo: ares__parse_into_addrinfo.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__parse_into_addrinfo.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Tpo -c -o libcares_la-ares__parse_into_addrinfo.lo `test -f 'ares__parse_into_addrinfo.c' || echo '$(srcdir)/'`ares__parse_into_addrinfo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Tpo $(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__parse_into_addrinfo.c' object='libcares_la-ares__parse_into_addrinfo.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__parse_into_addrinfo.lo `test -f 'ares__parse_into_addrinfo.c' || echo '$(srcdir)/'`ares__parse_into_addrinfo.c
|
||||
|
||||
libcares_la-ares__socket.lo: ares__socket.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__socket.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__socket.Tpo -c -o libcares_la-ares__socket.lo `test -f 'ares__socket.c' || echo '$(srcdir)/'`ares__socket.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__socket.Tpo $(DEPDIR)/libcares_la-ares__socket.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__socket.c' object='libcares_la-ares__socket.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__socket.lo `test -f 'ares__socket.c' || echo '$(srcdir)/'`ares__socket.c
|
||||
|
||||
libcares_la-ares__sortaddrinfo.lo: ares__sortaddrinfo.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__sortaddrinfo.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__sortaddrinfo.Tpo -c -o libcares_la-ares__sortaddrinfo.lo `test -f 'ares__sortaddrinfo.c' || echo '$(srcdir)/'`ares__sortaddrinfo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__sortaddrinfo.Tpo $(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__sortaddrinfo.c' object='libcares_la-ares__sortaddrinfo.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__sortaddrinfo.lo `test -f 'ares__sortaddrinfo.c' || echo '$(srcdir)/'`ares__sortaddrinfo.c
|
||||
@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_addrinfo_localhost.lo `test -f 'ares_addrinfo_localhost.c' || echo '$(srcdir)/'`ares_addrinfo_localhost.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
|
||||
|
|
@ -1180,6 +1166,20 @@ libcares_la-ares_cancel.lo: ares_cancel.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_cancel.lo `test -f 'ares_cancel.c' || echo '$(srcdir)/'`ares_cancel.c
|
||||
|
||||
libcares_la-ares_close_sockets.lo: ares_close_sockets.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_close_sockets.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_close_sockets.Tpo -c -o libcares_la-ares_close_sockets.lo `test -f 'ares_close_sockets.c' || echo '$(srcdir)/'`ares_close_sockets.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_close_sockets.Tpo $(DEPDIR)/libcares_la-ares_close_sockets.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_close_sockets.c' object='libcares_la-ares_close_sockets.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_close_sockets.lo `test -f 'ares_close_sockets.c' || echo '$(srcdir)/'`ares_close_sockets.c
|
||||
|
||||
libcares_la-ares_conn.lo: ares_conn.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_conn.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_conn.Tpo -c -o libcares_la-ares_conn.lo `test -f 'ares_conn.c' || echo '$(srcdir)/'`ares_conn.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_conn.Tpo $(DEPDIR)/libcares_la-ares_conn.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_conn.c' object='libcares_la-ares_conn.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_conn.lo `test -f 'ares_conn.c' || echo '$(srcdir)/'`ares_conn.c
|
||||
|
||||
libcares_la-ares_cookie.lo: ares_cookie.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_cookie.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_cookie.Tpo -c -o libcares_la-ares_cookie.lo `test -f 'ares_cookie.c' || echo '$(srcdir)/'`ares_cookie.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_cookie.Tpo $(DEPDIR)/libcares_la-ares_cookie.Plo
|
||||
|
|
@ -1257,6 +1257,13 @@ libcares_la-ares_getnameinfo.lo: ares_getnameinfo.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_getnameinfo.lo `test -f 'ares_getnameinfo.c' || echo '$(srcdir)/'`ares_getnameinfo.c
|
||||
|
||||
libcares_la-ares_hosts_file.lo: ares_hosts_file.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_hosts_file.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_hosts_file.Tpo -c -o libcares_la-ares_hosts_file.lo `test -f 'ares_hosts_file.c' || echo '$(srcdir)/'`ares_hosts_file.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_hosts_file.Tpo $(DEPDIR)/libcares_la-ares_hosts_file.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_hosts_file.c' object='libcares_la-ares_hosts_file.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_hosts_file.lo `test -f 'ares_hosts_file.c' || echo '$(srcdir)/'`ares_hosts_file.c
|
||||
|
||||
libcares_la-ares_init.lo: ares_init.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_init.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_init.Tpo -c -o libcares_la-ares_init.lo `test -f 'ares_init.c' || echo '$(srcdir)/'`ares_init.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_init.Tpo $(DEPDIR)/libcares_la-ares_init.Plo
|
||||
|
|
@ -1285,12 +1292,12 @@ libcares_la-ares_options.lo: ares_options.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_options.lo `test -f 'ares_options.c' || echo '$(srcdir)/'`ares_options.c
|
||||
|
||||
libcares_la-ares_platform.lo: ares_platform.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_platform.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_platform.Tpo -c -o libcares_la-ares_platform.lo `test -f 'ares_platform.c' || echo '$(srcdir)/'`ares_platform.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_platform.Tpo $(DEPDIR)/libcares_la-ares_platform.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_platform.c' object='libcares_la-ares_platform.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
libcares_la-ares_parse_into_addrinfo.lo: ares_parse_into_addrinfo.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_parse_into_addrinfo.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_parse_into_addrinfo.Tpo -c -o libcares_la-ares_parse_into_addrinfo.lo `test -f 'ares_parse_into_addrinfo.c' || echo '$(srcdir)/'`ares_parse_into_addrinfo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_parse_into_addrinfo.Tpo $(DEPDIR)/libcares_la-ares_parse_into_addrinfo.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_parse_into_addrinfo.c' object='libcares_la-ares_parse_into_addrinfo.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_platform.lo `test -f 'ares_platform.c' || echo '$(srcdir)/'`ares_platform.c
|
||||
@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_parse_into_addrinfo.lo `test -f 'ares_parse_into_addrinfo.c' || echo '$(srcdir)/'`ares_parse_into_addrinfo.c
|
||||
|
||||
libcares_la-ares_process.lo: ares_process.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_process.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_process.Tpo -c -o libcares_la-ares_process.lo `test -f 'ares_process.c' || echo '$(srcdir)/'`ares_process.c
|
||||
|
|
@ -1327,6 +1334,27 @@ libcares_la-ares_send.lo: ares_send.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_send.lo `test -f 'ares_send.c' || echo '$(srcdir)/'`ares_send.c
|
||||
|
||||
libcares_la-ares_set_socket_functions.lo: ares_set_socket_functions.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_set_socket_functions.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_set_socket_functions.Tpo -c -o libcares_la-ares_set_socket_functions.lo `test -f 'ares_set_socket_functions.c' || echo '$(srcdir)/'`ares_set_socket_functions.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_set_socket_functions.Tpo $(DEPDIR)/libcares_la-ares_set_socket_functions.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_set_socket_functions.c' object='libcares_la-ares_set_socket_functions.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_set_socket_functions.lo `test -f 'ares_set_socket_functions.c' || echo '$(srcdir)/'`ares_set_socket_functions.c
|
||||
|
||||
libcares_la-ares_socket.lo: ares_socket.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_socket.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_socket.Tpo -c -o libcares_la-ares_socket.lo `test -f 'ares_socket.c' || echo '$(srcdir)/'`ares_socket.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_socket.Tpo $(DEPDIR)/libcares_la-ares_socket.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_socket.c' object='libcares_la-ares_socket.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_socket.lo `test -f 'ares_socket.c' || echo '$(srcdir)/'`ares_socket.c
|
||||
|
||||
libcares_la-ares_sortaddrinfo.lo: ares_sortaddrinfo.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_sortaddrinfo.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_sortaddrinfo.Tpo -c -o libcares_la-ares_sortaddrinfo.lo `test -f 'ares_sortaddrinfo.c' || echo '$(srcdir)/'`ares_sortaddrinfo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_sortaddrinfo.Tpo $(DEPDIR)/libcares_la-ares_sortaddrinfo.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_sortaddrinfo.c' object='libcares_la-ares_sortaddrinfo.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_sortaddrinfo.lo `test -f 'ares_sortaddrinfo.c' || echo '$(srcdir)/'`ares_sortaddrinfo.c
|
||||
|
||||
libcares_la-ares_strerror.lo: ares_strerror.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_strerror.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_strerror.Tpo -c -o libcares_la-ares_strerror.lo `test -f 'ares_strerror.c' || echo '$(srcdir)/'`ares_strerror.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_strerror.Tpo $(DEPDIR)/libcares_la-ares_strerror.Plo
|
||||
|
|
@ -1404,61 +1432,75 @@ libcares_la-windows_port.lo: windows_port.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-windows_port.lo `test -f 'windows_port.c' || echo '$(srcdir)/'`windows_port.c
|
||||
|
||||
dsa/libcares_la-ares__array.lo: dsa/ares__array.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 dsa/libcares_la-ares__array.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares__array.Tpo -c -o dsa/libcares_la-ares__array.lo `test -f 'dsa/ares__array.c' || echo '$(srcdir)/'`dsa/ares__array.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares__array.Tpo dsa/$(DEPDIR)/libcares_la-ares__array.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares__array.c' object='dsa/libcares_la-ares__array.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
dsa/libcares_la-ares_array.lo: dsa/ares_array.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 dsa/libcares_la-ares_array.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_array.Tpo -c -o dsa/libcares_la-ares_array.lo `test -f 'dsa/ares_array.c' || echo '$(srcdir)/'`dsa/ares_array.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_array.Tpo dsa/$(DEPDIR)/libcares_la-ares_array.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_array.c' object='dsa/libcares_la-ares_array.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 dsa/libcares_la-ares__array.lo `test -f 'dsa/ares__array.c' || echo '$(srcdir)/'`dsa/ares__array.c
|
||||
@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 dsa/libcares_la-ares_array.lo `test -f 'dsa/ares_array.c' || echo '$(srcdir)/'`dsa/ares_array.c
|
||||
|
||||
dsa/libcares_la-ares__htable.lo: dsa/ares__htable.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 dsa/libcares_la-ares__htable.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares__htable.Tpo -c -o dsa/libcares_la-ares__htable.lo `test -f 'dsa/ares__htable.c' || echo '$(srcdir)/'`dsa/ares__htable.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares__htable.Tpo dsa/$(DEPDIR)/libcares_la-ares__htable.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares__htable.c' object='dsa/libcares_la-ares__htable.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
dsa/libcares_la-ares_htable.lo: dsa/ares_htable.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 dsa/libcares_la-ares_htable.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_htable.Tpo -c -o dsa/libcares_la-ares_htable.lo `test -f 'dsa/ares_htable.c' || echo '$(srcdir)/'`dsa/ares_htable.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_htable.Tpo dsa/$(DEPDIR)/libcares_la-ares_htable.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_htable.c' object='dsa/libcares_la-ares_htable.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 dsa/libcares_la-ares__htable.lo `test -f 'dsa/ares__htable.c' || echo '$(srcdir)/'`dsa/ares__htable.c
|
||||
@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 dsa/libcares_la-ares_htable.lo `test -f 'dsa/ares_htable.c' || echo '$(srcdir)/'`dsa/ares_htable.c
|
||||
|
||||
dsa/libcares_la-ares__htable_asvp.lo: dsa/ares__htable_asvp.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 dsa/libcares_la-ares__htable_asvp.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares__htable_asvp.Tpo -c -o dsa/libcares_la-ares__htable_asvp.lo `test -f 'dsa/ares__htable_asvp.c' || echo '$(srcdir)/'`dsa/ares__htable_asvp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares__htable_asvp.Tpo dsa/$(DEPDIR)/libcares_la-ares__htable_asvp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares__htable_asvp.c' object='dsa/libcares_la-ares__htable_asvp.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
dsa/libcares_la-ares_htable_asvp.lo: dsa/ares_htable_asvp.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 dsa/libcares_la-ares_htable_asvp.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_htable_asvp.Tpo -c -o dsa/libcares_la-ares_htable_asvp.lo `test -f 'dsa/ares_htable_asvp.c' || echo '$(srcdir)/'`dsa/ares_htable_asvp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_htable_asvp.Tpo dsa/$(DEPDIR)/libcares_la-ares_htable_asvp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_htable_asvp.c' object='dsa/libcares_la-ares_htable_asvp.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 dsa/libcares_la-ares__htable_asvp.lo `test -f 'dsa/ares__htable_asvp.c' || echo '$(srcdir)/'`dsa/ares__htable_asvp.c
|
||||
@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 dsa/libcares_la-ares_htable_asvp.lo `test -f 'dsa/ares_htable_asvp.c' || echo '$(srcdir)/'`dsa/ares_htable_asvp.c
|
||||
|
||||
dsa/libcares_la-ares__htable_strvp.lo: dsa/ares__htable_strvp.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 dsa/libcares_la-ares__htable_strvp.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares__htable_strvp.Tpo -c -o dsa/libcares_la-ares__htable_strvp.lo `test -f 'dsa/ares__htable_strvp.c' || echo '$(srcdir)/'`dsa/ares__htable_strvp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares__htable_strvp.Tpo dsa/$(DEPDIR)/libcares_la-ares__htable_strvp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares__htable_strvp.c' object='dsa/libcares_la-ares__htable_strvp.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
dsa/libcares_la-ares_htable_dict.lo: dsa/ares_htable_dict.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 dsa/libcares_la-ares_htable_dict.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_htable_dict.Tpo -c -o dsa/libcares_la-ares_htable_dict.lo `test -f 'dsa/ares_htable_dict.c' || echo '$(srcdir)/'`dsa/ares_htable_dict.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_htable_dict.Tpo dsa/$(DEPDIR)/libcares_la-ares_htable_dict.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_htable_dict.c' object='dsa/libcares_la-ares_htable_dict.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 dsa/libcares_la-ares__htable_strvp.lo `test -f 'dsa/ares__htable_strvp.c' || echo '$(srcdir)/'`dsa/ares__htable_strvp.c
|
||||
@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 dsa/libcares_la-ares_htable_dict.lo `test -f 'dsa/ares_htable_dict.c' || echo '$(srcdir)/'`dsa/ares_htable_dict.c
|
||||
|
||||
dsa/libcares_la-ares__htable_szvp.lo: dsa/ares__htable_szvp.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 dsa/libcares_la-ares__htable_szvp.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares__htable_szvp.Tpo -c -o dsa/libcares_la-ares__htable_szvp.lo `test -f 'dsa/ares__htable_szvp.c' || echo '$(srcdir)/'`dsa/ares__htable_szvp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares__htable_szvp.Tpo dsa/$(DEPDIR)/libcares_la-ares__htable_szvp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares__htable_szvp.c' object='dsa/libcares_la-ares__htable_szvp.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
dsa/libcares_la-ares_htable_strvp.lo: dsa/ares_htable_strvp.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 dsa/libcares_la-ares_htable_strvp.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_htable_strvp.Tpo -c -o dsa/libcares_la-ares_htable_strvp.lo `test -f 'dsa/ares_htable_strvp.c' || echo '$(srcdir)/'`dsa/ares_htable_strvp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_htable_strvp.Tpo dsa/$(DEPDIR)/libcares_la-ares_htable_strvp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_htable_strvp.c' object='dsa/libcares_la-ares_htable_strvp.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 dsa/libcares_la-ares__htable_szvp.lo `test -f 'dsa/ares__htable_szvp.c' || echo '$(srcdir)/'`dsa/ares__htable_szvp.c
|
||||
@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 dsa/libcares_la-ares_htable_strvp.lo `test -f 'dsa/ares_htable_strvp.c' || echo '$(srcdir)/'`dsa/ares_htable_strvp.c
|
||||
|
||||
dsa/libcares_la-ares__htable_vpvp.lo: dsa/ares__htable_vpvp.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 dsa/libcares_la-ares__htable_vpvp.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares__htable_vpvp.Tpo -c -o dsa/libcares_la-ares__htable_vpvp.lo `test -f 'dsa/ares__htable_vpvp.c' || echo '$(srcdir)/'`dsa/ares__htable_vpvp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares__htable_vpvp.Tpo dsa/$(DEPDIR)/libcares_la-ares__htable_vpvp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares__htable_vpvp.c' object='dsa/libcares_la-ares__htable_vpvp.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
dsa/libcares_la-ares_htable_szvp.lo: dsa/ares_htable_szvp.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 dsa/libcares_la-ares_htable_szvp.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_htable_szvp.Tpo -c -o dsa/libcares_la-ares_htable_szvp.lo `test -f 'dsa/ares_htable_szvp.c' || echo '$(srcdir)/'`dsa/ares_htable_szvp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_htable_szvp.Tpo dsa/$(DEPDIR)/libcares_la-ares_htable_szvp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_htable_szvp.c' object='dsa/libcares_la-ares_htable_szvp.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 dsa/libcares_la-ares__htable_vpvp.lo `test -f 'dsa/ares__htable_vpvp.c' || echo '$(srcdir)/'`dsa/ares__htable_vpvp.c
|
||||
@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 dsa/libcares_la-ares_htable_szvp.lo `test -f 'dsa/ares_htable_szvp.c' || echo '$(srcdir)/'`dsa/ares_htable_szvp.c
|
||||
|
||||
dsa/libcares_la-ares__llist.lo: dsa/ares__llist.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 dsa/libcares_la-ares__llist.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares__llist.Tpo -c -o dsa/libcares_la-ares__llist.lo `test -f 'dsa/ares__llist.c' || echo '$(srcdir)/'`dsa/ares__llist.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares__llist.Tpo dsa/$(DEPDIR)/libcares_la-ares__llist.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares__llist.c' object='dsa/libcares_la-ares__llist.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
dsa/libcares_la-ares_htable_vpstr.lo: dsa/ares_htable_vpstr.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 dsa/libcares_la-ares_htable_vpstr.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_htable_vpstr.Tpo -c -o dsa/libcares_la-ares_htable_vpstr.lo `test -f 'dsa/ares_htable_vpstr.c' || echo '$(srcdir)/'`dsa/ares_htable_vpstr.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_htable_vpstr.Tpo dsa/$(DEPDIR)/libcares_la-ares_htable_vpstr.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_htable_vpstr.c' object='dsa/libcares_la-ares_htable_vpstr.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 dsa/libcares_la-ares__llist.lo `test -f 'dsa/ares__llist.c' || echo '$(srcdir)/'`dsa/ares__llist.c
|
||||
@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 dsa/libcares_la-ares_htable_vpstr.lo `test -f 'dsa/ares_htable_vpstr.c' || echo '$(srcdir)/'`dsa/ares_htable_vpstr.c
|
||||
|
||||
dsa/libcares_la-ares__slist.lo: dsa/ares__slist.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 dsa/libcares_la-ares__slist.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares__slist.Tpo -c -o dsa/libcares_la-ares__slist.lo `test -f 'dsa/ares__slist.c' || echo '$(srcdir)/'`dsa/ares__slist.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares__slist.Tpo dsa/$(DEPDIR)/libcares_la-ares__slist.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares__slist.c' object='dsa/libcares_la-ares__slist.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
dsa/libcares_la-ares_htable_vpvp.lo: dsa/ares_htable_vpvp.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 dsa/libcares_la-ares_htable_vpvp.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_htable_vpvp.Tpo -c -o dsa/libcares_la-ares_htable_vpvp.lo `test -f 'dsa/ares_htable_vpvp.c' || echo '$(srcdir)/'`dsa/ares_htable_vpvp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_htable_vpvp.Tpo dsa/$(DEPDIR)/libcares_la-ares_htable_vpvp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_htable_vpvp.c' object='dsa/libcares_la-ares_htable_vpvp.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 dsa/libcares_la-ares__slist.lo `test -f 'dsa/ares__slist.c' || echo '$(srcdir)/'`dsa/ares__slist.c
|
||||
@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 dsa/libcares_la-ares_htable_vpvp.lo `test -f 'dsa/ares_htable_vpvp.c' || echo '$(srcdir)/'`dsa/ares_htable_vpvp.c
|
||||
|
||||
dsa/libcares_la-ares_llist.lo: dsa/ares_llist.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 dsa/libcares_la-ares_llist.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_llist.Tpo -c -o dsa/libcares_la-ares_llist.lo `test -f 'dsa/ares_llist.c' || echo '$(srcdir)/'`dsa/ares_llist.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_llist.Tpo dsa/$(DEPDIR)/libcares_la-ares_llist.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_llist.c' object='dsa/libcares_la-ares_llist.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 dsa/libcares_la-ares_llist.lo `test -f 'dsa/ares_llist.c' || echo '$(srcdir)/'`dsa/ares_llist.c
|
||||
|
||||
dsa/libcares_la-ares_slist.lo: dsa/ares_slist.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 dsa/libcares_la-ares_slist.lo -MD -MP -MF dsa/$(DEPDIR)/libcares_la-ares_slist.Tpo -c -o dsa/libcares_la-ares_slist.lo `test -f 'dsa/ares_slist.c' || echo '$(srcdir)/'`dsa/ares_slist.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) dsa/$(DEPDIR)/libcares_la-ares_slist.Tpo dsa/$(DEPDIR)/libcares_la-ares_slist.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dsa/ares_slist.c' object='dsa/libcares_la-ares_slist.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 dsa/libcares_la-ares_slist.lo `test -f 'dsa/ares_slist.c' || echo '$(srcdir)/'`dsa/ares_slist.c
|
||||
|
||||
event/libcares_la-ares_event_configchg.lo: event/ares_event_configchg.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 event/libcares_la-ares_event_configchg.lo -MD -MP -MF event/$(DEPDIR)/libcares_la-ares_event_configchg.Tpo -c -o event/libcares_la-ares_event_configchg.lo `test -f 'event/ares_event_configchg.c' || echo '$(srcdir)/'`event/ares_event_configchg.c
|
||||
|
|
@ -1670,19 +1712,12 @@ record/libcares_la-ares_dns_write.lo: record/ares_dns_write.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 record/libcares_la-ares_dns_write.lo `test -f 'record/ares_dns_write.c' || echo '$(srcdir)/'`record/ares_dns_write.c
|
||||
|
||||
str/libcares_la-ares__buf.lo: str/ares__buf.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 str/libcares_la-ares__buf.lo -MD -MP -MF str/$(DEPDIR)/libcares_la-ares__buf.Tpo -c -o str/libcares_la-ares__buf.lo `test -f 'str/ares__buf.c' || echo '$(srcdir)/'`str/ares__buf.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) str/$(DEPDIR)/libcares_la-ares__buf.Tpo str/$(DEPDIR)/libcares_la-ares__buf.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='str/ares__buf.c' object='str/libcares_la-ares__buf.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
str/libcares_la-ares_buf.lo: str/ares_buf.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 str/libcares_la-ares_buf.lo -MD -MP -MF str/$(DEPDIR)/libcares_la-ares_buf.Tpo -c -o str/libcares_la-ares_buf.lo `test -f 'str/ares_buf.c' || echo '$(srcdir)/'`str/ares_buf.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) str/$(DEPDIR)/libcares_la-ares_buf.Tpo str/$(DEPDIR)/libcares_la-ares_buf.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='str/ares_buf.c' object='str/libcares_la-ares_buf.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 str/libcares_la-ares__buf.lo `test -f 'str/ares__buf.c' || echo '$(srcdir)/'`str/ares__buf.c
|
||||
|
||||
str/libcares_la-ares_strcasecmp.lo: str/ares_strcasecmp.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 str/libcares_la-ares_strcasecmp.lo -MD -MP -MF str/$(DEPDIR)/libcares_la-ares_strcasecmp.Tpo -c -o str/libcares_la-ares_strcasecmp.lo `test -f 'str/ares_strcasecmp.c' || echo '$(srcdir)/'`str/ares_strcasecmp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) str/$(DEPDIR)/libcares_la-ares_strcasecmp.Tpo str/$(DEPDIR)/libcares_la-ares_strcasecmp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='str/ares_strcasecmp.c' object='str/libcares_la-ares_strcasecmp.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 str/libcares_la-ares_strcasecmp.lo `test -f 'str/ares_strcasecmp.c' || echo '$(srcdir)/'`str/ares_strcasecmp.c
|
||||
@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 str/libcares_la-ares_buf.lo `test -f 'str/ares_buf.c' || echo '$(srcdir)/'`str/ares_buf.c
|
||||
|
||||
str/libcares_la-ares_str.lo: str/ares_str.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 str/libcares_la-ares_str.lo -MD -MP -MF str/$(DEPDIR)/libcares_la-ares_str.Tpo -c -o str/libcares_la-ares_str.lo `test -f 'str/ares_str.c' || echo '$(srcdir)/'`str/ares_str.c
|
||||
|
|
@ -1698,26 +1733,26 @@ str/libcares_la-ares_strsplit.lo: str/ares_strsplit.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 str/libcares_la-ares_strsplit.lo `test -f 'str/ares_strsplit.c' || echo '$(srcdir)/'`str/ares_strsplit.c
|
||||
|
||||
util/libcares_la-ares__iface_ips.lo: util/ares__iface_ips.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 util/libcares_la-ares__iface_ips.lo -MD -MP -MF util/$(DEPDIR)/libcares_la-ares__iface_ips.Tpo -c -o util/libcares_la-ares__iface_ips.lo `test -f 'util/ares__iface_ips.c' || echo '$(srcdir)/'`util/ares__iface_ips.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/libcares_la-ares__iface_ips.Tpo util/$(DEPDIR)/libcares_la-ares__iface_ips.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/ares__iface_ips.c' object='util/libcares_la-ares__iface_ips.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
util/libcares_la-ares_iface_ips.lo: util/ares_iface_ips.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 util/libcares_la-ares_iface_ips.lo -MD -MP -MF util/$(DEPDIR)/libcares_la-ares_iface_ips.Tpo -c -o util/libcares_la-ares_iface_ips.lo `test -f 'util/ares_iface_ips.c' || echo '$(srcdir)/'`util/ares_iface_ips.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/libcares_la-ares_iface_ips.Tpo util/$(DEPDIR)/libcares_la-ares_iface_ips.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/ares_iface_ips.c' object='util/libcares_la-ares_iface_ips.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 util/libcares_la-ares__iface_ips.lo `test -f 'util/ares__iface_ips.c' || echo '$(srcdir)/'`util/ares__iface_ips.c
|
||||
@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 util/libcares_la-ares_iface_ips.lo `test -f 'util/ares_iface_ips.c' || echo '$(srcdir)/'`util/ares_iface_ips.c
|
||||
|
||||
util/libcares_la-ares__threads.lo: util/ares__threads.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 util/libcares_la-ares__threads.lo -MD -MP -MF util/$(DEPDIR)/libcares_la-ares__threads.Tpo -c -o util/libcares_la-ares__threads.lo `test -f 'util/ares__threads.c' || echo '$(srcdir)/'`util/ares__threads.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/libcares_la-ares__threads.Tpo util/$(DEPDIR)/libcares_la-ares__threads.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/ares__threads.c' object='util/libcares_la-ares__threads.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
util/libcares_la-ares_threads.lo: util/ares_threads.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 util/libcares_la-ares_threads.lo -MD -MP -MF util/$(DEPDIR)/libcares_la-ares_threads.Tpo -c -o util/libcares_la-ares_threads.lo `test -f 'util/ares_threads.c' || echo '$(srcdir)/'`util/ares_threads.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/libcares_la-ares_threads.Tpo util/$(DEPDIR)/libcares_la-ares_threads.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/ares_threads.c' object='util/libcares_la-ares_threads.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 util/libcares_la-ares__threads.lo `test -f 'util/ares__threads.c' || echo '$(srcdir)/'`util/ares__threads.c
|
||||
@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 util/libcares_la-ares_threads.lo `test -f 'util/ares_threads.c' || echo '$(srcdir)/'`util/ares_threads.c
|
||||
|
||||
util/libcares_la-ares__timeval.lo: util/ares__timeval.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 util/libcares_la-ares__timeval.lo -MD -MP -MF util/$(DEPDIR)/libcares_la-ares__timeval.Tpo -c -o util/libcares_la-ares__timeval.lo `test -f 'util/ares__timeval.c' || echo '$(srcdir)/'`util/ares__timeval.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/libcares_la-ares__timeval.Tpo util/$(DEPDIR)/libcares_la-ares__timeval.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/ares__timeval.c' object='util/libcares_la-ares__timeval.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
util/libcares_la-ares_timeval.lo: util/ares_timeval.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 util/libcares_la-ares_timeval.lo -MD -MP -MF util/$(DEPDIR)/libcares_la-ares_timeval.Tpo -c -o util/libcares_la-ares_timeval.lo `test -f 'util/ares_timeval.c' || echo '$(srcdir)/'`util/ares_timeval.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/libcares_la-ares_timeval.Tpo util/$(DEPDIR)/libcares_la-ares_timeval.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/ares_timeval.c' object='util/libcares_la-ares_timeval.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 util/libcares_la-ares__timeval.lo `test -f 'util/ares__timeval.c' || echo '$(srcdir)/'`util/ares__timeval.c
|
||||
@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 util/libcares_la-ares_timeval.lo `test -f 'util/ares_timeval.c' || echo '$(srcdir)/'`util/ares_timeval.c
|
||||
|
||||
util/libcares_la-ares_math.lo: util/ares_math.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 util/libcares_la-ares_math.lo -MD -MP -MF util/$(DEPDIR)/libcares_la-ares_math.Tpo -c -o util/libcares_la-ares_math.lo `test -f 'util/ares_math.c' || echo '$(srcdir)/'`util/ares_math.c
|
||||
|
|
@ -1733,6 +1768,13 @@ util/libcares_la-ares_rand.lo: util/ares_rand.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 util/libcares_la-ares_rand.lo `test -f 'util/ares_rand.c' || echo '$(srcdir)/'`util/ares_rand.c
|
||||
|
||||
util/libcares_la-ares_uri.lo: util/ares_uri.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 util/libcares_la-ares_uri.lo -MD -MP -MF util/$(DEPDIR)/libcares_la-ares_uri.Tpo -c -o util/libcares_la-ares_uri.lo `test -f 'util/ares_uri.c' || echo '$(srcdir)/'`util/ares_uri.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/libcares_la-ares_uri.Tpo util/$(DEPDIR)/libcares_la-ares_uri.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/ares_uri.c' object='util/libcares_la-ares_uri.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 util/libcares_la-ares_uri.lo `test -f 'util/ares_uri.c' || echo '$(srcdir)/'`util/ares_uri.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
|
|
@ -1958,15 +2000,12 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
|||
mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__close_sockets.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__hosts_file.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__socket.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_addrinfo2hostent.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_addrinfo_localhost.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_android.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_cancel.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_close_sockets.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_conn.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_cookie.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_data.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_destroy.Plo
|
||||
|
|
@ -1978,16 +2017,20 @@ distclean: distclean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-ares_gethostbyaddr.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_gethostbyname.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_getnameinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_hosts_file.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_init.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_library_init.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_metrics.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_options.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_platform.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_parse_into_addrinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_process.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_qcache.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_query.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_search.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_send.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_set_socket_functions.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_socket.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sortaddrinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_strerror.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig_files.Plo
|
||||
|
|
@ -1999,14 +2042,16 @@ distclean: distclean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-inet_net_pton.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-inet_ntop.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-windows_port.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__array.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable_asvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable_strvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable_szvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable_vpvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__llist.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__slist.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_array.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_asvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_dict.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_strvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_szvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_vpstr.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_vpvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_llist.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_slist.Plo
|
||||
-rm -f event/$(DEPDIR)/libcares_la-ares_event_configchg.Plo
|
||||
-rm -f event/$(DEPDIR)/libcares_la-ares_event_epoll.Plo
|
||||
-rm -f event/$(DEPDIR)/libcares_la-ares_event_kqueue.Plo
|
||||
|
|
@ -2037,15 +2082,15 @@ distclean: distclean-recursive
|
|||
-rm -f record/$(DEPDIR)/libcares_la-ares_dns_parse.Plo
|
||||
-rm -f record/$(DEPDIR)/libcares_la-ares_dns_record.Plo
|
||||
-rm -f record/$(DEPDIR)/libcares_la-ares_dns_write.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares__buf.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares_buf.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares_str.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares_strcasecmp.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares_strsplit.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares__iface_ips.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares__threads.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares__timeval.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_iface_ips.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_math.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_rand.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_threads.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_timeval.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_uri.Plo
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-tags
|
||||
|
|
@ -2091,15 +2136,12 @@ install-ps-am:
|
|||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__close_sockets.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__hosts_file.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__socket.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_addrinfo2hostent.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_addrinfo_localhost.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_android.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_cancel.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_close_sockets.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_conn.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_cookie.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_data.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_destroy.Plo
|
||||
|
|
@ -2111,16 +2153,20 @@ maintainer-clean: maintainer-clean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-ares_gethostbyaddr.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_gethostbyname.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_getnameinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_hosts_file.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_init.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_library_init.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_metrics.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_options.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_platform.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_parse_into_addrinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_process.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_qcache.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_query.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_search.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_send.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_set_socket_functions.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_socket.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sortaddrinfo.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_strerror.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig_files.Plo
|
||||
|
|
@ -2132,14 +2178,16 @@ maintainer-clean: maintainer-clean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-inet_net_pton.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-inet_ntop.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-windows_port.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__array.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable_asvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable_strvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable_szvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__htable_vpvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__llist.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares__slist.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_array.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_asvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_dict.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_strvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_szvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_vpstr.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_htable_vpvp.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_llist.Plo
|
||||
-rm -f dsa/$(DEPDIR)/libcares_la-ares_slist.Plo
|
||||
-rm -f event/$(DEPDIR)/libcares_la-ares_event_configchg.Plo
|
||||
-rm -f event/$(DEPDIR)/libcares_la-ares_event_epoll.Plo
|
||||
-rm -f event/$(DEPDIR)/libcares_la-ares_event_kqueue.Plo
|
||||
|
|
@ -2170,15 +2218,15 @@ maintainer-clean: maintainer-clean-recursive
|
|||
-rm -f record/$(DEPDIR)/libcares_la-ares_dns_parse.Plo
|
||||
-rm -f record/$(DEPDIR)/libcares_la-ares_dns_record.Plo
|
||||
-rm -f record/$(DEPDIR)/libcares_la-ares_dns_write.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares__buf.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares_buf.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares_str.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares_strcasecmp.Plo
|
||||
-rm -f str/$(DEPDIR)/libcares_la-ares_strsplit.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares__iface_ips.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares__threads.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares__timeval.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_iface_ips.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_math.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_rand.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_threads.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_timeval.Plo
|
||||
-rm -f util/$(DEPDIR)/libcares_la-ares_uri.Plo
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
|
|
|
|||
83
deps/cares/src/lib/Makefile.inc
vendored
83
deps/cares/src/lib/Makefile.inc
vendored
|
|
@ -1,15 +1,12 @@
|
|||
# Copyright (C) The c-ares project and its contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
CSOURCES = ares__addrinfo2hostent.c \
|
||||
ares__addrinfo_localhost.c \
|
||||
ares__close_sockets.c \
|
||||
ares__hosts_file.c \
|
||||
ares__parse_into_addrinfo.c \
|
||||
ares__socket.c \
|
||||
ares__sortaddrinfo.c \
|
||||
CSOURCES = ares_addrinfo2hostent.c \
|
||||
ares_addrinfo_localhost.c \
|
||||
ares_android.c \
|
||||
ares_cancel.c \
|
||||
ares_close_sockets.c \
|
||||
ares_conn.c \
|
||||
ares_cookie.c \
|
||||
ares_data.c \
|
||||
ares_destroy.c \
|
||||
|
|
@ -21,16 +18,20 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_gethostbyaddr.c \
|
||||
ares_gethostbyname.c \
|
||||
ares_getnameinfo.c \
|
||||
ares_hosts_file.c \
|
||||
ares_init.c \
|
||||
ares_library_init.c \
|
||||
ares_metrics.c \
|
||||
ares_options.c \
|
||||
ares_platform.c \
|
||||
ares_parse_into_addrinfo.c \
|
||||
ares_process.c \
|
||||
ares_qcache.c \
|
||||
ares_query.c \
|
||||
ares_search.c \
|
||||
ares_send.c \
|
||||
ares_set_socket_functions.c \
|
||||
ares_socket.c \
|
||||
ares_sortaddrinfo.c \
|
||||
ares_strerror.c \
|
||||
ares_sysconfig.c \
|
||||
ares_sysconfig_files.c \
|
||||
|
|
@ -42,14 +43,16 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
inet_net_pton.c \
|
||||
inet_ntop.c \
|
||||
windows_port.c \
|
||||
dsa/ares__array.c \
|
||||
dsa/ares__htable.c \
|
||||
dsa/ares__htable_asvp.c \
|
||||
dsa/ares__htable_strvp.c \
|
||||
dsa/ares__htable_szvp.c \
|
||||
dsa/ares__htable_vpvp.c \
|
||||
dsa/ares__llist.c \
|
||||
dsa/ares__slist.c \
|
||||
dsa/ares_array.c \
|
||||
dsa/ares_htable.c \
|
||||
dsa/ares_htable_asvp.c \
|
||||
dsa/ares_htable_dict.c \
|
||||
dsa/ares_htable_strvp.c \
|
||||
dsa/ares_htable_szvp.c \
|
||||
dsa/ares_htable_vpstr.c \
|
||||
dsa/ares_htable_vpvp.c \
|
||||
dsa/ares_llist.c \
|
||||
dsa/ares_slist.c \
|
||||
event/ares_event_configchg.c \
|
||||
event/ares_event_epoll.c \
|
||||
event/ares_event_kqueue.c \
|
||||
|
|
@ -80,41 +83,47 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
record/ares_dns_parse.c \
|
||||
record/ares_dns_record.c \
|
||||
record/ares_dns_write.c \
|
||||
str/ares__buf.c \
|
||||
str/ares_strcasecmp.c \
|
||||
str/ares_buf.c \
|
||||
str/ares_str.c \
|
||||
str/ares_strsplit.c \
|
||||
util/ares__iface_ips.c \
|
||||
util/ares__threads.c \
|
||||
util/ares__timeval.c \
|
||||
util/ares_iface_ips.c \
|
||||
util/ares_threads.c \
|
||||
util/ares_timeval.c \
|
||||
util/ares_math.c \
|
||||
util/ares_rand.c
|
||||
util/ares_rand.c \
|
||||
util/ares_uri.c
|
||||
|
||||
HHEADERS = ares_android.h \
|
||||
ares_conn.h \
|
||||
ares_data.h \
|
||||
ares_getenv.h \
|
||||
ares_inet_net_pton.h \
|
||||
ares_ipv6.h \
|
||||
ares_platform.h \
|
||||
ares_private.h \
|
||||
ares_setup.h \
|
||||
dsa/ares__array.h \
|
||||
dsa/ares__htable.h \
|
||||
dsa/ares__htable_asvp.h \
|
||||
dsa/ares__htable_strvp.h \
|
||||
dsa/ares__htable_szvp.h \
|
||||
dsa/ares__htable_vpvp.h \
|
||||
dsa/ares__llist.h \
|
||||
dsa/ares__slist.h \
|
||||
ares_socket.h \
|
||||
dsa/ares_htable.h \
|
||||
dsa/ares_slist.h \
|
||||
event/ares_event.h \
|
||||
event/ares_event_win32.h \
|
||||
include/ares_array.h \
|
||||
include/ares_buf.h \
|
||||
include/ares_htable_asvp.h \
|
||||
include/ares_htable_dict.h \
|
||||
include/ares_htable_strvp.h \
|
||||
include/ares_htable_szvp.h \
|
||||
include/ares_htable_vpstr.h \
|
||||
include/ares_htable_vpvp.h \
|
||||
include/ares_llist.h \
|
||||
include/ares_mem.h \
|
||||
include/ares_str.h \
|
||||
record/ares_dns_multistring.h \
|
||||
record/ares_dns_private.h \
|
||||
str/ares__buf.h \
|
||||
str/ares_strcasecmp.h \
|
||||
str/ares_str.h \
|
||||
str/ares_strsplit.h \
|
||||
util/ares__iface_ips.h \
|
||||
util/ares__threads.h \
|
||||
util/ares_iface_ips.h \
|
||||
util/ares_math.h \
|
||||
util/ares_rand.h \
|
||||
util/ares_time.h \
|
||||
util/ares_threads.h \
|
||||
util/ares_uri.h \
|
||||
thirdparty/apple/dnsinfo.h
|
||||
|
||||
|
|
|
|||
764
deps/cares/src/lib/ares__socket.c
vendored
764
deps/cares/src/lib/ares__socket.c
vendored
|
|
@ -1,764 +0,0 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) Massachusetts Institute of Technology
|
||||
* Copyright (c) The c-ares project and its contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
# include <sys/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_TCP_H
|
||||
# include <netinet/tcp.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef NETWARE
|
||||
# include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if defined(__linux__) && defined(TCP_FASTOPEN_CONNECT)
|
||||
# define TFO_SUPPORTED 1
|
||||
# define TFO_SKIP_CONNECT 0
|
||||
# define TFO_USE_SENDTO 0
|
||||
# define TFO_USE_CONNECTX 0
|
||||
# define TFO_CLIENT_SOCKOPT TCP_FASTOPEN_CONNECT
|
||||
#elif defined(__FreeBSD__) && defined(TCP_FASTOPEN)
|
||||
# define TFO_SUPPORTED 1
|
||||
# define TFO_SKIP_CONNECT 1
|
||||
# define TFO_USE_SENDTO 1
|
||||
# define TFO_USE_CONNECTX 0
|
||||
# define TFO_CLIENT_SOCKOPT TCP_FASTOPEN
|
||||
#elif defined(__APPLE__) && defined(HAVE_CONNECTX)
|
||||
# define TFO_SUPPORTED 1
|
||||
# define TFO_SKIP_CONNECT 0
|
||||
# define TFO_USE_SENDTO 0
|
||||
# define TFO_USE_CONNECTX 1
|
||||
# undef TFO_CLIENT_SOCKOPT
|
||||
#else
|
||||
# define TFO_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_WRITEV
|
||||
/* Structure for scatter/gather I/O. */
|
||||
struct iovec {
|
||||
void *iov_base; /* Pointer to data. */
|
||||
size_t iov_len; /* Length of data. */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* Return 1 if the specified error number describes a readiness error, or 0
|
||||
* otherwise. This is mostly for HP-UX, which could return EAGAIN or
|
||||
* EWOULDBLOCK. See this man page
|
||||
*
|
||||
* http://devrsrc1.external.hp.com/STKS/cgi-bin/man2html?
|
||||
* manpage=/usr/share/man/man2.Z/send.2
|
||||
*/
|
||||
ares_bool_t ares__socket_try_again(int errnum)
|
||||
{
|
||||
#if !defined EWOULDBLOCK && !defined EAGAIN
|
||||
# error "Neither EWOULDBLOCK nor EAGAIN defined"
|
||||
#endif
|
||||
|
||||
#ifdef EWOULDBLOCK
|
||||
if (errnum == EWOULDBLOCK) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined EAGAIN && EAGAIN != EWOULDBLOCK
|
||||
if (errnum == EAGAIN) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_ssize_t ares__socket_recv(ares_channel_t *channel, ares_socket_t s,
|
||||
void *data, size_t data_len)
|
||||
{
|
||||
if (channel->sock_funcs && channel->sock_funcs->arecvfrom) {
|
||||
return channel->sock_funcs->arecvfrom(s, data, data_len, 0, 0, 0,
|
||||
channel->sock_func_cb_data);
|
||||
}
|
||||
|
||||
return (ares_ssize_t)recv((RECV_TYPE_ARG1)s, (RECV_TYPE_ARG2)data,
|
||||
(RECV_TYPE_ARG3)data_len, (RECV_TYPE_ARG4)(0));
|
||||
}
|
||||
|
||||
ares_ssize_t ares__socket_recvfrom(ares_channel_t *channel, ares_socket_t s,
|
||||
void *data, size_t data_len, int flags,
|
||||
struct sockaddr *from,
|
||||
ares_socklen_t *from_len)
|
||||
{
|
||||
if (channel->sock_funcs && channel->sock_funcs->arecvfrom) {
|
||||
return channel->sock_funcs->arecvfrom(s, data, data_len, flags, from,
|
||||
from_len, channel->sock_func_cb_data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_RECVFROM
|
||||
return (ares_ssize_t)recvfrom(s, data, (RECVFROM_TYPE_ARG3)data_len, flags,
|
||||
from, from_len);
|
||||
#else
|
||||
return ares__socket_recv(channel, s, data, data_len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Use like:
|
||||
* struct sockaddr_storage sa_storage;
|
||||
* ares_socklen_t salen = sizeof(sa_storage);
|
||||
* struct sockaddr *sa = (struct sockaddr *)&sa_storage;
|
||||
* ares__conn_set_sockaddr(conn, sa, &salen);
|
||||
*/
|
||||
static ares_status_t ares__conn_set_sockaddr(const ares_conn_t *conn,
|
||||
struct sockaddr *sa,
|
||||
ares_socklen_t *salen)
|
||||
{
|
||||
const ares_server_t *server = conn->server;
|
||||
unsigned short port =
|
||||
conn->flags & ARES_CONN_FLAG_TCP ? server->tcp_port : server->udp_port;
|
||||
struct sockaddr_in *sin;
|
||||
struct sockaddr_in6 *sin6;
|
||||
|
||||
switch (server->addr.family) {
|
||||
case AF_INET:
|
||||
sin = (struct sockaddr_in *)(void *)sa;
|
||||
if (*salen < (ares_socklen_t)sizeof(*sin)) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
*salen = sizeof(*sin);
|
||||
memset(sin, 0, sizeof(*sin));
|
||||
sin->sin_family = AF_INET;
|
||||
sin->sin_port = htons(port);
|
||||
memcpy(&sin->sin_addr, &server->addr.addr.addr4, sizeof(sin->sin_addr));
|
||||
return ARES_SUCCESS;
|
||||
case AF_INET6:
|
||||
sin6 = (struct sockaddr_in6 *)(void *)sa;
|
||||
if (*salen < (ares_socklen_t)sizeof(*sin6)) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
*salen = sizeof(*sin6);
|
||||
memset(sin6, 0, sizeof(*sin6));
|
||||
sin6->sin6_family = AF_INET6;
|
||||
sin6->sin6_port = htons(port);
|
||||
memcpy(&sin6->sin6_addr, &server->addr.addr.addr6,
|
||||
sizeof(sin6->sin6_addr));
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
|
||||
sin6->sin6_scope_id = server->ll_scope;
|
||||
#endif
|
||||
return ARES_SUCCESS;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ARES_EBADFAMILY;
|
||||
}
|
||||
|
||||
static ares_status_t ares_conn_set_self_ip(ares_conn_t *conn, ares_bool_t early)
|
||||
{
|
||||
struct sockaddr_storage sa_storage;
|
||||
int rv;
|
||||
ares_socklen_t len = sizeof(sa_storage);
|
||||
|
||||
/* We call this twice on TFO, if we already have the IP we can go ahead and
|
||||
* skip processing */
|
||||
if (!early && conn->self_ip.family != AF_UNSPEC) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
memset(&sa_storage, 0, sizeof(sa_storage));
|
||||
|
||||
rv = getsockname(conn->fd, (struct sockaddr *)(void *)&sa_storage, &len);
|
||||
if (rv != 0) {
|
||||
/* During TCP FastOpen, we can't get the IP this early since connect()
|
||||
* may not be called. That's ok, we'll try again later */
|
||||
if (early && conn->flags & ARES_CONN_FLAG_TCP &&
|
||||
conn->flags & ARES_CONN_FLAG_TFO) {
|
||||
memset(&conn->self_ip, 0, sizeof(conn->self_ip));
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
|
||||
if (!ares_sockaddr_to_ares_addr(&conn->self_ip, NULL,
|
||||
(struct sockaddr *)(void *)&sa_storage)) {
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_ssize_t ares__conn_write(ares_conn_t *conn, const void *data, size_t len)
|
||||
{
|
||||
ares_channel_t *channel = conn->server->channel;
|
||||
int flags = 0;
|
||||
|
||||
#ifdef HAVE_MSG_NOSIGNAL
|
||||
flags |= MSG_NOSIGNAL;
|
||||
#endif
|
||||
|
||||
if (channel->sock_funcs && channel->sock_funcs->asendv) {
|
||||
struct iovec vec;
|
||||
vec.iov_base = (void *)((size_t)data); /* Cast off const */
|
||||
vec.iov_len = len;
|
||||
return channel->sock_funcs->asendv(conn->fd, &vec, 1,
|
||||
channel->sock_func_cb_data);
|
||||
}
|
||||
|
||||
if (conn->flags & ARES_CONN_FLAG_TFO_INITIAL) {
|
||||
conn->flags &= ~((unsigned int)ARES_CONN_FLAG_TFO_INITIAL);
|
||||
|
||||
#if defined(TFO_USE_SENDTO) && TFO_USE_SENDTO
|
||||
{
|
||||
struct sockaddr_storage sa_storage;
|
||||
ares_socklen_t salen = sizeof(sa_storage);
|
||||
struct sockaddr *sa = (struct sockaddr *)&sa_storage;
|
||||
ares_status_t status;
|
||||
ares_ssize_t rv;
|
||||
|
||||
status = ares__conn_set_sockaddr(conn, sa, &salen);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
rv = (ares_ssize_t)sendto((SEND_TYPE_ARG1)conn->fd, (SEND_TYPE_ARG2)data,
|
||||
(SEND_TYPE_ARG3)len, (SEND_TYPE_ARG4)flags, sa,
|
||||
salen);
|
||||
|
||||
/* If using TFO, we might not have been able to get an IP earlier, since
|
||||
* we hadn't informed the OS of the destination. When using sendto()
|
||||
* now we have so we should be able to fetch it */
|
||||
ares_conn_set_self_ip(conn, ARES_TRUE);
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return (ares_ssize_t)send((SEND_TYPE_ARG1)conn->fd, (SEND_TYPE_ARG2)data,
|
||||
(SEND_TYPE_ARG3)len, (SEND_TYPE_ARG4)flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* setsocknonblock sets the given socket to either blocking or non-blocking
|
||||
* mode based on the 'nonblock' boolean argument. This function is highly
|
||||
* portable.
|
||||
*/
|
||||
static int setsocknonblock(ares_socket_t sockfd, /* operate on this */
|
||||
int nonblock /* TRUE or FALSE */)
|
||||
{
|
||||
#if defined(USE_BLOCKING_SOCKETS)
|
||||
|
||||
return 0; /* returns success */
|
||||
|
||||
#elif defined(HAVE_FCNTL_O_NONBLOCK)
|
||||
|
||||
/* most recent unix versions */
|
||||
int flags;
|
||||
flags = fcntl(sockfd, F_GETFL, 0);
|
||||
if (nonblock) {
|
||||
return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
|
||||
} else {
|
||||
return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
#elif defined(HAVE_IOCTL_FIONBIO)
|
||||
|
||||
/* older unix versions */
|
||||
int flags = nonblock ? 1 : 0;
|
||||
return ioctl(sockfd, FIONBIO, &flags);
|
||||
|
||||
#elif defined(HAVE_IOCTLSOCKET_FIONBIO)
|
||||
|
||||
# ifdef WATT32
|
||||
char flags = nonblock ? 1 : 0;
|
||||
# else
|
||||
/* Windows */
|
||||
unsigned long flags = nonblock ? 1UL : 0UL;
|
||||
# endif
|
||||
return ioctlsocket(sockfd, (long)FIONBIO, &flags);
|
||||
|
||||
#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
|
||||
|
||||
/* Amiga */
|
||||
long flags = nonblock ? 1L : 0L;
|
||||
return IoctlSocket(sockfd, FIONBIO, flags);
|
||||
|
||||
#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
|
||||
|
||||
/* BeOS */
|
||||
long b = nonblock ? 1L : 0L;
|
||||
return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
|
||||
|
||||
#else
|
||||
# error "no non-blocking method was found/used/set"
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(IPV6_V6ONLY) && defined(USE_WINSOCK)
|
||||
/* It makes support for IPv4-mapped IPv6 addresses.
|
||||
* Linux kernel, NetBSD, FreeBSD and Darwin: default is off;
|
||||
* Windows Vista and later: default is on;
|
||||
* DragonFly BSD: acts like off, and dummy setting;
|
||||
* OpenBSD and earlier Windows: unsupported.
|
||||
* Linux: controlled by /proc/sys/net/ipv6/bindv6only.
|
||||
*/
|
||||
static void set_ipv6_v6only(ares_socket_t sockfd, int on)
|
||||
{
|
||||
(void)setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on));
|
||||
}
|
||||
#else
|
||||
# define set_ipv6_v6only(s, v)
|
||||
#endif
|
||||
|
||||
static ares_status_t configure_socket(ares_conn_t *conn)
|
||||
{
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sa4;
|
||||
struct sockaddr_in6 sa6;
|
||||
} local;
|
||||
|
||||
ares_socklen_t bindlen = 0;
|
||||
ares_server_t *server = conn->server;
|
||||
ares_channel_t *channel = server->channel;
|
||||
|
||||
/* do not set options for user-managed sockets */
|
||||
if (channel->sock_funcs && channel->sock_funcs->asocket) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
(void)setsocknonblock(conn->fd, 1);
|
||||
|
||||
#if defined(FD_CLOEXEC) && !defined(MSDOS)
|
||||
/* Configure the socket fd as close-on-exec. */
|
||||
if (fcntl(conn->fd, F_SETFD, FD_CLOEXEC) != 0) {
|
||||
return ARES_ECONNREFUSED; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* No need to emit SIGPIPE on socket errors */
|
||||
#if defined(SO_NOSIGPIPE)
|
||||
{
|
||||
int opt = 1;
|
||||
(void)setsockopt(conn->fd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&opt,
|
||||
sizeof(opt));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set the socket's send and receive buffer sizes. */
|
||||
if (channel->socket_send_buffer_size > 0 &&
|
||||
setsockopt(conn->fd, SOL_SOCKET, SO_SNDBUF,
|
||||
(void *)&channel->socket_send_buffer_size,
|
||||
sizeof(channel->socket_send_buffer_size)) != 0) {
|
||||
return ARES_ECONNREFUSED; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
if (channel->socket_receive_buffer_size > 0 &&
|
||||
setsockopt(conn->fd, SOL_SOCKET, SO_RCVBUF,
|
||||
(void *)&channel->socket_receive_buffer_size,
|
||||
sizeof(channel->socket_receive_buffer_size)) != 0) {
|
||||
return ARES_ECONNREFUSED; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
#ifdef SO_BINDTODEVICE
|
||||
if (ares_strlen(channel->local_dev_name)) {
|
||||
/* Only root can do this, and usually not fatal if it doesn't work, so
|
||||
* just continue on. */
|
||||
(void)setsockopt(conn->fd, SOL_SOCKET, SO_BINDTODEVICE,
|
||||
channel->local_dev_name, sizeof(channel->local_dev_name));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (server->addr.family == AF_INET && channel->local_ip4) {
|
||||
memset(&local.sa4, 0, sizeof(local.sa4));
|
||||
local.sa4.sin_family = AF_INET;
|
||||
local.sa4.sin_addr.s_addr = htonl(channel->local_ip4);
|
||||
bindlen = sizeof(local.sa4);
|
||||
} else if (server->addr.family == AF_INET6 && server->ll_scope == 0 &&
|
||||
memcmp(channel->local_ip6, ares_in6addr_any._S6_un._S6_u8,
|
||||
sizeof(channel->local_ip6)) != 0) {
|
||||
/* Only if not link-local and an ip other than "::" is specified */
|
||||
memset(&local.sa6, 0, sizeof(local.sa6));
|
||||
local.sa6.sin6_family = AF_INET6;
|
||||
memcpy(&local.sa6.sin6_addr, channel->local_ip6,
|
||||
sizeof(channel->local_ip6));
|
||||
bindlen = sizeof(local.sa6);
|
||||
}
|
||||
|
||||
if (bindlen && bind(conn->fd, &local.sa, bindlen) < 0) {
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
|
||||
if (server->addr.family == AF_INET6) {
|
||||
set_ipv6_v6only(conn->fd, 0);
|
||||
}
|
||||
|
||||
if (conn->flags & ARES_CONN_FLAG_TCP) {
|
||||
int opt = 1;
|
||||
|
||||
#ifdef TCP_NODELAY
|
||||
/*
|
||||
* Disable the Nagle algorithm (only relevant for TCP sockets, and thus not
|
||||
* in configure_socket). In general, in DNS lookups we're pretty much
|
||||
* interested in firing off a single request and then waiting for a reply,
|
||||
* so batching isn't very interesting.
|
||||
*/
|
||||
if (setsockopt(conn->fd, IPPROTO_TCP, TCP_NODELAY, (void *)&opt,
|
||||
sizeof(opt)) != 0) {
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TFO_CLIENT_SOCKOPT)
|
||||
if (conn->flags & ARES_CONN_FLAG_TFO &&
|
||||
setsockopt(conn->fd, IPPROTO_TCP, TFO_CLIENT_SOCKOPT, (void *)&opt,
|
||||
sizeof(opt)) != 0) {
|
||||
/* Disable TFO if flag can't be set. */
|
||||
conn->flags &= ~((unsigned int)ARES_CONN_FLAG_TFO);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_bool_t ares_sockaddr_to_ares_addr(struct ares_addr *ares_addr,
|
||||
unsigned short *port,
|
||||
const struct sockaddr *sockaddr)
|
||||
{
|
||||
if (sockaddr->sa_family == AF_INET) {
|
||||
/* NOTE: memcpy sockaddr_in due to alignment issues found by UBSAN due to
|
||||
* dnsinfo packing on MacOS */
|
||||
struct sockaddr_in sockaddr_in;
|
||||
memcpy(&sockaddr_in, sockaddr, sizeof(sockaddr_in));
|
||||
|
||||
ares_addr->family = AF_INET;
|
||||
memcpy(&ares_addr->addr.addr4, &(sockaddr_in.sin_addr),
|
||||
sizeof(ares_addr->addr.addr4));
|
||||
|
||||
if (port) {
|
||||
*port = ntohs(sockaddr_in.sin_port);
|
||||
}
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
if (sockaddr->sa_family == AF_INET6) {
|
||||
/* NOTE: memcpy sockaddr_in6 due to alignment issues found by UBSAN due to
|
||||
* dnsinfo packing on MacOS */
|
||||
struct sockaddr_in6 sockaddr_in6;
|
||||
memcpy(&sockaddr_in6, sockaddr, sizeof(sockaddr_in6));
|
||||
|
||||
ares_addr->family = AF_INET6;
|
||||
memcpy(&ares_addr->addr.addr6, &(sockaddr_in6.sin6_addr),
|
||||
sizeof(ares_addr->addr.addr6));
|
||||
if (port) {
|
||||
*port = ntohs(sockaddr_in6.sin6_port);
|
||||
}
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
static ares_status_t ares__conn_connect(ares_conn_t *conn, struct sockaddr *sa,
|
||||
ares_socklen_t salen)
|
||||
{
|
||||
/* Normal non TCPFastOpen style connect */
|
||||
if (!(conn->flags & ARES_CONN_FLAG_TFO)) {
|
||||
return ares__connect_socket(conn->server->channel, conn->fd, sa, salen);
|
||||
}
|
||||
|
||||
/* FreeBSD don't want any sort of connect() so skip */
|
||||
#if defined(TFO_SKIP_CONNECT) && TFO_SKIP_CONNECT
|
||||
return ARES_SUCCESS;
|
||||
#elif defined(TFO_USE_CONNECTX) && TFO_USE_CONNECTX
|
||||
{
|
||||
int rv;
|
||||
int err;
|
||||
|
||||
do {
|
||||
sa_endpoints_t endpoints;
|
||||
memset(&endpoints, 0, sizeof(endpoints));
|
||||
endpoints.sae_dstaddr = sa;
|
||||
endpoints.sae_dstaddrlen = salen;
|
||||
|
||||
rv = connectx(conn->fd, &endpoints, SAE_ASSOCID_ANY,
|
||||
CONNECT_DATA_IDEMPOTENT | CONNECT_RESUME_ON_READ_WRITE,
|
||||
NULL, 0, NULL, NULL);
|
||||
|
||||
err = SOCKERRNO;
|
||||
if (rv == -1 && err != EINPROGRESS && err != EWOULDBLOCK) {
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
|
||||
} while (rv == -1 && err == EINTR);
|
||||
}
|
||||
return ARES_SUCCESS;
|
||||
#elif defined(TFO_SUPPORTED) && TFO_SUPPORTED
|
||||
return ares__connect_socket(conn->server->channel, conn->fd, sa, salen);
|
||||
#else
|
||||
/* Shouldn't be possible */
|
||||
return ARES_ECONNREFUSED;
|
||||
#endif
|
||||
}
|
||||
|
||||
ares_status_t ares__open_connection(ares_conn_t **conn_out,
|
||||
ares_channel_t *channel,
|
||||
ares_server_t *server, ares_bool_t is_tcp)
|
||||
{
|
||||
ares_status_t status;
|
||||
struct sockaddr_storage sa_storage;
|
||||
ares_socklen_t salen = sizeof(sa_storage);
|
||||
struct sockaddr *sa = (struct sockaddr *)&sa_storage;
|
||||
ares_conn_t *conn;
|
||||
ares__llist_node_t *node = NULL;
|
||||
int stype = is_tcp ? SOCK_STREAM : SOCK_DGRAM;
|
||||
|
||||
*conn_out = NULL;
|
||||
|
||||
conn = ares_malloc(sizeof(*conn));
|
||||
if (conn == NULL) {
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
memset(conn, 0, sizeof(*conn));
|
||||
conn->fd = ARES_SOCKET_BAD;
|
||||
conn->server = server;
|
||||
conn->queries_to_conn = ares__llist_create(NULL);
|
||||
conn->flags = is_tcp ? ARES_CONN_FLAG_TCP : ARES_CONN_FLAG_NONE;
|
||||
|
||||
/* Enable TFO if the OS supports it and we were passed in data to send during
|
||||
* the connect. It might be disabled later if an error is encountered. Make
|
||||
* sure a user isn't overriding anything. */
|
||||
if (conn->flags & ARES_CONN_FLAG_TCP && channel->sock_funcs == NULL &&
|
||||
TFO_SUPPORTED) {
|
||||
conn->flags |= ARES_CONN_FLAG_TFO;
|
||||
}
|
||||
|
||||
if (conn->queries_to_conn == NULL) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* Convert into the struct sockaddr structure needed by the OS */
|
||||
status = ares__conn_set_sockaddr(conn, sa, &salen);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Acquire a socket. */
|
||||
conn->fd = ares__open_socket(channel, server->addr.family, stype, 0);
|
||||
if (conn->fd == ARES_SOCKET_BAD) {
|
||||
status = ARES_ECONNREFUSED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Configure it. */
|
||||
status = configure_socket(conn);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (channel->sock_config_cb) {
|
||||
int err =
|
||||
channel->sock_config_cb(conn->fd, stype, channel->sock_config_cb_data);
|
||||
if (err < 0) {
|
||||
status = ARES_ECONNREFUSED;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Connect */
|
||||
status = ares__conn_connect(conn, sa, salen);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (channel->sock_create_cb) {
|
||||
int err =
|
||||
channel->sock_create_cb(conn->fd, stype, channel->sock_create_cb_data);
|
||||
if (err < 0) {
|
||||
status = ARES_ECONNREFUSED;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Let the connection know we haven't written our first packet yet for TFO */
|
||||
if (conn->flags & ARES_CONN_FLAG_TFO) {
|
||||
conn->flags |= ARES_CONN_FLAG_TFO_INITIAL;
|
||||
}
|
||||
|
||||
/* Need to store our own ip for DNS cookie support */
|
||||
status = ares_conn_set_self_ip(conn, ARES_FALSE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
/* TCP connections are thrown to the end as we don't spawn multiple TCP
|
||||
* connections. UDP connections are put on front where the newest connection
|
||||
* can be quickly pulled */
|
||||
if (is_tcp) {
|
||||
node = ares__llist_insert_last(server->connections, conn);
|
||||
} else {
|
||||
node = ares__llist_insert_first(server->connections, conn);
|
||||
}
|
||||
if (node == NULL) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* Register globally to quickly map event on file descriptor to connection
|
||||
* node object */
|
||||
if (!ares__htable_asvp_insert(channel->connnode_by_socket, conn->fd, node)) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
SOCK_STATE_CALLBACK(channel, conn->fd, 1, is_tcp ? 1 : 0);
|
||||
|
||||
if (is_tcp) {
|
||||
server->tcp_conn = conn;
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares__llist_node_claim(node);
|
||||
ares__llist_destroy(conn->queries_to_conn);
|
||||
ares__close_socket(channel, conn->fd);
|
||||
ares_free(conn);
|
||||
} else {
|
||||
*conn_out = conn;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_socket_t ares__open_socket(ares_channel_t *channel, int af, int type,
|
||||
int protocol)
|
||||
{
|
||||
if (channel->sock_funcs && channel->sock_funcs->asocket) {
|
||||
return channel->sock_funcs->asocket(af, type, protocol,
|
||||
channel->sock_func_cb_data);
|
||||
}
|
||||
|
||||
return socket(af, type, protocol);
|
||||
}
|
||||
|
||||
ares_status_t ares__connect_socket(ares_channel_t *channel,
|
||||
ares_socket_t sockfd,
|
||||
const struct sockaddr *addr,
|
||||
ares_socklen_t addrlen)
|
||||
{
|
||||
int rv;
|
||||
int err;
|
||||
|
||||
do {
|
||||
if (channel->sock_funcs && channel->sock_funcs->aconnect) {
|
||||
rv = channel->sock_funcs->aconnect(sockfd, addr, addrlen,
|
||||
channel->sock_func_cb_data);
|
||||
} else {
|
||||
rv = connect(sockfd, addr, addrlen);
|
||||
}
|
||||
|
||||
err = SOCKERRNO;
|
||||
|
||||
if (rv == -1 && err != EINPROGRESS && err != EWOULDBLOCK) {
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
|
||||
} while (rv == -1 && err == EINTR);
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
void ares__close_socket(ares_channel_t *channel, ares_socket_t s)
|
||||
{
|
||||
if (s == ARES_SOCKET_BAD) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel->sock_funcs && channel->sock_funcs->aclose) {
|
||||
channel->sock_funcs->aclose(s, channel->sock_func_cb_data);
|
||||
} else {
|
||||
sclose(s);
|
||||
}
|
||||
}
|
||||
|
||||
void ares_set_socket_callback(ares_channel_t *channel,
|
||||
ares_sock_create_callback cb, void *data)
|
||||
{
|
||||
if (channel == NULL) {
|
||||
return;
|
||||
}
|
||||
channel->sock_create_cb = cb;
|
||||
channel->sock_create_cb_data = data;
|
||||
}
|
||||
|
||||
void ares_set_socket_configure_callback(ares_channel_t *channel,
|
||||
ares_sock_config_callback cb,
|
||||
void *data)
|
||||
{
|
||||
if (channel == NULL || channel->optmask & ARES_OPT_EVENT_THREAD) {
|
||||
return;
|
||||
}
|
||||
channel->sock_config_cb = cb;
|
||||
channel->sock_config_cb_data = data;
|
||||
}
|
||||
|
||||
void ares_set_socket_functions(ares_channel_t *channel,
|
||||
const struct ares_socket_functions *funcs,
|
||||
void *data)
|
||||
{
|
||||
if (channel == NULL || channel->optmask & ARES_OPT_EVENT_THREAD) {
|
||||
return;
|
||||
}
|
||||
channel->sock_funcs = funcs;
|
||||
channel->sock_func_cb_data = data;
|
||||
}
|
||||
|
|
@ -48,8 +48,8 @@
|
|||
#endif
|
||||
|
||||
|
||||
ares_status_t ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family,
|
||||
struct hostent **host)
|
||||
ares_status_t ares_addrinfo2hostent(const struct ares_addrinfo *ai, int family,
|
||||
struct hostent **host)
|
||||
{
|
||||
struct ares_addrinfo_node *next;
|
||||
struct ares_addrinfo_cname *next_cname;
|
||||
|
|
@ -196,11 +196,11 @@ enomem:
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ares_status_t ares__addrinfo2addrttl(const struct ares_addrinfo *ai, int family,
|
||||
size_t req_naddrttls,
|
||||
struct ares_addrttl *addrttls,
|
||||
struct ares_addr6ttl *addr6ttls,
|
||||
size_t *naddrttls)
|
||||
ares_status_t ares_addrinfo2addrttl(const struct ares_addrinfo *ai, int family,
|
||||
size_t req_naddrttls,
|
||||
struct ares_addrttl *addrttls,
|
||||
struct ares_addr6ttl *addr6ttls,
|
||||
size_t *naddrttls)
|
||||
{
|
||||
struct ares_addrinfo_node *next;
|
||||
struct ares_addrinfo_cname *next_cname;
|
||||
|
|
@ -55,7 +55,7 @@ ares_status_t ares_append_ai_node(int aftype, unsigned short port,
|
|||
{
|
||||
struct ares_addrinfo_node *node;
|
||||
|
||||
node = ares__append_addrinfo_node(nodes);
|
||||
node = ares_append_addrinfo_node(nodes);
|
||||
if (!node) {
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
@ -102,8 +102,8 @@ ares_status_t ares_append_ai_node(int aftype, unsigned short port,
|
|||
}
|
||||
|
||||
static ares_status_t
|
||||
ares__default_loopback_addrs(int aftype, unsigned short port,
|
||||
struct ares_addrinfo_node **nodes)
|
||||
ares_default_loopback_addrs(int aftype, unsigned short port,
|
||||
struct ares_addrinfo_node **nodes)
|
||||
{
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
|
||||
|
|
@ -129,8 +129,8 @@ static ares_status_t
|
|||
}
|
||||
|
||||
static ares_status_t
|
||||
ares__system_loopback_addrs(int aftype, unsigned short port,
|
||||
struct ares_addrinfo_node **nodes)
|
||||
ares_system_loopback_addrs(int aftype, unsigned short port,
|
||||
struct ares_addrinfo_node **nodes)
|
||||
{
|
||||
#if defined(USE_WINSOCK) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 && \
|
||||
!defined(__WATCOMC__)
|
||||
|
|
@ -176,7 +176,7 @@ fail:
|
|||
FreeMibTable(table);
|
||||
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares__freeaddrinfo_nodes(*nodes);
|
||||
ares_freeaddrinfo_nodes(*nodes);
|
||||
*nodes = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -191,9 +191,9 @@ fail:
|
|||
#endif
|
||||
}
|
||||
|
||||
ares_status_t ares__addrinfo_localhost(const char *name, unsigned short port,
|
||||
const struct ares_addrinfo_hints *hints,
|
||||
struct ares_addrinfo *ai)
|
||||
ares_status_t ares_addrinfo_localhost(const char *name, unsigned short port,
|
||||
const struct ares_addrinfo_hints *hints,
|
||||
struct ares_addrinfo *ai)
|
||||
{
|
||||
struct ares_addrinfo_node *nodes = NULL;
|
||||
ares_status_t status;
|
||||
|
|
@ -213,19 +213,19 @@ ares_status_t ares__addrinfo_localhost(const char *name, unsigned short port,
|
|||
goto enomem; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__system_loopback_addrs(hints->ai_family, port, &nodes);
|
||||
status = ares_system_loopback_addrs(hints->ai_family, port, &nodes);
|
||||
|
||||
if (status == ARES_ENOTFOUND) {
|
||||
status = ares__default_loopback_addrs(hints->ai_family, port, &nodes);
|
||||
status = ares_default_loopback_addrs(hints->ai_family, port, &nodes);
|
||||
}
|
||||
|
||||
ares__addrinfo_cat_nodes(&ai->nodes, nodes);
|
||||
ares_addrinfo_cat_nodes(&ai->nodes, nodes);
|
||||
|
||||
return status;
|
||||
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
enomem:
|
||||
ares__freeaddrinfo_nodes(nodes);
|
||||
ares_freeaddrinfo_nodes(nodes);
|
||||
ares_free(ai->name);
|
||||
ai->name = NULL;
|
||||
return ARES_ENOMEM;
|
||||
6
deps/cares/src/lib/ares_android.c
vendored
6
deps/cares/src/lib/ares_android.c
vendored
|
|
@ -84,9 +84,9 @@ static jmethodID jni_get_method_id(JNIEnv *env, jclass cls,
|
|||
|
||||
static int jvm_attach(JNIEnv **env)
|
||||
{
|
||||
char name[17] = {0};
|
||||
char name[17] = { 0 };
|
||||
|
||||
JavaVMAttachArgs args;
|
||||
JavaVMAttachArgs args;
|
||||
|
||||
args.version = JNI_VERSION_1_6;
|
||||
if (prctl(PR_GET_NAME, name) == 0) {
|
||||
|
|
@ -94,7 +94,7 @@ static int jvm_attach(JNIEnv **env)
|
|||
} else {
|
||||
args.name = NULL;
|
||||
}
|
||||
args.group = NULL;
|
||||
args.group = NULL;
|
||||
|
||||
return (*android_jvm)->AttachCurrentThread(android_jvm, env, &args);
|
||||
}
|
||||
|
|
|
|||
26
deps/cares/src/lib/ares_cancel.c
vendored
26
deps/cares/src/lib/ares_cancel.c
vendored
|
|
@ -37,18 +37,18 @@ void ares_cancel(ares_channel_t *channel)
|
|||
return;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
if (ares__llist_len(channel->all_queries) > 0) {
|
||||
ares__llist_node_t *node = NULL;
|
||||
ares__llist_node_t *next = NULL;
|
||||
if (ares_llist_len(channel->all_queries) > 0) {
|
||||
ares_llist_node_t *node = NULL;
|
||||
ares_llist_node_t *next = NULL;
|
||||
|
||||
/* Swap list heads, so that only those queries which were present on entry
|
||||
* into this function are cancelled. New queries added by callbacks of
|
||||
* queries being cancelled will not be cancelled themselves.
|
||||
*/
|
||||
ares__llist_t *list_copy = channel->all_queries;
|
||||
channel->all_queries = ares__llist_create(NULL);
|
||||
ares_llist_t *list_copy = channel->all_queries;
|
||||
channel->all_queries = ares_llist_create(NULL);
|
||||
|
||||
/* Out of memory, this function doesn't return a result code though so we
|
||||
* can't report to caller */
|
||||
|
|
@ -57,31 +57,31 @@ void ares_cancel(ares_channel_t *channel)
|
|||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
node = ares__llist_node_first(list_copy);
|
||||
node = ares_llist_node_first(list_copy);
|
||||
while (node != NULL) {
|
||||
ares_query_t *query;
|
||||
|
||||
/* Cache next since this node is being deleted */
|
||||
next = ares__llist_node_next(node);
|
||||
next = ares_llist_node_next(node);
|
||||
|
||||
query = ares__llist_node_claim(node);
|
||||
query = ares_llist_node_claim(node);
|
||||
query->node_all_queries = NULL;
|
||||
|
||||
/* NOTE: its possible this may enqueue new queries */
|
||||
query->callback(query->arg, ARES_ECANCELLED, 0, NULL);
|
||||
ares__free_query(query);
|
||||
ares_free_query(query);
|
||||
|
||||
node = next;
|
||||
}
|
||||
|
||||
ares__llist_destroy(list_copy);
|
||||
ares_llist_destroy(list_copy);
|
||||
}
|
||||
|
||||
/* See if the connections should be cleaned up */
|
||||
ares__check_cleanup_conns(channel);
|
||||
ares_check_cleanup_conns(channel);
|
||||
|
||||
ares_queue_notify_empty(channel);
|
||||
|
||||
done:
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,81 +28,82 @@
|
|||
#include "ares_private.h"
|
||||
#include <assert.h>
|
||||
|
||||
static void ares__requeue_queries(ares_conn_t *conn,
|
||||
ares_status_t requeue_status)
|
||||
static void ares_requeue_queries(ares_conn_t *conn,
|
||||
ares_status_t requeue_status)
|
||||
{
|
||||
ares_query_t *query;
|
||||
ares_timeval_t now;
|
||||
|
||||
ares__tvnow(&now);
|
||||
ares_tvnow(&now);
|
||||
|
||||
while ((query = ares__llist_first_val(conn->queries_to_conn)) != NULL) {
|
||||
ares__requeue_query(query, &now, requeue_status, ARES_TRUE, NULL);
|
||||
while ((query = ares_llist_first_val(conn->queries_to_conn)) != NULL) {
|
||||
ares_requeue_query(query, &now, requeue_status, ARES_TRUE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void ares__close_connection(ares_conn_t *conn, ares_status_t requeue_status)
|
||||
void ares_close_connection(ares_conn_t *conn, ares_status_t requeue_status)
|
||||
{
|
||||
ares_server_t *server = conn->server;
|
||||
ares_channel_t *channel = server->channel;
|
||||
|
||||
/* Unlink */
|
||||
ares__llist_node_claim(
|
||||
ares__htable_asvp_get_direct(channel->connnode_by_socket, conn->fd));
|
||||
ares__htable_asvp_remove(channel->connnode_by_socket, conn->fd);
|
||||
ares_llist_node_claim(
|
||||
ares_htable_asvp_get_direct(channel->connnode_by_socket, conn->fd));
|
||||
ares_htable_asvp_remove(channel->connnode_by_socket, conn->fd);
|
||||
|
||||
if (conn->flags & ARES_CONN_FLAG_TCP) {
|
||||
/* Reset any existing input and output buffer. */
|
||||
ares__buf_consume(server->tcp_parser, ares__buf_len(server->tcp_parser));
|
||||
ares__buf_consume(server->tcp_send, ares__buf_len(server->tcp_send));
|
||||
server->tcp_conn = NULL;
|
||||
}
|
||||
|
||||
ares_buf_destroy(conn->in_buf);
|
||||
ares_buf_destroy(conn->out_buf);
|
||||
|
||||
/* Requeue queries to other connections */
|
||||
ares__requeue_queries(conn, requeue_status);
|
||||
ares_requeue_queries(conn, requeue_status);
|
||||
|
||||
ares__llist_destroy(conn->queries_to_conn);
|
||||
ares_llist_destroy(conn->queries_to_conn);
|
||||
|
||||
SOCK_STATE_CALLBACK(channel, conn->fd, 0, 0);
|
||||
ares__close_socket(channel, conn->fd);
|
||||
ares_conn_sock_state_cb_update(conn, ARES_CONN_STATE_NONE);
|
||||
|
||||
ares_socket_close(channel, conn->fd);
|
||||
|
||||
ares_free(conn);
|
||||
}
|
||||
|
||||
void ares__close_sockets(ares_server_t *server)
|
||||
void ares_close_sockets(ares_server_t *server)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
while ((node = ares__llist_node_first(server->connections)) != NULL) {
|
||||
ares_conn_t *conn = ares__llist_node_val(node);
|
||||
ares__close_connection(conn, ARES_SUCCESS);
|
||||
while ((node = ares_llist_node_first(server->connections)) != NULL) {
|
||||
ares_conn_t *conn = ares_llist_node_val(node);
|
||||
ares_close_connection(conn, ARES_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
void ares__check_cleanup_conns(const ares_channel_t *channel)
|
||||
void ares_check_cleanup_conns(const ares_channel_t *channel)
|
||||
{
|
||||
ares__slist_node_t *snode;
|
||||
ares_slist_node_t *snode;
|
||||
|
||||
if (channel == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
/* Iterate across each server */
|
||||
for (snode = ares__slist_node_first(channel->servers); snode != NULL;
|
||||
snode = ares__slist_node_next(snode)) {
|
||||
ares_server_t *server = ares__slist_node_val(snode);
|
||||
ares__llist_node_t *cnode;
|
||||
for (snode = ares_slist_node_first(channel->servers); snode != NULL;
|
||||
snode = ares_slist_node_next(snode)) {
|
||||
ares_server_t *server = ares_slist_node_val(snode);
|
||||
ares_llist_node_t *cnode;
|
||||
|
||||
/* Iterate across each connection */
|
||||
cnode = ares__llist_node_first(server->connections);
|
||||
cnode = ares_llist_node_first(server->connections);
|
||||
while (cnode != NULL) {
|
||||
ares__llist_node_t *next = ares__llist_node_next(cnode);
|
||||
ares_conn_t *conn = ares__llist_node_val(cnode);
|
||||
ares_bool_t do_cleanup = ARES_FALSE;
|
||||
cnode = next;
|
||||
ares_llist_node_t *next = ares_llist_node_next(cnode);
|
||||
ares_conn_t *conn = ares_llist_node_val(cnode);
|
||||
ares_bool_t do_cleanup = ARES_FALSE;
|
||||
cnode = next;
|
||||
|
||||
/* Has connections, not eligible */
|
||||
if (ares__llist_len(conn->queries_to_conn)) {
|
||||
if (ares_llist_len(conn->queries_to_conn)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +131,7 @@ void ares__check_cleanup_conns(const ares_channel_t *channel)
|
|||
}
|
||||
|
||||
/* Clean it up */
|
||||
ares__close_connection(conn, ARES_SUCCESS);
|
||||
ares_close_connection(conn, ARES_SUCCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
deps/cares/src/lib/ares_config.h.cmake
vendored
6
deps/cares/src/lib/ares_config.h.cmake
vendored
|
|
@ -82,6 +82,9 @@
|
|||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#cmakedefine HAVE_POLL_H 1
|
||||
|
||||
/* Define to 1 if you have the memmem function. */
|
||||
#cmakedefine HAVE_MEMMEM 1
|
||||
|
||||
/* Define to 1 if you have the poll function. */
|
||||
#cmakedefine HAVE_POLL 1
|
||||
|
||||
|
|
@ -242,6 +245,9 @@
|
|||
/* Define to 1 if you have the send function. */
|
||||
#cmakedefine HAVE_SEND 1
|
||||
|
||||
/* Define to 1 if you have the sendto function. */
|
||||
#cmakedefine HAVE_SENDTO 1
|
||||
|
||||
/* Define to 1 if you have the setsockopt function. */
|
||||
#cmakedefine HAVE_SETSOCKOPT 1
|
||||
|
||||
|
|
|
|||
6
deps/cares/src/lib/ares_config.h.in
vendored
6
deps/cares/src/lib/ares_config.h.in
vendored
|
|
@ -177,6 +177,9 @@
|
|||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have `memmem` */
|
||||
#undef HAVE_MEMMEM
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
|
|
@ -249,6 +252,9 @@
|
|||
/* Define to 1 if you have `send` */
|
||||
#undef HAVE_SEND
|
||||
|
||||
/* Define to 1 if you have `sendto` */
|
||||
#undef HAVE_SENDTO
|
||||
|
||||
/* Define to 1 if you have `setsockopt` */
|
||||
#undef HAVE_SETSOCKOPT
|
||||
|
||||
|
|
|
|||
511
deps/cares/src/lib/ares_conn.c
vendored
Normal file
511
deps/cares/src/lib/ares_conn.c
vendored
Normal file
|
|
@ -0,0 +1,511 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) Massachusetts Institute of Technology
|
||||
* Copyright (c) The c-ares project and its contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
|
||||
void ares_conn_sock_state_cb_update(ares_conn_t *conn,
|
||||
ares_conn_state_flags_t flags)
|
||||
{
|
||||
ares_channel_t *channel = conn->server->channel;
|
||||
|
||||
if ((conn->state_flags & ARES_CONN_STATE_CBFLAGS) != flags &&
|
||||
channel->sock_state_cb) {
|
||||
channel->sock_state_cb(channel->sock_state_cb_data, conn->fd,
|
||||
flags & ARES_CONN_STATE_READ ? 1 : 0,
|
||||
flags & ARES_CONN_STATE_WRITE ? 1 : 0);
|
||||
}
|
||||
|
||||
conn->state_flags &= ~((unsigned int)ARES_CONN_STATE_CBFLAGS);
|
||||
conn->state_flags |= flags;
|
||||
}
|
||||
|
||||
ares_conn_err_t ares_conn_read(ares_conn_t *conn, void *data, size_t len,
|
||||
size_t *read_bytes)
|
||||
{
|
||||
ares_channel_t *channel = conn->server->channel;
|
||||
ares_conn_err_t err;
|
||||
|
||||
if (!(conn->flags & ARES_CONN_FLAG_TCP)) {
|
||||
struct sockaddr_storage sa_storage;
|
||||
ares_socklen_t salen = sizeof(sa_storage);
|
||||
|
||||
memset(&sa_storage, 0, sizeof(sa_storage));
|
||||
|
||||
err =
|
||||
ares_socket_recvfrom(channel, conn->fd, ARES_FALSE, data, len, 0,
|
||||
(struct sockaddr *)&sa_storage, &salen, read_bytes);
|
||||
|
||||
#ifdef HAVE_RECVFROM
|
||||
if (err == ARES_CONN_ERR_SUCCESS &&
|
||||
!ares_sockaddr_addr_eq((struct sockaddr *)&sa_storage,
|
||||
&conn->server->addr)) {
|
||||
err = ARES_CONN_ERR_WOULDBLOCK;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
err = ares_socket_recv(channel, conn->fd, ARES_TRUE, data, len, read_bytes);
|
||||
}
|
||||
|
||||
/* Toggle connected state if needed */
|
||||
if (err == ARES_CONN_ERR_SUCCESS) {
|
||||
conn->state_flags |= ARES_CONN_STATE_CONNECTED;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Use like:
|
||||
* struct sockaddr_storage sa_storage;
|
||||
* ares_socklen_t salen = sizeof(sa_storage);
|
||||
* struct sockaddr *sa = (struct sockaddr *)&sa_storage;
|
||||
* ares_conn_set_sockaddr(conn, sa, &salen);
|
||||
*/
|
||||
static ares_status_t ares_conn_set_sockaddr(const ares_conn_t *conn,
|
||||
struct sockaddr *sa,
|
||||
ares_socklen_t *salen)
|
||||
{
|
||||
const ares_server_t *server = conn->server;
|
||||
unsigned short port =
|
||||
conn->flags & ARES_CONN_FLAG_TCP ? server->tcp_port : server->udp_port;
|
||||
struct sockaddr_in *sin;
|
||||
struct sockaddr_in6 *sin6;
|
||||
|
||||
switch (server->addr.family) {
|
||||
case AF_INET:
|
||||
sin = (struct sockaddr_in *)(void *)sa;
|
||||
if (*salen < (ares_socklen_t)sizeof(*sin)) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
*salen = sizeof(*sin);
|
||||
memset(sin, 0, sizeof(*sin));
|
||||
sin->sin_family = AF_INET;
|
||||
sin->sin_port = htons(port);
|
||||
memcpy(&sin->sin_addr, &server->addr.addr.addr4, sizeof(sin->sin_addr));
|
||||
return ARES_SUCCESS;
|
||||
case AF_INET6:
|
||||
sin6 = (struct sockaddr_in6 *)(void *)sa;
|
||||
if (*salen < (ares_socklen_t)sizeof(*sin6)) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
*salen = sizeof(*sin6);
|
||||
memset(sin6, 0, sizeof(*sin6));
|
||||
sin6->sin6_family = AF_INET6;
|
||||
sin6->sin6_port = htons(port);
|
||||
memcpy(&sin6->sin6_addr, &server->addr.addr.addr6,
|
||||
sizeof(sin6->sin6_addr));
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
|
||||
sin6->sin6_scope_id = server->ll_scope;
|
||||
#endif
|
||||
return ARES_SUCCESS;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ARES_EBADFAMILY;
|
||||
}
|
||||
|
||||
static ares_status_t ares_conn_set_self_ip(ares_conn_t *conn, ares_bool_t early)
|
||||
{
|
||||
ares_channel_t *channel = conn->server->channel;
|
||||
struct sockaddr_storage sa_storage;
|
||||
int rv;
|
||||
ares_socklen_t len = sizeof(sa_storage);
|
||||
|
||||
/* We call this twice on TFO, if we already have the IP we can go ahead and
|
||||
* skip processing */
|
||||
if (!early && conn->self_ip.family != AF_UNSPEC) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
memset(&sa_storage, 0, sizeof(sa_storage));
|
||||
|
||||
if (channel->sock_funcs.agetsockname == NULL) {
|
||||
/* Not specified, we can still use cookies cooked with an empty self_ip */
|
||||
memset(&conn->self_ip, 0, sizeof(conn->self_ip));
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
rv = channel->sock_funcs.agetsockname(conn->fd,
|
||||
(struct sockaddr *)(void *)&sa_storage,
|
||||
&len, channel->sock_func_cb_data);
|
||||
if (rv != 0) {
|
||||
/* During TCP FastOpen, we can't get the IP this early since connect()
|
||||
* may not be called. That's ok, we'll try again later */
|
||||
if (early && conn->flags & ARES_CONN_FLAG_TCP &&
|
||||
conn->flags & ARES_CONN_FLAG_TFO) {
|
||||
memset(&conn->self_ip, 0, sizeof(conn->self_ip));
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
|
||||
if (!ares_sockaddr_to_ares_addr(&conn->self_ip, NULL,
|
||||
(struct sockaddr *)(void *)&sa_storage)) {
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_conn_err_t ares_conn_write(ares_conn_t *conn, const void *data, size_t len,
|
||||
size_t *written)
|
||||
{
|
||||
ares_channel_t *channel = conn->server->channel;
|
||||
ares_bool_t is_tfo = ARES_FALSE;
|
||||
ares_conn_err_t err = ARES_CONN_ERR_SUCCESS;
|
||||
struct sockaddr_storage sa_storage;
|
||||
ares_socklen_t salen = 0;
|
||||
struct sockaddr *sa = NULL;
|
||||
|
||||
*written = 0;
|
||||
|
||||
/* Don't try to write if not doing initial TFO and not connected */
|
||||
if (conn->flags & ARES_CONN_FLAG_TCP &&
|
||||
!(conn->state_flags & ARES_CONN_STATE_CONNECTED) &&
|
||||
!(conn->flags & ARES_CONN_FLAG_TFO_INITIAL)) {
|
||||
return ARES_CONN_ERR_WOULDBLOCK;
|
||||
}
|
||||
|
||||
/* On initial write during TFO we need to send an address */
|
||||
if (conn->flags & ARES_CONN_FLAG_TFO_INITIAL) {
|
||||
salen = sizeof(sa_storage);
|
||||
sa = (struct sockaddr *)&sa_storage;
|
||||
|
||||
conn->flags &= ~((unsigned int)ARES_CONN_FLAG_TFO_INITIAL);
|
||||
is_tfo = ARES_TRUE;
|
||||
|
||||
if (ares_conn_set_sockaddr(conn, sa, &salen) != ARES_SUCCESS) {
|
||||
return ARES_CONN_ERR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
err = ares_socket_write(channel, conn->fd, data, len, written, sa, salen);
|
||||
if (err != ARES_CONN_ERR_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (is_tfo) {
|
||||
/* If using TFO, we might not have been able to get an IP earlier, since
|
||||
* we hadn't informed the OS of the destination. When using sendto()
|
||||
* now we have so we should be able to fetch it */
|
||||
ares_conn_set_self_ip(conn, ARES_FALSE);
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
if (err == ARES_CONN_ERR_SUCCESS && len == *written) {
|
||||
/* Wrote all data, make sure we're not listening for write events unless
|
||||
* using TFO, in which case we'll need a write event to know when
|
||||
* we're connected. */
|
||||
ares_conn_sock_state_cb_update(
|
||||
conn, ARES_CONN_STATE_READ |
|
||||
(is_tfo ? ARES_CONN_STATE_WRITE : ARES_CONN_STATE_NONE));
|
||||
} else if (err == ARES_CONN_ERR_WOULDBLOCK) {
|
||||
/* Need to wait on more buffer space to write */
|
||||
ares_conn_sock_state_cb_update(conn, ARES_CONN_STATE_READ |
|
||||
ARES_CONN_STATE_WRITE);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
ares_status_t ares_conn_flush(ares_conn_t *conn)
|
||||
{
|
||||
const unsigned char *data;
|
||||
size_t data_len;
|
||||
size_t count;
|
||||
ares_conn_err_t err;
|
||||
ares_status_t status;
|
||||
ares_bool_t tfo = ARES_FALSE;
|
||||
|
||||
if (conn == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
if (conn->flags & ARES_CONN_FLAG_TFO_INITIAL) {
|
||||
tfo = ARES_TRUE;
|
||||
}
|
||||
|
||||
do {
|
||||
if (ares_buf_len(conn->out_buf) == 0) {
|
||||
status = ARES_SUCCESS;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (conn->flags & ARES_CONN_FLAG_TCP) {
|
||||
data = ares_buf_peek(conn->out_buf, &data_len);
|
||||
} else {
|
||||
unsigned short msg_len;
|
||||
|
||||
/* Read length, then provide buffer without length */
|
||||
ares_buf_tag(conn->out_buf);
|
||||
status = ares_buf_fetch_be16(conn->out_buf, &msg_len);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
ares_buf_tag_rollback(conn->out_buf);
|
||||
|
||||
data = ares_buf_peek(conn->out_buf, &data_len);
|
||||
if (data_len < (size_t)(msg_len + 2)) {
|
||||
status = ARES_EFORMERR;
|
||||
goto done;
|
||||
}
|
||||
data += 2;
|
||||
data_len = msg_len;
|
||||
}
|
||||
|
||||
err = ares_conn_write(conn, data, data_len, &count);
|
||||
if (err != ARES_CONN_ERR_SUCCESS) {
|
||||
if (err != ARES_CONN_ERR_WOULDBLOCK) {
|
||||
status = ARES_ECONNREFUSED;
|
||||
goto done;
|
||||
}
|
||||
status = ARES_SUCCESS;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* UDP didn't send the length prefix so augment that here */
|
||||
if (!(conn->flags & ARES_CONN_FLAG_TCP)) {
|
||||
count += 2;
|
||||
}
|
||||
|
||||
/* Strip data written from the buffer */
|
||||
ares_buf_consume(conn->out_buf, count);
|
||||
status = ARES_SUCCESS;
|
||||
|
||||
/* Loop only for UDP since we have to send per-packet. We already
|
||||
* sent everything we could if using tcp */
|
||||
} while (!(conn->flags & ARES_CONN_FLAG_TCP));
|
||||
|
||||
done:
|
||||
if (status == ARES_SUCCESS) {
|
||||
ares_conn_state_flags_t flags = ARES_CONN_STATE_READ;
|
||||
|
||||
/* When using TFO, the we need to enabling waiting on a write event to
|
||||
* be notified of when a connection is actually established */
|
||||
if (tfo) {
|
||||
flags |= ARES_CONN_STATE_WRITE;
|
||||
}
|
||||
|
||||
/* If using TCP and not all data was written (partial write), that means
|
||||
* we need to also wait on a write event */
|
||||
if (conn->flags & ARES_CONN_FLAG_TCP && ares_buf_len(conn->out_buf)) {
|
||||
flags |= ARES_CONN_STATE_WRITE;
|
||||
}
|
||||
|
||||
ares_conn_sock_state_cb_update(conn, flags);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static ares_status_t ares_conn_connect(ares_conn_t *conn,
|
||||
const struct sockaddr *sa,
|
||||
ares_socklen_t salen)
|
||||
{
|
||||
ares_conn_err_t err;
|
||||
|
||||
err = ares_socket_connect(
|
||||
conn->server->channel, conn->fd,
|
||||
(conn->flags & ARES_CONN_FLAG_TFO) ? ARES_TRUE : ARES_FALSE, sa, salen);
|
||||
|
||||
if (err != ARES_CONN_ERR_WOULDBLOCK && err != ARES_CONN_ERR_SUCCESS) {
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares_open_connection(ares_conn_t **conn_out,
|
||||
ares_channel_t *channel,
|
||||
ares_server_t *server, ares_bool_t is_tcp)
|
||||
{
|
||||
ares_status_t status;
|
||||
struct sockaddr_storage sa_storage;
|
||||
ares_socklen_t salen = sizeof(sa_storage);
|
||||
struct sockaddr *sa = (struct sockaddr *)&sa_storage;
|
||||
ares_conn_t *conn;
|
||||
ares_llist_node_t *node = NULL;
|
||||
int stype = is_tcp ? SOCK_STREAM : SOCK_DGRAM;
|
||||
ares_conn_state_flags_t state_flags;
|
||||
|
||||
*conn_out = NULL;
|
||||
|
||||
conn = ares_malloc(sizeof(*conn));
|
||||
if (conn == NULL) {
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
memset(conn, 0, sizeof(*conn));
|
||||
conn->fd = ARES_SOCKET_BAD;
|
||||
conn->server = server;
|
||||
conn->queries_to_conn = ares_llist_create(NULL);
|
||||
conn->flags = is_tcp ? ARES_CONN_FLAG_TCP : ARES_CONN_FLAG_NONE;
|
||||
conn->out_buf = ares_buf_create();
|
||||
conn->in_buf = ares_buf_create();
|
||||
|
||||
if (conn->queries_to_conn == NULL || conn->out_buf == NULL ||
|
||||
conn->in_buf == NULL) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* Try to enable TFO always if using TCP. it will fail later on if its
|
||||
* really not supported when we try to enable it on the socket. */
|
||||
if (conn->flags & ARES_CONN_FLAG_TCP) {
|
||||
conn->flags |= ARES_CONN_FLAG_TFO;
|
||||
}
|
||||
|
||||
/* Convert into the struct sockaddr structure needed by the OS */
|
||||
status = ares_conn_set_sockaddr(conn, sa, &salen);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Acquire a socket. */
|
||||
if (ares_socket_open(&conn->fd, channel, server->addr.family, stype, 0) !=
|
||||
ARES_CONN_ERR_SUCCESS) {
|
||||
status = ARES_ECONNREFUSED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Configure channel configured options */
|
||||
status = ares_socket_configure(
|
||||
channel, server->addr.family,
|
||||
(conn->flags & ARES_CONN_FLAG_TCP) ? ARES_TRUE : ARES_FALSE, conn->fd);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Enable TFO if possible */
|
||||
if (conn->flags & ARES_CONN_FLAG_TFO &&
|
||||
ares_socket_enable_tfo(channel, conn->fd) != ARES_CONN_ERR_SUCCESS) {
|
||||
conn->flags &= ~((unsigned int)ARES_CONN_FLAG_TFO);
|
||||
}
|
||||
|
||||
if (channel->sock_config_cb) {
|
||||
int err =
|
||||
channel->sock_config_cb(conn->fd, stype, channel->sock_config_cb_data);
|
||||
if (err < 0) {
|
||||
status = ARES_ECONNREFUSED;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Connect */
|
||||
status = ares_conn_connect(conn, sa, salen);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (channel->sock_create_cb) {
|
||||
int err =
|
||||
channel->sock_create_cb(conn->fd, stype, channel->sock_create_cb_data);
|
||||
if (err < 0) {
|
||||
status = ARES_ECONNREFUSED;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Let the connection know we haven't written our first packet yet for TFO */
|
||||
if (conn->flags & ARES_CONN_FLAG_TFO) {
|
||||
conn->flags |= ARES_CONN_FLAG_TFO_INITIAL;
|
||||
}
|
||||
|
||||
/* Need to store our own ip for DNS cookie support */
|
||||
status = ares_conn_set_self_ip(conn, ARES_TRUE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
/* TCP connections are thrown to the end as we don't spawn multiple TCP
|
||||
* connections. UDP connections are put on front where the newest connection
|
||||
* can be quickly pulled */
|
||||
if (is_tcp) {
|
||||
node = ares_llist_insert_last(server->connections, conn);
|
||||
} else {
|
||||
node = ares_llist_insert_first(server->connections, conn);
|
||||
}
|
||||
if (node == NULL) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* Register globally to quickly map event on file descriptor to connection
|
||||
* node object */
|
||||
if (!ares_htable_asvp_insert(channel->connnode_by_socket, conn->fd, node)) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
state_flags = ARES_CONN_STATE_READ;
|
||||
|
||||
/* Get notified on connect if using TCP */
|
||||
if (conn->flags & ARES_CONN_FLAG_TCP) {
|
||||
state_flags |= ARES_CONN_STATE_WRITE;
|
||||
}
|
||||
|
||||
/* Dot no attempt to update sock state callbacks on TFO until *after* the
|
||||
* initial write is performed. Due to the notification event, its possible
|
||||
* an erroneous read can come in before the attempt to write the data which
|
||||
* might be used to set the ip address */
|
||||
if (!(conn->flags & ARES_CONN_FLAG_TFO_INITIAL)) {
|
||||
ares_conn_sock_state_cb_update(conn, state_flags);
|
||||
}
|
||||
|
||||
if (is_tcp) {
|
||||
server->tcp_conn = conn;
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares_llist_node_claim(node);
|
||||
ares_llist_destroy(conn->queries_to_conn);
|
||||
ares_socket_close(channel, conn->fd);
|
||||
ares_buf_destroy(conn->out_buf);
|
||||
ares_buf_destroy(conn->in_buf);
|
||||
ares_free(conn);
|
||||
} else {
|
||||
*conn_out = conn;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_conn_t *ares_conn_from_fd(const ares_channel_t *channel, ares_socket_t fd)
|
||||
{
|
||||
ares_llist_node_t *node;
|
||||
|
||||
node = ares_htable_asvp_get_direct(channel->connnode_by_socket, fd);
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ares_llist_node_val(node);
|
||||
}
|
||||
196
deps/cares/src/lib/ares_conn.h
vendored
Normal file
196
deps/cares/src/lib/ares_conn.h
vendored
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Brad House
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#ifndef __ARES_CONN_H
|
||||
#define __ARES_CONN_H
|
||||
|
||||
#include "ares_socket.h"
|
||||
|
||||
struct ares_conn;
|
||||
typedef struct ares_conn ares_conn_t;
|
||||
|
||||
struct ares_server;
|
||||
typedef struct ares_server ares_server_t;
|
||||
|
||||
typedef enum {
|
||||
/*! No flags */
|
||||
ARES_CONN_FLAG_NONE = 0,
|
||||
/*! TCP connection, not UDP */
|
||||
ARES_CONN_FLAG_TCP = 1 << 0,
|
||||
/*! TCP Fast Open is enabled and being used if supported by the OS */
|
||||
ARES_CONN_FLAG_TFO = 1 << 1,
|
||||
/*! TCP Fast Open has not yet sent its first packet. Gets unset on first
|
||||
* write to a connection */
|
||||
ARES_CONN_FLAG_TFO_INITIAL = 1 << 2
|
||||
} ares_conn_flags_t;
|
||||
|
||||
typedef enum {
|
||||
ARES_CONN_STATE_NONE = 0,
|
||||
ARES_CONN_STATE_READ = 1 << 0,
|
||||
ARES_CONN_STATE_WRITE = 1 << 1,
|
||||
ARES_CONN_STATE_CONNECTED = 1 << 2, /* This doesn't get a callback */
|
||||
ARES_CONN_STATE_CBFLAGS = ARES_CONN_STATE_READ | ARES_CONN_STATE_WRITE
|
||||
} ares_conn_state_flags_t;
|
||||
|
||||
struct ares_conn {
|
||||
ares_server_t *server;
|
||||
ares_socket_t fd;
|
||||
struct ares_addr self_ip;
|
||||
ares_conn_flags_t flags;
|
||||
ares_conn_state_flags_t state_flags;
|
||||
|
||||
/*! Outbound buffered data that is not yet sent. Exists as one contiguous
|
||||
* stream in TCP format (big endian 16bit length prefix followed by DNS
|
||||
* wire-format message). For TCP this can be sent as-is, UDP this must
|
||||
* be sent per-packet (stripping the length prefix) */
|
||||
ares_buf_t *out_buf;
|
||||
|
||||
/*! Inbound buffered data that is not yet parsed. Exists as one contiguous
|
||||
* stream in TCP format (big endian 16bit length prefix followed by DNS
|
||||
* wire-format message). TCP may have partial data and this needs to be
|
||||
* handled gracefully, but UDP will always have a full message */
|
||||
ares_buf_t *in_buf;
|
||||
|
||||
/* total number of queries run on this connection since it was established */
|
||||
size_t total_queries;
|
||||
|
||||
/* list of outstanding queries to this connection */
|
||||
ares_llist_t *queries_to_conn;
|
||||
};
|
||||
|
||||
/*! Various buckets for grouping history */
|
||||
typedef enum {
|
||||
ARES_METRIC_1MINUTE = 0, /*!< Bucket for tracking over the last minute */
|
||||
ARES_METRIC_15MINUTES, /*!< Bucket for tracking over the last 15 minutes */
|
||||
ARES_METRIC_1HOUR, /*!< Bucket for tracking over the last hour */
|
||||
ARES_METRIC_1DAY, /*!< Bucket for tracking over the last day */
|
||||
ARES_METRIC_INCEPTION, /*!< Bucket for tracking since inception */
|
||||
ARES_METRIC_COUNT /*!< Count of buckets, not a real bucket */
|
||||
} ares_server_bucket_t;
|
||||
|
||||
/*! Data metrics collected for each bucket */
|
||||
typedef struct {
|
||||
time_t ts; /*!< Timestamp divided by bucket divisor */
|
||||
unsigned int latency_min_ms; /*!< Minimum latency for queries */
|
||||
unsigned int latency_max_ms; /*!< Maximum latency for queries */
|
||||
ares_uint64_t total_ms; /*!< Cumulative query time for bucket */
|
||||
ares_uint64_t total_count; /*!< Number of queries for bucket */
|
||||
|
||||
time_t prev_ts; /*!< Previous period bucket timestamp */
|
||||
ares_uint64_t
|
||||
prev_total_ms; /*!< Previous period bucket cumulative query time */
|
||||
ares_uint64_t prev_total_count; /*!< Previous period bucket query count */
|
||||
} ares_server_metrics_t;
|
||||
|
||||
typedef enum {
|
||||
ARES_COOKIE_INITIAL = 0,
|
||||
ARES_COOKIE_GENERATED = 1,
|
||||
ARES_COOKIE_SUPPORTED = 2,
|
||||
ARES_COOKIE_UNSUPPORTED = 3
|
||||
} ares_cookie_state_t;
|
||||
|
||||
/*! Structure holding tracking data for RFC 7873/9018 DNS cookies.
|
||||
* Implementation plan for this feature is here:
|
||||
* https://github.com/c-ares/c-ares/issues/620
|
||||
*/
|
||||
typedef struct {
|
||||
/*! starts at INITIAL, transitions as needed. */
|
||||
ares_cookie_state_t state;
|
||||
/*! randomly-generate client cookie */
|
||||
unsigned char client[8];
|
||||
/*! timestamp client cookie was generated, used for rotation purposes */
|
||||
ares_timeval_t client_ts;
|
||||
/*! IP address last used for client to connect to server. If this changes
|
||||
* The client cookie gets invalidated */
|
||||
struct ares_addr client_ip;
|
||||
/*! Server Cookie last received, 8-32 bytes in length */
|
||||
unsigned char server[32];
|
||||
/*! Length of server cookie on file. */
|
||||
size_t server_len;
|
||||
/*! Timestamp of last attempt to use cookies, but it was determined that the
|
||||
* server didn't support them */
|
||||
ares_timeval_t unsupported_ts;
|
||||
} ares_cookie_t;
|
||||
|
||||
struct ares_server {
|
||||
/* Configuration */
|
||||
size_t idx; /* index for server in system configuration */
|
||||
struct ares_addr addr;
|
||||
unsigned short udp_port; /* host byte order */
|
||||
unsigned short tcp_port; /* host byte order */
|
||||
char ll_iface[64]; /* IPv6 Link Local Interface */
|
||||
unsigned int ll_scope; /* IPv6 Link Local Scope */
|
||||
|
||||
size_t consec_failures; /* Consecutive query failure count
|
||||
* can be hard errors or timeouts
|
||||
*/
|
||||
ares_bool_t probe_pending; /* Whether a probe is pending for this
|
||||
* server due to prior failures */
|
||||
ares_llist_t *connections;
|
||||
ares_conn_t *tcp_conn;
|
||||
|
||||
/* The next time when we will retry this server if it has hit failures */
|
||||
ares_timeval_t next_retry_time;
|
||||
|
||||
/*! Buckets for collecting metrics about the server */
|
||||
ares_server_metrics_t metrics[ARES_METRIC_COUNT];
|
||||
|
||||
/*! RFC 7873/9018 DNS Cookies */
|
||||
ares_cookie_t cookie;
|
||||
|
||||
/* Link back to owning channel */
|
||||
ares_channel_t *channel;
|
||||
};
|
||||
|
||||
void ares_close_connection(ares_conn_t *conn, ares_status_t requeue_status);
|
||||
void ares_close_sockets(ares_server_t *server);
|
||||
void ares_check_cleanup_conns(const ares_channel_t *channel);
|
||||
|
||||
void ares_destroy_servers_state(ares_channel_t *channel);
|
||||
ares_status_t ares_open_connection(ares_conn_t **conn_out,
|
||||
ares_channel_t *channel,
|
||||
ares_server_t *server, ares_bool_t is_tcp);
|
||||
|
||||
ares_conn_err_t ares_conn_write(ares_conn_t *conn, const void *data, size_t len,
|
||||
size_t *written);
|
||||
ares_status_t ares_conn_flush(ares_conn_t *conn);
|
||||
ares_conn_err_t ares_conn_read(ares_conn_t *conn, void *data, size_t len,
|
||||
size_t *read_bytes);
|
||||
ares_conn_t *ares_conn_from_fd(const ares_channel_t *channel, ares_socket_t fd);
|
||||
void ares_conn_sock_state_cb_update(ares_conn_t *conn,
|
||||
ares_conn_state_flags_t flags);
|
||||
ares_conn_err_t ares_socket_recv(ares_channel_t *channel, ares_socket_t s,
|
||||
ares_bool_t is_tcp, void *data,
|
||||
size_t data_len, size_t *read_bytes);
|
||||
ares_conn_err_t ares_socket_recvfrom(ares_channel_t *channel, ares_socket_t s,
|
||||
ares_bool_t is_tcp, void *data,
|
||||
size_t data_len, int flags,
|
||||
struct sockaddr *from,
|
||||
ares_socklen_t *from_len,
|
||||
size_t *read_bytes);
|
||||
|
||||
void ares_destroy_server(ares_server_t *server);
|
||||
|
||||
#endif
|
||||
9
deps/cares/src/lib/ares_cookie.c
vendored
9
deps/cares/src/lib/ares_cookie.c
vendored
|
|
@ -229,7 +229,7 @@ static ares_bool_t timeval_expired(const ares_timeval_t *tv,
|
|||
{
|
||||
ares_int64_t tvdiff_ms;
|
||||
ares_timeval_t tvdiff;
|
||||
ares__timeval_diff(&tvdiff, tv, now);
|
||||
ares_timeval_diff(&tvdiff, tv, now);
|
||||
|
||||
tvdiff_ms = tvdiff.sec * 1000 + tvdiff.usec / 1000;
|
||||
if (tvdiff_ms >= (ares_int64_t)millsecs) {
|
||||
|
|
@ -249,7 +249,7 @@ static void ares_cookie_generate(ares_cookie_t *cookie, ares_conn_t *conn,
|
|||
{
|
||||
ares_channel_t *channel = conn->server->channel;
|
||||
|
||||
ares__rand_bytes(channel->rand_state, cookie->client, sizeof(cookie->client));
|
||||
ares_rand_bytes(channel->rand_state, cookie->client, sizeof(cookie->client));
|
||||
memcpy(&cookie->client_ts, now, sizeof(cookie->client_ts));
|
||||
memcpy(&cookie->client_ip, &conn->self_ip, sizeof(cookie->client_ip));
|
||||
}
|
||||
|
|
@ -426,9 +426,8 @@ ares_status_t ares_cookie_validate(ares_query_t *query,
|
|||
|
||||
/* Resend the request, hopefully it will work the next time as we should
|
||||
* have recorded a server cookie */
|
||||
ares__requeue_query(query, now, ARES_SUCCESS,
|
||||
ARES_FALSE /* Don't increment try count */,
|
||||
NULL);
|
||||
ares_requeue_query(query, now, ARES_SUCCESS,
|
||||
ARES_FALSE /* Don't increment try count */, NULL);
|
||||
|
||||
/* Parent needs to drop this response */
|
||||
return ARES_EBADRESP;
|
||||
|
|
|
|||
68
deps/cares/src/lib/ares_destroy.c
vendored
68
deps/cares/src/lib/ares_destroy.c
vendored
|
|
@ -31,17 +31,17 @@
|
|||
|
||||
void ares_destroy(ares_channel_t *channel)
|
||||
{
|
||||
size_t i;
|
||||
ares__llist_node_t *node = NULL;
|
||||
size_t i;
|
||||
ares_llist_node_t *node = NULL;
|
||||
|
||||
if (channel == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Mark as being shutdown */
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
channel->sys_up = ARES_FALSE;
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
/* Disable configuration change monitoring. We can't hold a lock because
|
||||
* some cleanup routines, such as on Windows, are synchronous operations.
|
||||
|
|
@ -61,23 +61,23 @@ void ares_destroy(ares_channel_t *channel)
|
|||
* holding a lock as the thread may take locks. */
|
||||
if (channel->reinit_thread != NULL) {
|
||||
void *rv;
|
||||
ares__thread_join(channel->reinit_thread, &rv);
|
||||
ares_thread_join(channel->reinit_thread, &rv);
|
||||
channel->reinit_thread = NULL;
|
||||
}
|
||||
|
||||
/* Lock because callbacks will be triggered, and any system-generated
|
||||
* callbacks need to hold a channel lock. */
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
/* Destroy all queries */
|
||||
node = ares__llist_node_first(channel->all_queries);
|
||||
node = ares_llist_node_first(channel->all_queries);
|
||||
while (node != NULL) {
|
||||
ares__llist_node_t *next = ares__llist_node_next(node);
|
||||
ares_query_t *query = ares__llist_node_claim(node);
|
||||
ares_llist_node_t *next = ares_llist_node_next(node);
|
||||
ares_query_t *query = ares_llist_node_claim(node);
|
||||
|
||||
query->node_all_queries = NULL;
|
||||
query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL);
|
||||
ares__free_query(query);
|
||||
ares_free_query(query);
|
||||
|
||||
node = next;
|
||||
}
|
||||
|
|
@ -88,19 +88,19 @@ void ares_destroy(ares_channel_t *channel)
|
|||
/* Freeing the query should remove it from all the lists in which it sits,
|
||||
* so all query lists should be empty now.
|
||||
*/
|
||||
assert(ares__llist_len(channel->all_queries) == 0);
|
||||
assert(ares__htable_szvp_num_keys(channel->queries_by_qid) == 0);
|
||||
assert(ares__slist_len(channel->queries_by_timeout) == 0);
|
||||
assert(ares_llist_len(channel->all_queries) == 0);
|
||||
assert(ares_htable_szvp_num_keys(channel->queries_by_qid) == 0);
|
||||
assert(ares_slist_len(channel->queries_by_timeout) == 0);
|
||||
#endif
|
||||
|
||||
ares__destroy_servers_state(channel);
|
||||
ares_destroy_servers_state(channel);
|
||||
|
||||
#ifndef NDEBUG
|
||||
assert(ares__htable_asvp_num_keys(channel->connnode_by_socket) == 0);
|
||||
assert(ares_htable_asvp_num_keys(channel->connnode_by_socket) == 0);
|
||||
#endif
|
||||
|
||||
/* No more callbacks will be triggered after this point, unlock */
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
/* Shut down the event thread */
|
||||
if (channel->optmask & ARES_OPT_EVENT_THREAD) {
|
||||
|
|
@ -114,48 +114,46 @@ void ares_destroy(ares_channel_t *channel)
|
|||
ares_free(channel->domains);
|
||||
}
|
||||
|
||||
ares__llist_destroy(channel->all_queries);
|
||||
ares__slist_destroy(channel->queries_by_timeout);
|
||||
ares__htable_szvp_destroy(channel->queries_by_qid);
|
||||
ares__htable_asvp_destroy(channel->connnode_by_socket);
|
||||
ares_llist_destroy(channel->all_queries);
|
||||
ares_slist_destroy(channel->queries_by_timeout);
|
||||
ares_htable_szvp_destroy(channel->queries_by_qid);
|
||||
ares_htable_asvp_destroy(channel->connnode_by_socket);
|
||||
|
||||
ares_free(channel->sortlist);
|
||||
ares_free(channel->lookups);
|
||||
ares_free(channel->resolvconf_path);
|
||||
ares_free(channel->hosts_path);
|
||||
ares__destroy_rand_state(channel->rand_state);
|
||||
ares_destroy_rand_state(channel->rand_state);
|
||||
|
||||
ares__hosts_file_destroy(channel->hf);
|
||||
ares_hosts_file_destroy(channel->hf);
|
||||
|
||||
ares__qcache_destroy(channel->qcache);
|
||||
ares_qcache_destroy(channel->qcache);
|
||||
|
||||
ares__channel_threading_destroy(channel);
|
||||
ares_channel_threading_destroy(channel);
|
||||
|
||||
ares_free(channel);
|
||||
}
|
||||
|
||||
void ares__destroy_server(ares_server_t *server)
|
||||
void ares_destroy_server(ares_server_t *server)
|
||||
{
|
||||
if (server == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares__close_sockets(server);
|
||||
ares__llist_destroy(server->connections);
|
||||
ares__buf_destroy(server->tcp_parser);
|
||||
ares__buf_destroy(server->tcp_send);
|
||||
ares_close_sockets(server);
|
||||
ares_llist_destroy(server->connections);
|
||||
ares_free(server);
|
||||
}
|
||||
|
||||
void ares__destroy_servers_state(ares_channel_t *channel)
|
||||
void ares_destroy_servers_state(ares_channel_t *channel)
|
||||
{
|
||||
ares__slist_node_t *node;
|
||||
ares_slist_node_t *node;
|
||||
|
||||
while ((node = ares__slist_node_first(channel->servers)) != NULL) {
|
||||
ares_server_t *server = ares__slist_node_claim(node);
|
||||
ares__destroy_server(server);
|
||||
while ((node = ares_slist_node_first(channel->servers)) != NULL) {
|
||||
ares_server_t *server = ares_slist_node_claim(node);
|
||||
ares_destroy_server(server);
|
||||
}
|
||||
|
||||
ares__slist_destroy(channel->servers);
|
||||
ares_slist_destroy(channel->servers);
|
||||
channel->servers = NULL;
|
||||
}
|
||||
|
|
|
|||
8
deps/cares/src/lib/ares_freeaddrinfo.c
vendored
8
deps/cares/src/lib/ares_freeaddrinfo.c
vendored
|
|
@ -31,7 +31,7 @@
|
|||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
void ares__freeaddrinfo_cnames(struct ares_addrinfo_cname *head)
|
||||
void ares_freeaddrinfo_cnames(struct ares_addrinfo_cname *head)
|
||||
{
|
||||
struct ares_addrinfo_cname *current;
|
||||
while (head) {
|
||||
|
|
@ -43,7 +43,7 @@ void ares__freeaddrinfo_cnames(struct ares_addrinfo_cname *head)
|
|||
}
|
||||
}
|
||||
|
||||
void ares__freeaddrinfo_nodes(struct ares_addrinfo_node *head)
|
||||
void ares_freeaddrinfo_nodes(struct ares_addrinfo_node *head)
|
||||
{
|
||||
struct ares_addrinfo_node *current;
|
||||
while (head) {
|
||||
|
|
@ -59,8 +59,8 @@ void ares_freeaddrinfo(struct ares_addrinfo *ai)
|
|||
if (ai == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__freeaddrinfo_cnames(ai->cnames);
|
||||
ares__freeaddrinfo_nodes(ai->nodes);
|
||||
ares_freeaddrinfo_cnames(ai->cnames);
|
||||
ares_freeaddrinfo_nodes(ai->nodes);
|
||||
|
||||
ares_free(ai->name);
|
||||
ares_free(ai);
|
||||
|
|
|
|||
64
deps/cares/src/lib/ares_getaddrinfo.c
vendored
64
deps/cares/src/lib/ares_getaddrinfo.c
vendored
|
|
@ -58,10 +58,6 @@
|
|||
|
||||
#include "ares_dns.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# include "ares_platform.h"
|
||||
#endif
|
||||
|
||||
struct host_query {
|
||||
ares_channel_t *channel;
|
||||
char *name;
|
||||
|
|
@ -101,7 +97,7 @@ static const struct ares_addrinfo_hints default_hints = {
|
|||
static ares_bool_t next_dns_lookup(struct host_query *hquery);
|
||||
|
||||
struct ares_addrinfo_cname *
|
||||
ares__append_addrinfo_cname(struct ares_addrinfo_cname **head)
|
||||
ares_append_addrinfo_cname(struct ares_addrinfo_cname **head)
|
||||
{
|
||||
struct ares_addrinfo_cname *tail = ares_malloc_zero(sizeof(*tail));
|
||||
struct ares_addrinfo_cname *last = *head;
|
||||
|
|
@ -123,8 +119,8 @@ struct ares_addrinfo_cname *
|
|||
return tail;
|
||||
}
|
||||
|
||||
void ares__addrinfo_cat_cnames(struct ares_addrinfo_cname **head,
|
||||
struct ares_addrinfo_cname *tail)
|
||||
void ares_addrinfo_cat_cnames(struct ares_addrinfo_cname **head,
|
||||
struct ares_addrinfo_cname *tail)
|
||||
{
|
||||
struct ares_addrinfo_cname *last = *head;
|
||||
if (!last) {
|
||||
|
|
@ -141,7 +137,7 @@ void ares__addrinfo_cat_cnames(struct ares_addrinfo_cname **head,
|
|||
|
||||
/* Allocate new addrinfo and append to the tail. */
|
||||
struct ares_addrinfo_node *
|
||||
ares__append_addrinfo_node(struct ares_addrinfo_node **head)
|
||||
ares_append_addrinfo_node(struct ares_addrinfo_node **head)
|
||||
{
|
||||
struct ares_addrinfo_node *tail = ares_malloc_zero(sizeof(*tail));
|
||||
struct ares_addrinfo_node *last = *head;
|
||||
|
|
@ -163,8 +159,8 @@ struct ares_addrinfo_node *
|
|||
return tail;
|
||||
}
|
||||
|
||||
void ares__addrinfo_cat_nodes(struct ares_addrinfo_node **head,
|
||||
struct ares_addrinfo_node *tail)
|
||||
void ares_addrinfo_cat_nodes(struct ares_addrinfo_node **head,
|
||||
struct ares_addrinfo_node *tail)
|
||||
{
|
||||
struct ares_addrinfo_node *last = *head;
|
||||
if (!last) {
|
||||
|
|
@ -252,7 +248,7 @@ static ares_bool_t fake_addrinfo(const char *name, unsigned short port,
|
|||
ares_bool_t valid = ARES_TRUE;
|
||||
const char *p;
|
||||
for (p = name; *p; p++) {
|
||||
if (!ares__isdigit(*p) && *p != '.') {
|
||||
if (!ares_isdigit(*p) && *p != '.') {
|
||||
valid = ARES_FALSE;
|
||||
break;
|
||||
} else if (*p == '.') {
|
||||
|
|
@ -297,7 +293,7 @@ static ares_bool_t fake_addrinfo(const char *name, unsigned short port,
|
|||
}
|
||||
|
||||
if (hints->ai_flags & ARES_AI_CANONNAME) {
|
||||
cname = ares__append_addrinfo_cname(&ai->cnames);
|
||||
cname = ares_append_addrinfo_cname(&ai->cnames);
|
||||
if (!cname) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
ares_freeaddrinfo(ai);
|
||||
|
|
@ -327,7 +323,7 @@ static void hquery_free(struct host_query *hquery, ares_bool_t cleanup_ai)
|
|||
if (cleanup_ai) {
|
||||
ares_freeaddrinfo(hquery->ai);
|
||||
}
|
||||
ares__strsplit_free(hquery->names, hquery->names_cnt);
|
||||
ares_strsplit_free(hquery->names, hquery->names_cnt);
|
||||
ares_free(hquery->name);
|
||||
ares_free(hquery->lookups);
|
||||
ares_free(hquery);
|
||||
|
|
@ -341,7 +337,7 @@ static void end_hquery(struct host_query *hquery, ares_status_t status)
|
|||
if (status == ARES_SUCCESS) {
|
||||
if (!(hquery->hints.ai_flags & ARES_AI_NOSORT) && hquery->ai->nodes) {
|
||||
sentinel.ai_next = hquery->ai->nodes;
|
||||
ares__sortaddrinfo(hquery->channel, &sentinel);
|
||||
ares_sortaddrinfo(hquery->channel, &sentinel);
|
||||
hquery->ai->nodes = sentinel.ai_next;
|
||||
}
|
||||
next = hquery->ai->nodes;
|
||||
|
|
@ -361,7 +357,7 @@ static void end_hquery(struct host_query *hquery, ares_status_t status)
|
|||
hquery_free(hquery, ARES_FALSE);
|
||||
}
|
||||
|
||||
ares_bool_t ares__is_localhost(const char *name)
|
||||
ares_bool_t ares_is_localhost(const char *name)
|
||||
{
|
||||
/* RFC6761 6.3 says : The domain "localhost." and any names falling within
|
||||
* ".localhost." */
|
||||
|
|
@ -371,7 +367,7 @@ ares_bool_t ares__is_localhost(const char *name)
|
|||
return ARES_FALSE; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
if (strcmp(name, "localhost") == 0) {
|
||||
if (ares_strcaseeq(name, "localhost")) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -380,7 +376,8 @@ ares_bool_t ares__is_localhost(const char *name)
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
if (strcmp(name + (len - 10 /* strlen(".localhost") */), ".localhost") == 0) {
|
||||
if (ares_strcaseeq(name + (len - 10 /* strlen(".localhost") */),
|
||||
".localhost")) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -393,11 +390,11 @@ static ares_status_t file_lookup(struct host_query *hquery)
|
|||
ares_status_t status;
|
||||
|
||||
/* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
|
||||
if (ares__is_onion_domain(hquery->name)) {
|
||||
if (ares_is_onion_domain(hquery->name)) {
|
||||
return ARES_ENOTFOUND;
|
||||
}
|
||||
|
||||
status = ares__hosts_search_host(
|
||||
status = ares_hosts_search_host(
|
||||
hquery->channel,
|
||||
(hquery->hints.ai_flags & ARES_AI_ENVHOSTS) ? ARES_TRUE : ARES_FALSE,
|
||||
hquery->name, &entry);
|
||||
|
|
@ -406,7 +403,7 @@ static ares_status_t file_lookup(struct host_query *hquery)
|
|||
goto done;
|
||||
}
|
||||
|
||||
status = ares__hosts_entry_to_addrinfo(
|
||||
status = ares_hosts_entry_to_addrinfo(
|
||||
entry, hquery->name, hquery->hints.ai_family, hquery->port,
|
||||
(hquery->hints.ai_flags & ARES_AI_CANONNAME) ? ARES_TRUE : ARES_FALSE,
|
||||
hquery->ai);
|
||||
|
|
@ -423,9 +420,9 @@ done:
|
|||
* We will also ignore ALL errors when trying to resolve localhost, such
|
||||
* as permissions errors reading /etc/hosts or a malformed /etc/hosts */
|
||||
if (status != ARES_SUCCESS && status != ARES_ENOMEM &&
|
||||
ares__is_localhost(hquery->name)) {
|
||||
return ares__addrinfo_localhost(hquery->name, hquery->port, &hquery->hints,
|
||||
hquery->ai);
|
||||
ares_is_localhost(hquery->name)) {
|
||||
return ares_addrinfo_localhost(hquery->name, hquery->port, &hquery->hints,
|
||||
hquery->ai);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
@ -439,7 +436,7 @@ static void next_lookup(struct host_query *hquery, ares_status_t status)
|
|||
* queries for localhost names to their configured caching DNS
|
||||
* server(s)."
|
||||
* Otherwise, DNS lookup. */
|
||||
if (!ares__is_localhost(hquery->name) && next_dns_lookup(hquery)) {
|
||||
if (!ares_is_localhost(hquery->name) && next_dns_lookup(hquery)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -476,7 +473,7 @@ static void terminate_retries(const struct host_query *hquery,
|
|||
return;
|
||||
}
|
||||
|
||||
query = ares__htable_szvp_get_direct(channel->queries_by_qid, term_qid);
|
||||
query = ares_htable_szvp_get_direct(channel->queries_by_qid, term_qid);
|
||||
if (query == NULL) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -497,7 +494,7 @@ static void host_callback(void *arg, ares_status_t status, size_t timeouts,
|
|||
addinfostatus = ARES_EBADRESP; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
} else {
|
||||
addinfostatus =
|
||||
ares__parse_into_addrinfo(dnsrec, ARES_TRUE, hquery->port, hquery->ai);
|
||||
ares_parse_into_addrinfo(dnsrec, ARES_TRUE, hquery->port, hquery->ai);
|
||||
}
|
||||
if (addinfostatus == ARES_SUCCESS) {
|
||||
terminate_retries(hquery, ares_dns_record_get_id(dnsrec));
|
||||
|
|
@ -528,10 +525,9 @@ static void host_callback(void *arg, ares_status_t status, size_t timeouts,
|
|||
hquery->nodata_cnt++;
|
||||
}
|
||||
next_lookup(hquery, hquery->nodata_cnt ? ARES_ENODATA : status);
|
||||
} else if (
|
||||
(status == ARES_ESERVFAIL || status == ARES_EREFUSED) &&
|
||||
ares__name_label_cnt(hquery->names[hquery->next_name_idx-1]) == 1
|
||||
) {
|
||||
} else if ((status == ARES_ESERVFAIL || status == ARES_EREFUSED) &&
|
||||
ares_name_label_cnt(hquery->names[hquery->next_name_idx - 1]) ==
|
||||
1) {
|
||||
/* Issue #852, systemd-resolved may return SERVFAIL or REFUSED on a
|
||||
* single label domain name. */
|
||||
next_lookup(hquery, hquery->nodata_cnt ? ARES_ENODATA : status);
|
||||
|
|
@ -567,7 +563,7 @@ static void ares_getaddrinfo_int(ares_channel_t *channel, const char *name,
|
|||
return;
|
||||
}
|
||||
|
||||
if (ares__is_onion_domain(name)) {
|
||||
if (ares_is_onion_domain(name)) {
|
||||
callback(arg, ARES_ENOTFOUND, 0, NULL);
|
||||
return;
|
||||
}
|
||||
|
|
@ -630,7 +626,7 @@ static void ares_getaddrinfo_int(ares_channel_t *channel, const char *name,
|
|||
}
|
||||
|
||||
status =
|
||||
ares__search_name_list(channel, name, &hquery->names, &hquery->names_cnt);
|
||||
ares_search_name_list(channel, name, &hquery->names, &hquery->names_cnt);
|
||||
if (status != ARES_SUCCESS) {
|
||||
hquery_free(hquery, ARES_TRUE);
|
||||
callback(arg, (int)status, 0, NULL);
|
||||
|
|
@ -659,9 +655,9 @@ void ares_getaddrinfo(ares_channel_t *channel, const char *name,
|
|||
if (channel == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
ares_getaddrinfo_int(channel, name, service, hints, callback, arg);
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
}
|
||||
|
||||
static ares_bool_t next_dns_lookup(struct host_query *hquery)
|
||||
|
|
|
|||
9
deps/cares/src/lib/ares_gethostbyaddr.c
vendored
9
deps/cares/src/lib/ares_gethostbyaddr.c
vendored
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include "ares_nameser.h"
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
|
||||
struct addr_query {
|
||||
/* Arguments passed to ares_gethostbyaddr() */
|
||||
|
|
@ -112,9 +111,9 @@ void ares_gethostbyaddr(ares_channel_t *channel, const void *addr, int addrlen,
|
|||
if (channel == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
ares_gethostbyaddr_nolock(channel, addr, addrlen, family, callback, arg);
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
}
|
||||
|
||||
static void next_lookup(struct addr_query *aquery)
|
||||
|
|
@ -216,12 +215,12 @@ static ares_status_t file_lookup(ares_channel_t *channel,
|
|||
return ARES_ENOTFOUND;
|
||||
}
|
||||
|
||||
status = ares__hosts_search_ipaddr(channel, ARES_FALSE, ipaddr, &entry);
|
||||
status = ares_hosts_search_ipaddr(channel, ARES_FALSE, ipaddr, &entry);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = ares__hosts_entry_to_hostent(entry, addr->family, host);
|
||||
status = ares_hosts_entry_to_hostent(entry, addr->family, host);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
|
|||
29
deps/cares/src/lib/ares_gethostbyname.c
vendored
29
deps/cares/src/lib/ares_gethostbyname.c
vendored
|
|
@ -44,7 +44,6 @@
|
|||
#endif
|
||||
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
|
||||
static void sort_addresses(const struct hostent *host,
|
||||
const struct apattern *sortlist, size_t nsort);
|
||||
|
|
@ -68,7 +67,7 @@ static void ares_gethostbyname_callback(void *arg, int status, int timeouts,
|
|||
struct host_query *ghbn_arg = arg;
|
||||
|
||||
if (status == ARES_SUCCESS) {
|
||||
status = (int)ares__addrinfo2hostent(result, AF_UNSPEC, &hostent);
|
||||
status = (int)ares_addrinfo2hostent(result, AF_UNSPEC, &hostent);
|
||||
}
|
||||
|
||||
/* addrinfo2hostent will only return ENODATA if there are no addresses _and_
|
||||
|
|
@ -175,7 +174,7 @@ static size_t get_address_index(const struct in_addr *addr,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ares__subnet_match(&aaddr, &sortlist[i].addr, sortlist[i].mask)) {
|
||||
if (ares_subnet_match(&aaddr, &sortlist[i].addr, sortlist[i].mask)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -231,15 +230,15 @@ static size_t get6_address_index(const struct ares_in6_addr *addr,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ares__subnet_match(&aaddr, &sortlist[i].addr, sortlist[i].mask)) {
|
||||
if (ares_subnet_match(&aaddr, &sortlist[i].addr, sortlist[i].mask)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static ares_status_t ares__hostent_localhost(const char *name, int family,
|
||||
struct hostent **host_out)
|
||||
static ares_status_t ares_hostent_localhost(const char *name, int family,
|
||||
struct hostent **host_out)
|
||||
{
|
||||
ares_status_t status;
|
||||
struct ares_addrinfo *ai = NULL;
|
||||
|
|
@ -254,12 +253,12 @@ static ares_status_t ares__hostent_localhost(const char *name, int family,
|
|||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__addrinfo_localhost(name, 0, &hints, ai);
|
||||
status = ares_addrinfo_localhost(name, 0, &hints, ai);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__addrinfo2hostent(ai, family, host_out);
|
||||
status = ares_addrinfo2hostent(ai, family, host_out);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
@ -289,16 +288,16 @@ static ares_status_t ares_gethostbyname_file_int(ares_channel_t *channel,
|
|||
}
|
||||
|
||||
/* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
|
||||
if (ares__is_onion_domain(name)) {
|
||||
if (ares_is_onion_domain(name)) {
|
||||
return ARES_ENOTFOUND;
|
||||
}
|
||||
|
||||
status = ares__hosts_search_host(channel, ARES_FALSE, name, &entry);
|
||||
status = ares_hosts_search_host(channel, ARES_FALSE, name, &entry);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ares__hosts_entry_to_hostent(entry, family, host);
|
||||
status = ares_hosts_entry_to_hostent(entry, family, host);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
@ -310,8 +309,8 @@ done:
|
|||
* We will also ignore ALL errors when trying to resolve localhost, such
|
||||
* as permissions errors reading /etc/hosts or a malformed /etc/hosts */
|
||||
if (status != ARES_SUCCESS && status != ARES_ENOMEM &&
|
||||
ares__is_localhost(name)) {
|
||||
return ares__hostent_localhost(name, family, host);
|
||||
ares_is_localhost(name)) {
|
||||
return ares_hostent_localhost(name, family, host);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
@ -325,8 +324,8 @@ int ares_gethostbyname_file(ares_channel_t *channel, const char *name,
|
|||
return ARES_ENOTFOUND;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
status = ares_gethostbyname_file_int(channel, name, family, host);
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
return (int)status;
|
||||
}
|
||||
|
|
|
|||
10
deps/cares/src/lib/ares_getnameinfo.c
vendored
10
deps/cares/src/lib/ares_getnameinfo.c
vendored
|
|
@ -193,9 +193,9 @@ void ares_getnameinfo(ares_channel_t *channel, const struct sockaddr *sa,
|
|||
return;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
ares_getnameinfo_int(channel, sa, salen, flags_int, callback, arg);
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
}
|
||||
|
||||
static void nameinfo_callback(void *arg, int status, int timeouts,
|
||||
|
|
@ -410,8 +410,8 @@ static char *ares_striendstr(const char *s1, const char *s2)
|
|||
c1 = c1_begin;
|
||||
c2 = s2;
|
||||
while (c2 < s2 + s2_len) {
|
||||
lo1 = ares__tolower((unsigned char)*c1);
|
||||
lo2 = ares__tolower((unsigned char)*c2);
|
||||
lo1 = ares_tolower((unsigned char)*c1);
|
||||
lo2 = ares_tolower((unsigned char)*c2);
|
||||
if (lo1 != lo2) {
|
||||
return NULL;
|
||||
} else {
|
||||
|
|
@ -423,7 +423,7 @@ static char *ares_striendstr(const char *s1, const char *s2)
|
|||
return (char *)((size_t)c1_begin);
|
||||
}
|
||||
|
||||
ares_bool_t ares__is_onion_domain(const char *name)
|
||||
ares_bool_t ares_is_onion_domain(const char *name)
|
||||
{
|
||||
if (ares_striendstr(name, ".onion")) {
|
||||
return ARES_TRUE;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
# include <arpa/inet.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include "ares_platform.h"
|
||||
|
||||
/* HOSTS FILE PROCESSING OVERVIEW
|
||||
* ==============================
|
||||
|
|
@ -78,22 +77,22 @@
|
|||
*/
|
||||
|
||||
struct ares_hosts_file {
|
||||
time_t ts;
|
||||
time_t ts;
|
||||
/*! cache the filename so we know if the filename changes it automatically
|
||||
* invalidates the cache */
|
||||
char *filename;
|
||||
char *filename;
|
||||
/*! iphash is the owner of the 'entry' object as there is only ever a single
|
||||
* match to the object. */
|
||||
ares__htable_strvp_t *iphash;
|
||||
ares_htable_strvp_t *iphash;
|
||||
/*! hosthash does not own the entry so won't free on destruction */
|
||||
ares__htable_strvp_t *hosthash;
|
||||
ares_htable_strvp_t *hosthash;
|
||||
};
|
||||
|
||||
struct ares_hosts_entry {
|
||||
size_t refcnt; /*! If the entry is stored multiple times in the
|
||||
* ip address hash, we have to reference count it */
|
||||
ares__llist_t *ips;
|
||||
ares__llist_t *hosts;
|
||||
size_t refcnt; /*! If the entry is stored multiple times in the
|
||||
* ip address hash, we have to reference count it */
|
||||
ares_llist_t *ips;
|
||||
ares_llist_t *hosts;
|
||||
};
|
||||
|
||||
const void *ares_dns_pton(const char *ipaddr, struct ares_addr *addr,
|
||||
|
|
@ -132,8 +131,8 @@ const void *ares_dns_pton(const char *ipaddr, struct ares_addr *addr,
|
|||
return ptr;
|
||||
}
|
||||
|
||||
static ares_bool_t ares__normalize_ipaddr(const char *ipaddr, char *out,
|
||||
size_t out_len)
|
||||
static ares_bool_t ares_normalize_ipaddr(const char *ipaddr, char *out,
|
||||
size_t out_len)
|
||||
{
|
||||
struct ares_addr data;
|
||||
const void *addr;
|
||||
|
|
@ -154,7 +153,7 @@ static ares_bool_t ares__normalize_ipaddr(const char *ipaddr, char *out,
|
|||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
static void ares__hosts_entry_destroy(ares_hosts_entry_t *entry)
|
||||
static void ares_hosts_entry_destroy(ares_hosts_entry_t *entry)
|
||||
{
|
||||
if (entry == NULL) {
|
||||
return;
|
||||
|
|
@ -169,29 +168,29 @@ static void ares__hosts_entry_destroy(ares_hosts_entry_t *entry)
|
|||
return;
|
||||
}
|
||||
|
||||
ares__llist_destroy(entry->hosts);
|
||||
ares__llist_destroy(entry->ips);
|
||||
ares_llist_destroy(entry->hosts);
|
||||
ares_llist_destroy(entry->ips);
|
||||
ares_free(entry);
|
||||
}
|
||||
|
||||
static void ares__hosts_entry_destroy_cb(void *entry)
|
||||
static void ares_hosts_entry_destroy_cb(void *entry)
|
||||
{
|
||||
ares__hosts_entry_destroy(entry);
|
||||
ares_hosts_entry_destroy(entry);
|
||||
}
|
||||
|
||||
void ares__hosts_file_destroy(ares_hosts_file_t *hf)
|
||||
void ares_hosts_file_destroy(ares_hosts_file_t *hf)
|
||||
{
|
||||
if (hf == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ares_free(hf->filename);
|
||||
ares__htable_strvp_destroy(hf->hosthash);
|
||||
ares__htable_strvp_destroy(hf->iphash);
|
||||
ares_htable_strvp_destroy(hf->hosthash);
|
||||
ares_htable_strvp_destroy(hf->iphash);
|
||||
ares_free(hf);
|
||||
}
|
||||
|
||||
static ares_hosts_file_t *ares__hosts_file_create(const char *filename)
|
||||
static ares_hosts_file_t *ares_hosts_file_create(const char *filename)
|
||||
{
|
||||
ares_hosts_file_t *hf = ares_malloc_zero(sizeof(*hf));
|
||||
if (hf == NULL) {
|
||||
|
|
@ -205,12 +204,12 @@ static ares_hosts_file_t *ares__hosts_file_create(const char *filename)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
hf->iphash = ares__htable_strvp_create(ares__hosts_entry_destroy_cb);
|
||||
hf->iphash = ares_htable_strvp_create(ares_hosts_entry_destroy_cb);
|
||||
if (hf->iphash == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hf->hosthash = ares__htable_strvp_create(NULL);
|
||||
hf->hosthash = ares_htable_strvp_create(NULL);
|
||||
if (hf->hosthash == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -218,7 +217,7 @@ static ares_hosts_file_t *ares__hosts_file_create(const char *filename)
|
|||
return hf;
|
||||
|
||||
fail:
|
||||
ares__hosts_file_destroy(hf);
|
||||
ares_hosts_file_destroy(hf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -228,63 +227,63 @@ typedef enum {
|
|||
ARES_MATCH_HOST = 2
|
||||
} ares_hosts_file_match_t;
|
||||
|
||||
static ares_status_t ares__hosts_file_merge_entry(
|
||||
static ares_status_t ares_hosts_file_merge_entry(
|
||||
const ares_hosts_file_t *hf, ares_hosts_entry_t *existing,
|
||||
ares_hosts_entry_t *entry, ares_hosts_file_match_t matchtype)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
/* If we matched on IP address, we know there can only be 1, so there's no
|
||||
* reason to do anything */
|
||||
if (matchtype != ARES_MATCH_IPADDR) {
|
||||
while ((node = ares__llist_node_first(entry->ips)) != NULL) {
|
||||
const char *ipaddr = ares__llist_node_val(node);
|
||||
while ((node = ares_llist_node_first(entry->ips)) != NULL) {
|
||||
const char *ipaddr = ares_llist_node_val(node);
|
||||
|
||||
if (ares__htable_strvp_get_direct(hf->iphash, ipaddr) != NULL) {
|
||||
ares__llist_node_destroy(node);
|
||||
if (ares_htable_strvp_get_direct(hf->iphash, ipaddr) != NULL) {
|
||||
ares_llist_node_destroy(node);
|
||||
continue;
|
||||
}
|
||||
|
||||
ares__llist_node_move_parent_last(node, existing->ips);
|
||||
ares_llist_node_mvparent_last(node, existing->ips);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while ((node = ares__llist_node_first(entry->hosts)) != NULL) {
|
||||
const char *hostname = ares__llist_node_val(node);
|
||||
while ((node = ares_llist_node_first(entry->hosts)) != NULL) {
|
||||
const char *hostname = ares_llist_node_val(node);
|
||||
|
||||
if (ares__htable_strvp_get_direct(hf->hosthash, hostname) != NULL) {
|
||||
ares__llist_node_destroy(node);
|
||||
if (ares_htable_strvp_get_direct(hf->hosthash, hostname) != NULL) {
|
||||
ares_llist_node_destroy(node);
|
||||
continue;
|
||||
}
|
||||
|
||||
ares__llist_node_move_parent_last(node, existing->hosts);
|
||||
ares_llist_node_mvparent_last(node, existing->hosts);
|
||||
}
|
||||
|
||||
ares__hosts_entry_destroy(entry);
|
||||
ares_hosts_entry_destroy(entry);
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_hosts_file_match_t
|
||||
ares__hosts_file_match(const ares_hosts_file_t *hf, ares_hosts_entry_t *entry,
|
||||
ares_hosts_entry_t **match)
|
||||
ares_hosts_file_match(const ares_hosts_file_t *hf, ares_hosts_entry_t *entry,
|
||||
ares_hosts_entry_t **match)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
*match = NULL;
|
||||
|
||||
for (node = ares__llist_node_first(entry->ips); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
const char *ipaddr = ares__llist_node_val(node);
|
||||
*match = ares__htable_strvp_get_direct(hf->iphash, ipaddr);
|
||||
for (node = ares_llist_node_first(entry->ips); node != NULL;
|
||||
node = ares_llist_node_next(node)) {
|
||||
const char *ipaddr = ares_llist_node_val(node);
|
||||
*match = ares_htable_strvp_get_direct(hf->iphash, ipaddr);
|
||||
if (*match != NULL) {
|
||||
return ARES_MATCH_IPADDR;
|
||||
}
|
||||
}
|
||||
|
||||
for (node = ares__llist_node_first(entry->hosts); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
const char *host = ares__llist_node_val(node);
|
||||
*match = ares__htable_strvp_get_direct(hf->hosthash, host);
|
||||
for (node = ares_llist_node_first(entry->hosts); node != NULL;
|
||||
node = ares_llist_node_next(node)) {
|
||||
const char *host = ares_llist_node_val(node);
|
||||
*match = ares_htable_strvp_get_direct(hf->hosthash, host);
|
||||
if (*match != NULL) {
|
||||
return ARES_MATCH_HOST;
|
||||
}
|
||||
|
|
@ -294,38 +293,38 @@ static ares_hosts_file_match_t
|
|||
}
|
||||
|
||||
/*! entry is invalidated upon calling this function, always, even on error */
|
||||
static ares_status_t ares__hosts_file_add(ares_hosts_file_t *hosts,
|
||||
ares_hosts_entry_t *entry)
|
||||
static ares_status_t ares_hosts_file_add(ares_hosts_file_t *hosts,
|
||||
ares_hosts_entry_t *entry)
|
||||
{
|
||||
ares_hosts_entry_t *match = NULL;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
ares_hosts_file_match_t matchtype;
|
||||
size_t num_hostnames;
|
||||
|
||||
/* Record the number of hostnames in this entry file. If we merge into an
|
||||
* existing record, these will be *appended* to the entry, so we'll count
|
||||
* backwards when adding to the hosts hashtable */
|
||||
num_hostnames = ares__llist_len(entry->hosts);
|
||||
num_hostnames = ares_llist_len(entry->hosts);
|
||||
|
||||
matchtype = ares__hosts_file_match(hosts, entry, &match);
|
||||
matchtype = ares_hosts_file_match(hosts, entry, &match);
|
||||
|
||||
if (matchtype != ARES_MATCH_NONE) {
|
||||
status = ares__hosts_file_merge_entry(hosts, match, entry, matchtype);
|
||||
status = ares_hosts_file_merge_entry(hosts, match, entry, matchtype);
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares__hosts_entry_destroy(entry); /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return status; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
ares_hosts_entry_destroy(entry); /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return status; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
/* entry was invalidated above by merging */
|
||||
entry = match;
|
||||
}
|
||||
|
||||
if (matchtype != ARES_MATCH_IPADDR) {
|
||||
const char *ipaddr = ares__llist_last_val(entry->ips);
|
||||
const char *ipaddr = ares_llist_last_val(entry->ips);
|
||||
|
||||
if (!ares__htable_strvp_get(hosts->iphash, ipaddr, NULL)) {
|
||||
if (!ares__htable_strvp_insert(hosts->iphash, ipaddr, entry)) {
|
||||
ares__hosts_entry_destroy(entry);
|
||||
if (!ares_htable_strvp_get(hosts->iphash, ipaddr, NULL)) {
|
||||
if (!ares_htable_strvp_insert(hosts->iphash, ipaddr, entry)) {
|
||||
ares_hosts_entry_destroy(entry);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
entry->refcnt++;
|
||||
|
|
@ -334,9 +333,9 @@ static ares_status_t ares__hosts_file_add(ares_hosts_file_t *hosts,
|
|||
|
||||
/* Go backwards, on a merge, hostnames are appended. Breakout once we've
|
||||
* consumed all the hosts that we appended */
|
||||
for (node = ares__llist_node_last(entry->hosts); node != NULL;
|
||||
node = ares__llist_node_prev(node)) {
|
||||
const char *val = ares__llist_node_val(node);
|
||||
for (node = ares_llist_node_last(entry->hosts); node != NULL;
|
||||
node = ares_llist_node_prev(node)) {
|
||||
const char *val = ares_llist_node_val(node);
|
||||
|
||||
if (num_hostnames == 0) {
|
||||
break;
|
||||
|
|
@ -346,11 +345,11 @@ static ares_status_t ares__hosts_file_add(ares_hosts_file_t *hosts,
|
|||
|
||||
/* first hostname match wins. If we detect a duplicate hostname for another
|
||||
* ip it will automatically be added to the same entry */
|
||||
if (ares__htable_strvp_get(hosts->hosthash, val, NULL)) {
|
||||
if (ares_htable_strvp_get(hosts->hosthash, val, NULL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ares__htable_strvp_insert(hosts->hosthash, val, entry)) {
|
||||
if (!ares_htable_strvp_insert(hosts->hosthash, val, entry)) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
|
|
@ -358,15 +357,15 @@ static ares_status_t ares__hosts_file_add(ares_hosts_file_t *hosts,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_bool_t ares__hosts_entry_isdup(ares_hosts_entry_t *entry,
|
||||
const char *host)
|
||||
static ares_bool_t ares_hosts_entry_isdup(ares_hosts_entry_t *entry,
|
||||
const char *host)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
for (node = ares__llist_node_first(entry->ips); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
const char *myhost = ares__llist_node_val(node);
|
||||
if (strcasecmp(myhost, host) == 0) {
|
||||
for (node = ares_llist_node_first(entry->ips); node != NULL;
|
||||
node = ares_llist_node_next(node)) {
|
||||
const char *myhost = ares_llist_node_val(node);
|
||||
if (ares_strcaseeq(myhost, host)) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -374,44 +373,44 @@ static ares_bool_t ares__hosts_entry_isdup(ares_hosts_entry_t *entry,
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
static ares_status_t ares__parse_hosts_hostnames(ares__buf_t *buf,
|
||||
ares_hosts_entry_t *entry)
|
||||
static ares_status_t ares_parse_hosts_hostnames(ares_buf_t *buf,
|
||||
ares_hosts_entry_t *entry)
|
||||
{
|
||||
entry->hosts = ares__llist_create(ares_free);
|
||||
entry->hosts = ares_llist_create(ares_free);
|
||||
if (entry->hosts == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
/* Parse hostnames and aliases */
|
||||
while (ares__buf_len(buf)) {
|
||||
while (ares_buf_len(buf)) {
|
||||
char hostname[256];
|
||||
char *temp;
|
||||
ares_status_t status;
|
||||
unsigned char comment = '#';
|
||||
|
||||
ares__buf_consume_whitespace(buf, ARES_FALSE);
|
||||
ares_buf_consume_whitespace(buf, ARES_FALSE);
|
||||
|
||||
if (ares__buf_len(buf) == 0) {
|
||||
if (ares_buf_len(buf) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* See if it is a comment, if so stop processing */
|
||||
if (ares__buf_begins_with(buf, &comment, 1)) {
|
||||
if (ares_buf_begins_with(buf, &comment, 1)) {
|
||||
break;
|
||||
}
|
||||
|
||||
ares__buf_tag(buf);
|
||||
ares_buf_tag(buf);
|
||||
|
||||
/* Must be at end of line */
|
||||
if (ares__buf_consume_nonwhitespace(buf) == 0) {
|
||||
if (ares_buf_consume_nonwhitespace(buf) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
status = ares__buf_tag_fetch_string(buf, hostname, sizeof(hostname));
|
||||
status = ares_buf_tag_fetch_string(buf, hostname, sizeof(hostname));
|
||||
if (status != ARES_SUCCESS) {
|
||||
/* Bad entry, just ignore as long as its not the first. If its the first,
|
||||
* it must be valid */
|
||||
if (ares__llist_len(entry->hosts) == 0) {
|
||||
if (ares_llist_len(entry->hosts) == 0) {
|
||||
return ARES_EBADSTR;
|
||||
}
|
||||
|
||||
|
|
@ -419,12 +418,12 @@ static ares_status_t ares__parse_hosts_hostnames(ares__buf_t *buf,
|
|||
}
|
||||
|
||||
/* Validate it is a valid hostname characterset */
|
||||
if (!ares__is_hostname(hostname)) {
|
||||
if (!ares_is_hostname(hostname)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Don't add a duplicate to the same entry */
|
||||
if (ares__hosts_entry_isdup(entry, hostname)) {
|
||||
if (ares_hosts_entry_isdup(entry, hostname)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -434,22 +433,22 @@ static ares_status_t ares__parse_hosts_hostnames(ares__buf_t *buf,
|
|||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
if (ares__llist_insert_last(entry->hosts, temp) == NULL) {
|
||||
if (ares_llist_insert_last(entry->hosts, temp) == NULL) {
|
||||
ares_free(temp);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
/* Must have at least 1 entry */
|
||||
if (ares__llist_len(entry->hosts) == 0) {
|
||||
if (ares_llist_len(entry->hosts) == 0) {
|
||||
return ARES_EBADSTR;
|
||||
}
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_status_t ares__parse_hosts_ipaddr(ares__buf_t *buf,
|
||||
ares_hosts_entry_t **entry_out)
|
||||
static ares_status_t ares_parse_hosts_ipaddr(ares_buf_t *buf,
|
||||
ares_hosts_entry_t **entry_out)
|
||||
{
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
char *temp;
|
||||
|
|
@ -458,15 +457,15 @@ static ares_status_t ares__parse_hosts_ipaddr(ares__buf_t *buf,
|
|||
|
||||
*entry_out = NULL;
|
||||
|
||||
ares__buf_tag(buf);
|
||||
ares__buf_consume_nonwhitespace(buf);
|
||||
status = ares__buf_tag_fetch_string(buf, addr, sizeof(addr));
|
||||
ares_buf_tag(buf);
|
||||
ares_buf_consume_nonwhitespace(buf);
|
||||
status = ares_buf_tag_fetch_string(buf, addr, sizeof(addr));
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Validate and normalize the ip address format */
|
||||
if (!ares__normalize_ipaddr(addr, addr, sizeof(addr))) {
|
||||
if (!ares_normalize_ipaddr(addr, addr, sizeof(addr))) {
|
||||
return ARES_EBADSTR;
|
||||
}
|
||||
|
||||
|
|
@ -475,21 +474,21 @@ static ares_status_t ares__parse_hosts_ipaddr(ares__buf_t *buf,
|
|||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
entry->ips = ares__llist_create(ares_free);
|
||||
entry->ips = ares_llist_create(ares_free);
|
||||
if (entry->ips == NULL) {
|
||||
ares__hosts_entry_destroy(entry);
|
||||
ares_hosts_entry_destroy(entry);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
temp = ares_strdup(addr);
|
||||
if (temp == NULL) {
|
||||
ares__hosts_entry_destroy(entry);
|
||||
ares_hosts_entry_destroy(entry);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
if (ares__llist_insert_first(entry->ips, temp) == NULL) {
|
||||
if (ares_llist_insert_first(entry->ips, temp) == NULL) {
|
||||
ares_free(temp);
|
||||
ares__hosts_entry_destroy(entry);
|
||||
ares_hosts_entry_destroy(entry);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
|
|
@ -498,100 +497,100 @@ static ares_status_t ares__parse_hosts_ipaddr(ares__buf_t *buf,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_status_t ares__parse_hosts(const char *filename,
|
||||
ares_hosts_file_t **out)
|
||||
static ares_status_t ares_parse_hosts(const char *filename,
|
||||
ares_hosts_file_t **out)
|
||||
{
|
||||
ares__buf_t *buf = NULL;
|
||||
ares_buf_t *buf = NULL;
|
||||
ares_status_t status = ARES_EBADRESP;
|
||||
ares_hosts_file_t *hf = NULL;
|
||||
ares_hosts_entry_t *entry = NULL;
|
||||
|
||||
*out = NULL;
|
||||
|
||||
buf = ares__buf_create();
|
||||
buf = ares_buf_create();
|
||||
if (buf == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ares__buf_load_file(filename, buf);
|
||||
status = ares_buf_load_file(filename, buf);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
hf = ares__hosts_file_create(filename);
|
||||
hf = ares_hosts_file_create(filename);
|
||||
if (hf == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
while (ares__buf_len(buf)) {
|
||||
while (ares_buf_len(buf)) {
|
||||
unsigned char comment = '#';
|
||||
|
||||
/* -- Start of new line here -- */
|
||||
|
||||
/* Consume any leading whitespace */
|
||||
ares__buf_consume_whitespace(buf, ARES_FALSE);
|
||||
ares_buf_consume_whitespace(buf, ARES_FALSE);
|
||||
|
||||
if (ares__buf_len(buf) == 0) {
|
||||
if (ares_buf_len(buf) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* See if it is a comment, if so, consume remaining line */
|
||||
if (ares__buf_begins_with(buf, &comment, 1)) {
|
||||
ares__buf_consume_line(buf, ARES_TRUE);
|
||||
if (ares_buf_begins_with(buf, &comment, 1)) {
|
||||
ares_buf_consume_line(buf, ARES_TRUE);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Pull off ip address */
|
||||
status = ares__parse_hosts_ipaddr(buf, &entry);
|
||||
status = ares_parse_hosts_ipaddr(buf, &entry);
|
||||
if (status == ARES_ENOMEM) {
|
||||
goto done;
|
||||
}
|
||||
if (status != ARES_SUCCESS) {
|
||||
/* Bad line, consume and go onto next */
|
||||
ares__buf_consume_line(buf, ARES_TRUE);
|
||||
ares_buf_consume_line(buf, ARES_TRUE);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Parse of the hostnames */
|
||||
status = ares__parse_hosts_hostnames(buf, entry);
|
||||
status = ares_parse_hosts_hostnames(buf, entry);
|
||||
if (status == ARES_ENOMEM) {
|
||||
goto done;
|
||||
} else if (status != ARES_SUCCESS) {
|
||||
/* Bad line, consume and go onto next */
|
||||
ares__hosts_entry_destroy(entry);
|
||||
ares_hosts_entry_destroy(entry);
|
||||
entry = NULL;
|
||||
ares__buf_consume_line(buf, ARES_TRUE);
|
||||
ares_buf_consume_line(buf, ARES_TRUE);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Append the successful entry to the hosts file */
|
||||
status = ares__hosts_file_add(hf, entry);
|
||||
status = ares_hosts_file_add(hf, entry);
|
||||
entry = NULL; /* is always invalidated by this function, even on error */
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Go to next line */
|
||||
ares__buf_consume_line(buf, ARES_TRUE);
|
||||
ares_buf_consume_line(buf, ARES_TRUE);
|
||||
}
|
||||
|
||||
status = ARES_SUCCESS;
|
||||
|
||||
done:
|
||||
ares__hosts_entry_destroy(entry);
|
||||
ares__buf_destroy(buf);
|
||||
ares_hosts_entry_destroy(entry);
|
||||
ares_buf_destroy(buf);
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares__hosts_file_destroy(hf);
|
||||
ares_hosts_file_destroy(hf);
|
||||
} else {
|
||||
*out = hf;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static ares_bool_t ares__hosts_expired(const char *filename,
|
||||
const ares_hosts_file_t *hf)
|
||||
static ares_bool_t ares_hosts_expired(const char *filename,
|
||||
const ares_hosts_file_t *hf)
|
||||
{
|
||||
time_t mod_ts = 0;
|
||||
|
||||
|
|
@ -620,7 +619,7 @@ static ares_bool_t ares__hosts_expired(const char *filename,
|
|||
}
|
||||
|
||||
/* If filenames are different, its expired */
|
||||
if (strcasecmp(hf->filename, filename) != 0) {
|
||||
if (!ares_strcaseeq(hf->filename, filename)) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -631,8 +630,8 @@ static ares_bool_t ares__hosts_expired(const char *filename,
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
static ares_status_t ares__hosts_path(const ares_channel_t *channel,
|
||||
ares_bool_t use_env, char **path)
|
||||
static ares_status_t ares_hosts_path(const ares_channel_t *channel,
|
||||
ares_bool_t use_env, char **path)
|
||||
{
|
||||
char *path_hosts = NULL;
|
||||
|
||||
|
|
@ -688,40 +687,40 @@ static ares_status_t ares__hosts_path(const ares_channel_t *channel,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_status_t ares__hosts_update(ares_channel_t *channel,
|
||||
ares_bool_t use_env)
|
||||
static ares_status_t ares_hosts_update(ares_channel_t *channel,
|
||||
ares_bool_t use_env)
|
||||
{
|
||||
ares_status_t status;
|
||||
char *filename = NULL;
|
||||
|
||||
status = ares__hosts_path(channel, use_env, &filename);
|
||||
status = ares_hosts_path(channel, use_env, &filename);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!ares__hosts_expired(filename, channel->hf)) {
|
||||
if (!ares_hosts_expired(filename, channel->hf)) {
|
||||
ares_free(filename);
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares__hosts_file_destroy(channel->hf);
|
||||
ares_hosts_file_destroy(channel->hf);
|
||||
channel->hf = NULL;
|
||||
|
||||
status = ares__parse_hosts(filename, &channel->hf);
|
||||
status = ares_parse_hosts(filename, &channel->hf);
|
||||
ares_free(filename);
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares__hosts_search_ipaddr(ares_channel_t *channel,
|
||||
ares_bool_t use_env, const char *ipaddr,
|
||||
const ares_hosts_entry_t **entry)
|
||||
ares_status_t ares_hosts_search_ipaddr(ares_channel_t *channel,
|
||||
ares_bool_t use_env, const char *ipaddr,
|
||||
const ares_hosts_entry_t **entry)
|
||||
{
|
||||
ares_status_t status;
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
|
||||
*entry = NULL;
|
||||
|
||||
status = ares__hosts_update(channel, use_env);
|
||||
status = ares_hosts_update(channel, use_env);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -730,11 +729,11 @@ ares_status_t ares__hosts_search_ipaddr(ares_channel_t *channel,
|
|||
return ARES_ENOTFOUND; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
if (!ares__normalize_ipaddr(ipaddr, addr, sizeof(addr))) {
|
||||
if (!ares_normalize_ipaddr(ipaddr, addr, sizeof(addr))) {
|
||||
return ARES_EBADNAME;
|
||||
}
|
||||
|
||||
*entry = ares__htable_strvp_get_direct(channel->hf->iphash, addr);
|
||||
*entry = ares_htable_strvp_get_direct(channel->hf->iphash, addr);
|
||||
if (*entry == NULL) {
|
||||
return ARES_ENOTFOUND;
|
||||
}
|
||||
|
|
@ -742,15 +741,15 @@ ares_status_t ares__hosts_search_ipaddr(ares_channel_t *channel,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__hosts_search_host(ares_channel_t *channel,
|
||||
ares_bool_t use_env, const char *host,
|
||||
const ares_hosts_entry_t **entry)
|
||||
ares_status_t ares_hosts_search_host(ares_channel_t *channel,
|
||||
ares_bool_t use_env, const char *host,
|
||||
const ares_hosts_entry_t **entry)
|
||||
{
|
||||
ares_status_t status;
|
||||
|
||||
*entry = NULL;
|
||||
|
||||
status = ares__hosts_update(channel, use_env);
|
||||
status = ares_hosts_update(channel, use_env);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -759,7 +758,7 @@ ares_status_t ares__hosts_search_host(ares_channel_t *channel,
|
|||
return ARES_ENOTFOUND; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
*entry = ares__htable_strvp_get_direct(channel->hf->hosthash, host);
|
||||
*entry = ares_htable_strvp_get_direct(channel->hf->hosthash, host);
|
||||
if (*entry == NULL) {
|
||||
return ARES_ENOTFOUND;
|
||||
}
|
||||
|
|
@ -768,23 +767,23 @@ ares_status_t ares__hosts_search_host(ares_channel_t *channel,
|
|||
}
|
||||
|
||||
static ares_status_t
|
||||
ares__hosts_ai_append_cnames(const ares_hosts_entry_t *entry,
|
||||
struct ares_addrinfo_cname **cnames_out)
|
||||
ares_hosts_ai_append_cnames(const ares_hosts_entry_t *entry,
|
||||
struct ares_addrinfo_cname **cnames_out)
|
||||
{
|
||||
struct ares_addrinfo_cname *cname = NULL;
|
||||
struct ares_addrinfo_cname *cnames = NULL;
|
||||
const char *primaryhost;
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
ares_status_t status;
|
||||
size_t cnt = 0;
|
||||
|
||||
node = ares__llist_node_first(entry->hosts);
|
||||
primaryhost = ares__llist_node_val(node);
|
||||
node = ares_llist_node_first(entry->hosts);
|
||||
primaryhost = ares_llist_node_val(node);
|
||||
/* Skip to next node to start with aliases */
|
||||
node = ares__llist_node_next(node);
|
||||
node = ares_llist_node_next(node);
|
||||
|
||||
while (node != NULL) {
|
||||
const char *host = ares__llist_node_val(node);
|
||||
const char *host = ares_llist_node_val(node);
|
||||
|
||||
/* Cap at 100 entries. , some people use
|
||||
* https://github.com/StevenBlack/hosts and we don't need 200k+ aliases */
|
||||
|
|
@ -793,7 +792,7 @@ static ares_status_t
|
|||
break; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
cname = ares__append_addrinfo_cname(&cnames);
|
||||
cname = ares_append_addrinfo_cname(&cnames);
|
||||
if (cname == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
|
|
@ -811,12 +810,12 @@ static ares_status_t
|
|||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
node = ares__llist_node_next(node);
|
||||
node = ares_llist_node_next(node);
|
||||
}
|
||||
|
||||
/* No entries, add only primary */
|
||||
if (cnames == NULL) {
|
||||
cname = ares__append_addrinfo_cname(&cnames);
|
||||
cname = ares_append_addrinfo_cname(&cnames);
|
||||
if (cname == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
|
|
@ -832,24 +831,24 @@ static ares_status_t
|
|||
|
||||
done:
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares__freeaddrinfo_cnames(cnames); /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return status; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
ares_freeaddrinfo_cnames(cnames); /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return status; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
*cnames_out = cnames;
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__hosts_entry_to_addrinfo(const ares_hosts_entry_t *entry,
|
||||
const char *name, int family,
|
||||
unsigned short port,
|
||||
ares_bool_t want_cnames,
|
||||
struct ares_addrinfo *ai)
|
||||
ares_status_t ares_hosts_entry_to_addrinfo(const ares_hosts_entry_t *entry,
|
||||
const char *name, int family,
|
||||
unsigned short port,
|
||||
ares_bool_t want_cnames,
|
||||
struct ares_addrinfo *ai)
|
||||
{
|
||||
ares_status_t status;
|
||||
struct ares_addrinfo_cname *cnames = NULL;
|
||||
struct ares_addrinfo_node *ainodes = NULL;
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
switch (family) {
|
||||
case AF_INET:
|
||||
|
|
@ -868,12 +867,12 @@ ares_status_t ares__hosts_entry_to_addrinfo(const ares_hosts_entry_t *entry,
|
|||
}
|
||||
}
|
||||
|
||||
for (node = ares__llist_node_first(entry->ips); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
for (node = ares_llist_node_first(entry->ips); node != NULL;
|
||||
node = ares_llist_node_next(node)) {
|
||||
struct ares_addr addr;
|
||||
const void *ptr = NULL;
|
||||
size_t ptr_len = 0;
|
||||
const char *ipaddr = ares__llist_node_val(node);
|
||||
const char *ipaddr = ares_llist_node_val(node);
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.family = family;
|
||||
|
|
@ -890,7 +889,7 @@ ares_status_t ares__hosts_entry_to_addrinfo(const ares_hosts_entry_t *entry,
|
|||
}
|
||||
|
||||
if (want_cnames) {
|
||||
status = ares__hosts_ai_append_cnames(entry, &cnames);
|
||||
status = ares_hosts_ai_append_cnames(entry, &cnames);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
|
@ -901,21 +900,21 @@ ares_status_t ares__hosts_entry_to_addrinfo(const ares_hosts_entry_t *entry,
|
|||
done:
|
||||
if (status != ARES_SUCCESS) {
|
||||
/* LCOV_EXCL_START: defensive coding */
|
||||
ares__freeaddrinfo_cnames(cnames);
|
||||
ares__freeaddrinfo_nodes(ainodes);
|
||||
ares_freeaddrinfo_cnames(cnames);
|
||||
ares_freeaddrinfo_nodes(ainodes);
|
||||
ares_free(ai->name);
|
||||
ai->name = NULL;
|
||||
return status;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
ares__addrinfo_cat_cnames(&ai->cnames, cnames);
|
||||
ares__addrinfo_cat_nodes(&ai->nodes, ainodes);
|
||||
ares_addrinfo_cat_cnames(&ai->cnames, cnames);
|
||||
ares_addrinfo_cat_nodes(&ai->nodes, ainodes);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
||||
int family, struct hostent **hostent)
|
||||
ares_status_t ares_hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
||||
int family, struct hostent **hostent)
|
||||
{
|
||||
ares_status_t status;
|
||||
struct ares_addrinfo *ai = ares_malloc_zero(sizeof(*ai));
|
||||
|
|
@ -926,12 +925,12 @@ ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
|||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
status = ares__hosts_entry_to_addrinfo(entry, NULL, family, 0, ARES_TRUE, ai);
|
||||
status = ares_hosts_entry_to_addrinfo(entry, NULL, family, 0, ARES_TRUE, ai);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ares__addrinfo2hostent(ai, family, hostent);
|
||||
status = ares_addrinfo2hostent(ai, family, hostent);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
4
deps/cares/src/lib/ares_inet_net_pton.h
vendored
4
deps/cares/src/lib/ares_inet_net_pton.h
vendored
|
|
@ -26,10 +26,6 @@
|
|||
#ifndef HEADER_CARES_INET_NET_PTON_H
|
||||
#define HEADER_CARES_INET_NET_PTON_H
|
||||
|
||||
#ifdef HAVE_INET_NET_PTON
|
||||
# define ares_inet_net_pton(w, x, y, z) inet_net_pton(w, x, y, z)
|
||||
#else
|
||||
int ares_inet_net_pton(int af, const char *src, void *dst, size_t size);
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CARES_INET_NET_PTON_H */
|
||||
|
|
|
|||
141
deps/cares/src/lib/ares_init.c
vendored
141
deps/cares/src/lib/ares_init.c
vendored
|
|
@ -62,7 +62,6 @@
|
|||
#endif
|
||||
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
#include "event/ares_event.h"
|
||||
|
||||
int ares_init(ares_channel_t **channelptr)
|
||||
|
|
@ -117,7 +116,7 @@ static void server_destroy_cb(void *data)
|
|||
if (data == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
ares__destroy_server(data);
|
||||
ares_destroy_server(data);
|
||||
}
|
||||
|
||||
static ares_status_t init_by_defaults(ares_channel_t *channel)
|
||||
|
|
@ -128,7 +127,7 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
|
|||
const char *dot;
|
||||
#endif
|
||||
struct ares_addr addr;
|
||||
ares__llist_t *sconfig = NULL;
|
||||
ares_llist_t *sconfig = NULL;
|
||||
|
||||
/* Enable EDNS by default */
|
||||
if (!(channel->optmask & ARES_OPT_FLAGS)) {
|
||||
|
|
@ -146,7 +145,7 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
|
|||
channel->tries = DEFAULT_TRIES;
|
||||
}
|
||||
|
||||
if (ares__slist_len(channel->servers) == 0) {
|
||||
if (ares_slist_len(channel->servers) == 0) {
|
||||
/* Add a default local named server to the channel unless configured not
|
||||
* to (in which case return an error).
|
||||
*/
|
||||
|
|
@ -158,28 +157,19 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
|
|||
addr.family = AF_INET;
|
||||
addr.addr.addr4.s_addr = htonl(INADDR_LOOPBACK);
|
||||
|
||||
rc = ares__sconfig_append(&sconfig, &addr, 0, 0, NULL);
|
||||
rc = ares_sconfig_append(channel, &sconfig, &addr, 0, 0, NULL);
|
||||
if (rc != ARES_SUCCESS) {
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
rc = ares__servers_update(channel, sconfig, ARES_FALSE);
|
||||
ares__llist_destroy(sconfig);
|
||||
rc = ares_servers_update(channel, sconfig, ARES_FALSE);
|
||||
ares_llist_destroy(sconfig);
|
||||
|
||||
if (rc != ARES_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_WINSOCK)
|
||||
# define toolong(x) (x == -1) && (SOCKERRNO == WSAEFAULT)
|
||||
#elif defined(ENAMETOOLONG)
|
||||
# define toolong(x) \
|
||||
(x == -1) && ((SOCKERRNO == ENAMETOOLONG) || (SOCKERRNO == EINVAL))
|
||||
#else
|
||||
# define toolong(x) (x == -1) && (SOCKERRNO == EINVAL)
|
||||
#endif
|
||||
|
||||
if (channel->ndomains == 0) {
|
||||
/* Derive a default domain search list from the kernel hostname,
|
||||
* or set it to empty if the hostname isn't helpful.
|
||||
|
|
@ -187,9 +177,7 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
|
|||
#ifndef HAVE_GETHOSTNAME
|
||||
channel->ndomains = 0; /* default to none */
|
||||
#else
|
||||
GETHOSTNAME_TYPE_ARG2 lenv = 64;
|
||||
size_t len = 64;
|
||||
int res;
|
||||
size_t len = 256;
|
||||
channel->ndomains = 0; /* default to none */
|
||||
|
||||
hostname = ares_malloc(len);
|
||||
|
|
@ -198,28 +186,11 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
|
|||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
do {
|
||||
res = gethostname(hostname, lenv);
|
||||
|
||||
if (toolong(res)) {
|
||||
char *p;
|
||||
len *= 2;
|
||||
lenv *= 2;
|
||||
p = ares_realloc(hostname, len);
|
||||
if (!p) {
|
||||
rc = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
hostname = p;
|
||||
continue;
|
||||
} else if (res) {
|
||||
/* Lets not treat a gethostname failure as critical, since we
|
||||
* are ok if gethostname doesn't even exist */
|
||||
*hostname = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
} while (res != 0);
|
||||
if (gethostname(hostname, (GETHOSTNAME_TYPE_ARG2)len) != 0) {
|
||||
/* Lets not treat a gethostname failure as critical, since we
|
||||
* are ok if gethostname doesn't even exist */
|
||||
*hostname = '\0';
|
||||
}
|
||||
|
||||
dot = strchr(hostname, '.');
|
||||
if (dot) {
|
||||
|
|
@ -286,13 +257,13 @@ int ares_init_options(ares_channel_t **channelptr,
|
|||
/* One option where zero is valid, so set default value here */
|
||||
channel->ndots = 1;
|
||||
|
||||
status = ares__channel_threading_init(channel);
|
||||
status = ares_channel_threading_init(channel);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Generate random key */
|
||||
channel->rand_state = ares__init_rand_state();
|
||||
channel->rand_state = ares_init_rand_state();
|
||||
if (channel->rand_state == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n",
|
||||
|
|
@ -302,33 +273,33 @@ int ares_init_options(ares_channel_t **channelptr,
|
|||
|
||||
/* Initialize Server List */
|
||||
channel->servers =
|
||||
ares__slist_create(channel->rand_state, server_sort_cb, server_destroy_cb);
|
||||
ares_slist_create(channel->rand_state, server_sort_cb, server_destroy_cb);
|
||||
if (channel->servers == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Initialize our lists of queries */
|
||||
channel->all_queries = ares__llist_create(NULL);
|
||||
channel->all_queries = ares_llist_create(NULL);
|
||||
if (channel->all_queries == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
channel->queries_by_qid = ares__htable_szvp_create(NULL);
|
||||
channel->queries_by_qid = ares_htable_szvp_create(NULL);
|
||||
if (channel->queries_by_qid == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
channel->queries_by_timeout =
|
||||
ares__slist_create(channel->rand_state, ares_query_timeout_cmp_cb, NULL);
|
||||
ares_slist_create(channel->rand_state, ares_query_timeout_cmp_cb, NULL);
|
||||
if (channel->queries_by_timeout == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
channel->connnode_by_socket = ares__htable_asvp_create(NULL);
|
||||
channel->connnode_by_socket = ares_htable_asvp_create(NULL);
|
||||
if (channel->connnode_by_socket == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
|
|
@ -338,7 +309,7 @@ int ares_init_options(ares_channel_t **channelptr,
|
|||
* precedence to lowest.
|
||||
*/
|
||||
|
||||
status = ares__init_by_options(channel, options, optmask);
|
||||
status = ares_init_by_options(channel, options, optmask);
|
||||
if (status != ARES_SUCCESS) {
|
||||
DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
|
|
@ -350,14 +321,14 @@ int ares_init_options(ares_channel_t **channelptr,
|
|||
/* Go ahead and let it initialize the query cache even if the ttl is 0 and
|
||||
* completely unused. This reduces the number of different code paths that
|
||||
* might be followed even if there is a minor performance hit. */
|
||||
status = ares__qcache_create(channel->rand_state, channel->qcache_max_ttl,
|
||||
&channel->qcache);
|
||||
status = ares_qcache_create(channel->rand_state, channel->qcache_max_ttl,
|
||||
&channel->qcache);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
if (status == ARES_SUCCESS) {
|
||||
status = ares__init_by_sysconfig(channel);
|
||||
status = ares_init_by_sysconfig(channel);
|
||||
if (status != ARES_SUCCESS) {
|
||||
DEBUGF(fprintf(stderr, "Error: init_by_sysconfig failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
|
|
@ -375,6 +346,8 @@ int ares_init_options(ares_channel_t **channelptr,
|
|||
goto done;
|
||||
}
|
||||
|
||||
ares_set_socket_functions_def(channel);
|
||||
|
||||
/* Initialize the event thread */
|
||||
if (channel->optmask & ARES_OPT_EVENT_THREAD) {
|
||||
ares_event_thread_t *e = NULL;
|
||||
|
|
@ -409,23 +382,23 @@ static void *ares_reinit_thread(void *arg)
|
|||
ares_channel_t *channel = arg;
|
||||
ares_status_t status;
|
||||
|
||||
/* ares__init_by_sysconfig() will lock when applying the config, but not
|
||||
/* ares_init_by_sysconfig() will lock when applying the config, but not
|
||||
* when retrieving. */
|
||||
status = ares__init_by_sysconfig(channel);
|
||||
status = ares_init_by_sysconfig(channel);
|
||||
if (status != ARES_SUCCESS) {
|
||||
DEBUGF(fprintf(stderr, "Error: init_by_sysconfig failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
/* Flush cached queries on reinit */
|
||||
if (status == ARES_SUCCESS && channel->qcache) {
|
||||
ares__qcache_flush(channel->qcache);
|
||||
ares_qcache_flush(channel->qcache);
|
||||
}
|
||||
|
||||
channel->reinit_pending = ARES_FALSE;
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -438,34 +411,34 @@ ares_status_t ares_reinit(ares_channel_t *channel)
|
|||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
/* If a reinit is already in process, lets not do it again. Or if we are
|
||||
* shutting down, skip. */
|
||||
if (!channel->sys_up || channel->reinit_pending) {
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
channel->reinit_pending = ARES_TRUE;
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
if (ares_threadsafety()) {
|
||||
/* clean up the prior reinit process's thread. We know the thread isn't
|
||||
* running since reinit_pending was false */
|
||||
if (channel->reinit_thread != NULL) {
|
||||
void *rv;
|
||||
ares__thread_join(channel->reinit_thread, &rv);
|
||||
ares_thread_join(channel->reinit_thread, &rv);
|
||||
channel->reinit_thread = NULL;
|
||||
}
|
||||
|
||||
/* Spawn a new thread */
|
||||
status =
|
||||
ares__thread_create(&channel->reinit_thread, ares_reinit_thread, channel);
|
||||
ares_thread_create(&channel->reinit_thread, ares_reinit_thread, channel);
|
||||
if (status != ARES_SUCCESS) {
|
||||
/* LCOV_EXCL_START: UntestablePath */
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
channel->reinit_pending = ARES_FALSE;
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
} else {
|
||||
|
|
@ -508,23 +481,25 @@ int ares_dup(ares_channel_t **dest, const ares_channel_t *src)
|
|||
goto done;
|
||||
}
|
||||
|
||||
ares__channel_lock(src);
|
||||
ares_channel_lock(src);
|
||||
/* Now clone the options that ares_save_options() doesn't support, but are
|
||||
* user-provided */
|
||||
(*dest)->sock_create_cb = src->sock_create_cb;
|
||||
(*dest)->sock_create_cb_data = src->sock_create_cb_data;
|
||||
(*dest)->sock_config_cb = src->sock_config_cb;
|
||||
(*dest)->sock_config_cb_data = src->sock_config_cb_data;
|
||||
(*dest)->sock_funcs = src->sock_funcs;
|
||||
(*dest)->sock_func_cb_data = src->sock_func_cb_data;
|
||||
(*dest)->server_state_cb = src->server_state_cb;
|
||||
(*dest)->server_state_cb_data = src->server_state_cb_data;
|
||||
(*dest)->sock_create_cb = src->sock_create_cb;
|
||||
(*dest)->sock_create_cb_data = src->sock_create_cb_data;
|
||||
(*dest)->sock_config_cb = src->sock_config_cb;
|
||||
(*dest)->sock_config_cb_data = src->sock_config_cb_data;
|
||||
memcpy(&(*dest)->sock_funcs, &(src->sock_funcs), sizeof((*dest)->sock_funcs));
|
||||
(*dest)->sock_func_cb_data = src->sock_func_cb_data;
|
||||
(*dest)->legacy_sock_funcs = src->legacy_sock_funcs;
|
||||
(*dest)->legacy_sock_funcs_cb_data = src->legacy_sock_funcs_cb_data;
|
||||
(*dest)->server_state_cb = src->server_state_cb;
|
||||
(*dest)->server_state_cb_data = src->server_state_cb_data;
|
||||
|
||||
ares_strcpy((*dest)->local_dev_name, src->local_dev_name,
|
||||
sizeof((*dest)->local_dev_name));
|
||||
(*dest)->local_ip4 = src->local_ip4;
|
||||
memcpy((*dest)->local_ip6, src->local_ip6, sizeof(src->local_ip6));
|
||||
ares__channel_unlock(src);
|
||||
ares_channel_unlock(src);
|
||||
|
||||
/* Servers are a bit unique as ares_init_options() only allows ipv4 servers
|
||||
* and not a port per server, but there are other user specified ways, that
|
||||
|
|
@ -568,9 +543,9 @@ void ares_set_local_ip4(ares_channel_t *channel, unsigned int local_ip)
|
|||
if (channel == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
channel->local_ip4 = local_ip;
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
}
|
||||
|
||||
/* local_ip6 should be 16 bytes in length */
|
||||
|
|
@ -579,9 +554,9 @@ void ares_set_local_ip6(ares_channel_t *channel, const unsigned char *local_ip6)
|
|||
if (channel == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
memcpy(&channel->local_ip6, local_ip6, sizeof(channel->local_ip6));
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
}
|
||||
|
||||
/* local_dev_name should be null terminated. */
|
||||
|
|
@ -591,11 +566,11 @@ void ares_set_local_dev(ares_channel_t *channel, const char *local_dev_name)
|
|||
return;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
ares_strcpy(channel->local_dev_name, local_dev_name,
|
||||
sizeof(channel->local_dev_name));
|
||||
channel->local_dev_name[sizeof(channel->local_dev_name) - 1] = 0;
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
}
|
||||
|
||||
int ares_set_sortlist(ares_channel_t *channel, const char *sortstr)
|
||||
|
|
@ -607,9 +582,9 @@ int ares_set_sortlist(ares_channel_t *channel, const char *sortstr)
|
|||
if (!channel) {
|
||||
return ARES_ENODATA;
|
||||
}
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
status = ares__parse_sortlist(&sortlist, &nsort, sortstr);
|
||||
status = ares_parse_sortlist(&sortlist, &nsort, sortstr);
|
||||
if (status == ARES_SUCCESS && sortlist) {
|
||||
if (channel->sortlist) {
|
||||
ares_free(channel->sortlist);
|
||||
|
|
@ -620,6 +595,6 @@ int ares_set_sortlist(ares_channel_t *channel, const char *sortstr)
|
|||
/* Save sortlist as if it was passed in as an option */
|
||||
channel->optmask |= ARES_OPT_SORTLIST;
|
||||
}
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
return (int)status;
|
||||
}
|
||||
|
|
|
|||
2
deps/cares/src/lib/ares_ipv6.h
vendored
2
deps/cares/src/lib/ares_ipv6.h
vendored
|
|
@ -94,7 +94,7 @@ struct addrinfo {
|
|||
# ifdef IFNAMSIZ
|
||||
# define IF_NAMESIZE IFNAMSIZ
|
||||
# else
|
||||
# define IF_NAMESIZE 256
|
||||
# define IF_NAMESIZE 32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
40
deps/cares/src/lib/ares_library_init.c
vendored
40
deps/cares/src/lib/ares_library_init.c
vendored
|
|
@ -52,8 +52,6 @@ static void *default_malloc(size_t size)
|
|||
return malloc(size);
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* We need indirections to handle Windows DLL rules. */
|
||||
static void *default_realloc(void *p, size_t size)
|
||||
{
|
||||
return realloc(p, size);
|
||||
|
|
@ -63,13 +61,25 @@ static void default_free(void *p)
|
|||
{
|
||||
free(p);
|
||||
}
|
||||
#else
|
||||
# define default_realloc realloc
|
||||
# define default_free free
|
||||
#endif
|
||||
void *(*ares_malloc)(size_t size) = default_malloc;
|
||||
void *(*ares_realloc)(void *ptr, size_t size) = default_realloc;
|
||||
void (*ares_free)(void *ptr) = default_free;
|
||||
|
||||
static void *(*__ares_malloc)(size_t size) = default_malloc;
|
||||
static void *(*__ares_realloc)(void *ptr, size_t size) = default_realloc;
|
||||
static void (*__ares_free)(void *ptr) = default_free;
|
||||
|
||||
void *ares_malloc(size_t size)
|
||||
{
|
||||
return __ares_malloc(size);
|
||||
}
|
||||
|
||||
void *ares_realloc(void *ptr, size_t size)
|
||||
{
|
||||
return __ares_realloc(ptr, size);
|
||||
}
|
||||
|
||||
void ares_free(void *ptr)
|
||||
{
|
||||
__ares_free(ptr);
|
||||
}
|
||||
|
||||
void *ares_malloc_zero(size_t size)
|
||||
{
|
||||
|
|
@ -115,13 +125,13 @@ int ares_library_init_mem(int flags, void *(*amalloc)(size_t size),
|
|||
void *(*arealloc)(void *ptr, size_t size))
|
||||
{
|
||||
if (amalloc) {
|
||||
ares_malloc = amalloc;
|
||||
__ares_malloc = amalloc;
|
||||
}
|
||||
if (arealloc) {
|
||||
ares_realloc = arealloc;
|
||||
__ares_realloc = arealloc;
|
||||
}
|
||||
if (afree) {
|
||||
ares_free = afree;
|
||||
__ares_free = afree;
|
||||
}
|
||||
return ares_library_init(flags);
|
||||
}
|
||||
|
|
@ -143,9 +153,9 @@ void ares_library_cleanup(void)
|
|||
#endif
|
||||
|
||||
ares_init_flags = ARES_LIB_INIT_NONE;
|
||||
ares_malloc = malloc;
|
||||
ares_realloc = realloc;
|
||||
ares_free = free;
|
||||
__ares_malloc = default_malloc;
|
||||
__ares_realloc = default_realloc;
|
||||
__ares_free = default_free;
|
||||
}
|
||||
|
||||
int ares_library_initialized(void)
|
||||
|
|
|
|||
4
deps/cares/src/lib/ares_metrics.c
vendored
4
deps/cares/src/lib/ares_metrics.c
vendored
|
|
@ -162,14 +162,14 @@ void ares_metrics_record(const ares_query_t *query, ares_server_t *server,
|
|||
return;
|
||||
}
|
||||
|
||||
ares__tvnow(&now);
|
||||
ares_tvnow(&now);
|
||||
|
||||
rcode = ares_dns_record_get_rcode(dnsrec);
|
||||
if (rcode != ARES_RCODE_NOERROR && rcode != ARES_RCODE_NXDOMAIN) {
|
||||
return;
|
||||
}
|
||||
|
||||
ares__timeval_diff(&tvdiff, &query->ts, &now);
|
||||
ares_timeval_diff(&tvdiff, &query->ts, &now);
|
||||
query_ms = (unsigned int)((tvdiff.sec * 1000) + (tvdiff.usec / 1000));
|
||||
if (query_ms == 0) {
|
||||
query_ms = 1;
|
||||
|
|
|
|||
40
deps/cares/src/lib/ares_options.c
vendored
40
deps/cares/src/lib/ares_options.c
vendored
|
|
@ -54,9 +54,9 @@ void ares_destroy_options(struct ares_options *options)
|
|||
static struct in_addr *ares_save_opt_servers(const ares_channel_t *channel,
|
||||
int *nservers)
|
||||
{
|
||||
ares__slist_node_t *snode;
|
||||
struct in_addr *out =
|
||||
ares_malloc_zero(ares__slist_len(channel->servers) * sizeof(*out));
|
||||
ares_slist_node_t *snode;
|
||||
struct in_addr *out =
|
||||
ares_malloc_zero(ares_slist_len(channel->servers) * sizeof(*out));
|
||||
|
||||
*nservers = 0;
|
||||
|
||||
|
|
@ -64,9 +64,9 @@ static struct in_addr *ares_save_opt_servers(const ares_channel_t *channel,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
for (snode = ares__slist_node_first(channel->servers); snode != NULL;
|
||||
snode = ares__slist_node_next(snode)) {
|
||||
const ares_server_t *server = ares__slist_node_val(snode);
|
||||
for (snode = ares_slist_node_first(channel->servers); snode != NULL;
|
||||
snode = ares_slist_node_next(snode)) {
|
||||
const ares_server_t *server = ares_slist_node_val(snode);
|
||||
|
||||
if (server->addr.family != AF_INET) {
|
||||
continue;
|
||||
|
|
@ -111,7 +111,7 @@ int ares_save_options(const ares_channel_t *channel,
|
|||
}
|
||||
|
||||
/* We convert ARES_OPT_TIMEOUT to ARES_OPT_TIMEOUTMS in
|
||||
* ares__init_by_options() */
|
||||
* ares_init_by_options() */
|
||||
if (channel->optmask & ARES_OPT_TIMEOUTMS) {
|
||||
options->timeout = (int)channel->timeout;
|
||||
}
|
||||
|
|
@ -238,28 +238,28 @@ int ares_save_options(const ares_channel_t *channel,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_status_t ares__init_options_servers(ares_channel_t *channel,
|
||||
const struct in_addr *servers,
|
||||
size_t nservers)
|
||||
static ares_status_t ares_init_options_servers(ares_channel_t *channel,
|
||||
const struct in_addr *servers,
|
||||
size_t nservers)
|
||||
{
|
||||
ares__llist_t *slist = NULL;
|
||||
ares_status_t status;
|
||||
ares_llist_t *slist = NULL;
|
||||
ares_status_t status;
|
||||
|
||||
status = ares_in_addr_to_server_config_llist(servers, nservers, &slist);
|
||||
status = ares_in_addr_to_sconfig_llist(servers, nservers, &slist);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__servers_update(channel, slist, ARES_TRUE);
|
||||
status = ares_servers_update(channel, slist, ARES_TRUE);
|
||||
|
||||
ares__llist_destroy(slist);
|
||||
ares_llist_destroy(slist);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares__init_by_options(ares_channel_t *channel,
|
||||
const struct ares_options *options,
|
||||
int optmask)
|
||||
ares_status_t ares_init_by_options(ares_channel_t *channel,
|
||||
const struct ares_options *options,
|
||||
int optmask)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
|
@ -472,8 +472,8 @@ ares_status_t ares__init_by_options(ares_channel_t *channel,
|
|||
optmask &= ~(ARES_OPT_SERVERS);
|
||||
} else {
|
||||
ares_status_t status;
|
||||
status = ares__init_options_servers(channel, options->servers,
|
||||
(size_t)options->nservers);
|
||||
status = ares_init_options_servers(channel, options->servers,
|
||||
(size_t)options->nservers);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@
|
|||
#endif
|
||||
|
||||
|
||||
ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
||||
ares_bool_t cname_only_is_enodata,
|
||||
unsigned short port,
|
||||
struct ares_addrinfo *ai)
|
||||
ares_status_t ares_parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
||||
ares_bool_t cname_only_is_enodata,
|
||||
unsigned short port,
|
||||
struct ares_addrinfo *ai)
|
||||
{
|
||||
ares_status_t status;
|
||||
size_t i;
|
||||
|
|
@ -90,7 +90,7 @@ ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
|||
*
|
||||
* rname = ares_dns_rr_get_name(rr);
|
||||
* if ((rtype == ARES_REC_TYPE_A || rtype == ARES_REC_TYPE_AAAA) &&
|
||||
* strcasecmp(rname, hostname) != 0) {
|
||||
* !ares_strcaseeq(rname, hostname)) {
|
||||
* continue;
|
||||
* }
|
||||
*/
|
||||
|
|
@ -103,7 +103,7 @@ ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
|||
* SA: Seems wrong as it introduces order dependency. */
|
||||
hostname = ares_dns_rr_get_str(rr, ARES_RR_CNAME_CNAME);
|
||||
|
||||
cname = ares__append_addrinfo_cname(&cnames);
|
||||
cname = ares_append_addrinfo_cname(&cnames);
|
||||
if (cname == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
|
|
@ -147,7 +147,7 @@ ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
|||
}
|
||||
|
||||
/* save the hostname as ai->name */
|
||||
if (ai->name == NULL || strcasecmp(ai->name, hostname) != 0) {
|
||||
if (ai->name == NULL || !ares_strcaseeq(ai->name, hostname)) {
|
||||
ares_free(ai->name);
|
||||
ai->name = ares_strdup(hostname);
|
||||
if (ai->name == NULL) {
|
||||
|
|
@ -157,18 +157,18 @@ ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
|||
}
|
||||
|
||||
if (got_a || got_aaaa) {
|
||||
ares__addrinfo_cat_nodes(&ai->nodes, nodes);
|
||||
ares_addrinfo_cat_nodes(&ai->nodes, nodes);
|
||||
nodes = NULL;
|
||||
}
|
||||
|
||||
if (got_cname) {
|
||||
ares__addrinfo_cat_cnames(&ai->cnames, cnames);
|
||||
ares_addrinfo_cat_cnames(&ai->cnames, cnames);
|
||||
cnames = NULL;
|
||||
}
|
||||
|
||||
done:
|
||||
ares__freeaddrinfo_cnames(cnames);
|
||||
ares__freeaddrinfo_nodes(nodes);
|
||||
ares_freeaddrinfo_cnames(cnames);
|
||||
ares_freeaddrinfo_nodes(nodes);
|
||||
|
||||
/* compatibility */
|
||||
if (status == ARES_EBADNAME) {
|
||||
11047
deps/cares/src/lib/ares_platform.c
vendored
11047
deps/cares/src/lib/ares_platform.c
vendored
File diff suppressed because it is too large
Load Diff
597
deps/cares/src/lib/ares_private.h
vendored
597
deps/cares/src/lib/ares_private.h
vendored
|
|
@ -40,6 +40,36 @@
|
|||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "ares_mem.h"
|
||||
#include "ares_ipv6.h"
|
||||
#include "util/ares_math.h"
|
||||
#include "util/ares_time.h"
|
||||
#include "util/ares_rand.h"
|
||||
#include "ares_array.h"
|
||||
#include "ares_llist.h"
|
||||
#include "dsa/ares_slist.h"
|
||||
#include "ares_htable_strvp.h"
|
||||
#include "ares_htable_szvp.h"
|
||||
#include "ares_htable_asvp.h"
|
||||
#include "ares_htable_dict.h"
|
||||
#include "ares_htable_vpvp.h"
|
||||
#include "ares_htable_vpstr.h"
|
||||
#include "record/ares_dns_multistring.h"
|
||||
#include "ares_buf.h"
|
||||
#include "record/ares_dns_private.h"
|
||||
#include "util/ares_iface_ips.h"
|
||||
#include "util/ares_threads.h"
|
||||
#include "ares_socket.h"
|
||||
#include "ares_conn.h"
|
||||
#include "ares_str.h"
|
||||
#include "str/ares_strsplit.h"
|
||||
#include "util/ares_uri.h"
|
||||
|
||||
#ifndef HAVE_GETENV
|
||||
# include "ares_getenv.h"
|
||||
# define getenv(ptr) ares_getenv(ptr)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_TIMEOUT 2000 /* milliseconds */
|
||||
#define DEFAULT_TRIES 3
|
||||
#ifndef INADDR_NONE
|
||||
|
|
@ -100,42 +130,6 @@ W32_FUNC const char *_w32_GetHostsFile(void);
|
|||
|
||||
#endif
|
||||
|
||||
#include "ares_ipv6.h"
|
||||
|
||||
struct ares_rand_state;
|
||||
typedef struct ares_rand_state ares_rand_state;
|
||||
|
||||
#include "dsa/ares__array.h"
|
||||
#include "dsa/ares__llist.h"
|
||||
#include "dsa/ares__slist.h"
|
||||
#include "dsa/ares__htable_strvp.h"
|
||||
#include "dsa/ares__htable_szvp.h"
|
||||
#include "dsa/ares__htable_asvp.h"
|
||||
#include "dsa/ares__htable_vpvp.h"
|
||||
#include "record/ares_dns_multistring.h"
|
||||
#include "str/ares__buf.h"
|
||||
#include "record/ares_dns_private.h"
|
||||
#include "util/ares__iface_ips.h"
|
||||
#include "util/ares__threads.h"
|
||||
|
||||
#ifndef HAVE_GETENV
|
||||
# include "ares_getenv.h"
|
||||
# define getenv(ptr) ares_getenv(ptr)
|
||||
#endif
|
||||
|
||||
#include "str/ares_str.h"
|
||||
#include "str/ares_strsplit.h"
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
# include "str/ares_strcasecmp.h"
|
||||
# define strcasecmp(p1, p2) ares_strcasecmp(p1, p2)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
# include "str/ares_strcasecmp.h"
|
||||
# define strncasecmp(p1, p2, n) ares_strncasecmp(p1, p2, n)
|
||||
#endif
|
||||
|
||||
/********* EDNS defines section ******/
|
||||
#define EDNSPACKETSZ \
|
||||
1232 /* Reasonable UDP payload size, as agreed by operators \
|
||||
|
|
@ -154,140 +148,6 @@ typedef struct ares_rand_state ares_rand_state;
|
|||
struct ares_query;
|
||||
typedef struct ares_query ares_query_t;
|
||||
|
||||
struct ares_server;
|
||||
typedef struct ares_server ares_server_t;
|
||||
|
||||
struct ares_conn;
|
||||
typedef struct ares_conn ares_conn_t;
|
||||
|
||||
typedef enum {
|
||||
/*! No flags */
|
||||
ARES_CONN_FLAG_NONE = 0,
|
||||
/*! TCP connection, not UDP */
|
||||
ARES_CONN_FLAG_TCP = 1 << 0,
|
||||
/*! TCP Fast Open is enabled and being used if supported by the OS */
|
||||
ARES_CONN_FLAG_TFO = 1 << 1,
|
||||
/*! TCP Fast Open has not yet sent its first packet. Gets unset on first
|
||||
* write to a connection */
|
||||
ARES_CONN_FLAG_TFO_INITIAL = 1 << 2
|
||||
} ares_conn_flags_t;
|
||||
|
||||
struct ares_conn {
|
||||
ares_server_t *server;
|
||||
ares_socket_t fd;
|
||||
struct ares_addr self_ip;
|
||||
ares_conn_flags_t flags;
|
||||
/* total number of queries run on this connection since it was established */
|
||||
size_t total_queries;
|
||||
/* list of outstanding queries to this connection */
|
||||
ares__llist_t *queries_to_conn;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef __int64 ares_int64_t;
|
||||
typedef unsigned __int64 ares_uint64_t;
|
||||
#else
|
||||
typedef long long ares_int64_t;
|
||||
typedef unsigned long long ares_uint64_t;
|
||||
#endif
|
||||
|
||||
/*! struct timeval on some systems like Windows doesn't support 64bit time so
|
||||
* therefore can't be used due to Y2K38 issues. Make our own that does have
|
||||
* 64bit time. */
|
||||
typedef struct {
|
||||
ares_int64_t sec; /*!< Seconds */
|
||||
unsigned int usec; /*!< Microseconds. Can't be negative. */
|
||||
} ares_timeval_t;
|
||||
|
||||
/*! Various buckets for grouping history */
|
||||
typedef enum {
|
||||
ARES_METRIC_1MINUTE = 0, /*!< Bucket for tracking over the last minute */
|
||||
ARES_METRIC_15MINUTES, /*!< Bucket for tracking over the last 15 minutes */
|
||||
ARES_METRIC_1HOUR, /*!< Bucket for tracking over the last hour */
|
||||
ARES_METRIC_1DAY, /*!< Bucket for tracking over the last day */
|
||||
ARES_METRIC_INCEPTION, /*!< Bucket for tracking since inception */
|
||||
ARES_METRIC_COUNT /*!< Count of buckets, not a real bucket */
|
||||
} ares_server_bucket_t;
|
||||
|
||||
/*! Data metrics collected for each bucket */
|
||||
typedef struct {
|
||||
time_t ts; /*!< Timestamp divided by bucket divisor */
|
||||
unsigned int latency_min_ms; /*!< Minimum latency for queries */
|
||||
unsigned int latency_max_ms; /*!< Maximum latency for queries */
|
||||
ares_uint64_t total_ms; /*!< Cumulative query time for bucket */
|
||||
ares_uint64_t total_count; /*!< Number of queries for bucket */
|
||||
|
||||
time_t prev_ts; /*!< Previous period bucket timestamp */
|
||||
ares_uint64_t
|
||||
prev_total_ms; /*!< Previous period bucket cumulative query time */
|
||||
ares_uint64_t prev_total_count; /*!< Previous period bucket query count */
|
||||
} ares_server_metrics_t;
|
||||
|
||||
typedef enum {
|
||||
ARES_COOKIE_INITIAL = 0,
|
||||
ARES_COOKIE_GENERATED = 1,
|
||||
ARES_COOKIE_SUPPORTED = 2,
|
||||
ARES_COOKIE_UNSUPPORTED = 3
|
||||
} ares_cookie_state_t;
|
||||
|
||||
/*! Structure holding tracking data for RFC 7873/9018 DNS cookies.
|
||||
* Implementation plan for this feature is here:
|
||||
* https://github.com/c-ares/c-ares/issues/620
|
||||
*/
|
||||
typedef struct {
|
||||
/*! starts at INITIAL, transitions as needed. */
|
||||
ares_cookie_state_t state;
|
||||
/*! randomly-generate client cookie */
|
||||
unsigned char client[8];
|
||||
/*! timestamp client cookie was generated, used for rotation purposes */
|
||||
ares_timeval_t client_ts;
|
||||
/*! IP address last used for client to connect to server. If this changes
|
||||
* The client cookie gets invalidated */
|
||||
struct ares_addr client_ip;
|
||||
/*! Server Cookie last received, 8-32 bytes in length */
|
||||
unsigned char server[32];
|
||||
/*! Length of server cookie on file. */
|
||||
size_t server_len;
|
||||
/*! Timestamp of last attempt to use cookies, but it was determined that the
|
||||
* server didn't support them */
|
||||
ares_timeval_t unsupported_ts;
|
||||
} ares_cookie_t;
|
||||
|
||||
struct ares_server {
|
||||
/* Configuration */
|
||||
size_t idx; /* index for server in system configuration */
|
||||
struct ares_addr addr;
|
||||
unsigned short udp_port; /* host byte order */
|
||||
unsigned short tcp_port; /* host byte order */
|
||||
char ll_iface[64]; /* IPv6 Link Local Interface */
|
||||
unsigned int ll_scope; /* IPv6 Link Local Scope */
|
||||
|
||||
size_t consec_failures; /* Consecutive query failure count
|
||||
* can be hard errors or timeouts
|
||||
*/
|
||||
ares__llist_t *connections;
|
||||
ares_conn_t *tcp_conn;
|
||||
|
||||
/* The next time when we will retry this server if it has hit failures */
|
||||
ares_timeval_t next_retry_time;
|
||||
|
||||
/* TCP buffer since multiple responses can come back in one read, or partial
|
||||
* in a read */
|
||||
ares__buf_t *tcp_parser;
|
||||
|
||||
/* TCP output queue */
|
||||
ares__buf_t *tcp_send;
|
||||
|
||||
/*! Buckets for collecting metrics about the server */
|
||||
ares_server_metrics_t metrics[ARES_METRIC_COUNT];
|
||||
|
||||
/*! RFC 7873/9018 DNS Cookies */
|
||||
ares_cookie_t cookie;
|
||||
|
||||
/* Link back to owning channel */
|
||||
ares_channel_t *channel;
|
||||
};
|
||||
|
||||
/* State to represent a DNS query */
|
||||
struct ares_query {
|
||||
/* Query ID from qbuf, for faster lookup, and current timeout */
|
||||
|
|
@ -300,9 +160,9 @@ struct ares_query {
|
|||
* Node object for each list entry the query belongs to in order to
|
||||
* make removal operations O(1).
|
||||
*/
|
||||
ares__slist_node_t *node_queries_by_timeout;
|
||||
ares__llist_node_t *node_queries_to_conn;
|
||||
ares__llist_node_t *node_all_queries;
|
||||
ares_slist_node_t *node_queries_by_timeout;
|
||||
ares_llist_node_t *node_queries_to_conn;
|
||||
ares_llist_node_t *node_all_queries;
|
||||
|
||||
/* connection handle query is associated with */
|
||||
ares_conn_t *conn;
|
||||
|
|
@ -328,71 +188,71 @@ struct apattern {
|
|||
unsigned char mask;
|
||||
};
|
||||
|
||||
struct ares__qcache;
|
||||
typedef struct ares__qcache ares__qcache_t;
|
||||
struct ares_qcache;
|
||||
typedef struct ares_qcache ares_qcache_t;
|
||||
|
||||
struct ares_hosts_file;
|
||||
typedef struct ares_hosts_file ares_hosts_file_t;
|
||||
|
||||
struct ares_channeldata {
|
||||
/* Configuration data */
|
||||
unsigned int flags;
|
||||
size_t timeout; /* in milliseconds */
|
||||
size_t tries;
|
||||
size_t ndots;
|
||||
size_t maxtimeout; /* in milliseconds */
|
||||
ares_bool_t rotate;
|
||||
unsigned short udp_port; /* stored in network order */
|
||||
unsigned short tcp_port; /* stored in network order */
|
||||
int socket_send_buffer_size; /* setsockopt takes int */
|
||||
int socket_receive_buffer_size; /* setsockopt takes int */
|
||||
char **domains;
|
||||
size_t ndomains;
|
||||
struct apattern *sortlist;
|
||||
size_t nsort;
|
||||
char *lookups;
|
||||
size_t ednspsz;
|
||||
unsigned int qcache_max_ttl;
|
||||
ares_evsys_t evsys;
|
||||
unsigned int optmask;
|
||||
unsigned int flags;
|
||||
size_t timeout; /* in milliseconds */
|
||||
size_t tries;
|
||||
size_t ndots;
|
||||
size_t maxtimeout; /* in milliseconds */
|
||||
ares_bool_t rotate;
|
||||
unsigned short udp_port; /* stored in network order */
|
||||
unsigned short tcp_port; /* stored in network order */
|
||||
int socket_send_buffer_size; /* setsockopt takes int */
|
||||
int socket_receive_buffer_size; /* setsockopt takes int */
|
||||
char **domains;
|
||||
size_t ndomains;
|
||||
struct apattern *sortlist;
|
||||
size_t nsort;
|
||||
char *lookups;
|
||||
size_t ednspsz;
|
||||
unsigned int qcache_max_ttl;
|
||||
ares_evsys_t evsys;
|
||||
unsigned int optmask;
|
||||
|
||||
/* For binding to local devices and/or IP addresses. Leave
|
||||
* them null/zero for no binding.
|
||||
*/
|
||||
char local_dev_name[32];
|
||||
unsigned int local_ip4;
|
||||
unsigned char local_ip6[16];
|
||||
char local_dev_name[32];
|
||||
unsigned int local_ip4;
|
||||
unsigned char local_ip6[16];
|
||||
|
||||
/* Thread safety lock */
|
||||
ares__thread_mutex_t *lock;
|
||||
ares_thread_mutex_t *lock;
|
||||
|
||||
/* Conditional to wake waiters when queue is empty */
|
||||
ares__thread_cond_t *cond_empty;
|
||||
ares_thread_cond_t *cond_empty;
|
||||
|
||||
/* Server addresses and communications state. Sorted by least consecutive
|
||||
* failures, followed by the configuration order if failures are equal. */
|
||||
ares__slist_t *servers;
|
||||
ares_slist_t *servers;
|
||||
|
||||
/* random state to use when generating new ids and generating retry penalties
|
||||
*/
|
||||
ares_rand_state *rand_state;
|
||||
ares_rand_state *rand_state;
|
||||
|
||||
/* All active queries in a single list */
|
||||
ares__llist_t *all_queries;
|
||||
ares_llist_t *all_queries;
|
||||
/* Queries bucketed by qid, for quickly dispatching DNS responses: */
|
||||
ares__htable_szvp_t *queries_by_qid;
|
||||
ares_htable_szvp_t *queries_by_qid;
|
||||
|
||||
/* Queries bucketed by timeout, for quickly handling timeouts: */
|
||||
ares__slist_t *queries_by_timeout;
|
||||
ares_slist_t *queries_by_timeout;
|
||||
|
||||
/* Map linked list node member for connection to file descriptor. We use
|
||||
* the node instead of the connection object itself so we can quickly look
|
||||
* up a connection and remove it if necessary (as otherwise we'd have to
|
||||
* scan all connections) */
|
||||
ares__htable_asvp_t *connnode_by_socket;
|
||||
ares_htable_asvp_t *connnode_by_socket;
|
||||
|
||||
ares_sock_state_cb sock_state_cb;
|
||||
void *sock_state_cb_data;
|
||||
ares_sock_state_cb sock_state_cb;
|
||||
void *sock_state_cb_data;
|
||||
|
||||
ares_sock_create_callback sock_create_cb;
|
||||
void *sock_create_cb_data;
|
||||
|
|
@ -400,8 +260,14 @@ struct ares_channeldata {
|
|||
ares_sock_config_callback sock_config_cb;
|
||||
void *sock_config_cb_data;
|
||||
|
||||
const struct ares_socket_functions *sock_funcs;
|
||||
struct ares_socket_functions_ex sock_funcs;
|
||||
void *sock_func_cb_data;
|
||||
const struct ares_socket_functions *legacy_sock_funcs;
|
||||
void *legacy_sock_funcs_cb_data;
|
||||
|
||||
ares_pending_write_cb notify_pending_write_cb;
|
||||
void *notify_pending_write_cb_data;
|
||||
ares_bool_t notify_pending_write;
|
||||
|
||||
/* Path for resolv.conf file, configurable via ares_options */
|
||||
char *resolvconf_path;
|
||||
|
|
@ -416,7 +282,7 @@ struct ares_channeldata {
|
|||
ares_hosts_file_t *hf;
|
||||
|
||||
/* Query Cache */
|
||||
ares__qcache_t *qcache;
|
||||
ares_qcache_t *qcache;
|
||||
|
||||
/* Fields controlling server failover behavior.
|
||||
* The retry chance is the probability (1/N) by which we will retry a failed
|
||||
|
|
@ -437,7 +303,7 @@ struct ares_channeldata {
|
|||
* reading may block. The thread handle is provided for waiting on thread
|
||||
* exit. */
|
||||
ares_bool_t reinit_pending;
|
||||
ares__thread_t *reinit_thread;
|
||||
ares_thread_t *reinit_thread;
|
||||
|
||||
/* Whether the system is up or not. This is mainly to prevent deadlocks
|
||||
* and access violations during the cleanup process. Some things like
|
||||
|
|
@ -447,29 +313,18 @@ struct ares_channeldata {
|
|||
};
|
||||
|
||||
/* Does the domain end in ".onion" or ".onion."? Case-insensitive. */
|
||||
ares_bool_t ares__is_onion_domain(const char *name);
|
||||
|
||||
/* Memory management functions */
|
||||
extern void *(*ares_malloc)(size_t size);
|
||||
extern void *(*ares_realloc)(void *ptr, size_t size);
|
||||
extern void (*ares_free)(void *ptr);
|
||||
void *ares_malloc_zero(size_t size);
|
||||
void *ares_realloc_zero(void *ptr, size_t orig_size, size_t new_size);
|
||||
|
||||
/* return true if now is exactly check time or later */
|
||||
ares_bool_t ares__timedout(const ares_timeval_t *now,
|
||||
const ares_timeval_t *check);
|
||||
ares_bool_t ares_is_onion_domain(const char *name);
|
||||
|
||||
/* Returns one of the normal ares status codes like ARES_SUCCESS */
|
||||
ares_status_t ares__send_query(ares_query_t *query, const ares_timeval_t *now);
|
||||
ares_status_t ares__requeue_query(ares_query_t *query,
|
||||
const ares_timeval_t *now,
|
||||
ares_status_t status,
|
||||
ares_bool_t inc_try_count,
|
||||
const ares_dns_record_t *dnsrec);
|
||||
ares_status_t ares_send_query(ares_server_t *requested_server /* Optional */,
|
||||
ares_query_t *query, const ares_timeval_t *now);
|
||||
ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t *now,
|
||||
ares_status_t status,
|
||||
ares_bool_t inc_try_count,
|
||||
const ares_dns_record_t *dnsrec);
|
||||
|
||||
/*! Count the number of labels (dots+1) in a domain */
|
||||
size_t ares__name_label_cnt(const char *name);
|
||||
size_t ares_name_label_cnt(const char *name);
|
||||
|
||||
/*! Retrieve a list of names to use for searching. The first successful
|
||||
* query in the list wins. This function also uses the HOSTSALIASES file
|
||||
|
|
@ -477,57 +332,45 @@ size_t ares__name_label_cnt(const char *name);
|
|||
*
|
||||
* \param[in] channel initialized ares channel
|
||||
* \param[in] name initial name being searched
|
||||
* \param[out] names array of names to attempt, use ares__strsplit_free()
|
||||
* \param[out] names array of names to attempt, use ares_strsplit_free()
|
||||
* when no longer needed.
|
||||
* \param[out] names_len number of names in array
|
||||
* \return ARES_SUCCESS on success, otherwise one of the other error codes.
|
||||
*/
|
||||
ares_status_t ares__search_name_list(const ares_channel_t *channel,
|
||||
const char *name, char ***names,
|
||||
size_t *names_len);
|
||||
ares_status_t ares_search_name_list(const ares_channel_t *channel,
|
||||
const char *name, char ***names,
|
||||
size_t *names_len);
|
||||
|
||||
/*! Function to create callback arg for converting from ares_callback_dnsrec
|
||||
* to ares_calback */
|
||||
void *ares__dnsrec_convert_arg(ares_callback callback, void *arg);
|
||||
void *ares_dnsrec_convert_arg(ares_callback callback, void *arg);
|
||||
|
||||
/*! Callback function used to convert from the ares_callback_dnsrec prototype to
|
||||
* the ares_callback prototype, by writing the result and passing that to
|
||||
* the inner callback.
|
||||
*/
|
||||
void ares__dnsrec_convert_cb(void *arg, ares_status_t status, size_t timeouts,
|
||||
const ares_dns_record_t *dnsrec);
|
||||
void ares_dnsrec_convert_cb(void *arg, ares_status_t status, size_t timeouts,
|
||||
const ares_dns_record_t *dnsrec);
|
||||
|
||||
void ares__close_connection(ares_conn_t *conn, ares_status_t requeue_status);
|
||||
void ares__close_sockets(ares_server_t *server);
|
||||
void ares__check_cleanup_conns(const ares_channel_t *channel);
|
||||
void ares__free_query(ares_query_t *query);
|
||||
void ares_free_query(ares_query_t *query);
|
||||
|
||||
ares_rand_state *ares__init_rand_state(void);
|
||||
void ares__destroy_rand_state(ares_rand_state *state);
|
||||
void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len);
|
||||
|
||||
unsigned short ares__generate_new_id(ares_rand_state *state);
|
||||
void ares__tvnow(ares_timeval_t *now);
|
||||
void ares__timeval_remaining(ares_timeval_t *remaining,
|
||||
const ares_timeval_t *now,
|
||||
const ares_timeval_t *tout);
|
||||
void ares__timeval_diff(ares_timeval_t *tvdiff, const ares_timeval_t *tvstart,
|
||||
const ares_timeval_t *tvstop);
|
||||
ares_status_t ares__expand_name_validated(const unsigned char *encoded,
|
||||
const unsigned char *abuf,
|
||||
size_t alen, char **s, size_t *enclen,
|
||||
unsigned short ares_generate_new_id(ares_rand_state *state);
|
||||
ares_status_t ares_expand_name_validated(const unsigned char *encoded,
|
||||
const unsigned char *abuf, size_t alen,
|
||||
char **s, size_t *enclen,
|
||||
ares_bool_t is_hostname);
|
||||
ares_status_t ares_expand_string_ex(const unsigned char *encoded,
|
||||
const unsigned char *abuf, size_t alen,
|
||||
unsigned char **s, size_t *enclen);
|
||||
ares_status_t ares__init_servers_state(ares_channel_t *channel);
|
||||
ares_status_t ares__init_by_options(ares_channel_t *channel,
|
||||
ares_status_t ares_expand_string_ex(const unsigned char *encoded,
|
||||
const unsigned char *abuf, size_t alen,
|
||||
unsigned char **s, size_t *enclen);
|
||||
ares_status_t ares_init_servers_state(ares_channel_t *channel);
|
||||
ares_status_t ares_init_by_options(ares_channel_t *channel,
|
||||
const struct ares_options *options,
|
||||
int optmask);
|
||||
ares_status_t ares__init_by_sysconfig(ares_channel_t *channel);
|
||||
ares_status_t ares_init_by_sysconfig(ares_channel_t *channel);
|
||||
void ares_set_socket_functions_def(ares_channel_t *channel);
|
||||
|
||||
typedef struct {
|
||||
ares__llist_t *sconfig;
|
||||
ares_llist_t *sconfig;
|
||||
struct apattern *sortlist;
|
||||
size_t nsortlist;
|
||||
char **domains;
|
||||
|
|
@ -540,131 +383,108 @@ typedef struct {
|
|||
ares_bool_t usevc;
|
||||
} ares_sysconfig_t;
|
||||
|
||||
ares_status_t ares__sysconfig_set_options(ares_sysconfig_t *sysconfig,
|
||||
const char *str);
|
||||
ares_status_t ares_sysconfig_set_options(ares_sysconfig_t *sysconfig,
|
||||
const char *str);
|
||||
|
||||
ares_status_t ares__init_by_environment(ares_sysconfig_t *sysconfig);
|
||||
ares_status_t ares_init_by_environment(ares_sysconfig_t *sysconfig);
|
||||
|
||||
ares_status_t ares__init_sysconfig_files(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig);
|
||||
ares_status_t ares_init_sysconfig_files(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig);
|
||||
#ifdef __APPLE__
|
||||
ares_status_t ares__init_sysconfig_macos(ares_sysconfig_t *sysconfig);
|
||||
ares_status_t ares_init_sysconfig_macos(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig);
|
||||
#endif
|
||||
#ifdef USE_WINSOCK
|
||||
ares_status_t ares__init_sysconfig_windows(ares_sysconfig_t *sysconfig);
|
||||
ares_status_t ares_init_sysconfig_windows(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig);
|
||||
#endif
|
||||
|
||||
ares_status_t ares__parse_sortlist(struct apattern **sortlist, size_t *nsort,
|
||||
const char *str);
|
||||
|
||||
void ares__destroy_servers_state(ares_channel_t *channel);
|
||||
ares_status_t ares_parse_sortlist(struct apattern **sortlist, size_t *nsort,
|
||||
const char *str);
|
||||
|
||||
/* Returns ARES_SUCCESS if alias found, alias is set. Returns ARES_ENOTFOUND
|
||||
* if not alias found. Returns other errors on critical failure like
|
||||
* ARES_ENOMEM */
|
||||
ares_status_t ares__lookup_hostaliases(const ares_channel_t *channel,
|
||||
const char *name, char **alias);
|
||||
ares_status_t ares_lookup_hostaliases(const ares_channel_t *channel,
|
||||
const char *name, char **alias);
|
||||
|
||||
ares_status_t ares__cat_domain(const char *name, const char *domain, char **s);
|
||||
ares_status_t ares__sortaddrinfo(ares_channel_t *channel,
|
||||
struct ares_addrinfo_node *ai_node);
|
||||
ares_status_t ares_cat_domain(const char *name, const char *domain, char **s);
|
||||
ares_status_t ares_sortaddrinfo(ares_channel_t *channel,
|
||||
struct ares_addrinfo_node *ai_node);
|
||||
|
||||
void ares__freeaddrinfo_nodes(struct ares_addrinfo_node *ai_node);
|
||||
ares_bool_t ares__is_localhost(const char *name);
|
||||
void ares_freeaddrinfo_nodes(struct ares_addrinfo_node *ai_node);
|
||||
ares_bool_t ares_is_localhost(const char *name);
|
||||
|
||||
struct ares_addrinfo_node *
|
||||
ares__append_addrinfo_node(struct ares_addrinfo_node **ai_node);
|
||||
void ares__addrinfo_cat_nodes(struct ares_addrinfo_node **head,
|
||||
struct ares_addrinfo_node *tail);
|
||||
ares_append_addrinfo_node(struct ares_addrinfo_node **ai_node);
|
||||
void ares_addrinfo_cat_nodes(struct ares_addrinfo_node **head,
|
||||
struct ares_addrinfo_node *tail);
|
||||
|
||||
void ares__freeaddrinfo_cnames(struct ares_addrinfo_cname *ai_cname);
|
||||
void ares_freeaddrinfo_cnames(struct ares_addrinfo_cname *ai_cname);
|
||||
|
||||
struct ares_addrinfo_cname *
|
||||
ares__append_addrinfo_cname(struct ares_addrinfo_cname **ai_cname);
|
||||
struct ares_addrinfo_cname *
|
||||
ares_append_addrinfo_cname(struct ares_addrinfo_cname **ai_cname);
|
||||
|
||||
ares_status_t ares_append_ai_node(int aftype, unsigned short port,
|
||||
unsigned int ttl, const void *adata,
|
||||
struct ares_addrinfo_node **nodes);
|
||||
|
||||
void ares__addrinfo_cat_cnames(struct ares_addrinfo_cname **head,
|
||||
struct ares_addrinfo_cname *tail);
|
||||
void ares_addrinfo_cat_cnames(struct ares_addrinfo_cname **head,
|
||||
struct ares_addrinfo_cname *tail);
|
||||
|
||||
ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
||||
ares_bool_t cname_only_is_enodata,
|
||||
unsigned short port,
|
||||
struct ares_addrinfo *ai);
|
||||
ares_status_t ares_parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
||||
ares_bool_t cname_only_is_enodata,
|
||||
unsigned short port,
|
||||
struct ares_addrinfo *ai);
|
||||
ares_status_t ares_parse_ptr_reply_dnsrec(const ares_dns_record_t *dnsrec,
|
||||
const void *addr, int addrlen,
|
||||
int family, struct hostent **host);
|
||||
|
||||
ares_status_t ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family,
|
||||
struct hostent **host);
|
||||
ares_status_t ares__addrinfo2addrttl(const struct ares_addrinfo *ai, int family,
|
||||
size_t req_naddrttls,
|
||||
struct ares_addrttl *addrttls,
|
||||
struct ares_addr6ttl *addr6ttls,
|
||||
size_t *naddrttls);
|
||||
ares_status_t ares__addrinfo_localhost(const char *name, unsigned short port,
|
||||
const struct ares_addrinfo_hints *hints,
|
||||
struct ares_addrinfo *ai);
|
||||
ares_status_t ares__open_connection(ares_conn_t **conn_out,
|
||||
ares_channel_t *channel,
|
||||
ares_server_t *server, ares_bool_t is_tcp);
|
||||
ares_bool_t ares_sockaddr_to_ares_addr(struct ares_addr *ares_addr,
|
||||
unsigned short *port,
|
||||
const struct sockaddr *sockaddr);
|
||||
ares_socket_t ares__open_socket(ares_channel_t *channel, int af, int type,
|
||||
int protocol);
|
||||
ares_bool_t ares__socket_try_again(int errnum);
|
||||
ares_ssize_t ares__conn_write(ares_conn_t *conn, const void *data, size_t len);
|
||||
ares_ssize_t ares__socket_recvfrom(ares_channel_t *channel, ares_socket_t s,
|
||||
void *data, size_t data_len, int flags,
|
||||
struct sockaddr *from,
|
||||
ares_socklen_t *from_len);
|
||||
ares_ssize_t ares__socket_recv(ares_channel_t *channel, ares_socket_t s,
|
||||
void *data, size_t data_len);
|
||||
void ares__close_socket(ares_channel_t *channel, ares_socket_t s);
|
||||
ares_status_t ares__connect_socket(ares_channel_t *channel,
|
||||
ares_socket_t sockfd,
|
||||
const struct sockaddr *addr,
|
||||
ares_socklen_t addrlen);
|
||||
void ares__destroy_server(ares_server_t *server);
|
||||
ares_status_t ares_addrinfo2hostent(const struct ares_addrinfo *ai, int family,
|
||||
struct hostent **host);
|
||||
ares_status_t ares_addrinfo2addrttl(const struct ares_addrinfo *ai, int family,
|
||||
size_t req_naddrttls,
|
||||
struct ares_addrttl *addrttls,
|
||||
struct ares_addr6ttl *addr6ttls,
|
||||
size_t *naddrttls);
|
||||
ares_status_t ares_addrinfo_localhost(const char *name, unsigned short port,
|
||||
const struct ares_addrinfo_hints *hints,
|
||||
struct ares_addrinfo *ai);
|
||||
|
||||
ares_status_t ares__servers_update(ares_channel_t *channel,
|
||||
ares__llist_t *server_list,
|
||||
ares_bool_t user_specified);
|
||||
ares_status_t ares__sconfig_append(ares__llist_t **sconfig,
|
||||
const struct ares_addr *addr,
|
||||
unsigned short udp_port,
|
||||
unsigned short tcp_port,
|
||||
const char *ll_iface);
|
||||
ares_status_t ares__sconfig_append_fromstr(ares__llist_t **sconfig,
|
||||
const char *str,
|
||||
ares_bool_t ignore_invalid);
|
||||
ares_status_t ares_in_addr_to_server_config_llist(const struct in_addr *servers,
|
||||
size_t nservers,
|
||||
ares__llist_t **llist);
|
||||
ares_status_t ares_servers_update(ares_channel_t *channel,
|
||||
ares_llist_t *server_list,
|
||||
ares_bool_t user_specified);
|
||||
ares_status_t
|
||||
ares_sconfig_append(const ares_channel_t *channel, ares_llist_t **sconfig,
|
||||
const struct ares_addr *addr, unsigned short udp_port,
|
||||
unsigned short tcp_port, const char *ll_iface);
|
||||
ares_status_t ares_sconfig_append_fromstr(const ares_channel_t *channel,
|
||||
ares_llist_t **sconfig,
|
||||
const char *str,
|
||||
ares_bool_t ignore_invalid);
|
||||
ares_status_t ares_in_addr_to_sconfig_llist(const struct in_addr *servers,
|
||||
size_t nservers,
|
||||
ares_llist_t **llist);
|
||||
ares_status_t ares_get_server_addr(const ares_server_t *server,
|
||||
ares__buf_t *buf);
|
||||
ares_buf_t *buf);
|
||||
|
||||
struct ares_hosts_entry;
|
||||
typedef struct ares_hosts_entry ares_hosts_entry_t;
|
||||
|
||||
void ares__hosts_file_destroy(ares_hosts_file_t *hf);
|
||||
ares_status_t ares__hosts_search_ipaddr(ares_channel_t *channel,
|
||||
ares_bool_t use_env, const char *ipaddr,
|
||||
const ares_hosts_entry_t **entry);
|
||||
ares_status_t ares__hosts_search_host(ares_channel_t *channel,
|
||||
ares_bool_t use_env, const char *host,
|
||||
const ares_hosts_entry_t **entry);
|
||||
ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
||||
int family,
|
||||
struct hostent **hostent);
|
||||
ares_status_t ares__hosts_entry_to_addrinfo(const ares_hosts_entry_t *entry,
|
||||
const char *name, int family,
|
||||
unsigned short port,
|
||||
ares_bool_t want_cnames,
|
||||
struct ares_addrinfo *ai);
|
||||
void ares_hosts_file_destroy(ares_hosts_file_t *hf);
|
||||
ares_status_t ares_hosts_search_ipaddr(ares_channel_t *channel,
|
||||
ares_bool_t use_env, const char *ipaddr,
|
||||
const ares_hosts_entry_t **entry);
|
||||
ares_status_t ares_hosts_search_host(ares_channel_t *channel,
|
||||
ares_bool_t use_env, const char *host,
|
||||
const ares_hosts_entry_t **entry);
|
||||
ares_status_t ares_hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
||||
int family, struct hostent **hostent);
|
||||
ares_status_t ares_hosts_entry_to_addrinfo(const ares_hosts_entry_t *entry,
|
||||
const char *name, int family,
|
||||
unsigned short port,
|
||||
ares_bool_t want_cnames,
|
||||
struct ares_addrinfo *ai);
|
||||
|
||||
/* Same as ares_query_dnsrec() except does not take a channel lock. Use this
|
||||
* if a channel lock is already held */
|
||||
|
|
@ -674,9 +494,17 @@ ares_status_t ares_query_nolock(ares_channel_t *channel, const char *name,
|
|||
ares_callback_dnsrec callback, void *arg,
|
||||
unsigned short *qid);
|
||||
|
||||
/* Same as ares_send_dnsrec() except does not take a channel lock. Use this
|
||||
* if a channel lock is already held */
|
||||
ares_status_t ares_send_nolock(ares_channel_t *channel,
|
||||
/*! Flags controlling behavior for ares_send_nolock() */
|
||||
typedef enum {
|
||||
ARES_SEND_FLAG_NOCACHE = 1 << 0, /*!< Do not query the cache */
|
||||
ARES_SEND_FLAG_NORETRY = 1 << 1 /*!< Do not retry this query on error */
|
||||
} ares_send_flags_t;
|
||||
|
||||
/* Similar to ares_send_dnsrec() except does not take a channel lock, allows
|
||||
* specifying a particular server to use, and also flags controlling behavior.
|
||||
*/
|
||||
ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
|
||||
ares_send_flags_t flags,
|
||||
const ares_dns_record_t *dnsrec,
|
||||
ares_callback_dnsrec callback, void *arg,
|
||||
unsigned short *qid);
|
||||
|
|
@ -691,7 +519,7 @@ void ares_gethostbyaddr_nolock(ares_channel_t *channel, const void *addr,
|
|||
* offset within the buffer.
|
||||
*
|
||||
* It is assumed that either a const buffer is being used, or before
|
||||
* the message processing was started that ares__buf_reclaim() was called.
|
||||
* the message processing was started that ares_buf_reclaim() was called.
|
||||
*
|
||||
* \param[in] buf Initialized buffer object
|
||||
* \param[out] name Pointer passed by reference to be filled in with
|
||||
|
|
@ -701,8 +529,8 @@ void ares_gethostbyaddr_nolock(ares_channel_t *channel, const void *addr,
|
|||
* a valid hostname or will return error.
|
||||
* \return ARES_SUCCESS on success
|
||||
*/
|
||||
ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name,
|
||||
ares_bool_t is_hostname);
|
||||
ares_status_t ares_dns_name_parse(ares_buf_t *buf, char **name,
|
||||
ares_bool_t is_hostname);
|
||||
|
||||
/*! Write the DNS name to the buffer in the DNS domain-name syntax as a
|
||||
* series of labels. The maximum domain name length is 255 characters with
|
||||
|
|
@ -721,9 +549,9 @@ ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name,
|
|||
* \return ARES_SUCCESS on success, most likely ARES_EBADNAME if the name is
|
||||
* bad.
|
||||
*/
|
||||
ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list,
|
||||
ares_bool_t validate_hostname,
|
||||
const char *name);
|
||||
ares_status_t ares_dns_name_write(ares_buf_t *buf, ares_llist_t **list,
|
||||
ares_bool_t validate_hostname,
|
||||
const char *name);
|
||||
|
||||
/*! Check if the queue is empty, if so, wake any waiters. This is only
|
||||
* effective if built with threading support.
|
||||
|
|
@ -734,35 +562,20 @@ ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list,
|
|||
*/
|
||||
void ares_queue_notify_empty(ares_channel_t *channel);
|
||||
|
||||
|
||||
#define SOCK_STATE_CALLBACK(c, s, r, w) \
|
||||
do { \
|
||||
if ((c)->sock_state_cb) { \
|
||||
(c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ARES_CONFIG_CHECK(x) \
|
||||
(x && x->lookups && ares__slist_len(x->servers) > 0 && x->timeout > 0 && \
|
||||
#define ARES_CONFIG_CHECK(x) \
|
||||
(x && x->lookups && ares_slist_len(x->servers) > 0 && x->timeout > 0 && \
|
||||
x->tries > 0)
|
||||
|
||||
ares_bool_t ares__subnet_match(const struct ares_addr *addr,
|
||||
const struct ares_addr *subnet,
|
||||
unsigned char netmask);
|
||||
ares_bool_t ares__addr_is_linklocal(const struct ares_addr *addr);
|
||||
ares_bool_t ares_subnet_match(const struct ares_addr *addr,
|
||||
const struct ares_addr *subnet,
|
||||
unsigned char netmask);
|
||||
ares_bool_t ares_addr_is_linklocal(const struct ares_addr *addr);
|
||||
|
||||
ares_bool_t ares__is_64bit(void);
|
||||
size_t ares__round_up_pow2(size_t n);
|
||||
size_t ares__log2(size_t n);
|
||||
size_t ares__pow(size_t x, size_t y);
|
||||
size_t ares__count_digits(size_t n);
|
||||
size_t ares__count_hexdigits(size_t n);
|
||||
unsigned char ares__count_bits_u8(unsigned char x);
|
||||
void ares__qcache_destroy(ares__qcache_t *cache);
|
||||
ares_status_t ares__qcache_create(ares_rand_state *rand_state,
|
||||
unsigned int max_ttl,
|
||||
ares__qcache_t **cache_out);
|
||||
void ares__qcache_flush(ares__qcache_t *cache);
|
||||
void ares_qcache_destroy(ares_qcache_t *cache);
|
||||
ares_status_t ares_qcache_create(ares_rand_state *rand_state,
|
||||
unsigned int max_ttl,
|
||||
ares_qcache_t **cache_out);
|
||||
void ares_qcache_flush(ares_qcache_t *cache);
|
||||
ares_status_t ares_qcache_insert(ares_channel_t *channel,
|
||||
const ares_timeval_t *now,
|
||||
const ares_query_t *query,
|
||||
|
|
@ -784,10 +597,10 @@ ares_status_t ares_cookie_validate(ares_query_t *query,
|
|||
ares_conn_t *conn,
|
||||
const ares_timeval_t *now);
|
||||
|
||||
ares_status_t ares__channel_threading_init(ares_channel_t *channel);
|
||||
void ares__channel_threading_destroy(ares_channel_t *channel);
|
||||
void ares__channel_lock(const ares_channel_t *channel);
|
||||
void ares__channel_unlock(const ares_channel_t *channel);
|
||||
ares_status_t ares_channel_threading_init(ares_channel_t *channel);
|
||||
void ares_channel_threading_destroy(ares_channel_t *channel);
|
||||
void ares_channel_lock(const ares_channel_t *channel);
|
||||
void ares_channel_unlock(const ares_channel_t *channel);
|
||||
|
||||
struct ares_event_thread;
|
||||
typedef struct ares_event_thread ares_event_thread_t;
|
||||
|
|
|
|||
1086
deps/cares/src/lib/ares_process.c
vendored
1086
deps/cares/src/lib/ares_process.c
vendored
File diff suppressed because it is too large
Load Diff
139
deps/cares/src/lib/ares_qcache.c
vendored
139
deps/cares/src/lib/ares_qcache.c
vendored
|
|
@ -25,10 +25,10 @@
|
|||
*/
|
||||
#include "ares_private.h"
|
||||
|
||||
struct ares__qcache {
|
||||
ares__htable_strvp_t *cache;
|
||||
ares__slist_t *expire;
|
||||
unsigned int max_ttl;
|
||||
struct ares_qcache {
|
||||
ares_htable_strvp_t *cache;
|
||||
ares_slist_t *expire;
|
||||
unsigned int max_ttl;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -36,11 +36,11 @@ typedef struct {
|
|||
ares_dns_record_t *dnsrec;
|
||||
time_t expire_ts;
|
||||
time_t insert_ts;
|
||||
} ares__qcache_entry_t;
|
||||
} ares_qcache_entry_t;
|
||||
|
||||
static char *ares__qcache_calc_key(const ares_dns_record_t *dnsrec)
|
||||
static char *ares_qcache_calc_key(const ares_dns_record_t *dnsrec)
|
||||
{
|
||||
ares__buf_t *buf = ares__buf_create();
|
||||
ares_buf_t *buf = ares_buf_create();
|
||||
size_t i;
|
||||
ares_status_t status;
|
||||
ares_dns_flags_t flags;
|
||||
|
|
@ -51,13 +51,13 @@ static char *ares__qcache_calc_key(const ares_dns_record_t *dnsrec)
|
|||
|
||||
/* Format is OPCODE|FLAGS[|QTYPE1|QCLASS1|QNAME1]... */
|
||||
|
||||
status = ares__buf_append_str(
|
||||
status = ares_buf_append_str(
|
||||
buf, ares_dns_opcode_tostr(ares_dns_record_get_opcode(dnsrec)));
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__buf_append_byte(buf, '|');
|
||||
status = ares_buf_append_byte(buf, '|');
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
@ -65,13 +65,13 @@ static char *ares__qcache_calc_key(const ares_dns_record_t *dnsrec)
|
|||
flags = ares_dns_record_get_flags(dnsrec);
|
||||
/* Only care about RD and CD */
|
||||
if (flags & ARES_FLAG_RD) {
|
||||
status = ares__buf_append_str(buf, "rd");
|
||||
status = ares_buf_append_str(buf, "rd");
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
if (flags & ARES_FLAG_CD) {
|
||||
status = ares__buf_append_str(buf, "cd");
|
||||
status = ares_buf_append_str(buf, "cd");
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
@ -88,27 +88,27 @@ static char *ares__qcache_calc_key(const ares_dns_record_t *dnsrec)
|
|||
goto fail; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
status = ares__buf_append_byte(buf, '|');
|
||||
status = ares_buf_append_byte(buf, '|');
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__buf_append_str(buf, ares_dns_rec_type_tostr(qtype));
|
||||
status = ares_buf_append_str(buf, ares_dns_rec_type_tostr(qtype));
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__buf_append_byte(buf, '|');
|
||||
status = ares_buf_append_byte(buf, '|');
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__buf_append_str(buf, ares_dns_class_tostr(qclass));
|
||||
status = ares_buf_append_str(buf, ares_dns_class_tostr(qclass));
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__buf_append_byte(buf, '|');
|
||||
status = ares_buf_append_byte(buf, '|');
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
@ -122,64 +122,63 @@ static char *ares__qcache_calc_key(const ares_dns_record_t *dnsrec)
|
|||
}
|
||||
|
||||
if (name_len > 0) {
|
||||
status = ares__buf_append(buf, (const unsigned char *)name, name_len);
|
||||
status = ares_buf_append(buf, (const unsigned char *)name, name_len);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ares__buf_finish_str(buf, NULL);
|
||||
return ares_buf_finish_str(buf, NULL);
|
||||
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
fail:
|
||||
ares__buf_destroy(buf);
|
||||
ares_buf_destroy(buf);
|
||||
return NULL;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
static void ares__qcache_expire(ares__qcache_t *cache,
|
||||
const ares_timeval_t *now)
|
||||
static void ares_qcache_expire(ares_qcache_t *cache, const ares_timeval_t *now)
|
||||
{
|
||||
ares__slist_node_t *node;
|
||||
ares_slist_node_t *node;
|
||||
|
||||
if (cache == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ((node = ares__slist_node_first(cache->expire)) != NULL) {
|
||||
const ares__qcache_entry_t *entry = ares__slist_node_val(node);
|
||||
while ((node = ares_slist_node_first(cache->expire)) != NULL) {
|
||||
const ares_qcache_entry_t *entry = ares_slist_node_val(node);
|
||||
|
||||
/* If now is NULL, we're flushing everything, so don't break */
|
||||
if (now != NULL && entry->expire_ts > now->sec) {
|
||||
break;
|
||||
}
|
||||
|
||||
ares__htable_strvp_remove(cache->cache, entry->key);
|
||||
ares__slist_node_destroy(node);
|
||||
ares_htable_strvp_remove(cache->cache, entry->key);
|
||||
ares_slist_node_destroy(node);
|
||||
}
|
||||
}
|
||||
|
||||
void ares__qcache_flush(ares__qcache_t *cache)
|
||||
void ares_qcache_flush(ares_qcache_t *cache)
|
||||
{
|
||||
ares__qcache_expire(cache, NULL /* flush all */);
|
||||
ares_qcache_expire(cache, NULL /* flush all */);
|
||||
}
|
||||
|
||||
void ares__qcache_destroy(ares__qcache_t *cache)
|
||||
void ares_qcache_destroy(ares_qcache_t *cache)
|
||||
{
|
||||
if (cache == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ares__htable_strvp_destroy(cache->cache);
|
||||
ares__slist_destroy(cache->expire);
|
||||
ares_htable_strvp_destroy(cache->cache);
|
||||
ares_slist_destroy(cache->expire);
|
||||
ares_free(cache);
|
||||
}
|
||||
|
||||
static int ares__qcache_entry_sort_cb(const void *arg1, const void *arg2)
|
||||
static int ares_qcache_entry_sort_cb(const void *arg1, const void *arg2)
|
||||
{
|
||||
const ares__qcache_entry_t *entry1 = arg1;
|
||||
const ares__qcache_entry_t *entry2 = arg2;
|
||||
const ares_qcache_entry_t *entry1 = arg1;
|
||||
const ares_qcache_entry_t *entry2 = arg2;
|
||||
|
||||
if (entry1->expire_ts > entry2->expire_ts) {
|
||||
return 1;
|
||||
|
|
@ -192,9 +191,9 @@ static int ares__qcache_entry_sort_cb(const void *arg1, const void *arg2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ares__qcache_entry_destroy_cb(void *arg)
|
||||
static void ares_qcache_entry_destroy_cb(void *arg)
|
||||
{
|
||||
ares__qcache_entry_t *entry = arg;
|
||||
ares_qcache_entry_t *entry = arg;
|
||||
if (entry == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
|
@ -204,12 +203,12 @@ static void ares__qcache_entry_destroy_cb(void *arg)
|
|||
ares_free(entry);
|
||||
}
|
||||
|
||||
ares_status_t ares__qcache_create(ares_rand_state *rand_state,
|
||||
unsigned int max_ttl,
|
||||
ares__qcache_t **cache_out)
|
||||
ares_status_t ares_qcache_create(ares_rand_state *rand_state,
|
||||
unsigned int max_ttl,
|
||||
ares_qcache_t **cache_out)
|
||||
{
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares__qcache_t *cache;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares_qcache_t *cache;
|
||||
|
||||
cache = ares_malloc_zero(sizeof(*cache));
|
||||
if (cache == NULL) {
|
||||
|
|
@ -217,14 +216,14 @@ ares_status_t ares__qcache_create(ares_rand_state *rand_state,
|
|||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
cache->cache = ares__htable_strvp_create(NULL);
|
||||
cache->cache = ares_htable_strvp_create(NULL);
|
||||
if (cache->cache == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
cache->expire = ares__slist_create(rand_state, ares__qcache_entry_sort_cb,
|
||||
ares__qcache_entry_destroy_cb);
|
||||
cache->expire = ares_slist_create(rand_state, ares_qcache_entry_sort_cb,
|
||||
ares_qcache_entry_destroy_cb);
|
||||
if (cache->expire == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
|
|
@ -235,7 +234,7 @@ ares_status_t ares__qcache_create(ares_rand_state *rand_state,
|
|||
done:
|
||||
if (status != ARES_SUCCESS) {
|
||||
*cache_out = NULL;
|
||||
ares__qcache_destroy(cache);
|
||||
ares_qcache_destroy(cache);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +242,7 @@ done:
|
|||
return status;
|
||||
}
|
||||
|
||||
static unsigned int ares__qcache_calc_minttl(ares_dns_record_t *dnsrec)
|
||||
static unsigned int ares_qcache_calc_minttl(ares_dns_record_t *dnsrec)
|
||||
{
|
||||
unsigned int minttl = 0xFFFFFFFF;
|
||||
size_t sect;
|
||||
|
|
@ -272,7 +271,7 @@ static unsigned int ares__qcache_calc_minttl(ares_dns_record_t *dnsrec)
|
|||
return minttl;
|
||||
}
|
||||
|
||||
static unsigned int ares__qcache_soa_minimum(ares_dns_record_t *dnsrec)
|
||||
static unsigned int ares_qcache_soa_minimum(ares_dns_record_t *dnsrec)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
|
@ -302,15 +301,15 @@ static unsigned int ares__qcache_soa_minimum(ares_dns_record_t *dnsrec)
|
|||
}
|
||||
|
||||
/* On success, takes ownership of dnsrec */
|
||||
static ares_status_t ares__qcache_insert(ares__qcache_t *qcache,
|
||||
ares_dns_record_t *qresp,
|
||||
const ares_dns_record_t *qreq,
|
||||
const ares_timeval_t *now)
|
||||
static ares_status_t ares_qcache_insert_int(ares_qcache_t *qcache,
|
||||
ares_dns_record_t *qresp,
|
||||
const ares_dns_record_t *qreq,
|
||||
const ares_timeval_t *now)
|
||||
{
|
||||
ares__qcache_entry_t *entry;
|
||||
unsigned int ttl;
|
||||
ares_dns_rcode_t rcode = ares_dns_record_get_rcode(qresp);
|
||||
ares_dns_flags_t flags = ares_dns_record_get_flags(qresp);
|
||||
ares_qcache_entry_t *entry;
|
||||
unsigned int ttl;
|
||||
ares_dns_rcode_t rcode = ares_dns_record_get_rcode(qresp);
|
||||
ares_dns_flags_t flags = ares_dns_record_get_flags(qresp);
|
||||
|
||||
if (qcache == NULL || qresp == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
|
|
@ -328,9 +327,9 @@ static ares_status_t ares__qcache_insert(ares__qcache_t *qcache,
|
|||
|
||||
/* Look at SOA for NXDOMAIN for minimum */
|
||||
if (rcode == ARES_RCODE_NXDOMAIN) {
|
||||
ttl = ares__qcache_soa_minimum(qresp);
|
||||
ttl = ares_qcache_soa_minimum(qresp);
|
||||
} else {
|
||||
ttl = ares__qcache_calc_minttl(qresp);
|
||||
ttl = ares_qcache_calc_minttl(qresp);
|
||||
}
|
||||
|
||||
if (ttl > qcache->max_ttl) {
|
||||
|
|
@ -355,16 +354,16 @@ static ares_status_t ares__qcache_insert(ares__qcache_t *qcache,
|
|||
* request had, so we have to re-parse the request in order to generate the
|
||||
* key for caching, but we'll only do this once we know for sure we really
|
||||
* want to cache it */
|
||||
entry->key = ares__qcache_calc_key(qreq);
|
||||
entry->key = ares_qcache_calc_key(qreq);
|
||||
if (entry->key == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
if (!ares__htable_strvp_insert(qcache->cache, entry->key, entry)) {
|
||||
if (!ares_htable_strvp_insert(qcache->cache, entry->key, entry)) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
if (ares__slist_insert(qcache->expire, entry) == NULL) {
|
||||
if (ares_slist_insert(qcache->expire, entry) == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +372,7 @@ static ares_status_t ares__qcache_insert(ares__qcache_t *qcache,
|
|||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
fail:
|
||||
if (entry != NULL && entry->key != NULL) {
|
||||
ares__htable_strvp_remove(qcache->cache, entry->key);
|
||||
ares_htable_strvp_remove(qcache->cache, entry->key);
|
||||
ares_free(entry->key);
|
||||
ares_free(entry);
|
||||
}
|
||||
|
|
@ -386,9 +385,9 @@ ares_status_t ares_qcache_fetch(ares_channel_t *channel,
|
|||
const ares_dns_record_t *dnsrec,
|
||||
const ares_dns_record_t **dnsrec_resp)
|
||||
{
|
||||
char *key = NULL;
|
||||
ares__qcache_entry_t *entry;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
char *key = NULL;
|
||||
ares_qcache_entry_t *entry;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
|
||||
if (channel == NULL || dnsrec == NULL || dnsrec_resp == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
|
|
@ -398,22 +397,22 @@ ares_status_t ares_qcache_fetch(ares_channel_t *channel,
|
|||
return ARES_ENOTFOUND;
|
||||
}
|
||||
|
||||
ares__qcache_expire(channel->qcache, now);
|
||||
ares_qcache_expire(channel->qcache, now);
|
||||
|
||||
key = ares__qcache_calc_key(dnsrec);
|
||||
key = ares_qcache_calc_key(dnsrec);
|
||||
if (key == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
entry = ares__htable_strvp_get_direct(channel->qcache->cache, key);
|
||||
entry = ares_htable_strvp_get_direct(channel->qcache->cache, key);
|
||||
if (entry == NULL) {
|
||||
status = ARES_ENOTFOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ares_dns_record_write_ttl_decrement(
|
||||
entry->dnsrec, (unsigned int)(now->sec - entry->insert_ts));
|
||||
ares_dns_record_ttl_decrement(entry->dnsrec,
|
||||
(unsigned int)(now->sec - entry->insert_ts));
|
||||
|
||||
*dnsrec_resp = entry->dnsrec;
|
||||
|
||||
|
|
@ -427,5 +426,5 @@ ares_status_t ares_qcache_insert(ares_channel_t *channel,
|
|||
const ares_query_t *query,
|
||||
ares_dns_record_t *dnsrec)
|
||||
{
|
||||
return ares__qcache_insert(channel->qcache, dnsrec, query->query, now);
|
||||
return ares_qcache_insert_int(channel->qcache, dnsrec, query->query, now);
|
||||
}
|
||||
|
|
|
|||
11
deps/cares/src/lib/ares_query.c
vendored
11
deps/cares/src/lib/ares_query.c
vendored
|
|
@ -105,7 +105,8 @@ ares_status_t ares_query_nolock(ares_channel_t *channel, const char *name,
|
|||
qquery->arg = arg;
|
||||
|
||||
/* Send it off. qcallback will be called when we get an answer. */
|
||||
status = ares_send_nolock(channel, dnsrec, ares_query_dnsrec_cb, qquery, qid);
|
||||
status = ares_send_nolock(channel, NULL, 0, dnsrec, ares_query_dnsrec_cb,
|
||||
qquery, qid);
|
||||
|
||||
ares_dns_record_destroy(dnsrec);
|
||||
return status;
|
||||
|
|
@ -123,9 +124,9 @@ ares_status_t ares_query_dnsrec(ares_channel_t *channel, const char *name,
|
|||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
status = ares_query_nolock(channel, name, dnsclass, type, callback, arg, qid);
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -138,13 +139,13 @@ void ares_query(ares_channel_t *channel, const char *name, int dnsclass,
|
|||
return;
|
||||
}
|
||||
|
||||
carg = ares__dnsrec_convert_arg(callback, arg);
|
||||
carg = ares_dnsrec_convert_arg(callback, arg);
|
||||
if (carg == NULL) {
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
ares_query_dnsrec(channel, name, (ares_dns_class_t)dnsclass,
|
||||
(ares_dns_rec_type_t)type, ares__dnsrec_convert_cb, carg,
|
||||
(ares_dns_rec_type_t)type, ares_dnsrec_convert_cb, carg,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
129
deps/cares/src/lib/ares_search.c
vendored
129
deps/cares/src/lib/ares_search.c
vendored
|
|
@ -55,7 +55,7 @@ static void squery_free(struct search_query *squery)
|
|||
if (squery == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
ares__strsplit_free(squery->names, squery->names_cnt);
|
||||
ares_strsplit_free(squery->names, squery->names_cnt);
|
||||
ares_dns_record_destroy(squery->dnsrec);
|
||||
ares_free(squery);
|
||||
}
|
||||
|
|
@ -92,8 +92,8 @@ static ares_status_t ares_search_next(ares_channel_t *channel,
|
|||
return status;
|
||||
}
|
||||
|
||||
status =
|
||||
ares_send_nolock(channel, squery->dnsrec, search_callback, squery, NULL);
|
||||
status = ares_send_nolock(channel, NULL, 0, squery->dnsrec, search_callback,
|
||||
squery, NULL);
|
||||
|
||||
if (status != ARES_EFORMERR) {
|
||||
*skip_cleanup = ARES_TRUE;
|
||||
|
|
@ -114,10 +114,9 @@ static void search_callback(void *arg, ares_status_t status, size_t timeouts,
|
|||
squery->timeouts += timeouts;
|
||||
|
||||
if (dnsrec) {
|
||||
ares_dns_rcode_t rcode = ares_dns_record_get_rcode(dnsrec);
|
||||
size_t ancount = ares_dns_record_rr_cnt(dnsrec,
|
||||
ARES_SECTION_ANSWER);
|
||||
mystatus = ares_dns_query_reply_tostatus(rcode, ancount);
|
||||
ares_dns_rcode_t rcode = ares_dns_record_get_rcode(dnsrec);
|
||||
size_t ancount = ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ANSWER);
|
||||
mystatus = ares_dns_query_reply_tostatus(rcode, ancount);
|
||||
} else {
|
||||
mystatus = status;
|
||||
}
|
||||
|
|
@ -128,9 +127,9 @@ static void search_callback(void *arg, ares_status_t status, size_t timeouts,
|
|||
break;
|
||||
case ARES_ESERVFAIL:
|
||||
case ARES_EREFUSED:
|
||||
/* Issue #852, systemd-resolved may return SERVFAIL or REFUSED on a
|
||||
/* Issue #852, systemd-resolved may return SERVFAIL or REFUSED on a
|
||||
* single label domain name. */
|
||||
if (ares__name_label_cnt(squery->names[squery->next_name_idx-1]) != 1) {
|
||||
if (ares_name_label_cnt(squery->names[squery->next_name_idx - 1]) != 1) {
|
||||
end_squery(squery, mystatus, dnsrec);
|
||||
return;
|
||||
}
|
||||
|
|
@ -169,8 +168,8 @@ static void search_callback(void *arg, ares_status_t status, size_t timeouts,
|
|||
|
||||
/* Determine if the domain should be looked up as-is, or if it is eligible
|
||||
* for search by appending domains */
|
||||
static ares_bool_t ares__search_eligible(const ares_channel_t *channel,
|
||||
const char *name)
|
||||
static ares_bool_t ares_search_eligible(const ares_channel_t *channel,
|
||||
const char *name)
|
||||
{
|
||||
size_t len = ares_strlen(name);
|
||||
|
||||
|
|
@ -186,10 +185,10 @@ static ares_bool_t ares__search_eligible(const ares_channel_t *channel,
|
|||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
size_t ares__name_label_cnt(const char *name)
|
||||
size_t ares_name_label_cnt(const char *name)
|
||||
{
|
||||
const char *p;
|
||||
size_t ndots = 0;
|
||||
const char *p;
|
||||
size_t ndots = 0;
|
||||
|
||||
if (name == NULL) {
|
||||
return 0;
|
||||
|
|
@ -202,12 +201,12 @@ size_t ares__name_label_cnt(const char *name)
|
|||
}
|
||||
|
||||
/* Label count is 1 greater than ndots */
|
||||
return ndots+1;
|
||||
return ndots + 1;
|
||||
}
|
||||
|
||||
ares_status_t ares__search_name_list(const ares_channel_t *channel,
|
||||
const char *name, char ***names,
|
||||
size_t *names_len)
|
||||
ares_status_t ares_search_name_list(const ares_channel_t *channel,
|
||||
const char *name, char ***names,
|
||||
size_t *names_len)
|
||||
{
|
||||
ares_status_t status;
|
||||
char **list = NULL;
|
||||
|
|
@ -218,7 +217,7 @@ ares_status_t ares__search_name_list(const ares_channel_t *channel,
|
|||
size_t i;
|
||||
|
||||
/* Perform HOSTALIASES resolution */
|
||||
status = ares__lookup_hostaliases(channel, name, &alias);
|
||||
status = ares_lookup_hostaliases(channel, name, &alias);
|
||||
if (status == ARES_SUCCESS) {
|
||||
/* If hostalias succeeds, there is no searching, it is used as-is */
|
||||
list_len = 1;
|
||||
|
|
@ -235,7 +234,7 @@ ares_status_t ares__search_name_list(const ares_channel_t *channel,
|
|||
}
|
||||
|
||||
/* See if searching is eligible at all, if not, look up as-is only */
|
||||
if (!ares__search_eligible(channel, name)) {
|
||||
if (!ares_search_eligible(channel, name)) {
|
||||
list_len = 1;
|
||||
list = ares_malloc_zero(sizeof(*list) * list_len);
|
||||
if (list == NULL) {
|
||||
|
|
@ -252,7 +251,7 @@ ares_status_t ares__search_name_list(const ares_channel_t *channel,
|
|||
}
|
||||
|
||||
/* Count the number of dots in name, 1 less than label count */
|
||||
ndots = ares__name_label_cnt(name);
|
||||
ndots = ares_name_label_cnt(name);
|
||||
if (ndots > 0) {
|
||||
ndots--;
|
||||
}
|
||||
|
|
@ -266,7 +265,7 @@ ares_status_t ares__search_name_list(const ares_channel_t *channel,
|
|||
}
|
||||
|
||||
/* Set status here, its possible there are no search domains at all, so
|
||||
* status may be ARES_ENOTFOUND from ares__lookup_hostaliases(). */
|
||||
* status may be ARES_ENOTFOUND from ares_lookup_hostaliases(). */
|
||||
status = ARES_SUCCESS;
|
||||
|
||||
/* Try as-is first */
|
||||
|
|
@ -281,7 +280,7 @@ ares_status_t ares__search_name_list(const ares_channel_t *channel,
|
|||
|
||||
/* Append each search suffix to the name */
|
||||
for (i = 0; i < channel->ndomains; i++) {
|
||||
status = ares__cat_domain(name, channel->domains[i], &list[idx]);
|
||||
status = ares_cat_domain(name, channel->domains[i], &list[idx]);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -304,7 +303,7 @@ done:
|
|||
*names = list;
|
||||
*names_len = list_len;
|
||||
} else {
|
||||
ares__strsplit_free(list, list_len);
|
||||
ares_strsplit_free(list, list_len);
|
||||
}
|
||||
|
||||
ares_free(alias);
|
||||
|
|
@ -334,7 +333,7 @@ static ares_status_t ares_search_int(ares_channel_t *channel,
|
|||
}
|
||||
|
||||
/* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
|
||||
if (ares__is_onion_domain(name)) {
|
||||
if (ares_is_onion_domain(name)) {
|
||||
status = ARES_ENOTFOUND;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -363,7 +362,7 @@ static ares_status_t ares_search_int(ares_channel_t *channel,
|
|||
squery->ever_got_nodata = ARES_FALSE;
|
||||
|
||||
status =
|
||||
ares__search_name_list(channel, name, &squery->names, &squery->names_cnt);
|
||||
ares_search_name_list(channel, name, &squery->names, &squery->names_cnt);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -383,7 +382,7 @@ fail:
|
|||
return status;
|
||||
}
|
||||
|
||||
/* Callback argument structure passed to ares__dnsrec_convert_cb(). */
|
||||
/* Callback argument structure passed to ares_dnsrec_convert_cb(). */
|
||||
typedef struct {
|
||||
ares_callback callback;
|
||||
void *arg;
|
||||
|
|
@ -391,7 +390,7 @@ typedef struct {
|
|||
|
||||
/*! Function to create callback arg for converting from ares_callback_dnsrec
|
||||
* to ares_calback */
|
||||
void *ares__dnsrec_convert_arg(ares_callback callback, void *arg)
|
||||
void *ares_dnsrec_convert_arg(ares_callback callback, void *arg)
|
||||
{
|
||||
dnsrec_convert_arg_t *carg = ares_malloc_zero(sizeof(*carg));
|
||||
if (carg == NULL) {
|
||||
|
|
@ -406,8 +405,8 @@ void *ares__dnsrec_convert_arg(ares_callback callback, void *arg)
|
|||
* the ares_callback prototype, by writing the result and passing that to
|
||||
* the inner callback.
|
||||
*/
|
||||
void ares__dnsrec_convert_cb(void *arg, ares_status_t status, size_t timeouts,
|
||||
const ares_dns_record_t *dnsrec)
|
||||
void ares_dnsrec_convert_cb(void *arg, ares_status_t status, size_t timeouts,
|
||||
const ares_dns_record_t *dnsrec)
|
||||
{
|
||||
dnsrec_convert_arg_t *carg = arg;
|
||||
unsigned char *abuf = NULL;
|
||||
|
|
@ -442,11 +441,11 @@ void ares_search(ares_channel_t *channel, const char *name, int dnsclass,
|
|||
}
|
||||
|
||||
/* For now, ares_search_int() uses the ares_callback prototype. We need to
|
||||
* wrap the callback passed to this function in ares__dnsrec_convert_cb, to
|
||||
* wrap the callback passed to this function in ares_dnsrec_convert_cb, to
|
||||
* convert from ares_callback_dnsrec to ares_callback. Allocate the convert
|
||||
* arg structure here.
|
||||
*/
|
||||
carg = ares__dnsrec_convert_arg(callback, arg);
|
||||
carg = ares_dnsrec_convert_arg(callback, arg);
|
||||
if (carg == NULL) {
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0);
|
||||
return;
|
||||
|
|
@ -463,9 +462,9 @@ void ares_search(ares_channel_t *channel, const char *name, int dnsclass,
|
|||
return;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_search_int(channel, dnsrec, ares__dnsrec_convert_cb, carg);
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_lock(channel);
|
||||
ares_search_int(channel, dnsrec, ares_dnsrec_convert_cb, carg);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
ares_dns_record_destroy(dnsrec);
|
||||
}
|
||||
|
|
@ -481,15 +480,15 @@ ares_status_t ares_search_dnsrec(ares_channel_t *channel,
|
|||
return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
status = ares_search_int(channel, dnsrec, callback, arg);
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Concatenate two domains. */
|
||||
ares_status_t ares__cat_domain(const char *name, const char *domain, char **s)
|
||||
ares_status_t ares_cat_domain(const char *name, const char *domain, char **s)
|
||||
{
|
||||
size_t nlen = ares_strlen(name);
|
||||
size_t dlen = ares_strlen(domain);
|
||||
|
|
@ -500,7 +499,7 @@ ares_status_t ares__cat_domain(const char *name, const char *domain, char **s)
|
|||
}
|
||||
memcpy(*s, name, nlen);
|
||||
(*s)[nlen] = '.';
|
||||
if (strcmp(domain, ".") == 0) {
|
||||
if (ares_streq(domain, ".")) {
|
||||
/* Avoid appending the root domain to the separator, which would set *s to
|
||||
an ill-formed value (ending in two consecutive dots). */
|
||||
dlen = 0;
|
||||
|
|
@ -510,14 +509,15 @@ ares_status_t ares__cat_domain(const char *name, const char *domain, char **s)
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__lookup_hostaliases(const ares_channel_t *channel,
|
||||
const char *name, char **alias)
|
||||
ares_status_t ares_lookup_hostaliases(const ares_channel_t *channel,
|
||||
const char *name, char **alias)
|
||||
{
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
const char *hostaliases = NULL;
|
||||
ares__buf_t *buf = NULL;
|
||||
ares__llist_t *lines = NULL;
|
||||
ares__llist_node_t *node;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
const char *hostaliases = NULL;
|
||||
ares_buf_t *buf = NULL;
|
||||
ares_array_t *lines = NULL;
|
||||
size_t num;
|
||||
size_t i;
|
||||
|
||||
if (channel == NULL || name == NULL || alias == NULL) {
|
||||
return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
|
|
@ -541,13 +541,13 @@ ares_status_t ares__lookup_hostaliases(const ares_channel_t *channel,
|
|||
goto done;
|
||||
}
|
||||
|
||||
buf = ares__buf_create();
|
||||
buf = ares_buf_create();
|
||||
if (buf == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__buf_load_file(hostaliases, buf);
|
||||
status = ares_buf_load_file(hostaliases, buf);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -560,44 +560,45 @@ ares_status_t ares__lookup_hostaliases(const ares_channel_t *channel,
|
|||
* curl www.curl.se
|
||||
*/
|
||||
|
||||
status = ares__buf_split(buf, (const unsigned char *)"\n", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 0, &lines);
|
||||
status = ares_buf_split(buf, (const unsigned char *)"\n", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 0, &lines);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (node = ares__llist_node_first(lines); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
ares__buf_t *line = ares__llist_node_val(node);
|
||||
num = ares_array_len(lines);
|
||||
for (i = 0; i < num; i++) {
|
||||
ares_buf_t **bufptr = ares_array_at(lines, i);
|
||||
ares_buf_t *line = *bufptr;
|
||||
char hostname[64] = "";
|
||||
char fqdn[256] = "";
|
||||
|
||||
/* Pull off hostname */
|
||||
ares__buf_tag(line);
|
||||
ares__buf_consume_nonwhitespace(line);
|
||||
if (ares__buf_tag_fetch_string(line, hostname, sizeof(hostname)) !=
|
||||
ares_buf_tag(line);
|
||||
ares_buf_consume_nonwhitespace(line);
|
||||
if (ares_buf_tag_fetch_string(line, hostname, sizeof(hostname)) !=
|
||||
ARES_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Match hostname */
|
||||
if (strcasecmp(hostname, name) != 0) {
|
||||
if (!ares_strcaseeq(hostname, name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* consume whitespace */
|
||||
ares__buf_consume_whitespace(line, ARES_TRUE);
|
||||
ares_buf_consume_whitespace(line, ARES_TRUE);
|
||||
|
||||
/* pull off fqdn */
|
||||
ares__buf_tag(line);
|
||||
ares__buf_consume_nonwhitespace(line);
|
||||
if (ares__buf_tag_fetch_string(line, fqdn, sizeof(fqdn)) != ARES_SUCCESS ||
|
||||
ares_buf_tag(line);
|
||||
ares_buf_consume_nonwhitespace(line);
|
||||
if (ares_buf_tag_fetch_string(line, fqdn, sizeof(fqdn)) != ARES_SUCCESS ||
|
||||
ares_strlen(fqdn) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Validate characterset */
|
||||
if (!ares__is_hostname(fqdn)) {
|
||||
if (!ares_is_hostname(fqdn)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -615,8 +616,8 @@ ares_status_t ares__lookup_hostaliases(const ares_channel_t *channel,
|
|||
status = ARES_ENOTFOUND;
|
||||
|
||||
done:
|
||||
ares__buf_destroy(buf);
|
||||
ares__llist_destroy(lines);
|
||||
ares_buf_destroy(buf);
|
||||
ares_array_destroy(lines);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
63
deps/cares/src/lib/ares_send.c
vendored
63
deps/cares/src/lib/ares_send.c
vendored
|
|
@ -37,8 +37,8 @@ static unsigned short generate_unique_qid(ares_channel_t *channel)
|
|||
unsigned short id;
|
||||
|
||||
do {
|
||||
id = ares__generate_new_id(channel->rand_state);
|
||||
} while (ares__htable_szvp_get(channel->queries_by_qid, id, NULL));
|
||||
id = ares_generate_new_id(channel->rand_state);
|
||||
} while (ares_htable_szvp_get(channel->queries_by_qid, id, NULL));
|
||||
|
||||
return id;
|
||||
}
|
||||
|
|
@ -77,14 +77,14 @@ static ares_status_t ares_apply_dns0x20(ares_channel_t *channel,
|
|||
* is 1 bit per byte */
|
||||
total_bits = ((len + 7) / 8) * 8;
|
||||
remaining_bits = total_bits;
|
||||
ares__rand_bytes(channel->rand_state, randdata, total_bits / 8);
|
||||
ares_rand_bytes(channel->rand_state, randdata, total_bits / 8);
|
||||
|
||||
/* Randomly apply 0x20 to name */
|
||||
for (i = 0; i < len; i++) {
|
||||
size_t bit;
|
||||
|
||||
/* Only apply 0x20 to alpha characters */
|
||||
if (!ares__isalpha(name[i])) {
|
||||
if (!ares_isalpha(name[i])) {
|
||||
dns0x20name[i] = name[i];
|
||||
continue;
|
||||
}
|
||||
|
|
@ -105,7 +105,8 @@ done:
|
|||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares_send_nolock(ares_channel_t *channel,
|
||||
ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
|
||||
ares_send_flags_t flags,
|
||||
const ares_dns_record_t *dnsrec,
|
||||
ares_callback_dnsrec callback, void *arg,
|
||||
unsigned short *qid)
|
||||
|
|
@ -116,20 +117,22 @@ ares_status_t ares_send_nolock(ares_channel_t *channel,
|
|||
unsigned short id = generate_unique_qid(channel);
|
||||
const ares_dns_record_t *dnsrec_resp = NULL;
|
||||
|
||||
ares__tvnow(&now);
|
||||
ares_tvnow(&now);
|
||||
|
||||
if (ares__slist_len(channel->servers) == 0) {
|
||||
if (ares_slist_len(channel->servers) == 0) {
|
||||
callback(arg, ARES_ENOSERVER, 0, NULL);
|
||||
return ARES_ENOSERVER;
|
||||
}
|
||||
|
||||
/* Check query cache */
|
||||
status = ares_qcache_fetch(channel, &now, dnsrec, &dnsrec_resp);
|
||||
if (status != ARES_ENOTFOUND) {
|
||||
/* ARES_SUCCESS means we retrieved the cache, anything else is a critical
|
||||
* failure, all result in termination */
|
||||
callback(arg, status, 0, dnsrec_resp);
|
||||
return status;
|
||||
if (!(flags & ARES_SEND_FLAG_NOCACHE)) {
|
||||
/* Check query cache */
|
||||
status = ares_qcache_fetch(channel, &now, dnsrec, &dnsrec_resp);
|
||||
if (status != ARES_ENOTFOUND) {
|
||||
/* ARES_SUCCESS means we retrieved the cache, anything else is a critical
|
||||
* failure, all result in termination */
|
||||
callback(arg, status, 0, dnsrec_resp);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate space for query and allocated fields. */
|
||||
|
|
@ -162,7 +165,7 @@ ares_status_t ares_send_nolock(ares_channel_t *channel,
|
|||
if (status != ARES_SUCCESS) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
callback(arg, status, 0, NULL);
|
||||
ares__free_query(query);
|
||||
ares_free_query(query);
|
||||
return status;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -175,6 +178,9 @@ ares_status_t ares_send_nolock(ares_channel_t *channel,
|
|||
/* Initialize query status. */
|
||||
query->try_count = 0;
|
||||
|
||||
if (flags & ARES_SEND_FLAG_NORETRY) {
|
||||
query->no_retries = ARES_TRUE;
|
||||
}
|
||||
|
||||
query->error_status = ARES_SUCCESS;
|
||||
query->timeouts = 0;
|
||||
|
|
@ -184,12 +190,11 @@ ares_status_t ares_send_nolock(ares_channel_t *channel,
|
|||
query->node_queries_to_conn = NULL;
|
||||
|
||||
/* Chain the query into the list of all queries. */
|
||||
query->node_all_queries =
|
||||
ares__llist_insert_last(channel->all_queries, query);
|
||||
query->node_all_queries = ares_llist_insert_last(channel->all_queries, query);
|
||||
if (query->node_all_queries == NULL) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
callback(arg, ARES_ENOMEM, 0, NULL);
|
||||
ares__free_query(query);
|
||||
ares_free_query(query);
|
||||
return ARES_ENOMEM;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -197,17 +202,17 @@ ares_status_t ares_send_nolock(ares_channel_t *channel,
|
|||
/* Keep track of queries bucketed by qid, so we can process DNS
|
||||
* responses quickly.
|
||||
*/
|
||||
if (!ares__htable_szvp_insert(channel->queries_by_qid, query->qid, query)) {
|
||||
if (!ares_htable_szvp_insert(channel->queries_by_qid, query->qid, query)) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
callback(arg, ARES_ENOMEM, 0, NULL);
|
||||
ares__free_query(query);
|
||||
ares_free_query(query);
|
||||
return ARES_ENOMEM;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* Perform the first query action. */
|
||||
|
||||
status = ares__send_query(query, &now);
|
||||
status = ares_send_query(server, query, &now);
|
||||
if (status == ARES_SUCCESS && qid) {
|
||||
*qid = id;
|
||||
}
|
||||
|
|
@ -225,11 +230,11 @@ ares_status_t ares_send_dnsrec(ares_channel_t *channel,
|
|||
return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
status = ares_send_nolock(channel, dnsrec, callback, arg, qid);
|
||||
status = ares_send_nolock(channel, NULL, 0, dnsrec, callback, arg, qid);
|
||||
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
@ -257,7 +262,7 @@ void ares_send(ares_channel_t *channel, const unsigned char *qbuf, int qlen,
|
|||
return;
|
||||
}
|
||||
|
||||
carg = ares__dnsrec_convert_arg(callback, arg);
|
||||
carg = ares_dnsrec_convert_arg(callback, arg);
|
||||
if (carg == NULL) {
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
status = ARES_ENOMEM;
|
||||
|
|
@ -267,7 +272,7 @@ void ares_send(ares_channel_t *channel, const unsigned char *qbuf, int qlen,
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ares_send_dnsrec(channel, dnsrec, ares__dnsrec_convert_cb, carg, NULL);
|
||||
ares_send_dnsrec(channel, dnsrec, ares_dnsrec_convert_cb, carg, NULL);
|
||||
|
||||
ares_dns_record_destroy(dnsrec);
|
||||
}
|
||||
|
|
@ -280,11 +285,11 @@ size_t ares_queue_active_queries(const ares_channel_t *channel)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
len = ares__llist_len(channel->all_queries);
|
||||
len = ares_llist_len(channel->all_queries);
|
||||
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
|
|
|||
586
deps/cares/src/lib/ares_set_socket_functions.c
vendored
Normal file
586
deps/cares/src/lib/ares_set_socket_functions.c
vendored
Normal file
|
|
@ -0,0 +1,586 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Brad House
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
# include <sys/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_TCP_H
|
||||
# include <netinet/tcp.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef NETWARE
|
||||
# include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
#if defined(__linux__) && defined(TCP_FASTOPEN_CONNECT)
|
||||
# define TFO_SUPPORTED 1
|
||||
# define TFO_SKIP_CONNECT 0
|
||||
# define TFO_USE_SENDTO 0
|
||||
# define TFO_USE_CONNECTX 0
|
||||
# define TFO_CLIENT_SOCKOPT TCP_FASTOPEN_CONNECT
|
||||
#elif defined(__FreeBSD__) && defined(TCP_FASTOPEN)
|
||||
# define TFO_SUPPORTED 1
|
||||
# define TFO_SKIP_CONNECT 1
|
||||
# define TFO_USE_SENDTO 1
|
||||
# define TFO_USE_CONNECTX 0
|
||||
# define TFO_CLIENT_SOCKOPT TCP_FASTOPEN
|
||||
#elif defined(__APPLE__) && defined(HAVE_CONNECTX)
|
||||
# define TFO_SUPPORTED 1
|
||||
# define TFO_SKIP_CONNECT 0
|
||||
# define TFO_USE_SENDTO 0
|
||||
# define TFO_USE_CONNECTX 1
|
||||
# undef TFO_CLIENT_SOCKOPT
|
||||
#else
|
||||
# define TFO_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WRITEV
|
||||
/* Structure for scatter/gather I/O. */
|
||||
struct iovec {
|
||||
void *iov_base; /* Pointer to data. */
|
||||
size_t iov_len; /* Length of data. */
|
||||
};
|
||||
#endif
|
||||
|
||||
ares_status_t
|
||||
ares_set_socket_functions_ex(ares_channel_t *channel,
|
||||
const struct ares_socket_functions_ex *funcs,
|
||||
void *user_data)
|
||||
{
|
||||
unsigned int known_versions[] = { 1 };
|
||||
size_t i;
|
||||
|
||||
if (channel == NULL || funcs == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
/* Check to see if we know the version referenced */
|
||||
for (i = 0; i < sizeof(known_versions) / sizeof(*known_versions); i++) {
|
||||
if (funcs->version == known_versions[i]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == sizeof(known_versions) / sizeof(*known_versions)) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
memset(&channel->sock_funcs, 0, sizeof(channel->sock_funcs));
|
||||
|
||||
/* Copy individually for ABI compliance. memcpy() with a sizeof would do
|
||||
* invalid reads */
|
||||
if (funcs->version >= 1) {
|
||||
if (funcs->asocket == NULL || funcs->aclose == NULL ||
|
||||
funcs->asetsockopt == NULL || funcs->aconnect == NULL ||
|
||||
funcs->arecvfrom == NULL || funcs->asendto == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
channel->sock_funcs.version = funcs->version;
|
||||
channel->sock_funcs.flags = funcs->flags;
|
||||
channel->sock_funcs.asocket = funcs->asocket;
|
||||
channel->sock_funcs.aclose = funcs->aclose;
|
||||
channel->sock_funcs.asetsockopt = funcs->asetsockopt;
|
||||
channel->sock_funcs.aconnect = funcs->aconnect;
|
||||
channel->sock_funcs.arecvfrom = funcs->arecvfrom;
|
||||
channel->sock_funcs.asendto = funcs->asendto;
|
||||
channel->sock_funcs.agetsockname = funcs->agetsockname;
|
||||
channel->sock_funcs.abind = funcs->abind;
|
||||
}
|
||||
|
||||
/* Implement newer versions here ...*/
|
||||
|
||||
|
||||
channel->sock_func_cb_data = user_data;
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static int setsocknonblock(ares_socket_t sockfd, /* operate on this */
|
||||
int nonblock /* TRUE or FALSE */)
|
||||
{
|
||||
#if defined(HAVE_FCNTL_O_NONBLOCK)
|
||||
|
||||
/* most recent unix versions */
|
||||
int flags;
|
||||
flags = fcntl(sockfd, F_GETFL, 0);
|
||||
if (nonblock) {
|
||||
return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
|
||||
} else {
|
||||
return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
#elif defined(HAVE_IOCTL_FIONBIO)
|
||||
|
||||
/* older unix versions */
|
||||
int flags = nonblock ? 1 : 0;
|
||||
return ioctl(sockfd, FIONBIO, &flags);
|
||||
|
||||
#elif defined(HAVE_IOCTLSOCKET_FIONBIO)
|
||||
|
||||
# ifdef WATT32
|
||||
char flags = nonblock ? 1 : 0;
|
||||
# else
|
||||
/* Windows */
|
||||
unsigned long flags = nonblock ? 1UL : 0UL;
|
||||
# endif
|
||||
return ioctlsocket(sockfd, (long)FIONBIO, &flags);
|
||||
|
||||
#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
|
||||
|
||||
/* Amiga */
|
||||
long flags = nonblock ? 1L : 0L;
|
||||
return IoctlSocket(sockfd, FIONBIO, flags);
|
||||
|
||||
#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
|
||||
|
||||
/* BeOS */
|
||||
long b = nonblock ? 1L : 0L;
|
||||
return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
|
||||
|
||||
#else
|
||||
# error "no non-blocking method was found/used/set"
|
||||
#endif
|
||||
}
|
||||
|
||||
static int default_aclose(ares_socket_t sock, void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
|
||||
#if defined(HAVE_CLOSESOCKET)
|
||||
return closesocket(sock);
|
||||
#elif defined(HAVE_CLOSESOCKET_CAMEL)
|
||||
return CloseSocket(sock);
|
||||
#elif defined(HAVE_CLOSE_S)
|
||||
return close_s(sock);
|
||||
#else
|
||||
return close(sock);
|
||||
#endif
|
||||
}
|
||||
|
||||
static ares_socket_t default_asocket(int domain, int type, int protocol,
|
||||
void *user_data)
|
||||
{
|
||||
ares_socket_t s;
|
||||
(void)user_data;
|
||||
|
||||
s = socket(domain, type, protocol);
|
||||
if (s == ARES_SOCKET_BAD) {
|
||||
return s;
|
||||
}
|
||||
|
||||
if (setsocknonblock(s, 1) != 0) {
|
||||
goto fail; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
#if defined(FD_CLOEXEC) && !defined(MSDOS)
|
||||
/* Configure the socket fd as close-on-exec. */
|
||||
if (fcntl(s, F_SETFD, FD_CLOEXEC) != 0) {
|
||||
goto fail; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* No need to emit SIGPIPE on socket errors */
|
||||
#if defined(SO_NOSIGPIPE)
|
||||
{
|
||||
int opt = 1;
|
||||
(void)setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, (void *)&opt, sizeof(opt));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (type == SOCK_STREAM) {
|
||||
int opt = 1;
|
||||
|
||||
#ifdef TCP_NODELAY
|
||||
/*
|
||||
* Disable the Nagle algorithm (only relevant for TCP sockets, and thus not
|
||||
* in configure_socket). In general, in DNS lookups we're pretty much
|
||||
* interested in firing off a single request and then waiting for a reply,
|
||||
* so batching isn't very interesting.
|
||||
*/
|
||||
if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *)&opt, sizeof(opt)) !=
|
||||
0) {
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(IPV6_V6ONLY) && defined(USE_WINSOCK)
|
||||
/* Support for IPv4-mapped IPv6 addresses.
|
||||
* Linux kernel, NetBSD, FreeBSD and Darwin: default is off;
|
||||
* Windows Vista and later: default is on;
|
||||
* DragonFly BSD: acts like off, and dummy setting;
|
||||
* OpenBSD and earlier Windows: unsupported.
|
||||
* Linux: controlled by /proc/sys/net/ipv6/bindv6only.
|
||||
*/
|
||||
if (domain == PF_INET6) {
|
||||
int on = 0;
|
||||
(void)setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on));
|
||||
}
|
||||
#endif
|
||||
|
||||
return s;
|
||||
|
||||
fail:
|
||||
default_aclose(s, user_data);
|
||||
return ARES_SOCKET_BAD;
|
||||
}
|
||||
|
||||
static int default_asetsockopt(ares_socket_t sock, ares_socket_opt_t opt,
|
||||
const void *val, ares_socklen_t val_size,
|
||||
void *user_data)
|
||||
{
|
||||
switch (opt) {
|
||||
case ARES_SOCKET_OPT_SENDBUF_SIZE:
|
||||
if (val_size != sizeof(int)) {
|
||||
SET_SOCKERRNO(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
return setsockopt(sock, SOL_SOCKET, SO_SNDBUF, val, val_size);
|
||||
|
||||
case ARES_SOCKET_OPT_RECVBUF_SIZE:
|
||||
if (val_size != sizeof(int)) {
|
||||
SET_SOCKERRNO(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
return setsockopt(sock, SOL_SOCKET, SO_RCVBUF, val, val_size);
|
||||
|
||||
case ARES_SOCKET_OPT_BIND_DEVICE:
|
||||
if (!ares_str_isprint(val, (size_t)val_size)) {
|
||||
SET_SOCKERRNO(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
#ifdef SO_BINDTODEVICE
|
||||
return setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, val, val_size);
|
||||
#else
|
||||
SET_SOCKERRNO(ENOSYS);
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case ARES_SOCKET_OPT_TCP_FASTOPEN:
|
||||
if (val_size != sizeof(ares_bool_t)) {
|
||||
SET_SOCKERRNO(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
#if defined(TFO_CLIENT_SOCKOPT)
|
||||
{
|
||||
int oval;
|
||||
const ares_bool_t *pval = val;
|
||||
oval = (int)*pval;
|
||||
return setsockopt(sock, IPPROTO_TCP, TFO_CLIENT_SOCKOPT, (void *)&oval,
|
||||
sizeof(oval));
|
||||
}
|
||||
#elif TFO_SUPPORTED
|
||||
return 0;
|
||||
#else
|
||||
SET_SOCKERRNO(ENOSYS);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
(void)user_data;
|
||||
SET_SOCKERRNO(ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int default_aconnect(ares_socket_t sock, const struct sockaddr *address,
|
||||
ares_socklen_t address_len, unsigned int flags,
|
||||
void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
|
||||
#if defined(TFO_SKIP_CONNECT) && TFO_SKIP_CONNECT
|
||||
if (flags & ARES_SOCKET_CONN_TCP_FASTOPEN) {
|
||||
return 0;
|
||||
}
|
||||
return connect(sock, address, address_len);
|
||||
#elif defined(TFO_USE_CONNECTX) && TFO_USE_CONNECTX
|
||||
if (flags & ARES_SOCKET_CONN_TCP_FASTOPEN) {
|
||||
sa_endpoints_t endpoints;
|
||||
|
||||
memset(&endpoints, 0, sizeof(endpoints));
|
||||
endpoints.sae_dstaddr = address;
|
||||
endpoints.sae_dstaddrlen = address_len;
|
||||
|
||||
return connectx(sock, &endpoints, SAE_ASSOCID_ANY,
|
||||
CONNECT_DATA_IDEMPOTENT | CONNECT_RESUME_ON_READ_WRITE,
|
||||
NULL, 0, NULL, NULL);
|
||||
} else {
|
||||
return connect(sock, address, address_len);
|
||||
}
|
||||
#else
|
||||
(void)flags;
|
||||
return connect(sock, address, address_len);
|
||||
#endif
|
||||
}
|
||||
|
||||
static ares_ssize_t default_arecvfrom(ares_socket_t sock, void *buffer,
|
||||
size_t length, int flags,
|
||||
struct sockaddr *address,
|
||||
ares_socklen_t *address_len,
|
||||
void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
|
||||
#ifdef HAVE_RECVFROM
|
||||
return (ares_ssize_t)recvfrom(sock, buffer, (RECVFROM_TYPE_ARG3)length, flags,
|
||||
address, address_len);
|
||||
#else
|
||||
if (address != NULL && address_len != NULL) {
|
||||
memset(address, 0, (size_t)*address_len);
|
||||
address->sa_family = AF_UNSPEC;
|
||||
}
|
||||
return (ares_ssize_t)recv(sock, buffer, (RECVFROM_TYPE_ARG3)length, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
static ares_ssize_t default_asendto(ares_socket_t sock, const void *buffer,
|
||||
size_t length, int flags,
|
||||
const struct sockaddr *address,
|
||||
ares_socklen_t address_len, void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
|
||||
if (address != NULL) {
|
||||
#ifdef HAVE_SENDTO
|
||||
return (ares_ssize_t)sendto((SEND_TYPE_ARG1)sock, (SEND_TYPE_ARG2)buffer,
|
||||
(SEND_TYPE_ARG3)length, (SEND_TYPE_ARG4)flags,
|
||||
address, address_len);
|
||||
#else
|
||||
(void)address_len;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (ares_ssize_t)send((SEND_TYPE_ARG1)sock, (SEND_TYPE_ARG2)buffer,
|
||||
(SEND_TYPE_ARG3)length, (SEND_TYPE_ARG4)flags);
|
||||
}
|
||||
|
||||
static int default_agetsockname(ares_socket_t sock, struct sockaddr *address,
|
||||
ares_socklen_t *address_len, void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
return getsockname(sock, address, address_len);
|
||||
}
|
||||
|
||||
static int default_abind(ares_socket_t sock, unsigned int flags,
|
||||
const struct sockaddr *address, socklen_t address_len,
|
||||
void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
|
||||
#ifdef IP_BIND_ADDRESS_NO_PORT
|
||||
if (flags & ARES_SOCKET_BIND_TCP && flags & ARES_SOCKET_BIND_CLIENT) {
|
||||
int opt = 1;
|
||||
(void)setsockopt(sock, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &opt, sizeof(opt));
|
||||
}
|
||||
#else
|
||||
(void)flags;
|
||||
#endif
|
||||
|
||||
return bind(sock, address, address_len);
|
||||
}
|
||||
|
||||
static unsigned int default_aif_nametoindex(const char *ifname, void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
return ares_os_if_nametoindex(ifname);
|
||||
}
|
||||
|
||||
static const char *default_aif_indextoname(unsigned int ifindex,
|
||||
char *ifname_buf,
|
||||
size_t ifname_buf_len,
|
||||
void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
return ares_os_if_indextoname(ifindex, ifname_buf, ifname_buf_len);
|
||||
}
|
||||
|
||||
static const struct ares_socket_functions_ex default_socket_functions = {
|
||||
1,
|
||||
ARES_SOCKFUNC_FLAG_NONBLOCKING,
|
||||
default_asocket,
|
||||
default_aclose,
|
||||
default_asetsockopt,
|
||||
default_aconnect,
|
||||
default_arecvfrom,
|
||||
default_asendto,
|
||||
default_agetsockname,
|
||||
default_abind,
|
||||
default_aif_nametoindex,
|
||||
default_aif_indextoname
|
||||
};
|
||||
|
||||
void ares_set_socket_functions_def(ares_channel_t *channel)
|
||||
{
|
||||
ares_set_socket_functions_ex(channel, &default_socket_functions, NULL);
|
||||
}
|
||||
|
||||
static int legacycb_aclose(ares_socket_t sock, void *user_data)
|
||||
{
|
||||
ares_channel_t *channel = user_data;
|
||||
|
||||
if (channel->legacy_sock_funcs != NULL &&
|
||||
channel->legacy_sock_funcs->aclose != NULL) {
|
||||
return channel->legacy_sock_funcs->aclose(
|
||||
sock, channel->legacy_sock_funcs_cb_data);
|
||||
}
|
||||
|
||||
return default_aclose(sock, NULL);
|
||||
}
|
||||
|
||||
static ares_socket_t legacycb_asocket(int domain, int type, int protocol,
|
||||
void *user_data)
|
||||
{
|
||||
ares_channel_t *channel = user_data;
|
||||
|
||||
if (channel->legacy_sock_funcs != NULL &&
|
||||
channel->legacy_sock_funcs->asocket != NULL) {
|
||||
return channel->legacy_sock_funcs->asocket(
|
||||
domain, type, protocol, channel->legacy_sock_funcs_cb_data);
|
||||
}
|
||||
|
||||
return default_asocket(domain, type, protocol, NULL);
|
||||
}
|
||||
|
||||
static int legacycb_asetsockopt(ares_socket_t sock, ares_socket_opt_t opt,
|
||||
const void *val, ares_socklen_t val_size,
|
||||
void *user_data)
|
||||
{
|
||||
(void)sock;
|
||||
(void)opt;
|
||||
(void)val;
|
||||
(void)val_size;
|
||||
(void)user_data;
|
||||
SET_SOCKERRNO(ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int legacycb_aconnect(ares_socket_t sock, const struct sockaddr *address,
|
||||
ares_socklen_t address_len, unsigned int flags,
|
||||
void *user_data)
|
||||
{
|
||||
ares_channel_t *channel = user_data;
|
||||
|
||||
if (channel->legacy_sock_funcs != NULL &&
|
||||
channel->legacy_sock_funcs->aconnect != NULL) {
|
||||
return channel->legacy_sock_funcs->aconnect(
|
||||
sock, address, address_len, channel->legacy_sock_funcs_cb_data);
|
||||
}
|
||||
|
||||
return default_aconnect(sock, address, address_len, flags, NULL);
|
||||
}
|
||||
|
||||
static ares_ssize_t legacycb_arecvfrom(ares_socket_t sock, void *buffer,
|
||||
size_t length, int flags,
|
||||
struct sockaddr *address,
|
||||
ares_socklen_t *address_len,
|
||||
void *user_data)
|
||||
{
|
||||
ares_channel_t *channel = user_data;
|
||||
|
||||
if (channel->legacy_sock_funcs != NULL &&
|
||||
channel->legacy_sock_funcs->arecvfrom != NULL) {
|
||||
if (address != NULL && address_len != NULL) {
|
||||
memset(address, 0, (size_t)*address_len);
|
||||
address->sa_family = AF_UNSPEC;
|
||||
}
|
||||
return channel->legacy_sock_funcs->arecvfrom(
|
||||
sock, buffer, length, flags, address, address_len,
|
||||
channel->legacy_sock_funcs_cb_data);
|
||||
}
|
||||
|
||||
return default_arecvfrom(sock, buffer, length, flags, address, address_len,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static ares_ssize_t legacycb_asendto(ares_socket_t sock, const void *buffer,
|
||||
size_t length, int flags,
|
||||
const struct sockaddr *address,
|
||||
ares_socklen_t address_len,
|
||||
void *user_data)
|
||||
{
|
||||
ares_channel_t *channel = user_data;
|
||||
|
||||
if (channel->legacy_sock_funcs != NULL &&
|
||||
channel->legacy_sock_funcs->asendv != NULL) {
|
||||
struct iovec vec;
|
||||
vec.iov_base = (void *)((size_t)buffer); /* Cast off const */
|
||||
vec.iov_len = length;
|
||||
return channel->legacy_sock_funcs->asendv(
|
||||
sock, &vec, 1, channel->legacy_sock_funcs_cb_data);
|
||||
}
|
||||
|
||||
return default_asendto(sock, buffer, length, flags, address, address_len,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
static const struct ares_socket_functions_ex legacy_socket_functions = {
|
||||
1,
|
||||
0,
|
||||
legacycb_asocket,
|
||||
legacycb_aclose,
|
||||
legacycb_asetsockopt,
|
||||
legacycb_aconnect,
|
||||
legacycb_arecvfrom,
|
||||
legacycb_asendto,
|
||||
NULL, /* agetsockname */
|
||||
NULL, /* abind */
|
||||
NULL, /* aif_nametoindex */
|
||||
NULL /* aif_indextoname */
|
||||
};
|
||||
|
||||
void ares_set_socket_functions(ares_channel_t *channel,
|
||||
const struct ares_socket_functions *funcs,
|
||||
void *data)
|
||||
{
|
||||
if (channel == NULL || channel->optmask & ARES_OPT_EVENT_THREAD) {
|
||||
return;
|
||||
}
|
||||
|
||||
channel->legacy_sock_funcs = funcs;
|
||||
channel->legacy_sock_funcs_cb_data = data;
|
||||
ares_set_socket_functions_ex(channel, &legacy_socket_functions, channel);
|
||||
}
|
||||
149
deps/cares/src/lib/ares_setup.h
vendored
149
deps/cares/src/lib/ares_setup.h
vendored
|
|
@ -199,51 +199,15 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef __hpux
|
||||
# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
|
||||
# ifdef _APP32_64BIT_OFF_T
|
||||
# define OLD_APP32_64BIT_OFF_T _APP32_64BIT_OFF_T
|
||||
# undef _APP32_64BIT_OFF_T
|
||||
# else
|
||||
# undef OLD_APP32_64BIT_OFF_T
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __hpux
|
||||
# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
|
||||
# ifdef OLD_APP32_64BIT_OFF_T
|
||||
# define _APP32_64BIT_OFF_T OLD_APP32_64BIT_OFF_T
|
||||
# undef OLD_APP32_64BIT_OFF_T
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Definition of timeval struct for platforms that don't have it.
|
||||
*/
|
||||
/* Definition of timeval struct for platforms that don't have it. */
|
||||
|
||||
#ifndef HAVE_STRUCT_TIMEVAL
|
||||
struct timeval {
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
ares_int64_t tv_sec;
|
||||
long tv_usec;
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function-like macro definition used to close a socket.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CLOSESOCKET)
|
||||
# define sclose(x) closesocket((x))
|
||||
#elif defined(HAVE_CLOSESOCKET_CAMEL)
|
||||
# define sclose(x) CloseSocket((x))
|
||||
#elif defined(HAVE_CLOSE_S)
|
||||
# define sclose(x) close_s((x))
|
||||
#else
|
||||
# define sclose(x) close((x))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro used to include code only in debug builds.
|
||||
|
|
@ -257,111 +221,4 @@ struct timeval {
|
|||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno
|
||||
* (or equivalent) on this platform to hide platform details to code using it.
|
||||
*/
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
# define SOCKERRNO ((int)WSAGetLastError())
|
||||
# define SET_SOCKERRNO(x) (WSASetLastError((int)(x)))
|
||||
#else
|
||||
# define SOCKERRNO (errno)
|
||||
# define SET_SOCKERRNO(x) (errno = (x))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno
|
||||
* (or equivalent) on this platform to hide platform details to code using it.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) && !defined(WATT32)
|
||||
# define ERRNO ((int)GetLastError())
|
||||
# define SET_ERRNO(x) (SetLastError((DWORD)(x)))
|
||||
#else
|
||||
# define ERRNO (errno)
|
||||
# define SET_ERRNO(x) (errno = (x))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Portable error number symbolic names defined to Winsock error codes.
|
||||
*/
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
# undef EBADF /* override definition in errno.h */
|
||||
# define EBADF WSAEBADF
|
||||
# undef EINTR /* override definition in errno.h */
|
||||
# define EINTR WSAEINTR
|
||||
# undef EINVAL /* override definition in errno.h */
|
||||
# define EINVAL WSAEINVAL
|
||||
# undef EWOULDBLOCK /* override definition in errno.h */
|
||||
# define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
# undef EINPROGRESS /* override definition in errno.h */
|
||||
# define EINPROGRESS WSAEINPROGRESS
|
||||
# undef EALREADY /* override definition in errno.h */
|
||||
# define EALREADY WSAEALREADY
|
||||
# undef ENOTSOCK /* override definition in errno.h */
|
||||
# define ENOTSOCK WSAENOTSOCK
|
||||
# undef EDESTADDRREQ /* override definition in errno.h */
|
||||
# define EDESTADDRREQ WSAEDESTADDRREQ
|
||||
# undef EMSGSIZE /* override definition in errno.h */
|
||||
# define EMSGSIZE WSAEMSGSIZE
|
||||
# undef EPROTOTYPE /* override definition in errno.h */
|
||||
# define EPROTOTYPE WSAEPROTOTYPE
|
||||
# undef ENOPROTOOPT /* override definition in errno.h */
|
||||
# define ENOPROTOOPT WSAENOPROTOOPT
|
||||
# undef EPROTONOSUPPORT /* override definition in errno.h */
|
||||
# define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
||||
# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
||||
# undef EOPNOTSUPP /* override definition in errno.h */
|
||||
# define EOPNOTSUPP WSAEOPNOTSUPP
|
||||
# define EPFNOSUPPORT WSAEPFNOSUPPORT
|
||||
# undef EAFNOSUPPORT /* override definition in errno.h */
|
||||
# define EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
# undef EADDRINUSE /* override definition in errno.h */
|
||||
# define EADDRINUSE WSAEADDRINUSE
|
||||
# undef EADDRNOTAVAIL /* override definition in errno.h */
|
||||
# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
# undef ENETDOWN /* override definition in errno.h */
|
||||
# define ENETDOWN WSAENETDOWN
|
||||
# undef ENETUNREACH /* override definition in errno.h */
|
||||
# define ENETUNREACH WSAENETUNREACH
|
||||
# undef ENETRESET /* override definition in errno.h */
|
||||
# define ENETRESET WSAENETRESET
|
||||
# undef ECONNABORTED /* override definition in errno.h */
|
||||
# define ECONNABORTED WSAECONNABORTED
|
||||
# undef ECONNRESET /* override definition in errno.h */
|
||||
# define ECONNRESET WSAECONNRESET
|
||||
# undef ENOBUFS /* override definition in errno.h */
|
||||
# define ENOBUFS WSAENOBUFS
|
||||
# undef EISCONN /* override definition in errno.h */
|
||||
# define EISCONN WSAEISCONN
|
||||
# undef ENOTCONN /* override definition in errno.h */
|
||||
# define ENOTCONN WSAENOTCONN
|
||||
# define ESHUTDOWN WSAESHUTDOWN
|
||||
# define ETOOMANYREFS WSAETOOMANYREFS
|
||||
# undef ETIMEDOUT /* override definition in errno.h */
|
||||
# define ETIMEDOUT WSAETIMEDOUT
|
||||
# undef ECONNREFUSED /* override definition in errno.h */
|
||||
# define ECONNREFUSED WSAECONNREFUSED
|
||||
# undef ELOOP /* override definition in errno.h */
|
||||
# define ELOOP WSAELOOP
|
||||
# ifndef ENAMETOOLONG /* possible previous definition in errno.h */
|
||||
# define ENAMETOOLONG WSAENAMETOOLONG
|
||||
# endif
|
||||
# define EHOSTDOWN WSAEHOSTDOWN
|
||||
# undef EHOSTUNREACH /* override definition in errno.h */
|
||||
# define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
# ifndef ENOTEMPTY /* possible previous definition in errno.h */
|
||||
# define ENOTEMPTY WSAENOTEMPTY
|
||||
# endif
|
||||
# define EPROCLIM WSAEPROCLIM
|
||||
# define EUSERS WSAEUSERS
|
||||
# define EDQUOT WSAEDQUOT
|
||||
# define ESTALE WSAESTALE
|
||||
# define EREMOTE WSAEREMOTE
|
||||
#endif
|
||||
|
||||
#endif /* __ARES_SETUP_H */
|
||||
|
|
|
|||
424
deps/cares/src/lib/ares_socket.c
vendored
Normal file
424
deps/cares/src/lib/ares_socket.c
vendored
Normal file
|
|
@ -0,0 +1,424 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) Massachusetts Institute of Technology
|
||||
* Copyright (c) The c-ares project and its contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
# include <sys/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_TCP_H
|
||||
# include <netinet/tcp.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef NETWARE
|
||||
# include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
static ares_conn_err_t ares_socket_deref_error(int err)
|
||||
{
|
||||
switch (err) {
|
||||
#if defined(EWOULDBLOCK)
|
||||
case EWOULDBLOCK:
|
||||
return ARES_CONN_ERR_WOULDBLOCK;
|
||||
#endif
|
||||
#if defined(EAGAIN) && (!defined(EWOULDBLOCK) || EAGAIN != EWOULDBLOCK)
|
||||
case EAGAIN:
|
||||
return ARES_CONN_ERR_WOULDBLOCK;
|
||||
#endif
|
||||
case EINPROGRESS:
|
||||
return ARES_CONN_ERR_WOULDBLOCK;
|
||||
case ENETDOWN:
|
||||
return ARES_CONN_ERR_NETDOWN;
|
||||
case ENETUNREACH:
|
||||
return ARES_CONN_ERR_NETUNREACH;
|
||||
case ECONNABORTED:
|
||||
return ARES_CONN_ERR_CONNABORTED;
|
||||
case ECONNRESET:
|
||||
return ARES_CONN_ERR_CONNRESET;
|
||||
case ECONNREFUSED:
|
||||
return ARES_CONN_ERR_CONNREFUSED;
|
||||
case ETIMEDOUT:
|
||||
return ARES_CONN_ERR_CONNTIMEDOUT;
|
||||
case EHOSTDOWN:
|
||||
return ARES_CONN_ERR_HOSTDOWN;
|
||||
case EHOSTUNREACH:
|
||||
return ARES_CONN_ERR_HOSTUNREACH;
|
||||
case EINTR:
|
||||
return ARES_CONN_ERR_INTERRUPT;
|
||||
case EAFNOSUPPORT:
|
||||
return ARES_CONN_ERR_AFNOSUPPORT;
|
||||
case EADDRNOTAVAIL:
|
||||
return ARES_CONN_ERR_BADADDR;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ARES_CONN_ERR_FAILURE;
|
||||
}
|
||||
|
||||
ares_bool_t ares_sockaddr_addr_eq(const struct sockaddr *sa,
|
||||
const struct ares_addr *aa)
|
||||
{
|
||||
const void *addr1;
|
||||
const void *addr2;
|
||||
|
||||
if (sa->sa_family == aa->family) {
|
||||
switch (aa->family) {
|
||||
case AF_INET:
|
||||
addr1 = &aa->addr.addr4;
|
||||
addr2 = &(CARES_INADDR_CAST(const struct sockaddr_in *, sa))->sin_addr;
|
||||
if (memcmp(addr1, addr2, sizeof(aa->addr.addr4)) == 0) {
|
||||
return ARES_TRUE; /* match */
|
||||
}
|
||||
break;
|
||||
case AF_INET6:
|
||||
addr1 = &aa->addr.addr6;
|
||||
addr2 =
|
||||
&(CARES_INADDR_CAST(const struct sockaddr_in6 *, sa))->sin6_addr;
|
||||
if (memcmp(addr1, addr2, sizeof(aa->addr.addr6)) == 0) {
|
||||
return ARES_TRUE; /* match */
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
}
|
||||
return ARES_FALSE; /* different */
|
||||
}
|
||||
|
||||
ares_conn_err_t ares_socket_write(ares_channel_t *channel, ares_socket_t fd,
|
||||
const void *data, size_t len, size_t *written,
|
||||
const struct sockaddr *sa,
|
||||
ares_socklen_t salen)
|
||||
{
|
||||
int flags = 0;
|
||||
ares_ssize_t rv;
|
||||
ares_conn_err_t err = ARES_CONN_ERR_SUCCESS;
|
||||
|
||||
#ifdef HAVE_MSG_NOSIGNAL
|
||||
flags |= MSG_NOSIGNAL;
|
||||
#endif
|
||||
|
||||
rv = channel->sock_funcs.asendto(fd, data, len, flags, sa, salen,
|
||||
channel->sock_func_cb_data);
|
||||
if (rv <= 0) {
|
||||
err = ares_socket_deref_error(SOCKERRNO);
|
||||
} else {
|
||||
*written = (size_t)rv;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
ares_conn_err_t ares_socket_recv(ares_channel_t *channel, ares_socket_t s,
|
||||
ares_bool_t is_tcp, void *data,
|
||||
size_t data_len, size_t *read_bytes)
|
||||
{
|
||||
ares_ssize_t rv;
|
||||
|
||||
*read_bytes = 0;
|
||||
|
||||
rv = channel->sock_funcs.arecvfrom(s, data, data_len, 0, NULL, 0,
|
||||
channel->sock_func_cb_data);
|
||||
|
||||
if (rv > 0) {
|
||||
*read_bytes = (size_t)rv;
|
||||
return ARES_CONN_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
if (rv == 0) {
|
||||
/* UDP allows 0-byte packets and is connectionless, so this is success */
|
||||
if (!is_tcp) {
|
||||
return ARES_CONN_ERR_SUCCESS;
|
||||
} else {
|
||||
return ARES_CONN_ERR_CONNCLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're here, rv<0 */
|
||||
return ares_socket_deref_error(SOCKERRNO);
|
||||
}
|
||||
|
||||
ares_conn_err_t ares_socket_recvfrom(ares_channel_t *channel, ares_socket_t s,
|
||||
ares_bool_t is_tcp, void *data,
|
||||
size_t data_len, int flags,
|
||||
struct sockaddr *from,
|
||||
ares_socklen_t *from_len,
|
||||
size_t *read_bytes)
|
||||
{
|
||||
ares_ssize_t rv;
|
||||
|
||||
rv = channel->sock_funcs.arecvfrom(s, data, data_len, flags, from, from_len,
|
||||
channel->sock_func_cb_data);
|
||||
|
||||
if (rv > 0) {
|
||||
*read_bytes = (size_t)rv;
|
||||
return ARES_CONN_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
if (rv == 0) {
|
||||
/* UDP allows 0-byte packets and is connectionless, so this is success */
|
||||
if (!is_tcp) {
|
||||
return ARES_CONN_ERR_SUCCESS;
|
||||
} else {
|
||||
return ARES_CONN_ERR_CONNCLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're here, rv<0 */
|
||||
return ares_socket_deref_error(SOCKERRNO);
|
||||
}
|
||||
|
||||
ares_conn_err_t ares_socket_enable_tfo(const ares_channel_t *channel,
|
||||
ares_socket_t fd)
|
||||
{
|
||||
ares_bool_t opt = ARES_TRUE;
|
||||
|
||||
if (channel->sock_funcs.asetsockopt(fd, ARES_SOCKET_OPT_TCP_FASTOPEN,
|
||||
(void *)&opt, sizeof(opt),
|
||||
channel->sock_func_cb_data) != 0) {
|
||||
return ARES_CONN_ERR_NOTIMP;
|
||||
}
|
||||
|
||||
return ARES_CONN_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares_socket_configure(ares_channel_t *channel, int family,
|
||||
ares_bool_t is_tcp, ares_socket_t fd)
|
||||
{
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sa4;
|
||||
struct sockaddr_in6 sa6;
|
||||
} local;
|
||||
|
||||
ares_socklen_t bindlen = 0;
|
||||
int rv;
|
||||
unsigned int bind_flags = 0;
|
||||
|
||||
/* Set the socket's send and receive buffer sizes. */
|
||||
if (channel->socket_send_buffer_size > 0) {
|
||||
rv = channel->sock_funcs.asetsockopt(
|
||||
fd, ARES_SOCKET_OPT_SENDBUF_SIZE,
|
||||
(void *)&channel->socket_send_buffer_size,
|
||||
sizeof(channel->socket_send_buffer_size), channel->sock_func_cb_data);
|
||||
if (rv != 0 && SOCKERRNO != ENOSYS) {
|
||||
return ARES_ECONNREFUSED; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
}
|
||||
|
||||
if (channel->socket_receive_buffer_size > 0) {
|
||||
rv = channel->sock_funcs.asetsockopt(
|
||||
fd, ARES_SOCKET_OPT_RECVBUF_SIZE,
|
||||
(void *)&channel->socket_receive_buffer_size,
|
||||
sizeof(channel->socket_receive_buffer_size), channel->sock_func_cb_data);
|
||||
if (rv != 0 && SOCKERRNO != ENOSYS) {
|
||||
return ARES_ECONNREFUSED; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
}
|
||||
|
||||
/* Bind to network interface if configured */
|
||||
if (ares_strlen(channel->local_dev_name)) {
|
||||
/* Prior versions silently ignored failure, so we need to maintain that
|
||||
* compatibility */
|
||||
(void)channel->sock_funcs.asetsockopt(
|
||||
fd, ARES_SOCKET_OPT_BIND_DEVICE, channel->local_dev_name,
|
||||
sizeof(channel->local_dev_name), channel->sock_func_cb_data);
|
||||
}
|
||||
|
||||
/* Bind to ip address if configured */
|
||||
if (family == AF_INET && channel->local_ip4) {
|
||||
memset(&local.sa4, 0, sizeof(local.sa4));
|
||||
local.sa4.sin_family = AF_INET;
|
||||
local.sa4.sin_addr.s_addr = htonl(channel->local_ip4);
|
||||
bindlen = sizeof(local.sa4);
|
||||
} else if (family == AF_INET6 &&
|
||||
memcmp(channel->local_ip6, ares_in6addr_any._S6_un._S6_u8,
|
||||
sizeof(channel->local_ip6)) != 0) {
|
||||
/* Only if not link-local and an ip other than "::" is specified */
|
||||
memset(&local.sa6, 0, sizeof(local.sa6));
|
||||
local.sa6.sin6_family = AF_INET6;
|
||||
memcpy(&local.sa6.sin6_addr, channel->local_ip6,
|
||||
sizeof(channel->local_ip6));
|
||||
bindlen = sizeof(local.sa6);
|
||||
}
|
||||
|
||||
|
||||
if (bindlen && channel->sock_funcs.abind != NULL) {
|
||||
bind_flags |= ARES_SOCKET_BIND_CLIENT;
|
||||
if (is_tcp) {
|
||||
bind_flags |= ARES_SOCKET_BIND_TCP;
|
||||
}
|
||||
if (channel->sock_funcs.abind(fd, bind_flags, &local.sa, bindlen,
|
||||
channel->sock_func_cb_data) != 0) {
|
||||
return ARES_ECONNREFUSED;
|
||||
}
|
||||
}
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_bool_t ares_sockaddr_to_ares_addr(struct ares_addr *ares_addr,
|
||||
unsigned short *port,
|
||||
const struct sockaddr *sockaddr)
|
||||
{
|
||||
if (sockaddr->sa_family == AF_INET) {
|
||||
/* NOTE: memcpy sockaddr_in due to alignment issues found by UBSAN due to
|
||||
* dnsinfo packing on MacOS */
|
||||
struct sockaddr_in sockaddr_in;
|
||||
memcpy(&sockaddr_in, sockaddr, sizeof(sockaddr_in));
|
||||
|
||||
ares_addr->family = AF_INET;
|
||||
memcpy(&ares_addr->addr.addr4, &(sockaddr_in.sin_addr),
|
||||
sizeof(ares_addr->addr.addr4));
|
||||
|
||||
if (port) {
|
||||
*port = ntohs(sockaddr_in.sin_port);
|
||||
}
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
if (sockaddr->sa_family == AF_INET6) {
|
||||
/* NOTE: memcpy sockaddr_in6 due to alignment issues found by UBSAN due to
|
||||
* dnsinfo packing on MacOS */
|
||||
struct sockaddr_in6 sockaddr_in6;
|
||||
memcpy(&sockaddr_in6, sockaddr, sizeof(sockaddr_in6));
|
||||
|
||||
ares_addr->family = AF_INET6;
|
||||
memcpy(&ares_addr->addr.addr6, &(sockaddr_in6.sin6_addr),
|
||||
sizeof(ares_addr->addr.addr6));
|
||||
if (port) {
|
||||
*port = ntohs(sockaddr_in6.sin6_port);
|
||||
}
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_conn_err_t ares_socket_open(ares_socket_t *sock, ares_channel_t *channel,
|
||||
int af, int type, int protocol)
|
||||
{
|
||||
ares_socket_t s;
|
||||
|
||||
*sock = ARES_SOCKET_BAD;
|
||||
|
||||
s =
|
||||
channel->sock_funcs.asocket(af, type, protocol, channel->sock_func_cb_data);
|
||||
|
||||
if (s == ARES_SOCKET_BAD) {
|
||||
return ares_socket_deref_error(SOCKERRNO);
|
||||
}
|
||||
|
||||
*sock = s;
|
||||
|
||||
return ARES_CONN_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
ares_conn_err_t ares_socket_connect(ares_channel_t *channel,
|
||||
ares_socket_t sockfd, ares_bool_t is_tfo,
|
||||
const struct sockaddr *addr,
|
||||
ares_socklen_t addrlen)
|
||||
{
|
||||
ares_conn_err_t err = ARES_CONN_ERR_SUCCESS;
|
||||
unsigned int flags = 0;
|
||||
|
||||
if (is_tfo) {
|
||||
flags |= ARES_SOCKET_CONN_TCP_FASTOPEN;
|
||||
}
|
||||
|
||||
do {
|
||||
int rv;
|
||||
|
||||
rv = channel->sock_funcs.aconnect(sockfd, addr, addrlen, flags,
|
||||
channel->sock_func_cb_data);
|
||||
|
||||
if (rv < 0) {
|
||||
err = ares_socket_deref_error(SOCKERRNO);
|
||||
} else {
|
||||
err = ARES_CONN_ERR_SUCCESS;
|
||||
}
|
||||
} while (err == ARES_CONN_ERR_INTERRUPT);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void ares_socket_close(ares_channel_t *channel, ares_socket_t s)
|
||||
{
|
||||
if (channel == NULL || s == ARES_SOCKET_BAD) {
|
||||
return;
|
||||
}
|
||||
|
||||
channel->sock_funcs.aclose(s, channel->sock_func_cb_data);
|
||||
}
|
||||
|
||||
void ares_set_socket_callback(ares_channel_t *channel,
|
||||
ares_sock_create_callback cb, void *data)
|
||||
{
|
||||
if (channel == NULL) {
|
||||
return;
|
||||
}
|
||||
channel->sock_create_cb = cb;
|
||||
channel->sock_create_cb_data = data;
|
||||
}
|
||||
|
||||
void ares_set_socket_configure_callback(ares_channel_t *channel,
|
||||
ares_sock_config_callback cb,
|
||||
void *data)
|
||||
{
|
||||
if (channel == NULL || channel->optmask & ARES_OPT_EVENT_THREAD) {
|
||||
return;
|
||||
}
|
||||
channel->sock_config_cb = cb;
|
||||
channel->sock_config_cb_data = data;
|
||||
}
|
||||
|
||||
void ares_set_pending_write_cb(ares_channel_t *channel,
|
||||
ares_pending_write_cb callback, void *user_data)
|
||||
{
|
||||
if (channel == NULL || channel->optmask & ARES_OPT_EVENT_THREAD) {
|
||||
return;
|
||||
}
|
||||
channel->notify_pending_write_cb = callback;
|
||||
channel->notify_pending_write_cb_data = user_data;
|
||||
}
|
||||
163
deps/cares/src/lib/ares_socket.h
vendored
Normal file
163
deps/cares/src/lib/ares_socket.h
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Brad House
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef __ARES_SOCKET_H
|
||||
#define __ARES_SOCKET_H
|
||||
|
||||
/* Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno
|
||||
* (or equivalent) on this platform to hide platform details to code using it.
|
||||
*/
|
||||
#ifdef USE_WINSOCK
|
||||
# define SOCKERRNO ((int)WSAGetLastError())
|
||||
# define SET_SOCKERRNO(x) (WSASetLastError((int)(x)))
|
||||
#else
|
||||
# define SOCKERRNO (errno)
|
||||
# define SET_SOCKERRNO(x) (errno = (x))
|
||||
#endif
|
||||
|
||||
/* Portable error number symbolic names defined to Winsock error codes. */
|
||||
#ifdef USE_WINSOCK
|
||||
# undef EBADF /* override definition in errno.h */
|
||||
# define EBADF WSAEBADF
|
||||
# undef EINTR /* override definition in errno.h */
|
||||
# define EINTR WSAEINTR
|
||||
# undef EINVAL /* override definition in errno.h */
|
||||
# define EINVAL WSAEINVAL
|
||||
# undef EWOULDBLOCK /* override definition in errno.h */
|
||||
# define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
# undef EINPROGRESS /* override definition in errno.h */
|
||||
# define EINPROGRESS WSAEINPROGRESS
|
||||
# undef EALREADY /* override definition in errno.h */
|
||||
# define EALREADY WSAEALREADY
|
||||
# undef ENOTSOCK /* override definition in errno.h */
|
||||
# define ENOTSOCK WSAENOTSOCK
|
||||
# undef EDESTADDRREQ /* override definition in errno.h */
|
||||
# define EDESTADDRREQ WSAEDESTADDRREQ
|
||||
# undef EMSGSIZE /* override definition in errno.h */
|
||||
# define EMSGSIZE WSAEMSGSIZE
|
||||
# undef EPROTOTYPE /* override definition in errno.h */
|
||||
# define EPROTOTYPE WSAEPROTOTYPE
|
||||
# undef ENOPROTOOPT /* override definition in errno.h */
|
||||
# define ENOPROTOOPT WSAENOPROTOOPT
|
||||
# undef EPROTONOSUPPORT /* override definition in errno.h */
|
||||
# define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
||||
# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
||||
# undef EOPNOTSUPP /* override definition in errno.h */
|
||||
# define EOPNOTSUPP WSAEOPNOTSUPP
|
||||
# undef ENOSYS /* override definition in errno.h */
|
||||
# define ENOSYS WSAEOPNOTSUPP
|
||||
# define EPFNOSUPPORT WSAEPFNOSUPPORT
|
||||
# undef EAFNOSUPPORT /* override definition in errno.h */
|
||||
# define EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
# undef EADDRINUSE /* override definition in errno.h */
|
||||
# define EADDRINUSE WSAEADDRINUSE
|
||||
# undef EADDRNOTAVAIL /* override definition in errno.h */
|
||||
# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
# undef ENETDOWN /* override definition in errno.h */
|
||||
# define ENETDOWN WSAENETDOWN
|
||||
# undef ENETUNREACH /* override definition in errno.h */
|
||||
# define ENETUNREACH WSAENETUNREACH
|
||||
# undef ENETRESET /* override definition in errno.h */
|
||||
# define ENETRESET WSAENETRESET
|
||||
# undef ECONNABORTED /* override definition in errno.h */
|
||||
# define ECONNABORTED WSAECONNABORTED
|
||||
# undef ECONNRESET /* override definition in errno.h */
|
||||
# define ECONNRESET WSAECONNRESET
|
||||
# undef ENOBUFS /* override definition in errno.h */
|
||||
# define ENOBUFS WSAENOBUFS
|
||||
# undef EISCONN /* override definition in errno.h */
|
||||
# define EISCONN WSAEISCONN
|
||||
# undef ENOTCONN /* override definition in errno.h */
|
||||
# define ENOTCONN WSAENOTCONN
|
||||
# define ESHUTDOWN WSAESHUTDOWN
|
||||
# define ETOOMANYREFS WSAETOOMANYREFS
|
||||
# undef ETIMEDOUT /* override definition in errno.h */
|
||||
# define ETIMEDOUT WSAETIMEDOUT
|
||||
# undef ECONNREFUSED /* override definition in errno.h */
|
||||
# define ECONNREFUSED WSAECONNREFUSED
|
||||
# undef ELOOP /* override definition in errno.h */
|
||||
# define ELOOP WSAELOOP
|
||||
# ifndef ENAMETOOLONG /* possible previous definition in errno.h */
|
||||
# define ENAMETOOLONG WSAENAMETOOLONG
|
||||
# endif
|
||||
# define EHOSTDOWN WSAEHOSTDOWN
|
||||
# undef EHOSTUNREACH /* override definition in errno.h */
|
||||
# define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
# ifndef ENOTEMPTY /* possible previous definition in errno.h */
|
||||
# define ENOTEMPTY WSAENOTEMPTY
|
||||
# endif
|
||||
# define EPROCLIM WSAEPROCLIM
|
||||
# define EUSERS WSAEUSERS
|
||||
# define EDQUOT WSAEDQUOT
|
||||
# define ESTALE WSAESTALE
|
||||
# define EREMOTE WSAEREMOTE
|
||||
#endif
|
||||
|
||||
/*! Socket errors */
|
||||
typedef enum {
|
||||
ARES_CONN_ERR_SUCCESS = 0, /*!< Success */
|
||||
ARES_CONN_ERR_WOULDBLOCK = 1, /*!< Operation would block */
|
||||
ARES_CONN_ERR_CONNCLOSED = 2, /*!< Connection closed (gracefully) */
|
||||
ARES_CONN_ERR_CONNABORTED = 3, /*!< Connection Aborted */
|
||||
ARES_CONN_ERR_CONNRESET = 4, /*!< Connection Reset */
|
||||
ARES_CONN_ERR_CONNREFUSED = 5, /*!< Connection Refused */
|
||||
ARES_CONN_ERR_CONNTIMEDOUT = 6, /*!< Connection Timed Out */
|
||||
ARES_CONN_ERR_HOSTDOWN = 7, /*!< Host Down */
|
||||
ARES_CONN_ERR_HOSTUNREACH = 8, /*!< Host Unreachable */
|
||||
ARES_CONN_ERR_NETDOWN = 9, /*!< Network Down */
|
||||
ARES_CONN_ERR_NETUNREACH = 10, /*!< Network Unreachable */
|
||||
ARES_CONN_ERR_INTERRUPT = 11, /*!< Call interrupted by signal, repeat */
|
||||
ARES_CONN_ERR_AFNOSUPPORT = 12, /*!< Address family not supported */
|
||||
ARES_CONN_ERR_BADADDR = 13, /*!< Bad Address / Unavailable */
|
||||
ARES_CONN_ERR_NOMEM = 14, /*!< Out of memory */
|
||||
ARES_CONN_ERR_INVALID = 15, /*!< Invalid Usage */
|
||||
ARES_CONN_ERR_TOOLARGE = 16, /*!< Request size too large */
|
||||
ARES_CONN_ERR_NOTIMP = 17, /*!< Not implemented */
|
||||
ARES_CONN_ERR_FAILURE = 99 /*!< Generic failure */
|
||||
} ares_conn_err_t;
|
||||
|
||||
ares_bool_t ares_sockaddr_addr_eq(const struct sockaddr *sa,
|
||||
const struct ares_addr *aa);
|
||||
ares_status_t ares_socket_configure(ares_channel_t *channel, int family,
|
||||
ares_bool_t is_tcp, ares_socket_t fd);
|
||||
ares_conn_err_t ares_socket_enable_tfo(const ares_channel_t *channel,
|
||||
ares_socket_t fd);
|
||||
ares_conn_err_t ares_socket_open(ares_socket_t *sock, ares_channel_t *channel,
|
||||
int af, int type, int protocol);
|
||||
ares_bool_t ares_socket_try_again(int errnum);
|
||||
void ares_socket_close(ares_channel_t *channel, ares_socket_t s);
|
||||
ares_conn_err_t ares_socket_connect(ares_channel_t *channel,
|
||||
ares_socket_t sockfd, ares_bool_t is_tfo,
|
||||
const struct sockaddr *addr,
|
||||
ares_socklen_t addrlen);
|
||||
ares_bool_t ares_sockaddr_to_ares_addr(struct ares_addr *ares_addr,
|
||||
unsigned short *port,
|
||||
const struct sockaddr *sockaddr);
|
||||
ares_conn_err_t ares_socket_write(ares_channel_t *channel, ares_socket_t fd,
|
||||
const void *data, size_t len, size_t *written,
|
||||
const struct sockaddr *sa,
|
||||
ares_socklen_t salen);
|
||||
#endif
|
||||
|
|
@ -345,8 +345,9 @@ static int rfc6724_compare(const void *ptr1, const void *ptr2)
|
|||
static int find_src_addr(ares_channel_t *channel, const struct sockaddr *addr,
|
||||
struct sockaddr *src_addr)
|
||||
{
|
||||
ares_socket_t sock;
|
||||
ares_socklen_t len;
|
||||
ares_socket_t sock;
|
||||
ares_socklen_t len;
|
||||
ares_conn_err_t err;
|
||||
|
||||
switch (addr->sa_family) {
|
||||
case AF_INET:
|
||||
|
|
@ -360,25 +361,27 @@ static int find_src_addr(ares_channel_t *channel, const struct sockaddr *addr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
sock = ares__open_socket(channel, addr->sa_family, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (sock == ARES_SOCKET_BAD) {
|
||||
if (SOCKERRNO == EAFNOSUPPORT) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
err =
|
||||
ares_socket_open(&sock, channel, addr->sa_family, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (err == ARES_CONN_ERR_AFNOSUPPORT) {
|
||||
return 0;
|
||||
} else if (err != ARES_CONN_ERR_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ares__connect_socket(channel, sock, addr, len) != ARES_SUCCESS) {
|
||||
ares__close_socket(channel, sock);
|
||||
err = ares_socket_connect(channel, sock, ARES_FALSE, addr, len);
|
||||
if (err != ARES_CONN_ERR_SUCCESS && err != ARES_CONN_ERR_WOULDBLOCK) {
|
||||
ares_socket_close(channel, sock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (getsockname(sock, src_addr, &len) != 0) {
|
||||
ares__close_socket(channel, sock);
|
||||
if (channel->sock_funcs.agetsockname == NULL ||
|
||||
channel->sock_funcs.agetsockname(sock, src_addr, &len,
|
||||
channel->sock_func_cb_data) != 0) {
|
||||
ares_socket_close(channel, sock);
|
||||
return -1;
|
||||
}
|
||||
ares__close_socket(channel, sock);
|
||||
ares_socket_close(channel, sock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -386,8 +389,8 @@ static int find_src_addr(ares_channel_t *channel, const struct sockaddr *addr,
|
|||
* Sort the linked list starting at sentinel->ai_next in RFC6724 order.
|
||||
* Will leave the list unchanged if an error occurs.
|
||||
*/
|
||||
ares_status_t ares__sortaddrinfo(ares_channel_t *channel,
|
||||
struct ares_addrinfo_node *list_sentinel)
|
||||
ares_status_t ares_sortaddrinfo(ares_channel_t *channel,
|
||||
struct ares_addrinfo_node *list_sentinel)
|
||||
{
|
||||
struct ares_addrinfo_node *cur;
|
||||
size_t nelem = 0;
|
||||
106
deps/cares/src/lib/ares_sysconfig.c
vendored
106
deps/cares/src/lib/ares_sysconfig.c
vendored
|
|
@ -56,11 +56,11 @@
|
|||
#endif
|
||||
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
|
||||
|
||||
#if defined(__MVS__)
|
||||
static ares_status_t ares__init_sysconfig_mvs(ares_sysconfig_t *sysconfig)
|
||||
static ares_status_t ares_init_sysconfig_mvs(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
struct __res_state *res = 0;
|
||||
size_t count4;
|
||||
|
|
@ -99,9 +99,9 @@ static ares_status_t ares__init_sysconfig_mvs(ares_sysconfig_t *sysconfig)
|
|||
addr.addr.addr4.s_addr = addr_in->sin_addr.s_addr;
|
||||
addr.family = AF_INET;
|
||||
|
||||
status =
|
||||
ares__sconfig_append(&sysconfig->sconfig, &addr, htons(addr_in->sin_port),
|
||||
htons(addr_in->sin_port), NULL);
|
||||
status = ares_sconfig_append(channel, &sysconfig->sconfig, &addr,
|
||||
htons(addr_in->sin_port),
|
||||
htons(addr_in->sin_port), NULL);
|
||||
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
|
|
@ -116,9 +116,9 @@ static ares_status_t ares__init_sysconfig_mvs(ares_sysconfig_t *sysconfig)
|
|||
memcpy(&(addr.addr.addr6), &(addr_in->sin6_addr),
|
||||
sizeof(addr_in->sin6_addr));
|
||||
|
||||
status =
|
||||
ares__sconfig_append(&sysconfig->sconfig, &addr, htons(addr_in->sin_port),
|
||||
htons(addr_in->sin_port), NULL);
|
||||
status = ares_sconfig_append(channel, &sysconfig->sconfig, &addr,
|
||||
htons(addr_in->sin_port),
|
||||
htons(addr_in->sin_port), NULL);
|
||||
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
|
|
@ -130,7 +130,8 @@ static ares_status_t ares__init_sysconfig_mvs(ares_sysconfig_t *sysconfig)
|
|||
#endif
|
||||
|
||||
#if defined(__riscos__)
|
||||
static ares_status_t ares__init_sysconfig_riscos(ares_sysconfig_t *sysconfig)
|
||||
static ares_status_t ares_init_sysconfig_riscos(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
char *line;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
|
|
@ -153,8 +154,8 @@ static ares_status_t ares__init_sysconfig_riscos(ares_sysconfig_t *sysconfig)
|
|||
if (space) {
|
||||
*space = '\0';
|
||||
}
|
||||
status =
|
||||
ares__sconfig_append_fromstr(&sysconfig->sconfig, pos, ARES_TRUE);
|
||||
status = ares_sconfig_append_fromstr(channel, &sysconfig->sconfig, pos,
|
||||
ARES_TRUE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -169,7 +170,8 @@ static ares_status_t ares__init_sysconfig_riscos(ares_sysconfig_t *sysconfig)
|
|||
#endif
|
||||
|
||||
#if defined(WATT32)
|
||||
static ares_status_t ares__init_sysconfig_watt32(ares_sysconfig_t *sysconfig)
|
||||
static ares_status_t ares_init_sysconfig_watt32(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
size_t i;
|
||||
ares_status_t status;
|
||||
|
|
@ -182,7 +184,8 @@ static ares_status_t ares__init_sysconfig_watt32(ares_sysconfig_t *sysconfig)
|
|||
addr.family = AF_INET;
|
||||
addr.addr.addr4.s_addr = htonl(def_nameservers[i]);
|
||||
|
||||
status = ares__sconfig_append(&sysconfig->sconfig, &addr, 0, 0, NULL);
|
||||
status =
|
||||
ares_sconfig_append(channel, &sysconfig->sconfig, &addr, 0, 0, NULL);
|
||||
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
|
|
@ -194,7 +197,8 @@ static ares_status_t ares__init_sysconfig_watt32(ares_sysconfig_t *sysconfig)
|
|||
#endif
|
||||
|
||||
#if defined(ANDROID) || defined(__ANDROID__)
|
||||
static ares_status_t ares__init_sysconfig_android(ares_sysconfig_t *sysconfig)
|
||||
static ares_status_t ares_init_sysconfig_android(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
size_t i;
|
||||
char **dns_servers;
|
||||
|
|
@ -211,8 +215,8 @@ static ares_status_t ares__init_sysconfig_android(ares_sysconfig_t *sysconfig)
|
|||
dns_servers = ares_get_android_server_list(MAX_DNS_PROPERTIES, &num_servers);
|
||||
if (dns_servers != NULL) {
|
||||
for (i = 0; i < num_servers; i++) {
|
||||
status = ares__sconfig_append_fromstr(&sysconfig->sconfig, dns_servers[i],
|
||||
ARES_TRUE);
|
||||
status = ares_sconfig_append_fromstr(channel, &sysconfig->sconfig,
|
||||
dns_servers[i], ARES_TRUE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -224,7 +228,7 @@ static ares_status_t ares__init_sysconfig_android(ares_sysconfig_t *sysconfig)
|
|||
}
|
||||
|
||||
domains = ares_get_android_search_domains_list();
|
||||
sysconfig->domains = ares__strsplit(domains, ", ", &sysconfig->ndomains);
|
||||
sysconfig->domains = ares_strsplit(domains, ", ", &sysconfig->ndomains);
|
||||
ares_free(domains);
|
||||
|
||||
# ifdef HAVE___SYSTEM_PROPERTY_GET
|
||||
|
|
@ -243,8 +247,8 @@ static ares_status_t ares__init_sysconfig_android(ares_sysconfig_t *sysconfig)
|
|||
if (__system_property_get(propname, propvalue) < 1) {
|
||||
break;
|
||||
}
|
||||
status =
|
||||
ares__sconfig_append_fromstr(&sysconfig->sconfig, propvalue, ARES_TRUE);
|
||||
status = ares_sconfig_append_fromstr(channel, &sysconfig->sconfig,
|
||||
propvalue, ARES_TRUE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -257,7 +261,9 @@ static ares_status_t ares__init_sysconfig_android(ares_sysconfig_t *sysconfig)
|
|||
#endif
|
||||
|
||||
#if defined(CARES_USE_LIBRESOLV)
|
||||
static ares_status_t ares__init_sysconfig_libresolv(ares_sysconfig_t *sysconfig)
|
||||
static ares_status_t
|
||||
ares_init_sysconfig_libresolv(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
struct __res_state res;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
|
|
@ -265,7 +271,7 @@ static ares_status_t ares__init_sysconfig_libresolv(ares_sysconfig_t *sysconfig)
|
|||
int nscount;
|
||||
size_t i;
|
||||
size_t entries = 0;
|
||||
ares__buf_t *ipbuf = NULL;
|
||||
ares_buf_t *ipbuf = NULL;
|
||||
|
||||
memset(&res, 0, sizeof(res));
|
||||
|
||||
|
|
@ -295,58 +301,58 @@ static ares_status_t ares__init_sysconfig_libresolv(ares_sysconfig_t *sysconfig)
|
|||
|
||||
|
||||
/* [ip]:port%iface */
|
||||
ipbuf = ares__buf_create();
|
||||
ipbuf = ares_buf_create();
|
||||
if (ipbuf == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ares__buf_append_str(ipbuf, "[");
|
||||
status = ares_buf_append_str(ipbuf, "[");
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ares__buf_append_str(ipbuf, ipaddr);
|
||||
status = ares_buf_append_str(ipbuf, ipaddr);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ares__buf_append_str(ipbuf, "]");
|
||||
status = ares_buf_append_str(ipbuf, "]");
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (port) {
|
||||
status = ares__buf_append_str(ipbuf, ":");
|
||||
status = ares_buf_append_str(ipbuf, ":");
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
status = ares__buf_append_num_dec(ipbuf, port, 0);
|
||||
status = ares_buf_append_num_dec(ipbuf, port, 0);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (ll_scope) {
|
||||
status = ares__buf_append_str(ipbuf, "%");
|
||||
status = ares_buf_append_str(ipbuf, "%");
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
status = ares__buf_append_num_dec(ipbuf, ll_scope, 0);
|
||||
status = ares_buf_append_num_dec(ipbuf, ll_scope, 0);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
ipstr = ares__buf_finish_str(ipbuf, NULL);
|
||||
ipstr = ares_buf_finish_str(ipbuf, NULL);
|
||||
ipbuf = NULL;
|
||||
if (ipstr == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
status =
|
||||
ares__sconfig_append_fromstr(&sysconfig->sconfig, ipstr, ARES_TRUE);
|
||||
status = ares_sconfig_append_fromstr(channel, &sysconfig->sconfig, ipstr,
|
||||
ARES_TRUE);
|
||||
|
||||
ares_free(ipstr);
|
||||
if (status != ARES_SUCCESS) {
|
||||
|
|
@ -400,7 +406,7 @@ static ares_status_t ares__init_sysconfig_libresolv(ares_sysconfig_t *sysconfig)
|
|||
}
|
||||
|
||||
done:
|
||||
ares__buf_destroy(ipbuf);
|
||||
ares_buf_destroy(ipbuf);
|
||||
res_ndestroy(&res);
|
||||
return status;
|
||||
}
|
||||
|
|
@ -408,8 +414,8 @@ done:
|
|||
|
||||
static void ares_sysconfig_free(ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
ares__llist_destroy(sysconfig->sconfig);
|
||||
ares__strsplit_free(sysconfig->domains, sysconfig->ndomains);
|
||||
ares_llist_destroy(sysconfig->sconfig);
|
||||
ares_strsplit_free(sysconfig->domains, sysconfig->ndomains);
|
||||
ares_free(sysconfig->sortlist);
|
||||
ares_free(sysconfig->lookups);
|
||||
memset(sysconfig, 0, sizeof(*sysconfig));
|
||||
|
|
@ -421,7 +427,7 @@ static ares_status_t ares_sysconfig_apply(ares_channel_t *channel,
|
|||
ares_status_t status;
|
||||
|
||||
if (sysconfig->sconfig && !(channel->optmask & ARES_OPT_SERVERS)) {
|
||||
status = ares__servers_update(channel, sysconfig->sconfig, ARES_FALSE);
|
||||
status = ares_servers_update(channel, sysconfig->sconfig, ARES_FALSE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -431,12 +437,12 @@ static ares_status_t ares_sysconfig_apply(ares_channel_t *channel,
|
|||
/* Make sure we duplicate first then replace so even if there is
|
||||
* ARES_ENOMEM, the channel stays in a good state */
|
||||
char **temp =
|
||||
ares__strsplit_duplicate(sysconfig->domains, sysconfig->ndomains);
|
||||
ares_strsplit_duplicate(sysconfig->domains, sysconfig->ndomains);
|
||||
if (temp == NULL) {
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
ares__strsplit_free(channel->domains, channel->ndomains);
|
||||
ares_strsplit_free(channel->domains, channel->ndomains);
|
||||
channel->domains = temp;
|
||||
channel->ndomains = sysconfig->ndomains;
|
||||
}
|
||||
|
|
@ -488,7 +494,7 @@ static ares_status_t ares_sysconfig_apply(ares_channel_t *channel,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__init_by_sysconfig(ares_channel_t *channel)
|
||||
ares_status_t ares_init_by_sysconfig(ares_channel_t *channel)
|
||||
{
|
||||
ares_status_t status;
|
||||
ares_sysconfig_t sysconfig;
|
||||
|
|
@ -497,21 +503,21 @@ ares_status_t ares__init_by_sysconfig(ares_channel_t *channel)
|
|||
sysconfig.ndots = 1; /* Default value if not otherwise set */
|
||||
|
||||
#if defined(USE_WINSOCK)
|
||||
status = ares__init_sysconfig_windows(&sysconfig);
|
||||
status = ares_init_sysconfig_windows(channel, &sysconfig);
|
||||
#elif defined(__MVS__)
|
||||
status = ares__init_sysconfig_mvs(&sysconfig);
|
||||
status = ares_init_sysconfig_mvs(channel, &sysconfig);
|
||||
#elif defined(__riscos__)
|
||||
status = ares__init_sysconfig_riscos(&sysconfig);
|
||||
status = ares_init_sysconfig_riscos(channel, &sysconfig);
|
||||
#elif defined(WATT32)
|
||||
status = ares__init_sysconfig_watt32(&sysconfig);
|
||||
status = ares_init_sysconfig_watt32(channel, &sysconfig);
|
||||
#elif defined(ANDROID) || defined(__ANDROID__)
|
||||
status = ares__init_sysconfig_android(&sysconfig);
|
||||
status = ares_init_sysconfig_android(channel, &sysconfig);
|
||||
#elif defined(__APPLE__)
|
||||
status = ares__init_sysconfig_macos(&sysconfig);
|
||||
status = ares_init_sysconfig_macos(channel, &sysconfig);
|
||||
#elif defined(CARES_USE_LIBRESOLV)
|
||||
status = ares__init_sysconfig_libresolv(&sysconfig);
|
||||
status = ares_init_sysconfig_libresolv(channel, &sysconfig);
|
||||
#else
|
||||
status = ares__init_sysconfig_files(channel, &sysconfig);
|
||||
status = ares_init_sysconfig_files(channel, &sysconfig);
|
||||
#endif
|
||||
|
||||
if (status != ARES_SUCCESS) {
|
||||
|
|
@ -519,7 +525,7 @@ ares_status_t ares__init_by_sysconfig(ares_channel_t *channel)
|
|||
}
|
||||
|
||||
/* Environment is supposed to override sysconfig */
|
||||
status = ares__init_by_environment(&sysconfig);
|
||||
status = ares_init_by_environment(&sysconfig);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -527,10 +533,10 @@ ares_status_t ares__init_by_sysconfig(ares_channel_t *channel)
|
|||
/* Lock when applying the configuration to the channel. Don't need to
|
||||
* lock prior to this. */
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
status = ares_sysconfig_apply(channel, &sysconfig);
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
|
|
|
|||
380
deps/cares/src/lib/ares_sysconfig_files.c
vendored
380
deps/cares/src/lib/ares_sysconfig_files.c
vendored
|
|
@ -60,7 +60,6 @@
|
|||
#endif
|
||||
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
|
||||
static unsigned char ip_natural_mask(const struct ares_addr *addr)
|
||||
{
|
||||
|
|
@ -110,7 +109,7 @@ static ares_bool_t sortlist_append(struct apattern **sortlist, size_t *nsort,
|
|||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
static ares_status_t parse_sort(ares__buf_t *buf, struct apattern *pat)
|
||||
static ares_status_t parse_sort(ares_buf_t *buf, struct apattern *pat)
|
||||
{
|
||||
ares_status_t status;
|
||||
const unsigned char ip_charset[] = "ABCDEFabcdef0123456789.:";
|
||||
|
|
@ -120,22 +119,22 @@ static ares_status_t parse_sort(ares__buf_t *buf, struct apattern *pat)
|
|||
memset(pat, 0, sizeof(*pat));
|
||||
|
||||
/* Consume any leading whitespace */
|
||||
ares__buf_consume_whitespace(buf, ARES_TRUE);
|
||||
ares_buf_consume_whitespace(buf, ARES_TRUE);
|
||||
|
||||
/* If no length, just ignore, return ENOTFOUND as an indicator */
|
||||
if (ares__buf_len(buf) == 0) {
|
||||
if (ares_buf_len(buf) == 0) {
|
||||
return ARES_ENOTFOUND;
|
||||
}
|
||||
|
||||
ares__buf_tag(buf);
|
||||
ares_buf_tag(buf);
|
||||
|
||||
/* Consume ip address */
|
||||
if (ares__buf_consume_charset(buf, ip_charset, sizeof(ip_charset) - 1) == 0) {
|
||||
if (ares_buf_consume_charset(buf, ip_charset, sizeof(ip_charset) - 1) == 0) {
|
||||
return ARES_EBADSTR;
|
||||
}
|
||||
|
||||
/* Fetch ip address */
|
||||
status = ares__buf_tag_fetch_string(buf, ipaddr, sizeof(ipaddr));
|
||||
status = ares_buf_tag_fetch_string(buf, ipaddr, sizeof(ipaddr));
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -147,24 +146,24 @@ static ares_status_t parse_sort(ares__buf_t *buf, struct apattern *pat)
|
|||
}
|
||||
|
||||
/* See if there is a subnet mask */
|
||||
if (ares__buf_begins_with(buf, (const unsigned char *)"/", 1)) {
|
||||
if (ares_buf_begins_with(buf, (const unsigned char *)"/", 1)) {
|
||||
char maskstr[16];
|
||||
const unsigned char ipv4_charset[] = "0123456789.";
|
||||
|
||||
|
||||
/* Consume / */
|
||||
ares__buf_consume(buf, 1);
|
||||
ares_buf_consume(buf, 1);
|
||||
|
||||
ares__buf_tag(buf);
|
||||
ares_buf_tag(buf);
|
||||
|
||||
/* Consume mask */
|
||||
if (ares__buf_consume_charset(buf, ipv4_charset,
|
||||
sizeof(ipv4_charset) - 1) == 0) {
|
||||
if (ares_buf_consume_charset(buf, ipv4_charset, sizeof(ipv4_charset) - 1) ==
|
||||
0) {
|
||||
return ARES_EBADSTR;
|
||||
}
|
||||
|
||||
/* Fetch mask */
|
||||
status = ares__buf_tag_fetch_string(buf, maskstr, sizeof(maskstr));
|
||||
status = ares_buf_tag_fetch_string(buf, maskstr, sizeof(maskstr));
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -190,33 +189,34 @@ static ares_status_t parse_sort(ares__buf_t *buf, struct apattern *pat)
|
|||
return ARES_EBADSTR;
|
||||
}
|
||||
ptr = (const unsigned char *)&maskaddr.addr.addr4;
|
||||
pat->mask = (unsigned char)(ares__count_bits_u8(ptr[0]) +
|
||||
ares__count_bits_u8(ptr[1]) +
|
||||
ares__count_bits_u8(ptr[2]) +
|
||||
ares__count_bits_u8(ptr[3]));
|
||||
pat->mask = (unsigned char)(ares_count_bits_u8(ptr[0]) +
|
||||
ares_count_bits_u8(ptr[1]) +
|
||||
ares_count_bits_u8(ptr[2]) +
|
||||
ares_count_bits_u8(ptr[3]));
|
||||
}
|
||||
} else {
|
||||
pat->mask = ip_natural_mask(&pat->addr);
|
||||
}
|
||||
|
||||
/* Consume any trailing whitespace */
|
||||
ares__buf_consume_whitespace(buf, ARES_TRUE);
|
||||
ares_buf_consume_whitespace(buf, ARES_TRUE);
|
||||
|
||||
/* If we have any trailing bytes other than whitespace, its a parse failure */
|
||||
if (ares__buf_len(buf) != 0) {
|
||||
if (ares_buf_len(buf) != 0) {
|
||||
return ARES_EBADSTR;
|
||||
}
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__parse_sortlist(struct apattern **sortlist, size_t *nsort,
|
||||
const char *str)
|
||||
ares_status_t ares_parse_sortlist(struct apattern **sortlist, size_t *nsort,
|
||||
const char *str)
|
||||
{
|
||||
ares__buf_t *buf = NULL;
|
||||
ares__llist_t *list = NULL;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares__llist_node_t *node = NULL;
|
||||
ares_buf_t *buf = NULL;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares_array_t *arr = NULL;
|
||||
size_t num = 0;
|
||||
size_t i;
|
||||
|
||||
if (sortlist == NULL || nsort == NULL || str == NULL) {
|
||||
return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
|
|
@ -229,22 +229,23 @@ ares_status_t ares__parse_sortlist(struct apattern **sortlist, size_t *nsort,
|
|||
*sortlist = NULL;
|
||||
*nsort = 0;
|
||||
|
||||
buf = ares__buf_create_const((const unsigned char *)str, ares_strlen(str));
|
||||
buf = ares_buf_create_const((const unsigned char *)str, ares_strlen(str));
|
||||
if (buf == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Split on space or semicolon */
|
||||
status = ares__buf_split(buf, (const unsigned char *)" ;", 2,
|
||||
ARES_BUF_SPLIT_NONE, 0, &list);
|
||||
status = ares_buf_split(buf, (const unsigned char *)" ;", 2,
|
||||
ARES_BUF_SPLIT_NONE, 0, &arr);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (node = ares__llist_node_first(list); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
ares__buf_t *entry = ares__llist_node_val(node);
|
||||
num = ares_array_len(arr);
|
||||
for (i = 0; i < num; i++) {
|
||||
ares_buf_t **bufptr = ares_array_at(arr, i);
|
||||
ares_buf_t *entry = *bufptr;
|
||||
|
||||
struct apattern pat;
|
||||
|
||||
|
|
@ -266,8 +267,8 @@ ares_status_t ares__parse_sortlist(struct apattern **sortlist, size_t *nsort,
|
|||
status = ARES_SUCCESS;
|
||||
|
||||
done:
|
||||
ares__buf_destroy(buf);
|
||||
ares__llist_destroy(list);
|
||||
ares_buf_destroy(buf);
|
||||
ares_array_destroy(arr);
|
||||
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares_free(*sortlist);
|
||||
|
|
@ -283,12 +284,12 @@ static ares_status_t config_search(ares_sysconfig_t *sysconfig, const char *str,
|
|||
{
|
||||
if (sysconfig->domains && sysconfig->ndomains > 0) {
|
||||
/* if we already have some domains present, free them first */
|
||||
ares__strsplit_free(sysconfig->domains, sysconfig->ndomains);
|
||||
ares_strsplit_free(sysconfig->domains, sysconfig->ndomains);
|
||||
sysconfig->domains = NULL;
|
||||
sysconfig->ndomains = 0;
|
||||
}
|
||||
|
||||
sysconfig->domains = ares__strsplit(str, ", ", &sysconfig->ndomains);
|
||||
sysconfig->domains = ares_strsplit(str, ", ", &sysconfig->ndomains);
|
||||
if (sysconfig->domains == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
|
@ -306,52 +307,45 @@ static ares_status_t config_search(ares_sysconfig_t *sysconfig, const char *str,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_status_t buf_fetch_string(ares__buf_t *buf, char *str,
|
||||
static ares_status_t buf_fetch_string(ares_buf_t *buf, char *str,
|
||||
size_t str_len)
|
||||
{
|
||||
ares_status_t status;
|
||||
ares__buf_tag(buf);
|
||||
ares__buf_consume(buf, ares__buf_len(buf));
|
||||
ares_buf_tag(buf);
|
||||
ares_buf_consume(buf, ares_buf_len(buf));
|
||||
|
||||
status = ares__buf_tag_fetch_string(buf, str, str_len);
|
||||
status = ares_buf_tag_fetch_string(buf, str, str_len);
|
||||
return status;
|
||||
}
|
||||
|
||||
static ares_status_t config_lookup(ares_sysconfig_t *sysconfig,
|
||||
ares__buf_t *buf, const char *separators)
|
||||
static ares_status_t config_lookup(ares_sysconfig_t *sysconfig, ares_buf_t *buf,
|
||||
const char *separators)
|
||||
{
|
||||
ares_status_t status;
|
||||
char lookupstr[32];
|
||||
size_t lookupstr_cnt = 0;
|
||||
ares__llist_t *lookups = NULL;
|
||||
ares__llist_node_t *node;
|
||||
size_t separators_len = ares_strlen(separators);
|
||||
ares_status_t status;
|
||||
char lookupstr[32];
|
||||
size_t lookupstr_cnt = 0;
|
||||
char **lookups = NULL;
|
||||
size_t num = 0;
|
||||
size_t i;
|
||||
size_t separators_len = ares_strlen(separators);
|
||||
|
||||
status = ares__buf_split(buf, (const unsigned char *)separators,
|
||||
separators_len, ARES_BUF_SPLIT_TRIM, 0, &lookups);
|
||||
status =
|
||||
ares_buf_split_str(buf, (const unsigned char *)separators, separators_len,
|
||||
ARES_BUF_SPLIT_TRIM, 0, &lookups, &num);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
memset(lookupstr, 0, sizeof(lookupstr));
|
||||
for (i = 0; i < num; i++) {
|
||||
const char *value = lookups[i];
|
||||
char ch;
|
||||
|
||||
for (node = ares__llist_node_first(lookups); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
char value[128];
|
||||
char ch;
|
||||
ares__buf_t *valbuf = ares__llist_node_val(node);
|
||||
|
||||
status = buf_fetch_string(valbuf, value, sizeof(value));
|
||||
if (status != ARES_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(value, "dns") == 0 || strcasecmp(value, "bind") == 0 ||
|
||||
strcasecmp(value, "resolv") == 0 || strcasecmp(value, "resolve") == 0) {
|
||||
if (ares_strcaseeq(value, "dns") || ares_strcaseeq(value, "bind") ||
|
||||
ares_strcaseeq(value, "resolv") || ares_strcaseeq(value, "resolve")) {
|
||||
ch = 'b';
|
||||
} else if (strcasecmp(value, "files") == 0 ||
|
||||
strcasecmp(value, "file") == 0 ||
|
||||
strcasecmp(value, "local") == 0) {
|
||||
} else if (ares_strcaseeq(value, "files") ||
|
||||
ares_strcaseeq(value, "file") ||
|
||||
ares_strcaseeq(value, "local")) {
|
||||
ch = 'f';
|
||||
} else {
|
||||
continue;
|
||||
|
|
@ -364,10 +358,12 @@ static ares_status_t config_lookup(ares_sysconfig_t *sysconfig,
|
|||
}
|
||||
|
||||
if (lookupstr_cnt) {
|
||||
lookupstr[lookupstr_cnt] = 0;
|
||||
ares_free(sysconfig->lookups);
|
||||
sysconfig->lookups = ares_strdup(lookupstr);
|
||||
if (sysconfig->lookups == NULL) {
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -377,83 +373,85 @@ done:
|
|||
if (status != ARES_ENOMEM) {
|
||||
status = ARES_SUCCESS;
|
||||
}
|
||||
ares__llist_destroy(lookups);
|
||||
ares_free_array(lookups, num, ares_free);
|
||||
return status;
|
||||
}
|
||||
|
||||
static ares_status_t process_option(ares_sysconfig_t *sysconfig,
|
||||
ares__buf_t *option)
|
||||
ares_buf_t *option)
|
||||
{
|
||||
ares__llist_t *kv = NULL;
|
||||
char key[32] = "";
|
||||
char val[32] = "";
|
||||
unsigned int valint = 0;
|
||||
ares_status_t status;
|
||||
char **kv = NULL;
|
||||
size_t num = 0;
|
||||
const char *key;
|
||||
const char *val;
|
||||
unsigned int valint = 0;
|
||||
ares_status_t status;
|
||||
|
||||
/* Split on : */
|
||||
status = ares__buf_split(option, (const unsigned char *)":", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 2, &kv);
|
||||
status = ares_buf_split_str(option, (const unsigned char *)":", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 2, &kv, &num);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = buf_fetch_string(ares__llist_first_val(kv), key, sizeof(key));
|
||||
if (status != ARES_SUCCESS) {
|
||||
if (num < 1) {
|
||||
status = ARES_EBADSTR;
|
||||
goto done;
|
||||
}
|
||||
if (ares__llist_len(kv) == 2) {
|
||||
status = buf_fetch_string(ares__llist_last_val(kv), val, sizeof(val));
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
key = kv[0];
|
||||
if (num == 2) {
|
||||
val = kv[1];
|
||||
valint = (unsigned int)strtoul(val, NULL, 10);
|
||||
}
|
||||
|
||||
if (strcmp(key, "ndots") == 0) {
|
||||
if (ares_streq(key, "ndots")) {
|
||||
sysconfig->ndots = valint;
|
||||
} else if (strcmp(key, "retrans") == 0 || strcmp(key, "timeout") == 0) {
|
||||
} else if (ares_streq(key, "retrans") || ares_streq(key, "timeout")) {
|
||||
if (valint == 0) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
sysconfig->timeout_ms = valint * 1000;
|
||||
} else if (strcmp(key, "retry") == 0 || strcmp(key, "attempts") == 0) {
|
||||
} else if (ares_streq(key, "retry") || ares_streq(key, "attempts")) {
|
||||
if (valint == 0) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
sysconfig->tries = valint;
|
||||
} else if (strcmp(key, "rotate") == 0) {
|
||||
} else if (ares_streq(key, "rotate")) {
|
||||
sysconfig->rotate = ARES_TRUE;
|
||||
} else if (strcmp(key, "use-vc") == 0 || strcmp(key, "usevc") == 0) {
|
||||
} else if (ares_streq(key, "use-vc") || ares_streq(key, "usevc")) {
|
||||
sysconfig->usevc = ARES_TRUE;
|
||||
}
|
||||
|
||||
done:
|
||||
ares__llist_destroy(kv);
|
||||
ares_free_array(kv, num, ares_free);
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares__sysconfig_set_options(ares_sysconfig_t *sysconfig,
|
||||
const char *str)
|
||||
ares_status_t ares_sysconfig_set_options(ares_sysconfig_t *sysconfig,
|
||||
const char *str)
|
||||
{
|
||||
ares__buf_t *buf = NULL;
|
||||
ares__llist_t *options = NULL;
|
||||
ares_status_t status;
|
||||
ares__llist_node_t *node;
|
||||
ares_buf_t *buf = NULL;
|
||||
ares_array_t *options = NULL;
|
||||
size_t num;
|
||||
size_t i;
|
||||
ares_status_t status;
|
||||
|
||||
buf = ares__buf_create_const((const unsigned char *)str, ares_strlen(str));
|
||||
buf = ares_buf_create_const((const unsigned char *)str, ares_strlen(str));
|
||||
if (buf == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
status = ares__buf_split(buf, (const unsigned char *)" \t", 2,
|
||||
ARES_BUF_SPLIT_TRIM, 0, &options);
|
||||
status = ares_buf_split(buf, (const unsigned char *)" \t", 2,
|
||||
ARES_BUF_SPLIT_TRIM, 0, &options);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (node = ares__llist_node_first(options); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
ares__buf_t *valbuf = ares__llist_node_val(node);
|
||||
num = ares_array_len(options);
|
||||
for (i = 0; i < num; i++) {
|
||||
ares_buf_t **bufptr = ares_array_at(options, i);
|
||||
ares_buf_t *valbuf = *bufptr;
|
||||
|
||||
status = process_option(sysconfig, valbuf);
|
||||
/* Out of memory is the only fatal condition */
|
||||
|
|
@ -465,12 +463,12 @@ ares_status_t ares__sysconfig_set_options(ares_sysconfig_t *sysconfig,
|
|||
status = ARES_SUCCESS;
|
||||
|
||||
done:
|
||||
ares__llist_destroy(options);
|
||||
ares__buf_destroy(buf);
|
||||
ares_array_destroy(options);
|
||||
ares_buf_destroy(buf);
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares__init_by_environment(ares_sysconfig_t *sysconfig)
|
||||
ares_status_t ares_init_by_environment(ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
const char *localdomain;
|
||||
const char *res_options;
|
||||
|
|
@ -491,7 +489,7 @@ ares_status_t ares__init_by_environment(ares_sysconfig_t *sysconfig)
|
|||
|
||||
res_options = getenv("RES_OPTIONS");
|
||||
if (res_options) {
|
||||
status = ares__sysconfig_set_options(sysconfig, res_options);
|
||||
status = ares_sysconfig_set_options(sysconfig, res_options);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -551,70 +549,71 @@ ares_status_t ares__init_by_environment(ares_sysconfig_t *sysconfig)
|
|||
/* This function will only return ARES_SUCCESS or ARES_ENOMEM. Any other
|
||||
* conditions are ignored. Users may mess up config files, but we want to
|
||||
* process anything we can. */
|
||||
static ares_status_t parse_resolvconf_line(ares_sysconfig_t *sysconfig,
|
||||
ares__buf_t *line)
|
||||
static ares_status_t parse_resolvconf_line(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig,
|
||||
ares_buf_t *line)
|
||||
{
|
||||
char option[32];
|
||||
char value[512];
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
|
||||
/* Ignore lines beginning with a comment */
|
||||
if (ares__buf_begins_with(line, (const unsigned char *)"#", 1) ||
|
||||
ares__buf_begins_with(line, (const unsigned char *)";", 1)) {
|
||||
if (ares_buf_begins_with(line, (const unsigned char *)"#", 1) ||
|
||||
ares_buf_begins_with(line, (const unsigned char *)";", 1)) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares__buf_tag(line);
|
||||
ares_buf_tag(line);
|
||||
|
||||
/* Shouldn't be possible, but if it happens, ignore the line. */
|
||||
if (ares__buf_consume_nonwhitespace(line) == 0) {
|
||||
if (ares_buf_consume_nonwhitespace(line) == 0) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
status = ares__buf_tag_fetch_string(line, option, sizeof(option));
|
||||
status = ares_buf_tag_fetch_string(line, option, sizeof(option));
|
||||
if (status != ARES_SUCCESS) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares__buf_consume_whitespace(line, ARES_TRUE);
|
||||
ares_buf_consume_whitespace(line, ARES_TRUE);
|
||||
|
||||
status = buf_fetch_string(line, value, sizeof(value));
|
||||
if (status != ARES_SUCCESS) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares__str_trim(value);
|
||||
ares_str_trim(value);
|
||||
if (*value == 0) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
/* At this point we have a string option and a string value, both trimmed
|
||||
* of leading and trailing whitespace. Lets try to evaluate them */
|
||||
if (strcmp(option, "domain") == 0) {
|
||||
if (ares_streq(option, "domain")) {
|
||||
/* Domain is legacy, don't overwrite an existing config set by search */
|
||||
if (sysconfig->domains == NULL) {
|
||||
status = config_search(sysconfig, value, 1);
|
||||
}
|
||||
} else if (strcmp(option, "lookup") == 0 ||
|
||||
strcmp(option, "hostresorder") == 0) {
|
||||
ares__buf_tag_rollback(line);
|
||||
} else if (ares_streq(option, "lookup") ||
|
||||
ares_streq(option, "hostresorder")) {
|
||||
ares_buf_tag_rollback(line);
|
||||
status = config_lookup(sysconfig, line, " \t");
|
||||
} else if (strcmp(option, "search") == 0) {
|
||||
} else if (ares_streq(option, "search")) {
|
||||
status = config_search(sysconfig, value, 0);
|
||||
} else if (strcmp(option, "nameserver") == 0) {
|
||||
status =
|
||||
ares__sconfig_append_fromstr(&sysconfig->sconfig, value, ARES_TRUE);
|
||||
} else if (strcmp(option, "sortlist") == 0) {
|
||||
} else if (ares_streq(option, "nameserver")) {
|
||||
status = ares_sconfig_append_fromstr(channel, &sysconfig->sconfig, value,
|
||||
ARES_TRUE);
|
||||
} else if (ares_streq(option, "sortlist")) {
|
||||
/* Ignore all failures except ENOMEM. If the sysadmin set a bad
|
||||
* sortlist, just ignore the sortlist, don't cause an inoperable
|
||||
* channel */
|
||||
status =
|
||||
ares__parse_sortlist(&sysconfig->sortlist, &sysconfig->nsortlist, value);
|
||||
ares_parse_sortlist(&sysconfig->sortlist, &sysconfig->nsortlist, value);
|
||||
if (status != ARES_ENOMEM) {
|
||||
status = ARES_SUCCESS;
|
||||
}
|
||||
} else if (strcmp(option, "options") == 0) {
|
||||
status = ares__sysconfig_set_options(sysconfig, value);
|
||||
} else if (ares_streq(option, "options")) {
|
||||
status = ares_sysconfig_set_options(sysconfig, value);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
@ -623,44 +622,51 @@ static ares_status_t parse_resolvconf_line(ares_sysconfig_t *sysconfig,
|
|||
/* This function will only return ARES_SUCCESS or ARES_ENOMEM. Any other
|
||||
* conditions are ignored. Users may mess up config files, but we want to
|
||||
* process anything we can. */
|
||||
static ares_status_t parse_nsswitch_line(ares_sysconfig_t *sysconfig,
|
||||
ares__buf_t *line)
|
||||
static ares_status_t parse_nsswitch_line(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig,
|
||||
ares_buf_t *line)
|
||||
{
|
||||
char option[32];
|
||||
ares__buf_t *buf;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares__llist_t *sects = NULL;
|
||||
char option[32];
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares_array_t *sects = NULL;
|
||||
ares_buf_t **bufptr;
|
||||
ares_buf_t *buf;
|
||||
|
||||
(void)channel;
|
||||
|
||||
/* Ignore lines beginning with a comment */
|
||||
if (ares__buf_begins_with(line, (const unsigned char *)"#", 1)) {
|
||||
if (ares_buf_begins_with(line, (const unsigned char *)"#", 1)) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
/* database : values (space delimited) */
|
||||
status = ares__buf_split(line, (const unsigned char *)":", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 2, §s);
|
||||
status = ares_buf_split(line, (const unsigned char *)":", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 2, §s);
|
||||
|
||||
if (status != ARES_SUCCESS || ares__llist_len(sects) != 2) {
|
||||
if (status != ARES_SUCCESS || ares_array_len(sects) != 2) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
buf = ares__llist_first_val(sects);
|
||||
bufptr = ares_array_at(sects, 0);
|
||||
buf = *bufptr;
|
||||
|
||||
status = buf_fetch_string(buf, option, sizeof(option));
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Only support "hosts:" */
|
||||
if (strcmp(option, "hosts") != 0) {
|
||||
if (!ares_streq(option, "hosts")) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Values are space separated */
|
||||
buf = ares__llist_last_val(sects);
|
||||
bufptr = ares_array_at(sects, 1);
|
||||
buf = *bufptr;
|
||||
status = config_lookup(sysconfig, buf, " \t");
|
||||
|
||||
done:
|
||||
ares__llist_destroy(sects);
|
||||
ares_array_destroy(sects);
|
||||
if (status != ARES_ENOMEM) {
|
||||
status = ARES_SUCCESS;
|
||||
}
|
||||
|
|
@ -670,52 +676,59 @@ done:
|
|||
/* This function will only return ARES_SUCCESS or ARES_ENOMEM. Any other
|
||||
* conditions are ignored. Users may mess up config files, but we want to
|
||||
* process anything we can. */
|
||||
static ares_status_t parse_svcconf_line(ares_sysconfig_t *sysconfig,
|
||||
ares__buf_t *line)
|
||||
static ares_status_t parse_svcconf_line(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig,
|
||||
ares_buf_t *line)
|
||||
{
|
||||
char option[32];
|
||||
ares__buf_t *buf;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares__llist_t *sects = NULL;
|
||||
char option[32];
|
||||
ares_buf_t **bufptr;
|
||||
ares_buf_t *buf;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares_array_t *sects = NULL;
|
||||
|
||||
(void)channel;
|
||||
|
||||
/* Ignore lines beginning with a comment */
|
||||
if (ares__buf_begins_with(line, (const unsigned char *)"#", 1)) {
|
||||
if (ares_buf_begins_with(line, (const unsigned char *)"#", 1)) {
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
/* database = values (comma delimited)*/
|
||||
status = ares__buf_split(line, (const unsigned char *)"=", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 2, §s);
|
||||
status = ares_buf_split(line, (const unsigned char *)"=", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 2, §s);
|
||||
|
||||
if (status != ARES_SUCCESS || ares__llist_len(sects) != 2) {
|
||||
if (status != ARES_SUCCESS || ares_array_len(sects) != 2) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
buf = ares__llist_first_val(sects);
|
||||
bufptr = ares_array_at(sects, 0);
|
||||
buf = *bufptr;
|
||||
status = buf_fetch_string(buf, option, sizeof(option));
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Only support "hosts=" */
|
||||
if (strcmp(option, "hosts") != 0) {
|
||||
if (!ares_streq(option, "hosts")) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Values are comma separated */
|
||||
buf = ares__llist_last_val(sects);
|
||||
bufptr = ares_array_at(sects, 1);
|
||||
buf = *bufptr;
|
||||
status = config_lookup(sysconfig, buf, ",");
|
||||
|
||||
done:
|
||||
ares__llist_destroy(sects);
|
||||
ares_array_destroy(sects);
|
||||
if (status != ARES_ENOMEM) {
|
||||
status = ARES_SUCCESS;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
typedef ares_status_t (*line_callback_t)(ares_sysconfig_t *sysconfig,
|
||||
ares__buf_t *line);
|
||||
typedef ares_status_t (*line_callback_t)(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig,
|
||||
ares_buf_t *line);
|
||||
|
||||
/* Should only return:
|
||||
* ARES_ENOTFOUND - file not found
|
||||
|
|
@ -724,56 +737,60 @@ typedef ares_status_t (*line_callback_t)(ares_sysconfig_t *sysconfig,
|
|||
* ARES_SUCCESS - file processed, doesn't necessarily mean it was a good
|
||||
* file, but we're not erroring out if we can't parse
|
||||
* something (or anything at all) */
|
||||
static ares_status_t process_config_lines(const char *filename,
|
||||
ares_sysconfig_t *sysconfig,
|
||||
line_callback_t cb)
|
||||
static ares_status_t process_config_lines(const ares_channel_t *channel,
|
||||
const char *filename,
|
||||
ares_sysconfig_t *sysconfig,
|
||||
line_callback_t cb)
|
||||
{
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares__llist_node_t *node;
|
||||
ares__llist_t *lines = NULL;
|
||||
ares__buf_t *buf = NULL;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
ares_array_t *lines = NULL;
|
||||
ares_buf_t *buf = NULL;
|
||||
size_t num;
|
||||
size_t i;
|
||||
|
||||
buf = ares__buf_create();
|
||||
buf = ares_buf_create();
|
||||
if (buf == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ares__buf_load_file(filename, buf);
|
||||
status = ares_buf_load_file(filename, buf);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ares__buf_split(buf, (const unsigned char *)"\n", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 0, &lines);
|
||||
status = ares_buf_split(buf, (const unsigned char *)"\n", 1,
|
||||
ARES_BUF_SPLIT_TRIM, 0, &lines);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (node = ares__llist_node_first(lines); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
ares__buf_t *line = ares__llist_node_val(node);
|
||||
num = ares_array_len(lines);
|
||||
for (i = 0; i < num; i++) {
|
||||
ares_buf_t **bufptr = ares_array_at(lines, i);
|
||||
ares_buf_t *line = *bufptr;
|
||||
|
||||
status = cb(sysconfig, line);
|
||||
status = cb(channel, sysconfig, line);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
ares__buf_destroy(buf);
|
||||
ares__llist_destroy(lines);
|
||||
ares_buf_destroy(buf);
|
||||
ares_array_destroy(lines);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares__init_sysconfig_files(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
ares_status_t ares_init_sysconfig_files(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
|
||||
/* Resolv.conf */
|
||||
status = process_config_lines((channel->resolvconf_path != NULL)
|
||||
status = process_config_lines(channel,
|
||||
(channel->resolvconf_path != NULL)
|
||||
? channel->resolvconf_path
|
||||
: PATH_RESOLV_CONF,
|
||||
sysconfig, parse_resolvconf_line);
|
||||
|
|
@ -782,21 +799,22 @@ ares_status_t ares__init_sysconfig_files(const ares_channel_t *channel,
|
|||
}
|
||||
|
||||
/* Nsswitch.conf */
|
||||
status =
|
||||
process_config_lines("/etc/nsswitch.conf", sysconfig, parse_nsswitch_line);
|
||||
status = process_config_lines(channel, "/etc/nsswitch.conf", sysconfig,
|
||||
parse_nsswitch_line);
|
||||
if (status != ARES_SUCCESS && status != ARES_ENOTFOUND) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* netsvc.conf */
|
||||
status =
|
||||
process_config_lines("/etc/netsvc.conf", sysconfig, parse_svcconf_line);
|
||||
status = process_config_lines(channel, "/etc/netsvc.conf", sysconfig,
|
||||
parse_svcconf_line);
|
||||
if (status != ARES_SUCCESS && status != ARES_ENOTFOUND) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* svc.conf */
|
||||
status = process_config_lines("/etc/svc.conf", sysconfig, parse_svcconf_line);
|
||||
status = process_config_lines(channel, "/etc/svc.conf", sysconfig,
|
||||
parse_svcconf_line);
|
||||
if (status != ARES_SUCCESS && status != ARES_ENOTFOUND) {
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
32
deps/cares/src/lib/ares_sysconfig_mac.c
vendored
32
deps/cares/src/lib/ares_sysconfig_mac.c
vendored
|
|
@ -154,14 +154,15 @@ static ares_bool_t search_is_duplicate(const ares_sysconfig_t *sysconfig,
|
|||
{
|
||||
size_t i;
|
||||
for (i = 0; i < sysconfig->ndomains; i++) {
|
||||
if (strcasecmp(sysconfig->domains[i], name) == 0) {
|
||||
if (ares_strcaseeq(sysconfig->domains[i], name)) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
}
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
static ares_status_t read_resolver(const dns_resolver_t *resolver,
|
||||
static ares_status_t read_resolver(const ares_channel_t *channel,
|
||||
const dns_resolver_t *resolver,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -243,7 +244,7 @@ static ares_status_t read_resolver(const dns_resolver_t *resolver,
|
|||
# endif
|
||||
|
||||
if (resolver->options != NULL) {
|
||||
status = ares__sysconfig_set_options(sysconfig, resolver->options);
|
||||
status = ares_sysconfig_set_options(sysconfig, resolver->options);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -269,7 +270,7 @@ static ares_status_t read_resolver(const dns_resolver_t *resolver,
|
|||
unsigned short addrport;
|
||||
const struct sockaddr *sockaddr;
|
||||
char if_name_str[256] = "";
|
||||
const char *if_name;
|
||||
const char *if_name = NULL;
|
||||
|
||||
/* UBSAN alignment workaround to fetch memory address */
|
||||
memcpy(&sockaddr, resolver->nameserver + i, sizeof(sockaddr));
|
||||
|
|
@ -282,10 +283,14 @@ static ares_status_t read_resolver(const dns_resolver_t *resolver,
|
|||
addrport = port;
|
||||
}
|
||||
|
||||
if_name = ares__if_indextoname(resolver->if_index, if_name_str,
|
||||
sizeof(if_name_str));
|
||||
status = ares__sconfig_append(&sysconfig->sconfig, &addr, addrport,
|
||||
addrport, if_name);
|
||||
if (channel->sock_funcs.aif_indextoname != NULL) {
|
||||
if_name = channel->sock_funcs.aif_indextoname(
|
||||
resolver->if_index, if_name_str, sizeof(if_name_str),
|
||||
channel->sock_func_cb_data);
|
||||
}
|
||||
|
||||
status = ares_sconfig_append(channel, &sysconfig->sconfig, &addr, addrport,
|
||||
addrport, if_name);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -294,7 +299,8 @@ static ares_status_t read_resolver(const dns_resolver_t *resolver,
|
|||
return status;
|
||||
}
|
||||
|
||||
static ares_status_t read_resolvers(dns_resolver_t **resolvers, int nresolvers,
|
||||
static ares_status_t read_resolvers(const ares_channel_t *channel,
|
||||
dns_resolver_t **resolvers, int nresolvers,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
|
|
@ -309,13 +315,14 @@ static ares_status_t read_resolvers(dns_resolver_t **resolvers, int nresolvers,
|
|||
*/
|
||||
memcpy(&resolver_ptr, resolvers + i, sizeof(resolver_ptr));
|
||||
|
||||
status = read_resolver(resolver_ptr, sysconfig);
|
||||
status = read_resolver(channel, resolver_ptr, sysconfig);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares__init_sysconfig_macos(ares_sysconfig_t *sysconfig)
|
||||
ares_status_t ares_init_sysconfig_macos(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
dnsinfo_t *dnsinfo = NULL;
|
||||
dns_config_t *sc_dns = NULL;
|
||||
|
|
@ -343,7 +350,8 @@ ares_status_t ares__init_sysconfig_macos(ares_sysconfig_t *sysconfig)
|
|||
* Likely this wasn't available via `/etc/resolv.conf` nor `libresolv` anyhow
|
||||
* so its not worse to prior configuration methods, worst case. */
|
||||
|
||||
status = read_resolvers(sc_dns->resolver, sc_dns->n_resolver, sysconfig);
|
||||
status =
|
||||
read_resolvers(channel, sc_dns->resolver, sc_dns->n_resolver, sysconfig);
|
||||
|
||||
done:
|
||||
if (dnsinfo) {
|
||||
|
|
|
|||
15
deps/cares/src/lib/ares_sysconfig_win.c
vendored
15
deps/cares/src/lib/ares_sysconfig_win.c
vendored
|
|
@ -53,7 +53,6 @@
|
|||
#endif
|
||||
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
|
||||
#if defined(USE_WINSOCK)
|
||||
/*
|
||||
|
|
@ -420,7 +419,7 @@ static ares_bool_t get_DNS_Windows(char **outptr)
|
|||
memset(&addr, 0, sizeof(addr));
|
||||
addr.family = AF_INET6;
|
||||
memcpy(&addr.addr.addr6, &namesrvr.sa6->sin6_addr, 16);
|
||||
if (ares__addr_is_linklocal(&addr)) {
|
||||
if (ares_addr_is_linklocal(&addr)) {
|
||||
ll_scope = ipaaEntry->Ipv6IfIndex;
|
||||
}
|
||||
|
||||
|
|
@ -514,10 +513,6 @@ static ares_bool_t get_SuffixList_Windows(char **outptr)
|
|||
|
||||
*outptr = NULL;
|
||||
|
||||
if (ares__getplatform() != WIN_NT) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
/* 1. Global DNS Suffix Search List */
|
||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hKey) ==
|
||||
ERROR_SUCCESS) {
|
||||
|
|
@ -589,13 +584,15 @@ static ares_bool_t get_SuffixList_Windows(char **outptr)
|
|||
return *outptr != NULL ? ARES_TRUE : ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_status_t ares__init_sysconfig_windows(ares_sysconfig_t *sysconfig)
|
||||
ares_status_t ares_init_sysconfig_windows(const ares_channel_t *channel,
|
||||
ares_sysconfig_t *sysconfig)
|
||||
{
|
||||
char *line = NULL;
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
|
||||
if (get_DNS_Windows(&line)) {
|
||||
status = ares__sconfig_append_fromstr(&sysconfig->sconfig, line, ARES_TRUE);
|
||||
status = ares_sconfig_append_fromstr(channel, &sysconfig->sconfig, line,
|
||||
ARES_TRUE);
|
||||
ares_free(line);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
|
|
@ -603,7 +600,7 @@ ares_status_t ares__init_sysconfig_windows(ares_sysconfig_t *sysconfig)
|
|||
}
|
||||
|
||||
if (get_SuffixList_Windows(&line)) {
|
||||
sysconfig->domains = ares__strsplit(line, ", ", &sysconfig->ndomains);
|
||||
sysconfig->domains = ares_strsplit(line, ", ", &sysconfig->ndomains);
|
||||
ares_free(line);
|
||||
if (sysconfig->domains == NULL) {
|
||||
status = ARES_EFILE;
|
||||
|
|
|
|||
24
deps/cares/src/lib/ares_timeout.c
vendored
24
deps/cares/src/lib/ares_timeout.c
vendored
|
|
@ -32,9 +32,9 @@
|
|||
#endif
|
||||
|
||||
|
||||
void ares__timeval_remaining(ares_timeval_t *remaining,
|
||||
const ares_timeval_t *now,
|
||||
const ares_timeval_t *tout)
|
||||
void ares_timeval_remaining(ares_timeval_t *remaining,
|
||||
const ares_timeval_t *now,
|
||||
const ares_timeval_t *tout)
|
||||
{
|
||||
memset(remaining, 0, sizeof(*remaining));
|
||||
|
||||
|
|
@ -53,8 +53,8 @@ void ares__timeval_remaining(ares_timeval_t *remaining,
|
|||
}
|
||||
}
|
||||
|
||||
void ares__timeval_diff(ares_timeval_t *tvdiff, const ares_timeval_t *tvstart,
|
||||
const ares_timeval_t *tvstop)
|
||||
void ares_timeval_diff(ares_timeval_t *tvdiff, const ares_timeval_t *tvstart,
|
||||
const ares_timeval_t *tvstop)
|
||||
{
|
||||
tvdiff->sec = tvstop->sec - tvstart->sec;
|
||||
if (tvstop->usec > tvstart->usec) {
|
||||
|
|
@ -89,24 +89,24 @@ static struct timeval *ares_timeout_int(const ares_channel_t *channel,
|
|||
struct timeval *tvbuf)
|
||||
{
|
||||
const ares_query_t *query;
|
||||
ares__slist_node_t *node;
|
||||
ares_slist_node_t *node;
|
||||
ares_timeval_t now;
|
||||
ares_timeval_t atvbuf;
|
||||
ares_timeval_t amaxtv;
|
||||
|
||||
/* The minimum timeout of all queries is always the first entry in
|
||||
* channel->queries_by_timeout */
|
||||
node = ares__slist_node_first(channel->queries_by_timeout);
|
||||
node = ares_slist_node_first(channel->queries_by_timeout);
|
||||
/* no queries/timeout */
|
||||
if (node == NULL) {
|
||||
return maxtv;
|
||||
}
|
||||
|
||||
query = ares__slist_node_val(node);
|
||||
query = ares_slist_node_val(node);
|
||||
|
||||
ares__tvnow(&now);
|
||||
ares_tvnow(&now);
|
||||
|
||||
ares__timeval_remaining(&atvbuf, &now, &query->timeout);
|
||||
ares_timeval_remaining(&atvbuf, &now, &query->timeout);
|
||||
|
||||
ares_timeval_to_struct_timeval(tvbuf, &atvbuf);
|
||||
|
||||
|
|
@ -141,11 +141,11 @@ struct timeval *ares_timeout(const ares_channel_t *channel,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ares__channel_lock(channel);
|
||||
ares_channel_lock(channel);
|
||||
|
||||
rv = ares_timeout_int(channel, maxtv, tvbuf);
|
||||
|
||||
ares__channel_unlock(channel);
|
||||
ares_channel_unlock(channel);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
593
deps/cares/src/lib/ares_update_servers.c
vendored
593
deps/cares/src/lib/ares_update_servers.c
vendored
File diff suppressed because it is too large
Load Diff
1
deps/cares/src/lib/config-dos.h
vendored
1
deps/cares/src/lib/config-dos.h
vendored
|
|
@ -21,6 +21,7 @@
|
|||
#define HAVE_RECV 1
|
||||
#define HAVE_RECVFROM 1
|
||||
#define HAVE_SEND 1
|
||||
#define HAVE_SENDTO 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRICMP 1
|
||||
#define HAVE_STRUCT_IN6_ADDR 1
|
||||
|
|
|
|||
3
deps/cares/src/lib/config-win32.h
vendored
3
deps/cares/src/lib/config-win32.h
vendored
|
|
@ -187,6 +187,9 @@
|
|||
/* Define if you have the send function. */
|
||||
#define HAVE_SEND 1
|
||||
|
||||
/* Define if you have the sendto function. */
|
||||
#define HAVE_SENDTO 1
|
||||
|
||||
/* Define to the type of arg 1 for send. */
|
||||
#define SEND_TYPE_ARG1 SOCKET
|
||||
|
||||
|
|
|
|||
|
|
@ -24,23 +24,23 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares__array.h"
|
||||
#include "ares_array.h"
|
||||
|
||||
#define ARES__ARRAY_MIN 4
|
||||
|
||||
struct ares__array {
|
||||
ares__array_destructor_t destruct;
|
||||
void *arr;
|
||||
size_t member_size;
|
||||
size_t cnt;
|
||||
size_t offset;
|
||||
size_t alloc_cnt;
|
||||
struct ares_array {
|
||||
ares_array_destructor_t destruct;
|
||||
void *arr;
|
||||
size_t member_size;
|
||||
size_t cnt;
|
||||
size_t offset;
|
||||
size_t alloc_cnt;
|
||||
};
|
||||
|
||||
ares__array_t *ares__array_create(size_t member_size,
|
||||
ares__array_destructor_t destruct)
|
||||
ares_array_t *ares_array_create(size_t member_size,
|
||||
ares_array_destructor_t destruct)
|
||||
{
|
||||
ares__array_t *arr;
|
||||
ares_array_t *arr;
|
||||
|
||||
if (member_size == 0) {
|
||||
return NULL;
|
||||
|
|
@ -56,7 +56,7 @@ ares__array_t *ares__array_create(size_t member_size,
|
|||
return arr;
|
||||
}
|
||||
|
||||
size_t ares__array_len(const ares__array_t *arr)
|
||||
size_t ares_array_len(const ares_array_t *arr)
|
||||
{
|
||||
if (arr == NULL) {
|
||||
return 0;
|
||||
|
|
@ -64,7 +64,7 @@ size_t ares__array_len(const ares__array_t *arr)
|
|||
return arr->cnt;
|
||||
}
|
||||
|
||||
void *ares__array_at(ares__array_t *arr, size_t idx)
|
||||
void *ares_array_at(ares_array_t *arr, size_t idx)
|
||||
{
|
||||
if (arr == NULL || idx >= arr->cnt) {
|
||||
return NULL;
|
||||
|
|
@ -72,7 +72,7 @@ void *ares__array_at(ares__array_t *arr, size_t idx)
|
|||
return (unsigned char *)arr->arr + ((idx + arr->offset) * arr->member_size);
|
||||
}
|
||||
|
||||
const void *ares__array_at_const(const ares__array_t *arr, size_t idx)
|
||||
const void *ares_array_at_const(const ares_array_t *arr, size_t idx)
|
||||
{
|
||||
if (arr == NULL || idx >= arr->cnt) {
|
||||
return NULL;
|
||||
|
|
@ -80,7 +80,7 @@ const void *ares__array_at_const(const ares__array_t *arr, size_t idx)
|
|||
return (unsigned char *)arr->arr + ((idx + arr->offset) * arr->member_size);
|
||||
}
|
||||
|
||||
ares_status_t ares__array_sort(ares__array_t *arr, ares__array_cmp_t cmp)
|
||||
ares_status_t ares_array_sort(ares_array_t *arr, ares_array_cmp_t cmp)
|
||||
{
|
||||
if (arr == NULL || cmp == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
|
|
@ -96,7 +96,7 @@ ares_status_t ares__array_sort(ares__array_t *arr, ares__array_cmp_t cmp)
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
void ares__array_destroy(ares__array_t *arr)
|
||||
void ares_array_destroy(ares_array_t *arr)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ void ares__array_destroy(ares__array_t *arr)
|
|||
|
||||
if (arr->destruct != NULL) {
|
||||
for (i = 0; i < arr->cnt; i++) {
|
||||
arr->destruct(ares__array_at(arr, i));
|
||||
arr->destruct(ares_array_at(arr, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -116,8 +116,8 @@ void ares__array_destroy(ares__array_t *arr)
|
|||
|
||||
/* NOTE: this function operates on actual indexes, NOT indexes using the
|
||||
* arr->offset */
|
||||
static ares_status_t ares__array_move(ares__array_t *arr, size_t dest_idx,
|
||||
size_t src_idx)
|
||||
static ares_status_t ares_array_move(ares_array_t *arr, size_t dest_idx,
|
||||
size_t src_idx)
|
||||
{
|
||||
void *dest_ptr;
|
||||
const void *src_ptr;
|
||||
|
|
@ -140,18 +140,14 @@ static ares_status_t ares__array_move(ares__array_t *arr, size_t dest_idx,
|
|||
if (dest_idx > src_idx && arr->cnt + (dest_idx - src_idx) > arr->alloc_cnt) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
if (dest_idx < src_idx) {
|
||||
nmembers = arr->cnt - dest_idx;
|
||||
} else {
|
||||
nmembers = arr->cnt - src_idx;
|
||||
}
|
||||
|
||||
nmembers = arr->cnt - (src_idx - arr->offset);
|
||||
memmove(dest_ptr, src_ptr, nmembers * arr->member_size);
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
void *ares__array_finish(ares__array_t *arr, size_t *num_members)
|
||||
void *ares_array_finish(ares_array_t *arr, size_t *num_members)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
|
|
@ -161,7 +157,7 @@ void *ares__array_finish(ares__array_t *arr, size_t *num_members)
|
|||
|
||||
/* Make sure we move data to beginning of allocation */
|
||||
if (arr->offset != 0) {
|
||||
if (ares__array_move(arr, 0, arr->offset) != ARES_SUCCESS) {
|
||||
if (ares_array_move(arr, 0, arr->offset) != ARES_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
arr->offset = 0;
|
||||
|
|
@ -173,7 +169,7 @@ void *ares__array_finish(ares__array_t *arr, size_t *num_members)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
ares_status_t ares__array_set_size(ares__array_t *arr, size_t size)
|
||||
ares_status_t ares_array_set_size(ares_array_t *arr, size_t size)
|
||||
{
|
||||
void *temp;
|
||||
|
||||
|
|
@ -182,7 +178,7 @@ ares_status_t ares__array_set_size(ares__array_t *arr, size_t size)
|
|||
}
|
||||
|
||||
/* Always operate on powers of 2 */
|
||||
size = ares__round_up_pow2(size);
|
||||
size = ares_round_up_pow2(size);
|
||||
|
||||
if (size < ARES__ARRAY_MIN) {
|
||||
size = ARES__ARRAY_MIN;
|
||||
|
|
@ -203,8 +199,8 @@ ares_status_t ares__array_set_size(ares__array_t *arr, size_t size)
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__array_insert_at(void **elem_ptr, ares__array_t *arr,
|
||||
size_t idx)
|
||||
ares_status_t ares_array_insert_at(void **elem_ptr, ares_array_t *arr,
|
||||
size_t idx)
|
||||
{
|
||||
void *ptr;
|
||||
ares_status_t status;
|
||||
|
|
@ -219,14 +215,14 @@ ares_status_t ares__array_insert_at(void **elem_ptr, ares__array_t *arr,
|
|||
}
|
||||
|
||||
/* Allocate more if needed */
|
||||
status = ares__array_set_size(arr, arr->cnt + 1);
|
||||
status = ares_array_set_size(arr, arr->cnt + 1);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Shift if we have memory but not enough room at the end */
|
||||
if (arr->cnt + 1 + arr->offset > arr->alloc_cnt) {
|
||||
status = ares__array_move(arr, 0, arr->offset);
|
||||
status = ares_array_move(arr, 0, arr->offset);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -236,7 +232,7 @@ ares_status_t ares__array_insert_at(void **elem_ptr, ares__array_t *arr,
|
|||
/* If we're inserting anywhere other than the end, we need to move some
|
||||
* elements out of the way */
|
||||
if (idx != arr->cnt) {
|
||||
status = ares__array_move(arr, idx + arr->offset + 1, idx + arr->offset);
|
||||
status = ares_array_move(arr, idx + arr->offset + 1, idx + arr->offset);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -255,46 +251,88 @@ ares_status_t ares__array_insert_at(void **elem_ptr, ares__array_t *arr,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__array_insert_last(void **elem_ptr, ares__array_t *arr)
|
||||
ares_status_t ares_array_insert_last(void **elem_ptr, ares_array_t *arr)
|
||||
{
|
||||
return ares__array_insert_at(elem_ptr, arr, ares__array_len(arr));
|
||||
return ares_array_insert_at(elem_ptr, arr, ares_array_len(arr));
|
||||
}
|
||||
|
||||
ares_status_t ares__array_insert_first(void **elem_ptr, ares__array_t *arr)
|
||||
ares_status_t ares_array_insert_first(void **elem_ptr, ares_array_t *arr)
|
||||
{
|
||||
return ares__array_insert_at(elem_ptr, arr, 0);
|
||||
return ares_array_insert_at(elem_ptr, arr, 0);
|
||||
}
|
||||
|
||||
void *ares__array_first(ares__array_t *arr)
|
||||
ares_status_t ares_array_insertdata_at(ares_array_t *arr, size_t idx,
|
||||
const void *data_ptr)
|
||||
{
|
||||
return ares__array_at(arr, 0);
|
||||
ares_status_t status;
|
||||
void *ptr = NULL;
|
||||
|
||||
status = ares_array_insert_at(&ptr, arr, idx);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
memcpy(ptr, data_ptr, arr->member_size);
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
void *ares__array_last(ares__array_t *arr)
|
||||
ares_status_t ares_array_insertdata_last(ares_array_t *arr,
|
||||
const void *data_ptr)
|
||||
{
|
||||
size_t cnt = ares__array_len(arr);
|
||||
ares_status_t status;
|
||||
void *ptr = NULL;
|
||||
|
||||
status = ares_array_insert_last(&ptr, arr);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
memcpy(ptr, data_ptr, arr->member_size);
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares_array_insertdata_first(ares_array_t *arr,
|
||||
const void *data_ptr)
|
||||
{
|
||||
ares_status_t status;
|
||||
void *ptr = NULL;
|
||||
|
||||
status = ares_array_insert_last(&ptr, arr);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
memcpy(ptr, data_ptr, arr->member_size);
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
void *ares_array_first(ares_array_t *arr)
|
||||
{
|
||||
return ares_array_at(arr, 0);
|
||||
}
|
||||
|
||||
void *ares_array_last(ares_array_t *arr)
|
||||
{
|
||||
size_t cnt = ares_array_len(arr);
|
||||
if (cnt == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return ares__array_at(arr, cnt - 1);
|
||||
return ares_array_at(arr, cnt - 1);
|
||||
}
|
||||
|
||||
const void *ares__array_first_const(const ares__array_t *arr)
|
||||
const void *ares_array_first_const(const ares_array_t *arr)
|
||||
{
|
||||
return ares__array_at_const(arr, 0);
|
||||
return ares_array_at_const(arr, 0);
|
||||
}
|
||||
|
||||
const void *ares__array_last_const(const ares__array_t *arr)
|
||||
const void *ares_array_last_const(const ares_array_t *arr)
|
||||
{
|
||||
size_t cnt = ares__array_len(arr);
|
||||
size_t cnt = ares_array_len(arr);
|
||||
if (cnt == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return ares__array_at_const(arr, cnt - 1);
|
||||
return ares_array_at_const(arr, cnt - 1);
|
||||
}
|
||||
|
||||
ares_status_t ares__array_claim_at(void *dest, size_t dest_size,
|
||||
ares__array_t *arr, size_t idx)
|
||||
ares_status_t ares_array_claim_at(void *dest, size_t dest_size,
|
||||
ares_array_t *arr, size_t idx)
|
||||
{
|
||||
ares_status_t status;
|
||||
|
||||
|
|
@ -307,7 +345,7 @@ ares_status_t ares__array_claim_at(void *dest, size_t dest_size,
|
|||
}
|
||||
|
||||
if (dest) {
|
||||
memcpy(dest, ares__array_at(arr, idx), arr->member_size);
|
||||
memcpy(dest, ares_array_at(arr, idx), arr->member_size);
|
||||
}
|
||||
|
||||
if (idx == 0) {
|
||||
|
|
@ -317,7 +355,7 @@ ares_status_t ares__array_claim_at(void *dest, size_t dest_size,
|
|||
} else if (idx != arr->cnt - 1) {
|
||||
/* Must shift entire array if removing an element from the middle. Does
|
||||
* nothing if removing last element other than decrement count. */
|
||||
status = ares__array_move(arr, idx + arr->offset, idx + arr->offset + 1);
|
||||
status = ares_array_move(arr, idx + arr->offset, idx + arr->offset + 1);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -327,9 +365,9 @@ ares_status_t ares__array_claim_at(void *dest, size_t dest_size,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__array_remove_at(ares__array_t *arr, size_t idx)
|
||||
ares_status_t ares_array_remove_at(ares_array_t *arr, size_t idx)
|
||||
{
|
||||
void *ptr = ares__array_at(arr, idx);
|
||||
void *ptr = ares_array_at(arr, idx);
|
||||
if (arr == NULL || ptr == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
|
@ -338,19 +376,19 @@ ares_status_t ares__array_remove_at(ares__array_t *arr, size_t idx)
|
|||
arr->destruct(ptr);
|
||||
}
|
||||
|
||||
return ares__array_claim_at(NULL, 0, arr, idx);
|
||||
return ares_array_claim_at(NULL, 0, arr, idx);
|
||||
}
|
||||
|
||||
ares_status_t ares__array_remove_first(ares__array_t *arr)
|
||||
ares_status_t ares_array_remove_first(ares_array_t *arr)
|
||||
{
|
||||
return ares__array_remove_at(arr, 0);
|
||||
return ares_array_remove_at(arr, 0);
|
||||
}
|
||||
|
||||
ares_status_t ares__array_remove_last(ares__array_t *arr)
|
||||
ares_status_t ares_array_remove_last(ares_array_t *arr)
|
||||
{
|
||||
size_t cnt = ares__array_len(arr);
|
||||
size_t cnt = ares_array_len(arr);
|
||||
if (cnt == 0) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
return ares__array_remove_at(arr, cnt - 1);
|
||||
return ares_array_remove_at(arr, cnt - 1);
|
||||
}
|
||||
|
|
@ -24,33 +24,37 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares__llist.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares_llist.h"
|
||||
#include "ares_htable.h"
|
||||
|
||||
#define ARES__HTABLE_MAX_BUCKETS (1U << 24)
|
||||
#define ARES__HTABLE_MIN_BUCKETS (1U << 4)
|
||||
#define ARES__HTABLE_EXPAND_PERCENT 75
|
||||
|
||||
struct ares__htable {
|
||||
ares__htable_hashfunc_t hash;
|
||||
ares__htable_bucket_key_t bucket_key;
|
||||
ares__htable_bucket_free_t bucket_free;
|
||||
ares__htable_key_eq_t key_eq;
|
||||
unsigned int seed;
|
||||
unsigned int size;
|
||||
size_t num_keys;
|
||||
size_t num_collisions;
|
||||
/* NOTE: if we converted buckets into ares__slist_t we could guarantee on
|
||||
struct ares_htable {
|
||||
ares_htable_hashfunc_t hash;
|
||||
ares_htable_bucket_key_t bucket_key;
|
||||
ares_htable_bucket_free_t bucket_free;
|
||||
ares_htable_key_eq_t key_eq;
|
||||
unsigned int seed;
|
||||
unsigned int size;
|
||||
size_t num_keys;
|
||||
size_t num_collisions;
|
||||
/* NOTE: if we converted buckets into ares_slist_t we could guarantee on
|
||||
* hash collisions we would have O(log n) worst case insert and search
|
||||
* performance. (We'd also need to make key_eq into a key_cmp to
|
||||
* support sort). That said, risk with a random hash seed is near zero,
|
||||
* and ares__slist_t is heavier weight, so I think using ares__llist_t
|
||||
* and ares_slist_t is heavier weight, so I think using ares_llist_t
|
||||
* is an overall win. */
|
||||
ares__llist_t **buckets;
|
||||
ares_llist_t **buckets;
|
||||
};
|
||||
|
||||
static unsigned int ares__htable_generate_seed(ares__htable_t *htable)
|
||||
static unsigned int ares_htable_generate_seed(ares_htable_t *htable)
|
||||
{
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
/* Seed needs to be static for fuzzing */
|
||||
return 0;
|
||||
#else
|
||||
unsigned int seed = 0;
|
||||
time_t t = time(NULL);
|
||||
|
||||
|
|
@ -61,11 +65,12 @@ static unsigned int ares__htable_generate_seed(ares__htable_t *htable)
|
|||
seed |= (unsigned int)((size_t)&seed & 0xFFFFFFFF);
|
||||
seed |= (unsigned int)(((ares_uint64_t)t) & 0xFFFFFFFF);
|
||||
return seed;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ares__htable_buckets_destroy(ares__llist_t **buckets,
|
||||
unsigned int size,
|
||||
ares_bool_t destroy_vals)
|
||||
static void ares_htable_buckets_destroy(ares_llist_t **buckets,
|
||||
unsigned int size,
|
||||
ares_bool_t destroy_vals)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -79,30 +84,30 @@ static void ares__htable_buckets_destroy(ares__llist_t **buckets,
|
|||
}
|
||||
|
||||
if (!destroy_vals) {
|
||||
ares__llist_replace_destructor(buckets[i], NULL);
|
||||
ares_llist_replace_destructor(buckets[i], NULL);
|
||||
}
|
||||
|
||||
ares__llist_destroy(buckets[i]);
|
||||
ares_llist_destroy(buckets[i]);
|
||||
}
|
||||
|
||||
ares_free(buckets);
|
||||
}
|
||||
|
||||
void ares__htable_destroy(ares__htable_t *htable)
|
||||
void ares_htable_destroy(ares_htable_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__htable_buckets_destroy(htable->buckets, htable->size, ARES_TRUE);
|
||||
ares_htable_buckets_destroy(htable->buckets, htable->size, ARES_TRUE);
|
||||
ares_free(htable);
|
||||
}
|
||||
|
||||
ares__htable_t *ares__htable_create(ares__htable_hashfunc_t hash_func,
|
||||
ares__htable_bucket_key_t bucket_key,
|
||||
ares__htable_bucket_free_t bucket_free,
|
||||
ares__htable_key_eq_t key_eq)
|
||||
ares_htable_t *ares_htable_create(ares_htable_hashfunc_t hash_func,
|
||||
ares_htable_bucket_key_t bucket_key,
|
||||
ares_htable_bucket_free_t bucket_free,
|
||||
ares_htable_key_eq_t key_eq)
|
||||
{
|
||||
ares__htable_t *htable = NULL;
|
||||
ares_htable_t *htable = NULL;
|
||||
|
||||
if (hash_func == NULL || bucket_key == NULL || bucket_free == NULL ||
|
||||
key_eq == NULL) {
|
||||
|
|
@ -118,7 +123,7 @@ ares__htable_t *ares__htable_create(ares__htable_hashfunc_t hash_func,
|
|||
htable->bucket_key = bucket_key;
|
||||
htable->bucket_free = bucket_free;
|
||||
htable->key_eq = key_eq;
|
||||
htable->seed = ares__htable_generate_seed(htable);
|
||||
htable->seed = ares_htable_generate_seed(htable);
|
||||
htable->size = ARES__HTABLE_MIN_BUCKETS;
|
||||
htable->buckets = ares_malloc_zero(sizeof(*htable->buckets) * htable->size);
|
||||
|
||||
|
|
@ -129,11 +134,11 @@ ares__htable_t *ares__htable_create(ares__htable_hashfunc_t hash_func,
|
|||
return htable;
|
||||
|
||||
fail:
|
||||
ares__htable_destroy(htable);
|
||||
ares_htable_destroy(htable);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const void **ares__htable_all_buckets(const ares__htable_t *htable, size_t *num)
|
||||
const void **ares_htable_all_buckets(const ares_htable_t *htable, size_t *num)
|
||||
{
|
||||
const void **out = NULL;
|
||||
size_t cnt = 0;
|
||||
|
|
@ -151,10 +156,10 @@ const void **ares__htable_all_buckets(const ares__htable_t *htable, size_t *num)
|
|||
}
|
||||
|
||||
for (i = 0; i < htable->size; i++) {
|
||||
ares__llist_node_t *node;
|
||||
for (node = ares__llist_node_first(htable->buckets[i]); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
out[cnt++] = ares__llist_node_val(node);
|
||||
ares_llist_node_t *node;
|
||||
for (node = ares_llist_node_first(htable->buckets[i]); node != NULL;
|
||||
node = ares_llist_node_next(node)) {
|
||||
out[cnt++] = ares_llist_node_val(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,14 +174,14 @@ const void **ares__htable_all_buckets(const ares__htable_t *htable, size_t *num)
|
|||
* efficient */
|
||||
#define HASH_IDX(h, key) h->hash(key, h->seed) & (h->size - 1)
|
||||
|
||||
static ares__llist_node_t *ares__htable_find(const ares__htable_t *htable,
|
||||
unsigned int idx, const void *key)
|
||||
static ares_llist_node_t *ares_htable_find(const ares_htable_t *htable,
|
||||
unsigned int idx, const void *key)
|
||||
{
|
||||
ares__llist_node_t *node = NULL;
|
||||
ares_llist_node_t *node = NULL;
|
||||
|
||||
for (node = ares__llist_node_first(htable->buckets[idx]); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
if (htable->key_eq(key, htable->bucket_key(ares__llist_node_val(node)))) {
|
||||
for (node = ares_llist_node_first(htable->buckets[idx]); node != NULL;
|
||||
node = ares_llist_node_next(node)) {
|
||||
if (htable->key_eq(key, htable->bucket_key(ares_llist_node_val(node)))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -184,14 +189,14 @@ static ares__llist_node_t *ares__htable_find(const ares__htable_t *htable,
|
|||
return node;
|
||||
}
|
||||
|
||||
static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
||||
static ares_bool_t ares_htable_expand(ares_htable_t *htable)
|
||||
{
|
||||
ares__llist_t **buckets = NULL;
|
||||
unsigned int old_size = htable->size;
|
||||
size_t i;
|
||||
ares__llist_t **prealloc_llist = NULL;
|
||||
size_t prealloc_llist_len = 0;
|
||||
ares_bool_t rv = ARES_FALSE;
|
||||
ares_llist_t **buckets = NULL;
|
||||
unsigned int old_size = htable->size;
|
||||
size_t i;
|
||||
ares_llist_t **prealloc_llist = NULL;
|
||||
size_t prealloc_llist_len = 0;
|
||||
ares_bool_t rv = ARES_FALSE;
|
||||
|
||||
/* Not a failure, just won't expand */
|
||||
if (old_size == ARES__HTABLE_MAX_BUCKETS) {
|
||||
|
|
@ -219,7 +224,7 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
|||
}
|
||||
}
|
||||
for (i = 0; i < prealloc_llist_len; i++) {
|
||||
prealloc_llist[i] = ares__llist_create(htable->bucket_free);
|
||||
prealloc_llist[i] = ares_llist_create(htable->bucket_free);
|
||||
if (prealloc_llist[i] == NULL) {
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -228,7 +233,7 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
|||
/* Iterate across all buckets and move the entries to the new buckets */
|
||||
htable->num_collisions = 0;
|
||||
for (i = 0; i < old_size; i++) {
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
/* Nothing in this bucket */
|
||||
if (htable->buckets[i] == NULL) {
|
||||
|
|
@ -238,8 +243,8 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
|||
/* Fast path optimization (most likely case), there is likely only a single
|
||||
* entry in both the source and destination, check for this to confirm and
|
||||
* if so, just move the bucket over */
|
||||
if (ares__llist_len(htable->buckets[i]) == 1) {
|
||||
const void *val = ares__llist_first_val(htable->buckets[i]);
|
||||
if (ares_llist_len(htable->buckets[i]) == 1) {
|
||||
const void *val = ares_llist_first_val(htable->buckets[i]);
|
||||
size_t idx = HASH_IDX(htable, htable->bucket_key(val));
|
||||
|
||||
if (buckets[idx] == NULL) {
|
||||
|
|
@ -251,13 +256,13 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
|||
}
|
||||
|
||||
/* Slow path, collisions */
|
||||
while ((node = ares__llist_node_first(htable->buckets[i])) != NULL) {
|
||||
const void *val = ares__llist_node_val(node);
|
||||
while ((node = ares_llist_node_first(htable->buckets[i])) != NULL) {
|
||||
const void *val = ares_llist_node_val(node);
|
||||
size_t idx = HASH_IDX(htable, htable->bucket_key(val));
|
||||
|
||||
/* Try fast path again as maybe we popped one collision off and the
|
||||
* next we can reuse the llist parent */
|
||||
if (buckets[idx] == NULL && ares__llist_len(htable->buckets[i]) == 1) {
|
||||
if (buckets[idx] == NULL && ares_llist_len(htable->buckets[i]) == 1) {
|
||||
/* Swap! */
|
||||
buckets[idx] = htable->buckets[i];
|
||||
htable->buckets[i] = NULL;
|
||||
|
|
@ -277,12 +282,12 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
|||
htable->num_collisions++;
|
||||
}
|
||||
|
||||
ares__llist_node_move_parent_first(node, buckets[idx]);
|
||||
ares_llist_node_mvparent_first(node, buckets[idx]);
|
||||
}
|
||||
|
||||
/* Abandoned bucket, destroy */
|
||||
if (htable->buckets[i] != NULL) {
|
||||
ares__llist_destroy(htable->buckets[i]);
|
||||
ares_llist_destroy(htable->buckets[i]);
|
||||
htable->buckets[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -297,8 +302,8 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
|||
done:
|
||||
ares_free(buckets);
|
||||
/* destroy any unused preallocated buckets */
|
||||
ares__htable_buckets_destroy(prealloc_llist, (unsigned int)prealloc_llist_len,
|
||||
ARES_FALSE);
|
||||
ares_htable_buckets_destroy(prealloc_llist, (unsigned int)prealloc_llist_len,
|
||||
ARES_FALSE);
|
||||
|
||||
/* On failure, we need to restore the htable size */
|
||||
if (rv != ARES_TRUE) {
|
||||
|
|
@ -308,11 +313,11 @@ done:
|
|||
return rv;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket)
|
||||
ares_bool_t ares_htable_insert(ares_htable_t *htable, void *bucket)
|
||||
{
|
||||
unsigned int idx = 0;
|
||||
ares__llist_node_t *node = NULL;
|
||||
const void *key = NULL;
|
||||
unsigned int idx = 0;
|
||||
ares_llist_node_t *node = NULL;
|
||||
const void *key = NULL;
|
||||
|
||||
if (htable == NULL || bucket == NULL) {
|
||||
return ARES_FALSE;
|
||||
|
|
@ -323,9 +328,9 @@ ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket)
|
|||
idx = HASH_IDX(htable, key);
|
||||
|
||||
/* See if we have a matching bucket already, if so, replace it */
|
||||
node = ares__htable_find(htable, idx, key);
|
||||
node = ares_htable_find(htable, idx, key);
|
||||
if (node != NULL) {
|
||||
ares__llist_node_replace(node, bucket);
|
||||
ares_llist_node_replace(node, bucket);
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +338,7 @@ ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket)
|
|||
* increased beyond our threshold */
|
||||
if (htable->num_keys + 1 >
|
||||
(htable->size * ARES__HTABLE_EXPAND_PERCENT) / 100) {
|
||||
if (!ares__htable_expand(htable)) {
|
||||
if (!ares_htable_expand(htable)) {
|
||||
return ARES_FALSE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
/* If we expanded, need to calculate a new index */
|
||||
|
|
@ -342,19 +347,19 @@ ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket)
|
|||
|
||||
/* We lazily allocate the linked list */
|
||||
if (htable->buckets[idx] == NULL) {
|
||||
htable->buckets[idx] = ares__llist_create(htable->bucket_free);
|
||||
htable->buckets[idx] = ares_llist_create(htable->bucket_free);
|
||||
if (htable->buckets[idx] == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
node = ares__llist_insert_first(htable->buckets[idx], bucket);
|
||||
node = ares_llist_insert_first(htable->buckets[idx], bucket);
|
||||
if (node == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
/* Track collisions for rehash stability */
|
||||
if (ares__llist_len(htable->buckets[idx]) > 1) {
|
||||
if (ares_llist_len(htable->buckets[idx]) > 1) {
|
||||
htable->num_collisions++;
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +368,7 @@ ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket)
|
|||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
void *ares__htable_get(const ares__htable_t *htable, const void *key)
|
||||
void *ares_htable_get(const ares_htable_t *htable, const void *key)
|
||||
{
|
||||
unsigned int idx;
|
||||
|
||||
|
|
@ -373,20 +378,20 @@ void *ares__htable_get(const ares__htable_t *htable, const void *key)
|
|||
|
||||
idx = HASH_IDX(htable, key);
|
||||
|
||||
return ares__llist_node_val(ares__htable_find(htable, idx, key));
|
||||
return ares_llist_node_val(ares_htable_find(htable, idx, key));
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_remove(ares__htable_t *htable, const void *key)
|
||||
ares_bool_t ares_htable_remove(ares_htable_t *htable, const void *key)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
unsigned int idx;
|
||||
ares_llist_node_t *node;
|
||||
unsigned int idx;
|
||||
|
||||
if (htable == NULL || key == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
idx = HASH_IDX(htable, key);
|
||||
node = ares__htable_find(htable, idx, key);
|
||||
node = ares_htable_find(htable, idx, key);
|
||||
if (node == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
|
@ -394,15 +399,15 @@ ares_bool_t ares__htable_remove(ares__htable_t *htable, const void *key)
|
|||
htable->num_keys--;
|
||||
|
||||
/* Reduce collisions */
|
||||
if (ares__llist_len(ares__llist_node_parent(node)) > 1) {
|
||||
if (ares_llist_len(ares_llist_node_parent(node)) > 1) {
|
||||
htable->num_collisions--;
|
||||
}
|
||||
|
||||
ares__llist_node_destroy(node);
|
||||
ares_llist_node_destroy(node);
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
size_t ares__htable_num_keys(const ares__htable_t *htable)
|
||||
size_t ares_htable_num_keys(const ares_htable_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return 0;
|
||||
|
|
@ -410,16 +415,15 @@ size_t ares__htable_num_keys(const ares__htable_t *htable)
|
|||
return htable->num_keys;
|
||||
}
|
||||
|
||||
unsigned int ares__htable_hash_FNV1a(const unsigned char *key, size_t key_len,
|
||||
unsigned int seed)
|
||||
unsigned int ares_htable_hash_FNV1a(const unsigned char *key, size_t key_len,
|
||||
unsigned int seed)
|
||||
{
|
||||
/* recommended seed is 2166136261U, but we don't want collisions */
|
||||
unsigned int hv = seed;
|
||||
unsigned int hv = seed ^ 2166136261U;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < key_len; i++) {
|
||||
hv ^= (unsigned int)key[i];
|
||||
/* hv *= 0x01000193 */
|
||||
/* hv *= 16777619 (0x01000193) */
|
||||
hv += (hv << 1) + (hv << 4) + (hv << 7) + (hv << 8) + (hv << 24);
|
||||
}
|
||||
|
||||
|
|
@ -427,16 +431,15 @@ unsigned int ares__htable_hash_FNV1a(const unsigned char *key, size_t key_len,
|
|||
}
|
||||
|
||||
/* Case insensitive version, meant for ASCII strings */
|
||||
unsigned int ares__htable_hash_FNV1a_casecmp(const unsigned char *key,
|
||||
size_t key_len, unsigned int seed)
|
||||
unsigned int ares_htable_hash_FNV1a_casecmp(const unsigned char *key,
|
||||
size_t key_len, unsigned int seed)
|
||||
{
|
||||
/* recommended seed is 2166136261U, but we don't want collisions */
|
||||
unsigned int hv = seed;
|
||||
unsigned int hv = seed ^ 2166136261U;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < key_len; i++) {
|
||||
hv ^= (unsigned int)ares__tolower(key[i]);
|
||||
/* hv *= 0x01000193 */
|
||||
hv ^= (unsigned int)ares_tolower(key[i]);
|
||||
/* hv *= 16777619 (0x01000193) */
|
||||
hv += (hv << 1) + (hv << 4) + (hv << 7) + (hv << 8) + (hv << 24);
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#define __ARES__HTABLE_H
|
||||
|
||||
|
||||
/*! \addtogroup ares__htable Base HashTable Data Structure
|
||||
/*! \addtogroup ares_htable Base HashTable Data Structure
|
||||
*
|
||||
* This is a basic hashtable data structure that is meant to be wrapped
|
||||
* by a higher level implementation. This data structure is designed to
|
||||
|
|
@ -45,10 +45,10 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
struct ares__htable;
|
||||
struct ares_htable;
|
||||
|
||||
/*! Opaque data type for generic hash table implementation */
|
||||
typedef struct ares__htable ares__htable_t;
|
||||
typedef struct ares_htable ares_htable_t;
|
||||
|
||||
/*! Callback for generating a hash of the key.
|
||||
*
|
||||
|
|
@ -58,21 +58,21 @@ typedef struct ares__htable ares__htable_t;
|
|||
* but otherwise will not change between calls.
|
||||
* \return hash
|
||||
*/
|
||||
typedef unsigned int (*ares__htable_hashfunc_t)(const void *key,
|
||||
unsigned int seed);
|
||||
typedef unsigned int (*ares_htable_hashfunc_t)(const void *key,
|
||||
unsigned int seed);
|
||||
|
||||
/*! Callback to free the bucket
|
||||
*
|
||||
* \param[in] bucket user provided bucket
|
||||
*/
|
||||
typedef void (*ares__htable_bucket_free_t)(void *bucket);
|
||||
typedef void (*ares_htable_bucket_free_t)(void *bucket);
|
||||
|
||||
/*! Callback to extract the key from the user-provided bucket
|
||||
*
|
||||
* \param[in] bucket user provided bucket
|
||||
* \return pointer to key held in bucket
|
||||
*/
|
||||
typedef const void *(*ares__htable_bucket_key_t)(const void *bucket);
|
||||
typedef const void *(*ares_htable_bucket_key_t)(const void *bucket);
|
||||
|
||||
/*! Callback to compare two keys for equality
|
||||
*
|
||||
|
|
@ -80,15 +80,14 @@ typedef const void *(*ares__htable_bucket_key_t)(const void *bucket);
|
|||
* \param[in] key2 second key
|
||||
* \return ARES_TRUE if equal, ARES_FALSE if not
|
||||
*/
|
||||
typedef ares_bool_t (*ares__htable_key_eq_t)(const void *key1,
|
||||
const void *key2);
|
||||
typedef ares_bool_t (*ares_htable_key_eq_t)(const void *key1, const void *key2);
|
||||
|
||||
|
||||
/*! Destroy the initialized hashtable
|
||||
*
|
||||
* \param[in] htable initialized hashtable
|
||||
*/
|
||||
void ares__htable_destroy(ares__htable_t *htable);
|
||||
void ares_htable_destroy(ares_htable_t *htable);
|
||||
|
||||
/*! Create a new hashtable
|
||||
*
|
||||
|
|
@ -98,17 +97,17 @@ void ares__htable_destroy(ares__htable_t *htable);
|
|||
* \param[in] key_eq Required. Callback to check for key equality.
|
||||
* \return initialized hashtable. NULL if out of memory or misuse.
|
||||
*/
|
||||
ares__htable_t *ares__htable_create(ares__htable_hashfunc_t hash_func,
|
||||
ares__htable_bucket_key_t bucket_key,
|
||||
ares__htable_bucket_free_t bucket_free,
|
||||
ares__htable_key_eq_t key_eq);
|
||||
ares_htable_t *ares_htable_create(ares_htable_hashfunc_t hash_func,
|
||||
ares_htable_bucket_key_t bucket_key,
|
||||
ares_htable_bucket_free_t bucket_free,
|
||||
ares_htable_key_eq_t key_eq);
|
||||
|
||||
/*! Count of keys from initialized hashtable
|
||||
*
|
||||
* \param[in] htable Initialized hashtable.
|
||||
* \return count of keys
|
||||
*/
|
||||
size_t ares__htable_num_keys(const ares__htable_t *htable);
|
||||
size_t ares_htable_num_keys(const ares_htable_t *htable);
|
||||
|
||||
/*! Retrieve an array of buckets from the hashtable. This is mainly used as
|
||||
* a helper for retrieving an array of keys.
|
||||
|
|
@ -120,8 +119,7 @@ size_t ares__htable_num_keys(const ares__htable_t *htable);
|
|||
* will be a dangling pointer. It is expected wrappers will make
|
||||
* such values safe by duplicating them.
|
||||
*/
|
||||
const void **ares__htable_all_buckets(const ares__htable_t *htable,
|
||||
size_t *num);
|
||||
const void **ares_htable_all_buckets(const ares_htable_t *htable, size_t *num);
|
||||
|
||||
/*! Insert bucket into hashtable
|
||||
*
|
||||
|
|
@ -130,7 +128,7 @@ const void **ares__htable_all_buckets(const ares__htable_t *htable,
|
|||
* allowed to be NULL.
|
||||
* \return ARES_TRUE on success, ARES_FALSE if out of memory
|
||||
*/
|
||||
ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket);
|
||||
ares_bool_t ares_htable_insert(ares_htable_t *htable, void *bucket);
|
||||
|
||||
/*! Retrieve bucket from hashtable based on key.
|
||||
*
|
||||
|
|
@ -138,7 +136,7 @@ ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket);
|
|||
* \param[in] key Pointer to key to use for comparison.
|
||||
* \return matching bucket, or NULL if not found.
|
||||
*/
|
||||
void *ares__htable_get(const ares__htable_t *htable, const void *key);
|
||||
void *ares_htable_get(const ares_htable_t *htable, const void *key);
|
||||
|
||||
/*! Remove bucket from hashtable by key
|
||||
*
|
||||
|
|
@ -146,7 +144,7 @@ void *ares__htable_get(const ares__htable_t *htable, const void *key);
|
|||
* \param[in] key Pointer to key to use for comparison
|
||||
* \return ARES_TRUE if found, ARES_FALSE if not found
|
||||
*/
|
||||
ares_bool_t ares__htable_remove(ares__htable_t *htable, const void *key);
|
||||
ares_bool_t ares_htable_remove(ares_htable_t *htable, const void *key);
|
||||
|
||||
/*! FNV1a hash algorithm. Can be used as underlying primitive for building
|
||||
* a wrapper hashtable.
|
||||
|
|
@ -156,8 +154,8 @@ ares_bool_t ares__htable_remove(ares__htable_t *htable, const void *key);
|
|||
* \param[in] seed Seed for generating hash
|
||||
* \return hash value
|
||||
*/
|
||||
unsigned int ares__htable_hash_FNV1a(const unsigned char *key, size_t key_len,
|
||||
unsigned int seed);
|
||||
unsigned int ares_htable_hash_FNV1a(const unsigned char *key, size_t key_len,
|
||||
unsigned int seed);
|
||||
|
||||
/*! FNV1a hash algorithm, but converts all characters to lowercase before
|
||||
* hashing to make the hash case-insensitive. Can be used as underlying
|
||||
|
|
@ -168,8 +166,8 @@ unsigned int ares__htable_hash_FNV1a(const unsigned char *key, size_t key_len,
|
|||
* \param[in] seed Seed for generating hash
|
||||
* \return hash value
|
||||
*/
|
||||
unsigned int ares__htable_hash_FNV1a_casecmp(const unsigned char *key,
|
||||
size_t key_len, unsigned int seed);
|
||||
unsigned int ares_htable_hash_FNV1a_casecmp(const unsigned char *key,
|
||||
size_t key_len, unsigned int seed);
|
||||
|
||||
/*! @} */
|
||||
|
||||
|
|
@ -24,46 +24,45 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares__htable_asvp.h"
|
||||
#include "ares_htable.h"
|
||||
#include "ares_htable_asvp.h"
|
||||
|
||||
struct ares__htable_asvp {
|
||||
ares__htable_asvp_val_free_t free_val;
|
||||
ares__htable_t *hash;
|
||||
struct ares_htable_asvp {
|
||||
ares_htable_asvp_val_free_t free_val;
|
||||
ares_htable_t *hash;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
ares_socket_t key;
|
||||
void *val;
|
||||
ares__htable_asvp_t *parent;
|
||||
} ares__htable_asvp_bucket_t;
|
||||
ares_socket_t key;
|
||||
void *val;
|
||||
ares_htable_asvp_t *parent;
|
||||
} ares_htable_asvp_bucket_t;
|
||||
|
||||
void ares__htable_asvp_destroy(ares__htable_asvp_t *htable)
|
||||
void ares_htable_asvp_destroy(ares_htable_asvp_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ares__htable_destroy(htable->hash);
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
|
||||
static unsigned int hash_func(const void *key, unsigned int seed)
|
||||
{
|
||||
const ares_socket_t *arg = key;
|
||||
return ares__htable_hash_FNV1a((const unsigned char *)arg, sizeof(*arg),
|
||||
seed);
|
||||
return ares_htable_hash_FNV1a((const unsigned char *)arg, sizeof(*arg), seed);
|
||||
}
|
||||
|
||||
static const void *bucket_key(const void *bucket)
|
||||
{
|
||||
const ares__htable_asvp_bucket_t *arg = bucket;
|
||||
const ares_htable_asvp_bucket_t *arg = bucket;
|
||||
return &arg->key;
|
||||
}
|
||||
|
||||
static void bucket_free(void *bucket)
|
||||
{
|
||||
ares__htable_asvp_bucket_t *arg = bucket;
|
||||
ares_htable_asvp_bucket_t *arg = bucket;
|
||||
|
||||
if (arg->parent->free_val) {
|
||||
arg->parent->free_val(arg->val);
|
||||
|
|
@ -84,16 +83,15 @@ static ares_bool_t key_eq(const void *key1, const void *key2)
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares__htable_asvp_t *
|
||||
ares__htable_asvp_create(ares__htable_asvp_val_free_t val_free)
|
||||
ares_htable_asvp_t *
|
||||
ares_htable_asvp_create(ares_htable_asvp_val_free_t val_free)
|
||||
{
|
||||
ares__htable_asvp_t *htable = ares_malloc(sizeof(*htable));
|
||||
ares_htable_asvp_t *htable = ares_malloc(sizeof(*htable));
|
||||
if (htable == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
htable->hash =
|
||||
ares__htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
htable->hash = ares_htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
if (htable->hash == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -104,14 +102,14 @@ ares__htable_asvp_t *
|
|||
|
||||
fail:
|
||||
if (htable) {
|
||||
ares__htable_destroy(htable->hash);
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ares_socket_t *ares__htable_asvp_keys(const ares__htable_asvp_t *htable,
|
||||
size_t *num)
|
||||
ares_socket_t *ares_htable_asvp_keys(const ares_htable_asvp_t *htable,
|
||||
size_t *num)
|
||||
{
|
||||
const void **buckets = NULL;
|
||||
size_t cnt = 0;
|
||||
|
|
@ -124,7 +122,7 @@ ares_socket_t *ares__htable_asvp_keys(const ares__htable_asvp_t *htable,
|
|||
|
||||
*num = 0;
|
||||
|
||||
buckets = ares__htable_all_buckets(htable->hash, &cnt);
|
||||
buckets = ares_htable_all_buckets(htable->hash, &cnt);
|
||||
if (buckets == NULL || cnt == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -136,7 +134,7 @@ ares_socket_t *ares__htable_asvp_keys(const ares__htable_asvp_t *htable,
|
|||
}
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
out[i] = ((const ares__htable_asvp_bucket_t *)buckets[i])->key;
|
||||
out[i] = ((const ares_htable_asvp_bucket_t *)buckets[i])->key;
|
||||
}
|
||||
|
||||
ares_free(buckets);
|
||||
|
|
@ -144,10 +142,10 @@ ares_socket_t *ares__htable_asvp_keys(const ares__htable_asvp_t *htable,
|
|||
return out;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_asvp_insert(ares__htable_asvp_t *htable,
|
||||
ares_socket_t key, void *val)
|
||||
ares_bool_t ares_htable_asvp_insert(ares_htable_asvp_t *htable,
|
||||
ares_socket_t key, void *val)
|
||||
{
|
||||
ares__htable_asvp_bucket_t *bucket = NULL;
|
||||
ares_htable_asvp_bucket_t *bucket = NULL;
|
||||
|
||||
if (htable == NULL) {
|
||||
goto fail;
|
||||
|
|
@ -162,7 +160,7 @@ ares_bool_t ares__htable_asvp_insert(ares__htable_asvp_t *htable,
|
|||
bucket->key = key;
|
||||
bucket->val = val;
|
||||
|
||||
if (!ares__htable_insert(htable->hash, bucket)) {
|
||||
if (!ares_htable_insert(htable->hash, bucket)) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
|
|
@ -175,10 +173,10 @@ fail:
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_asvp_get(const ares__htable_asvp_t *htable,
|
||||
ares_socket_t key, void **val)
|
||||
ares_bool_t ares_htable_asvp_get(const ares_htable_asvp_t *htable,
|
||||
ares_socket_t key, void **val)
|
||||
{
|
||||
ares__htable_asvp_bucket_t *bucket = NULL;
|
||||
ares_htable_asvp_bucket_t *bucket = NULL;
|
||||
|
||||
if (val) {
|
||||
*val = NULL;
|
||||
|
|
@ -188,7 +186,7 @@ ares_bool_t ares__htable_asvp_get(const ares__htable_asvp_t *htable,
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
bucket = ares__htable_get(htable->hash, &key);
|
||||
bucket = ares_htable_get(htable->hash, &key);
|
||||
if (bucket == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
|
@ -199,28 +197,28 @@ ares_bool_t ares__htable_asvp_get(const ares__htable_asvp_t *htable,
|
|||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
void *ares__htable_asvp_get_direct(const ares__htable_asvp_t *htable,
|
||||
ares_socket_t key)
|
||||
void *ares_htable_asvp_get_direct(const ares_htable_asvp_t *htable,
|
||||
ares_socket_t key)
|
||||
{
|
||||
void *val = NULL;
|
||||
ares__htable_asvp_get(htable, key, &val);
|
||||
ares_htable_asvp_get(htable, key, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_asvp_remove(ares__htable_asvp_t *htable,
|
||||
ares_socket_t key)
|
||||
ares_bool_t ares_htable_asvp_remove(ares_htable_asvp_t *htable,
|
||||
ares_socket_t key)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
return ares__htable_remove(htable->hash, &key);
|
||||
return ares_htable_remove(htable->hash, &key);
|
||||
}
|
||||
|
||||
size_t ares__htable_asvp_num_keys(const ares__htable_asvp_t *htable)
|
||||
size_t ares_htable_asvp_num_keys(const ares_htable_asvp_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return ares__htable_num_keys(htable->hash);
|
||||
return ares_htable_num_keys(htable->hash);
|
||||
}
|
||||
228
deps/cares/src/lib/dsa/ares_htable_dict.c
vendored
Normal file
228
deps/cares/src/lib/dsa/ares_htable_dict.c
vendored
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Brad House
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares_htable.h"
|
||||
#include "ares_htable_dict.h"
|
||||
|
||||
struct ares_htable_dict {
|
||||
ares_htable_t *hash;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *key;
|
||||
char *val;
|
||||
ares_htable_dict_t *parent;
|
||||
} ares_htable_dict_bucket_t;
|
||||
|
||||
void ares_htable_dict_destroy(ares_htable_dict_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
|
||||
static unsigned int hash_func(const void *key, unsigned int seed)
|
||||
{
|
||||
return ares_htable_hash_FNV1a_casecmp(key, ares_strlen(key), seed);
|
||||
}
|
||||
|
||||
static const void *bucket_key(const void *bucket)
|
||||
{
|
||||
const ares_htable_dict_bucket_t *arg = bucket;
|
||||
return arg->key;
|
||||
}
|
||||
|
||||
static void bucket_free(void *bucket)
|
||||
{
|
||||
ares_htable_dict_bucket_t *arg = bucket;
|
||||
|
||||
ares_free(arg->key);
|
||||
ares_free(arg->val);
|
||||
|
||||
ares_free(arg);
|
||||
}
|
||||
|
||||
static ares_bool_t key_eq(const void *key1, const void *key2)
|
||||
{
|
||||
return ares_strcaseeq(key1, key2);
|
||||
}
|
||||
|
||||
ares_htable_dict_t *ares_htable_dict_create(void)
|
||||
{
|
||||
ares_htable_dict_t *htable = ares_malloc(sizeof(*htable));
|
||||
if (htable == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
htable->hash = ares_htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
if (htable->hash == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
return htable;
|
||||
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
fail:
|
||||
if (htable) {
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
return NULL;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ares_bool_t ares_htable_dict_insert(ares_htable_dict_t *htable, const char *key,
|
||||
const char *val)
|
||||
{
|
||||
ares_htable_dict_bucket_t *bucket = NULL;
|
||||
|
||||
if (htable == NULL || ares_strlen(key) == 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bucket = ares_malloc_zero(sizeof(*bucket));
|
||||
if (bucket == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bucket->parent = htable;
|
||||
bucket->key = ares_strdup(key);
|
||||
if (bucket->key == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (val != NULL) {
|
||||
bucket->val = ares_strdup(val);
|
||||
if (bucket->val == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ares_htable_insert(htable->hash, bucket)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return ARES_TRUE;
|
||||
|
||||
fail:
|
||||
if (bucket) {
|
||||
ares_free(bucket->val);
|
||||
ares_free(bucket);
|
||||
}
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_bool_t ares_htable_dict_get(const ares_htable_dict_t *htable,
|
||||
const char *key, const char **val)
|
||||
{
|
||||
const ares_htable_dict_bucket_t *bucket = NULL;
|
||||
|
||||
if (val) {
|
||||
*val = NULL;
|
||||
}
|
||||
|
||||
if (htable == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
bucket = ares_htable_get(htable->hash, key);
|
||||
if (bucket == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
if (val) {
|
||||
*val = bucket->val;
|
||||
}
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
const char *ares_htable_dict_get_direct(const ares_htable_dict_t *htable,
|
||||
const char *key)
|
||||
{
|
||||
const char *val = NULL;
|
||||
ares_htable_dict_get(htable, key, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
ares_bool_t ares_htable_dict_remove(ares_htable_dict_t *htable, const char *key)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
return ares_htable_remove(htable->hash, key);
|
||||
}
|
||||
|
||||
size_t ares_htable_dict_num_keys(const ares_htable_dict_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return ares_htable_num_keys(htable->hash);
|
||||
}
|
||||
|
||||
char **ares_htable_dict_keys(const ares_htable_dict_t *htable, size_t *num)
|
||||
{
|
||||
const void **buckets = NULL;
|
||||
size_t cnt = 0;
|
||||
char **out = NULL;
|
||||
size_t i;
|
||||
|
||||
if (htable == NULL || num == NULL) {
|
||||
return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
*num = 0;
|
||||
|
||||
buckets = ares_htable_all_buckets(htable->hash, &cnt);
|
||||
if (buckets == NULL || cnt == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
out = ares_malloc_zero(sizeof(*out) * cnt);
|
||||
if (out == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
out[i] = ares_strdup(((const ares_htable_dict_bucket_t *)buckets[i])->key);
|
||||
if (out[i] == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
ares_free(buckets);
|
||||
*num = cnt;
|
||||
return out;
|
||||
|
||||
fail:
|
||||
*num = 0;
|
||||
ares_free_array(out, cnt, ares_free);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -24,46 +24,46 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares__htable_strvp.h"
|
||||
#include "ares_htable.h"
|
||||
#include "ares_htable_strvp.h"
|
||||
|
||||
struct ares__htable_strvp {
|
||||
ares__htable_strvp_val_free_t free_val;
|
||||
ares__htable_t *hash;
|
||||
struct ares_htable_strvp {
|
||||
ares_htable_strvp_val_free_t free_val;
|
||||
ares_htable_t *hash;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *key;
|
||||
void *val;
|
||||
ares__htable_strvp_t *parent;
|
||||
} ares__htable_strvp_bucket_t;
|
||||
char *key;
|
||||
void *val;
|
||||
ares_htable_strvp_t *parent;
|
||||
} ares_htable_strvp_bucket_t;
|
||||
|
||||
void ares__htable_strvp_destroy(ares__htable_strvp_t *htable)
|
||||
void ares_htable_strvp_destroy(ares_htable_strvp_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ares__htable_destroy(htable->hash);
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
|
||||
static unsigned int hash_func(const void *key, unsigned int seed)
|
||||
{
|
||||
const char *arg = key;
|
||||
return ares__htable_hash_FNV1a_casecmp((const unsigned char *)arg,
|
||||
ares_strlen(arg), seed);
|
||||
return ares_htable_hash_FNV1a_casecmp((const unsigned char *)arg,
|
||||
ares_strlen(arg), seed);
|
||||
}
|
||||
|
||||
static const void *bucket_key(const void *bucket)
|
||||
{
|
||||
const ares__htable_strvp_bucket_t *arg = bucket;
|
||||
const ares_htable_strvp_bucket_t *arg = bucket;
|
||||
return arg->key;
|
||||
}
|
||||
|
||||
static void bucket_free(void *bucket)
|
||||
{
|
||||
ares__htable_strvp_bucket_t *arg = bucket;
|
||||
ares_htable_strvp_bucket_t *arg = bucket;
|
||||
|
||||
if (arg->parent->free_val) {
|
||||
arg->parent->free_val(arg->val);
|
||||
|
|
@ -74,26 +74,18 @@ static void bucket_free(void *bucket)
|
|||
|
||||
static ares_bool_t key_eq(const void *key1, const void *key2)
|
||||
{
|
||||
const char *k1 = key1;
|
||||
const char *k2 = key2;
|
||||
|
||||
if (strcasecmp(k1, k2) == 0) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
return ARES_FALSE;
|
||||
return ares_strcaseeq(key1, key2);
|
||||
}
|
||||
|
||||
ares__htable_strvp_t *
|
||||
ares__htable_strvp_create(ares__htable_strvp_val_free_t val_free)
|
||||
ares_htable_strvp_t *
|
||||
ares_htable_strvp_create(ares_htable_strvp_val_free_t val_free)
|
||||
{
|
||||
ares__htable_strvp_t *htable = ares_malloc(sizeof(*htable));
|
||||
ares_htable_strvp_t *htable = ares_malloc(sizeof(*htable));
|
||||
if (htable == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
htable->hash =
|
||||
ares__htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
htable->hash = ares_htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
if (htable->hash == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -104,16 +96,16 @@ ares__htable_strvp_t *
|
|||
|
||||
fail:
|
||||
if (htable) {
|
||||
ares__htable_destroy(htable->hash);
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_strvp_insert(ares__htable_strvp_t *htable,
|
||||
const char *key, void *val)
|
||||
ares_bool_t ares_htable_strvp_insert(ares_htable_strvp_t *htable,
|
||||
const char *key, void *val)
|
||||
{
|
||||
ares__htable_strvp_bucket_t *bucket = NULL;
|
||||
ares_htable_strvp_bucket_t *bucket = NULL;
|
||||
|
||||
if (htable == NULL || key == NULL) {
|
||||
goto fail;
|
||||
|
|
@ -131,7 +123,7 @@ ares_bool_t ares__htable_strvp_insert(ares__htable_strvp_t *htable,
|
|||
}
|
||||
bucket->val = val;
|
||||
|
||||
if (!ares__htable_insert(htable->hash, bucket)) {
|
||||
if (!ares_htable_insert(htable->hash, bucket)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -145,10 +137,10 @@ fail:
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_strvp_get(const ares__htable_strvp_t *htable,
|
||||
const char *key, void **val)
|
||||
ares_bool_t ares_htable_strvp_get(const ares_htable_strvp_t *htable,
|
||||
const char *key, void **val)
|
||||
{
|
||||
ares__htable_strvp_bucket_t *bucket = NULL;
|
||||
ares_htable_strvp_bucket_t *bucket = NULL;
|
||||
|
||||
if (val) {
|
||||
*val = NULL;
|
||||
|
|
@ -158,7 +150,7 @@ ares_bool_t ares__htable_strvp_get(const ares__htable_strvp_t *htable,
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
bucket = ares__htable_get(htable->hash, key);
|
||||
bucket = ares_htable_get(htable->hash, key);
|
||||
if (bucket == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
|
@ -169,28 +161,50 @@ ares_bool_t ares__htable_strvp_get(const ares__htable_strvp_t *htable,
|
|||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
void *ares__htable_strvp_get_direct(const ares__htable_strvp_t *htable,
|
||||
const char *key)
|
||||
void *ares_htable_strvp_get_direct(const ares_htable_strvp_t *htable,
|
||||
const char *key)
|
||||
{
|
||||
void *val = NULL;
|
||||
ares__htable_strvp_get(htable, key, &val);
|
||||
ares_htable_strvp_get(htable, key, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_strvp_remove(ares__htable_strvp_t *htable,
|
||||
const char *key)
|
||||
ares_bool_t ares_htable_strvp_remove(ares_htable_strvp_t *htable,
|
||||
const char *key)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
return ares__htable_remove(htable->hash, key);
|
||||
return ares_htable_remove(htable->hash, key);
|
||||
}
|
||||
|
||||
size_t ares__htable_strvp_num_keys(const ares__htable_strvp_t *htable)
|
||||
void *ares_htable_strvp_claim(ares_htable_strvp_t *htable, const char *key)
|
||||
{
|
||||
ares_htable_strvp_bucket_t *bucket = NULL;
|
||||
void *val;
|
||||
|
||||
if (htable == NULL || key == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bucket = ares_htable_get(htable->hash, key);
|
||||
if (bucket == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Unassociate value from bucket */
|
||||
val = bucket->val;
|
||||
bucket->val = NULL;
|
||||
|
||||
ares_htable_strvp_remove(htable, key);
|
||||
return val;
|
||||
}
|
||||
|
||||
size_t ares_htable_strvp_num_keys(const ares_htable_strvp_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return ares__htable_num_keys(htable->hash);
|
||||
return ares_htable_num_keys(htable->hash);
|
||||
}
|
||||
|
|
@ -24,46 +24,45 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares__htable_szvp.h"
|
||||
#include "ares_htable.h"
|
||||
#include "ares_htable_szvp.h"
|
||||
|
||||
struct ares__htable_szvp {
|
||||
ares__htable_szvp_val_free_t free_val;
|
||||
ares__htable_t *hash;
|
||||
struct ares_htable_szvp {
|
||||
ares_htable_szvp_val_free_t free_val;
|
||||
ares_htable_t *hash;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
size_t key;
|
||||
void *val;
|
||||
ares__htable_szvp_t *parent;
|
||||
} ares__htable_szvp_bucket_t;
|
||||
size_t key;
|
||||
void *val;
|
||||
ares_htable_szvp_t *parent;
|
||||
} ares_htable_szvp_bucket_t;
|
||||
|
||||
void ares__htable_szvp_destroy(ares__htable_szvp_t *htable)
|
||||
void ares_htable_szvp_destroy(ares_htable_szvp_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ares__htable_destroy(htable->hash);
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
|
||||
static unsigned int hash_func(const void *key, unsigned int seed)
|
||||
{
|
||||
const size_t *arg = key;
|
||||
return ares__htable_hash_FNV1a((const unsigned char *)arg, sizeof(*arg),
|
||||
seed);
|
||||
return ares_htable_hash_FNV1a((const unsigned char *)arg, sizeof(*arg), seed);
|
||||
}
|
||||
|
||||
static const void *bucket_key(const void *bucket)
|
||||
{
|
||||
const ares__htable_szvp_bucket_t *arg = bucket;
|
||||
const ares_htable_szvp_bucket_t *arg = bucket;
|
||||
return &arg->key;
|
||||
}
|
||||
|
||||
static void bucket_free(void *bucket)
|
||||
{
|
||||
ares__htable_szvp_bucket_t *arg = bucket;
|
||||
ares_htable_szvp_bucket_t *arg = bucket;
|
||||
|
||||
if (arg->parent->free_val) {
|
||||
arg->parent->free_val(arg->val);
|
||||
|
|
@ -84,16 +83,15 @@ static ares_bool_t key_eq(const void *key1, const void *key2)
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares__htable_szvp_t *
|
||||
ares__htable_szvp_create(ares__htable_szvp_val_free_t val_free)
|
||||
ares_htable_szvp_t *
|
||||
ares_htable_szvp_create(ares_htable_szvp_val_free_t val_free)
|
||||
{
|
||||
ares__htable_szvp_t *htable = ares_malloc(sizeof(*htable));
|
||||
ares_htable_szvp_t *htable = ares_malloc(sizeof(*htable));
|
||||
if (htable == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
htable->hash =
|
||||
ares__htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
htable->hash = ares_htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
if (htable->hash == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -104,16 +102,16 @@ ares__htable_szvp_t *
|
|||
|
||||
fail:
|
||||
if (htable) {
|
||||
ares__htable_destroy(htable->hash);
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_szvp_insert(ares__htable_szvp_t *htable, size_t key,
|
||||
void *val)
|
||||
ares_bool_t ares_htable_szvp_insert(ares_htable_szvp_t *htable, size_t key,
|
||||
void *val)
|
||||
{
|
||||
ares__htable_szvp_bucket_t *bucket = NULL;
|
||||
ares_htable_szvp_bucket_t *bucket = NULL;
|
||||
|
||||
if (htable == NULL) {
|
||||
goto fail;
|
||||
|
|
@ -128,7 +126,7 @@ ares_bool_t ares__htable_szvp_insert(ares__htable_szvp_t *htable, size_t key,
|
|||
bucket->key = key;
|
||||
bucket->val = val;
|
||||
|
||||
if (!ares__htable_insert(htable->hash, bucket)) {
|
||||
if (!ares_htable_insert(htable->hash, bucket)) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
|
|
@ -141,10 +139,10 @@ fail:
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_szvp_get(const ares__htable_szvp_t *htable, size_t key,
|
||||
void **val)
|
||||
ares_bool_t ares_htable_szvp_get(const ares_htable_szvp_t *htable, size_t key,
|
||||
void **val)
|
||||
{
|
||||
ares__htable_szvp_bucket_t *bucket = NULL;
|
||||
ares_htable_szvp_bucket_t *bucket = NULL;
|
||||
|
||||
if (val) {
|
||||
*val = NULL;
|
||||
|
|
@ -154,7 +152,7 @@ ares_bool_t ares__htable_szvp_get(const ares__htable_szvp_t *htable, size_t key,
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
bucket = ares__htable_get(htable->hash, &key);
|
||||
bucket = ares_htable_get(htable->hash, &key);
|
||||
if (bucket == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
|
@ -165,27 +163,26 @@ ares_bool_t ares__htable_szvp_get(const ares__htable_szvp_t *htable, size_t key,
|
|||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
void *ares__htable_szvp_get_direct(const ares__htable_szvp_t *htable,
|
||||
size_t key)
|
||||
void *ares_htable_szvp_get_direct(const ares_htable_szvp_t *htable, size_t key)
|
||||
{
|
||||
void *val = NULL;
|
||||
ares__htable_szvp_get(htable, key, &val);
|
||||
ares_htable_szvp_get(htable, key, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_szvp_remove(ares__htable_szvp_t *htable, size_t key)
|
||||
ares_bool_t ares_htable_szvp_remove(ares_htable_szvp_t *htable, size_t key)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
return ares__htable_remove(htable->hash, &key);
|
||||
return ares_htable_remove(htable->hash, &key);
|
||||
}
|
||||
|
||||
size_t ares__htable_szvp_num_keys(const ares__htable_szvp_t *htable)
|
||||
size_t ares_htable_szvp_num_keys(const ares_htable_szvp_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return ares__htable_num_keys(htable->hash);
|
||||
return ares_htable_num_keys(htable->hash);
|
||||
}
|
||||
186
deps/cares/src/lib/dsa/ares_htable_vpstr.c
vendored
Normal file
186
deps/cares/src/lib/dsa/ares_htable_vpstr.c
vendored
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Brad House
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares_htable.h"
|
||||
#include "ares_htable_vpstr.h"
|
||||
|
||||
struct ares_htable_vpstr {
|
||||
ares_htable_t *hash;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
void *key;
|
||||
char *val;
|
||||
ares_htable_vpstr_t *parent;
|
||||
} ares_htable_vpstr_bucket_t;
|
||||
|
||||
void ares_htable_vpstr_destroy(ares_htable_vpstr_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
|
||||
static unsigned int hash_func(const void *key, unsigned int seed)
|
||||
{
|
||||
return ares_htable_hash_FNV1a((const unsigned char *)&key, sizeof(key), seed);
|
||||
}
|
||||
|
||||
static const void *bucket_key(const void *bucket)
|
||||
{
|
||||
const ares_htable_vpstr_bucket_t *arg = bucket;
|
||||
return arg->key;
|
||||
}
|
||||
|
||||
static void bucket_free(void *bucket)
|
||||
{
|
||||
ares_htable_vpstr_bucket_t *arg = bucket;
|
||||
|
||||
ares_free(arg->val);
|
||||
|
||||
ares_free(arg);
|
||||
}
|
||||
|
||||
static ares_bool_t key_eq(const void *key1, const void *key2)
|
||||
{
|
||||
if (key1 == key2) {
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_htable_vpstr_t *ares_htable_vpstr_create(void)
|
||||
{
|
||||
ares_htable_vpstr_t *htable = ares_malloc(sizeof(*htable));
|
||||
if (htable == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
htable->hash = ares_htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
if (htable->hash == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
return htable;
|
||||
|
||||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
fail:
|
||||
if (htable) {
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
return NULL;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ares_bool_t ares_htable_vpstr_insert(ares_htable_vpstr_t *htable, void *key,
|
||||
const char *val)
|
||||
{
|
||||
ares_htable_vpstr_bucket_t *bucket = NULL;
|
||||
|
||||
if (htable == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bucket = ares_malloc(sizeof(*bucket));
|
||||
if (bucket == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bucket->parent = htable;
|
||||
bucket->key = key;
|
||||
bucket->val = ares_strdup(val);
|
||||
if (bucket->val == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!ares_htable_insert(htable->hash, bucket)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return ARES_TRUE;
|
||||
|
||||
fail:
|
||||
if (bucket) {
|
||||
ares_free(bucket->val);
|
||||
ares_free(bucket);
|
||||
}
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_bool_t ares_htable_vpstr_get(const ares_htable_vpstr_t *htable,
|
||||
const void *key, const char **val)
|
||||
{
|
||||
const ares_htable_vpstr_bucket_t *bucket = NULL;
|
||||
|
||||
if (val) {
|
||||
*val = NULL;
|
||||
}
|
||||
|
||||
if (htable == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
bucket = ares_htable_get(htable->hash, key);
|
||||
if (bucket == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
if (val) {
|
||||
*val = bucket->val;
|
||||
}
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
const char *ares_htable_vpstr_get_direct(const ares_htable_vpstr_t *htable,
|
||||
const void *key)
|
||||
{
|
||||
const char *val = NULL;
|
||||
ares_htable_vpstr_get(htable, key, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
ares_bool_t ares_htable_vpstr_remove(ares_htable_vpstr_t *htable,
|
||||
const void *key)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
return ares_htable_remove(htable->hash, key);
|
||||
}
|
||||
|
||||
size_t ares_htable_vpstr_num_keys(const ares_htable_vpstr_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return ares_htable_num_keys(htable->hash);
|
||||
}
|
||||
|
|
@ -24,46 +24,45 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares__htable_vpvp.h"
|
||||
#include "ares_htable.h"
|
||||
#include "ares_htable_vpvp.h"
|
||||
|
||||
struct ares__htable_vpvp {
|
||||
ares__htable_vpvp_key_free_t free_key;
|
||||
ares__htable_vpvp_val_free_t free_val;
|
||||
ares__htable_t *hash;
|
||||
struct ares_htable_vpvp {
|
||||
ares_htable_vpvp_key_free_t free_key;
|
||||
ares_htable_vpvp_val_free_t free_val;
|
||||
ares_htable_t *hash;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
void *key;
|
||||
void *val;
|
||||
ares__htable_vpvp_t *parent;
|
||||
} ares__htable_vpvp_bucket_t;
|
||||
void *key;
|
||||
void *val;
|
||||
ares_htable_vpvp_t *parent;
|
||||
} ares_htable_vpvp_bucket_t;
|
||||
|
||||
void ares__htable_vpvp_destroy(ares__htable_vpvp_t *htable)
|
||||
void ares_htable_vpvp_destroy(ares_htable_vpvp_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares__htable_destroy(htable->hash);
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
|
||||
static unsigned int hash_func(const void *key, unsigned int seed)
|
||||
{
|
||||
return ares__htable_hash_FNV1a((const unsigned char *)&key, sizeof(key),
|
||||
seed);
|
||||
return ares_htable_hash_FNV1a((const unsigned char *)&key, sizeof(key), seed);
|
||||
}
|
||||
|
||||
static const void *bucket_key(const void *bucket)
|
||||
{
|
||||
const ares__htable_vpvp_bucket_t *arg = bucket;
|
||||
const ares_htable_vpvp_bucket_t *arg = bucket;
|
||||
return arg->key;
|
||||
}
|
||||
|
||||
static void bucket_free(void *bucket)
|
||||
{
|
||||
ares__htable_vpvp_bucket_t *arg = bucket;
|
||||
ares_htable_vpvp_bucket_t *arg = bucket;
|
||||
|
||||
if (arg->parent->free_key) {
|
||||
arg->parent->free_key(arg->key);
|
||||
|
|
@ -85,17 +84,16 @@ static ares_bool_t key_eq(const void *key1, const void *key2)
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares__htable_vpvp_t *
|
||||
ares__htable_vpvp_create(ares__htable_vpvp_key_free_t key_free,
|
||||
ares__htable_vpvp_val_free_t val_free)
|
||||
ares_htable_vpvp_t *
|
||||
ares_htable_vpvp_create(ares_htable_vpvp_key_free_t key_free,
|
||||
ares_htable_vpvp_val_free_t val_free)
|
||||
{
|
||||
ares__htable_vpvp_t *htable = ares_malloc(sizeof(*htable));
|
||||
ares_htable_vpvp_t *htable = ares_malloc(sizeof(*htable));
|
||||
if (htable == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
htable->hash =
|
||||
ares__htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
htable->hash = ares_htable_create(hash_func, bucket_key, bucket_free, key_eq);
|
||||
if (htable->hash == NULL) {
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
|
@ -108,17 +106,17 @@ ares__htable_vpvp_t *
|
|||
/* LCOV_EXCL_START: OutOfMemory */
|
||||
fail:
|
||||
if (htable) {
|
||||
ares__htable_destroy(htable->hash);
|
||||
ares_htable_destroy(htable->hash);
|
||||
ares_free(htable);
|
||||
}
|
||||
return NULL;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_vpvp_insert(ares__htable_vpvp_t *htable, void *key,
|
||||
void *val)
|
||||
ares_bool_t ares_htable_vpvp_insert(ares_htable_vpvp_t *htable, void *key,
|
||||
void *val)
|
||||
{
|
||||
ares__htable_vpvp_bucket_t *bucket = NULL;
|
||||
ares_htable_vpvp_bucket_t *bucket = NULL;
|
||||
|
||||
if (htable == NULL) {
|
||||
goto fail;
|
||||
|
|
@ -133,7 +131,7 @@ ares_bool_t ares__htable_vpvp_insert(ares__htable_vpvp_t *htable, void *key,
|
|||
bucket->key = key;
|
||||
bucket->val = val;
|
||||
|
||||
if (!ares__htable_insert(htable->hash, bucket)) {
|
||||
if (!ares_htable_insert(htable->hash, bucket)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -146,10 +144,10 @@ fail:
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable,
|
||||
const void *key, void **val)
|
||||
ares_bool_t ares_htable_vpvp_get(const ares_htable_vpvp_t *htable,
|
||||
const void *key, void **val)
|
||||
{
|
||||
ares__htable_vpvp_bucket_t *bucket = NULL;
|
||||
ares_htable_vpvp_bucket_t *bucket = NULL;
|
||||
|
||||
if (val) {
|
||||
*val = NULL;
|
||||
|
|
@ -159,7 +157,7 @@ ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable,
|
|||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
bucket = ares__htable_get(htable->hash, key);
|
||||
bucket = ares_htable_get(htable->hash, key);
|
||||
if (bucket == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
|
@ -170,28 +168,27 @@ ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable,
|
|||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable,
|
||||
const void *key)
|
||||
void *ares_htable_vpvp_get_direct(const ares_htable_vpvp_t *htable,
|
||||
const void *key)
|
||||
{
|
||||
void *val = NULL;
|
||||
ares__htable_vpvp_get(htable, key, &val);
|
||||
ares_htable_vpvp_get(htable, key, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_vpvp_remove(ares__htable_vpvp_t *htable,
|
||||
const void *key)
|
||||
ares_bool_t ares_htable_vpvp_remove(ares_htable_vpvp_t *htable, const void *key)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
return ares__htable_remove(htable->hash, key);
|
||||
return ares_htable_remove(htable->hash, key);
|
||||
}
|
||||
|
||||
size_t ares__htable_vpvp_num_keys(const ares__htable_vpvp_t *htable)
|
||||
size_t ares_htable_vpvp_num_keys(const ares_htable_vpvp_t *htable)
|
||||
{
|
||||
if (htable == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return ares__htable_num_keys(htable->hash);
|
||||
return ares_htable_num_keys(htable->hash);
|
||||
}
|
||||
|
|
@ -24,25 +24,25 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares__llist.h"
|
||||
#include "ares_llist.h"
|
||||
|
||||
struct ares__llist {
|
||||
ares__llist_node_t *head;
|
||||
ares__llist_node_t *tail;
|
||||
ares__llist_destructor_t destruct;
|
||||
size_t cnt;
|
||||
struct ares_llist {
|
||||
ares_llist_node_t *head;
|
||||
ares_llist_node_t *tail;
|
||||
ares_llist_destructor_t destruct;
|
||||
size_t cnt;
|
||||
};
|
||||
|
||||
struct ares__llist_node {
|
||||
void *data;
|
||||
ares__llist_node_t *prev;
|
||||
ares__llist_node_t *next;
|
||||
ares__llist_t *parent;
|
||||
struct ares_llist_node {
|
||||
void *data;
|
||||
ares_llist_node_t *prev;
|
||||
ares_llist_node_t *next;
|
||||
ares_llist_t *parent;
|
||||
};
|
||||
|
||||
ares__llist_t *ares__llist_create(ares__llist_destructor_t destruct)
|
||||
ares_llist_t *ares_llist_create(ares_llist_destructor_t destruct)
|
||||
{
|
||||
ares__llist_t *list = ares_malloc_zero(sizeof(*list));
|
||||
ares_llist_t *list = ares_malloc_zero(sizeof(*list));
|
||||
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -53,8 +53,8 @@ ares__llist_t *ares__llist_create(ares__llist_destructor_t destruct)
|
|||
return list;
|
||||
}
|
||||
|
||||
void ares__llist_replace_destructor(ares__llist_t *list,
|
||||
ares__llist_destructor_t destruct)
|
||||
void ares_llist_replace_destructor(ares_llist_t *list,
|
||||
ares_llist_destructor_t destruct)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return;
|
||||
|
|
@ -67,12 +67,11 @@ typedef enum {
|
|||
ARES__LLIST_INSERT_HEAD,
|
||||
ARES__LLIST_INSERT_TAIL,
|
||||
ARES__LLIST_INSERT_BEFORE
|
||||
} ares__llist_insert_type_t;
|
||||
} ares_llist_insert_type_t;
|
||||
|
||||
static void ares__llist_attach_at(ares__llist_t *list,
|
||||
ares__llist_insert_type_t type,
|
||||
ares__llist_node_t *at,
|
||||
ares__llist_node_t *node)
|
||||
static void ares_llist_attach_at(ares_llist_t *list,
|
||||
ares_llist_insert_type_t type,
|
||||
ares_llist_node_t *at, ares_llist_node_t *node)
|
||||
{
|
||||
if (list == NULL || node == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
|
|
@ -117,12 +116,11 @@ static void ares__llist_attach_at(ares__llist_t *list,
|
|||
list->cnt++;
|
||||
}
|
||||
|
||||
static ares__llist_node_t *ares__llist_insert_at(ares__llist_t *list,
|
||||
ares__llist_insert_type_t type,
|
||||
ares__llist_node_t *at,
|
||||
void *val)
|
||||
static ares_llist_node_t *ares_llist_insert_at(ares_llist_t *list,
|
||||
ares_llist_insert_type_t type,
|
||||
ares_llist_node_t *at, void *val)
|
||||
{
|
||||
ares__llist_node_t *node = NULL;
|
||||
ares_llist_node_t *node = NULL;
|
||||
|
||||
if (list == NULL || val == NULL) {
|
||||
return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
|
|
@ -135,48 +133,46 @@ static ares__llist_node_t *ares__llist_insert_at(ares__llist_t *list,
|
|||
}
|
||||
|
||||
node->data = val;
|
||||
ares__llist_attach_at(list, type, at, node);
|
||||
ares_llist_attach_at(list, type, at, node);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_insert_first(ares__llist_t *list, void *val)
|
||||
ares_llist_node_t *ares_llist_insert_first(ares_llist_t *list, void *val)
|
||||
{
|
||||
return ares__llist_insert_at(list, ARES__LLIST_INSERT_HEAD, NULL, val);
|
||||
return ares_llist_insert_at(list, ARES__LLIST_INSERT_HEAD, NULL, val);
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_insert_last(ares__llist_t *list, void *val)
|
||||
ares_llist_node_t *ares_llist_insert_last(ares_llist_t *list, void *val)
|
||||
{
|
||||
return ares__llist_insert_at(list, ARES__LLIST_INSERT_TAIL, NULL, val);
|
||||
return ares_llist_insert_at(list, ARES__LLIST_INSERT_TAIL, NULL, val);
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_insert_before(ares__llist_node_t *node,
|
||||
void *val)
|
||||
ares_llist_node_t *ares_llist_insert_before(ares_llist_node_t *node, void *val)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ares__llist_insert_at(node->parent, ARES__LLIST_INSERT_BEFORE, node,
|
||||
val);
|
||||
return ares_llist_insert_at(node->parent, ARES__LLIST_INSERT_BEFORE, node,
|
||||
val);
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_insert_after(ares__llist_node_t *node,
|
||||
void *val)
|
||||
ares_llist_node_t *ares_llist_insert_after(ares_llist_node_t *node, void *val)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (node->next == NULL) {
|
||||
return ares__llist_insert_last(node->parent, val);
|
||||
return ares_llist_insert_last(node->parent, val);
|
||||
}
|
||||
|
||||
return ares__llist_insert_at(node->parent, ARES__LLIST_INSERT_BEFORE,
|
||||
node->next, val);
|
||||
return ares_llist_insert_at(node->parent, ARES__LLIST_INSERT_BEFORE,
|
||||
node->next, val);
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_node_first(ares__llist_t *list)
|
||||
ares_llist_node_t *ares_llist_node_first(ares_llist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -184,10 +180,10 @@ ares__llist_node_t *ares__llist_node_first(ares__llist_t *list)
|
|||
return list->head;
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_node_idx(ares__llist_t *list, size_t idx)
|
||||
ares_llist_node_t *ares_llist_node_idx(ares_llist_t *list, size_t idx)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
size_t cnt;
|
||||
ares_llist_node_t *node;
|
||||
size_t cnt;
|
||||
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -204,7 +200,7 @@ ares__llist_node_t *ares__llist_node_idx(ares__llist_t *list, size_t idx)
|
|||
return node;
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_node_last(ares__llist_t *list)
|
||||
ares_llist_node_t *ares_llist_node_last(ares_llist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -212,7 +208,7 @@ ares__llist_node_t *ares__llist_node_last(ares__llist_t *list)
|
|||
return list->tail;
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_node_next(ares__llist_node_t *node)
|
||||
ares_llist_node_t *ares_llist_node_next(ares_llist_node_t *node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -220,7 +216,7 @@ ares__llist_node_t *ares__llist_node_next(ares__llist_node_t *node)
|
|||
return node->next;
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_node_prev(ares__llist_node_t *node)
|
||||
ares_llist_node_t *ares_llist_node_prev(ares_llist_node_t *node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -228,7 +224,7 @@ ares__llist_node_t *ares__llist_node_prev(ares__llist_node_t *node)
|
|||
return node->prev;
|
||||
}
|
||||
|
||||
void *ares__llist_node_val(ares__llist_node_t *node)
|
||||
void *ares_llist_node_val(ares_llist_node_t *node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -237,7 +233,7 @@ void *ares__llist_node_val(ares__llist_node_t *node)
|
|||
return node->data;
|
||||
}
|
||||
|
||||
size_t ares__llist_len(const ares__llist_t *list)
|
||||
size_t ares_llist_len(const ares_llist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return 0;
|
||||
|
|
@ -245,7 +241,7 @@ size_t ares__llist_len(const ares__llist_t *list)
|
|||
return list->cnt;
|
||||
}
|
||||
|
||||
ares__llist_t *ares__llist_node_parent(ares__llist_node_t *node)
|
||||
ares_llist_t *ares_llist_node_parent(ares_llist_node_t *node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -253,19 +249,19 @@ ares__llist_t *ares__llist_node_parent(ares__llist_node_t *node)
|
|||
return node->parent;
|
||||
}
|
||||
|
||||
void *ares__llist_first_val(ares__llist_t *list)
|
||||
void *ares_llist_first_val(ares_llist_t *list)
|
||||
{
|
||||
return ares__llist_node_val(ares__llist_node_first(list));
|
||||
return ares_llist_node_val(ares_llist_node_first(list));
|
||||
}
|
||||
|
||||
void *ares__llist_last_val(ares__llist_t *list)
|
||||
void *ares_llist_last_val(ares_llist_t *list)
|
||||
{
|
||||
return ares__llist_node_val(ares__llist_node_last(list));
|
||||
return ares_llist_node_val(ares_llist_node_last(list));
|
||||
}
|
||||
|
||||
static void ares__llist_node_detach(ares__llist_node_t *node)
|
||||
static void ares_llist_node_detach(ares_llist_node_t *node)
|
||||
{
|
||||
ares__llist_t *list;
|
||||
ares_llist_t *list;
|
||||
|
||||
if (node == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
|
|
@ -293,7 +289,7 @@ static void ares__llist_node_detach(ares__llist_node_t *node)
|
|||
list->cnt--;
|
||||
}
|
||||
|
||||
void *ares__llist_node_claim(ares__llist_node_t *node)
|
||||
void *ares_llist_node_claim(ares_llist_node_t *node)
|
||||
{
|
||||
void *val;
|
||||
|
||||
|
|
@ -302,16 +298,16 @@ void *ares__llist_node_claim(ares__llist_node_t *node)
|
|||
}
|
||||
|
||||
val = node->data;
|
||||
ares__llist_node_detach(node);
|
||||
ares_llist_node_detach(node);
|
||||
ares_free(node);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void ares__llist_node_destroy(ares__llist_node_t *node)
|
||||
void ares_llist_node_destroy(ares_llist_node_t *node)
|
||||
{
|
||||
ares__llist_destructor_t destruct;
|
||||
void *val;
|
||||
ares_llist_destructor_t destruct;
|
||||
void *val;
|
||||
|
||||
if (node == NULL) {
|
||||
return;
|
||||
|
|
@ -319,15 +315,15 @@ void ares__llist_node_destroy(ares__llist_node_t *node)
|
|||
|
||||
destruct = node->parent->destruct;
|
||||
|
||||
val = ares__llist_node_claim(node);
|
||||
val = ares_llist_node_claim(node);
|
||||
if (val != NULL && destruct != NULL) {
|
||||
destruct(val);
|
||||
}
|
||||
}
|
||||
|
||||
void ares__llist_node_replace(ares__llist_node_t *node, void *val)
|
||||
void ares_llist_node_replace(ares_llist_node_t *node, void *val)
|
||||
{
|
||||
ares__llist_destructor_t destruct;
|
||||
ares_llist_destructor_t destruct;
|
||||
|
||||
if (node == NULL) {
|
||||
return;
|
||||
|
|
@ -341,46 +337,46 @@ void ares__llist_node_replace(ares__llist_node_t *node, void *val)
|
|||
node->data = val;
|
||||
}
|
||||
|
||||
void ares__llist_clear(ares__llist_t *list)
|
||||
void ares_llist_clear(ares_llist_t *list)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
if (list == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ((node = ares__llist_node_first(list)) != NULL) {
|
||||
ares__llist_node_destroy(node);
|
||||
while ((node = ares_llist_node_first(list)) != NULL) {
|
||||
ares_llist_node_destroy(node);
|
||||
}
|
||||
}
|
||||
|
||||
void ares__llist_destroy(ares__llist_t *list)
|
||||
void ares_llist_destroy(ares_llist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__llist_clear(list);
|
||||
ares_llist_clear(list);
|
||||
ares_free(list);
|
||||
}
|
||||
|
||||
void ares__llist_node_move_parent_last(ares__llist_node_t *node,
|
||||
ares__llist_t *new_parent)
|
||||
void ares_llist_node_mvparent_last(ares_llist_node_t *node,
|
||||
ares_llist_t *new_parent)
|
||||
{
|
||||
if (node == NULL || new_parent == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares__llist_node_detach(node);
|
||||
ares__llist_attach_at(new_parent, ARES__LLIST_INSERT_TAIL, NULL, node);
|
||||
ares_llist_node_detach(node);
|
||||
ares_llist_attach_at(new_parent, ARES__LLIST_INSERT_TAIL, NULL, node);
|
||||
}
|
||||
|
||||
void ares__llist_node_move_parent_first(ares__llist_node_t *node,
|
||||
ares__llist_t *new_parent)
|
||||
void ares_llist_node_mvparent_first(ares_llist_node_t *node,
|
||||
ares_llist_t *new_parent)
|
||||
{
|
||||
if (node == NULL || new_parent == NULL) {
|
||||
return; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares__llist_node_detach(node);
|
||||
ares__llist_attach_at(new_parent, ARES__LLIST_INSERT_HEAD, NULL, node);
|
||||
ares_llist_node_detach(node);
|
||||
ares_llist_attach_at(new_parent, ARES__LLIST_INSERT_HEAD, NULL, node);
|
||||
}
|
||||
|
|
@ -24,39 +24,39 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares__slist.h"
|
||||
#include "ares_slist.h"
|
||||
|
||||
/* SkipList implementation */
|
||||
|
||||
#define ARES__SLIST_START_LEVELS 4
|
||||
|
||||
struct ares__slist {
|
||||
ares_rand_state *rand_state;
|
||||
unsigned char rand_data[8];
|
||||
size_t rand_bits;
|
||||
struct ares_slist {
|
||||
ares_rand_state *rand_state;
|
||||
unsigned char rand_data[8];
|
||||
size_t rand_bits;
|
||||
|
||||
ares__slist_node_t **head;
|
||||
size_t levels;
|
||||
ares__slist_node_t *tail;
|
||||
ares_slist_node_t **head;
|
||||
size_t levels;
|
||||
ares_slist_node_t *tail;
|
||||
|
||||
ares__slist_cmp_t cmp;
|
||||
ares__slist_destructor_t destruct;
|
||||
size_t cnt;
|
||||
ares_slist_cmp_t cmp;
|
||||
ares_slist_destructor_t destruct;
|
||||
size_t cnt;
|
||||
};
|
||||
|
||||
struct ares__slist_node {
|
||||
void *data;
|
||||
ares__slist_node_t **prev;
|
||||
ares__slist_node_t **next;
|
||||
size_t levels;
|
||||
ares__slist_t *parent;
|
||||
struct ares_slist_node {
|
||||
void *data;
|
||||
ares_slist_node_t **prev;
|
||||
ares_slist_node_t **next;
|
||||
size_t levels;
|
||||
ares_slist_t *parent;
|
||||
};
|
||||
|
||||
ares__slist_t *ares__slist_create(ares_rand_state *rand_state,
|
||||
ares__slist_cmp_t cmp,
|
||||
ares__slist_destructor_t destruct)
|
||||
ares_slist_t *ares_slist_create(ares_rand_state *rand_state,
|
||||
ares_slist_cmp_t cmp,
|
||||
ares_slist_destructor_t destruct)
|
||||
{
|
||||
ares__slist_t *list;
|
||||
ares_slist_t *list;
|
||||
|
||||
if (rand_state == NULL || cmp == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -82,18 +82,17 @@ ares__slist_t *ares__slist_create(ares_rand_state *rand_state,
|
|||
return list;
|
||||
}
|
||||
|
||||
static ares_bool_t ares__slist_coin_flip(ares__slist_t *list)
|
||||
static ares_bool_t ares_slist_coin_flip(ares_slist_t *list)
|
||||
{
|
||||
size_t total_bits = sizeof(list->rand_data) * 8;
|
||||
size_t bit;
|
||||
|
||||
/* Refill random data used for coin flips. We pull this in 8 byte chunks.
|
||||
* ares__rand_bytes() has some built-in caching of its own so we don't need
|
||||
* ares_rand_bytes() has some built-in caching of its own so we don't need
|
||||
* to be excessive in caching ourselves. Prefer to require less memory per
|
||||
* skiplist */
|
||||
if (list->rand_bits == 0) {
|
||||
ares__rand_bytes(list->rand_state, list->rand_data,
|
||||
sizeof(list->rand_data));
|
||||
ares_rand_bytes(list->rand_state, list->rand_data, sizeof(list->rand_data));
|
||||
list->rand_bits = total_bits;
|
||||
}
|
||||
|
||||
|
|
@ -103,8 +102,8 @@ static ares_bool_t ares__slist_coin_flip(ares__slist_t *list)
|
|||
return (list->rand_data[bit / 8] & (1 << (bit % 8))) ? ARES_TRUE : ARES_FALSE;
|
||||
}
|
||||
|
||||
void ares__slist_replace_destructor(ares__slist_t *list,
|
||||
ares__slist_destructor_t destruct)
|
||||
void ares_slist_replace_destructor(ares_slist_t *list,
|
||||
ares_slist_destructor_t destruct)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return;
|
||||
|
|
@ -113,14 +112,14 @@ void ares__slist_replace_destructor(ares__slist_t *list,
|
|||
list->destruct = destruct;
|
||||
}
|
||||
|
||||
static size_t ares__slist_max_level(const ares__slist_t *list)
|
||||
static size_t ares_slist_max_level(const ares_slist_t *list)
|
||||
{
|
||||
size_t max_level = 0;
|
||||
|
||||
if (list->cnt + 1 <= (1 << ARES__SLIST_START_LEVELS)) {
|
||||
max_level = ARES__SLIST_START_LEVELS;
|
||||
} else {
|
||||
max_level = ares__log2(ares__round_up_pow2(list->cnt + 1));
|
||||
max_level = ares_log2(ares_round_up_pow2(list->cnt + 1));
|
||||
}
|
||||
|
||||
if (list->levels > max_level) {
|
||||
|
|
@ -130,21 +129,21 @@ static size_t ares__slist_max_level(const ares__slist_t *list)
|
|||
return max_level;
|
||||
}
|
||||
|
||||
static size_t ares__slist_calc_level(ares__slist_t *list)
|
||||
static size_t ares_slist_calc_level(ares_slist_t *list)
|
||||
{
|
||||
size_t max_level = ares__slist_max_level(list);
|
||||
size_t max_level = ares_slist_max_level(list);
|
||||
size_t level;
|
||||
|
||||
for (level = 1; ares__slist_coin_flip(list) && level < max_level; level++)
|
||||
for (level = 1; ares_slist_coin_flip(list) && level < max_level; level++)
|
||||
;
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
static void ares__slist_node_push(ares__slist_t *list, ares__slist_node_t *node)
|
||||
static void ares_slist_node_push(ares_slist_t *list, ares_slist_node_t *node)
|
||||
{
|
||||
size_t i;
|
||||
ares__slist_node_t *left = NULL;
|
||||
size_t i;
|
||||
ares_slist_node_t *left = NULL;
|
||||
|
||||
/* Scan from highest level in the slist, even if we're not using that number
|
||||
* of levels for this entry as this is what makes it O(log n) */
|
||||
|
|
@ -193,9 +192,9 @@ static void ares__slist_node_push(ares__slist_t *list, ares__slist_node_t *node)
|
|||
}
|
||||
}
|
||||
|
||||
ares__slist_node_t *ares__slist_insert(ares__slist_t *list, void *val)
|
||||
ares_slist_node_t *ares_slist_insert(ares_slist_t *list, void *val)
|
||||
{
|
||||
ares__slist_node_t *node = NULL;
|
||||
ares_slist_node_t *node = NULL;
|
||||
|
||||
if (list == NULL || val == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -211,7 +210,7 @@ ares__slist_node_t *ares__slist_insert(ares__slist_t *list, void *val)
|
|||
node->parent = list;
|
||||
|
||||
/* Randomly determine the number of levels we want to use */
|
||||
node->levels = ares__slist_calc_level(list);
|
||||
node->levels = ares_slist_calc_level(list);
|
||||
|
||||
/* Allocate array of next and prev nodes for linking each level */
|
||||
node->next = ares_malloc_zero(sizeof(*node->next) * node->levels);
|
||||
|
|
@ -238,7 +237,7 @@ ares__slist_node_t *ares__slist_insert(ares__slist_t *list, void *val)
|
|||
list->levels = node->levels;
|
||||
}
|
||||
|
||||
ares__slist_node_push(list, node);
|
||||
ares_slist_node_push(list, node);
|
||||
|
||||
list->cnt++;
|
||||
|
||||
|
|
@ -255,10 +254,10 @@ fail:
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
static void ares__slist_node_pop(ares__slist_node_t *node)
|
||||
static void ares_slist_node_pop(ares_slist_node_t *node)
|
||||
{
|
||||
ares__slist_t *list = node->parent;
|
||||
size_t i;
|
||||
ares_slist_t *list = node->parent;
|
||||
size_t i;
|
||||
|
||||
/* relink each node at each level */
|
||||
for (i = node->levels; i-- > 0;) {
|
||||
|
|
@ -281,10 +280,10 @@ static void ares__slist_node_pop(ares__slist_node_t *node)
|
|||
memset(node->prev, 0, sizeof(*node->prev) * node->levels);
|
||||
}
|
||||
|
||||
void *ares__slist_node_claim(ares__slist_node_t *node)
|
||||
void *ares_slist_node_claim(ares_slist_node_t *node)
|
||||
{
|
||||
ares__slist_t *list;
|
||||
void *val;
|
||||
ares_slist_t *list;
|
||||
void *val;
|
||||
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -293,7 +292,7 @@ void *ares__slist_node_claim(ares__slist_node_t *node)
|
|||
list = node->parent;
|
||||
val = node->data;
|
||||
|
||||
ares__slist_node_pop(node);
|
||||
ares_slist_node_pop(node);
|
||||
|
||||
ares_free(node->next);
|
||||
ares_free(node->prev);
|
||||
|
|
@ -304,9 +303,9 @@ void *ares__slist_node_claim(ares__slist_node_t *node)
|
|||
return val;
|
||||
}
|
||||
|
||||
void ares__slist_node_reinsert(ares__slist_node_t *node)
|
||||
void ares_slist_node_reinsert(ares_slist_node_t *node)
|
||||
{
|
||||
ares__slist_t *list;
|
||||
ares_slist_t *list;
|
||||
|
||||
if (node == NULL) {
|
||||
return;
|
||||
|
|
@ -314,15 +313,16 @@ void ares__slist_node_reinsert(ares__slist_node_t *node)
|
|||
|
||||
list = node->parent;
|
||||
|
||||
ares__slist_node_pop(node);
|
||||
ares__slist_node_push(list, node);
|
||||
ares_slist_node_pop(node);
|
||||
ares_slist_node_push(list, node);
|
||||
}
|
||||
|
||||
ares__slist_node_t *ares__slist_node_find(ares__slist_t *list, const void *val)
|
||||
ares_slist_node_t *ares_slist_node_find(const ares_slist_t *list,
|
||||
const void *val)
|
||||
{
|
||||
size_t i;
|
||||
ares__slist_node_t *node = NULL;
|
||||
int rv = -1;
|
||||
size_t i;
|
||||
ares_slist_node_t *node = NULL;
|
||||
int rv = -1;
|
||||
|
||||
if (list == NULL || val == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -377,7 +377,7 @@ ares__slist_node_t *ares__slist_node_find(ares__slist_t *list, const void *val)
|
|||
return node;
|
||||
}
|
||||
|
||||
ares__slist_node_t *ares__slist_node_first(ares__slist_t *list)
|
||||
ares_slist_node_t *ares_slist_node_first(const ares_slist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -386,7 +386,7 @@ ares__slist_node_t *ares__slist_node_first(ares__slist_t *list)
|
|||
return list->head[0];
|
||||
}
|
||||
|
||||
ares__slist_node_t *ares__slist_node_last(ares__slist_t *list)
|
||||
ares_slist_node_t *ares_slist_node_last(const ares_slist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -394,7 +394,7 @@ ares__slist_node_t *ares__slist_node_last(ares__slist_t *list)
|
|||
return list->tail;
|
||||
}
|
||||
|
||||
ares__slist_node_t *ares__slist_node_next(ares__slist_node_t *node)
|
||||
ares_slist_node_t *ares_slist_node_next(const ares_slist_node_t *node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -402,7 +402,7 @@ ares__slist_node_t *ares__slist_node_next(ares__slist_node_t *node)
|
|||
return node->next[0];
|
||||
}
|
||||
|
||||
ares__slist_node_t *ares__slist_node_prev(ares__slist_node_t *node)
|
||||
ares_slist_node_t *ares_slist_node_prev(const ares_slist_node_t *node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -410,7 +410,7 @@ ares__slist_node_t *ares__slist_node_prev(ares__slist_node_t *node)
|
|||
return node->prev[0];
|
||||
}
|
||||
|
||||
void *ares__slist_node_val(ares__slist_node_t *node)
|
||||
void *ares_slist_node_val(ares_slist_node_t *node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -419,7 +419,7 @@ void *ares__slist_node_val(ares__slist_node_t *node)
|
|||
return node->data;
|
||||
}
|
||||
|
||||
size_t ares__slist_len(const ares__slist_t *list)
|
||||
size_t ares_slist_len(const ares_slist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return 0;
|
||||
|
|
@ -427,7 +427,7 @@ size_t ares__slist_len(const ares__slist_t *list)
|
|||
return list->cnt;
|
||||
}
|
||||
|
||||
ares__slist_t *ares__slist_node_parent(ares__slist_node_t *node)
|
||||
ares_slist_t *ares_slist_node_parent(ares_slist_node_t *node)
|
||||
{
|
||||
if (node == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -435,43 +435,43 @@ ares__slist_t *ares__slist_node_parent(ares__slist_node_t *node)
|
|||
return node->parent;
|
||||
}
|
||||
|
||||
void *ares__slist_first_val(ares__slist_t *list)
|
||||
void *ares_slist_first_val(const ares_slist_t *list)
|
||||
{
|
||||
return ares__slist_node_val(ares__slist_node_first(list));
|
||||
return ares_slist_node_val(ares_slist_node_first(list));
|
||||
}
|
||||
|
||||
void *ares__slist_last_val(ares__slist_t *list)
|
||||
void *ares_slist_last_val(const ares_slist_t *list)
|
||||
{
|
||||
return ares__slist_node_val(ares__slist_node_last(list));
|
||||
return ares_slist_node_val(ares_slist_node_last(list));
|
||||
}
|
||||
|
||||
void ares__slist_node_destroy(ares__slist_node_t *node)
|
||||
void ares_slist_node_destroy(ares_slist_node_t *node)
|
||||
{
|
||||
ares__slist_destructor_t destruct;
|
||||
void *val;
|
||||
ares_slist_destructor_t destruct;
|
||||
void *val;
|
||||
|
||||
if (node == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
destruct = node->parent->destruct;
|
||||
val = ares__slist_node_claim(node);
|
||||
val = ares_slist_node_claim(node);
|
||||
|
||||
if (val != NULL && destruct != NULL) {
|
||||
destruct(val);
|
||||
}
|
||||
}
|
||||
|
||||
void ares__slist_destroy(ares__slist_t *list)
|
||||
void ares_slist_destroy(ares_slist_t *list)
|
||||
{
|
||||
ares__slist_node_t *node;
|
||||
ares_slist_node_t *node;
|
||||
|
||||
if (list == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ((node = ares__slist_node_first(list)) != NULL) {
|
||||
ares__slist_node_destroy(node);
|
||||
while ((node = ares_slist_node_first(list)) != NULL) {
|
||||
ares_slist_node_destroy(node);
|
||||
}
|
||||
|
||||
ares_free(list->head);
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#define __ARES__SLIST_H
|
||||
|
||||
|
||||
/*! \addtogroup ares__slist SkipList Data Structure
|
||||
/*! \addtogroup ares_slist SkipList Data Structure
|
||||
*
|
||||
* This data structure is known as a Skip List, which in essence is a sorted
|
||||
* linked list with multiple levels of linkage to gain some algorithmic
|
||||
|
|
@ -49,21 +49,21 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
struct ares__slist;
|
||||
struct ares_slist;
|
||||
|
||||
/*! SkipList Object, opaque */
|
||||
typedef struct ares__slist ares__slist_t;
|
||||
typedef struct ares_slist ares_slist_t;
|
||||
|
||||
struct ares__slist_node;
|
||||
struct ares_slist_node;
|
||||
|
||||
/*! SkipList Node Object, opaque */
|
||||
typedef struct ares__slist_node ares__slist_node_t;
|
||||
typedef struct ares_slist_node ares_slist_node_t;
|
||||
|
||||
/*! SkipList Node Value destructor callback
|
||||
*
|
||||
* \param[in] data User-defined data to destroy
|
||||
*/
|
||||
typedef void (*ares__slist_destructor_t)(void *data);
|
||||
typedef void (*ares_slist_destructor_t)(void *data);
|
||||
|
||||
/*! SkipList comparison function
|
||||
*
|
||||
|
|
@ -71,7 +71,7 @@ typedef void (*ares__slist_destructor_t)(void *data);
|
|||
* \param[in] data2 Second user-defined data object
|
||||
* \return < 0 if data1 < data1, > 0 if data1 > data2, 0 if data1 == data2
|
||||
*/
|
||||
typedef int (*ares__slist_cmp_t)(const void *data1, const void *data2);
|
||||
typedef int (*ares_slist_cmp_t)(const void *data1, const void *data2);
|
||||
|
||||
/*! Create SkipList
|
||||
*
|
||||
|
|
@ -80,17 +80,17 @@ typedef int (*ares__slist_cmp_t)(const void *data1, const void *data2);
|
|||
* \param[in] destruct SkipList Node Value Destructor. Optional, use NULL.
|
||||
* \return Initialized SkipList Object or NULL on misuse or ENOMEM
|
||||
*/
|
||||
ares__slist_t *ares__slist_create(ares_rand_state *rand_state,
|
||||
ares__slist_cmp_t cmp,
|
||||
ares__slist_destructor_t destruct);
|
||||
ares_slist_t *ares_slist_create(ares_rand_state *rand_state,
|
||||
ares_slist_cmp_t cmp,
|
||||
ares_slist_destructor_t destruct);
|
||||
|
||||
/*! Replace SkipList Node Value Destructor
|
||||
*
|
||||
* \param[in] list Initialized SkipList Object
|
||||
* \param[in] destruct Replacement destructor. May be NULL.
|
||||
*/
|
||||
void ares__slist_replace_destructor(ares__slist_t *list,
|
||||
ares__slist_destructor_t destruct);
|
||||
void ares_slist_replace_destructor(ares_slist_t *list,
|
||||
ares_slist_destructor_t destruct);
|
||||
|
||||
/*! Insert Value into SkipList
|
||||
*
|
||||
|
|
@ -99,35 +99,35 @@ void ares__slist_replace_destructor(ares__slist_t *list
|
|||
* and will have destructor called.
|
||||
* \return SkipList Node Object or NULL on misuse or ENOMEM
|
||||
*/
|
||||
ares__slist_node_t *ares__slist_insert(ares__slist_t *list, void *val);
|
||||
ares_slist_node_t *ares_slist_insert(ares_slist_t *list, void *val);
|
||||
|
||||
/*! Fetch first node in SkipList
|
||||
*
|
||||
* \param[in] list Initialized SkipList Object
|
||||
* \return SkipList Node Object or NULL if none
|
||||
*/
|
||||
ares__slist_node_t *ares__slist_node_first(ares__slist_t *list);
|
||||
ares_slist_node_t *ares_slist_node_first(const ares_slist_t *list);
|
||||
|
||||
/*! Fetch last node in SkipList
|
||||
*
|
||||
* \param[in] list Initialized SkipList Object
|
||||
* \return SkipList Node Object or NULL if none
|
||||
*/
|
||||
ares__slist_node_t *ares__slist_node_last(ares__slist_t *list);
|
||||
ares_slist_node_t *ares_slist_node_last(const ares_slist_t *list);
|
||||
|
||||
/*! Fetch next node in SkipList
|
||||
*
|
||||
* \param[in] node SkipList Node Object
|
||||
* \return SkipList Node Object or NULL if none
|
||||
*/
|
||||
ares__slist_node_t *ares__slist_node_next(ares__slist_node_t *node);
|
||||
ares_slist_node_t *ares_slist_node_next(const ares_slist_node_t *node);
|
||||
|
||||
/*! Fetch previous node in SkipList
|
||||
*
|
||||
* \param[in] node SkipList Node Object
|
||||
* \return SkipList Node Object or NULL if none
|
||||
*/
|
||||
ares__slist_node_t *ares__slist_node_prev(ares__slist_node_t *node);
|
||||
ares_slist_node_t *ares_slist_node_prev(const ares_slist_node_t *node);
|
||||
|
||||
/*! Fetch SkipList Node Object by Value
|
||||
*
|
||||
|
|
@ -135,7 +135,8 @@ ares__slist_node_t *ares__slist_node_prev(ares__slist_node_t *node);
|
|||
* \param[in] val Object to use for comparison
|
||||
* \return SkipList Node Object or NULL if not found
|
||||
*/
|
||||
ares__slist_node_t *ares__slist_node_find(ares__slist_t *list, const void *val);
|
||||
ares_slist_node_t *ares_slist_node_find(const ares_slist_t *list,
|
||||
const void *val);
|
||||
|
||||
|
||||
/*! Fetch Node Value
|
||||
|
|
@ -143,42 +144,42 @@ ares__slist_node_t *ares__slist_node_find(ares__slist_t *list, const void *val);
|
|||
* \param[in] node SkipList Node Object
|
||||
* \return user defined node value
|
||||
*/
|
||||
void *ares__slist_node_val(ares__slist_node_t *node);
|
||||
void *ares_slist_node_val(ares_slist_node_t *node);
|
||||
|
||||
/*! Fetch number of entries in SkipList Object
|
||||
*
|
||||
* \param[in] list Initialized SkipList Object
|
||||
* \return number of entries
|
||||
*/
|
||||
size_t ares__slist_len(const ares__slist_t *list);
|
||||
size_t ares_slist_len(const ares_slist_t *list);
|
||||
|
||||
/*! Fetch SkipList Object from SkipList Node
|
||||
*
|
||||
* \param[in] node SkipList Node Object
|
||||
* \return SkipList Object
|
||||
*/
|
||||
ares__slist_t *ares__slist_node_parent(ares__slist_node_t *node);
|
||||
ares_slist_t *ares_slist_node_parent(ares_slist_node_t *node);
|
||||
|
||||
/*! Fetch first Node Value in SkipList
|
||||
*
|
||||
* \param[in] list Initialized SkipList Object
|
||||
* \return user defined node value or NULL if none
|
||||
*/
|
||||
void *ares__slist_first_val(ares__slist_t *list);
|
||||
void *ares_slist_first_val(const ares_slist_t *list);
|
||||
|
||||
/*! Fetch last Node Value in SkipList
|
||||
*
|
||||
* \param[in] list Initialized SkipList Object
|
||||
* \return user defined node value or NULL if none
|
||||
*/
|
||||
void *ares__slist_last_val(ares__slist_t *list);
|
||||
void *ares_slist_last_val(const ares_slist_t *list);
|
||||
|
||||
/*! Take back ownership of Node Value in SkipList, remove from SkipList.
|
||||
*
|
||||
* \param[in] node SkipList Node Object
|
||||
* \return user defined node value
|
||||
*/
|
||||
void *ares__slist_node_claim(ares__slist_node_t *node);
|
||||
void *ares_slist_node_claim(ares_slist_node_t *node);
|
||||
|
||||
/*! The internals of the node have changed, thus its position in the sorted
|
||||
* list is no longer valid. This function will remove it and re-add it to
|
||||
|
|
@ -187,19 +188,19 @@ void *ares__slist_node_claim(ares__slist_node_t *node);
|
|||
*
|
||||
* \param[in] node SkipList Node Object
|
||||
*/
|
||||
void ares__slist_node_reinsert(ares__slist_node_t *node);
|
||||
void ares_slist_node_reinsert(ares_slist_node_t *node);
|
||||
|
||||
/*! Remove Node from SkipList, calling destructor for Node Value.
|
||||
*
|
||||
* \param[in] node SkipList Node Object
|
||||
*/
|
||||
void ares__slist_node_destroy(ares__slist_node_t *node);
|
||||
void ares_slist_node_destroy(ares_slist_node_t *node);
|
||||
|
||||
/*! Destroy SkipList Object. If there are any nodes, they will be destroyed.
|
||||
*
|
||||
* \param[in] list Initialized SkipList Object
|
||||
*/
|
||||
void ares__slist_destroy(ares__slist_t *list);
|
||||
void ares_slist_destroy(ares_slist_t *list);
|
||||
|
||||
/*! @} */
|
||||
|
||||
12
deps/cares/src/lib/event/ares_event.h
vendored
12
deps/cares/src/lib/event/ares_event.h
vendored
|
|
@ -90,21 +90,23 @@ struct ares_event_thread {
|
|||
* event before sleeping. */
|
||||
ares_bool_t isup;
|
||||
/*! Handle to the thread for joining during shutdown */
|
||||
ares__thread_t *thread;
|
||||
ares_thread_t *thread;
|
||||
/*! Lock to protect the data contained within the event thread itself */
|
||||
ares__thread_mutex_t *mutex;
|
||||
ares_thread_mutex_t *mutex;
|
||||
/*! Reference to the ares channel, for being able to call things like
|
||||
* ares_timeout() and ares_process_fd(). */
|
||||
ares_channel_t *channel;
|
||||
/*! Whether or not on the next loop we should process a pending write */
|
||||
ares_bool_t process_pending_write;
|
||||
/*! Not-yet-processed event handle updates. These will get enqueued by a
|
||||
* thread other than the event thread itself. The event thread will then
|
||||
* be woken then process these updates itself */
|
||||
ares__llist_t *ev_updates;
|
||||
ares_llist_t *ev_updates;
|
||||
/*! Registered socket event handles */
|
||||
ares__htable_asvp_t *ev_sock_handles;
|
||||
ares_htable_asvp_t *ev_sock_handles;
|
||||
/*! Registered custom event handles. Typically used for external triggering.
|
||||
*/
|
||||
ares__htable_vpvp_t *ev_cust_handles;
|
||||
ares_htable_vpvp_t *ev_cust_handles;
|
||||
/*! Pointer to the event handle which is used to signal and wake the event
|
||||
* thread itself. This is needed to be able to do things like update the
|
||||
* file descriptors being waited on and to wake the event subsystem during
|
||||
|
|
|
|||
54
deps/cares/src/lib/event/ares_event_configchg.c
vendored
54
deps/cares/src/lib/event/ares_event_configchg.c
vendored
|
|
@ -116,8 +116,8 @@ static void ares_event_configchg_cb(ares_event_thread_t *e, ares_socket_t fd,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(event->name, "resolv.conf") == 0 ||
|
||||
strcasecmp(event->name, "nsswitch.conf") == 0) {
|
||||
if (ares_strcaseeq(event->name, "resolv.conf") ||
|
||||
ares_strcaseeq(event->name, "nsswitch.conf")) {
|
||||
triggered = ARES_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -545,17 +545,17 @@ typedef struct {
|
|||
} fileinfo_t;
|
||||
|
||||
struct ares_event_configchg {
|
||||
ares_bool_t isup;
|
||||
ares__thread_t *thread;
|
||||
ares__htable_strvp_t *filestat;
|
||||
ares__thread_mutex_t *lock;
|
||||
ares__thread_cond_t *wake;
|
||||
const char *resolvconf_path;
|
||||
ares_event_thread_t *e;
|
||||
ares_bool_t isup;
|
||||
ares_thread_t *thread;
|
||||
ares_htable_strvp_t *filestat;
|
||||
ares_thread_mutex_t *lock;
|
||||
ares_thread_cond_t *wake;
|
||||
const char *resolvconf_path;
|
||||
ares_event_thread_t *e;
|
||||
};
|
||||
|
||||
static ares_status_t config_change_check(ares__htable_strvp_t *filestat,
|
||||
const char *resolvconf_path)
|
||||
static ares_status_t config_change_check(ares_htable_strvp_t *filestat,
|
||||
const char *resolvconf_path)
|
||||
{
|
||||
size_t i;
|
||||
const char *configfiles[5];
|
||||
|
|
@ -568,7 +568,7 @@ static ares_status_t config_change_check(ares__htable_strvp_t *filestat,
|
|||
configfiles[4] = NULL;
|
||||
|
||||
for (i = 0; configfiles[i] != NULL; i++) {
|
||||
fileinfo_t *fi = ares__htable_strvp_get_direct(filestat, configfiles[i]);
|
||||
fileinfo_t *fi = ares_htable_strvp_get_direct(filestat, configfiles[i]);
|
||||
struct stat st;
|
||||
|
||||
if (stat(configfiles[i], &st) == 0) {
|
||||
|
|
@ -577,7 +577,7 @@ static ares_status_t config_change_check(ares__htable_strvp_t *filestat,
|
|||
if (fi == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
if (!ares__htable_strvp_insert(filestat, configfiles[i], fi)) {
|
||||
if (!ares_htable_strvp_insert(filestat, configfiles[i], fi)) {
|
||||
ares_free(fi);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
|
@ -589,7 +589,7 @@ static ares_status_t config_change_check(ares__htable_strvp_t *filestat,
|
|||
fi->mtime = (time_t)st.st_mtime;
|
||||
} else if (fi != NULL) {
|
||||
/* File no longer exists, remove */
|
||||
ares__htable_strvp_remove(filestat, configfiles[i]);
|
||||
ares_htable_strvp_remove(filestat, configfiles[i]);
|
||||
changed = ARES_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -604,11 +604,11 @@ static void *ares_event_configchg_thread(void *arg)
|
|||
{
|
||||
ares_event_configchg_t *c = arg;
|
||||
|
||||
ares__thread_mutex_lock(c->lock);
|
||||
ares_thread_mutex_lock(c->lock);
|
||||
while (c->isup) {
|
||||
ares_status_t status;
|
||||
|
||||
if (ares__thread_cond_timedwait(c->wake, c->lock, 30000) != ARES_ETIMEOUT) {
|
||||
if (ares_thread_cond_timedwait(c->wake, c->lock, 30000) != ARES_ETIMEOUT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -623,7 +623,7 @@ static void *ares_event_configchg_thread(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
ares__thread_mutex_unlock(c->lock);
|
||||
ares_thread_mutex_unlock(c->lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -643,13 +643,13 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
|||
|
||||
c->e = e;
|
||||
|
||||
c->filestat = ares__htable_strvp_create(ares_free);
|
||||
c->filestat = ares_htable_strvp_create(ares_free);
|
||||
if (c->filestat == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
c->wake = ares__thread_cond_create();
|
||||
c->wake = ares_thread_cond_create();
|
||||
if (c->wake == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
goto done;
|
||||
|
|
@ -666,7 +666,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
|||
}
|
||||
|
||||
c->isup = ARES_TRUE;
|
||||
status = ares__thread_create(&c->thread, ares_event_configchg_thread, c);
|
||||
status = ares_thread_create(&c->thread, ares_event_configchg_thread, c);
|
||||
|
||||
done:
|
||||
if (status != ARES_SUCCESS) {
|
||||
|
|
@ -684,26 +684,26 @@ void ares_event_configchg_destroy(ares_event_configchg_t *configchg)
|
|||
}
|
||||
|
||||
if (configchg->lock) {
|
||||
ares__thread_mutex_lock(configchg->lock);
|
||||
ares_thread_mutex_lock(configchg->lock);
|
||||
}
|
||||
|
||||
configchg->isup = ARES_FALSE;
|
||||
if (configchg->wake) {
|
||||
ares__thread_cond_signal(configchg->wake);
|
||||
ares_thread_cond_signal(configchg->wake);
|
||||
}
|
||||
|
||||
if (configchg->lock) {
|
||||
ares__thread_mutex_unlock(configchg->lock);
|
||||
ares_thread_mutex_unlock(configchg->lock);
|
||||
}
|
||||
|
||||
if (configchg->thread) {
|
||||
void *rv = NULL;
|
||||
ares__thread_join(configchg->thread, &rv);
|
||||
ares_thread_join(configchg->thread, &rv);
|
||||
}
|
||||
|
||||
ares__thread_mutex_destroy(configchg->lock);
|
||||
ares__thread_cond_destroy(configchg->wake);
|
||||
ares__htable_strvp_destroy(configchg->filestat);
|
||||
ares_thread_mutex_destroy(configchg->lock);
|
||||
ares_thread_cond_destroy(configchg->wake);
|
||||
ares_htable_strvp_destroy(configchg->filestat);
|
||||
ares_free(configchg);
|
||||
}
|
||||
|
||||
|
|
|
|||
4
deps/cares/src/lib/event/ares_event_epoll.c
vendored
4
deps/cares/src/lib/event/ares_event_epoll.c
vendored
|
|
@ -161,8 +161,8 @@ static size_t ares_evsys_epoll_wait(ares_event_thread_t *e,
|
|||
ares_event_t *ev;
|
||||
ares_event_flags_t flags = 0;
|
||||
|
||||
ev = ares__htable_asvp_get_direct(e->ev_sock_handles,
|
||||
(ares_socket_t)events[i].data.fd);
|
||||
ev = ares_htable_asvp_get_direct(e->ev_sock_handles,
|
||||
(ares_socket_t)events[i].data.fd);
|
||||
if (ev == NULL || ev->cb == NULL) {
|
||||
continue; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
|
|
|||
4
deps/cares/src/lib/event/ares_event_kqueue.c
vendored
4
deps/cares/src/lib/event/ares_event_kqueue.c
vendored
|
|
@ -217,8 +217,8 @@ static size_t ares_evsys_kqueue_wait(ares_event_thread_t *e,
|
|||
ares_event_t *ev;
|
||||
ares_event_flags_t flags = 0;
|
||||
|
||||
ev = ares__htable_asvp_get_direct(e->ev_sock_handles,
|
||||
(ares_socket_t)events[i].ident);
|
||||
ev = ares_htable_asvp_get_direct(e->ev_sock_handles,
|
||||
(ares_socket_t)events[i].ident);
|
||||
if (ev == NULL || ev->cb == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
6
deps/cares/src/lib/event/ares_event_poll.c
vendored
6
deps/cares/src/lib/event/ares_event_poll.c
vendored
|
|
@ -67,7 +67,7 @@ static size_t ares_evsys_poll_wait(ares_event_thread_t *e,
|
|||
unsigned long timeout_ms)
|
||||
{
|
||||
size_t num_fds = 0;
|
||||
ares_socket_t *fdlist = ares__htable_asvp_keys(e->ev_sock_handles, &num_fds);
|
||||
ares_socket_t *fdlist = ares_htable_asvp_keys(e->ev_sock_handles, &num_fds);
|
||||
struct pollfd *pollfd = NULL;
|
||||
int rv;
|
||||
size_t cnt = 0;
|
||||
|
|
@ -80,7 +80,7 @@ static size_t ares_evsys_poll_wait(ares_event_thread_t *e,
|
|||
}
|
||||
for (i = 0; i < num_fds; i++) {
|
||||
const ares_event_t *ev =
|
||||
ares__htable_asvp_get_direct(e->ev_sock_handles, fdlist[i]);
|
||||
ares_htable_asvp_get_direct(e->ev_sock_handles, fdlist[i]);
|
||||
pollfd[i].fd = ev->fd;
|
||||
if (ev->flags & ARES_EVENT_FLAG_READ) {
|
||||
pollfd[i].events |= POLLIN;
|
||||
|
|
@ -107,7 +107,7 @@ static size_t ares_evsys_poll_wait(ares_event_thread_t *e,
|
|||
|
||||
cnt++;
|
||||
|
||||
ev = ares__htable_asvp_get_direct(e->ev_sock_handles, pollfd[i].fd);
|
||||
ev = ares_htable_asvp_get_direct(e->ev_sock_handles, pollfd[i].fd);
|
||||
if (ev == NULL || ev->cb == NULL) {
|
||||
continue; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
|
|
|||
6
deps/cares/src/lib/event/ares_event_select.c
vendored
6
deps/cares/src/lib/event/ares_event_select.c
vendored
|
|
@ -75,7 +75,7 @@ static size_t ares_evsys_select_wait(ares_event_thread_t *e,
|
|||
unsigned long timeout_ms)
|
||||
{
|
||||
size_t num_fds = 0;
|
||||
ares_socket_t *fdlist = ares__htable_asvp_keys(e->ev_sock_handles, &num_fds);
|
||||
ares_socket_t *fdlist = ares_htable_asvp_keys(e->ev_sock_handles, &num_fds);
|
||||
int rv;
|
||||
size_t cnt = 0;
|
||||
size_t i;
|
||||
|
|
@ -92,7 +92,7 @@ static size_t ares_evsys_select_wait(ares_event_thread_t *e,
|
|||
|
||||
for (i = 0; i < num_fds; i++) {
|
||||
const ares_event_t *ev =
|
||||
ares__htable_asvp_get_direct(e->ev_sock_handles, fdlist[i]);
|
||||
ares_htable_asvp_get_direct(e->ev_sock_handles, fdlist[i]);
|
||||
if (ev->flags & ARES_EVENT_FLAG_READ) {
|
||||
FD_SET(ev->fd, &read_fds);
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ static size_t ares_evsys_select_wait(ares_event_thread_t *e,
|
|||
ares_event_t *ev;
|
||||
ares_event_flags_t flags = 0;
|
||||
|
||||
ev = ares__htable_asvp_get_direct(e->ev_sock_handles, fdlist[i]);
|
||||
ev = ares_htable_asvp_get_direct(e->ev_sock_handles, fdlist[i]);
|
||||
if (ev == NULL || ev->cb == NULL) {
|
||||
continue; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
|
|
|||
121
deps/cares/src/lib/event/ares_event_thread.c
vendored
121
deps/cares/src/lib/event/ares_event_thread.c
vendored
|
|
@ -77,11 +77,11 @@ static void ares_event_thread_wake(const ares_event_thread_t *e)
|
|||
static ares_event_t *ares_event_update_find(ares_event_thread_t *e,
|
||||
ares_socket_t fd, const void *data)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
for (node = ares__llist_node_first(e->ev_updates); node != NULL;
|
||||
node = ares__llist_node_next(node)) {
|
||||
ares_event_t *ev = ares__llist_node_val(node);
|
||||
for (node = ares_llist_node_first(e->ev_updates); node != NULL;
|
||||
node = ares_llist_node_next(node)) {
|
||||
ares_event_t *ev = ares_llist_node_val(node);
|
||||
|
||||
if (fd != ARES_SOCKET_BAD && fd == ev->fd && ev->flags != 0) {
|
||||
return ev;
|
||||
|
|
@ -134,7 +134,7 @@ ares_status_t ares_event_update(ares_event_t **event, ares_event_thread_t *e,
|
|||
|
||||
/* That's all the validation we can really do */
|
||||
|
||||
ares__thread_mutex_lock(e->mutex);
|
||||
ares_thread_mutex_lock(e->mutex);
|
||||
|
||||
/* See if we have a queued update already */
|
||||
ev = ares_event_update_find(e, fd, data);
|
||||
|
|
@ -146,7 +146,7 @@ ares_status_t ares_event_update(ares_event_t **event, ares_event_thread_t *e,
|
|||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
if (ares__llist_insert_last(e->ev_updates, ev) == NULL) {
|
||||
if (ares_llist_insert_last(e->ev_updates, ev) == NULL) {
|
||||
ares_free(ev); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
|
|
@ -180,7 +180,7 @@ done:
|
|||
ares_event_thread_wake(e);
|
||||
}
|
||||
|
||||
ares__thread_mutex_unlock(e->mutex);
|
||||
ares_thread_mutex_unlock(e->mutex);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
@ -189,11 +189,18 @@ static void ares_event_thread_process_fd(ares_event_thread_t *e,
|
|||
ares_socket_t fd, void *data,
|
||||
ares_event_flags_t flags)
|
||||
{
|
||||
ares_fd_events_t event;
|
||||
(void)data;
|
||||
|
||||
ares_process_fd(e->channel,
|
||||
(flags & ARES_EVENT_FLAG_READ) ? fd : ARES_SOCKET_BAD,
|
||||
(flags & ARES_EVENT_FLAG_WRITE) ? fd : ARES_SOCKET_BAD);
|
||||
event.fd = fd;
|
||||
event.events = 0;
|
||||
if (flags & ARES_EVENT_FLAG_READ) {
|
||||
event.events |= ARES_FD_EVENT_READ;
|
||||
}
|
||||
if (flags & ARES_EVENT_FLAG_WRITE) {
|
||||
event.events |= ARES_FD_EVENT_WRITE;
|
||||
}
|
||||
ares_process_fds(e->channel, &event, 1, ARES_PROCESS_FLAG_SKIP_NON_FD);
|
||||
}
|
||||
|
||||
static void ares_event_thread_sockstate_cb(void *data, ares_socket_t socket_fd,
|
||||
|
|
@ -216,20 +223,31 @@ static void ares_event_thread_sockstate_cb(void *data, ares_socket_t socket_fd,
|
|||
NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void notifywrite_cb(void *data)
|
||||
{
|
||||
ares_event_thread_t *e = data;
|
||||
|
||||
ares_thread_mutex_lock(e->mutex);
|
||||
e->process_pending_write = ARES_TRUE;
|
||||
ares_thread_mutex_unlock(e->mutex);
|
||||
|
||||
ares_event_thread_wake(e);
|
||||
}
|
||||
|
||||
static void ares_event_process_updates(ares_event_thread_t *e)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
/* Iterate across all updates and apply to internal list, removing from update
|
||||
* list */
|
||||
while ((node = ares__llist_node_first(e->ev_updates)) != NULL) {
|
||||
ares_event_t *newev = ares__llist_node_claim(node);
|
||||
while ((node = ares_llist_node_first(e->ev_updates)) != NULL) {
|
||||
ares_event_t *newev = ares_llist_node_claim(node);
|
||||
ares_event_t *oldev;
|
||||
|
||||
if (newev->fd == ARES_SOCKET_BAD) {
|
||||
oldev = ares__htable_vpvp_get_direct(e->ev_cust_handles, newev->data);
|
||||
oldev = ares_htable_vpvp_get_direct(e->ev_cust_handles, newev->data);
|
||||
} else {
|
||||
oldev = ares__htable_asvp_get_direct(e->ev_sock_handles, newev->fd);
|
||||
oldev = ares_htable_asvp_get_direct(e->ev_sock_handles, newev->fd);
|
||||
}
|
||||
|
||||
/* Adding new */
|
||||
|
|
@ -244,9 +262,9 @@ static void ares_event_process_updates(ares_event_thread_t *e)
|
|||
ares_event_destroy_cb(newev);
|
||||
} else {
|
||||
if (newev->fd == ARES_SOCKET_BAD) {
|
||||
ares__htable_vpvp_insert(e->ev_cust_handles, newev->data, newev);
|
||||
ares_htable_vpvp_insert(e->ev_cust_handles, newev->data, newev);
|
||||
} else {
|
||||
ares__htable_asvp_insert(e->ev_sock_handles, newev->fd, newev);
|
||||
ares_htable_asvp_insert(e->ev_sock_handles, newev->fd, newev);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
|
@ -257,9 +275,9 @@ static void ares_event_process_updates(ares_event_thread_t *e)
|
|||
/* the callback for the removal will call e->ev_sys->event_del(e, event)
|
||||
*/
|
||||
if (newev->fd == ARES_SOCKET_BAD) {
|
||||
ares__htable_vpvp_remove(e->ev_cust_handles, newev->data);
|
||||
ares_htable_vpvp_remove(e->ev_cust_handles, newev->data);
|
||||
} else {
|
||||
ares__htable_asvp_remove(e->ev_sock_handles, newev->fd);
|
||||
ares_htable_asvp_remove(e->ev_sock_handles, newev->fd);
|
||||
}
|
||||
ares_free(newev);
|
||||
continue;
|
||||
|
|
@ -276,22 +294,22 @@ static void ares_event_thread_cleanup(ares_event_thread_t *e)
|
|||
{
|
||||
/* Manually free any updates that weren't processed */
|
||||
if (e->ev_updates != NULL) {
|
||||
ares__llist_node_t *node;
|
||||
ares_llist_node_t *node;
|
||||
|
||||
while ((node = ares__llist_node_first(e->ev_updates)) != NULL) {
|
||||
ares_event_destroy_cb(ares__llist_node_claim(node));
|
||||
while ((node = ares_llist_node_first(e->ev_updates)) != NULL) {
|
||||
ares_event_destroy_cb(ares_llist_node_claim(node));
|
||||
}
|
||||
ares__llist_destroy(e->ev_updates);
|
||||
ares_llist_destroy(e->ev_updates);
|
||||
e->ev_updates = NULL;
|
||||
}
|
||||
|
||||
if (e->ev_sock_handles != NULL) {
|
||||
ares__htable_asvp_destroy(e->ev_sock_handles);
|
||||
ares_htable_asvp_destroy(e->ev_sock_handles);
|
||||
e->ev_sock_handles = NULL;
|
||||
}
|
||||
|
||||
if (e->ev_cust_handles != NULL) {
|
||||
ares__htable_vpvp_destroy(e->ev_cust_handles);
|
||||
ares_htable_vpvp_destroy(e->ev_cust_handles);
|
||||
e->ev_cust_handles = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -304,19 +322,20 @@ static void ares_event_thread_cleanup(ares_event_thread_t *e)
|
|||
static void *ares_event_thread(void *arg)
|
||||
{
|
||||
ares_event_thread_t *e = arg;
|
||||
ares__thread_mutex_lock(e->mutex);
|
||||
ares_thread_mutex_lock(e->mutex);
|
||||
|
||||
while (e->isup) {
|
||||
struct timeval tv;
|
||||
const struct timeval *tvout;
|
||||
unsigned long timeout_ms = 0; /* 0 = unlimited */
|
||||
ares_bool_t process_pending_write;
|
||||
|
||||
ares_event_process_updates(e);
|
||||
|
||||
/* Don't hold a mutex while waiting on events or calling into anything
|
||||
* that might require a c-ares channel lock since a callback could be
|
||||
* triggered cross-thread */
|
||||
ares__thread_mutex_unlock(e->mutex);
|
||||
ares_thread_mutex_unlock(e->mutex);
|
||||
|
||||
tvout = ares_timeout(e->channel, NULL, &tv);
|
||||
if (tvout != NULL) {
|
||||
|
|
@ -326,19 +345,29 @@ static void *ares_event_thread(void *arg)
|
|||
|
||||
e->ev_sys->wait(e, timeout_ms);
|
||||
|
||||
/* Each iteration should do timeout processing */
|
||||
/* Process pending write operation */
|
||||
ares_thread_mutex_lock(e->mutex);
|
||||
process_pending_write = e->process_pending_write;
|
||||
e->process_pending_write = ARES_FALSE;
|
||||
ares_thread_mutex_unlock(e->mutex);
|
||||
if (process_pending_write) {
|
||||
ares_process_pending_write(e->channel);
|
||||
}
|
||||
|
||||
/* Each iteration should do timeout processing and any other cleanup
|
||||
* that may not have been performed */
|
||||
if (e->isup) {
|
||||
ares_process_fd(e->channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
|
||||
ares_process_fds(e->channel, NULL, 0, ARES_PROCESS_FLAG_NONE);
|
||||
}
|
||||
|
||||
/* Relock before we loop again */
|
||||
ares__thread_mutex_lock(e->mutex);
|
||||
ares_thread_mutex_lock(e->mutex);
|
||||
}
|
||||
|
||||
/* Lets cleanup while we're in the thread itself */
|
||||
ares_event_thread_cleanup(e);
|
||||
|
||||
ares__thread_mutex_unlock(e->mutex);
|
||||
ares_thread_mutex_unlock(e->mutex);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -346,17 +375,17 @@ static void *ares_event_thread(void *arg)
|
|||
static void ares_event_thread_destroy_int(ares_event_thread_t *e)
|
||||
{
|
||||
/* Wake thread and tell it to shutdown if it exists */
|
||||
ares__thread_mutex_lock(e->mutex);
|
||||
ares_thread_mutex_lock(e->mutex);
|
||||
if (e->isup) {
|
||||
e->isup = ARES_FALSE;
|
||||
ares_event_thread_wake(e);
|
||||
}
|
||||
ares__thread_mutex_unlock(e->mutex);
|
||||
ares_thread_mutex_unlock(e->mutex);
|
||||
|
||||
/* Wait for thread to shutdown */
|
||||
if (e->thread) {
|
||||
void *rv = NULL;
|
||||
ares__thread_join(e->thread, &rv);
|
||||
ares_thread_join(e->thread, &rv);
|
||||
e->thread = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -364,7 +393,7 @@ static void ares_event_thread_destroy_int(ares_event_thread_t *e)
|
|||
* as it runs this same cleanup when it shuts down */
|
||||
ares_event_thread_cleanup(e);
|
||||
|
||||
ares__thread_mutex_destroy(e->mutex);
|
||||
ares_thread_mutex_destroy(e->mutex);
|
||||
e->mutex = NULL;
|
||||
|
||||
ares_free(e);
|
||||
|
|
@ -379,8 +408,10 @@ void ares_event_thread_destroy(ares_channel_t *channel)
|
|||
}
|
||||
|
||||
ares_event_thread_destroy_int(e);
|
||||
channel->sock_state_cb_data = NULL;
|
||||
channel->sock_state_cb = NULL;
|
||||
channel->sock_state_cb_data = NULL;
|
||||
channel->sock_state_cb = NULL;
|
||||
channel->notify_pending_write_cb = NULL;
|
||||
channel->notify_pending_write_cb_data = NULL;
|
||||
}
|
||||
|
||||
static const ares_event_sys_t *ares_event_fetch_sys(ares_evsys_t evsys)
|
||||
|
|
@ -451,25 +482,25 @@ ares_status_t ares_event_thread_init(ares_channel_t *channel)
|
|||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
e->mutex = ares__thread_mutex_create();
|
||||
e->mutex = ares_thread_mutex_create();
|
||||
if (e->mutex == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
e->ev_updates = ares__llist_create(NULL);
|
||||
e->ev_updates = ares_llist_create(NULL);
|
||||
if (e->ev_updates == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
e->ev_sock_handles = ares__htable_asvp_create(ares_event_destroy_cb);
|
||||
e->ev_sock_handles = ares_htable_asvp_create(ares_event_destroy_cb);
|
||||
if (e->ev_sock_handles == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
e->ev_cust_handles = ares__htable_vpvp_create(NULL, ares_event_destroy_cb);
|
||||
e->ev_cust_handles = ares_htable_vpvp_create(NULL, ares_event_destroy_cb);
|
||||
if (e->ev_cust_handles == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
|
|
@ -483,8 +514,10 @@ ares_status_t ares_event_thread_init(ares_channel_t *channel)
|
|||
return ARES_ENOTIMP; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
channel->sock_state_cb = ares_event_thread_sockstate_cb;
|
||||
channel->sock_state_cb_data = e;
|
||||
channel->sock_state_cb = ares_event_thread_sockstate_cb;
|
||||
channel->sock_state_cb_data = e;
|
||||
channel->notify_pending_write_cb = notifywrite_cb;
|
||||
channel->notify_pending_write_cb_data = e;
|
||||
|
||||
if (!e->ev_sys->init(e)) {
|
||||
/* LCOV_EXCL_START: UntestablePath */
|
||||
|
|
@ -503,7 +536,7 @@ ares_status_t ares_event_thread_init(ares_channel_t *channel)
|
|||
ares_event_process_updates(e);
|
||||
|
||||
/* Start thread */
|
||||
if (ares__thread_create(&e->thread, ares_event_thread, e) != ARES_SUCCESS) {
|
||||
if (ares_thread_create(&e->thread, ares_event_thread, e) != ARES_SUCCESS) {
|
||||
/* LCOV_EXCL_START: UntestablePath */
|
||||
ares_event_thread_destroy_int(e);
|
||||
channel->sock_state_cb = NULL;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user