diff --git a/cmake/headers.cmake b/cmake/headers.cmake index 9253040b5fc..9da112cd30b 100755 --- a/cmake/headers.cmake +++ b/cmake/headers.cmake @@ -37,6 +37,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/${FLB_PATH_LIB_JANSSON}/include ${CMAKE_CURRENT_BINARY_DIR}/lib/cmetrics + ${CMAKE_CURRENT_BINARY_DIR}/lib/cprofiles/include ${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/lib/monkey/include/ diff --git a/cmake/libraries.cmake b/cmake/libraries.cmake index f92abcf452c..c802f54c07e 100644 --- a/cmake/libraries.cmake +++ b/cmake/libraries.cmake @@ -20,7 +20,7 @@ set(FLB_PATH_LIB_ONIGMO "lib/onigmo") set(FLB_PATH_LIB_MPACK "lib/mpack-amalgamation-1.1.1") set(FLB_PATH_LIB_MINIZ "lib/miniz") set(FLB_PATH_LIB_TUTF8E "lib/tutf8e") -set(FLB_PATH_LIB_CARES "lib/c-ares-1.33.1") +set(FLB_PATH_LIB_CARES "lib/c-ares-1.34.4") set(FLB_PATH_LIB_SNAPPY "lib/snappy-fef67ac") set(FLB_PATH_LIB_RDKAFKA "lib/librdkafka-2.4.0") set(FLB_PATH_LIB_RING_BUFFER "lib/lwrb") diff --git a/lib/c-ares-1.33.1/RELEASE-NOTES.md b/lib/c-ares-1.33.1/RELEASE-NOTES.md deleted file mode 100644 index e9c04953dc6..00000000000 --- a/lib/c-ares-1.33.1/RELEASE-NOTES.md +++ /dev/null @@ -1,65 +0,0 @@ -## c-ares version 1.33.1 - August 23 2024 - -This is a bugfix release. - -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 - -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) - -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) - -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) - - -Thanks go to these friendly people for their efforts and contributions for this -release: - -* Brad House (@bradh352) -* Yauheni Khnykin (@Hsilgos) - diff --git a/lib/c-ares-1.33.1/docs/adig.1 b/lib/c-ares-1.33.1/docs/adig.1 deleted file mode 100644 index 59923790587..00000000000 --- a/lib/c-ares-1.33.1/docs/adig.1 +++ /dev/null @@ -1,67 +0,0 @@ -.\" -.\" Copyright (C) the Massachusetts Institute of Technology. -.\" Copyright (C) Daniel Stenberg -.\" SPDX-License-Identifier: MIT -.\" -.TH ADIG "1" "April 2011" "c-ares utilities" -.SH NAME -adig \- print information collected from Domain Name System (DNS) servers -.SH SYNOPSIS -.B adig -[\fIOPTION\fR]... \fINAME\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, -1.2.3.10.in-addr.arpa). -.PP -This utility comes with the \fBc\-ares\fR asynchronous resolver library. -.SH OPTIONS -.TP -\fB\-c\fR class -Set the query class. -Possible values for class are -ANY, CHAOS, HS and IN (default). -.TP -\fB\-d\fR -Print some extra debugging output. -.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. -.TP -\fB\-h\fR, \fB\-?\fR -Display this help and exit. -.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. -.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. -.TP -\fB\-T\fR port -Connect to the specified TCP port of DNS server. -.TP -\fB\-U\fR port -Connect to the specified UDP port of DNS server. - -.SH "REPORTING BUGS" -Report bugs to the c-ares mailing list: -.br -\fBhttps://lists.haxx.se/listinfo/c-ares\fR -.SH "SEE ALSO" -.PP -ahost(1). diff --git a/lib/c-ares-1.33.1/docs/ares_process.3 b/lib/c-ares-1.33.1/docs/ares_process.3 deleted file mode 100644 index d45d92a6259..00000000000 --- a/lib/c-ares-1.33.1/docs/ares_process.3 +++ /dev/null @@ -1,64 +0,0 @@ -.\" -.\" Copyright 1998 by the Massachusetts Institute of Technology. -.\" SPDX-License-Identifier: MIT -.\" -.TH ARES_PROCESS 3 "25 July 1998" -.SH NAME -ares_process \- Process events for name resolution -.SH SYNOPSIS -.nf -#include - -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). - -The \fBares_process(3)\fP function will invoke callbacks for pending queries -if they complete successfully or fail. - -\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. - -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: - -.nf -int nfds, count; -fd_set readers, writers; -struct timeval tv, *tvp; - -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) diff --git a/lib/c-ares-1.33.1/docs/ares_set_servers_csv.3 b/lib/c-ares-1.33.1/docs/ares_set_servers_csv.3 deleted file mode 100644 index 875a156bfb1..00000000000 --- a/lib/c-ares-1.33.1/docs/ares_set_servers_csv.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" -.\" Copyright 2010 by Ben Greear -.\" SPDX-License-Identifier: MIT -.\" -.TH ARES_SET_SERVERS_CSV 3 "5 Dec 2023" -.SH NAME -ares_set_servers_csv, ares_set_servers_ports_csv, ares_get_servers_csv \- Set -or Get a list of DNS servers used for queries. -.SH SYNOPSIS -.nf -#include - -int ares_set_servers_csv(ares_channel_t *\fIchannel\fP, const char* \fIservers\fP) - -int ares_set_servers_ports_csv(ares_channel_t *\fIchannel\fP, const char* \fIservers\fP) - -char *ares_get_servers_csv(const ares_channel_t *\fIchannel\fP) -.fi -.SH DESCRIPTION -The \fBares_set_servers_csv\fP and \fBares_set_servers_ports_csv\fP functions set -the list of DNS servers that c-ares will query. As of v1.22.0 this function can -be called on an active channel with running queries, previously it would return -ARES_ENOTIMP. - -Though not recommended, passing NULL for servers will clear all configured -servers and make an inoperable channel, this may be advantageous for test -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: - -ip[:port][%iface] - -The \fBip\fP may be encapsulated in square brackets ([ ]), and must be if -using ipv6 and also specifying a port. - -The \fBport\fP is optional, and will default to 53 or the value specified in -\fBares_init_options(3)\fP. - -The \fBiface\fP is specific to IPv6 link-local servers (fe80::/10) and should -not otherwise be used. - -For example: - -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 RETURN VALUES -.B ares_set_servers_csv(3) -and -.B ares_set_servers_ports_csv(3) -may return any of the following values: -.TP 15 -.B ARES_SUCCESS -The name servers configuration was successfully initialized. -.TP 15 -.B ARES_ENOMEM -The process's available memory was exhausted. -.TP 15 -.B ARES_ENODATA -The channel data identified by -.IR channel -was invalid. -.TP 15 -.B ARES_ENOTINITIALIZED -c-ares library initialization not yet performed. -.PP -.B ares_get_servers_csv(3) -returns a string representing the servers configured which must be freed with -\fBares_free_string(3)\fP. If it returns NULL, this is an out of memory condition. -.SH SEE ALSO -.BR ares_set_servers (3) -.SH AVAILABILITY -\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. diff --git a/lib/c-ares-1.33.1/docs/ares_set_socket_functions.3 b/lib/c-ares-1.33.1/docs/ares_set_socket_functions.3 deleted file mode 100644 index ab945ed18de..00000000000 --- a/lib/c-ares-1.33.1/docs/ares_set_socket_functions.3 +++ /dev/null @@ -1,101 +0,0 @@ -.\" Copyright (C) Daniel Stenberg -.\" SPDX-License-Identifier: MIT -.TH ARES_SET_SOCKET_FUNCTIONS 3 "13 Dec 2016" -.SH NAME -ares_set_socket_functions \- Set socket io callbacks -.SH SYNOPSIS -.nf -#include - -struct ares_socket_functions { - ares_socket_t (*\fIasocket\fP)(int, int, int, void *); - int (*\fIaclose\fP)(ares_socket_t, void *); - int (*\fIaconnect\fP)(ares_socket_t, const struct sockaddr *, ares_socklen_t, void *); - ares_ssize_t (*\fIarecvfrom\fP)(ares_socket_t, void *, size_t, int, - struct sockaddr *, ares_socklen_t *, void *); - ares_ssize_t (*\fIasendv\fP)(ares_socket_t, const struct iovec *, int, void *); -}; - -void ares_set_socket_functions(ares_channel_t *\fIchannel\fP, - const struct ares_socket_functions * \fIfunctions\fP, - void *\fIuser_data\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. - -.PP -The \fIuser_data\fP value is provided to each callback function invocation to serve as -context. -.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) -.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) -.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) -.br -Initiate a connection to the address indicated by \fIaddr\fP on a socket. See -.BR connect(2) - -.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) -.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) - -.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) -.br -Send data, as provided by the iovec array \fIdata\fP, to the socket endpoint. See -.BR writev(2), - -.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. -.SH AVAILABILITY -Added in c-ares 1.13.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 writev (2) diff --git a/lib/c-ares-1.33.1/m4/ax_append_compile_flags.m4 b/lib/c-ares-1.33.1/m4/ax_append_compile_flags.m4 deleted file mode 100644 index 1f8e70845c2..00000000000 --- a/lib/c-ares-1.33.1/m4/ax_append_compile_flags.m4 +++ /dev/null @@ -1,65 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) -# -# DESCRIPTION -# -# For every FLAG1, FLAG2 it is checked whether the compiler works with the -# flag. If it does, the flag is added FLAGS-VARIABLE -# -# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. -# CFLAGS) is used. During the check the flag is always added to the -# current language's flags. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# NOTE: This macro depends on the AX_APPEND_FLAG and -# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with -# AX_APPEND_LINK_FLAGS. -# -# LICENSE -# -# Copyright (c) 2011 Maarten Bosmans -# -# This program 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 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 3 - -AC_DEFUN([AX_APPEND_COMPILE_FLAGS], -[AC_REQUIRE([AX_CHECK_COMPILE_FLAG]) -AC_REQUIRE([AX_APPEND_FLAG]) -for flag in $1; do - AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3]) -done -])dnl AX_APPEND_COMPILE_FLAGS diff --git a/lib/c-ares-1.33.1/m4/ax_append_flag.m4 b/lib/c-ares-1.33.1/m4/ax_append_flag.m4 deleted file mode 100644 index 1d38b76fb8e..00000000000 --- a/lib/c-ares-1.33.1/m4/ax_append_flag.m4 +++ /dev/null @@ -1,69 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) -# -# DESCRIPTION -# -# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space -# added in between. -# -# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. -# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains -# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly -# FLAG. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# This program 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 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 2 - -AC_DEFUN([AX_APPEND_FLAG], -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX -AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl -AS_VAR_SET_IF(FLAGS, - [case " AS_VAR_GET(FLAGS) " in - *" $1 "*) - AC_RUN_LOG([: FLAGS already contains $1]) - ;; - *) - AC_RUN_LOG([: FLAGS="$FLAGS $1"]) - AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"]) - ;; - esac], - [AS_VAR_SET(FLAGS,["$1"])]) -AS_VAR_POPDEF([FLAGS])dnl -])dnl AX_APPEND_FLAG diff --git a/lib/c-ares-1.33.1/m4/ax_check_compile_flag.m4 b/lib/c-ares-1.33.1/m4/ax_check_compile_flag.m4 deleted file mode 100644 index c3a8d695a1b..00000000000 --- a/lib/c-ares-1.33.1/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,72 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# This program 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 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 2 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/lib/c-ares-1.33.1/src/lib/ares__socket.c b/lib/c-ares-1.33.1/src/lib/ares__socket.c deleted file mode 100644 index 86e281fcdda..00000000000 --- a/lib/c-ares-1.33.1/src/lib/ares__socket.c +++ /dev/null @@ -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 -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_NETINET_TCP_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif - -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_SYS_IOCTL_H -# include -#endif -#ifdef NETWARE -# include -#endif - -#include -#include -#include - -#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; -} diff --git a/lib/c-ares-1.33.1/src/lib/ares_platform.c b/lib/c-ares-1.33.1/src/lib/ares_platform.c deleted file mode 100644 index 8f0a1dbffb8..00000000000 --- a/lib/c-ares-1.33.1/src/lib/ares_platform.c +++ /dev/null @@ -1,11047 +0,0 @@ -/* MIT License - * - * Copyright (c) 1998 Massachusetts Institute of Technology - * Copyright (c) 2004 Daniel Stenberg - * - * 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_platform.h" - -#if defined(_WIN32) && !defined(MSDOS) - -# define V_PLATFORM_WIN32s 0 -# define V_PLATFORM_WIN32_WINDOWS 1 -# define V_PLATFORM_WIN32_NT 2 -# define V_PLATFORM_WIN32_CE 3 - -win_platform ares__getplatform(void) -{ - OSVERSIONINFOEX OsvEx; - - memset(&OsvEx, 0, sizeof(OsvEx)); - OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); -# ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable : 4996) /* warning C4996: 'GetVersionExW': was \ - declared deprecated */ -# endif - if (!GetVersionEx((void *)&OsvEx)) { - memset(&OsvEx, 0, sizeof(OsvEx)); - OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((void *)&OsvEx)) { - return WIN_UNKNOWN; - } - } -# ifdef _MSC_VER -# pragma warning(pop) -# endif - - switch (OsvEx.dwPlatformId) { - case V_PLATFORM_WIN32s: - return WIN_3X; - - case V_PLATFORM_WIN32_WINDOWS: - return WIN_9X; - - case V_PLATFORM_WIN32_NT: - return WIN_NT; - - case V_PLATFORM_WIN32_CE: - return WIN_CE; - - default: - return WIN_UNKNOWN; - } -} - -#endif /* _WIN32 && ! MSDOS */ - -#if defined(_WIN32_WCE) - -/* IANA Well Known Ports are in range 0-1023 */ -# define USE_IANA_WELL_KNOWN_PORTS 1 - -/* IANA Registered Ports are in range 1024-49151 */ -# define USE_IANA_REGISTERED_PORTS 1 - -struct pvt_servent { - char *s_name; - char **s_aliases; - unsigned short s_port; - char *s_proto; -}; - -/* - * Ref: http://www.iana.org/assignments/port-numbers - */ - -static struct pvt_servent IANAports[] = { -# ifdef USE_IANA_WELL_KNOWN_PORTS - { "tcpmux", { NULL }, 1, "tcp" }, - { "tcpmux", { NULL }, 1, "udp" }, - { "compressnet", { NULL }, 2, "tcp" }, - { "compressnet", { NULL }, 2, "udp" }, - { "compressnet", { NULL }, 3, "tcp" }, - { "compressnet", { NULL }, 3, "udp" }, - { "rje", { NULL }, 5, "tcp" }, - { "rje", { NULL }, 5, "udp" }, - { "echo", { NULL }, 7, "tcp" }, - { "echo", { NULL }, 7, "udp" }, - { "discard", { NULL }, 9, "tcp" }, - { "discard", { NULL }, 9, "udp" }, - { "discard", { NULL }, 9, "sctp" }, - { "discard", { NULL }, 9, "dccp" }, - { "systat", { NULL }, 11, "tcp" }, - { "systat", { NULL }, 11, "udp" }, - { "daytime", { NULL }, 13, "tcp" }, - { "daytime", { NULL }, 13, "udp" }, - { "qotd", { NULL }, 17, "tcp" }, - { "qotd", { NULL }, 17, "udp" }, - { "msp", { NULL }, 18, "tcp" }, - { "msp", { NULL }, 18, "udp" }, - { "chargen", { NULL }, 19, "tcp" }, - { "chargen", { NULL }, 19, "udp" }, - { "ftp-data", { NULL }, 20, "tcp" }, - { "ftp-data", { NULL }, 20, "udp" }, - { "ftp-data", { NULL }, 20, "sctp" }, - { "ftp", { NULL }, 21, "tcp" }, - { "ftp", { NULL }, 21, "udp" }, - { "ftp", { NULL }, 21, "sctp" }, - { "ssh", { NULL }, 22, "tcp" }, - { "ssh", { NULL }, 22, "udp" }, - { "ssh", { NULL }, 22, "sctp" }, - { "telnet", { NULL }, 23, "tcp" }, - { "telnet", { NULL }, 23, "udp" }, - { "smtp", { NULL }, 25, "tcp" }, - { "smtp", { NULL }, 25, "udp" }, - { "nsw-fe", { NULL }, 27, "tcp" }, - { "nsw-fe", { NULL }, 27, "udp" }, - { "msg-icp", { NULL }, 29, "tcp" }, - { "msg-icp", { NULL }, 29, "udp" }, - { "msg-auth", { NULL }, 31, "tcp" }, - { "msg-auth", { NULL }, 31, "udp" }, - { "dsp", { NULL }, 33, "tcp" }, - { "dsp", { NULL }, 33, "udp" }, - { "time", { NULL }, 37, "tcp" }, - { "time", { NULL }, 37, "udp" }, - { "rap", { NULL }, 38, "tcp" }, - { "rap", { NULL }, 38, "udp" }, - { "rlp", { NULL }, 39, "tcp" }, - { "rlp", { NULL }, 39, "udp" }, - { "graphics", { NULL }, 41, "tcp" }, - { "graphics", { NULL }, 41, "udp" }, - { "name", { NULL }, 42, "tcp" }, - { "name", { NULL }, 42, "udp" }, - { "nameserver", { NULL }, 42, "tcp" }, - { "nameserver", { NULL }, 42, "udp" }, - { "nicname", { NULL }, 43, "tcp" }, - { "nicname", { NULL }, 43, "udp" }, - { "mpm-flags", { NULL }, 44, "tcp" }, - { "mpm-flags", { NULL }, 44, "udp" }, - { "mpm", { NULL }, 45, "tcp" }, - { "mpm", { NULL }, 45, "udp" }, - { "mpm-snd", { NULL }, 46, "tcp" }, - { "mpm-snd", { NULL }, 46, "udp" }, - { "ni-ftp", { NULL }, 47, "tcp" }, - { "ni-ftp", { NULL }, 47, "udp" }, - { "auditd", { NULL }, 48, "tcp" }, - { "auditd", { NULL }, 48, "udp" }, - { "tacacs", { NULL }, 49, "tcp" }, - { "tacacs", { NULL }, 49, "udp" }, - { "re-mail-ck", { NULL }, 50, "tcp" }, - { "re-mail-ck", { NULL }, 50, "udp" }, - { "la-maint", { NULL }, 51, "tcp" }, - { "la-maint", { NULL }, 51, "udp" }, - { "xns-time", { NULL }, 52, "tcp" }, - { "xns-time", { NULL }, 52, "udp" }, - { "domain", { NULL }, 53, "tcp" }, - { "domain", { NULL }, 53, "udp" }, - { "xns-ch", { NULL }, 54, "tcp" }, - { "xns-ch", { NULL }, 54, "udp" }, - { "isi-gl", { NULL }, 55, "tcp" }, - { "isi-gl", { NULL }, 55, "udp" }, - { "xns-auth", { NULL }, 56, "tcp" }, - { "xns-auth", { NULL }, 56, "udp" }, - { "xns-mail", { NULL }, 58, "tcp" }, - { "xns-mail", { NULL }, 58, "udp" }, - { "ni-mail", { NULL }, 61, "tcp" }, - { "ni-mail", { NULL }, 61, "udp" }, - { "acas", { NULL }, 62, "tcp" }, - { "acas", { NULL }, 62, "udp" }, - { "whois++", { NULL }, 63, "tcp" }, - { "whois++", { NULL }, 63, "udp" }, - { "covia", { NULL }, 64, "tcp" }, - { "covia", { NULL }, 64, "udp" }, - { "tacacs-ds", { NULL }, 65, "tcp" }, - { "tacacs-ds", { NULL }, 65, "udp" }, - { "sql*net", { NULL }, 66, "tcp" }, - { "sql*net", { NULL }, 66, "udp" }, - { "bootps", { NULL }, 67, "tcp" }, - { "bootps", { NULL }, 67, "udp" }, - { "bootpc", { NULL }, 68, "tcp" }, - { "bootpc", { NULL }, 68, "udp" }, - { "tftp", { NULL }, 69, "tcp" }, - { "tftp", { NULL }, 69, "udp" }, - { "gopher", { NULL }, 70, "tcp" }, - { "gopher", { NULL }, 70, "udp" }, - { "netrjs-1", { NULL }, 71, "tcp" }, - { "netrjs-1", { NULL }, 71, "udp" }, - { "netrjs-2", { NULL }, 72, "tcp" }, - { "netrjs-2", { NULL }, 72, "udp" }, - { "netrjs-3", { NULL }, 73, "tcp" }, - { "netrjs-3", { NULL }, 73, "udp" }, - { "netrjs-4", { NULL }, 74, "tcp" }, - { "netrjs-4", { NULL }, 74, "udp" }, - { "deos", { NULL }, 76, "tcp" }, - { "deos", { NULL }, 76, "udp" }, - { "vettcp", { NULL }, 78, "tcp" }, - { "vettcp", { NULL }, 78, "udp" }, - { "finger", { NULL }, 79, "tcp" }, - { "finger", { NULL }, 79, "udp" }, - { "http", { NULL }, 80, "tcp" }, - { "http", { NULL }, 80, "udp" }, - { "www", { NULL }, 80, "tcp" }, - { "www", { NULL }, 80, "udp" }, - { "www-http", { NULL }, 80, "tcp" }, - { "www-http", { NULL }, 80, "udp" }, - { "http", { NULL }, 80, "sctp" }, - { "xfer", { NULL }, 82, "tcp" }, - { "xfer", { NULL }, 82, "udp" }, - { "mit-ml-dev", { NULL }, 83, "tcp" }, - { "mit-ml-dev", { NULL }, 83, "udp" }, - { "ctf", { NULL }, 84, "tcp" }, - { "ctf", { NULL }, 84, "udp" }, - { "mit-ml-dev", { NULL }, 85, "tcp" }, - { "mit-ml-dev", { NULL }, 85, "udp" }, - { "mfcobol", { NULL }, 86, "tcp" }, - { "mfcobol", { NULL }, 86, "udp" }, - { "kerberos", { NULL }, 88, "tcp" }, - { "kerberos", { NULL }, 88, "udp" }, - { "su-mit-tg", { NULL }, 89, "tcp" }, - { "su-mit-tg", { NULL }, 89, "udp" }, - { "dnsix", { NULL }, 90, "tcp" }, - { "dnsix", { NULL }, 90, "udp" }, - { "mit-dov", { NULL }, 91, "tcp" }, - { "mit-dov", { NULL }, 91, "udp" }, - { "npp", { NULL }, 92, "tcp" }, - { "npp", { NULL }, 92, "udp" }, - { "dcp", { NULL }, 93, "tcp" }, - { "dcp", { NULL }, 93, "udp" }, - { "objcall", { NULL }, 94, "tcp" }, - { "objcall", { NULL }, 94, "udp" }, - { "supdup", { NULL }, 95, "tcp" }, - { "supdup", { NULL }, 95, "udp" }, - { "dixie", { NULL }, 96, "tcp" }, - { "dixie", { NULL }, 96, "udp" }, - { "swift-rvf", { NULL }, 97, "tcp" }, - { "swift-rvf", { NULL }, 97, "udp" }, - { "tacnews", { NULL }, 98, "tcp" }, - { "tacnews", { NULL }, 98, "udp" }, - { "metagram", { NULL }, 99, "tcp" }, - { "metagram", { NULL }, 99, "udp" }, - { "newacct", { NULL }, 100, "tcp" }, - { "hostname", { NULL }, 101, "tcp" }, - { "hostname", { NULL }, 101, "udp" }, - { "iso-tsap", { NULL }, 102, "tcp" }, - { "iso-tsap", { NULL }, 102, "udp" }, - { "gppitnp", { NULL }, 103, "tcp" }, - { "gppitnp", { NULL }, 103, "udp" }, - { "acr-nema", { NULL }, 104, "tcp" }, - { "acr-nema", { NULL }, 104, "udp" }, - { "cso", { NULL }, 105, "tcp" }, - { "cso", { NULL }, 105, "udp" }, - { "csnet-ns", { NULL }, 105, "tcp" }, - { "csnet-ns", { NULL }, 105, "udp" }, - { "3com-tsmux", { NULL }, 106, "tcp" }, - { "3com-tsmux", { NULL }, 106, "udp" }, - { "rtelnet", { NULL }, 107, "tcp" }, - { "rtelnet", { NULL }, 107, "udp" }, - { "snagas", { NULL }, 108, "tcp" }, - { "snagas", { NULL }, 108, "udp" }, - { "pop2", { NULL }, 109, "tcp" }, - { "pop2", { NULL }, 109, "udp" }, - { "pop3", { NULL }, 110, "tcp" }, - { "pop3", { NULL }, 110, "udp" }, - { "sunrpc", { NULL }, 111, "tcp" }, - { "sunrpc", { NULL }, 111, "udp" }, - { "mcidas", { NULL }, 112, "tcp" }, - { "mcidas", { NULL }, 112, "udp" }, - { "ident", { NULL }, 113, "tcp" }, - { "auth", { NULL }, 113, "tcp" }, - { "auth", { NULL }, 113, "udp" }, - { "sftp", { NULL }, 115, "tcp" }, - { "sftp", { NULL }, 115, "udp" }, - { "ansanotify", { NULL }, 116, "tcp" }, - { "ansanotify", { NULL }, 116, "udp" }, - { "uucp-path", { NULL }, 117, "tcp" }, - { "uucp-path", { NULL }, 117, "udp" }, - { "sqlserv", { NULL }, 118, "tcp" }, - { "sqlserv", { NULL }, 118, "udp" }, - { "nntp", { NULL }, 119, "tcp" }, - { "nntp", { NULL }, 119, "udp" }, - { "cfdptkt", { NULL }, 120, "tcp" }, - { "cfdptkt", { NULL }, 120, "udp" }, - { "erpc", { NULL }, 121, "tcp" }, - { "erpc", { NULL }, 121, "udp" }, - { "smakynet", { NULL }, 122, "tcp" }, - { "smakynet", { NULL }, 122, "udp" }, - { "ntp", { NULL }, 123, "tcp" }, - { "ntp", { NULL }, 123, "udp" }, - { "ansatrader", { NULL }, 124, "tcp" }, - { "ansatrader", { NULL }, 124, "udp" }, - { "locus-map", { NULL }, 125, "tcp" }, - { "locus-map", { NULL }, 125, "udp" }, - { "nxedit", { NULL }, 126, "tcp" }, - { "nxedit", { NULL }, 126, "udp" }, - { "locus-con", { NULL }, 127, "tcp" }, - { "locus-con", { NULL }, 127, "udp" }, - { "gss-xlicen", { NULL }, 128, "tcp" }, - { "gss-xlicen", { NULL }, 128, "udp" }, - { "pwdgen", { NULL }, 129, "tcp" }, - { "pwdgen", { NULL }, 129, "udp" }, - { "cisco-fna", { NULL }, 130, "tcp" }, - { "cisco-fna", { NULL }, 130, "udp" }, - { "cisco-tna", { NULL }, 131, "tcp" }, - { "cisco-tna", { NULL }, 131, "udp" }, - { "cisco-sys", { NULL }, 132, "tcp" }, - { "cisco-sys", { NULL }, 132, "udp" }, - { "statsrv", { NULL }, 133, "tcp" }, - { "statsrv", { NULL }, 133, "udp" }, - { "ingres-net", { NULL }, 134, "tcp" }, - { "ingres-net", { NULL }, 134, "udp" }, - { "epmap", { NULL }, 135, "tcp" }, - { "epmap", { NULL }, 135, "udp" }, - { "profile", { NULL }, 136, "tcp" }, - { "profile", { NULL }, 136, "udp" }, - { "netbios-ns", { NULL }, 137, "tcp" }, - { "netbios-ns", { NULL }, 137, "udp" }, - { "netbios-dgm", { NULL }, 138, "tcp" }, - { "netbios-dgm", { NULL }, 138, "udp" }, - { "netbios-ssn", { NULL }, 139, "tcp" }, - { "netbios-ssn", { NULL }, 139, "udp" }, - { "emfis-data", { NULL }, 140, "tcp" }, - { "emfis-data", { NULL }, 140, "udp" }, - { "emfis-cntl", { NULL }, 141, "tcp" }, - { "emfis-cntl", { NULL }, 141, "udp" }, - { "bl-idm", { NULL }, 142, "tcp" }, - { "bl-idm", { NULL }, 142, "udp" }, - { "imap", { NULL }, 143, "tcp" }, - { "imap", { NULL }, 143, "udp" }, - { "uma", { NULL }, 144, "tcp" }, - { "uma", { NULL }, 144, "udp" }, - { "uaac", { NULL }, 145, "tcp" }, - { "uaac", { NULL }, 145, "udp" }, - { "iso-tp0", { NULL }, 146, "tcp" }, - { "iso-tp0", { NULL }, 146, "udp" }, - { "iso-ip", { NULL }, 147, "tcp" }, - { "iso-ip", { NULL }, 147, "udp" }, - { "jargon", { NULL }, 148, "tcp" }, - { "jargon", { NULL }, 148, "udp" }, - { "aed-512", { NULL }, 149, "tcp" }, - { "aed-512", { NULL }, 149, "udp" }, - { "sql-net", { NULL }, 150, "tcp" }, - { "sql-net", { NULL }, 150, "udp" }, - { "hems", { NULL }, 151, "tcp" }, - { "hems", { NULL }, 151, "udp" }, - { "bftp", { NULL }, 152, "tcp" }, - { "bftp", { NULL }, 152, "udp" }, - { "sgmp", { NULL }, 153, "tcp" }, - { "sgmp", { NULL }, 153, "udp" }, - { "netsc-prod", { NULL }, 154, "tcp" }, - { "netsc-prod", { NULL }, 154, "udp" }, - { "netsc-dev", { NULL }, 155, "tcp" }, - { "netsc-dev", { NULL }, 155, "udp" }, - { "sqlsrv", { NULL }, 156, "tcp" }, - { "sqlsrv", { NULL }, 156, "udp" }, - { "knet-cmp", { NULL }, 157, "tcp" }, - { "knet-cmp", { NULL }, 157, "udp" }, - { "pcmail-srv", { NULL }, 158, "tcp" }, - { "pcmail-srv", { NULL }, 158, "udp" }, - { "nss-routing", { NULL }, 159, "tcp" }, - { "nss-routing", { NULL }, 159, "udp" }, - { "sgmp-traps", { NULL }, 160, "tcp" }, - { "sgmp-traps", { NULL }, 160, "udp" }, - { "snmp", { NULL }, 161, "tcp" }, - { "snmp", { NULL }, 161, "udp" }, - { "snmptrap", { NULL }, 162, "tcp" }, - { "snmptrap", { NULL }, 162, "udp" }, - { "cmip-man", { NULL }, 163, "tcp" }, - { "cmip-man", { NULL }, 163, "udp" }, - { "cmip-agent", { NULL }, 164, "tcp" }, - { "cmip-agent", { NULL }, 164, "udp" }, - { "xns-courier", { NULL }, 165, "tcp" }, - { "xns-courier", { NULL }, 165, "udp" }, - { "s-net", { NULL }, 166, "tcp" }, - { "s-net", { NULL }, 166, "udp" }, - { "namp", { NULL }, 167, "tcp" }, - { "namp", { NULL }, 167, "udp" }, - { "rsvd", { NULL }, 168, "tcp" }, - { "rsvd", { NULL }, 168, "udp" }, - { "send", { NULL }, 169, "tcp" }, - { "send", { NULL }, 169, "udp" }, - { "print-srv", { NULL }, 170, "tcp" }, - { "print-srv", { NULL }, 170, "udp" }, - { "multiplex", { NULL }, 171, "tcp" }, - { "multiplex", { NULL }, 171, "udp" }, - { "cl/1", { NULL }, 172, "tcp" }, - { "cl/1", { NULL }, 172, "udp" }, - { "xyplex-mux", { NULL }, 173, "tcp" }, - { "xyplex-mux", { NULL }, 173, "udp" }, - { "mailq", { NULL }, 174, "tcp" }, - { "mailq", { NULL }, 174, "udp" }, - { "vmnet", { NULL }, 175, "tcp" }, - { "vmnet", { NULL }, 175, "udp" }, - { "genrad-mux", { NULL }, 176, "tcp" }, - { "genrad-mux", { NULL }, 176, "udp" }, - { "xdmcp", { NULL }, 177, "tcp" }, - { "xdmcp", { NULL }, 177, "udp" }, - { "nextstep", { NULL }, 178, "tcp" }, - { "nextstep", { NULL }, 178, "udp" }, - { "bgp", { NULL }, 179, "tcp" }, - { "bgp", { NULL }, 179, "udp" }, - { "bgp", { NULL }, 179, "sctp" }, - { "ris", { NULL }, 180, "tcp" }, - { "ris", { NULL }, 180, "udp" }, - { "unify", { NULL }, 181, "tcp" }, - { "unify", { NULL }, 181, "udp" }, - { "audit", { NULL }, 182, "tcp" }, - { "audit", { NULL }, 182, "udp" }, - { "ocbinder", { NULL }, 183, "tcp" }, - { "ocbinder", { NULL }, 183, "udp" }, - { "ocserver", { NULL }, 184, "tcp" }, - { "ocserver", { NULL }, 184, "udp" }, - { "remote-kis", { NULL }, 185, "tcp" }, - { "remote-kis", { NULL }, 185, "udp" }, - { "kis", { NULL }, 186, "tcp" }, - { "kis", { NULL }, 186, "udp" }, - { "aci", { NULL }, 187, "tcp" }, - { "aci", { NULL }, 187, "udp" }, - { "mumps", { NULL }, 188, "tcp" }, - { "mumps", { NULL }, 188, "udp" }, - { "qft", { NULL }, 189, "tcp" }, - { "qft", { NULL }, 189, "udp" }, - { "gacp", { NULL }, 190, "tcp" }, - { "gacp", { NULL }, 190, "udp" }, - { "prospero", { NULL }, 191, "tcp" }, - { "prospero", { NULL }, 191, "udp" }, - { "osu-nms", { NULL }, 192, "tcp" }, - { "osu-nms", { NULL }, 192, "udp" }, - { "srmp", { NULL }, 193, "tcp" }, - { "srmp", { NULL }, 193, "udp" }, - { "irc", { NULL }, 194, "tcp" }, - { "irc", { NULL }, 194, "udp" }, - { "dn6-nlm-aud", { NULL }, 195, "tcp" }, - { "dn6-nlm-aud", { NULL }, 195, "udp" }, - { "dn6-smm-red", { NULL }, 196, "tcp" }, - { "dn6-smm-red", { NULL }, 196, "udp" }, - { "dls", { NULL }, 197, "tcp" }, - { "dls", { NULL }, 197, "udp" }, - { "dls-mon", { NULL }, 198, "tcp" }, - { "dls-mon", { NULL }, 198, "udp" }, - { "smux", { NULL }, 199, "tcp" }, - { "smux", { NULL }, 199, "udp" }, - { "src", { NULL }, 200, "tcp" }, - { "src", { NULL }, 200, "udp" }, - { "at-rtmp", { NULL }, 201, "tcp" }, - { "at-rtmp", { NULL }, 201, "udp" }, - { "at-nbp", { NULL }, 202, "tcp" }, - { "at-nbp", { NULL }, 202, "udp" }, - { "at-3", { NULL }, 203, "tcp" }, - { "at-3", { NULL }, 203, "udp" }, - { "at-echo", { NULL }, 204, "tcp" }, - { "at-echo", { NULL }, 204, "udp" }, - { "at-5", { NULL }, 205, "tcp" }, - { "at-5", { NULL }, 205, "udp" }, - { "at-zis", { NULL }, 206, "tcp" }, - { "at-zis", { NULL }, 206, "udp" }, - { "at-7", { NULL }, 207, "tcp" }, - { "at-7", { NULL }, 207, "udp" }, - { "at-8", { NULL }, 208, "tcp" }, - { "at-8", { NULL }, 208, "udp" }, - { "qmtp", { NULL }, 209, "tcp" }, - { "qmtp", { NULL }, 209, "udp" }, - { "z39.50", { NULL }, 210, "tcp" }, - { "z39.50", { NULL }, 210, "udp" }, - { "914c/g", { NULL }, 211, "tcp" }, - { "914c/g", { NULL }, 211, "udp" }, - { "anet", { NULL }, 212, "tcp" }, - { "anet", { NULL }, 212, "udp" }, - { "ipx", { NULL }, 213, "tcp" }, - { "ipx", { NULL }, 213, "udp" }, - { "vmpwscs", { NULL }, 214, "tcp" }, - { "vmpwscs", { NULL }, 214, "udp" }, - { "softpc", { NULL }, 215, "tcp" }, - { "softpc", { NULL }, 215, "udp" }, - { "CAIlic", { NULL }, 216, "tcp" }, - { "CAIlic", { NULL }, 216, "udp" }, - { "dbase", { NULL }, 217, "tcp" }, - { "dbase", { NULL }, 217, "udp" }, - { "mpp", { NULL }, 218, "tcp" }, - { "mpp", { NULL }, 218, "udp" }, - { "uarps", { NULL }, 219, "tcp" }, - { "uarps", { NULL }, 219, "udp" }, - { "imap3", { NULL }, 220, "tcp" }, - { "imap3", { NULL }, 220, "udp" }, - { "fln-spx", { NULL }, 221, "tcp" }, - { "fln-spx", { NULL }, 221, "udp" }, - { "rsh-spx", { NULL }, 222, "tcp" }, - { "rsh-spx", { NULL }, 222, "udp" }, - { "cdc", { NULL }, 223, "tcp" }, - { "cdc", { NULL }, 223, "udp" }, - { "masqdialer", { NULL }, 224, "tcp" }, - { "masqdialer", { NULL }, 224, "udp" }, - { "direct", { NULL }, 242, "tcp" }, - { "direct", { NULL }, 242, "udp" }, - { "sur-meas", { NULL }, 243, "tcp" }, - { "sur-meas", { NULL }, 243, "udp" }, - { "inbusiness", { NULL }, 244, "tcp" }, - { "inbusiness", { NULL }, 244, "udp" }, - { "link", { NULL }, 245, "tcp" }, - { "link", { NULL }, 245, "udp" }, - { "dsp3270", { NULL }, 246, "tcp" }, - { "dsp3270", { NULL }, 246, "udp" }, - { "subntbcst_tftp", { NULL }, 247, "tcp" }, - { "subntbcst_tftp", { NULL }, 247, "udp" }, - { "bhfhs", { NULL }, 248, "tcp" }, - { "bhfhs", { NULL }, 248, "udp" }, - { "rap", { NULL }, 256, "tcp" }, - { "rap", { NULL }, 256, "udp" }, - { "set", { NULL }, 257, "tcp" }, - { "set", { NULL }, 257, "udp" }, - { "esro-gen", { NULL }, 259, "tcp" }, - { "esro-gen", { NULL }, 259, "udp" }, - { "openport", { NULL }, 260, "tcp" }, - { "openport", { NULL }, 260, "udp" }, - { "nsiiops", { NULL }, 261, "tcp" }, - { "nsiiops", { NULL }, 261, "udp" }, - { "arcisdms", { NULL }, 262, "tcp" }, - { "arcisdms", { NULL }, 262, "udp" }, - { "hdap", { NULL }, 263, "tcp" }, - { "hdap", { NULL }, 263, "udp" }, - { "bgmp", { NULL }, 264, "tcp" }, - { "bgmp", { NULL }, 264, "udp" }, - { "x-bone-ctl", { NULL }, 265, "tcp" }, - { "x-bone-ctl", { NULL }, 265, "udp" }, - { "sst", { NULL }, 266, "tcp" }, - { "sst", { NULL }, 266, "udp" }, - { "td-service", { NULL }, 267, "tcp" }, - { "td-service", { NULL }, 267, "udp" }, - { "td-replica", { NULL }, 268, "tcp" }, - { "td-replica", { NULL }, 268, "udp" }, - { "manet", { NULL }, 269, "tcp" }, - { "manet", { NULL }, 269, "udp" }, - { "gist", { NULL }, 270, "udp" }, - { "http-mgmt", { NULL }, 280, "tcp" }, - { "http-mgmt", { NULL }, 280, "udp" }, - { "personal-link", { NULL }, 281, "tcp" }, - { "personal-link", { NULL }, 281, "udp" }, - { "cableport-ax", { NULL }, 282, "tcp" }, - { "cableport-ax", { NULL }, 282, "udp" }, - { "rescap", { NULL }, 283, "tcp" }, - { "rescap", { NULL }, 283, "udp" }, - { "corerjd", { NULL }, 284, "tcp" }, - { "corerjd", { NULL }, 284, "udp" }, - { "fxp", { NULL }, 286, "tcp" }, - { "fxp", { NULL }, 286, "udp" }, - { "k-block", { NULL }, 287, "tcp" }, - { "k-block", { NULL }, 287, "udp" }, - { "novastorbakcup", { NULL }, 308, "tcp" }, - { "novastorbakcup", { NULL }, 308, "udp" }, - { "entrusttime", { NULL }, 309, "tcp" }, - { "entrusttime", { NULL }, 309, "udp" }, - { "bhmds", { NULL }, 310, "tcp" }, - { "bhmds", { NULL }, 310, "udp" }, - { "asip-webadmin", { NULL }, 311, "tcp" }, - { "asip-webadmin", { NULL }, 311, "udp" }, - { "vslmp", { NULL }, 312, "tcp" }, - { "vslmp", { NULL }, 312, "udp" }, - { "magenta-logic", { NULL }, 313, "tcp" }, - { "magenta-logic", { NULL }, 313, "udp" }, - { "opalis-robot", { NULL }, 314, "tcp" }, - { "opalis-robot", { NULL }, 314, "udp" }, - { "dpsi", { NULL }, 315, "tcp" }, - { "dpsi", { NULL }, 315, "udp" }, - { "decauth", { NULL }, 316, "tcp" }, - { "decauth", { NULL }, 316, "udp" }, - { "zannet", { NULL }, 317, "tcp" }, - { "zannet", { NULL }, 317, "udp" }, - { "pkix-timestamp", { NULL }, 318, "tcp" }, - { "pkix-timestamp", { NULL }, 318, "udp" }, - { "ptp-event", { NULL }, 319, "tcp" }, - { "ptp-event", { NULL }, 319, "udp" }, - { "ptp-general", { NULL }, 320, "tcp" }, - { "ptp-general", { NULL }, 320, "udp" }, - { "pip", { NULL }, 321, "tcp" }, - { "pip", { NULL }, 321, "udp" }, - { "rtsps", { NULL }, 322, "tcp" }, - { "rtsps", { NULL }, 322, "udp" }, - { "texar", { NULL }, 333, "tcp" }, - { "texar", { NULL }, 333, "udp" }, - { "pdap", { NULL }, 344, "tcp" }, - { "pdap", { NULL }, 344, "udp" }, - { "pawserv", { NULL }, 345, "tcp" }, - { "pawserv", { NULL }, 345, "udp" }, - { "zserv", { NULL }, 346, "tcp" }, - { "zserv", { NULL }, 346, "udp" }, - { "fatserv", { NULL }, 347, "tcp" }, - { "fatserv", { NULL }, 347, "udp" }, - { "csi-sgwp", { NULL }, 348, "tcp" }, - { "csi-sgwp", { NULL }, 348, "udp" }, - { "mftp", { NULL }, 349, "tcp" }, - { "mftp", { NULL }, 349, "udp" }, - { "matip-type-a", { NULL }, 350, "tcp" }, - { "matip-type-a", { NULL }, 350, "udp" }, - { "matip-type-b", { NULL }, 351, "tcp" }, - { "matip-type-b", { NULL }, 351, "udp" }, - { "bhoetty", { NULL }, 351, "tcp" }, - { "bhoetty", { NULL }, 351, "udp" }, - { "dtag-ste-sb", { NULL }, 352, "tcp" }, - { "dtag-ste-sb", { NULL }, 352, "udp" }, - { "bhoedap4", { NULL }, 352, "tcp" }, - { "bhoedap4", { NULL }, 352, "udp" }, - { "ndsauth", { NULL }, 353, "tcp" }, - { "ndsauth", { NULL }, 353, "udp" }, - { "bh611", { NULL }, 354, "tcp" }, - { "bh611", { NULL }, 354, "udp" }, - { "datex-asn", { NULL }, 355, "tcp" }, - { "datex-asn", { NULL }, 355, "udp" }, - { "cloanto-net-1", { NULL }, 356, "tcp" }, - { "cloanto-net-1", { NULL }, 356, "udp" }, - { "bhevent", { NULL }, 357, "tcp" }, - { "bhevent", { NULL }, 357, "udp" }, - { "shrinkwrap", { NULL }, 358, "tcp" }, - { "shrinkwrap", { NULL }, 358, "udp" }, - { "nsrmp", { NULL }, 359, "tcp" }, - { "nsrmp", { NULL }, 359, "udp" }, - { "scoi2odialog", { NULL }, 360, "tcp" }, - { "scoi2odialog", { NULL }, 360, "udp" }, - { "semantix", { NULL }, 361, "tcp" }, - { "semantix", { NULL }, 361, "udp" }, - { "srssend", { NULL }, 362, "tcp" }, - { "srssend", { NULL }, 362, "udp" }, - { "rsvp_tunnel", { NULL }, 363, "tcp" }, - { "rsvp_tunnel", { NULL }, 363, "udp" }, - { "aurora-cmgr", { NULL }, 364, "tcp" }, - { "aurora-cmgr", { NULL }, 364, "udp" }, - { "dtk", { NULL }, 365, "tcp" }, - { "dtk", { NULL }, 365, "udp" }, - { "odmr", { NULL }, 366, "tcp" }, - { "odmr", { NULL }, 366, "udp" }, - { "mortgageware", { NULL }, 367, "tcp" }, - { "mortgageware", { NULL }, 367, "udp" }, - { "qbikgdp", { NULL }, 368, "tcp" }, - { "qbikgdp", { NULL }, 368, "udp" }, - { "rpc2portmap", { NULL }, 369, "tcp" }, - { "rpc2portmap", { NULL }, 369, "udp" }, - { "codaauth2", { NULL }, 370, "tcp" }, - { "codaauth2", { NULL }, 370, "udp" }, - { "clearcase", { NULL }, 371, "tcp" }, - { "clearcase", { NULL }, 371, "udp" }, - { "ulistproc", { NULL }, 372, "tcp" }, - { "ulistproc", { NULL }, 372, "udp" }, - { "legent-1", { NULL }, 373, "tcp" }, - { "legent-1", { NULL }, 373, "udp" }, - { "legent-2", { NULL }, 374, "tcp" }, - { "legent-2", { NULL }, 374, "udp" }, - { "hassle", { NULL }, 375, "tcp" }, - { "hassle", { NULL }, 375, "udp" }, - { "nip", { NULL }, 376, "tcp" }, - { "nip", { NULL }, 376, "udp" }, - { "tnETOS", { NULL }, 377, "tcp" }, - { "tnETOS", { NULL }, 377, "udp" }, - { "dsETOS", { NULL }, 378, "tcp" }, - { "dsETOS", { NULL }, 378, "udp" }, - { "is99c", { NULL }, 379, "tcp" }, - { "is99c", { NULL }, 379, "udp" }, - { "is99s", { NULL }, 380, "tcp" }, - { "is99s", { NULL }, 380, "udp" }, - { "hp-collector", { NULL }, 381, "tcp" }, - { "hp-collector", { NULL }, 381, "udp" }, - { "hp-managed-node", { NULL }, 382, "tcp" }, - { "hp-managed-node", { NULL }, 382, "udp" }, - { "hp-alarm-mgr", { NULL }, 383, "tcp" }, - { "hp-alarm-mgr", { NULL }, 383, "udp" }, - { "arns", { NULL }, 384, "tcp" }, - { "arns", { NULL }, 384, "udp" }, - { "ibm-app", { NULL }, 385, "tcp" }, - { "ibm-app", { NULL }, 385, "udp" }, - { "asa", { NULL }, 386, "tcp" }, - { "asa", { NULL }, 386, "udp" }, - { "aurp", { NULL }, 387, "tcp" }, - { "aurp", { NULL }, 387, "udp" }, - { "unidata-ldm", { NULL }, 388, "tcp" }, - { "unidata-ldm", { NULL }, 388, "udp" }, - { "ldap", { NULL }, 389, "tcp" }, - { "ldap", { NULL }, 389, "udp" }, - { "uis", { NULL }, 390, "tcp" }, - { "uis", { NULL }, 390, "udp" }, - { "synotics-relay", { NULL }, 391, "tcp" }, - { "synotics-relay", { NULL }, 391, "udp" }, - { "synotics-broker", { NULL }, 392, "tcp" }, - { "synotics-broker", { NULL }, 392, "udp" }, - { "meta5", { NULL }, 393, "tcp" }, - { "meta5", { NULL }, 393, "udp" }, - { "embl-ndt", { NULL }, 394, "tcp" }, - { "embl-ndt", { NULL }, 394, "udp" }, - { "netcp", { NULL }, 395, "tcp" }, - { "netcp", { NULL }, 395, "udp" }, - { "netware-ip", { NULL }, 396, "tcp" }, - { "netware-ip", { NULL }, 396, "udp" }, - { "mptn", { NULL }, 397, "tcp" }, - { "mptn", { NULL }, 397, "udp" }, - { "kryptolan", { NULL }, 398, "tcp" }, - { "kryptolan", { NULL }, 398, "udp" }, - { "iso-tsap-c2", { NULL }, 399, "tcp" }, - { "iso-tsap-c2", { NULL }, 399, "udp" }, - { "osb-sd", { NULL }, 400, "tcp" }, - { "osb-sd", { NULL }, 400, "udp" }, - { "ups", { NULL }, 401, "tcp" }, - { "ups", { NULL }, 401, "udp" }, - { "genie", { NULL }, 402, "tcp" }, - { "genie", { NULL }, 402, "udp" }, - { "decap", { NULL }, 403, "tcp" }, - { "decap", { NULL }, 403, "udp" }, - { "nced", { NULL }, 404, "tcp" }, - { "nced", { NULL }, 404, "udp" }, - { "ncld", { NULL }, 405, "tcp" }, - { "ncld", { NULL }, 405, "udp" }, - { "imsp", { NULL }, 406, "tcp" }, - { "imsp", { NULL }, 406, "udp" }, - { "timbuktu", { NULL }, 407, "tcp" }, - { "timbuktu", { NULL }, 407, "udp" }, - { "prm-sm", { NULL }, 408, "tcp" }, - { "prm-sm", { NULL }, 408, "udp" }, - { "prm-nm", { NULL }, 409, "tcp" }, - { "prm-nm", { NULL }, 409, "udp" }, - { "decladebug", { NULL }, 410, "tcp" }, - { "decladebug", { NULL }, 410, "udp" }, - { "rmt", { NULL }, 411, "tcp" }, - { "rmt", { NULL }, 411, "udp" }, - { "synoptics-trap", { NULL }, 412, "tcp" }, - { "synoptics-trap", { NULL }, 412, "udp" }, - { "smsp", { NULL }, 413, "tcp" }, - { "smsp", { NULL }, 413, "udp" }, - { "infoseek", { NULL }, 414, "tcp" }, - { "infoseek", { NULL }, 414, "udp" }, - { "bnet", { NULL }, 415, "tcp" }, - { "bnet", { NULL }, 415, "udp" }, - { "silverplatter", { NULL }, 416, "tcp" }, - { "silverplatter", { NULL }, 416, "udp" }, - { "onmux", { NULL }, 417, "tcp" }, - { "onmux", { NULL }, 417, "udp" }, - { "hyper-g", { NULL }, 418, "tcp" }, - { "hyper-g", { NULL }, 418, "udp" }, - { "ariel1", { NULL }, 419, "tcp" }, - { "ariel1", { NULL }, 419, "udp" }, - { "smpte", { NULL }, 420, "tcp" }, - { "smpte", { NULL }, 420, "udp" }, - { "ariel2", { NULL }, 421, "tcp" }, - { "ariel2", { NULL }, 421, "udp" }, - { "ariel3", { NULL }, 422, "tcp" }, - { "ariel3", { NULL }, 422, "udp" }, - { "opc-job-start", { NULL }, 423, "tcp" }, - { "opc-job-start", { NULL }, 423, "udp" }, - { "opc-job-track", { NULL }, 424, "tcp" }, - { "opc-job-track", { NULL }, 424, "udp" }, - { "icad-el", { NULL }, 425, "tcp" }, - { "icad-el", { NULL }, 425, "udp" }, - { "smartsdp", { NULL }, 426, "tcp" }, - { "smartsdp", { NULL }, 426, "udp" }, - { "svrloc", { NULL }, 427, "tcp" }, - { "svrloc", { NULL }, 427, "udp" }, - { "ocs_cmu", { NULL }, 428, "tcp" }, - { "ocs_cmu", { NULL }, 428, "udp" }, - { "ocs_amu", { NULL }, 429, "tcp" }, - { "ocs_amu", { NULL }, 429, "udp" }, - { "utmpsd", { NULL }, 430, "tcp" }, - { "utmpsd", { NULL }, 430, "udp" }, - { "utmpcd", { NULL }, 431, "tcp" }, - { "utmpcd", { NULL }, 431, "udp" }, - { "iasd", { NULL }, 432, "tcp" }, - { "iasd", { NULL }, 432, "udp" }, - { "nnsp", { NULL }, 433, "tcp" }, - { "nnsp", { NULL }, 433, "udp" }, - { "mobileip-agent", { NULL }, 434, "tcp" }, - { "mobileip-agent", { NULL }, 434, "udp" }, - { "mobilip-mn", { NULL }, 435, "tcp" }, - { "mobilip-mn", { NULL }, 435, "udp" }, - { "dna-cml", { NULL }, 436, "tcp" }, - { "dna-cml", { NULL }, 436, "udp" }, - { "comscm", { NULL }, 437, "tcp" }, - { "comscm", { NULL }, 437, "udp" }, - { "dsfgw", { NULL }, 438, "tcp" }, - { "dsfgw", { NULL }, 438, "udp" }, - { "dasp", { NULL }, 439, "tcp" }, - { "dasp", { NULL }, 439, "udp" }, - { "sgcp", { NULL }, 440, "tcp" }, - { "sgcp", { NULL }, 440, "udp" }, - { "decvms-sysmgt", { NULL }, 441, "tcp" }, - { "decvms-sysmgt", { NULL }, 441, "udp" }, - { "cvc_hostd", { NULL }, 442, "tcp" }, - { "cvc_hostd", { NULL }, 442, "udp" }, - { "https", { NULL }, 443, "tcp" }, - { "https", { NULL }, 443, "udp" }, - { "https", { NULL }, 443, "sctp" }, - { "snpp", { NULL }, 444, "tcp" }, - { "snpp", { NULL }, 444, "udp" }, - { "microsoft-ds", { NULL }, 445, "tcp" }, - { "microsoft-ds", { NULL }, 445, "udp" }, - { "ddm-rdb", { NULL }, 446, "tcp" }, - { "ddm-rdb", { NULL }, 446, "udp" }, - { "ddm-dfm", { NULL }, 447, "tcp" }, - { "ddm-dfm", { NULL }, 447, "udp" }, - { "ddm-ssl", { NULL }, 448, "tcp" }, - { "ddm-ssl", { NULL }, 448, "udp" }, - { "as-servermap", { NULL }, 449, "tcp" }, - { "as-servermap", { NULL }, 449, "udp" }, - { "tserver", { NULL }, 450, "tcp" }, - { "tserver", { NULL }, 450, "udp" }, - { "sfs-smp-net", { NULL }, 451, "tcp" }, - { "sfs-smp-net", { NULL }, 451, "udp" }, - { "sfs-config", { NULL }, 452, "tcp" }, - { "sfs-config", { NULL }, 452, "udp" }, - { "creativeserver", { NULL }, 453, "tcp" }, - { "creativeserver", { NULL }, 453, "udp" }, - { "contentserver", { NULL }, 454, "tcp" }, - { "contentserver", { NULL }, 454, "udp" }, - { "creativepartnr", { NULL }, 455, "tcp" }, - { "creativepartnr", { NULL }, 455, "udp" }, - { "macon-tcp", { NULL }, 456, "tcp" }, - { "macon-udp", { NULL }, 456, "udp" }, - { "scohelp", { NULL }, 457, "tcp" }, - { "scohelp", { NULL }, 457, "udp" }, - { "appleqtc", { NULL }, 458, "tcp" }, - { "appleqtc", { NULL }, 458, "udp" }, - { "ampr-rcmd", { NULL }, 459, "tcp" }, - { "ampr-rcmd", { NULL }, 459, "udp" }, - { "skronk", { NULL }, 460, "tcp" }, - { "skronk", { NULL }, 460, "udp" }, - { "datasurfsrv", { NULL }, 461, "tcp" }, - { "datasurfsrv", { NULL }, 461, "udp" }, - { "datasurfsrvsec", { NULL }, 462, "tcp" }, - { "datasurfsrvsec", { NULL }, 462, "udp" }, - { "alpes", { NULL }, 463, "tcp" }, - { "alpes", { NULL }, 463, "udp" }, - { "kpasswd", { NULL }, 464, "tcp" }, - { "kpasswd", { NULL }, 464, "udp" }, - { "urd", { NULL }, 465, "tcp" }, - { "igmpv3lite", { NULL }, 465, "udp" }, - { "digital-vrc", { NULL }, 466, "tcp" }, - { "digital-vrc", { NULL }, 466, "udp" }, - { "mylex-mapd", { NULL }, 467, "tcp" }, - { "mylex-mapd", { NULL }, 467, "udp" }, - { "photuris", { NULL }, 468, "tcp" }, - { "photuris", { NULL }, 468, "udp" }, - { "rcp", { NULL }, 469, "tcp" }, - { "rcp", { NULL }, 469, "udp" }, - { "scx-proxy", { NULL }, 470, "tcp" }, - { "scx-proxy", { NULL }, 470, "udp" }, - { "mondex", { NULL }, 471, "tcp" }, - { "mondex", { NULL }, 471, "udp" }, - { "ljk-login", { NULL }, 472, "tcp" }, - { "ljk-login", { NULL }, 472, "udp" }, - { "hybrid-pop", { NULL }, 473, "tcp" }, - { "hybrid-pop", { NULL }, 473, "udp" }, - { "tn-tl-w1", { NULL }, 474, "tcp" }, - { "tn-tl-w2", { NULL }, 474, "udp" }, - { "tcpnethaspsrv", { NULL }, 475, "tcp" }, - { "tcpnethaspsrv", { NULL }, 475, "udp" }, - { "tn-tl-fd1", { NULL }, 476, "tcp" }, - { "tn-tl-fd1", { NULL }, 476, "udp" }, - { "ss7ns", { NULL }, 477, "tcp" }, - { "ss7ns", { NULL }, 477, "udp" }, - { "spsc", { NULL }, 478, "tcp" }, - { "spsc", { NULL }, 478, "udp" }, - { "iafserver", { NULL }, 479, "tcp" }, - { "iafserver", { NULL }, 479, "udp" }, - { "iafdbase", { NULL }, 480, "tcp" }, - { "iafdbase", { NULL }, 480, "udp" }, - { "ph", { NULL }, 481, "tcp" }, - { "ph", { NULL }, 481, "udp" }, - { "bgs-nsi", { NULL }, 482, "tcp" }, - { "bgs-nsi", { NULL }, 482, "udp" }, - { "ulpnet", { NULL }, 483, "tcp" }, - { "ulpnet", { NULL }, 483, "udp" }, - { "integra-sme", { NULL }, 484, "tcp" }, - { "integra-sme", { NULL }, 484, "udp" }, - { "powerburst", { NULL }, 485, "tcp" }, - { "powerburst", { NULL }, 485, "udp" }, - { "avian", { NULL }, 486, "tcp" }, - { "avian", { NULL }, 486, "udp" }, - { "saft", { NULL }, 487, "tcp" }, - { "saft", { NULL }, 487, "udp" }, - { "gss-http", { NULL }, 488, "tcp" }, - { "gss-http", { NULL }, 488, "udp" }, - { "nest-protocol", { NULL }, 489, "tcp" }, - { "nest-protocol", { NULL }, 489, "udp" }, - { "micom-pfs", { NULL }, 490, "tcp" }, - { "micom-pfs", { NULL }, 490, "udp" }, - { "go-login", { NULL }, 491, "tcp" }, - { "go-login", { NULL }, 491, "udp" }, - { "ticf-1", { NULL }, 492, "tcp" }, - { "ticf-1", { NULL }, 492, "udp" }, - { "ticf-2", { NULL }, 493, "tcp" }, - { "ticf-2", { NULL }, 493, "udp" }, - { "pov-ray", { NULL }, 494, "tcp" }, - { "pov-ray", { NULL }, 494, "udp" }, - { "intecourier", { NULL }, 495, "tcp" }, - { "intecourier", { NULL }, 495, "udp" }, - { "pim-rp-disc", { NULL }, 496, "tcp" }, - { "pim-rp-disc", { NULL }, 496, "udp" }, - { "dantz", { NULL }, 497, "tcp" }, - { "dantz", { NULL }, 497, "udp" }, - { "siam", { NULL }, 498, "tcp" }, - { "siam", { NULL }, 498, "udp" }, - { "iso-ill", { NULL }, 499, "tcp" }, - { "iso-ill", { NULL }, 499, "udp" }, - { "isakmp", { NULL }, 500, "tcp" }, - { "isakmp", { NULL }, 500, "udp" }, - { "stmf", { NULL }, 501, "tcp" }, - { "stmf", { NULL }, 501, "udp" }, - { "asa-appl-proto", { NULL }, 502, "tcp" }, - { "asa-appl-proto", { NULL }, 502, "udp" }, - { "intrinsa", { NULL }, 503, "tcp" }, - { "intrinsa", { NULL }, 503, "udp" }, - { "citadel", { NULL }, 504, "tcp" }, - { "citadel", { NULL }, 504, "udp" }, - { "mailbox-lm", { NULL }, 505, "tcp" }, - { "mailbox-lm", { NULL }, 505, "udp" }, - { "ohimsrv", { NULL }, 506, "tcp" }, - { "ohimsrv", { NULL }, 506, "udp" }, - { "crs", { NULL }, 507, "tcp" }, - { "crs", { NULL }, 507, "udp" }, - { "xvttp", { NULL }, 508, "tcp" }, - { "xvttp", { NULL }, 508, "udp" }, - { "snare", { NULL }, 509, "tcp" }, - { "snare", { NULL }, 509, "udp" }, - { "fcp", { NULL }, 510, "tcp" }, - { "fcp", { NULL }, 510, "udp" }, - { "passgo", { NULL }, 511, "tcp" }, - { "passgo", { NULL }, 511, "udp" }, - { "exec", { NULL }, 512, "tcp" }, - { "comsat", { NULL }, 512, "udp" }, - { "biff", { NULL }, 512, "udp" }, - { "login", { NULL }, 513, "tcp" }, - { "who", { NULL }, 513, "udp" }, - { "shell", { NULL }, 514, "tcp" }, - { "syslog", { NULL }, 514, "udp" }, - { "printer", { NULL }, 515, "tcp" }, - { "printer", { NULL }, 515, "udp" }, - { "videotex", { NULL }, 516, "tcp" }, - { "videotex", { NULL }, 516, "udp" }, - { "talk", { NULL }, 517, "tcp" }, - { "talk", { NULL }, 517, "udp" }, - { "ntalk", { NULL }, 518, "tcp" }, - { "ntalk", { NULL }, 518, "udp" }, - { "utime", { NULL }, 519, "tcp" }, - { "utime", { NULL }, 519, "udp" }, - { "efs", { NULL }, 520, "tcp" }, - { "router", { NULL }, 520, "udp" }, - { "ripng", { NULL }, 521, "tcp" }, - { "ripng", { NULL }, 521, "udp" }, - { "ulp", { NULL }, 522, "tcp" }, - { "ulp", { NULL }, 522, "udp" }, - { "ibm-db2", { NULL }, 523, "tcp" }, - { "ibm-db2", { NULL }, 523, "udp" }, - { "ncp", { NULL }, 524, "tcp" }, - { "ncp", { NULL }, 524, "udp" }, - { "timed", { NULL }, 525, "tcp" }, - { "timed", { NULL }, 525, "udp" }, - { "tempo", { NULL }, 526, "tcp" }, - { "tempo", { NULL }, 526, "udp" }, - { "stx", { NULL }, 527, "tcp" }, - { "stx", { NULL }, 527, "udp" }, - { "custix", { NULL }, 528, "tcp" }, - { "custix", { NULL }, 528, "udp" }, - { "irc-serv", { NULL }, 529, "tcp" }, - { "irc-serv", { NULL }, 529, "udp" }, - { "courier", { NULL }, 530, "tcp" }, - { "courier", { NULL }, 530, "udp" }, - { "conference", { NULL }, 531, "tcp" }, - { "conference", { NULL }, 531, "udp" }, - { "netnews", { NULL }, 532, "tcp" }, - { "netnews", { NULL }, 532, "udp" }, - { "netwall", { NULL }, 533, "tcp" }, - { "netwall", { NULL }, 533, "udp" }, - { "windream", { NULL }, 534, "tcp" }, - { "windream", { NULL }, 534, "udp" }, - { "iiop", { NULL }, 535, "tcp" }, - { "iiop", { NULL }, 535, "udp" }, - { "opalis-rdv", { NULL }, 536, "tcp" }, - { "opalis-rdv", { NULL }, 536, "udp" }, - { "nmsp", { NULL }, 537, "tcp" }, - { "nmsp", { NULL }, 537, "udp" }, - { "gdomap", { NULL }, 538, "tcp" }, - { "gdomap", { NULL }, 538, "udp" }, - { "apertus-ldp", { NULL }, 539, "tcp" }, - { "apertus-ldp", { NULL }, 539, "udp" }, - { "uucp", { NULL }, 540, "tcp" }, - { "uucp", { NULL }, 540, "udp" }, - { "uucp-rlogin", { NULL }, 541, "tcp" }, - { "uucp-rlogin", { NULL }, 541, "udp" }, - { "commerce", { NULL }, 542, "tcp" }, - { "commerce", { NULL }, 542, "udp" }, - { "klogin", { NULL }, 543, "tcp" }, - { "klogin", { NULL }, 543, "udp" }, - { "kshell", { NULL }, 544, "tcp" }, - { "kshell", { NULL }, 544, "udp" }, - { "appleqtcsrvr", { NULL }, 545, "tcp" }, - { "appleqtcsrvr", { NULL }, 545, "udp" }, - { "dhcpv6-client", { NULL }, 546, "tcp" }, - { "dhcpv6-client", { NULL }, 546, "udp" }, - { "dhcpv6-server", { NULL }, 547, "tcp" }, - { "dhcpv6-server", { NULL }, 547, "udp" }, - { "afpovertcp", { NULL }, 548, "tcp" }, - { "afpovertcp", { NULL }, 548, "udp" }, - { "idfp", { NULL }, 549, "tcp" }, - { "idfp", { NULL }, 549, "udp" }, - { "new-rwho", { NULL }, 550, "tcp" }, - { "new-rwho", { NULL }, 550, "udp" }, - { "cybercash", { NULL }, 551, "tcp" }, - { "cybercash", { NULL }, 551, "udp" }, - { "devshr-nts", { NULL }, 552, "tcp" }, - { "devshr-nts", { NULL }, 552, "udp" }, - { "pirp", { NULL }, 553, "tcp" }, - { "pirp", { NULL }, 553, "udp" }, - { "rtsp", { NULL }, 554, "tcp" }, - { "rtsp", { NULL }, 554, "udp" }, - { "dsf", { NULL }, 555, "tcp" }, - { "dsf", { NULL }, 555, "udp" }, - { "remotefs", { NULL }, 556, "tcp" }, - { "remotefs", { NULL }, 556, "udp" }, - { "openvms-sysipc", { NULL }, 557, "tcp" }, - { "openvms-sysipc", { NULL }, 557, "udp" }, - { "sdnskmp", { NULL }, 558, "tcp" }, - { "sdnskmp", { NULL }, 558, "udp" }, - { "teedtap", { NULL }, 559, "tcp" }, - { "teedtap", { NULL }, 559, "udp" }, - { "rmonitor", { NULL }, 560, "tcp" }, - { "rmonitor", { NULL }, 560, "udp" }, - { "monitor", { NULL }, 561, "tcp" }, - { "monitor", { NULL }, 561, "udp" }, - { "chshell", { NULL }, 562, "tcp" }, - { "chshell", { NULL }, 562, "udp" }, - { "nntps", { NULL }, 563, "tcp" }, - { "nntps", { NULL }, 563, "udp" }, - { "9pfs", { NULL }, 564, "tcp" }, - { "9pfs", { NULL }, 564, "udp" }, - { "whoami", { NULL }, 565, "tcp" }, - { "whoami", { NULL }, 565, "udp" }, - { "streettalk", { NULL }, 566, "tcp" }, - { "streettalk", { NULL }, 566, "udp" }, - { "banyan-rpc", { NULL }, 567, "tcp" }, - { "banyan-rpc", { NULL }, 567, "udp" }, - { "ms-shuttle", { NULL }, 568, "tcp" }, - { "ms-shuttle", { NULL }, 568, "udp" }, - { "ms-rome", { NULL }, 569, "tcp" }, - { "ms-rome", { NULL }, 569, "udp" }, - { "meter", { NULL }, 570, "tcp" }, - { "meter", { NULL }, 570, "udp" }, - { "meter", { NULL }, 571, "tcp" }, - { "meter", { NULL }, 571, "udp" }, - { "sonar", { NULL }, 572, "tcp" }, - { "sonar", { NULL }, 572, "udp" }, - { "banyan-vip", { NULL }, 573, "tcp" }, - { "banyan-vip", { NULL }, 573, "udp" }, - { "ftp-agent", { NULL }, 574, "tcp" }, - { "ftp-agent", { NULL }, 574, "udp" }, - { "vemmi", { NULL }, 575, "tcp" }, - { "vemmi", { NULL }, 575, "udp" }, - { "ipcd", { NULL }, 576, "tcp" }, - { "ipcd", { NULL }, 576, "udp" }, - { "vnas", { NULL }, 577, "tcp" }, - { "vnas", { NULL }, 577, "udp" }, - { "ipdd", { NULL }, 578, "tcp" }, - { "ipdd", { NULL }, 578, "udp" }, - { "decbsrv", { NULL }, 579, "tcp" }, - { "decbsrv", { NULL }, 579, "udp" }, - { "sntp-heartbeat", { NULL }, 580, "tcp" }, - { "sntp-heartbeat", { NULL }, 580, "udp" }, - { "bdp", { NULL }, 581, "tcp" }, - { "bdp", { NULL }, 581, "udp" }, - { "scc-security", { NULL }, 582, "tcp" }, - { "scc-security", { NULL }, 582, "udp" }, - { "philips-vc", { NULL }, 583, "tcp" }, - { "philips-vc", { NULL }, 583, "udp" }, - { "keyserver", { NULL }, 584, "tcp" }, - { "keyserver", { NULL }, 584, "udp" }, - { "password-chg", { NULL }, 586, "tcp" }, - { "password-chg", { NULL }, 586, "udp" }, - { "submission", { NULL }, 587, "tcp" }, - { "submission", { NULL }, 587, "udp" }, - { "cal", { NULL }, 588, "tcp" }, - { "cal", { NULL }, 588, "udp" }, - { "eyelink", { NULL }, 589, "tcp" }, - { "eyelink", { NULL }, 589, "udp" }, - { "tns-cml", { NULL }, 590, "tcp" }, - { "tns-cml", { NULL }, 590, "udp" }, - { "http-alt", { NULL }, 591, "tcp" }, - { "http-alt", { NULL }, 591, "udp" }, - { "eudora-set", { NULL }, 592, "tcp" }, - { "eudora-set", { NULL }, 592, "udp" }, - { "http-rpc-epmap", { NULL }, 593, "tcp" }, - { "http-rpc-epmap", { NULL }, 593, "udp" }, - { "tpip", { NULL }, 594, "tcp" }, - { "tpip", { NULL }, 594, "udp" }, - { "cab-protocol", { NULL }, 595, "tcp" }, - { "cab-protocol", { NULL }, 595, "udp" }, - { "smsd", { NULL }, 596, "tcp" }, - { "smsd", { NULL }, 596, "udp" }, - { "ptcnameservice", { NULL }, 597, "tcp" }, - { "ptcnameservice", { NULL }, 597, "udp" }, - { "sco-websrvrmg3", { NULL }, 598, "tcp" }, - { "sco-websrvrmg3", { NULL }, 598, "udp" }, - { "acp", { NULL }, 599, "tcp" }, - { "acp", { NULL }, 599, "udp" }, - { "ipcserver", { NULL }, 600, "tcp" }, - { "ipcserver", { NULL }, 600, "udp" }, - { "syslog-conn", { NULL }, 601, "tcp" }, - { "syslog-conn", { NULL }, 601, "udp" }, - { "xmlrpc-beep", { NULL }, 602, "tcp" }, - { "xmlrpc-beep", { NULL }, 602, "udp" }, - { "idxp", { NULL }, 603, "tcp" }, - { "idxp", { NULL }, 603, "udp" }, - { "tunnel", { NULL }, 604, "tcp" }, - { "tunnel", { NULL }, 604, "udp" }, - { "soap-beep", { NULL }, 605, "tcp" }, - { "soap-beep", { NULL }, 605, "udp" }, - { "urm", { NULL }, 606, "tcp" }, - { "urm", { NULL }, 606, "udp" }, - { "nqs", { NULL }, 607, "tcp" }, - { "nqs", { NULL }, 607, "udp" }, - { "sift-uft", { NULL }, 608, "tcp" }, - { "sift-uft", { NULL }, 608, "udp" }, - { "npmp-trap", { NULL }, 609, "tcp" }, - { "npmp-trap", { NULL }, 609, "udp" }, - { "npmp-local", { NULL }, 610, "tcp" }, - { "npmp-local", { NULL }, 610, "udp" }, - { "npmp-gui", { NULL }, 611, "tcp" }, - { "npmp-gui", { NULL }, 611, "udp" }, - { "hmmp-ind", { NULL }, 612, "tcp" }, - { "hmmp-ind", { NULL }, 612, "udp" }, - { "hmmp-op", { NULL }, 613, "tcp" }, - { "hmmp-op", { NULL }, 613, "udp" }, - { "sshell", { NULL }, 614, "tcp" }, - { "sshell", { NULL }, 614, "udp" }, - { "sco-inetmgr", { NULL }, 615, "tcp" }, - { "sco-inetmgr", { NULL }, 615, "udp" }, - { "sco-sysmgr", { NULL }, 616, "tcp" }, - { "sco-sysmgr", { NULL }, 616, "udp" }, - { "sco-dtmgr", { NULL }, 617, "tcp" }, - { "sco-dtmgr", { NULL }, 617, "udp" }, - { "dei-icda", { NULL }, 618, "tcp" }, - { "dei-icda", { NULL }, 618, "udp" }, - { "compaq-evm", { NULL }, 619, "tcp" }, - { "compaq-evm", { NULL }, 619, "udp" }, - { "sco-websrvrmgr", { NULL }, 620, "tcp" }, - { "sco-websrvrmgr", { NULL }, 620, "udp" }, - { "escp-ip", { NULL }, 621, "tcp" }, - { "escp-ip", { NULL }, 621, "udp" }, - { "collaborator", { NULL }, 622, "tcp" }, - { "collaborator", { NULL }, 622, "udp" }, - { "oob-ws-http", { NULL }, 623, "tcp" }, - { "asf-rmcp", { NULL }, 623, "udp" }, - { "cryptoadmin", { NULL }, 624, "tcp" }, - { "cryptoadmin", { NULL }, 624, "udp" }, - { "dec_dlm", { NULL }, 625, "tcp" }, - { "dec_dlm", { NULL }, 625, "udp" }, - { "asia", { NULL }, 626, "tcp" }, - { "asia", { NULL }, 626, "udp" }, - { "passgo-tivoli", { NULL }, 627, "tcp" }, - { "passgo-tivoli", { NULL }, 627, "udp" }, - { "qmqp", { NULL }, 628, "tcp" }, - { "qmqp", { NULL }, 628, "udp" }, - { "3com-amp3", { NULL }, 629, "tcp" }, - { "3com-amp3", { NULL }, 629, "udp" }, - { "rda", { NULL }, 630, "tcp" }, - { "rda", { NULL }, 630, "udp" }, - { "ipp", { NULL }, 631, "tcp" }, - { "ipp", { NULL }, 631, "udp" }, - { "bmpp", { NULL }, 632, "tcp" }, - { "bmpp", { NULL }, 632, "udp" }, - { "servstat", { NULL }, 633, "tcp" }, - { "servstat", { NULL }, 633, "udp" }, - { "ginad", { NULL }, 634, "tcp" }, - { "ginad", { NULL }, 634, "udp" }, - { "rlzdbase", { NULL }, 635, "tcp" }, - { "rlzdbase", { NULL }, 635, "udp" }, - { "ldaps", { NULL }, 636, "tcp" }, - { "ldaps", { NULL }, 636, "udp" }, - { "lanserver", { NULL }, 637, "tcp" }, - { "lanserver", { NULL }, 637, "udp" }, - { "mcns-sec", { NULL }, 638, "tcp" }, - { "mcns-sec", { NULL }, 638, "udp" }, - { "msdp", { NULL }, 639, "tcp" }, - { "msdp", { NULL }, 639, "udp" }, - { "entrust-sps", { NULL }, 640, "tcp" }, - { "entrust-sps", { NULL }, 640, "udp" }, - { "repcmd", { NULL }, 641, "tcp" }, - { "repcmd", { NULL }, 641, "udp" }, - { "esro-emsdp", { NULL }, 642, "tcp" }, - { "esro-emsdp", { NULL }, 642, "udp" }, - { "sanity", { NULL }, 643, "tcp" }, - { "sanity", { NULL }, 643, "udp" }, - { "dwr", { NULL }, 644, "tcp" }, - { "dwr", { NULL }, 644, "udp" }, - { "pssc", { NULL }, 645, "tcp" }, - { "pssc", { NULL }, 645, "udp" }, - { "ldp", { NULL }, 646, "tcp" }, - { "ldp", { NULL }, 646, "udp" }, - { "dhcp-failover", { NULL }, 647, "tcp" }, - { "dhcp-failover", { NULL }, 647, "udp" }, - { "rrp", { NULL }, 648, "tcp" }, - { "rrp", { NULL }, 648, "udp" }, - { "cadview-3d", { NULL }, 649, "tcp" }, - { "cadview-3d", { NULL }, 649, "udp" }, - { "obex", { NULL }, 650, "tcp" }, - { "obex", { NULL }, 650, "udp" }, - { "ieee-mms", { NULL }, 651, "tcp" }, - { "ieee-mms", { NULL }, 651, "udp" }, - { "hello-port", { NULL }, 652, "tcp" }, - { "hello-port", { NULL }, 652, "udp" }, - { "repscmd", { NULL }, 653, "tcp" }, - { "repscmd", { NULL }, 653, "udp" }, - { "aodv", { NULL }, 654, "tcp" }, - { "aodv", { NULL }, 654, "udp" }, - { "tinc", { NULL }, 655, "tcp" }, - { "tinc", { NULL }, 655, "udp" }, - { "spmp", { NULL }, 656, "tcp" }, - { "spmp", { NULL }, 656, "udp" }, - { "rmc", { NULL }, 657, "tcp" }, - { "rmc", { NULL }, 657, "udp" }, - { "tenfold", { NULL }, 658, "tcp" }, - { "tenfold", { NULL }, 658, "udp" }, - { "mac-srvr-admin", { NULL }, 660, "tcp" }, - { "mac-srvr-admin", { NULL }, 660, "udp" }, - { "hap", { NULL }, 661, "tcp" }, - { "hap", { NULL }, 661, "udp" }, - { "pftp", { NULL }, 662, "tcp" }, - { "pftp", { NULL }, 662, "udp" }, - { "purenoise", { NULL }, 663, "tcp" }, - { "purenoise", { NULL }, 663, "udp" }, - { "oob-ws-https", { NULL }, 664, "tcp" }, - { "asf-secure-rmcp", { NULL }, 664, "udp" }, - { "sun-dr", { NULL }, 665, "tcp" }, - { "sun-dr", { NULL }, 665, "udp" }, - { "mdqs", { NULL }, 666, "tcp" }, - { "mdqs", { NULL }, 666, "udp" }, - { "doom", { NULL }, 666, "tcp" }, - { "doom", { NULL }, 666, "udp" }, - { "disclose", { NULL }, 667, "tcp" }, - { "disclose", { NULL }, 667, "udp" }, - { "mecomm", { NULL }, 668, "tcp" }, - { "mecomm", { NULL }, 668, "udp" }, - { "meregister", { NULL }, 669, "tcp" }, - { "meregister", { NULL }, 669, "udp" }, - { "vacdsm-sws", { NULL }, 670, "tcp" }, - { "vacdsm-sws", { NULL }, 670, "udp" }, - { "vacdsm-app", { NULL }, 671, "tcp" }, - { "vacdsm-app", { NULL }, 671, "udp" }, - { "vpps-qua", { NULL }, 672, "tcp" }, - { "vpps-qua", { NULL }, 672, "udp" }, - { "cimplex", { NULL }, 673, "tcp" }, - { "cimplex", { NULL }, 673, "udp" }, - { "acap", { NULL }, 674, "tcp" }, - { "acap", { NULL }, 674, "udp" }, - { "dctp", { NULL }, 675, "tcp" }, - { "dctp", { NULL }, 675, "udp" }, - { "vpps-via", { NULL }, 676, "tcp" }, - { "vpps-via", { NULL }, 676, "udp" }, - { "vpp", { NULL }, 677, "tcp" }, - { "vpp", { NULL }, 677, "udp" }, - { "ggf-ncp", { NULL }, 678, "tcp" }, - { "ggf-ncp", { NULL }, 678, "udp" }, - { "mrm", { NULL }, 679, "tcp" }, - { "mrm", { NULL }, 679, "udp" }, - { "entrust-aaas", { NULL }, 680, "tcp" }, - { "entrust-aaas", { NULL }, 680, "udp" }, - { "entrust-aams", { NULL }, 681, "tcp" }, - { "entrust-aams", { NULL }, 681, "udp" }, - { "xfr", { NULL }, 682, "tcp" }, - { "xfr", { NULL }, 682, "udp" }, - { "corba-iiop", { NULL }, 683, "tcp" }, - { "corba-iiop", { NULL }, 683, "udp" }, - { "corba-iiop-ssl", { NULL }, 684, "tcp" }, - { "corba-iiop-ssl", { NULL }, 684, "udp" }, - { "mdc-portmapper", { NULL }, 685, "tcp" }, - { "mdc-portmapper", { NULL }, 685, "udp" }, - { "hcp-wismar", { NULL }, 686, "tcp" }, - { "hcp-wismar", { NULL }, 686, "udp" }, - { "asipregistry", { NULL }, 687, "tcp" }, - { "asipregistry", { NULL }, 687, "udp" }, - { "realm-rusd", { NULL }, 688, "tcp" }, - { "realm-rusd", { NULL }, 688, "udp" }, - { "nmap", { NULL }, 689, "tcp" }, - { "nmap", { NULL }, 689, "udp" }, - { "vatp", { NULL }, 690, "tcp" }, - { "vatp", { NULL }, 690, "udp" }, - { "msexch-routing", { NULL }, 691, "tcp" }, - { "msexch-routing", { NULL }, 691, "udp" }, - { "hyperwave-isp", { NULL }, 692, "tcp" }, - { "hyperwave-isp", { NULL }, 692, "udp" }, - { "connendp", { NULL }, 693, "tcp" }, - { "connendp", { NULL }, 693, "udp" }, - { "ha-cluster", { NULL }, 694, "tcp" }, - { "ha-cluster", { NULL }, 694, "udp" }, - { "ieee-mms-ssl", { NULL }, 695, "tcp" }, - { "ieee-mms-ssl", { NULL }, 695, "udp" }, - { "rushd", { NULL }, 696, "tcp" }, - { "rushd", { NULL }, 696, "udp" }, - { "uuidgen", { NULL }, 697, "tcp" }, - { "uuidgen", { NULL }, 697, "udp" }, - { "olsr", { NULL }, 698, "tcp" }, - { "olsr", { NULL }, 698, "udp" }, - { "accessnetwork", { NULL }, 699, "tcp" }, - { "accessnetwork", { NULL }, 699, "udp" }, - { "epp", { NULL }, 700, "tcp" }, - { "epp", { NULL }, 700, "udp" }, - { "lmp", { NULL }, 701, "tcp" }, - { "lmp", { NULL }, 701, "udp" }, - { "iris-beep", { NULL }, 702, "tcp" }, - { "iris-beep", { NULL }, 702, "udp" }, - { "elcsd", { NULL }, 704, "tcp" }, - { "elcsd", { NULL }, 704, "udp" }, - { "agentx", { NULL }, 705, "tcp" }, - { "agentx", { NULL }, 705, "udp" }, - { "silc", { NULL }, 706, "tcp" }, - { "silc", { NULL }, 706, "udp" }, - { "borland-dsj", { NULL }, 707, "tcp" }, - { "borland-dsj", { NULL }, 707, "udp" }, - { "entrust-kmsh", { NULL }, 709, "tcp" }, - { "entrust-kmsh", { NULL }, 709, "udp" }, - { "entrust-ash", { NULL }, 710, "tcp" }, - { "entrust-ash", { NULL }, 710, "udp" }, - { "cisco-tdp", { NULL }, 711, "tcp" }, - { "cisco-tdp", { NULL }, 711, "udp" }, - { "tbrpf", { NULL }, 712, "tcp" }, - { "tbrpf", { NULL }, 712, "udp" }, - { "iris-xpc", { NULL }, 713, "tcp" }, - { "iris-xpc", { NULL }, 713, "udp" }, - { "iris-xpcs", { NULL }, 714, "tcp" }, - { "iris-xpcs", { NULL }, 714, "udp" }, - { "iris-lwz", { NULL }, 715, "tcp" }, - { "iris-lwz", { NULL }, 715, "udp" }, - { "pana", { NULL }, 716, "udp" }, - { "netviewdm1", { NULL }, 729, "tcp" }, - { "netviewdm1", { NULL }, 729, "udp" }, - { "netviewdm2", { NULL }, 730, "tcp" }, - { "netviewdm2", { NULL }, 730, "udp" }, - { "netviewdm3", { NULL }, 731, "tcp" }, - { "netviewdm3", { NULL }, 731, "udp" }, - { "netgw", { NULL }, 741, "tcp" }, - { "netgw", { NULL }, 741, "udp" }, - { "netrcs", { NULL }, 742, "tcp" }, - { "netrcs", { NULL }, 742, "udp" }, - { "flexlm", { NULL }, 744, "tcp" }, - { "flexlm", { NULL }, 744, "udp" }, - { "fujitsu-dev", { NULL }, 747, "tcp" }, - { "fujitsu-dev", { NULL }, 747, "udp" }, - { "ris-cm", { NULL }, 748, "tcp" }, - { "ris-cm", { NULL }, 748, "udp" }, - { "kerberos-adm", { NULL }, 749, "tcp" }, - { "kerberos-adm", { NULL }, 749, "udp" }, - { "rfile", { NULL }, 750, "tcp" }, - { "loadav", { NULL }, 750, "udp" }, - { "kerberos-iv", { NULL }, 750, "udp" }, - { "pump", { NULL }, 751, "tcp" }, - { "pump", { NULL }, 751, "udp" }, - { "qrh", { NULL }, 752, "tcp" }, - { "qrh", { NULL }, 752, "udp" }, - { "rrh", { NULL }, 753, "tcp" }, - { "rrh", { NULL }, 753, "udp" }, - { "tell", { NULL }, 754, "tcp" }, - { "tell", { NULL }, 754, "udp" }, - { "nlogin", { NULL }, 758, "tcp" }, - { "nlogin", { NULL }, 758, "udp" }, - { "con", { NULL }, 759, "tcp" }, - { "con", { NULL }, 759, "udp" }, - { "ns", { NULL }, 760, "tcp" }, - { "ns", { NULL }, 760, "udp" }, - { "rxe", { NULL }, 761, "tcp" }, - { "rxe", { NULL }, 761, "udp" }, - { "quotad", { NULL }, 762, "tcp" }, - { "quotad", { NULL }, 762, "udp" }, - { "cycleserv", { NULL }, 763, "tcp" }, - { "cycleserv", { NULL }, 763, "udp" }, - { "omserv", { NULL }, 764, "tcp" }, - { "omserv", { NULL }, 764, "udp" }, - { "webster", { NULL }, 765, "tcp" }, - { "webster", { NULL }, 765, "udp" }, - { "phonebook", { NULL }, 767, "tcp" }, - { "phonebook", { NULL }, 767, "udp" }, - { "vid", { NULL }, 769, "tcp" }, - { "vid", { NULL }, 769, "udp" }, - { "cadlock", { NULL }, 770, "tcp" }, - { "cadlock", { NULL }, 770, "udp" }, - { "rtip", { NULL }, 771, "tcp" }, - { "rtip", { NULL }, 771, "udp" }, - { "cycleserv2", { NULL }, 772, "tcp" }, - { "cycleserv2", { NULL }, 772, "udp" }, - { "submit", { NULL }, 773, "tcp" }, - { "notify", { NULL }, 773, "udp" }, - { "rpasswd", { NULL }, 774, "tcp" }, - { "acmaint_dbd", { NULL }, 774, "udp" }, - { "entomb", { NULL }, 775, "tcp" }, - { "acmaint_transd", { NULL }, 775, "udp" }, - { "wpages", { NULL }, 776, "tcp" }, - { "wpages", { NULL }, 776, "udp" }, - { "multiling-http", { NULL }, 777, "tcp" }, - { "multiling-http", { NULL }, 777, "udp" }, - { "wpgs", { NULL }, 780, "tcp" }, - { "wpgs", { NULL }, 780, "udp" }, - { "mdbs_daemon", { NULL }, 800, "tcp" }, - { "mdbs_daemon", { NULL }, 800, "udp" }, - { "device", { NULL }, 801, "tcp" }, - { "device", { NULL }, 801, "udp" }, - { "fcp-udp", { NULL }, 810, "tcp" }, - { "fcp-udp", { NULL }, 810, "udp" }, - { "itm-mcell-s", { NULL }, 828, "tcp" }, - { "itm-mcell-s", { NULL }, 828, "udp" }, - { "pkix-3-ca-ra", { NULL }, 829, "tcp" }, - { "pkix-3-ca-ra", { NULL }, 829, "udp" }, - { "netconf-ssh", { NULL }, 830, "tcp" }, - { "netconf-ssh", { NULL }, 830, "udp" }, - { "netconf-beep", { NULL }, 831, "tcp" }, - { "netconf-beep", { NULL }, 831, "udp" }, - { "netconfsoaphttp", { NULL }, 832, "tcp" }, - { "netconfsoaphttp", { NULL }, 832, "udp" }, - { "netconfsoapbeep", { NULL }, 833, "tcp" }, - { "netconfsoapbeep", { NULL }, 833, "udp" }, - { "dhcp-failover2", { NULL }, 847, "tcp" }, - { "dhcp-failover2", { NULL }, 847, "udp" }, - { "gdoi", { NULL }, 848, "tcp" }, - { "gdoi", { NULL }, 848, "udp" }, - { "iscsi", { NULL }, 860, "tcp" }, - { "iscsi", { NULL }, 860, "udp" }, - { "owamp-control", { NULL }, 861, "tcp" }, - { "owamp-control", { NULL }, 861, "udp" }, - { "twamp-control", { NULL }, 862, "tcp" }, - { "twamp-control", { NULL }, 862, "udp" }, - { "rsync", { NULL }, 873, "tcp" }, - { "rsync", { NULL }, 873, "udp" }, - { "iclcnet-locate", { NULL }, 886, "tcp" }, - { "iclcnet-locate", { NULL }, 886, "udp" }, - { "iclcnet_svinfo", { NULL }, 887, "tcp" }, - { "iclcnet_svinfo", { NULL }, 887, "udp" }, - { "accessbuilder", { NULL }, 888, "tcp" }, - { "accessbuilder", { NULL }, 888, "udp" }, - { "cddbp", { NULL }, 888, "tcp" }, - { "omginitialrefs", { NULL }, 900, "tcp" }, - { "omginitialrefs", { NULL }, 900, "udp" }, - { "smpnameres", { NULL }, 901, "tcp" }, - { "smpnameres", { NULL }, 901, "udp" }, - { "ideafarm-door", { NULL }, 902, "tcp" }, - { "ideafarm-door", { NULL }, 902, "udp" }, - { "ideafarm-panic", { NULL }, 903, "tcp" }, - { "ideafarm-panic", { NULL }, 903, "udp" }, - { "kink", { NULL }, 910, "tcp" }, - { "kink", { NULL }, 910, "udp" }, - { "xact-backup", { NULL }, 911, "tcp" }, - { "xact-backup", { NULL }, 911, "udp" }, - { "apex-mesh", { NULL }, 912, "tcp" }, - { "apex-mesh", { NULL }, 912, "udp" }, - { "apex-edge", { NULL }, 913, "tcp" }, - { "apex-edge", { NULL }, 913, "udp" }, - { "ftps-data", { NULL }, 989, "tcp" }, - { "ftps-data", { NULL }, 989, "udp" }, - { "ftps", { NULL }, 990, "tcp" }, - { "ftps", { NULL }, 990, "udp" }, - { "nas", { NULL }, 991, "tcp" }, - { "nas", { NULL }, 991, "udp" }, - { "telnets", { NULL }, 992, "tcp" }, - { "telnets", { NULL }, 992, "udp" }, - { "imaps", { NULL }, 993, "tcp" }, - { "imaps", { NULL }, 993, "udp" }, - { "ircs", { NULL }, 994, "tcp" }, - { "ircs", { NULL }, 994, "udp" }, - { "pop3s", { NULL }, 995, "tcp" }, - { "pop3s", { NULL }, 995, "udp" }, - { "vsinet", { NULL }, 996, "tcp" }, - { "vsinet", { NULL }, 996, "udp" }, - { "maitrd", { NULL }, 997, "tcp" }, - { "maitrd", { NULL }, 997, "udp" }, - { "busboy", { NULL }, 998, "tcp" }, - { "puparp", { NULL }, 998, "udp" }, - { "garcon", { NULL }, 999, "tcp" }, - { "applix", { NULL }, 999, "udp" }, - { "puprouter", { NULL }, 999, "tcp" }, - { "puprouter", { NULL }, 999, "udp" }, - { "cadlock2", { NULL }, 1000, "tcp" }, - { "cadlock2", { NULL }, 1000, "udp" }, - { "surf", { NULL }, 1010, "tcp" }, - { "surf", { NULL }, 1010, "udp" }, - { "exp1", { NULL }, 1021, "tcp" }, - { "exp1", { NULL }, 1021, "udp" }, - { "exp2", { NULL }, 1022, "tcp" }, - { "exp2", { NULL }, 1022, "udp" }, -# endif /* USE_IANA_WELL_KNOWN_PORTS */ -# ifdef USE_IANA_REGISTERED_PORTS - { "blackjack", { NULL }, 1025, "tcp" }, - { "blackjack", { NULL }, 1025, "udp" }, - { "cap", { NULL }, 1026, "tcp" }, - { "cap", { NULL }, 1026, "udp" }, - { "solid-mux", { NULL }, 1029, "tcp" }, - { "solid-mux", { NULL }, 1029, "udp" }, - { "iad1", { NULL }, 1030, "tcp" }, - { "iad1", { NULL }, 1030, "udp" }, - { "iad2", { NULL }, 1031, "tcp" }, - { "iad2", { NULL }, 1031, "udp" }, - { "iad3", { NULL }, 1032, "tcp" }, - { "iad3", { NULL }, 1032, "udp" }, - { "netinfo-local", { NULL }, 1033, "tcp" }, - { "netinfo-local", { NULL }, 1033, "udp" }, - { "activesync", { NULL }, 1034, "tcp" }, - { "activesync", { NULL }, 1034, "udp" }, - { "mxxrlogin", { NULL }, 1035, "tcp" }, - { "mxxrlogin", { NULL }, 1035, "udp" }, - { "nsstp", { NULL }, 1036, "tcp" }, - { "nsstp", { NULL }, 1036, "udp" }, - { "ams", { NULL }, 1037, "tcp" }, - { "ams", { NULL }, 1037, "udp" }, - { "mtqp", { NULL }, 1038, "tcp" }, - { "mtqp", { NULL }, 1038, "udp" }, - { "sbl", { NULL }, 1039, "tcp" }, - { "sbl", { NULL }, 1039, "udp" }, - { "netarx", { NULL }, 1040, "tcp" }, - { "netarx", { NULL }, 1040, "udp" }, - { "danf-ak2", { NULL }, 1041, "tcp" }, - { "danf-ak2", { NULL }, 1041, "udp" }, - { "afrog", { NULL }, 1042, "tcp" }, - { "afrog", { NULL }, 1042, "udp" }, - { "boinc-client", { NULL }, 1043, "tcp" }, - { "boinc-client", { NULL }, 1043, "udp" }, - { "dcutility", { NULL }, 1044, "tcp" }, - { "dcutility", { NULL }, 1044, "udp" }, - { "fpitp", { NULL }, 1045, "tcp" }, - { "fpitp", { NULL }, 1045, "udp" }, - { "wfremotertm", { NULL }, 1046, "tcp" }, - { "wfremotertm", { NULL }, 1046, "udp" }, - { "neod1", { NULL }, 1047, "tcp" }, - { "neod1", { NULL }, 1047, "udp" }, - { "neod2", { NULL }, 1048, "tcp" }, - { "neod2", { NULL }, 1048, "udp" }, - { "td-postman", { NULL }, 1049, "tcp" }, - { "td-postman", { NULL }, 1049, "udp" }, - { "cma", { NULL }, 1050, "tcp" }, - { "cma", { NULL }, 1050, "udp" }, - { "optima-vnet", { NULL }, 1051, "tcp" }, - { "optima-vnet", { NULL }, 1051, "udp" }, - { "ddt", { NULL }, 1052, "tcp" }, - { "ddt", { NULL }, 1052, "udp" }, - { "remote-as", { NULL }, 1053, "tcp" }, - { "remote-as", { NULL }, 1053, "udp" }, - { "brvread", { NULL }, 1054, "tcp" }, - { "brvread", { NULL }, 1054, "udp" }, - { "ansyslmd", { NULL }, 1055, "tcp" }, - { "ansyslmd", { NULL }, 1055, "udp" }, - { "vfo", { NULL }, 1056, "tcp" }, - { "vfo", { NULL }, 1056, "udp" }, - { "startron", { NULL }, 1057, "tcp" }, - { "startron", { NULL }, 1057, "udp" }, - { "nim", { NULL }, 1058, "tcp" }, - { "nim", { NULL }, 1058, "udp" }, - { "nimreg", { NULL }, 1059, "tcp" }, - { "nimreg", { NULL }, 1059, "udp" }, - { "polestar", { NULL }, 1060, "tcp" }, - { "polestar", { NULL }, 1060, "udp" }, - { "kiosk", { NULL }, 1061, "tcp" }, - { "kiosk", { NULL }, 1061, "udp" }, - { "veracity", { NULL }, 1062, "tcp" }, - { "veracity", { NULL }, 1062, "udp" }, - { "kyoceranetdev", { NULL }, 1063, "tcp" }, - { "kyoceranetdev", { NULL }, 1063, "udp" }, - { "jstel", { NULL }, 1064, "tcp" }, - { "jstel", { NULL }, 1064, "udp" }, - { "syscomlan", { NULL }, 1065, "tcp" }, - { "syscomlan", { NULL }, 1065, "udp" }, - { "fpo-fns", { NULL }, 1066, "tcp" }, - { "fpo-fns", { NULL }, 1066, "udp" }, - { "instl_boots", { NULL }, 1067, "tcp" }, - { "instl_boots", { NULL }, 1067, "udp" }, - { "instl_bootc", { NULL }, 1068, "tcp" }, - { "instl_bootc", { NULL }, 1068, "udp" }, - { "cognex-insight", { NULL }, 1069, "tcp" }, - { "cognex-insight", { NULL }, 1069, "udp" }, - { "gmrupdateserv", { NULL }, 1070, "tcp" }, - { "gmrupdateserv", { NULL }, 1070, "udp" }, - { "bsquare-voip", { NULL }, 1071, "tcp" }, - { "bsquare-voip", { NULL }, 1071, "udp" }, - { "cardax", { NULL }, 1072, "tcp" }, - { "cardax", { NULL }, 1072, "udp" }, - { "bridgecontrol", { NULL }, 1073, "tcp" }, - { "bridgecontrol", { NULL }, 1073, "udp" }, - { "warmspotMgmt", { NULL }, 1074, "tcp" }, - { "warmspotMgmt", { NULL }, 1074, "udp" }, - { "rdrmshc", { NULL }, 1075, "tcp" }, - { "rdrmshc", { NULL }, 1075, "udp" }, - { "dab-sti-c", { NULL }, 1076, "tcp" }, - { "dab-sti-c", { NULL }, 1076, "udp" }, - { "imgames", { NULL }, 1077, "tcp" }, - { "imgames", { NULL }, 1077, "udp" }, - { "avocent-proxy", { NULL }, 1078, "tcp" }, - { "avocent-proxy", { NULL }, 1078, "udp" }, - { "asprovatalk", { NULL }, 1079, "tcp" }, - { "asprovatalk", { NULL }, 1079, "udp" }, - { "socks", { NULL }, 1080, "tcp" }, - { "socks", { NULL }, 1080, "udp" }, - { "pvuniwien", { NULL }, 1081, "tcp" }, - { "pvuniwien", { NULL }, 1081, "udp" }, - { "amt-esd-prot", { NULL }, 1082, "tcp" }, - { "amt-esd-prot", { NULL }, 1082, "udp" }, - { "ansoft-lm-1", { NULL }, 1083, "tcp" }, - { "ansoft-lm-1", { NULL }, 1083, "udp" }, - { "ansoft-lm-2", { NULL }, 1084, "tcp" }, - { "ansoft-lm-2", { NULL }, 1084, "udp" }, - { "webobjects", { NULL }, 1085, "tcp" }, - { "webobjects", { NULL }, 1085, "udp" }, - { "cplscrambler-lg", { NULL }, 1086, "tcp" }, - { "cplscrambler-lg", { NULL }, 1086, "udp" }, - { "cplscrambler-in", { NULL }, 1087, "tcp" }, - { "cplscrambler-in", { NULL }, 1087, "udp" }, - { "cplscrambler-al", { NULL }, 1088, "tcp" }, - { "cplscrambler-al", { NULL }, 1088, "udp" }, - { "ff-annunc", { NULL }, 1089, "tcp" }, - { "ff-annunc", { NULL }, 1089, "udp" }, - { "ff-fms", { NULL }, 1090, "tcp" }, - { "ff-fms", { NULL }, 1090, "udp" }, - { "ff-sm", { NULL }, 1091, "tcp" }, - { "ff-sm", { NULL }, 1091, "udp" }, - { "obrpd", { NULL }, 1092, "tcp" }, - { "obrpd", { NULL }, 1092, "udp" }, - { "proofd", { NULL }, 1093, "tcp" }, - { "proofd", { NULL }, 1093, "udp" }, - { "rootd", { NULL }, 1094, "tcp" }, - { "rootd", { NULL }, 1094, "udp" }, - { "nicelink", { NULL }, 1095, "tcp" }, - { "nicelink", { NULL }, 1095, "udp" }, - { "cnrprotocol", { NULL }, 1096, "tcp" }, - { "cnrprotocol", { NULL }, 1096, "udp" }, - { "sunclustermgr", { NULL }, 1097, "tcp" }, - { "sunclustermgr", { NULL }, 1097, "udp" }, - { "rmiactivation", { NULL }, 1098, "tcp" }, - { "rmiactivation", { NULL }, 1098, "udp" }, - { "rmiregistry", { NULL }, 1099, "tcp" }, - { "rmiregistry", { NULL }, 1099, "udp" }, - { "mctp", { NULL }, 1100, "tcp" }, - { "mctp", { NULL }, 1100, "udp" }, - { "pt2-discover", { NULL }, 1101, "tcp" }, - { "pt2-discover", { NULL }, 1101, "udp" }, - { "adobeserver-1", { NULL }, 1102, "tcp" }, - { "adobeserver-1", { NULL }, 1102, "udp" }, - { "adobeserver-2", { NULL }, 1103, "tcp" }, - { "adobeserver-2", { NULL }, 1103, "udp" }, - { "xrl", { NULL }, 1104, "tcp" }, - { "xrl", { NULL }, 1104, "udp" }, - { "ftranhc", { NULL }, 1105, "tcp" }, - { "ftranhc", { NULL }, 1105, "udp" }, - { "isoipsigport-1", { NULL }, 1106, "tcp" }, - { "isoipsigport-1", { NULL }, 1106, "udp" }, - { "isoipsigport-2", { NULL }, 1107, "tcp" }, - { "isoipsigport-2", { NULL }, 1107, "udp" }, - { "ratio-adp", { NULL }, 1108, "tcp" }, - { "ratio-adp", { NULL }, 1108, "udp" }, - { "webadmstart", { NULL }, 1110, "tcp" }, - { "nfsd-keepalive", { NULL }, 1110, "udp" }, - { "lmsocialserver", { NULL }, 1111, "tcp" }, - { "lmsocialserver", { NULL }, 1111, "udp" }, - { "icp", { NULL }, 1112, "tcp" }, - { "icp", { NULL }, 1112, "udp" }, - { "ltp-deepspace", { NULL }, 1113, "tcp" }, - { "ltp-deepspace", { NULL }, 1113, "udp" }, - { "mini-sql", { NULL }, 1114, "tcp" }, - { "mini-sql", { NULL }, 1114, "udp" }, - { "ardus-trns", { NULL }, 1115, "tcp" }, - { "ardus-trns", { NULL }, 1115, "udp" }, - { "ardus-cntl", { NULL }, 1116, "tcp" }, - { "ardus-cntl", { NULL }, 1116, "udp" }, - { "ardus-mtrns", { NULL }, 1117, "tcp" }, - { "ardus-mtrns", { NULL }, 1117, "udp" }, - { "sacred", { NULL }, 1118, "tcp" }, - { "sacred", { NULL }, 1118, "udp" }, - { "bnetgame", { NULL }, 1119, "tcp" }, - { "bnetgame", { NULL }, 1119, "udp" }, - { "bnetfile", { NULL }, 1120, "tcp" }, - { "bnetfile", { NULL }, 1120, "udp" }, - { "rmpp", { NULL }, 1121, "tcp" }, - { "rmpp", { NULL }, 1121, "udp" }, - { "availant-mgr", { NULL }, 1122, "tcp" }, - { "availant-mgr", { NULL }, 1122, "udp" }, - { "murray", { NULL }, 1123, "tcp" }, - { "murray", { NULL }, 1123, "udp" }, - { "hpvmmcontrol", { NULL }, 1124, "tcp" }, - { "hpvmmcontrol", { NULL }, 1124, "udp" }, - { "hpvmmagent", { NULL }, 1125, "tcp" }, - { "hpvmmagent", { NULL }, 1125, "udp" }, - { "hpvmmdata", { NULL }, 1126, "tcp" }, - { "hpvmmdata", { NULL }, 1126, "udp" }, - { "kwdb-commn", { NULL }, 1127, "tcp" }, - { "kwdb-commn", { NULL }, 1127, "udp" }, - { "saphostctrl", { NULL }, 1128, "tcp" }, - { "saphostctrl", { NULL }, 1128, "udp" }, - { "saphostctrls", { NULL }, 1129, "tcp" }, - { "saphostctrls", { NULL }, 1129, "udp" }, - { "casp", { NULL }, 1130, "tcp" }, - { "casp", { NULL }, 1130, "udp" }, - { "caspssl", { NULL }, 1131, "tcp" }, - { "caspssl", { NULL }, 1131, "udp" }, - { "kvm-via-ip", { NULL }, 1132, "tcp" }, - { "kvm-via-ip", { NULL }, 1132, "udp" }, - { "dfn", { NULL }, 1133, "tcp" }, - { "dfn", { NULL }, 1133, "udp" }, - { "aplx", { NULL }, 1134, "tcp" }, - { "aplx", { NULL }, 1134, "udp" }, - { "omnivision", { NULL }, 1135, "tcp" }, - { "omnivision", { NULL }, 1135, "udp" }, - { "hhb-gateway", { NULL }, 1136, "tcp" }, - { "hhb-gateway", { NULL }, 1136, "udp" }, - { "trim", { NULL }, 1137, "tcp" }, - { "trim", { NULL }, 1137, "udp" }, - { "encrypted_admin", { NULL }, 1138, "tcp" }, - { "encrypted_admin", { NULL }, 1138, "udp" }, - { "evm", { NULL }, 1139, "tcp" }, - { "evm", { NULL }, 1139, "udp" }, - { "autonoc", { NULL }, 1140, "tcp" }, - { "autonoc", { NULL }, 1140, "udp" }, - { "mxomss", { NULL }, 1141, "tcp" }, - { "mxomss", { NULL }, 1141, "udp" }, - { "edtools", { NULL }, 1142, "tcp" }, - { "edtools", { NULL }, 1142, "udp" }, - { "imyx", { NULL }, 1143, "tcp" }, - { "imyx", { NULL }, 1143, "udp" }, - { "fuscript", { NULL }, 1144, "tcp" }, - { "fuscript", { NULL }, 1144, "udp" }, - { "x9-icue", { NULL }, 1145, "tcp" }, - { "x9-icue", { NULL }, 1145, "udp" }, - { "audit-transfer", { NULL }, 1146, "tcp" }, - { "audit-transfer", { NULL }, 1146, "udp" }, - { "capioverlan", { NULL }, 1147, "tcp" }, - { "capioverlan", { NULL }, 1147, "udp" }, - { "elfiq-repl", { NULL }, 1148, "tcp" }, - { "elfiq-repl", { NULL }, 1148, "udp" }, - { "bvtsonar", { NULL }, 1149, "tcp" }, - { "bvtsonar", { NULL }, 1149, "udp" }, - { "blaze", { NULL }, 1150, "tcp" }, - { "blaze", { NULL }, 1150, "udp" }, - { "unizensus", { NULL }, 1151, "tcp" }, - { "unizensus", { NULL }, 1151, "udp" }, - { "winpoplanmess", { NULL }, 1152, "tcp" }, - { "winpoplanmess", { NULL }, 1152, "udp" }, - { "c1222-acse", { NULL }, 1153, "tcp" }, - { "c1222-acse", { NULL }, 1153, "udp" }, - { "resacommunity", { NULL }, 1154, "tcp" }, - { "resacommunity", { NULL }, 1154, "udp" }, - { "nfa", { NULL }, 1155, "tcp" }, - { "nfa", { NULL }, 1155, "udp" }, - { "iascontrol-oms", { NULL }, 1156, "tcp" }, - { "iascontrol-oms", { NULL }, 1156, "udp" }, - { "iascontrol", { NULL }, 1157, "tcp" }, - { "iascontrol", { NULL }, 1157, "udp" }, - { "dbcontrol-oms", { NULL }, 1158, "tcp" }, - { "dbcontrol-oms", { NULL }, 1158, "udp" }, - { "oracle-oms", { NULL }, 1159, "tcp" }, - { "oracle-oms", { NULL }, 1159, "udp" }, - { "olsv", { NULL }, 1160, "tcp" }, - { "olsv", { NULL }, 1160, "udp" }, - { "health-polling", { NULL }, 1161, "tcp" }, - { "health-polling", { NULL }, 1161, "udp" }, - { "health-trap", { NULL }, 1162, "tcp" }, - { "health-trap", { NULL }, 1162, "udp" }, - { "sddp", { NULL }, 1163, "tcp" }, - { "sddp", { NULL }, 1163, "udp" }, - { "qsm-proxy", { NULL }, 1164, "tcp" }, - { "qsm-proxy", { NULL }, 1164, "udp" }, - { "qsm-gui", { NULL }, 1165, "tcp" }, - { "qsm-gui", { NULL }, 1165, "udp" }, - { "qsm-remote", { NULL }, 1166, "tcp" }, - { "qsm-remote", { NULL }, 1166, "udp" }, - { "cisco-ipsla", { NULL }, 1167, "tcp" }, - { "cisco-ipsla", { NULL }, 1167, "udp" }, - { "cisco-ipsla", { NULL }, 1167, "sctp" }, - { "vchat", { NULL }, 1168, "tcp" }, - { "vchat", { NULL }, 1168, "udp" }, - { "tripwire", { NULL }, 1169, "tcp" }, - { "tripwire", { NULL }, 1169, "udp" }, - { "atc-lm", { NULL }, 1170, "tcp" }, - { "atc-lm", { NULL }, 1170, "udp" }, - { "atc-appserver", { NULL }, 1171, "tcp" }, - { "atc-appserver", { NULL }, 1171, "udp" }, - { "dnap", { NULL }, 1172, "tcp" }, - { "dnap", { NULL }, 1172, "udp" }, - { "d-cinema-rrp", { NULL }, 1173, "tcp" }, - { "d-cinema-rrp", { NULL }, 1173, "udp" }, - { "fnet-remote-ui", { NULL }, 1174, "tcp" }, - { "fnet-remote-ui", { NULL }, 1174, "udp" }, - { "dossier", { NULL }, 1175, "tcp" }, - { "dossier", { NULL }, 1175, "udp" }, - { "indigo-server", { NULL }, 1176, "tcp" }, - { "indigo-server", { NULL }, 1176, "udp" }, - { "dkmessenger", { NULL }, 1177, "tcp" }, - { "dkmessenger", { NULL }, 1177, "udp" }, - { "sgi-storman", { NULL }, 1178, "tcp" }, - { "sgi-storman", { NULL }, 1178, "udp" }, - { "b2n", { NULL }, 1179, "tcp" }, - { "b2n", { NULL }, 1179, "udp" }, - { "mc-client", { NULL }, 1180, "tcp" }, - { "mc-client", { NULL }, 1180, "udp" }, - { "3comnetman", { NULL }, 1181, "tcp" }, - { "3comnetman", { NULL }, 1181, "udp" }, - { "accelenet", { NULL }, 1182, "tcp" }, - { "accelenet-data", { NULL }, 1182, "udp" }, - { "llsurfup-http", { NULL }, 1183, "tcp" }, - { "llsurfup-http", { NULL }, 1183, "udp" }, - { "llsurfup-https", { NULL }, 1184, "tcp" }, - { "llsurfup-https", { NULL }, 1184, "udp" }, - { "catchpole", { NULL }, 1185, "tcp" }, - { "catchpole", { NULL }, 1185, "udp" }, - { "mysql-cluster", { NULL }, 1186, "tcp" }, - { "mysql-cluster", { NULL }, 1186, "udp" }, - { "alias", { NULL }, 1187, "tcp" }, - { "alias", { NULL }, 1187, "udp" }, - { "hp-webadmin", { NULL }, 1188, "tcp" }, - { "hp-webadmin", { NULL }, 1188, "udp" }, - { "unet", { NULL }, 1189, "tcp" }, - { "unet", { NULL }, 1189, "udp" }, - { "commlinx-avl", { NULL }, 1190, "tcp" }, - { "commlinx-avl", { NULL }, 1190, "udp" }, - { "gpfs", { NULL }, 1191, "tcp" }, - { "gpfs", { NULL }, 1191, "udp" }, - { "caids-sensor", { NULL }, 1192, "tcp" }, - { "caids-sensor", { NULL }, 1192, "udp" }, - { "fiveacross", { NULL }, 1193, "tcp" }, - { "fiveacross", { NULL }, 1193, "udp" }, - { "openvpn", { NULL }, 1194, "tcp" }, - { "openvpn", { NULL }, 1194, "udp" }, - { "rsf-1", { NULL }, 1195, "tcp" }, - { "rsf-1", { NULL }, 1195, "udp" }, - { "netmagic", { NULL }, 1196, "tcp" }, - { "netmagic", { NULL }, 1196, "udp" }, - { "carrius-rshell", { NULL }, 1197, "tcp" }, - { "carrius-rshell", { NULL }, 1197, "udp" }, - { "cajo-discovery", { NULL }, 1198, "tcp" }, - { "cajo-discovery", { NULL }, 1198, "udp" }, - { "dmidi", { NULL }, 1199, "tcp" }, - { "dmidi", { NULL }, 1199, "udp" }, - { "scol", { NULL }, 1200, "tcp" }, - { "scol", { NULL }, 1200, "udp" }, - { "nucleus-sand", { NULL }, 1201, "tcp" }, - { "nucleus-sand", { NULL }, 1201, "udp" }, - { "caiccipc", { NULL }, 1202, "tcp" }, - { "caiccipc", { NULL }, 1202, "udp" }, - { "ssslic-mgr", { NULL }, 1203, "tcp" }, - { "ssslic-mgr", { NULL }, 1203, "udp" }, - { "ssslog-mgr", { NULL }, 1204, "tcp" }, - { "ssslog-mgr", { NULL }, 1204, "udp" }, - { "accord-mgc", { NULL }, 1205, "tcp" }, - { "accord-mgc", { NULL }, 1205, "udp" }, - { "anthony-data", { NULL }, 1206, "tcp" }, - { "anthony-data", { NULL }, 1206, "udp" }, - { "metasage", { NULL }, 1207, "tcp" }, - { "metasage", { NULL }, 1207, "udp" }, - { "seagull-ais", { NULL }, 1208, "tcp" }, - { "seagull-ais", { NULL }, 1208, "udp" }, - { "ipcd3", { NULL }, 1209, "tcp" }, - { "ipcd3", { NULL }, 1209, "udp" }, - { "eoss", { NULL }, 1210, "tcp" }, - { "eoss", { NULL }, 1210, "udp" }, - { "groove-dpp", { NULL }, 1211, "tcp" }, - { "groove-dpp", { NULL }, 1211, "udp" }, - { "lupa", { NULL }, 1212, "tcp" }, - { "lupa", { NULL }, 1212, "udp" }, - { "mpc-lifenet", { NULL }, 1213, "tcp" }, - { "mpc-lifenet", { NULL }, 1213, "udp" }, - { "kazaa", { NULL }, 1214, "tcp" }, - { "kazaa", { NULL }, 1214, "udp" }, - { "scanstat-1", { NULL }, 1215, "tcp" }, - { "scanstat-1", { NULL }, 1215, "udp" }, - { "etebac5", { NULL }, 1216, "tcp" }, - { "etebac5", { NULL }, 1216, "udp" }, - { "hpss-ndapi", { NULL }, 1217, "tcp" }, - { "hpss-ndapi", { NULL }, 1217, "udp" }, - { "aeroflight-ads", { NULL }, 1218, "tcp" }, - { "aeroflight-ads", { NULL }, 1218, "udp" }, - { "aeroflight-ret", { NULL }, 1219, "tcp" }, - { "aeroflight-ret", { NULL }, 1219, "udp" }, - { "qt-serveradmin", { NULL }, 1220, "tcp" }, - { "qt-serveradmin", { NULL }, 1220, "udp" }, - { "sweetware-apps", { NULL }, 1221, "tcp" }, - { "sweetware-apps", { NULL }, 1221, "udp" }, - { "nerv", { NULL }, 1222, "tcp" }, - { "nerv", { NULL }, 1222, "udp" }, - { "tgp", { NULL }, 1223, "tcp" }, - { "tgp", { NULL }, 1223, "udp" }, - { "vpnz", { NULL }, 1224, "tcp" }, - { "vpnz", { NULL }, 1224, "udp" }, - { "slinkysearch", { NULL }, 1225, "tcp" }, - { "slinkysearch", { NULL }, 1225, "udp" }, - { "stgxfws", { NULL }, 1226, "tcp" }, - { "stgxfws", { NULL }, 1226, "udp" }, - { "dns2go", { NULL }, 1227, "tcp" }, - { "dns2go", { NULL }, 1227, "udp" }, - { "florence", { NULL }, 1228, "tcp" }, - { "florence", { NULL }, 1228, "udp" }, - { "zented", { NULL }, 1229, "tcp" }, - { "zented", { NULL }, 1229, "udp" }, - { "periscope", { NULL }, 1230, "tcp" }, - { "periscope", { NULL }, 1230, "udp" }, - { "menandmice-lpm", { NULL }, 1231, "tcp" }, - { "menandmice-lpm", { NULL }, 1231, "udp" }, - { "univ-appserver", { NULL }, 1233, "tcp" }, - { "univ-appserver", { NULL }, 1233, "udp" }, - { "search-agent", { NULL }, 1234, "tcp" }, - { "search-agent", { NULL }, 1234, "udp" }, - { "mosaicsyssvc1", { NULL }, 1235, "tcp" }, - { "mosaicsyssvc1", { NULL }, 1235, "udp" }, - { "bvcontrol", { NULL }, 1236, "tcp" }, - { "bvcontrol", { NULL }, 1236, "udp" }, - { "tsdos390", { NULL }, 1237, "tcp" }, - { "tsdos390", { NULL }, 1237, "udp" }, - { "hacl-qs", { NULL }, 1238, "tcp" }, - { "hacl-qs", { NULL }, 1238, "udp" }, - { "nmsd", { NULL }, 1239, "tcp" }, - { "nmsd", { NULL }, 1239, "udp" }, - { "instantia", { NULL }, 1240, "tcp" }, - { "instantia", { NULL }, 1240, "udp" }, - { "nessus", { NULL }, 1241, "tcp" }, - { "nessus", { NULL }, 1241, "udp" }, - { "nmasoverip", { NULL }, 1242, "tcp" }, - { "nmasoverip", { NULL }, 1242, "udp" }, - { "serialgateway", { NULL }, 1243, "tcp" }, - { "serialgateway", { NULL }, 1243, "udp" }, - { "isbconference1", { NULL }, 1244, "tcp" }, - { "isbconference1", { NULL }, 1244, "udp" }, - { "isbconference2", { NULL }, 1245, "tcp" }, - { "isbconference2", { NULL }, 1245, "udp" }, - { "payrouter", { NULL }, 1246, "tcp" }, - { "payrouter", { NULL }, 1246, "udp" }, - { "visionpyramid", { NULL }, 1247, "tcp" }, - { "visionpyramid", { NULL }, 1247, "udp" }, - { "hermes", { NULL }, 1248, "tcp" }, - { "hermes", { NULL }, 1248, "udp" }, - { "mesavistaco", { NULL }, 1249, "tcp" }, - { "mesavistaco", { NULL }, 1249, "udp" }, - { "swldy-sias", { NULL }, 1250, "tcp" }, - { "swldy-sias", { NULL }, 1250, "udp" }, - { "servergraph", { NULL }, 1251, "tcp" }, - { "servergraph", { NULL }, 1251, "udp" }, - { "bspne-pcc", { NULL }, 1252, "tcp" }, - { "bspne-pcc", { NULL }, 1252, "udp" }, - { "q55-pcc", { NULL }, 1253, "tcp" }, - { "q55-pcc", { NULL }, 1253, "udp" }, - { "de-noc", { NULL }, 1254, "tcp" }, - { "de-noc", { NULL }, 1254, "udp" }, - { "de-cache-query", { NULL }, 1255, "tcp" }, - { "de-cache-query", { NULL }, 1255, "udp" }, - { "de-server", { NULL }, 1256, "tcp" }, - { "de-server", { NULL }, 1256, "udp" }, - { "shockwave2", { NULL }, 1257, "tcp" }, - { "shockwave2", { NULL }, 1257, "udp" }, - { "opennl", { NULL }, 1258, "tcp" }, - { "opennl", { NULL }, 1258, "udp" }, - { "opennl-voice", { NULL }, 1259, "tcp" }, - { "opennl-voice", { NULL }, 1259, "udp" }, - { "ibm-ssd", { NULL }, 1260, "tcp" }, - { "ibm-ssd", { NULL }, 1260, "udp" }, - { "mpshrsv", { NULL }, 1261, "tcp" }, - { "mpshrsv", { NULL }, 1261, "udp" }, - { "qnts-orb", { NULL }, 1262, "tcp" }, - { "qnts-orb", { NULL }, 1262, "udp" }, - { "dka", { NULL }, 1263, "tcp" }, - { "dka", { NULL }, 1263, "udp" }, - { "prat", { NULL }, 1264, "tcp" }, - { "prat", { NULL }, 1264, "udp" }, - { "dssiapi", { NULL }, 1265, "tcp" }, - { "dssiapi", { NULL }, 1265, "udp" }, - { "dellpwrappks", { NULL }, 1266, "tcp" }, - { "dellpwrappks", { NULL }, 1266, "udp" }, - { "epc", { NULL }, 1267, "tcp" }, - { "epc", { NULL }, 1267, "udp" }, - { "propel-msgsys", { NULL }, 1268, "tcp" }, - { "propel-msgsys", { NULL }, 1268, "udp" }, - { "watilapp", { NULL }, 1269, "tcp" }, - { "watilapp", { NULL }, 1269, "udp" }, - { "opsmgr", { NULL }, 1270, "tcp" }, - { "opsmgr", { NULL }, 1270, "udp" }, - { "excw", { NULL }, 1271, "tcp" }, - { "excw", { NULL }, 1271, "udp" }, - { "cspmlockmgr", { NULL }, 1272, "tcp" }, - { "cspmlockmgr", { NULL }, 1272, "udp" }, - { "emc-gateway", { NULL }, 1273, "tcp" }, - { "emc-gateway", { NULL }, 1273, "udp" }, - { "t1distproc", { NULL }, 1274, "tcp" }, - { "t1distproc", { NULL }, 1274, "udp" }, - { "ivcollector", { NULL }, 1275, "tcp" }, - { "ivcollector", { NULL }, 1275, "udp" }, - { "ivmanager", { NULL }, 1276, "tcp" }, - { "ivmanager", { NULL }, 1276, "udp" }, - { "miva-mqs", { NULL }, 1277, "tcp" }, - { "miva-mqs", { NULL }, 1277, "udp" }, - { "dellwebadmin-1", { NULL }, 1278, "tcp" }, - { "dellwebadmin-1", { NULL }, 1278, "udp" }, - { "dellwebadmin-2", { NULL }, 1279, "tcp" }, - { "dellwebadmin-2", { NULL }, 1279, "udp" }, - { "pictrography", { NULL }, 1280, "tcp" }, - { "pictrography", { NULL }, 1280, "udp" }, - { "healthd", { NULL }, 1281, "tcp" }, - { "healthd", { NULL }, 1281, "udp" }, - { "emperion", { NULL }, 1282, "tcp" }, - { "emperion", { NULL }, 1282, "udp" }, - { "productinfo", { NULL }, 1283, "tcp" }, - { "productinfo", { NULL }, 1283, "udp" }, - { "iee-qfx", { NULL }, 1284, "tcp" }, - { "iee-qfx", { NULL }, 1284, "udp" }, - { "neoiface", { NULL }, 1285, "tcp" }, - { "neoiface", { NULL }, 1285, "udp" }, - { "netuitive", { NULL }, 1286, "tcp" }, - { "netuitive", { NULL }, 1286, "udp" }, - { "routematch", { NULL }, 1287, "tcp" }, - { "routematch", { NULL }, 1287, "udp" }, - { "navbuddy", { NULL }, 1288, "tcp" }, - { "navbuddy", { NULL }, 1288, "udp" }, - { "jwalkserver", { NULL }, 1289, "tcp" }, - { "jwalkserver", { NULL }, 1289, "udp" }, - { "winjaserver", { NULL }, 1290, "tcp" }, - { "winjaserver", { NULL }, 1290, "udp" }, - { "seagulllms", { NULL }, 1291, "tcp" }, - { "seagulllms", { NULL }, 1291, "udp" }, - { "dsdn", { NULL }, 1292, "tcp" }, - { "dsdn", { NULL }, 1292, "udp" }, - { "pkt-krb-ipsec", { NULL }, 1293, "tcp" }, - { "pkt-krb-ipsec", { NULL }, 1293, "udp" }, - { "cmmdriver", { NULL }, 1294, "tcp" }, - { "cmmdriver", { NULL }, 1294, "udp" }, - { "ehtp", { NULL }, 1295, "tcp" }, - { "ehtp", { NULL }, 1295, "udp" }, - { "dproxy", { NULL }, 1296, "tcp" }, - { "dproxy", { NULL }, 1296, "udp" }, - { "sdproxy", { NULL }, 1297, "tcp" }, - { "sdproxy", { NULL }, 1297, "udp" }, - { "lpcp", { NULL }, 1298, "tcp" }, - { "lpcp", { NULL }, 1298, "udp" }, - { "hp-sci", { NULL }, 1299, "tcp" }, - { "hp-sci", { NULL }, 1299, "udp" }, - { "h323hostcallsc", { NULL }, 1300, "tcp" }, - { "h323hostcallsc", { NULL }, 1300, "udp" }, - { "ci3-software-1", { NULL }, 1301, "tcp" }, - { "ci3-software-1", { NULL }, 1301, "udp" }, - { "ci3-software-2", { NULL }, 1302, "tcp" }, - { "ci3-software-2", { NULL }, 1302, "udp" }, - { "sftsrv", { NULL }, 1303, "tcp" }, - { "sftsrv", { NULL }, 1303, "udp" }, - { "boomerang", { NULL }, 1304, "tcp" }, - { "boomerang", { NULL }, 1304, "udp" }, - { "pe-mike", { NULL }, 1305, "tcp" }, - { "pe-mike", { NULL }, 1305, "udp" }, - { "re-conn-proto", { NULL }, 1306, "tcp" }, - { "re-conn-proto", { NULL }, 1306, "udp" }, - { "pacmand", { NULL }, 1307, "tcp" }, - { "pacmand", { NULL }, 1307, "udp" }, - { "odsi", { NULL }, 1308, "tcp" }, - { "odsi", { NULL }, 1308, "udp" }, - { "jtag-server", { NULL }, 1309, "tcp" }, - { "jtag-server", { NULL }, 1309, "udp" }, - { "husky", { NULL }, 1310, "tcp" }, - { "husky", { NULL }, 1310, "udp" }, - { "rxmon", { NULL }, 1311, "tcp" }, - { "rxmon", { NULL }, 1311, "udp" }, - { "sti-envision", { NULL }, 1312, "tcp" }, - { "sti-envision", { NULL }, 1312, "udp" }, - { "bmc_patroldb", { NULL }, 1313, "tcp" }, - { "bmc_patroldb", { NULL }, 1313, "udp" }, - { "pdps", { NULL }, 1314, "tcp" }, - { "pdps", { NULL }, 1314, "udp" }, - { "els", { NULL }, 1315, "tcp" }, - { "els", { NULL }, 1315, "udp" }, - { "exbit-escp", { NULL }, 1316, "tcp" }, - { "exbit-escp", { NULL }, 1316, "udp" }, - { "vrts-ipcserver", { NULL }, 1317, "tcp" }, - { "vrts-ipcserver", { NULL }, 1317, "udp" }, - { "krb5gatekeeper", { NULL }, 1318, "tcp" }, - { "krb5gatekeeper", { NULL }, 1318, "udp" }, - { "amx-icsp", { NULL }, 1319, "tcp" }, - { "amx-icsp", { NULL }, 1319, "udp" }, - { "amx-axbnet", { NULL }, 1320, "tcp" }, - { "amx-axbnet", { NULL }, 1320, "udp" }, - { "pip", { NULL }, 1321, "tcp" }, - { "pip", { NULL }, 1321, "udp" }, - { "novation", { NULL }, 1322, "tcp" }, - { "novation", { NULL }, 1322, "udp" }, - { "brcd", { NULL }, 1323, "tcp" }, - { "brcd", { NULL }, 1323, "udp" }, - { "delta-mcp", { NULL }, 1324, "tcp" }, - { "delta-mcp", { NULL }, 1324, "udp" }, - { "dx-instrument", { NULL }, 1325, "tcp" }, - { "dx-instrument", { NULL }, 1325, "udp" }, - { "wimsic", { NULL }, 1326, "tcp" }, - { "wimsic", { NULL }, 1326, "udp" }, - { "ultrex", { NULL }, 1327, "tcp" }, - { "ultrex", { NULL }, 1327, "udp" }, - { "ewall", { NULL }, 1328, "tcp" }, - { "ewall", { NULL }, 1328, "udp" }, - { "netdb-export", { NULL }, 1329, "tcp" }, - { "netdb-export", { NULL }, 1329, "udp" }, - { "streetperfect", { NULL }, 1330, "tcp" }, - { "streetperfect", { NULL }, 1330, "udp" }, - { "intersan", { NULL }, 1331, "tcp" }, - { "intersan", { NULL }, 1331, "udp" }, - { "pcia-rxp-b", { NULL }, 1332, "tcp" }, - { "pcia-rxp-b", { NULL }, 1332, "udp" }, - { "passwrd-policy", { NULL }, 1333, "tcp" }, - { "passwrd-policy", { NULL }, 1333, "udp" }, - { "writesrv", { NULL }, 1334, "tcp" }, - { "writesrv", { NULL }, 1334, "udp" }, - { "digital-notary", { NULL }, 1335, "tcp" }, - { "digital-notary", { NULL }, 1335, "udp" }, - { "ischat", { NULL }, 1336, "tcp" }, - { "ischat", { NULL }, 1336, "udp" }, - { "menandmice-dns", { NULL }, 1337, "tcp" }, - { "menandmice-dns", { NULL }, 1337, "udp" }, - { "wmc-log-svc", { NULL }, 1338, "tcp" }, - { "wmc-log-svc", { NULL }, 1338, "udp" }, - { "kjtsiteserver", { NULL }, 1339, "tcp" }, - { "kjtsiteserver", { NULL }, 1339, "udp" }, - { "naap", { NULL }, 1340, "tcp" }, - { "naap", { NULL }, 1340, "udp" }, - { "qubes", { NULL }, 1341, "tcp" }, - { "qubes", { NULL }, 1341, "udp" }, - { "esbroker", { NULL }, 1342, "tcp" }, - { "esbroker", { NULL }, 1342, "udp" }, - { "re101", { NULL }, 1343, "tcp" }, - { "re101", { NULL }, 1343, "udp" }, - { "icap", { NULL }, 1344, "tcp" }, - { "icap", { NULL }, 1344, "udp" }, - { "vpjp", { NULL }, 1345, "tcp" }, - { "vpjp", { NULL }, 1345, "udp" }, - { "alta-ana-lm", { NULL }, 1346, "tcp" }, - { "alta-ana-lm", { NULL }, 1346, "udp" }, - { "bbn-mmc", { NULL }, 1347, "tcp" }, - { "bbn-mmc", { NULL }, 1347, "udp" }, - { "bbn-mmx", { NULL }, 1348, "tcp" }, - { "bbn-mmx", { NULL }, 1348, "udp" }, - { "sbook", { NULL }, 1349, "tcp" }, - { "sbook", { NULL }, 1349, "udp" }, - { "editbench", { NULL }, 1350, "tcp" }, - { "editbench", { NULL }, 1350, "udp" }, - { "equationbuilder", { NULL }, 1351, "tcp" }, - { "equationbuilder", { NULL }, 1351, "udp" }, - { "lotusnote", { NULL }, 1352, "tcp" }, - { "lotusnote", { NULL }, 1352, "udp" }, - { "relief", { NULL }, 1353, "tcp" }, - { "relief", { NULL }, 1353, "udp" }, - { "XSIP-network", { NULL }, 1354, "tcp" }, - { "XSIP-network", { NULL }, 1354, "udp" }, - { "intuitive-edge", { NULL }, 1355, "tcp" }, - { "intuitive-edge", { NULL }, 1355, "udp" }, - { "cuillamartin", { NULL }, 1356, "tcp" }, - { "cuillamartin", { NULL }, 1356, "udp" }, - { "pegboard", { NULL }, 1357, "tcp" }, - { "pegboard", { NULL }, 1357, "udp" }, - { "connlcli", { NULL }, 1358, "tcp" }, - { "connlcli", { NULL }, 1358, "udp" }, - { "ftsrv", { NULL }, 1359, "tcp" }, - { "ftsrv", { NULL }, 1359, "udp" }, - { "mimer", { NULL }, 1360, "tcp" }, - { "mimer", { NULL }, 1360, "udp" }, - { "linx", { NULL }, 1361, "tcp" }, - { "linx", { NULL }, 1361, "udp" }, - { "timeflies", { NULL }, 1362, "tcp" }, - { "timeflies", { NULL }, 1362, "udp" }, - { "ndm-requester", { NULL }, 1363, "tcp" }, - { "ndm-requester", { NULL }, 1363, "udp" }, - { "ndm-server", { NULL }, 1364, "tcp" }, - { "ndm-server", { NULL }, 1364, "udp" }, - { "adapt-sna", { NULL }, 1365, "tcp" }, - { "adapt-sna", { NULL }, 1365, "udp" }, - { "netware-csp", { NULL }, 1366, "tcp" }, - { "netware-csp", { NULL }, 1366, "udp" }, - { "dcs", { NULL }, 1367, "tcp" }, - { "dcs", { NULL }, 1367, "udp" }, - { "screencast", { NULL }, 1368, "tcp" }, - { "screencast", { NULL }, 1368, "udp" }, - { "gv-us", { NULL }, 1369, "tcp" }, - { "gv-us", { NULL }, 1369, "udp" }, - { "us-gv", { NULL }, 1370, "tcp" }, - { "us-gv", { NULL }, 1370, "udp" }, - { "fc-cli", { NULL }, 1371, "tcp" }, - { "fc-cli", { NULL }, 1371, "udp" }, - { "fc-ser", { NULL }, 1372, "tcp" }, - { "fc-ser", { NULL }, 1372, "udp" }, - { "chromagrafx", { NULL }, 1373, "tcp" }, - { "chromagrafx", { NULL }, 1373, "udp" }, - { "molly", { NULL }, 1374, "tcp" }, - { "molly", { NULL }, 1374, "udp" }, - { "bytex", { NULL }, 1375, "tcp" }, - { "bytex", { NULL }, 1375, "udp" }, - { "ibm-pps", { NULL }, 1376, "tcp" }, - { "ibm-pps", { NULL }, 1376, "udp" }, - { "cichlid", { NULL }, 1377, "tcp" }, - { "cichlid", { NULL }, 1377, "udp" }, - { "elan", { NULL }, 1378, "tcp" }, - { "elan", { NULL }, 1378, "udp" }, - { "dbreporter", { NULL }, 1379, "tcp" }, - { "dbreporter", { NULL }, 1379, "udp" }, - { "telesis-licman", { NULL }, 1380, "tcp" }, - { "telesis-licman", { NULL }, 1380, "udp" }, - { "apple-licman", { NULL }, 1381, "tcp" }, - { "apple-licman", { NULL }, 1381, "udp" }, - { "udt_os", { NULL }, 1382, "tcp" }, - { "udt_os", { NULL }, 1382, "udp" }, - { "gwha", { NULL }, 1383, "tcp" }, - { "gwha", { NULL }, 1383, "udp" }, - { "os-licman", { NULL }, 1384, "tcp" }, - { "os-licman", { NULL }, 1384, "udp" }, - { "atex_elmd", { NULL }, 1385, "tcp" }, - { "atex_elmd", { NULL }, 1385, "udp" }, - { "checksum", { NULL }, 1386, "tcp" }, - { "checksum", { NULL }, 1386, "udp" }, - { "cadsi-lm", { NULL }, 1387, "tcp" }, - { "cadsi-lm", { NULL }, 1387, "udp" }, - { "objective-dbc", { NULL }, 1388, "tcp" }, - { "objective-dbc", { NULL }, 1388, "udp" }, - { "iclpv-dm", { NULL }, 1389, "tcp" }, - { "iclpv-dm", { NULL }, 1389, "udp" }, - { "iclpv-sc", { NULL }, 1390, "tcp" }, - { "iclpv-sc", { NULL }, 1390, "udp" }, - { "iclpv-sas", { NULL }, 1391, "tcp" }, - { "iclpv-sas", { NULL }, 1391, "udp" }, - { "iclpv-pm", { NULL }, 1392, "tcp" }, - { "iclpv-pm", { NULL }, 1392, "udp" }, - { "iclpv-nls", { NULL }, 1393, "tcp" }, - { "iclpv-nls", { NULL }, 1393, "udp" }, - { "iclpv-nlc", { NULL }, 1394, "tcp" }, - { "iclpv-nlc", { NULL }, 1394, "udp" }, - { "iclpv-wsm", { NULL }, 1395, "tcp" }, - { "iclpv-wsm", { NULL }, 1395, "udp" }, - { "dvl-activemail", { NULL }, 1396, "tcp" }, - { "dvl-activemail", { NULL }, 1396, "udp" }, - { "audio-activmail", { NULL }, 1397, "tcp" }, - { "audio-activmail", { NULL }, 1397, "udp" }, - { "video-activmail", { NULL }, 1398, "tcp" }, - { "video-activmail", { NULL }, 1398, "udp" }, - { "cadkey-licman", { NULL }, 1399, "tcp" }, - { "cadkey-licman", { NULL }, 1399, "udp" }, - { "cadkey-tablet", { NULL }, 1400, "tcp" }, - { "cadkey-tablet", { NULL }, 1400, "udp" }, - { "goldleaf-licman", { NULL }, 1401, "tcp" }, - { "goldleaf-licman", { NULL }, 1401, "udp" }, - { "prm-sm-np", { NULL }, 1402, "tcp" }, - { "prm-sm-np", { NULL }, 1402, "udp" }, - { "prm-nm-np", { NULL }, 1403, "tcp" }, - { "prm-nm-np", { NULL }, 1403, "udp" }, - { "igi-lm", { NULL }, 1404, "tcp" }, - { "igi-lm", { NULL }, 1404, "udp" }, - { "ibm-res", { NULL }, 1405, "tcp" }, - { "ibm-res", { NULL }, 1405, "udp" }, - { "netlabs-lm", { NULL }, 1406, "tcp" }, - { "netlabs-lm", { NULL }, 1406, "udp" }, - { "dbsa-lm", { NULL }, 1407, "tcp" }, - { "dbsa-lm", { NULL }, 1407, "udp" }, - { "sophia-lm", { NULL }, 1408, "tcp" }, - { "sophia-lm", { NULL }, 1408, "udp" }, - { "here-lm", { NULL }, 1409, "tcp" }, - { "here-lm", { NULL }, 1409, "udp" }, - { "hiq", { NULL }, 1410, "tcp" }, - { "hiq", { NULL }, 1410, "udp" }, - { "af", { NULL }, 1411, "tcp" }, - { "af", { NULL }, 1411, "udp" }, - { "innosys", { NULL }, 1412, "tcp" }, - { "innosys", { NULL }, 1412, "udp" }, - { "innosys-acl", { NULL }, 1413, "tcp" }, - { "innosys-acl", { NULL }, 1413, "udp" }, - { "ibm-mqseries", { NULL }, 1414, "tcp" }, - { "ibm-mqseries", { NULL }, 1414, "udp" }, - { "dbstar", { NULL }, 1415, "tcp" }, - { "dbstar", { NULL }, 1415, "udp" }, - { "novell-lu6.2", { NULL }, 1416, "tcp" }, - { "novell-lu6.2", { NULL }, 1416, "udp" }, - { "timbuktu-srv1", { NULL }, 1417, "tcp" }, - { "timbuktu-srv1", { NULL }, 1417, "udp" }, - { "timbuktu-srv2", { NULL }, 1418, "tcp" }, - { "timbuktu-srv2", { NULL }, 1418, "udp" }, - { "timbuktu-srv3", { NULL }, 1419, "tcp" }, - { "timbuktu-srv3", { NULL }, 1419, "udp" }, - { "timbuktu-srv4", { NULL }, 1420, "tcp" }, - { "timbuktu-srv4", { NULL }, 1420, "udp" }, - { "gandalf-lm", { NULL }, 1421, "tcp" }, - { "gandalf-lm", { NULL }, 1421, "udp" }, - { "autodesk-lm", { NULL }, 1422, "tcp" }, - { "autodesk-lm", { NULL }, 1422, "udp" }, - { "essbase", { NULL }, 1423, "tcp" }, - { "essbase", { NULL }, 1423, "udp" }, - { "hybrid", { NULL }, 1424, "tcp" }, - { "hybrid", { NULL }, 1424, "udp" }, - { "zion-lm", { NULL }, 1425, "tcp" }, - { "zion-lm", { NULL }, 1425, "udp" }, - { "sais", { NULL }, 1426, "tcp" }, - { "sais", { NULL }, 1426, "udp" }, - { "mloadd", { NULL }, 1427, "tcp" }, - { "mloadd", { NULL }, 1427, "udp" }, - { "informatik-lm", { NULL }, 1428, "tcp" }, - { "informatik-lm", { NULL }, 1428, "udp" }, - { "nms", { NULL }, 1429, "tcp" }, - { "nms", { NULL }, 1429, "udp" }, - { "tpdu", { NULL }, 1430, "tcp" }, - { "tpdu", { NULL }, 1430, "udp" }, - { "rgtp", { NULL }, 1431, "tcp" }, - { "rgtp", { NULL }, 1431, "udp" }, - { "blueberry-lm", { NULL }, 1432, "tcp" }, - { "blueberry-lm", { NULL }, 1432, "udp" }, - { "ms-sql-s", { NULL }, 1433, "tcp" }, - { "ms-sql-s", { NULL }, 1433, "udp" }, - { "ms-sql-m", { NULL }, 1434, "tcp" }, - { "ms-sql-m", { NULL }, 1434, "udp" }, - { "ibm-cics", { NULL }, 1435, "tcp" }, - { "ibm-cics", { NULL }, 1435, "udp" }, - { "saism", { NULL }, 1436, "tcp" }, - { "saism", { NULL }, 1436, "udp" }, - { "tabula", { NULL }, 1437, "tcp" }, - { "tabula", { NULL }, 1437, "udp" }, - { "eicon-server", { NULL }, 1438, "tcp" }, - { "eicon-server", { NULL }, 1438, "udp" }, - { "eicon-x25", { NULL }, 1439, "tcp" }, - { "eicon-x25", { NULL }, 1439, "udp" }, - { "eicon-slp", { NULL }, 1440, "tcp" }, - { "eicon-slp", { NULL }, 1440, "udp" }, - { "cadis-1", { NULL }, 1441, "tcp" }, - { "cadis-1", { NULL }, 1441, "udp" }, - { "cadis-2", { NULL }, 1442, "tcp" }, - { "cadis-2", { NULL }, 1442, "udp" }, - { "ies-lm", { NULL }, 1443, "tcp" }, - { "ies-lm", { NULL }, 1443, "udp" }, - { "marcam-lm", { NULL }, 1444, "tcp" }, - { "marcam-lm", { NULL }, 1444, "udp" }, - { "proxima-lm", { NULL }, 1445, "tcp" }, - { "proxima-lm", { NULL }, 1445, "udp" }, - { "ora-lm", { NULL }, 1446, "tcp" }, - { "ora-lm", { NULL }, 1446, "udp" }, - { "apri-lm", { NULL }, 1447, "tcp" }, - { "apri-lm", { NULL }, 1447, "udp" }, - { "oc-lm", { NULL }, 1448, "tcp" }, - { "oc-lm", { NULL }, 1448, "udp" }, - { "peport", { NULL }, 1449, "tcp" }, - { "peport", { NULL }, 1449, "udp" }, - { "dwf", { NULL }, 1450, "tcp" }, - { "dwf", { NULL }, 1450, "udp" }, - { "infoman", { NULL }, 1451, "tcp" }, - { "infoman", { NULL }, 1451, "udp" }, - { "gtegsc-lm", { NULL }, 1452, "tcp" }, - { "gtegsc-lm", { NULL }, 1452, "udp" }, - { "genie-lm", { NULL }, 1453, "tcp" }, - { "genie-lm", { NULL }, 1453, "udp" }, - { "interhdl_elmd", { NULL }, 1454, "tcp" }, - { "interhdl_elmd", { NULL }, 1454, "udp" }, - { "esl-lm", { NULL }, 1455, "tcp" }, - { "esl-lm", { NULL }, 1455, "udp" }, - { "dca", { NULL }, 1456, "tcp" }, - { "dca", { NULL }, 1456, "udp" }, - { "valisys-lm", { NULL }, 1457, "tcp" }, - { "valisys-lm", { NULL }, 1457, "udp" }, - { "nrcabq-lm", { NULL }, 1458, "tcp" }, - { "nrcabq-lm", { NULL }, 1458, "udp" }, - { "proshare1", { NULL }, 1459, "tcp" }, - { "proshare1", { NULL }, 1459, "udp" }, - { "proshare2", { NULL }, 1460, "tcp" }, - { "proshare2", { NULL }, 1460, "udp" }, - { "ibm_wrless_lan", { NULL }, 1461, "tcp" }, - { "ibm_wrless_lan", { NULL }, 1461, "udp" }, - { "world-lm", { NULL }, 1462, "tcp" }, - { "world-lm", { NULL }, 1462, "udp" }, - { "nucleus", { NULL }, 1463, "tcp" }, - { "nucleus", { NULL }, 1463, "udp" }, - { "msl_lmd", { NULL }, 1464, "tcp" }, - { "msl_lmd", { NULL }, 1464, "udp" }, - { "pipes", { NULL }, 1465, "tcp" }, - { "pipes", { NULL }, 1465, "udp" }, - { "oceansoft-lm", { NULL }, 1466, "tcp" }, - { "oceansoft-lm", { NULL }, 1466, "udp" }, - { "csdmbase", { NULL }, 1467, "tcp" }, - { "csdmbase", { NULL }, 1467, "udp" }, - { "csdm", { NULL }, 1468, "tcp" }, - { "csdm", { NULL }, 1468, "udp" }, - { "aal-lm", { NULL }, 1469, "tcp" }, - { "aal-lm", { NULL }, 1469, "udp" }, - { "uaiact", { NULL }, 1470, "tcp" }, - { "uaiact", { NULL }, 1470, "udp" }, - { "csdmbase", { NULL }, 1471, "tcp" }, - { "csdmbase", { NULL }, 1471, "udp" }, - { "csdm", { NULL }, 1472, "tcp" }, - { "csdm", { NULL }, 1472, "udp" }, - { "openmath", { NULL }, 1473, "tcp" }, - { "openmath", { NULL }, 1473, "udp" }, - { "telefinder", { NULL }, 1474, "tcp" }, - { "telefinder", { NULL }, 1474, "udp" }, - { "taligent-lm", { NULL }, 1475, "tcp" }, - { "taligent-lm", { NULL }, 1475, "udp" }, - { "clvm-cfg", { NULL }, 1476, "tcp" }, - { "clvm-cfg", { NULL }, 1476, "udp" }, - { "ms-sna-server", { NULL }, 1477, "tcp" }, - { "ms-sna-server", { NULL }, 1477, "udp" }, - { "ms-sna-base", { NULL }, 1478, "tcp" }, - { "ms-sna-base", { NULL }, 1478, "udp" }, - { "dberegister", { NULL }, 1479, "tcp" }, - { "dberegister", { NULL }, 1479, "udp" }, - { "pacerforum", { NULL }, 1480, "tcp" }, - { "pacerforum", { NULL }, 1480, "udp" }, - { "airs", { NULL }, 1481, "tcp" }, - { "airs", { NULL }, 1481, "udp" }, - { "miteksys-lm", { NULL }, 1482, "tcp" }, - { "miteksys-lm", { NULL }, 1482, "udp" }, - { "afs", { NULL }, 1483, "tcp" }, - { "afs", { NULL }, 1483, "udp" }, - { "confluent", { NULL }, 1484, "tcp" }, - { "confluent", { NULL }, 1484, "udp" }, - { "lansource", { NULL }, 1485, "tcp" }, - { "lansource", { NULL }, 1485, "udp" }, - { "nms_topo_serv", { NULL }, 1486, "tcp" }, - { "nms_topo_serv", { NULL }, 1486, "udp" }, - { "localinfosrvr", { NULL }, 1487, "tcp" }, - { "localinfosrvr", { NULL }, 1487, "udp" }, - { "docstor", { NULL }, 1488, "tcp" }, - { "docstor", { NULL }, 1488, "udp" }, - { "dmdocbroker", { NULL }, 1489, "tcp" }, - { "dmdocbroker", { NULL }, 1489, "udp" }, - { "insitu-conf", { NULL }, 1490, "tcp" }, - { "insitu-conf", { NULL }, 1490, "udp" }, - { "stone-design-1", { NULL }, 1492, "tcp" }, - { "stone-design-1", { NULL }, 1492, "udp" }, - { "netmap_lm", { NULL }, 1493, "tcp" }, - { "netmap_lm", { NULL }, 1493, "udp" }, - { "ica", { NULL }, 1494, "tcp" }, - { "ica", { NULL }, 1494, "udp" }, - { "cvc", { NULL }, 1495, "tcp" }, - { "cvc", { NULL }, 1495, "udp" }, - { "liberty-lm", { NULL }, 1496, "tcp" }, - { "liberty-lm", { NULL }, 1496, "udp" }, - { "rfx-lm", { NULL }, 1497, "tcp" }, - { "rfx-lm", { NULL }, 1497, "udp" }, - { "sybase-sqlany", { NULL }, 1498, "tcp" }, - { "sybase-sqlany", { NULL }, 1498, "udp" }, - { "fhc", { NULL }, 1499, "tcp" }, - { "fhc", { NULL }, 1499, "udp" }, - { "vlsi-lm", { NULL }, 1500, "tcp" }, - { "vlsi-lm", { NULL }, 1500, "udp" }, - { "saiscm", { NULL }, 1501, "tcp" }, - { "saiscm", { NULL }, 1501, "udp" }, - { "shivadiscovery", { NULL }, 1502, "tcp" }, - { "shivadiscovery", { NULL }, 1502, "udp" }, - { "imtc-mcs", { NULL }, 1503, "tcp" }, - { "imtc-mcs", { NULL }, 1503, "udp" }, - { "evb-elm", { NULL }, 1504, "tcp" }, - { "evb-elm", { NULL }, 1504, "udp" }, - { "funkproxy", { NULL }, 1505, "tcp" }, - { "funkproxy", { NULL }, 1505, "udp" }, - { "utcd", { NULL }, 1506, "tcp" }, - { "utcd", { NULL }, 1506, "udp" }, - { "symplex", { NULL }, 1507, "tcp" }, - { "symplex", { NULL }, 1507, "udp" }, - { "diagmond", { NULL }, 1508, "tcp" }, - { "diagmond", { NULL }, 1508, "udp" }, - { "robcad-lm", { NULL }, 1509, "tcp" }, - { "robcad-lm", { NULL }, 1509, "udp" }, - { "mvx-lm", { NULL }, 1510, "tcp" }, - { "mvx-lm", { NULL }, 1510, "udp" }, - { "3l-l1", { NULL }, 1511, "tcp" }, - { "3l-l1", { NULL }, 1511, "udp" }, - { "wins", { NULL }, 1512, "tcp" }, - { "wins", { NULL }, 1512, "udp" }, - { "fujitsu-dtc", { NULL }, 1513, "tcp" }, - { "fujitsu-dtc", { NULL }, 1513, "udp" }, - { "fujitsu-dtcns", { NULL }, 1514, "tcp" }, - { "fujitsu-dtcns", { NULL }, 1514, "udp" }, - { "ifor-protocol", { NULL }, 1515, "tcp" }, - { "ifor-protocol", { NULL }, 1515, "udp" }, - { "vpad", { NULL }, 1516, "tcp" }, - { "vpad", { NULL }, 1516, "udp" }, - { "vpac", { NULL }, 1517, "tcp" }, - { "vpac", { NULL }, 1517, "udp" }, - { "vpvd", { NULL }, 1518, "tcp" }, - { "vpvd", { NULL }, 1518, "udp" }, - { "vpvc", { NULL }, 1519, "tcp" }, - { "vpvc", { NULL }, 1519, "udp" }, - { "atm-zip-office", { NULL }, 1520, "tcp" }, - { "atm-zip-office", { NULL }, 1520, "udp" }, - { "ncube-lm", { NULL }, 1521, "tcp" }, - { "ncube-lm", { NULL }, 1521, "udp" }, - { "ricardo-lm", { NULL }, 1522, "tcp" }, - { "ricardo-lm", { NULL }, 1522, "udp" }, - { "cichild-lm", { NULL }, 1523, "tcp" }, - { "cichild-lm", { NULL }, 1523, "udp" }, - { "ingreslock", { NULL }, 1524, "tcp" }, - { "ingreslock", { NULL }, 1524, "udp" }, - { "orasrv", { NULL }, 1525, "tcp" }, - { "orasrv", { NULL }, 1525, "udp" }, - { "prospero-np", { NULL }, 1525, "tcp" }, - { "prospero-np", { NULL }, 1525, "udp" }, - { "pdap-np", { NULL }, 1526, "tcp" }, - { "pdap-np", { NULL }, 1526, "udp" }, - { "tlisrv", { NULL }, 1527, "tcp" }, - { "tlisrv", { NULL }, 1527, "udp" }, - { "coauthor", { NULL }, 1529, "tcp" }, - { "coauthor", { NULL }, 1529, "udp" }, - { "rap-service", { NULL }, 1530, "tcp" }, - { "rap-service", { NULL }, 1530, "udp" }, - { "rap-listen", { NULL }, 1531, "tcp" }, - { "rap-listen", { NULL }, 1531, "udp" }, - { "miroconnect", { NULL }, 1532, "tcp" }, - { "miroconnect", { NULL }, 1532, "udp" }, - { "virtual-places", { NULL }, 1533, "tcp" }, - { "virtual-places", { NULL }, 1533, "udp" }, - { "micromuse-lm", { NULL }, 1534, "tcp" }, - { "micromuse-lm", { NULL }, 1534, "udp" }, - { "ampr-info", { NULL }, 1535, "tcp" }, - { "ampr-info", { NULL }, 1535, "udp" }, - { "ampr-inter", { NULL }, 1536, "tcp" }, - { "ampr-inter", { NULL }, 1536, "udp" }, - { "sdsc-lm", { NULL }, 1537, "tcp" }, - { "sdsc-lm", { NULL }, 1537, "udp" }, - { "3ds-lm", { NULL }, 1538, "tcp" }, - { "3ds-lm", { NULL }, 1538, "udp" }, - { "intellistor-lm", { NULL }, 1539, "tcp" }, - { "intellistor-lm", { NULL }, 1539, "udp" }, - { "rds", { NULL }, 1540, "tcp" }, - { "rds", { NULL }, 1540, "udp" }, - { "rds2", { NULL }, 1541, "tcp" }, - { "rds2", { NULL }, 1541, "udp" }, - { "gridgen-elmd", { NULL }, 1542, "tcp" }, - { "gridgen-elmd", { NULL }, 1542, "udp" }, - { "simba-cs", { NULL }, 1543, "tcp" }, - { "simba-cs", { NULL }, 1543, "udp" }, - { "aspeclmd", { NULL }, 1544, "tcp" }, - { "aspeclmd", { NULL }, 1544, "udp" }, - { "vistium-share", { NULL }, 1545, "tcp" }, - { "vistium-share", { NULL }, 1545, "udp" }, - { "abbaccuray", { NULL }, 1546, "tcp" }, - { "abbaccuray", { NULL }, 1546, "udp" }, - { "laplink", { NULL }, 1547, "tcp" }, - { "laplink", { NULL }, 1547, "udp" }, - { "axon-lm", { NULL }, 1548, "tcp" }, - { "axon-lm", { NULL }, 1548, "udp" }, - { "shivahose", { NULL }, 1549, "tcp" }, - { "shivasound", { NULL }, 1549, "udp" }, - { "3m-image-lm", { NULL }, 1550, "tcp" }, - { "3m-image-lm", { NULL }, 1550, "udp" }, - { "hecmtl-db", { NULL }, 1551, "tcp" }, - { "hecmtl-db", { NULL }, 1551, "udp" }, - { "pciarray", { NULL }, 1552, "tcp" }, - { "pciarray", { NULL }, 1552, "udp" }, - { "sna-cs", { NULL }, 1553, "tcp" }, - { "sna-cs", { NULL }, 1553, "udp" }, - { "caci-lm", { NULL }, 1554, "tcp" }, - { "caci-lm", { NULL }, 1554, "udp" }, - { "livelan", { NULL }, 1555, "tcp" }, - { "livelan", { NULL }, 1555, "udp" }, - { "veritas_pbx", { NULL }, 1556, "tcp" }, - { "veritas_pbx", { NULL }, 1556, "udp" }, - { "arbortext-lm", { NULL }, 1557, "tcp" }, - { "arbortext-lm", { NULL }, 1557, "udp" }, - { "xingmpeg", { NULL }, 1558, "tcp" }, - { "xingmpeg", { NULL }, 1558, "udp" }, - { "web2host", { NULL }, 1559, "tcp" }, - { "web2host", { NULL }, 1559, "udp" }, - { "asci-val", { NULL }, 1560, "tcp" }, - { "asci-val", { NULL }, 1560, "udp" }, - { "facilityview", { NULL }, 1561, "tcp" }, - { "facilityview", { NULL }, 1561, "udp" }, - { "pconnectmgr", { NULL }, 1562, "tcp" }, - { "pconnectmgr", { NULL }, 1562, "udp" }, - { "cadabra-lm", { NULL }, 1563, "tcp" }, - { "cadabra-lm", { NULL }, 1563, "udp" }, - { "pay-per-view", { NULL }, 1564, "tcp" }, - { "pay-per-view", { NULL }, 1564, "udp" }, - { "winddlb", { NULL }, 1565, "tcp" }, - { "winddlb", { NULL }, 1565, "udp" }, - { "corelvideo", { NULL }, 1566, "tcp" }, - { "corelvideo", { NULL }, 1566, "udp" }, - { "jlicelmd", { NULL }, 1567, "tcp" }, - { "jlicelmd", { NULL }, 1567, "udp" }, - { "tsspmap", { NULL }, 1568, "tcp" }, - { "tsspmap", { NULL }, 1568, "udp" }, - { "ets", { NULL }, 1569, "tcp" }, - { "ets", { NULL }, 1569, "udp" }, - { "orbixd", { NULL }, 1570, "tcp" }, - { "orbixd", { NULL }, 1570, "udp" }, - { "rdb-dbs-disp", { NULL }, 1571, "tcp" }, - { "rdb-dbs-disp", { NULL }, 1571, "udp" }, - { "chip-lm", { NULL }, 1572, "tcp" }, - { "chip-lm", { NULL }, 1572, "udp" }, - { "itscomm-ns", { NULL }, 1573, "tcp" }, - { "itscomm-ns", { NULL }, 1573, "udp" }, - { "mvel-lm", { NULL }, 1574, "tcp" }, - { "mvel-lm", { NULL }, 1574, "udp" }, - { "oraclenames", { NULL }, 1575, "tcp" }, - { "oraclenames", { NULL }, 1575, "udp" }, - { "moldflow-lm", { NULL }, 1576, "tcp" }, - { "moldflow-lm", { NULL }, 1576, "udp" }, - { "hypercube-lm", { NULL }, 1577, "tcp" }, - { "hypercube-lm", { NULL }, 1577, "udp" }, - { "jacobus-lm", { NULL }, 1578, "tcp" }, - { "jacobus-lm", { NULL }, 1578, "udp" }, - { "ioc-sea-lm", { NULL }, 1579, "tcp" }, - { "ioc-sea-lm", { NULL }, 1579, "udp" }, - { "tn-tl-r1", { NULL }, 1580, "tcp" }, - { "tn-tl-r2", { NULL }, 1580, "udp" }, - { "mil-2045-47001", { NULL }, 1581, "tcp" }, - { "mil-2045-47001", { NULL }, 1581, "udp" }, - { "msims", { NULL }, 1582, "tcp" }, - { "msims", { NULL }, 1582, "udp" }, - { "simbaexpress", { NULL }, 1583, "tcp" }, - { "simbaexpress", { NULL }, 1583, "udp" }, - { "tn-tl-fd2", { NULL }, 1584, "tcp" }, - { "tn-tl-fd2", { NULL }, 1584, "udp" }, - { "intv", { NULL }, 1585, "tcp" }, - { "intv", { NULL }, 1585, "udp" }, - { "ibm-abtact", { NULL }, 1586, "tcp" }, - { "ibm-abtact", { NULL }, 1586, "udp" }, - { "pra_elmd", { NULL }, 1587, "tcp" }, - { "pra_elmd", { NULL }, 1587, "udp" }, - { "triquest-lm", { NULL }, 1588, "tcp" }, - { "triquest-lm", { NULL }, 1588, "udp" }, - { "vqp", { NULL }, 1589, "tcp" }, - { "vqp", { NULL }, 1589, "udp" }, - { "gemini-lm", { NULL }, 1590, "tcp" }, - { "gemini-lm", { NULL }, 1590, "udp" }, - { "ncpm-pm", { NULL }, 1591, "tcp" }, - { "ncpm-pm", { NULL }, 1591, "udp" }, - { "commonspace", { NULL }, 1592, "tcp" }, - { "commonspace", { NULL }, 1592, "udp" }, - { "mainsoft-lm", { NULL }, 1593, "tcp" }, - { "mainsoft-lm", { NULL }, 1593, "udp" }, - { "sixtrak", { NULL }, 1594, "tcp" }, - { "sixtrak", { NULL }, 1594, "udp" }, - { "radio", { NULL }, 1595, "tcp" }, - { "radio", { NULL }, 1595, "udp" }, - { "radio-sm", { NULL }, 1596, "tcp" }, - { "radio-bc", { NULL }, 1596, "udp" }, - { "orbplus-iiop", { NULL }, 1597, "tcp" }, - { "orbplus-iiop", { NULL }, 1597, "udp" }, - { "picknfs", { NULL }, 1598, "tcp" }, - { "picknfs", { NULL }, 1598, "udp" }, - { "simbaservices", { NULL }, 1599, "tcp" }, - { "simbaservices", { NULL }, 1599, "udp" }, - { "issd", { NULL }, 1600, "tcp" }, - { "issd", { NULL }, 1600, "udp" }, - { "aas", { NULL }, 1601, "tcp" }, - { "aas", { NULL }, 1601, "udp" }, - { "inspect", { NULL }, 1602, "tcp" }, - { "inspect", { NULL }, 1602, "udp" }, - { "picodbc", { NULL }, 1603, "tcp" }, - { "picodbc", { NULL }, 1603, "udp" }, - { "icabrowser", { NULL }, 1604, "tcp" }, - { "icabrowser", { NULL }, 1604, "udp" }, - { "slp", { NULL }, 1605, "tcp" }, - { "slp", { NULL }, 1605, "udp" }, - { "slm-api", { NULL }, 1606, "tcp" }, - { "slm-api", { NULL }, 1606, "udp" }, - { "stt", { NULL }, 1607, "tcp" }, - { "stt", { NULL }, 1607, "udp" }, - { "smart-lm", { NULL }, 1608, "tcp" }, - { "smart-lm", { NULL }, 1608, "udp" }, - { "isysg-lm", { NULL }, 1609, "tcp" }, - { "isysg-lm", { NULL }, 1609, "udp" }, - { "taurus-wh", { NULL }, 1610, "tcp" }, - { "taurus-wh", { NULL }, 1610, "udp" }, - { "ill", { NULL }, 1611, "tcp" }, - { "ill", { NULL }, 1611, "udp" }, - { "netbill-trans", { NULL }, 1612, "tcp" }, - { "netbill-trans", { NULL }, 1612, "udp" }, - { "netbill-keyrep", { NULL }, 1613, "tcp" }, - { "netbill-keyrep", { NULL }, 1613, "udp" }, - { "netbill-cred", { NULL }, 1614, "tcp" }, - { "netbill-cred", { NULL }, 1614, "udp" }, - { "netbill-auth", { NULL }, 1615, "tcp" }, - { "netbill-auth", { NULL }, 1615, "udp" }, - { "netbill-prod", { NULL }, 1616, "tcp" }, - { "netbill-prod", { NULL }, 1616, "udp" }, - { "nimrod-agent", { NULL }, 1617, "tcp" }, - { "nimrod-agent", { NULL }, 1617, "udp" }, - { "skytelnet", { NULL }, 1618, "tcp" }, - { "skytelnet", { NULL }, 1618, "udp" }, - { "xs-openstorage", { NULL }, 1619, "tcp" }, - { "xs-openstorage", { NULL }, 1619, "udp" }, - { "faxportwinport", { NULL }, 1620, "tcp" }, - { "faxportwinport", { NULL }, 1620, "udp" }, - { "softdataphone", { NULL }, 1621, "tcp" }, - { "softdataphone", { NULL }, 1621, "udp" }, - { "ontime", { NULL }, 1622, "tcp" }, - { "ontime", { NULL }, 1622, "udp" }, - { "jaleosnd", { NULL }, 1623, "tcp" }, - { "jaleosnd", { NULL }, 1623, "udp" }, - { "udp-sr-port", { NULL }, 1624, "tcp" }, - { "udp-sr-port", { NULL }, 1624, "udp" }, - { "svs-omagent", { NULL }, 1625, "tcp" }, - { "svs-omagent", { NULL }, 1625, "udp" }, - { "shockwave", { NULL }, 1626, "tcp" }, - { "shockwave", { NULL }, 1626, "udp" }, - { "t128-gateway", { NULL }, 1627, "tcp" }, - { "t128-gateway", { NULL }, 1627, "udp" }, - { "lontalk-norm", { NULL }, 1628, "tcp" }, - { "lontalk-norm", { NULL }, 1628, "udp" }, - { "lontalk-urgnt", { NULL }, 1629, "tcp" }, - { "lontalk-urgnt", { NULL }, 1629, "udp" }, - { "oraclenet8cman", { NULL }, 1630, "tcp" }, - { "oraclenet8cman", { NULL }, 1630, "udp" }, - { "visitview", { NULL }, 1631, "tcp" }, - { "visitview", { NULL }, 1631, "udp" }, - { "pammratc", { NULL }, 1632, "tcp" }, - { "pammratc", { NULL }, 1632, "udp" }, - { "pammrpc", { NULL }, 1633, "tcp" }, - { "pammrpc", { NULL }, 1633, "udp" }, - { "loaprobe", { NULL }, 1634, "tcp" }, - { "loaprobe", { NULL }, 1634, "udp" }, - { "edb-server1", { NULL }, 1635, "tcp" }, - { "edb-server1", { NULL }, 1635, "udp" }, - { "isdc", { NULL }, 1636, "tcp" }, - { "isdc", { NULL }, 1636, "udp" }, - { "islc", { NULL }, 1637, "tcp" }, - { "islc", { NULL }, 1637, "udp" }, - { "ismc", { NULL }, 1638, "tcp" }, - { "ismc", { NULL }, 1638, "udp" }, - { "cert-initiator", { NULL }, 1639, "tcp" }, - { "cert-initiator", { NULL }, 1639, "udp" }, - { "cert-responder", { NULL }, 1640, "tcp" }, - { "cert-responder", { NULL }, 1640, "udp" }, - { "invision", { NULL }, 1641, "tcp" }, - { "invision", { NULL }, 1641, "udp" }, - { "isis-am", { NULL }, 1642, "tcp" }, - { "isis-am", { NULL }, 1642, "udp" }, - { "isis-ambc", { NULL }, 1643, "tcp" }, - { "isis-ambc", { NULL }, 1643, "udp" }, - { "saiseh", { NULL }, 1644, "tcp" }, - { "sightline", { NULL }, 1645, "tcp" }, - { "sightline", { NULL }, 1645, "udp" }, - { "sa-msg-port", { NULL }, 1646, "tcp" }, - { "sa-msg-port", { NULL }, 1646, "udp" }, - { "rsap", { NULL }, 1647, "tcp" }, - { "rsap", { NULL }, 1647, "udp" }, - { "concurrent-lm", { NULL }, 1648, "tcp" }, - { "concurrent-lm", { NULL }, 1648, "udp" }, - { "kermit", { NULL }, 1649, "tcp" }, - { "kermit", { NULL }, 1649, "udp" }, - { "nkd", { NULL }, 1650, "tcp" }, - { "nkd", { NULL }, 1650, "udp" }, - { "shiva_confsrvr", { NULL }, 1651, "tcp" }, - { "shiva_confsrvr", { NULL }, 1651, "udp" }, - { "xnmp", { NULL }, 1652, "tcp" }, - { "xnmp", { NULL }, 1652, "udp" }, - { "alphatech-lm", { NULL }, 1653, "tcp" }, - { "alphatech-lm", { NULL }, 1653, "udp" }, - { "stargatealerts", { NULL }, 1654, "tcp" }, - { "stargatealerts", { NULL }, 1654, "udp" }, - { "dec-mbadmin", { NULL }, 1655, "tcp" }, - { "dec-mbadmin", { NULL }, 1655, "udp" }, - { "dec-mbadmin-h", { NULL }, 1656, "tcp" }, - { "dec-mbadmin-h", { NULL }, 1656, "udp" }, - { "fujitsu-mmpdc", { NULL }, 1657, "tcp" }, - { "fujitsu-mmpdc", { NULL }, 1657, "udp" }, - { "sixnetudr", { NULL }, 1658, "tcp" }, - { "sixnetudr", { NULL }, 1658, "udp" }, - { "sg-lm", { NULL }, 1659, "tcp" }, - { "sg-lm", { NULL }, 1659, "udp" }, - { "skip-mc-gikreq", { NULL }, 1660, "tcp" }, - { "skip-mc-gikreq", { NULL }, 1660, "udp" }, - { "netview-aix-1", { NULL }, 1661, "tcp" }, - { "netview-aix-1", { NULL }, 1661, "udp" }, - { "netview-aix-2", { NULL }, 1662, "tcp" }, - { "netview-aix-2", { NULL }, 1662, "udp" }, - { "netview-aix-3", { NULL }, 1663, "tcp" }, - { "netview-aix-3", { NULL }, 1663, "udp" }, - { "netview-aix-4", { NULL }, 1664, "tcp" }, - { "netview-aix-4", { NULL }, 1664, "udp" }, - { "netview-aix-5", { NULL }, 1665, "tcp" }, - { "netview-aix-5", { NULL }, 1665, "udp" }, - { "netview-aix-6", { NULL }, 1666, "tcp" }, - { "netview-aix-6", { NULL }, 1666, "udp" }, - { "netview-aix-7", { NULL }, 1667, "tcp" }, - { "netview-aix-7", { NULL }, 1667, "udp" }, - { "netview-aix-8", { NULL }, 1668, "tcp" }, - { "netview-aix-8", { NULL }, 1668, "udp" }, - { "netview-aix-9", { NULL }, 1669, "tcp" }, - { "netview-aix-9", { NULL }, 1669, "udp" }, - { "netview-aix-10", { NULL }, 1670, "tcp" }, - { "netview-aix-10", { NULL }, 1670, "udp" }, - { "netview-aix-11", { NULL }, 1671, "tcp" }, - { "netview-aix-11", { NULL }, 1671, "udp" }, - { "netview-aix-12", { NULL }, 1672, "tcp" }, - { "netview-aix-12", { NULL }, 1672, "udp" }, - { "proshare-mc-1", { NULL }, 1673, "tcp" }, - { "proshare-mc-1", { NULL }, 1673, "udp" }, - { "proshare-mc-2", { NULL }, 1674, "tcp" }, - { "proshare-mc-2", { NULL }, 1674, "udp" }, - { "pdp", { NULL }, 1675, "tcp" }, - { "pdp", { NULL }, 1675, "udp" }, - { "netcomm1", { NULL }, 1676, "tcp" }, - { "netcomm2", { NULL }, 1676, "udp" }, - { "groupwise", { NULL }, 1677, "tcp" }, - { "groupwise", { NULL }, 1677, "udp" }, - { "prolink", { NULL }, 1678, "tcp" }, - { "prolink", { NULL }, 1678, "udp" }, - { "darcorp-lm", { NULL }, 1679, "tcp" }, - { "darcorp-lm", { NULL }, 1679, "udp" }, - { "microcom-sbp", { NULL }, 1680, "tcp" }, - { "microcom-sbp", { NULL }, 1680, "udp" }, - { "sd-elmd", { NULL }, 1681, "tcp" }, - { "sd-elmd", { NULL }, 1681, "udp" }, - { "lanyon-lantern", { NULL }, 1682, "tcp" }, - { "lanyon-lantern", { NULL }, 1682, "udp" }, - { "ncpm-hip", { NULL }, 1683, "tcp" }, - { "ncpm-hip", { NULL }, 1683, "udp" }, - { "snaresecure", { NULL }, 1684, "tcp" }, - { "snaresecure", { NULL }, 1684, "udp" }, - { "n2nremote", { NULL }, 1685, "tcp" }, - { "n2nremote", { NULL }, 1685, "udp" }, - { "cvmon", { NULL }, 1686, "tcp" }, - { "cvmon", { NULL }, 1686, "udp" }, - { "nsjtp-ctrl", { NULL }, 1687, "tcp" }, - { "nsjtp-ctrl", { NULL }, 1687, "udp" }, - { "nsjtp-data", { NULL }, 1688, "tcp" }, - { "nsjtp-data", { NULL }, 1688, "udp" }, - { "firefox", { NULL }, 1689, "tcp" }, - { "firefox", { NULL }, 1689, "udp" }, - { "ng-umds", { NULL }, 1690, "tcp" }, - { "ng-umds", { NULL }, 1690, "udp" }, - { "empire-empuma", { NULL }, 1691, "tcp" }, - { "empire-empuma", { NULL }, 1691, "udp" }, - { "sstsys-lm", { NULL }, 1692, "tcp" }, - { "sstsys-lm", { NULL }, 1692, "udp" }, - { "rrirtr", { NULL }, 1693, "tcp" }, - { "rrirtr", { NULL }, 1693, "udp" }, - { "rrimwm", { NULL }, 1694, "tcp" }, - { "rrimwm", { NULL }, 1694, "udp" }, - { "rrilwm", { NULL }, 1695, "tcp" }, - { "rrilwm", { NULL }, 1695, "udp" }, - { "rrifmm", { NULL }, 1696, "tcp" }, - { "rrifmm", { NULL }, 1696, "udp" }, - { "rrisat", { NULL }, 1697, "tcp" }, - { "rrisat", { NULL }, 1697, "udp" }, - { "rsvp-encap-1", { NULL }, 1698, "tcp" }, - { "rsvp-encap-1", { NULL }, 1698, "udp" }, - { "rsvp-encap-2", { NULL }, 1699, "tcp" }, - { "rsvp-encap-2", { NULL }, 1699, "udp" }, - { "mps-raft", { NULL }, 1700, "tcp" }, - { "mps-raft", { NULL }, 1700, "udp" }, - { "l2f", { NULL }, 1701, "tcp" }, - { "l2f", { NULL }, 1701, "udp" }, - { "l2tp", { NULL }, 1701, "tcp" }, - { "l2tp", { NULL }, 1701, "udp" }, - { "deskshare", { NULL }, 1702, "tcp" }, - { "deskshare", { NULL }, 1702, "udp" }, - { "hb-engine", { NULL }, 1703, "tcp" }, - { "hb-engine", { NULL }, 1703, "udp" }, - { "bcs-broker", { NULL }, 1704, "tcp" }, - { "bcs-broker", { NULL }, 1704, "udp" }, - { "slingshot", { NULL }, 1705, "tcp" }, - { "slingshot", { NULL }, 1705, "udp" }, - { "jetform", { NULL }, 1706, "tcp" }, - { "jetform", { NULL }, 1706, "udp" }, - { "vdmplay", { NULL }, 1707, "tcp" }, - { "vdmplay", { NULL }, 1707, "udp" }, - { "gat-lmd", { NULL }, 1708, "tcp" }, - { "gat-lmd", { NULL }, 1708, "udp" }, - { "centra", { NULL }, 1709, "tcp" }, - { "centra", { NULL }, 1709, "udp" }, - { "impera", { NULL }, 1710, "tcp" }, - { "impera", { NULL }, 1710, "udp" }, - { "pptconference", { NULL }, 1711, "tcp" }, - { "pptconference", { NULL }, 1711, "udp" }, - { "registrar", { NULL }, 1712, "tcp" }, - { "registrar", { NULL }, 1712, "udp" }, - { "conferencetalk", { NULL }, 1713, "tcp" }, - { "conferencetalk", { NULL }, 1713, "udp" }, - { "sesi-lm", { NULL }, 1714, "tcp" }, - { "sesi-lm", { NULL }, 1714, "udp" }, - { "houdini-lm", { NULL }, 1715, "tcp" }, - { "houdini-lm", { NULL }, 1715, "udp" }, - { "xmsg", { NULL }, 1716, "tcp" }, - { "xmsg", { NULL }, 1716, "udp" }, - { "fj-hdnet", { NULL }, 1717, "tcp" }, - { "fj-hdnet", { NULL }, 1717, "udp" }, - { "h323gatedisc", { NULL }, 1718, "tcp" }, - { "h323gatedisc", { NULL }, 1718, "udp" }, - { "h323gatestat", { NULL }, 1719, "tcp" }, - { "h323gatestat", { NULL }, 1719, "udp" }, - { "h323hostcall", { NULL }, 1720, "tcp" }, - { "h323hostcall", { NULL }, 1720, "udp" }, - { "caicci", { NULL }, 1721, "tcp" }, - { "caicci", { NULL }, 1721, "udp" }, - { "hks-lm", { NULL }, 1722, "tcp" }, - { "hks-lm", { NULL }, 1722, "udp" }, - { "pptp", { NULL }, 1723, "tcp" }, - { "pptp", { NULL }, 1723, "udp" }, - { "csbphonemaster", { NULL }, 1724, "tcp" }, - { "csbphonemaster", { NULL }, 1724, "udp" }, - { "iden-ralp", { NULL }, 1725, "tcp" }, - { "iden-ralp", { NULL }, 1725, "udp" }, - { "iberiagames", { NULL }, 1726, "tcp" }, - { "iberiagames", { NULL }, 1726, "udp" }, - { "winddx", { NULL }, 1727, "tcp" }, - { "winddx", { NULL }, 1727, "udp" }, - { "telindus", { NULL }, 1728, "tcp" }, - { "telindus", { NULL }, 1728, "udp" }, - { "citynl", { NULL }, 1729, "tcp" }, - { "citynl", { NULL }, 1729, "udp" }, - { "roketz", { NULL }, 1730, "tcp" }, - { "roketz", { NULL }, 1730, "udp" }, - { "msiccp", { NULL }, 1731, "tcp" }, - { "msiccp", { NULL }, 1731, "udp" }, - { "proxim", { NULL }, 1732, "tcp" }, - { "proxim", { NULL }, 1732, "udp" }, - { "siipat", { NULL }, 1733, "tcp" }, - { "siipat", { NULL }, 1733, "udp" }, - { "cambertx-lm", { NULL }, 1734, "tcp" }, - { "cambertx-lm", { NULL }, 1734, "udp" }, - { "privatechat", { NULL }, 1735, "tcp" }, - { "privatechat", { NULL }, 1735, "udp" }, - { "street-stream", { NULL }, 1736, "tcp" }, - { "street-stream", { NULL }, 1736, "udp" }, - { "ultimad", { NULL }, 1737, "tcp" }, - { "ultimad", { NULL }, 1737, "udp" }, - { "gamegen1", { NULL }, 1738, "tcp" }, - { "gamegen1", { NULL }, 1738, "udp" }, - { "webaccess", { NULL }, 1739, "tcp" }, - { "webaccess", { NULL }, 1739, "udp" }, - { "encore", { NULL }, 1740, "tcp" }, - { "encore", { NULL }, 1740, "udp" }, - { "cisco-net-mgmt", { NULL }, 1741, "tcp" }, - { "cisco-net-mgmt", { NULL }, 1741, "udp" }, - { "3Com-nsd", { NULL }, 1742, "tcp" }, - { "3Com-nsd", { NULL }, 1742, "udp" }, - { "cinegrfx-lm", { NULL }, 1743, "tcp" }, - { "cinegrfx-lm", { NULL }, 1743, "udp" }, - { "ncpm-ft", { NULL }, 1744, "tcp" }, - { "ncpm-ft", { NULL }, 1744, "udp" }, - { "remote-winsock", { NULL }, 1745, "tcp" }, - { "remote-winsock", { NULL }, 1745, "udp" }, - { "ftrapid-1", { NULL }, 1746, "tcp" }, - { "ftrapid-1", { NULL }, 1746, "udp" }, - { "ftrapid-2", { NULL }, 1747, "tcp" }, - { "ftrapid-2", { NULL }, 1747, "udp" }, - { "oracle-em1", { NULL }, 1748, "tcp" }, - { "oracle-em1", { NULL }, 1748, "udp" }, - { "aspen-services", { NULL }, 1749, "tcp" }, - { "aspen-services", { NULL }, 1749, "udp" }, - { "sslp", { NULL }, 1750, "tcp" }, - { "sslp", { NULL }, 1750, "udp" }, - { "swiftnet", { NULL }, 1751, "tcp" }, - { "swiftnet", { NULL }, 1751, "udp" }, - { "lofr-lm", { NULL }, 1752, "tcp" }, - { "lofr-lm", { NULL }, 1752, "udp" }, - { "oracle-em2", { NULL }, 1754, "tcp" }, - { "oracle-em2", { NULL }, 1754, "udp" }, - { "ms-streaming", { NULL }, 1755, "tcp" }, - { "ms-streaming", { NULL }, 1755, "udp" }, - { "capfast-lmd", { NULL }, 1756, "tcp" }, - { "capfast-lmd", { NULL }, 1756, "udp" }, - { "cnhrp", { NULL }, 1757, "tcp" }, - { "cnhrp", { NULL }, 1757, "udp" }, - { "tftp-mcast", { NULL }, 1758, "tcp" }, - { "tftp-mcast", { NULL }, 1758, "udp" }, - { "spss-lm", { NULL }, 1759, "tcp" }, - { "spss-lm", { NULL }, 1759, "udp" }, - { "www-ldap-gw", { NULL }, 1760, "tcp" }, - { "www-ldap-gw", { NULL }, 1760, "udp" }, - { "cft-0", { NULL }, 1761, "tcp" }, - { "cft-0", { NULL }, 1761, "udp" }, - { "cft-1", { NULL }, 1762, "tcp" }, - { "cft-1", { NULL }, 1762, "udp" }, - { "cft-2", { NULL }, 1763, "tcp" }, - { "cft-2", { NULL }, 1763, "udp" }, - { "cft-3", { NULL }, 1764, "tcp" }, - { "cft-3", { NULL }, 1764, "udp" }, - { "cft-4", { NULL }, 1765, "tcp" }, - { "cft-4", { NULL }, 1765, "udp" }, - { "cft-5", { NULL }, 1766, "tcp" }, - { "cft-5", { NULL }, 1766, "udp" }, - { "cft-6", { NULL }, 1767, "tcp" }, - { "cft-6", { NULL }, 1767, "udp" }, - { "cft-7", { NULL }, 1768, "tcp" }, - { "cft-7", { NULL }, 1768, "udp" }, - { "bmc-net-adm", { NULL }, 1769, "tcp" }, - { "bmc-net-adm", { NULL }, 1769, "udp" }, - { "bmc-net-svc", { NULL }, 1770, "tcp" }, - { "bmc-net-svc", { NULL }, 1770, "udp" }, - { "vaultbase", { NULL }, 1771, "tcp" }, - { "vaultbase", { NULL }, 1771, "udp" }, - { "essweb-gw", { NULL }, 1772, "tcp" }, - { "essweb-gw", { NULL }, 1772, "udp" }, - { "kmscontrol", { NULL }, 1773, "tcp" }, - { "kmscontrol", { NULL }, 1773, "udp" }, - { "global-dtserv", { NULL }, 1774, "tcp" }, - { "global-dtserv", { NULL }, 1774, "udp" }, - { "femis", { NULL }, 1776, "tcp" }, - { "femis", { NULL }, 1776, "udp" }, - { "powerguardian", { NULL }, 1777, "tcp" }, - { "powerguardian", { NULL }, 1777, "udp" }, - { "prodigy-intrnet", { NULL }, 1778, "tcp" }, - { "prodigy-intrnet", { NULL }, 1778, "udp" }, - { "pharmasoft", { NULL }, 1779, "tcp" }, - { "pharmasoft", { NULL }, 1779, "udp" }, - { "dpkeyserv", { NULL }, 1780, "tcp" }, - { "dpkeyserv", { NULL }, 1780, "udp" }, - { "answersoft-lm", { NULL }, 1781, "tcp" }, - { "answersoft-lm", { NULL }, 1781, "udp" }, - { "hp-hcip", { NULL }, 1782, "tcp" }, - { "hp-hcip", { NULL }, 1782, "udp" }, - { "finle-lm", { NULL }, 1784, "tcp" }, - { "finle-lm", { NULL }, 1784, "udp" }, - { "windlm", { NULL }, 1785, "tcp" }, - { "windlm", { NULL }, 1785, "udp" }, - { "funk-logger", { NULL }, 1786, "tcp" }, - { "funk-logger", { NULL }, 1786, "udp" }, - { "funk-license", { NULL }, 1787, "tcp" }, - { "funk-license", { NULL }, 1787, "udp" }, - { "psmond", { NULL }, 1788, "tcp" }, - { "psmond", { NULL }, 1788, "udp" }, - { "hello", { NULL }, 1789, "tcp" }, - { "hello", { NULL }, 1789, "udp" }, - { "nmsp", { NULL }, 1790, "tcp" }, - { "nmsp", { NULL }, 1790, "udp" }, - { "ea1", { NULL }, 1791, "tcp" }, - { "ea1", { NULL }, 1791, "udp" }, - { "ibm-dt-2", { NULL }, 1792, "tcp" }, - { "ibm-dt-2", { NULL }, 1792, "udp" }, - { "rsc-robot", { NULL }, 1793, "tcp" }, - { "rsc-robot", { NULL }, 1793, "udp" }, - { "cera-bcm", { NULL }, 1794, "tcp" }, - { "cera-bcm", { NULL }, 1794, "udp" }, - { "dpi-proxy", { NULL }, 1795, "tcp" }, - { "dpi-proxy", { NULL }, 1795, "udp" }, - { "vocaltec-admin", { NULL }, 1796, "tcp" }, - { "vocaltec-admin", { NULL }, 1796, "udp" }, - { "uma", { NULL }, 1797, "tcp" }, - { "uma", { NULL }, 1797, "udp" }, - { "etp", { NULL }, 1798, "tcp" }, - { "etp", { NULL }, 1798, "udp" }, - { "netrisk", { NULL }, 1799, "tcp" }, - { "netrisk", { NULL }, 1799, "udp" }, - { "ansys-lm", { NULL }, 1800, "tcp" }, - { "ansys-lm", { NULL }, 1800, "udp" }, - { "msmq", { NULL }, 1801, "tcp" }, - { "msmq", { NULL }, 1801, "udp" }, - { "concomp1", { NULL }, 1802, "tcp" }, - { "concomp1", { NULL }, 1802, "udp" }, - { "hp-hcip-gwy", { NULL }, 1803, "tcp" }, - { "hp-hcip-gwy", { NULL }, 1803, "udp" }, - { "enl", { NULL }, 1804, "tcp" }, - { "enl", { NULL }, 1804, "udp" }, - { "enl-name", { NULL }, 1805, "tcp" }, - { "enl-name", { NULL }, 1805, "udp" }, - { "musiconline", { NULL }, 1806, "tcp" }, - { "musiconline", { NULL }, 1806, "udp" }, - { "fhsp", { NULL }, 1807, "tcp" }, - { "fhsp", { NULL }, 1807, "udp" }, - { "oracle-vp2", { NULL }, 1808, "tcp" }, - { "oracle-vp2", { NULL }, 1808, "udp" }, - { "oracle-vp1", { NULL }, 1809, "tcp" }, - { "oracle-vp1", { NULL }, 1809, "udp" }, - { "jerand-lm", { NULL }, 1810, "tcp" }, - { "jerand-lm", { NULL }, 1810, "udp" }, - { "scientia-sdb", { NULL }, 1811, "tcp" }, - { "scientia-sdb", { NULL }, 1811, "udp" }, - { "radius", { NULL }, 1812, "tcp" }, - { "radius", { NULL }, 1812, "udp" }, - { "radius-acct", { NULL }, 1813, "tcp" }, - { "radius-acct", { NULL }, 1813, "udp" }, - { "tdp-suite", { NULL }, 1814, "tcp" }, - { "tdp-suite", { NULL }, 1814, "udp" }, - { "mmpft", { NULL }, 1815, "tcp" }, - { "mmpft", { NULL }, 1815, "udp" }, - { "harp", { NULL }, 1816, "tcp" }, - { "harp", { NULL }, 1816, "udp" }, - { "rkb-oscs", { NULL }, 1817, "tcp" }, - { "rkb-oscs", { NULL }, 1817, "udp" }, - { "etftp", { NULL }, 1818, "tcp" }, - { "etftp", { NULL }, 1818, "udp" }, - { "plato-lm", { NULL }, 1819, "tcp" }, - { "plato-lm", { NULL }, 1819, "udp" }, - { "mcagent", { NULL }, 1820, "tcp" }, - { "mcagent", { NULL }, 1820, "udp" }, - { "donnyworld", { NULL }, 1821, "tcp" }, - { "donnyworld", { NULL }, 1821, "udp" }, - { "es-elmd", { NULL }, 1822, "tcp" }, - { "es-elmd", { NULL }, 1822, "udp" }, - { "unisys-lm", { NULL }, 1823, "tcp" }, - { "unisys-lm", { NULL }, 1823, "udp" }, - { "metrics-pas", { NULL }, 1824, "tcp" }, - { "metrics-pas", { NULL }, 1824, "udp" }, - { "direcpc-video", { NULL }, 1825, "tcp" }, - { "direcpc-video", { NULL }, 1825, "udp" }, - { "ardt", { NULL }, 1826, "tcp" }, - { "ardt", { NULL }, 1826, "udp" }, - { "asi", { NULL }, 1827, "tcp" }, - { "asi", { NULL }, 1827, "udp" }, - { "itm-mcell-u", { NULL }, 1828, "tcp" }, - { "itm-mcell-u", { NULL }, 1828, "udp" }, - { "optika-emedia", { NULL }, 1829, "tcp" }, - { "optika-emedia", { NULL }, 1829, "udp" }, - { "net8-cman", { NULL }, 1830, "tcp" }, - { "net8-cman", { NULL }, 1830, "udp" }, - { "myrtle", { NULL }, 1831, "tcp" }, - { "myrtle", { NULL }, 1831, "udp" }, - { "tht-treasure", { NULL }, 1832, "tcp" }, - { "tht-treasure", { NULL }, 1832, "udp" }, - { "udpradio", { NULL }, 1833, "tcp" }, - { "udpradio", { NULL }, 1833, "udp" }, - { "ardusuni", { NULL }, 1834, "tcp" }, - { "ardusuni", { NULL }, 1834, "udp" }, - { "ardusmul", { NULL }, 1835, "tcp" }, - { "ardusmul", { NULL }, 1835, "udp" }, - { "ste-smsc", { NULL }, 1836, "tcp" }, - { "ste-smsc", { NULL }, 1836, "udp" }, - { "csoft1", { NULL }, 1837, "tcp" }, - { "csoft1", { NULL }, 1837, "udp" }, - { "talnet", { NULL }, 1838, "tcp" }, - { "talnet", { NULL }, 1838, "udp" }, - { "netopia-vo1", { NULL }, 1839, "tcp" }, - { "netopia-vo1", { NULL }, 1839, "udp" }, - { "netopia-vo2", { NULL }, 1840, "tcp" }, - { "netopia-vo2", { NULL }, 1840, "udp" }, - { "netopia-vo3", { NULL }, 1841, "tcp" }, - { "netopia-vo3", { NULL }, 1841, "udp" }, - { "netopia-vo4", { NULL }, 1842, "tcp" }, - { "netopia-vo4", { NULL }, 1842, "udp" }, - { "netopia-vo5", { NULL }, 1843, "tcp" }, - { "netopia-vo5", { NULL }, 1843, "udp" }, - { "direcpc-dll", { NULL }, 1844, "tcp" }, - { "direcpc-dll", { NULL }, 1844, "udp" }, - { "altalink", { NULL }, 1845, "tcp" }, - { "altalink", { NULL }, 1845, "udp" }, - { "tunstall-pnc", { NULL }, 1846, "tcp" }, - { "tunstall-pnc", { NULL }, 1846, "udp" }, - { "slp-notify", { NULL }, 1847, "tcp" }, - { "slp-notify", { NULL }, 1847, "udp" }, - { "fjdocdist", { NULL }, 1848, "tcp" }, - { "fjdocdist", { NULL }, 1848, "udp" }, - { "alpha-sms", { NULL }, 1849, "tcp" }, - { "alpha-sms", { NULL }, 1849, "udp" }, - { "gsi", { NULL }, 1850, "tcp" }, - { "gsi", { NULL }, 1850, "udp" }, - { "ctcd", { NULL }, 1851, "tcp" }, - { "ctcd", { NULL }, 1851, "udp" }, - { "virtual-time", { NULL }, 1852, "tcp" }, - { "virtual-time", { NULL }, 1852, "udp" }, - { "vids-avtp", { NULL }, 1853, "tcp" }, - { "vids-avtp", { NULL }, 1853, "udp" }, - { "buddy-draw", { NULL }, 1854, "tcp" }, - { "buddy-draw", { NULL }, 1854, "udp" }, - { "fiorano-rtrsvc", { NULL }, 1855, "tcp" }, - { "fiorano-rtrsvc", { NULL }, 1855, "udp" }, - { "fiorano-msgsvc", { NULL }, 1856, "tcp" }, - { "fiorano-msgsvc", { NULL }, 1856, "udp" }, - { "datacaptor", { NULL }, 1857, "tcp" }, - { "datacaptor", { NULL }, 1857, "udp" }, - { "privateark", { NULL }, 1858, "tcp" }, - { "privateark", { NULL }, 1858, "udp" }, - { "gammafetchsvr", { NULL }, 1859, "tcp" }, - { "gammafetchsvr", { NULL }, 1859, "udp" }, - { "sunscalar-svc", { NULL }, 1860, "tcp" }, - { "sunscalar-svc", { NULL }, 1860, "udp" }, - { "lecroy-vicp", { NULL }, 1861, "tcp" }, - { "lecroy-vicp", { NULL }, 1861, "udp" }, - { "mysql-cm-agent", { NULL }, 1862, "tcp" }, - { "mysql-cm-agent", { NULL }, 1862, "udp" }, - { "msnp", { NULL }, 1863, "tcp" }, - { "msnp", { NULL }, 1863, "udp" }, - { "paradym-31port", { NULL }, 1864, "tcp" }, - { "paradym-31port", { NULL }, 1864, "udp" }, - { "entp", { NULL }, 1865, "tcp" }, - { "entp", { NULL }, 1865, "udp" }, - { "swrmi", { NULL }, 1866, "tcp" }, - { "swrmi", { NULL }, 1866, "udp" }, - { "udrive", { NULL }, 1867, "tcp" }, - { "udrive", { NULL }, 1867, "udp" }, - { "viziblebrowser", { NULL }, 1868, "tcp" }, - { "viziblebrowser", { NULL }, 1868, "udp" }, - { "transact", { NULL }, 1869, "tcp" }, - { "transact", { NULL }, 1869, "udp" }, - { "sunscalar-dns", { NULL }, 1870, "tcp" }, - { "sunscalar-dns", { NULL }, 1870, "udp" }, - { "canocentral0", { NULL }, 1871, "tcp" }, - { "canocentral0", { NULL }, 1871, "udp" }, - { "canocentral1", { NULL }, 1872, "tcp" }, - { "canocentral1", { NULL }, 1872, "udp" }, - { "fjmpjps", { NULL }, 1873, "tcp" }, - { "fjmpjps", { NULL }, 1873, "udp" }, - { "fjswapsnp", { NULL }, 1874, "tcp" }, - { "fjswapsnp", { NULL }, 1874, "udp" }, - { "westell-stats", { NULL }, 1875, "tcp" }, - { "westell-stats", { NULL }, 1875, "udp" }, - { "ewcappsrv", { NULL }, 1876, "tcp" }, - { "ewcappsrv", { NULL }, 1876, "udp" }, - { "hp-webqosdb", { NULL }, 1877, "tcp" }, - { "hp-webqosdb", { NULL }, 1877, "udp" }, - { "drmsmc", { NULL }, 1878, "tcp" }, - { "drmsmc", { NULL }, 1878, "udp" }, - { "nettgain-nms", { NULL }, 1879, "tcp" }, - { "nettgain-nms", { NULL }, 1879, "udp" }, - { "vsat-control", { NULL }, 1880, "tcp" }, - { "vsat-control", { NULL }, 1880, "udp" }, - { "ibm-mqseries2", { NULL }, 1881, "tcp" }, - { "ibm-mqseries2", { NULL }, 1881, "udp" }, - { "ecsqdmn", { NULL }, 1882, "tcp" }, - { "ecsqdmn", { NULL }, 1882, "udp" }, - { "ibm-mqisdp", { NULL }, 1883, "tcp" }, - { "ibm-mqisdp", { NULL }, 1883, "udp" }, - { "idmaps", { NULL }, 1884, "tcp" }, - { "idmaps", { NULL }, 1884, "udp" }, - { "vrtstrapserver", { NULL }, 1885, "tcp" }, - { "vrtstrapserver", { NULL }, 1885, "udp" }, - { "leoip", { NULL }, 1886, "tcp" }, - { "leoip", { NULL }, 1886, "udp" }, - { "filex-lport", { NULL }, 1887, "tcp" }, - { "filex-lport", { NULL }, 1887, "udp" }, - { "ncconfig", { NULL }, 1888, "tcp" }, - { "ncconfig", { NULL }, 1888, "udp" }, - { "unify-adapter", { NULL }, 1889, "tcp" }, - { "unify-adapter", { NULL }, 1889, "udp" }, - { "wilkenlistener", { NULL }, 1890, "tcp" }, - { "wilkenlistener", { NULL }, 1890, "udp" }, - { "childkey-notif", { NULL }, 1891, "tcp" }, - { "childkey-notif", { NULL }, 1891, "udp" }, - { "childkey-ctrl", { NULL }, 1892, "tcp" }, - { "childkey-ctrl", { NULL }, 1892, "udp" }, - { "elad", { NULL }, 1893, "tcp" }, - { "elad", { NULL }, 1893, "udp" }, - { "o2server-port", { NULL }, 1894, "tcp" }, - { "o2server-port", { NULL }, 1894, "udp" }, - { "b-novative-ls", { NULL }, 1896, "tcp" }, - { "b-novative-ls", { NULL }, 1896, "udp" }, - { "metaagent", { NULL }, 1897, "tcp" }, - { "metaagent", { NULL }, 1897, "udp" }, - { "cymtec-port", { NULL }, 1898, "tcp" }, - { "cymtec-port", { NULL }, 1898, "udp" }, - { "mc2studios", { NULL }, 1899, "tcp" }, - { "mc2studios", { NULL }, 1899, "udp" }, - { "ssdp", { NULL }, 1900, "tcp" }, - { "ssdp", { NULL }, 1900, "udp" }, - { "fjicl-tep-a", { NULL }, 1901, "tcp" }, - { "fjicl-tep-a", { NULL }, 1901, "udp" }, - { "fjicl-tep-b", { NULL }, 1902, "tcp" }, - { "fjicl-tep-b", { NULL }, 1902, "udp" }, - { "linkname", { NULL }, 1903, "tcp" }, - { "linkname", { NULL }, 1903, "udp" }, - { "fjicl-tep-c", { NULL }, 1904, "tcp" }, - { "fjicl-tep-c", { NULL }, 1904, "udp" }, - { "sugp", { NULL }, 1905, "tcp" }, - { "sugp", { NULL }, 1905, "udp" }, - { "tpmd", { NULL }, 1906, "tcp" }, - { "tpmd", { NULL }, 1906, "udp" }, - { "intrastar", { NULL }, 1907, "tcp" }, - { "intrastar", { NULL }, 1907, "udp" }, - { "dawn", { NULL }, 1908, "tcp" }, - { "dawn", { NULL }, 1908, "udp" }, - { "global-wlink", { NULL }, 1909, "tcp" }, - { "global-wlink", { NULL }, 1909, "udp" }, - { "ultrabac", { NULL }, 1910, "tcp" }, - { "ultrabac", { NULL }, 1910, "udp" }, - { "mtp", { NULL }, 1911, "tcp" }, - { "mtp", { NULL }, 1911, "udp" }, - { "rhp-iibp", { NULL }, 1912, "tcp" }, - { "rhp-iibp", { NULL }, 1912, "udp" }, - { "armadp", { NULL }, 1913, "tcp" }, - { "armadp", { NULL }, 1913, "udp" }, - { "elm-momentum", { NULL }, 1914, "tcp" }, - { "elm-momentum", { NULL }, 1914, "udp" }, - { "facelink", { NULL }, 1915, "tcp" }, - { "facelink", { NULL }, 1915, "udp" }, - { "persona", { NULL }, 1916, "tcp" }, - { "persona", { NULL }, 1916, "udp" }, - { "noagent", { NULL }, 1917, "tcp" }, - { "noagent", { NULL }, 1917, "udp" }, - { "can-nds", { NULL }, 1918, "tcp" }, - { "can-nds", { NULL }, 1918, "udp" }, - { "can-dch", { NULL }, 1919, "tcp" }, - { "can-dch", { NULL }, 1919, "udp" }, - { "can-ferret", { NULL }, 1920, "tcp" }, - { "can-ferret", { NULL }, 1920, "udp" }, - { "noadmin", { NULL }, 1921, "tcp" }, - { "noadmin", { NULL }, 1921, "udp" }, - { "tapestry", { NULL }, 1922, "tcp" }, - { "tapestry", { NULL }, 1922, "udp" }, - { "spice", { NULL }, 1923, "tcp" }, - { "spice", { NULL }, 1923, "udp" }, - { "xiip", { NULL }, 1924, "tcp" }, - { "xiip", { NULL }, 1924, "udp" }, - { "discovery-port", { NULL }, 1925, "tcp" }, - { "discovery-port", { NULL }, 1925, "udp" }, - { "egs", { NULL }, 1926, "tcp" }, - { "egs", { NULL }, 1926, "udp" }, - { "videte-cipc", { NULL }, 1927, "tcp" }, - { "videte-cipc", { NULL }, 1927, "udp" }, - { "emsd-port", { NULL }, 1928, "tcp" }, - { "emsd-port", { NULL }, 1928, "udp" }, - { "bandwiz-system", { NULL }, 1929, "tcp" }, - { "bandwiz-system", { NULL }, 1929, "udp" }, - { "driveappserver", { NULL }, 1930, "tcp" }, - { "driveappserver", { NULL }, 1930, "udp" }, - { "amdsched", { NULL }, 1931, "tcp" }, - { "amdsched", { NULL }, 1931, "udp" }, - { "ctt-broker", { NULL }, 1932, "tcp" }, - { "ctt-broker", { NULL }, 1932, "udp" }, - { "xmapi", { NULL }, 1933, "tcp" }, - { "xmapi", { NULL }, 1933, "udp" }, - { "xaapi", { NULL }, 1934, "tcp" }, - { "xaapi", { NULL }, 1934, "udp" }, - { "macromedia-fcs", { NULL }, 1935, "tcp" }, - { "macromedia-fcs", { NULL }, 1935, "udp" }, - { "jetcmeserver", { NULL }, 1936, "tcp" }, - { "jetcmeserver", { NULL }, 1936, "udp" }, - { "jwserver", { NULL }, 1937, "tcp" }, - { "jwserver", { NULL }, 1937, "udp" }, - { "jwclient", { NULL }, 1938, "tcp" }, - { "jwclient", { NULL }, 1938, "udp" }, - { "jvserver", { NULL }, 1939, "tcp" }, - { "jvserver", { NULL }, 1939, "udp" }, - { "jvclient", { NULL }, 1940, "tcp" }, - { "jvclient", { NULL }, 1940, "udp" }, - { "dic-aida", { NULL }, 1941, "tcp" }, - { "dic-aida", { NULL }, 1941, "udp" }, - { "res", { NULL }, 1942, "tcp" }, - { "res", { NULL }, 1942, "udp" }, - { "beeyond-media", { NULL }, 1943, "tcp" }, - { "beeyond-media", { NULL }, 1943, "udp" }, - { "close-combat", { NULL }, 1944, "tcp" }, - { "close-combat", { NULL }, 1944, "udp" }, - { "dialogic-elmd", { NULL }, 1945, "tcp" }, - { "dialogic-elmd", { NULL }, 1945, "udp" }, - { "tekpls", { NULL }, 1946, "tcp" }, - { "tekpls", { NULL }, 1946, "udp" }, - { "sentinelsrm", { NULL }, 1947, "tcp" }, - { "sentinelsrm", { NULL }, 1947, "udp" }, - { "eye2eye", { NULL }, 1948, "tcp" }, - { "eye2eye", { NULL }, 1948, "udp" }, - { "ismaeasdaqlive", { NULL }, 1949, "tcp" }, - { "ismaeasdaqlive", { NULL }, 1949, "udp" }, - { "ismaeasdaqtest", { NULL }, 1950, "tcp" }, - { "ismaeasdaqtest", { NULL }, 1950, "udp" }, - { "bcs-lmserver", { NULL }, 1951, "tcp" }, - { "bcs-lmserver", { NULL }, 1951, "udp" }, - { "mpnjsc", { NULL }, 1952, "tcp" }, - { "mpnjsc", { NULL }, 1952, "udp" }, - { "rapidbase", { NULL }, 1953, "tcp" }, - { "rapidbase", { NULL }, 1953, "udp" }, - { "abr-api", { NULL }, 1954, "tcp" }, - { "abr-api", { NULL }, 1954, "udp" }, - { "abr-secure", { NULL }, 1955, "tcp" }, - { "abr-secure", { NULL }, 1955, "udp" }, - { "vrtl-vmf-ds", { NULL }, 1956, "tcp" }, - { "vrtl-vmf-ds", { NULL }, 1956, "udp" }, - { "unix-status", { NULL }, 1957, "tcp" }, - { "unix-status", { NULL }, 1957, "udp" }, - { "dxadmind", { NULL }, 1958, "tcp" }, - { "dxadmind", { NULL }, 1958, "udp" }, - { "simp-all", { NULL }, 1959, "tcp" }, - { "simp-all", { NULL }, 1959, "udp" }, - { "nasmanager", { NULL }, 1960, "tcp" }, - { "nasmanager", { NULL }, 1960, "udp" }, - { "bts-appserver", { NULL }, 1961, "tcp" }, - { "bts-appserver", { NULL }, 1961, "udp" }, - { "biap-mp", { NULL }, 1962, "tcp" }, - { "biap-mp", { NULL }, 1962, "udp" }, - { "webmachine", { NULL }, 1963, "tcp" }, - { "webmachine", { NULL }, 1963, "udp" }, - { "solid-e-engine", { NULL }, 1964, "tcp" }, - { "solid-e-engine", { NULL }, 1964, "udp" }, - { "tivoli-npm", { NULL }, 1965, "tcp" }, - { "tivoli-npm", { NULL }, 1965, "udp" }, - { "slush", { NULL }, 1966, "tcp" }, - { "slush", { NULL }, 1966, "udp" }, - { "sns-quote", { NULL }, 1967, "tcp" }, - { "sns-quote", { NULL }, 1967, "udp" }, - { "lipsinc", { NULL }, 1968, "tcp" }, - { "lipsinc", { NULL }, 1968, "udp" }, - { "lipsinc1", { NULL }, 1969, "tcp" }, - { "lipsinc1", { NULL }, 1969, "udp" }, - { "netop-rc", { NULL }, 1970, "tcp" }, - { "netop-rc", { NULL }, 1970, "udp" }, - { "netop-school", { NULL }, 1971, "tcp" }, - { "netop-school", { NULL }, 1971, "udp" }, - { "intersys-cache", { NULL }, 1972, "tcp" }, - { "intersys-cache", { NULL }, 1972, "udp" }, - { "dlsrap", { NULL }, 1973, "tcp" }, - { "dlsrap", { NULL }, 1973, "udp" }, - { "drp", { NULL }, 1974, "tcp" }, - { "drp", { NULL }, 1974, "udp" }, - { "tcoflashagent", { NULL }, 1975, "tcp" }, - { "tcoflashagent", { NULL }, 1975, "udp" }, - { "tcoregagent", { NULL }, 1976, "tcp" }, - { "tcoregagent", { NULL }, 1976, "udp" }, - { "tcoaddressbook", { NULL }, 1977, "tcp" }, - { "tcoaddressbook", { NULL }, 1977, "udp" }, - { "unisql", { NULL }, 1978, "tcp" }, - { "unisql", { NULL }, 1978, "udp" }, - { "unisql-java", { NULL }, 1979, "tcp" }, - { "unisql-java", { NULL }, 1979, "udp" }, - { "pearldoc-xact", { NULL }, 1980, "tcp" }, - { "pearldoc-xact", { NULL }, 1980, "udp" }, - { "p2pq", { NULL }, 1981, "tcp" }, - { "p2pq", { NULL }, 1981, "udp" }, - { "estamp", { NULL }, 1982, "tcp" }, - { "estamp", { NULL }, 1982, "udp" }, - { "lhtp", { NULL }, 1983, "tcp" }, - { "lhtp", { NULL }, 1983, "udp" }, - { "bb", { NULL }, 1984, "tcp" }, - { "bb", { NULL }, 1984, "udp" }, - { "hsrp", { NULL }, 1985, "tcp" }, - { "hsrp", { NULL }, 1985, "udp" }, - { "licensedaemon", { NULL }, 1986, "tcp" }, - { "licensedaemon", { NULL }, 1986, "udp" }, - { "tr-rsrb-p1", { NULL }, 1987, "tcp" }, - { "tr-rsrb-p1", { NULL }, 1987, "udp" }, - { "tr-rsrb-p2", { NULL }, 1988, "tcp" }, - { "tr-rsrb-p2", { NULL }, 1988, "udp" }, - { "tr-rsrb-p3", { NULL }, 1989, "tcp" }, - { "tr-rsrb-p3", { NULL }, 1989, "udp" }, - { "mshnet", { NULL }, 1989, "tcp" }, - { "mshnet", { NULL }, 1989, "udp" }, - { "stun-p1", { NULL }, 1990, "tcp" }, - { "stun-p1", { NULL }, 1990, "udp" }, - { "stun-p2", { NULL }, 1991, "tcp" }, - { "stun-p2", { NULL }, 1991, "udp" }, - { "stun-p3", { NULL }, 1992, "tcp" }, - { "stun-p3", { NULL }, 1992, "udp" }, - { "ipsendmsg", { NULL }, 1992, "tcp" }, - { "ipsendmsg", { NULL }, 1992, "udp" }, - { "snmp-tcp-port", { NULL }, 1993, "tcp" }, - { "snmp-tcp-port", { NULL }, 1993, "udp" }, - { "stun-port", { NULL }, 1994, "tcp" }, - { "stun-port", { NULL }, 1994, "udp" }, - { "perf-port", { NULL }, 1995, "tcp" }, - { "perf-port", { NULL }, 1995, "udp" }, - { "tr-rsrb-port", { NULL }, 1996, "tcp" }, - { "tr-rsrb-port", { NULL }, 1996, "udp" }, - { "gdp-port", { NULL }, 1997, "tcp" }, - { "gdp-port", { NULL }, 1997, "udp" }, - { "x25-svc-port", { NULL }, 1998, "tcp" }, - { "x25-svc-port", { NULL }, 1998, "udp" }, - { "tcp-id-port", { NULL }, 1999, "tcp" }, - { "tcp-id-port", { NULL }, 1999, "udp" }, - { "cisco-sccp", { NULL }, 2000, "tcp" }, - { "cisco-sccp", { NULL }, 2000, "udp" }, - { "dc", { NULL }, 2001, "tcp" }, - { "wizard", { NULL }, 2001, "udp" }, - { "globe", { NULL }, 2002, "tcp" }, - { "globe", { NULL }, 2002, "udp" }, - { "brutus", { NULL }, 2003, "tcp" }, - { "brutus", { NULL }, 2003, "udp" }, - { "mailbox", { NULL }, 2004, "tcp" }, - { "emce", { NULL }, 2004, "udp" }, - { "berknet", { NULL }, 2005, "tcp" }, - { "oracle", { NULL }, 2005, "udp" }, - { "invokator", { NULL }, 2006, "tcp" }, - { "raid-cd", { NULL }, 2006, "udp" }, - { "dectalk", { NULL }, 2007, "tcp" }, - { "raid-am", { NULL }, 2007, "udp" }, - { "conf", { NULL }, 2008, "tcp" }, - { "terminaldb", { NULL }, 2008, "udp" }, - { "news", { NULL }, 2009, "tcp" }, - { "whosockami", { NULL }, 2009, "udp" }, - { "search", { NULL }, 2010, "tcp" }, - { "pipe_server", { NULL }, 2010, "udp" }, - { "raid-cc", { NULL }, 2011, "tcp" }, - { "servserv", { NULL }, 2011, "udp" }, - { "ttyinfo", { NULL }, 2012, "tcp" }, - { "raid-ac", { NULL }, 2012, "udp" }, - { "raid-am", { NULL }, 2013, "tcp" }, - { "raid-cd", { NULL }, 2013, "udp" }, - { "troff", { NULL }, 2014, "tcp" }, - { "raid-sf", { NULL }, 2014, "udp" }, - { "cypress", { NULL }, 2015, "tcp" }, - { "raid-cs", { NULL }, 2015, "udp" }, - { "bootserver", { NULL }, 2016, "tcp" }, - { "bootserver", { NULL }, 2016, "udp" }, - { "cypress-stat", { NULL }, 2017, "tcp" }, - { "bootclient", { NULL }, 2017, "udp" }, - { "terminaldb", { NULL }, 2018, "tcp" }, - { "rellpack", { NULL }, 2018, "udp" }, - { "whosockami", { NULL }, 2019, "tcp" }, - { "about", { NULL }, 2019, "udp" }, - { "xinupageserver", { NULL }, 2020, "tcp" }, - { "xinupageserver", { NULL }, 2020, "udp" }, - { "servexec", { NULL }, 2021, "tcp" }, - { "xinuexpansion1", { NULL }, 2021, "udp" }, - { "down", { NULL }, 2022, "tcp" }, - { "xinuexpansion2", { NULL }, 2022, "udp" }, - { "xinuexpansion3", { NULL }, 2023, "tcp" }, - { "xinuexpansion3", { NULL }, 2023, "udp" }, - { "xinuexpansion4", { NULL }, 2024, "tcp" }, - { "xinuexpansion4", { NULL }, 2024, "udp" }, - { "ellpack", { NULL }, 2025, "tcp" }, - { "xribs", { NULL }, 2025, "udp" }, - { "scrabble", { NULL }, 2026, "tcp" }, - { "scrabble", { NULL }, 2026, "udp" }, - { "shadowserver", { NULL }, 2027, "tcp" }, - { "shadowserver", { NULL }, 2027, "udp" }, - { "submitserver", { NULL }, 2028, "tcp" }, - { "submitserver", { NULL }, 2028, "udp" }, - { "hsrpv6", { NULL }, 2029, "tcp" }, - { "hsrpv6", { NULL }, 2029, "udp" }, - { "device2", { NULL }, 2030, "tcp" }, - { "device2", { NULL }, 2030, "udp" }, - { "mobrien-chat", { NULL }, 2031, "tcp" }, - { "mobrien-chat", { NULL }, 2031, "udp" }, - { "blackboard", { NULL }, 2032, "tcp" }, - { "blackboard", { NULL }, 2032, "udp" }, - { "glogger", { NULL }, 2033, "tcp" }, - { "glogger", { NULL }, 2033, "udp" }, - { "scoremgr", { NULL }, 2034, "tcp" }, - { "scoremgr", { NULL }, 2034, "udp" }, - { "imsldoc", { NULL }, 2035, "tcp" }, - { "imsldoc", { NULL }, 2035, "udp" }, - { "e-dpnet", { NULL }, 2036, "tcp" }, - { "e-dpnet", { NULL }, 2036, "udp" }, - { "applus", { NULL }, 2037, "tcp" }, - { "applus", { NULL }, 2037, "udp" }, - { "objectmanager", { NULL }, 2038, "tcp" }, - { "objectmanager", { NULL }, 2038, "udp" }, - { "prizma", { NULL }, 2039, "tcp" }, - { "prizma", { NULL }, 2039, "udp" }, - { "lam", { NULL }, 2040, "tcp" }, - { "lam", { NULL }, 2040, "udp" }, - { "interbase", { NULL }, 2041, "tcp" }, - { "interbase", { NULL }, 2041, "udp" }, - { "isis", { NULL }, 2042, "tcp" }, - { "isis", { NULL }, 2042, "udp" }, - { "isis-bcast", { NULL }, 2043, "tcp" }, - { "isis-bcast", { NULL }, 2043, "udp" }, - { "rimsl", { NULL }, 2044, "tcp" }, - { "rimsl", { NULL }, 2044, "udp" }, - { "cdfunc", { NULL }, 2045, "tcp" }, - { "cdfunc", { NULL }, 2045, "udp" }, - { "sdfunc", { NULL }, 2046, "tcp" }, - { "sdfunc", { NULL }, 2046, "udp" }, - { "dls", { NULL }, 2047, "tcp" }, - { "dls", { NULL }, 2047, "udp" }, - { "dls-monitor", { NULL }, 2048, "tcp" }, - { "dls-monitor", { NULL }, 2048, "udp" }, - { "shilp", { NULL }, 2049, "tcp" }, - { "shilp", { NULL }, 2049, "udp" }, - { "nfs", { NULL }, 2049, "tcp" }, - { "nfs", { NULL }, 2049, "udp" }, - { "nfs", { NULL }, 2049, "sctp" }, - { "av-emb-config", { NULL }, 2050, "tcp" }, - { "av-emb-config", { NULL }, 2050, "udp" }, - { "epnsdp", { NULL }, 2051, "tcp" }, - { "epnsdp", { NULL }, 2051, "udp" }, - { "clearvisn", { NULL }, 2052, "tcp" }, - { "clearvisn", { NULL }, 2052, "udp" }, - { "lot105-ds-upd", { NULL }, 2053, "tcp" }, - { "lot105-ds-upd", { NULL }, 2053, "udp" }, - { "weblogin", { NULL }, 2054, "tcp" }, - { "weblogin", { NULL }, 2054, "udp" }, - { "iop", { NULL }, 2055, "tcp" }, - { "iop", { NULL }, 2055, "udp" }, - { "omnisky", { NULL }, 2056, "tcp" }, - { "omnisky", { NULL }, 2056, "udp" }, - { "rich-cp", { NULL }, 2057, "tcp" }, - { "rich-cp", { NULL }, 2057, "udp" }, - { "newwavesearch", { NULL }, 2058, "tcp" }, - { "newwavesearch", { NULL }, 2058, "udp" }, - { "bmc-messaging", { NULL }, 2059, "tcp" }, - { "bmc-messaging", { NULL }, 2059, "udp" }, - { "teleniumdaemon", { NULL }, 2060, "tcp" }, - { "teleniumdaemon", { NULL }, 2060, "udp" }, - { "netmount", { NULL }, 2061, "tcp" }, - { "netmount", { NULL }, 2061, "udp" }, - { "icg-swp", { NULL }, 2062, "tcp" }, - { "icg-swp", { NULL }, 2062, "udp" }, - { "icg-bridge", { NULL }, 2063, "tcp" }, - { "icg-bridge", { NULL }, 2063, "udp" }, - { "icg-iprelay", { NULL }, 2064, "tcp" }, - { "icg-iprelay", { NULL }, 2064, "udp" }, - { "dlsrpn", { NULL }, 2065, "tcp" }, - { "dlsrpn", { NULL }, 2065, "udp" }, - { "aura", { NULL }, 2066, "tcp" }, - { "aura", { NULL }, 2066, "udp" }, - { "dlswpn", { NULL }, 2067, "tcp" }, - { "dlswpn", { NULL }, 2067, "udp" }, - { "avauthsrvprtcl", { NULL }, 2068, "tcp" }, - { "avauthsrvprtcl", { NULL }, 2068, "udp" }, - { "event-port", { NULL }, 2069, "tcp" }, - { "event-port", { NULL }, 2069, "udp" }, - { "ah-esp-encap", { NULL }, 2070, "tcp" }, - { "ah-esp-encap", { NULL }, 2070, "udp" }, - { "acp-port", { NULL }, 2071, "tcp" }, - { "acp-port", { NULL }, 2071, "udp" }, - { "msync", { NULL }, 2072, "tcp" }, - { "msync", { NULL }, 2072, "udp" }, - { "gxs-data-port", { NULL }, 2073, "tcp" }, - { "gxs-data-port", { NULL }, 2073, "udp" }, - { "vrtl-vmf-sa", { NULL }, 2074, "tcp" }, - { "vrtl-vmf-sa", { NULL }, 2074, "udp" }, - { "newlixengine", { NULL }, 2075, "tcp" }, - { "newlixengine", { NULL }, 2075, "udp" }, - { "newlixconfig", { NULL }, 2076, "tcp" }, - { "newlixconfig", { NULL }, 2076, "udp" }, - { "tsrmagt", { NULL }, 2077, "tcp" }, - { "tsrmagt", { NULL }, 2077, "udp" }, - { "tpcsrvr", { NULL }, 2078, "tcp" }, - { "tpcsrvr", { NULL }, 2078, "udp" }, - { "idware-router", { NULL }, 2079, "tcp" }, - { "idware-router", { NULL }, 2079, "udp" }, - { "autodesk-nlm", { NULL }, 2080, "tcp" }, - { "autodesk-nlm", { NULL }, 2080, "udp" }, - { "kme-trap-port", { NULL }, 2081, "tcp" }, - { "kme-trap-port", { NULL }, 2081, "udp" }, - { "infowave", { NULL }, 2082, "tcp" }, - { "infowave", { NULL }, 2082, "udp" }, - { "radsec", { NULL }, 2083, "tcp" }, - { "radsec", { NULL }, 2083, "udp" }, - { "sunclustergeo", { NULL }, 2084, "tcp" }, - { "sunclustergeo", { NULL }, 2084, "udp" }, - { "ada-cip", { NULL }, 2085, "tcp" }, - { "ada-cip", { NULL }, 2085, "udp" }, - { "gnunet", { NULL }, 2086, "tcp" }, - { "gnunet", { NULL }, 2086, "udp" }, - { "eli", { NULL }, 2087, "tcp" }, - { "eli", { NULL }, 2087, "udp" }, - { "ip-blf", { NULL }, 2088, "tcp" }, - { "ip-blf", { NULL }, 2088, "udp" }, - { "sep", { NULL }, 2089, "tcp" }, - { "sep", { NULL }, 2089, "udp" }, - { "lrp", { NULL }, 2090, "tcp" }, - { "lrp", { NULL }, 2090, "udp" }, - { "prp", { NULL }, 2091, "tcp" }, - { "prp", { NULL }, 2091, "udp" }, - { "descent3", { NULL }, 2092, "tcp" }, - { "descent3", { NULL }, 2092, "udp" }, - { "nbx-cc", { NULL }, 2093, "tcp" }, - { "nbx-cc", { NULL }, 2093, "udp" }, - { "nbx-au", { NULL }, 2094, "tcp" }, - { "nbx-au", { NULL }, 2094, "udp" }, - { "nbx-ser", { NULL }, 2095, "tcp" }, - { "nbx-ser", { NULL }, 2095, "udp" }, - { "nbx-dir", { NULL }, 2096, "tcp" }, - { "nbx-dir", { NULL }, 2096, "udp" }, - { "jetformpreview", { NULL }, 2097, "tcp" }, - { "jetformpreview", { NULL }, 2097, "udp" }, - { "dialog-port", { NULL }, 2098, "tcp" }, - { "dialog-port", { NULL }, 2098, "udp" }, - { "h2250-annex-g", { NULL }, 2099, "tcp" }, - { "h2250-annex-g", { NULL }, 2099, "udp" }, - { "amiganetfs", { NULL }, 2100, "tcp" }, - { "amiganetfs", { NULL }, 2100, "udp" }, - { "rtcm-sc104", { NULL }, 2101, "tcp" }, - { "rtcm-sc104", { NULL }, 2101, "udp" }, - { "zephyr-srv", { NULL }, 2102, "tcp" }, - { "zephyr-srv", { NULL }, 2102, "udp" }, - { "zephyr-clt", { NULL }, 2103, "tcp" }, - { "zephyr-clt", { NULL }, 2103, "udp" }, - { "zephyr-hm", { NULL }, 2104, "tcp" }, - { "zephyr-hm", { NULL }, 2104, "udp" }, - { "minipay", { NULL }, 2105, "tcp" }, - { "minipay", { NULL }, 2105, "udp" }, - { "mzap", { NULL }, 2106, "tcp" }, - { "mzap", { NULL }, 2106, "udp" }, - { "bintec-admin", { NULL }, 2107, "tcp" }, - { "bintec-admin", { NULL }, 2107, "udp" }, - { "comcam", { NULL }, 2108, "tcp" }, - { "comcam", { NULL }, 2108, "udp" }, - { "ergolight", { NULL }, 2109, "tcp" }, - { "ergolight", { NULL }, 2109, "udp" }, - { "umsp", { NULL }, 2110, "tcp" }, - { "umsp", { NULL }, 2110, "udp" }, - { "dsatp", { NULL }, 2111, "tcp" }, - { "dsatp", { NULL }, 2111, "udp" }, - { "idonix-metanet", { NULL }, 2112, "tcp" }, - { "idonix-metanet", { NULL }, 2112, "udp" }, - { "hsl-storm", { NULL }, 2113, "tcp" }, - { "hsl-storm", { NULL }, 2113, "udp" }, - { "newheights", { NULL }, 2114, "tcp" }, - { "newheights", { NULL }, 2114, "udp" }, - { "kdm", { NULL }, 2115, "tcp" }, - { "kdm", { NULL }, 2115, "udp" }, - { "ccowcmr", { NULL }, 2116, "tcp" }, - { "ccowcmr", { NULL }, 2116, "udp" }, - { "mentaclient", { NULL }, 2117, "tcp" }, - { "mentaclient", { NULL }, 2117, "udp" }, - { "mentaserver", { NULL }, 2118, "tcp" }, - { "mentaserver", { NULL }, 2118, "udp" }, - { "gsigatekeeper", { NULL }, 2119, "tcp" }, - { "gsigatekeeper", { NULL }, 2119, "udp" }, - { "qencp", { NULL }, 2120, "tcp" }, - { "qencp", { NULL }, 2120, "udp" }, - { "scientia-ssdb", { NULL }, 2121, "tcp" }, - { "scientia-ssdb", { NULL }, 2121, "udp" }, - { "caupc-remote", { NULL }, 2122, "tcp" }, - { "caupc-remote", { NULL }, 2122, "udp" }, - { "gtp-control", { NULL }, 2123, "tcp" }, - { "gtp-control", { NULL }, 2123, "udp" }, - { "elatelink", { NULL }, 2124, "tcp" }, - { "elatelink", { NULL }, 2124, "udp" }, - { "lockstep", { NULL }, 2125, "tcp" }, - { "lockstep", { NULL }, 2125, "udp" }, - { "pktcable-cops", { NULL }, 2126, "tcp" }, - { "pktcable-cops", { NULL }, 2126, "udp" }, - { "index-pc-wb", { NULL }, 2127, "tcp" }, - { "index-pc-wb", { NULL }, 2127, "udp" }, - { "net-steward", { NULL }, 2128, "tcp" }, - { "net-steward", { NULL }, 2128, "udp" }, - { "cs-live", { NULL }, 2129, "tcp" }, - { "cs-live", { NULL }, 2129, "udp" }, - { "xds", { NULL }, 2130, "tcp" }, - { "xds", { NULL }, 2130, "udp" }, - { "avantageb2b", { NULL }, 2131, "tcp" }, - { "avantageb2b", { NULL }, 2131, "udp" }, - { "solera-epmap", { NULL }, 2132, "tcp" }, - { "solera-epmap", { NULL }, 2132, "udp" }, - { "zymed-zpp", { NULL }, 2133, "tcp" }, - { "zymed-zpp", { NULL }, 2133, "udp" }, - { "avenue", { NULL }, 2134, "tcp" }, - { "avenue", { NULL }, 2134, "udp" }, - { "gris", { NULL }, 2135, "tcp" }, - { "gris", { NULL }, 2135, "udp" }, - { "appworxsrv", { NULL }, 2136, "tcp" }, - { "appworxsrv", { NULL }, 2136, "udp" }, - { "connect", { NULL }, 2137, "tcp" }, - { "connect", { NULL }, 2137, "udp" }, - { "unbind-cluster", { NULL }, 2138, "tcp" }, - { "unbind-cluster", { NULL }, 2138, "udp" }, - { "ias-auth", { NULL }, 2139, "tcp" }, - { "ias-auth", { NULL }, 2139, "udp" }, - { "ias-reg", { NULL }, 2140, "tcp" }, - { "ias-reg", { NULL }, 2140, "udp" }, - { "ias-admind", { NULL }, 2141, "tcp" }, - { "ias-admind", { NULL }, 2141, "udp" }, - { "tdmoip", { NULL }, 2142, "tcp" }, - { "tdmoip", { NULL }, 2142, "udp" }, - { "lv-jc", { NULL }, 2143, "tcp" }, - { "lv-jc", { NULL }, 2143, "udp" }, - { "lv-ffx", { NULL }, 2144, "tcp" }, - { "lv-ffx", { NULL }, 2144, "udp" }, - { "lv-pici", { NULL }, 2145, "tcp" }, - { "lv-pici", { NULL }, 2145, "udp" }, - { "lv-not", { NULL }, 2146, "tcp" }, - { "lv-not", { NULL }, 2146, "udp" }, - { "lv-auth", { NULL }, 2147, "tcp" }, - { "lv-auth", { NULL }, 2147, "udp" }, - { "veritas-ucl", { NULL }, 2148, "tcp" }, - { "veritas-ucl", { NULL }, 2148, "udp" }, - { "acptsys", { NULL }, 2149, "tcp" }, - { "acptsys", { NULL }, 2149, "udp" }, - { "dynamic3d", { NULL }, 2150, "tcp" }, - { "dynamic3d", { NULL }, 2150, "udp" }, - { "docent", { NULL }, 2151, "tcp" }, - { "docent", { NULL }, 2151, "udp" }, - { "gtp-user", { NULL }, 2152, "tcp" }, - { "gtp-user", { NULL }, 2152, "udp" }, - { "ctlptc", { NULL }, 2153, "tcp" }, - { "ctlptc", { NULL }, 2153, "udp" }, - { "stdptc", { NULL }, 2154, "tcp" }, - { "stdptc", { NULL }, 2154, "udp" }, - { "brdptc", { NULL }, 2155, "tcp" }, - { "brdptc", { NULL }, 2155, "udp" }, - { "trp", { NULL }, 2156, "tcp" }, - { "trp", { NULL }, 2156, "udp" }, - { "xnds", { NULL }, 2157, "tcp" }, - { "xnds", { NULL }, 2157, "udp" }, - { "touchnetplus", { NULL }, 2158, "tcp" }, - { "touchnetplus", { NULL }, 2158, "udp" }, - { "gdbremote", { NULL }, 2159, "tcp" }, - { "gdbremote", { NULL }, 2159, "udp" }, - { "apc-2160", { NULL }, 2160, "tcp" }, - { "apc-2160", { NULL }, 2160, "udp" }, - { "apc-2161", { NULL }, 2161, "tcp" }, - { "apc-2161", { NULL }, 2161, "udp" }, - { "navisphere", { NULL }, 2162, "tcp" }, - { "navisphere", { NULL }, 2162, "udp" }, - { "navisphere-sec", { NULL }, 2163, "tcp" }, - { "navisphere-sec", { NULL }, 2163, "udp" }, - { "ddns-v3", { NULL }, 2164, "tcp" }, - { "ddns-v3", { NULL }, 2164, "udp" }, - { "x-bone-api", { NULL }, 2165, "tcp" }, - { "x-bone-api", { NULL }, 2165, "udp" }, - { "iwserver", { NULL }, 2166, "tcp" }, - { "iwserver", { NULL }, 2166, "udp" }, - { "raw-serial", { NULL }, 2167, "tcp" }, - { "raw-serial", { NULL }, 2167, "udp" }, - { "easy-soft-mux", { NULL }, 2168, "tcp" }, - { "easy-soft-mux", { NULL }, 2168, "udp" }, - { "brain", { NULL }, 2169, "tcp" }, - { "brain", { NULL }, 2169, "udp" }, - { "eyetv", { NULL }, 2170, "tcp" }, - { "eyetv", { NULL }, 2170, "udp" }, - { "msfw-storage", { NULL }, 2171, "tcp" }, - { "msfw-storage", { NULL }, 2171, "udp" }, - { "msfw-s-storage", { NULL }, 2172, "tcp" }, - { "msfw-s-storage", { NULL }, 2172, "udp" }, - { "msfw-replica", { NULL }, 2173, "tcp" }, - { "msfw-replica", { NULL }, 2173, "udp" }, - { "msfw-array", { NULL }, 2174, "tcp" }, - { "msfw-array", { NULL }, 2174, "udp" }, - { "airsync", { NULL }, 2175, "tcp" }, - { "airsync", { NULL }, 2175, "udp" }, - { "rapi", { NULL }, 2176, "tcp" }, - { "rapi", { NULL }, 2176, "udp" }, - { "qwave", { NULL }, 2177, "tcp" }, - { "qwave", { NULL }, 2177, "udp" }, - { "bitspeer", { NULL }, 2178, "tcp" }, - { "bitspeer", { NULL }, 2178, "udp" }, - { "vmrdp", { NULL }, 2179, "tcp" }, - { "vmrdp", { NULL }, 2179, "udp" }, - { "mc-gt-srv", { NULL }, 2180, "tcp" }, - { "mc-gt-srv", { NULL }, 2180, "udp" }, - { "eforward", { NULL }, 2181, "tcp" }, - { "eforward", { NULL }, 2181, "udp" }, - { "cgn-stat", { NULL }, 2182, "tcp" }, - { "cgn-stat", { NULL }, 2182, "udp" }, - { "cgn-config", { NULL }, 2183, "tcp" }, - { "cgn-config", { NULL }, 2183, "udp" }, - { "nvd", { NULL }, 2184, "tcp" }, - { "nvd", { NULL }, 2184, "udp" }, - { "onbase-dds", { NULL }, 2185, "tcp" }, - { "onbase-dds", { NULL }, 2185, "udp" }, - { "gtaua", { NULL }, 2186, "tcp" }, - { "gtaua", { NULL }, 2186, "udp" }, - { "ssmc", { NULL }, 2187, "tcp" }, - { "ssmd", { NULL }, 2187, "udp" }, - { "tivoconnect", { NULL }, 2190, "tcp" }, - { "tivoconnect", { NULL }, 2190, "udp" }, - { "tvbus", { NULL }, 2191, "tcp" }, - { "tvbus", { NULL }, 2191, "udp" }, - { "asdis", { NULL }, 2192, "tcp" }, - { "asdis", { NULL }, 2192, "udp" }, - { "drwcs", { NULL }, 2193, "tcp" }, - { "drwcs", { NULL }, 2193, "udp" }, - { "mnp-exchange", { NULL }, 2197, "tcp" }, - { "mnp-exchange", { NULL }, 2197, "udp" }, - { "onehome-remote", { NULL }, 2198, "tcp" }, - { "onehome-remote", { NULL }, 2198, "udp" }, - { "onehome-help", { NULL }, 2199, "tcp" }, - { "onehome-help", { NULL }, 2199, "udp" }, - { "ici", { NULL }, 2200, "tcp" }, - { "ici", { NULL }, 2200, "udp" }, - { "ats", { NULL }, 2201, "tcp" }, - { "ats", { NULL }, 2201, "udp" }, - { "imtc-map", { NULL }, 2202, "tcp" }, - { "imtc-map", { NULL }, 2202, "udp" }, - { "b2-runtime", { NULL }, 2203, "tcp" }, - { "b2-runtime", { NULL }, 2203, "udp" }, - { "b2-license", { NULL }, 2204, "tcp" }, - { "b2-license", { NULL }, 2204, "udp" }, - { "jps", { NULL }, 2205, "tcp" }, - { "jps", { NULL }, 2205, "udp" }, - { "hpocbus", { NULL }, 2206, "tcp" }, - { "hpocbus", { NULL }, 2206, "udp" }, - { "hpssd", { NULL }, 2207, "tcp" }, - { "hpssd", { NULL }, 2207, "udp" }, - { "hpiod", { NULL }, 2208, "tcp" }, - { "hpiod", { NULL }, 2208, "udp" }, - { "rimf-ps", { NULL }, 2209, "tcp" }, - { "rimf-ps", { NULL }, 2209, "udp" }, - { "noaaport", { NULL }, 2210, "tcp" }, - { "noaaport", { NULL }, 2210, "udp" }, - { "emwin", { NULL }, 2211, "tcp" }, - { "emwin", { NULL }, 2211, "udp" }, - { "leecoposserver", { NULL }, 2212, "tcp" }, - { "leecoposserver", { NULL }, 2212, "udp" }, - { "kali", { NULL }, 2213, "tcp" }, - { "kali", { NULL }, 2213, "udp" }, - { "rpi", { NULL }, 2214, "tcp" }, - { "rpi", { NULL }, 2214, "udp" }, - { "ipcore", { NULL }, 2215, "tcp" }, - { "ipcore", { NULL }, 2215, "udp" }, - { "vtu-comms", { NULL }, 2216, "tcp" }, - { "vtu-comms", { NULL }, 2216, "udp" }, - { "gotodevice", { NULL }, 2217, "tcp" }, - { "gotodevice", { NULL }, 2217, "udp" }, - { "bounzza", { NULL }, 2218, "tcp" }, - { "bounzza", { NULL }, 2218, "udp" }, - { "netiq-ncap", { NULL }, 2219, "tcp" }, - { "netiq-ncap", { NULL }, 2219, "udp" }, - { "netiq", { NULL }, 2220, "tcp" }, - { "netiq", { NULL }, 2220, "udp" }, - { "rockwell-csp1", { NULL }, 2221, "tcp" }, - { "rockwell-csp1", { NULL }, 2221, "udp" }, - { "EtherNet/IP-1", { NULL }, 2222, "tcp" }, - { "EtherNet/IP-1", { NULL }, 2222, "udp" }, - { "rockwell-csp2", { NULL }, 2223, "tcp" }, - { "rockwell-csp2", { NULL }, 2223, "udp" }, - { "efi-mg", { NULL }, 2224, "tcp" }, - { "efi-mg", { NULL }, 2224, "udp" }, - { "rcip-itu", { NULL }, 2225, "tcp" }, - { "rcip-itu", { NULL }, 2225, "sctp" }, - { "di-drm", { NULL }, 2226, "tcp" }, - { "di-drm", { NULL }, 2226, "udp" }, - { "di-msg", { NULL }, 2227, "tcp" }, - { "di-msg", { NULL }, 2227, "udp" }, - { "ehome-ms", { NULL }, 2228, "tcp" }, - { "ehome-ms", { NULL }, 2228, "udp" }, - { "datalens", { NULL }, 2229, "tcp" }, - { "datalens", { NULL }, 2229, "udp" }, - { "queueadm", { NULL }, 2230, "tcp" }, - { "queueadm", { NULL }, 2230, "udp" }, - { "wimaxasncp", { NULL }, 2231, "tcp" }, - { "wimaxasncp", { NULL }, 2231, "udp" }, - { "ivs-video", { NULL }, 2232, "tcp" }, - { "ivs-video", { NULL }, 2232, "udp" }, - { "infocrypt", { NULL }, 2233, "tcp" }, - { "infocrypt", { NULL }, 2233, "udp" }, - { "directplay", { NULL }, 2234, "tcp" }, - { "directplay", { NULL }, 2234, "udp" }, - { "sercomm-wlink", { NULL }, 2235, "tcp" }, - { "sercomm-wlink", { NULL }, 2235, "udp" }, - { "nani", { NULL }, 2236, "tcp" }, - { "nani", { NULL }, 2236, "udp" }, - { "optech-port1-lm", { NULL }, 2237, "tcp" }, - { "optech-port1-lm", { NULL }, 2237, "udp" }, - { "aviva-sna", { NULL }, 2238, "tcp" }, - { "aviva-sna", { NULL }, 2238, "udp" }, - { "imagequery", { NULL }, 2239, "tcp" }, - { "imagequery", { NULL }, 2239, "udp" }, - { "recipe", { NULL }, 2240, "tcp" }, - { "recipe", { NULL }, 2240, "udp" }, - { "ivsd", { NULL }, 2241, "tcp" }, - { "ivsd", { NULL }, 2241, "udp" }, - { "foliocorp", { NULL }, 2242, "tcp" }, - { "foliocorp", { NULL }, 2242, "udp" }, - { "magicom", { NULL }, 2243, "tcp" }, - { "magicom", { NULL }, 2243, "udp" }, - { "nmsserver", { NULL }, 2244, "tcp" }, - { "nmsserver", { NULL }, 2244, "udp" }, - { "hao", { NULL }, 2245, "tcp" }, - { "hao", { NULL }, 2245, "udp" }, - { "pc-mta-addrmap", { NULL }, 2246, "tcp" }, - { "pc-mta-addrmap", { NULL }, 2246, "udp" }, - { "antidotemgrsvr", { NULL }, 2247, "tcp" }, - { "antidotemgrsvr", { NULL }, 2247, "udp" }, - { "ums", { NULL }, 2248, "tcp" }, - { "ums", { NULL }, 2248, "udp" }, - { "rfmp", { NULL }, 2249, "tcp" }, - { "rfmp", { NULL }, 2249, "udp" }, - { "remote-collab", { NULL }, 2250, "tcp" }, - { "remote-collab", { NULL }, 2250, "udp" }, - { "dif-port", { NULL }, 2251, "tcp" }, - { "dif-port", { NULL }, 2251, "udp" }, - { "njenet-ssl", { NULL }, 2252, "tcp" }, - { "njenet-ssl", { NULL }, 2252, "udp" }, - { "dtv-chan-req", { NULL }, 2253, "tcp" }, - { "dtv-chan-req", { NULL }, 2253, "udp" }, - { "seispoc", { NULL }, 2254, "tcp" }, - { "seispoc", { NULL }, 2254, "udp" }, - { "vrtp", { NULL }, 2255, "tcp" }, - { "vrtp", { NULL }, 2255, "udp" }, - { "pcc-mfp", { NULL }, 2256, "tcp" }, - { "pcc-mfp", { NULL }, 2256, "udp" }, - { "simple-tx-rx", { NULL }, 2257, "tcp" }, - { "simple-tx-rx", { NULL }, 2257, "udp" }, - { "rcts", { NULL }, 2258, "tcp" }, - { "rcts", { NULL }, 2258, "udp" }, - { "acd-pm", { NULL }, 2259, "tcp" }, - { "acd-pm", { NULL }, 2259, "udp" }, - { "apc-2260", { NULL }, 2260, "tcp" }, - { "apc-2260", { NULL }, 2260, "udp" }, - { "comotionmaster", { NULL }, 2261, "tcp" }, - { "comotionmaster", { NULL }, 2261, "udp" }, - { "comotionback", { NULL }, 2262, "tcp" }, - { "comotionback", { NULL }, 2262, "udp" }, - { "ecwcfg", { NULL }, 2263, "tcp" }, - { "ecwcfg", { NULL }, 2263, "udp" }, - { "apx500api-1", { NULL }, 2264, "tcp" }, - { "apx500api-1", { NULL }, 2264, "udp" }, - { "apx500api-2", { NULL }, 2265, "tcp" }, - { "apx500api-2", { NULL }, 2265, "udp" }, - { "mfserver", { NULL }, 2266, "tcp" }, - { "mfserver", { NULL }, 2266, "udp" }, - { "ontobroker", { NULL }, 2267, "tcp" }, - { "ontobroker", { NULL }, 2267, "udp" }, - { "amt", { NULL }, 2268, "tcp" }, - { "amt", { NULL }, 2268, "udp" }, - { "mikey", { NULL }, 2269, "tcp" }, - { "mikey", { NULL }, 2269, "udp" }, - { "starschool", { NULL }, 2270, "tcp" }, - { "starschool", { NULL }, 2270, "udp" }, - { "mmcals", { NULL }, 2271, "tcp" }, - { "mmcals", { NULL }, 2271, "udp" }, - { "mmcal", { NULL }, 2272, "tcp" }, - { "mmcal", { NULL }, 2272, "udp" }, - { "mysql-im", { NULL }, 2273, "tcp" }, - { "mysql-im", { NULL }, 2273, "udp" }, - { "pcttunnell", { NULL }, 2274, "tcp" }, - { "pcttunnell", { NULL }, 2274, "udp" }, - { "ibridge-data", { NULL }, 2275, "tcp" }, - { "ibridge-data", { NULL }, 2275, "udp" }, - { "ibridge-mgmt", { NULL }, 2276, "tcp" }, - { "ibridge-mgmt", { NULL }, 2276, "udp" }, - { "bluectrlproxy", { NULL }, 2277, "tcp" }, - { "bluectrlproxy", { NULL }, 2277, "udp" }, - { "s3db", { NULL }, 2278, "tcp" }, - { "s3db", { NULL }, 2278, "udp" }, - { "xmquery", { NULL }, 2279, "tcp" }, - { "xmquery", { NULL }, 2279, "udp" }, - { "lnvpoller", { NULL }, 2280, "tcp" }, - { "lnvpoller", { NULL }, 2280, "udp" }, - { "lnvconsole", { NULL }, 2281, "tcp" }, - { "lnvconsole", { NULL }, 2281, "udp" }, - { "lnvalarm", { NULL }, 2282, "tcp" }, - { "lnvalarm", { NULL }, 2282, "udp" }, - { "lnvstatus", { NULL }, 2283, "tcp" }, - { "lnvstatus", { NULL }, 2283, "udp" }, - { "lnvmaps", { NULL }, 2284, "tcp" }, - { "lnvmaps", { NULL }, 2284, "udp" }, - { "lnvmailmon", { NULL }, 2285, "tcp" }, - { "lnvmailmon", { NULL }, 2285, "udp" }, - { "nas-metering", { NULL }, 2286, "tcp" }, - { "nas-metering", { NULL }, 2286, "udp" }, - { "dna", { NULL }, 2287, "tcp" }, - { "dna", { NULL }, 2287, "udp" }, - { "netml", { NULL }, 2288, "tcp" }, - { "netml", { NULL }, 2288, "udp" }, - { "dict-lookup", { NULL }, 2289, "tcp" }, - { "dict-lookup", { NULL }, 2289, "udp" }, - { "sonus-logging", { NULL }, 2290, "tcp" }, - { "sonus-logging", { NULL }, 2290, "udp" }, - { "eapsp", { NULL }, 2291, "tcp" }, - { "eapsp", { NULL }, 2291, "udp" }, - { "mib-streaming", { NULL }, 2292, "tcp" }, - { "mib-streaming", { NULL }, 2292, "udp" }, - { "npdbgmngr", { NULL }, 2293, "tcp" }, - { "npdbgmngr", { NULL }, 2293, "udp" }, - { "konshus-lm", { NULL }, 2294, "tcp" }, - { "konshus-lm", { NULL }, 2294, "udp" }, - { "advant-lm", { NULL }, 2295, "tcp" }, - { "advant-lm", { NULL }, 2295, "udp" }, - { "theta-lm", { NULL }, 2296, "tcp" }, - { "theta-lm", { NULL }, 2296, "udp" }, - { "d2k-datamover1", { NULL }, 2297, "tcp" }, - { "d2k-datamover1", { NULL }, 2297, "udp" }, - { "d2k-datamover2", { NULL }, 2298, "tcp" }, - { "d2k-datamover2", { NULL }, 2298, "udp" }, - { "pc-telecommute", { NULL }, 2299, "tcp" }, - { "pc-telecommute", { NULL }, 2299, "udp" }, - { "cvmmon", { NULL }, 2300, "tcp" }, - { "cvmmon", { NULL }, 2300, "udp" }, - { "cpq-wbem", { NULL }, 2301, "tcp" }, - { "cpq-wbem", { NULL }, 2301, "udp" }, - { "binderysupport", { NULL }, 2302, "tcp" }, - { "binderysupport", { NULL }, 2302, "udp" }, - { "proxy-gateway", { NULL }, 2303, "tcp" }, - { "proxy-gateway", { NULL }, 2303, "udp" }, - { "attachmate-uts", { NULL }, 2304, "tcp" }, - { "attachmate-uts", { NULL }, 2304, "udp" }, - { "mt-scaleserver", { NULL }, 2305, "tcp" }, - { "mt-scaleserver", { NULL }, 2305, "udp" }, - { "tappi-boxnet", { NULL }, 2306, "tcp" }, - { "tappi-boxnet", { NULL }, 2306, "udp" }, - { "pehelp", { NULL }, 2307, "tcp" }, - { "pehelp", { NULL }, 2307, "udp" }, - { "sdhelp", { NULL }, 2308, "tcp" }, - { "sdhelp", { NULL }, 2308, "udp" }, - { "sdserver", { NULL }, 2309, "tcp" }, - { "sdserver", { NULL }, 2309, "udp" }, - { "sdclient", { NULL }, 2310, "tcp" }, - { "sdclient", { NULL }, 2310, "udp" }, - { "messageservice", { NULL }, 2311, "tcp" }, - { "messageservice", { NULL }, 2311, "udp" }, - { "wanscaler", { NULL }, 2312, "tcp" }, - { "wanscaler", { NULL }, 2312, "udp" }, - { "iapp", { NULL }, 2313, "tcp" }, - { "iapp", { NULL }, 2313, "udp" }, - { "cr-websystems", { NULL }, 2314, "tcp" }, - { "cr-websystems", { NULL }, 2314, "udp" }, - { "precise-sft", { NULL }, 2315, "tcp" }, - { "precise-sft", { NULL }, 2315, "udp" }, - { "sent-lm", { NULL }, 2316, "tcp" }, - { "sent-lm", { NULL }, 2316, "udp" }, - { "attachmate-g32", { NULL }, 2317, "tcp" }, - { "attachmate-g32", { NULL }, 2317, "udp" }, - { "cadencecontrol", { NULL }, 2318, "tcp" }, - { "cadencecontrol", { NULL }, 2318, "udp" }, - { "infolibria", { NULL }, 2319, "tcp" }, - { "infolibria", { NULL }, 2319, "udp" }, - { "siebel-ns", { NULL }, 2320, "tcp" }, - { "siebel-ns", { NULL }, 2320, "udp" }, - { "rdlap", { NULL }, 2321, "tcp" }, - { "rdlap", { NULL }, 2321, "udp" }, - { "ofsd", { NULL }, 2322, "tcp" }, - { "ofsd", { NULL }, 2322, "udp" }, - { "3d-nfsd", { NULL }, 2323, "tcp" }, - { "3d-nfsd", { NULL }, 2323, "udp" }, - { "cosmocall", { NULL }, 2324, "tcp" }, - { "cosmocall", { NULL }, 2324, "udp" }, - { "ansysli", { NULL }, 2325, "tcp" }, - { "ansysli", { NULL }, 2325, "udp" }, - { "idcp", { NULL }, 2326, "tcp" }, - { "idcp", { NULL }, 2326, "udp" }, - { "xingcsm", { NULL }, 2327, "tcp" }, - { "xingcsm", { NULL }, 2327, "udp" }, - { "netrix-sftm", { NULL }, 2328, "tcp" }, - { "netrix-sftm", { NULL }, 2328, "udp" }, - { "nvd", { NULL }, 2329, "tcp" }, - { "nvd", { NULL }, 2329, "udp" }, - { "tscchat", { NULL }, 2330, "tcp" }, - { "tscchat", { NULL }, 2330, "udp" }, - { "agentview", { NULL }, 2331, "tcp" }, - { "agentview", { NULL }, 2331, "udp" }, - { "rcc-host", { NULL }, 2332, "tcp" }, - { "rcc-host", { NULL }, 2332, "udp" }, - { "snapp", { NULL }, 2333, "tcp" }, - { "snapp", { NULL }, 2333, "udp" }, - { "ace-client", { NULL }, 2334, "tcp" }, - { "ace-client", { NULL }, 2334, "udp" }, - { "ace-proxy", { NULL }, 2335, "tcp" }, - { "ace-proxy", { NULL }, 2335, "udp" }, - { "appleugcontrol", { NULL }, 2336, "tcp" }, - { "appleugcontrol", { NULL }, 2336, "udp" }, - { "ideesrv", { NULL }, 2337, "tcp" }, - { "ideesrv", { NULL }, 2337, "udp" }, - { "norton-lambert", { NULL }, 2338, "tcp" }, - { "norton-lambert", { NULL }, 2338, "udp" }, - { "3com-webview", { NULL }, 2339, "tcp" }, - { "3com-webview", { NULL }, 2339, "udp" }, - { "wrs_registry", { NULL }, 2340, "tcp" }, - { "wrs_registry", { NULL }, 2340, "udp" }, - { "xiostatus", { NULL }, 2341, "tcp" }, - { "xiostatus", { NULL }, 2341, "udp" }, - { "manage-exec", { NULL }, 2342, "tcp" }, - { "manage-exec", { NULL }, 2342, "udp" }, - { "nati-logos", { NULL }, 2343, "tcp" }, - { "nati-logos", { NULL }, 2343, "udp" }, - { "fcmsys", { NULL }, 2344, "tcp" }, - { "fcmsys", { NULL }, 2344, "udp" }, - { "dbm", { NULL }, 2345, "tcp" }, - { "dbm", { NULL }, 2345, "udp" }, - { "redstorm_join", { NULL }, 2346, "tcp" }, - { "redstorm_join", { NULL }, 2346, "udp" }, - { "redstorm_find", { NULL }, 2347, "tcp" }, - { "redstorm_find", { NULL }, 2347, "udp" }, - { "redstorm_info", { NULL }, 2348, "tcp" }, - { "redstorm_info", { NULL }, 2348, "udp" }, - { "redstorm_diag", { NULL }, 2349, "tcp" }, - { "redstorm_diag", { NULL }, 2349, "udp" }, - { "psbserver", { NULL }, 2350, "tcp" }, - { "psbserver", { NULL }, 2350, "udp" }, - { "psrserver", { NULL }, 2351, "tcp" }, - { "psrserver", { NULL }, 2351, "udp" }, - { "pslserver", { NULL }, 2352, "tcp" }, - { "pslserver", { NULL }, 2352, "udp" }, - { "pspserver", { NULL }, 2353, "tcp" }, - { "pspserver", { NULL }, 2353, "udp" }, - { "psprserver", { NULL }, 2354, "tcp" }, - { "psprserver", { NULL }, 2354, "udp" }, - { "psdbserver", { NULL }, 2355, "tcp" }, - { "psdbserver", { NULL }, 2355, "udp" }, - { "gxtelmd", { NULL }, 2356, "tcp" }, - { "gxtelmd", { NULL }, 2356, "udp" }, - { "unihub-server", { NULL }, 2357, "tcp" }, - { "unihub-server", { NULL }, 2357, "udp" }, - { "futrix", { NULL }, 2358, "tcp" }, - { "futrix", { NULL }, 2358, "udp" }, - { "flukeserver", { NULL }, 2359, "tcp" }, - { "flukeserver", { NULL }, 2359, "udp" }, - { "nexstorindltd", { NULL }, 2360, "tcp" }, - { "nexstorindltd", { NULL }, 2360, "udp" }, - { "tl1", { NULL }, 2361, "tcp" }, - { "tl1", { NULL }, 2361, "udp" }, - { "digiman", { NULL }, 2362, "tcp" }, - { "digiman", { NULL }, 2362, "udp" }, - { "mediacntrlnfsd", { NULL }, 2363, "tcp" }, - { "mediacntrlnfsd", { NULL }, 2363, "udp" }, - { "oi-2000", { NULL }, 2364, "tcp" }, - { "oi-2000", { NULL }, 2364, "udp" }, - { "dbref", { NULL }, 2365, "tcp" }, - { "dbref", { NULL }, 2365, "udp" }, - { "qip-login", { NULL }, 2366, "tcp" }, - { "qip-login", { NULL }, 2366, "udp" }, - { "service-ctrl", { NULL }, 2367, "tcp" }, - { "service-ctrl", { NULL }, 2367, "udp" }, - { "opentable", { NULL }, 2368, "tcp" }, - { "opentable", { NULL }, 2368, "udp" }, - { "l3-hbmon", { NULL }, 2370, "tcp" }, - { "l3-hbmon", { NULL }, 2370, "udp" }, - { "worldwire", { NULL }, 2371, "tcp" }, - { "worldwire", { NULL }, 2371, "udp" }, - { "lanmessenger", { NULL }, 2372, "tcp" }, - { "lanmessenger", { NULL }, 2372, "udp" }, - { "remographlm", { NULL }, 2373, "tcp" }, - { "hydra", { NULL }, 2374, "tcp" }, - { "compaq-https", { NULL }, 2381, "tcp" }, - { "compaq-https", { NULL }, 2381, "udp" }, - { "ms-olap3", { NULL }, 2382, "tcp" }, - { "ms-olap3", { NULL }, 2382, "udp" }, - { "ms-olap4", { NULL }, 2383, "tcp" }, - { "ms-olap4", { NULL }, 2383, "udp" }, - { "sd-request", { NULL }, 2384, "tcp" }, - { "sd-capacity", { NULL }, 2384, "udp" }, - { "sd-data", { NULL }, 2385, "tcp" }, - { "sd-data", { NULL }, 2385, "udp" }, - { "virtualtape", { NULL }, 2386, "tcp" }, - { "virtualtape", { NULL }, 2386, "udp" }, - { "vsamredirector", { NULL }, 2387, "tcp" }, - { "vsamredirector", { NULL }, 2387, "udp" }, - { "mynahautostart", { NULL }, 2388, "tcp" }, - { "mynahautostart", { NULL }, 2388, "udp" }, - { "ovsessionmgr", { NULL }, 2389, "tcp" }, - { "ovsessionmgr", { NULL }, 2389, "udp" }, - { "rsmtp", { NULL }, 2390, "tcp" }, - { "rsmtp", { NULL }, 2390, "udp" }, - { "3com-net-mgmt", { NULL }, 2391, "tcp" }, - { "3com-net-mgmt", { NULL }, 2391, "udp" }, - { "tacticalauth", { NULL }, 2392, "tcp" }, - { "tacticalauth", { NULL }, 2392, "udp" }, - { "ms-olap1", { NULL }, 2393, "tcp" }, - { "ms-olap1", { NULL }, 2393, "udp" }, - { "ms-olap2", { NULL }, 2394, "tcp" }, - { "ms-olap2", { NULL }, 2394, "udp" }, - { "lan900_remote", { NULL }, 2395, "tcp" }, - { "lan900_remote", { NULL }, 2395, "udp" }, - { "wusage", { NULL }, 2396, "tcp" }, - { "wusage", { NULL }, 2396, "udp" }, - { "ncl", { NULL }, 2397, "tcp" }, - { "ncl", { NULL }, 2397, "udp" }, - { "orbiter", { NULL }, 2398, "tcp" }, - { "orbiter", { NULL }, 2398, "udp" }, - { "fmpro-fdal", { NULL }, 2399, "tcp" }, - { "fmpro-fdal", { NULL }, 2399, "udp" }, - { "opequus-server", { NULL }, 2400, "tcp" }, - { "opequus-server", { NULL }, 2400, "udp" }, - { "cvspserver", { NULL }, 2401, "tcp" }, - { "cvspserver", { NULL }, 2401, "udp" }, - { "taskmaster2000", { NULL }, 2402, "tcp" }, - { "taskmaster2000", { NULL }, 2402, "udp" }, - { "taskmaster2000", { NULL }, 2403, "tcp" }, - { "taskmaster2000", { NULL }, 2403, "udp" }, - { "iec-104", { NULL }, 2404, "tcp" }, - { "iec-104", { NULL }, 2404, "udp" }, - { "trc-netpoll", { NULL }, 2405, "tcp" }, - { "trc-netpoll", { NULL }, 2405, "udp" }, - { "jediserver", { NULL }, 2406, "tcp" }, - { "jediserver", { NULL }, 2406, "udp" }, - { "orion", { NULL }, 2407, "tcp" }, - { "orion", { NULL }, 2407, "udp" }, - { "optimanet", { NULL }, 2408, "tcp" }, - { "optimanet", { NULL }, 2408, "udp" }, - { "sns-protocol", { NULL }, 2409, "tcp" }, - { "sns-protocol", { NULL }, 2409, "udp" }, - { "vrts-registry", { NULL }, 2410, "tcp" }, - { "vrts-registry", { NULL }, 2410, "udp" }, - { "netwave-ap-mgmt", { NULL }, 2411, "tcp" }, - { "netwave-ap-mgmt", { NULL }, 2411, "udp" }, - { "cdn", { NULL }, 2412, "tcp" }, - { "cdn", { NULL }, 2412, "udp" }, - { "orion-rmi-reg", { NULL }, 2413, "tcp" }, - { "orion-rmi-reg", { NULL }, 2413, "udp" }, - { "beeyond", { NULL }, 2414, "tcp" }, - { "beeyond", { NULL }, 2414, "udp" }, - { "codima-rtp", { NULL }, 2415, "tcp" }, - { "codima-rtp", { NULL }, 2415, "udp" }, - { "rmtserver", { NULL }, 2416, "tcp" }, - { "rmtserver", { NULL }, 2416, "udp" }, - { "composit-server", { NULL }, 2417, "tcp" }, - { "composit-server", { NULL }, 2417, "udp" }, - { "cas", { NULL }, 2418, "tcp" }, - { "cas", { NULL }, 2418, "udp" }, - { "attachmate-s2s", { NULL }, 2419, "tcp" }, - { "attachmate-s2s", { NULL }, 2419, "udp" }, - { "dslremote-mgmt", { NULL }, 2420, "tcp" }, - { "dslremote-mgmt", { NULL }, 2420, "udp" }, - { "g-talk", { NULL }, 2421, "tcp" }, - { "g-talk", { NULL }, 2421, "udp" }, - { "crmsbits", { NULL }, 2422, "tcp" }, - { "crmsbits", { NULL }, 2422, "udp" }, - { "rnrp", { NULL }, 2423, "tcp" }, - { "rnrp", { NULL }, 2423, "udp" }, - { "kofax-svr", { NULL }, 2424, "tcp" }, - { "kofax-svr", { NULL }, 2424, "udp" }, - { "fjitsuappmgr", { NULL }, 2425, "tcp" }, - { "fjitsuappmgr", { NULL }, 2425, "udp" }, - { "mgcp-gateway", { NULL }, 2427, "tcp" }, - { "mgcp-gateway", { NULL }, 2427, "udp" }, - { "ott", { NULL }, 2428, "tcp" }, - { "ott", { NULL }, 2428, "udp" }, - { "ft-role", { NULL }, 2429, "tcp" }, - { "ft-role", { NULL }, 2429, "udp" }, - { "venus", { NULL }, 2430, "tcp" }, - { "venus", { NULL }, 2430, "udp" }, - { "venus-se", { NULL }, 2431, "tcp" }, - { "venus-se", { NULL }, 2431, "udp" }, - { "codasrv", { NULL }, 2432, "tcp" }, - { "codasrv", { NULL }, 2432, "udp" }, - { "codasrv-se", { NULL }, 2433, "tcp" }, - { "codasrv-se", { NULL }, 2433, "udp" }, - { "pxc-epmap", { NULL }, 2434, "tcp" }, - { "pxc-epmap", { NULL }, 2434, "udp" }, - { "optilogic", { NULL }, 2435, "tcp" }, - { "optilogic", { NULL }, 2435, "udp" }, - { "topx", { NULL }, 2436, "tcp" }, - { "topx", { NULL }, 2436, "udp" }, - { "unicontrol", { NULL }, 2437, "tcp" }, - { "unicontrol", { NULL }, 2437, "udp" }, - { "msp", { NULL }, 2438, "tcp" }, - { "msp", { NULL }, 2438, "udp" }, - { "sybasedbsynch", { NULL }, 2439, "tcp" }, - { "sybasedbsynch", { NULL }, 2439, "udp" }, - { "spearway", { NULL }, 2440, "tcp" }, - { "spearway", { NULL }, 2440, "udp" }, - { "pvsw-inet", { NULL }, 2441, "tcp" }, - { "pvsw-inet", { NULL }, 2441, "udp" }, - { "netangel", { NULL }, 2442, "tcp" }, - { "netangel", { NULL }, 2442, "udp" }, - { "powerclientcsf", { NULL }, 2443, "tcp" }, - { "powerclientcsf", { NULL }, 2443, "udp" }, - { "btpp2sectrans", { NULL }, 2444, "tcp" }, - { "btpp2sectrans", { NULL }, 2444, "udp" }, - { "dtn1", { NULL }, 2445, "tcp" }, - { "dtn1", { NULL }, 2445, "udp" }, - { "bues_service", { NULL }, 2446, "tcp" }, - { "bues_service", { NULL }, 2446, "udp" }, - { "ovwdb", { NULL }, 2447, "tcp" }, - { "ovwdb", { NULL }, 2447, "udp" }, - { "hpppssvr", { NULL }, 2448, "tcp" }, - { "hpppssvr", { NULL }, 2448, "udp" }, - { "ratl", { NULL }, 2449, "tcp" }, - { "ratl", { NULL }, 2449, "udp" }, - { "netadmin", { NULL }, 2450, "tcp" }, - { "netadmin", { NULL }, 2450, "udp" }, - { "netchat", { NULL }, 2451, "tcp" }, - { "netchat", { NULL }, 2451, "udp" }, - { "snifferclient", { NULL }, 2452, "tcp" }, - { "snifferclient", { NULL }, 2452, "udp" }, - { "madge-ltd", { NULL }, 2453, "tcp" }, - { "madge-ltd", { NULL }, 2453, "udp" }, - { "indx-dds", { NULL }, 2454, "tcp" }, - { "indx-dds", { NULL }, 2454, "udp" }, - { "wago-io-system", { NULL }, 2455, "tcp" }, - { "wago-io-system", { NULL }, 2455, "udp" }, - { "altav-remmgt", { NULL }, 2456, "tcp" }, - { "altav-remmgt", { NULL }, 2456, "udp" }, - { "rapido-ip", { NULL }, 2457, "tcp" }, - { "rapido-ip", { NULL }, 2457, "udp" }, - { "griffin", { NULL }, 2458, "tcp" }, - { "griffin", { NULL }, 2458, "udp" }, - { "community", { NULL }, 2459, "tcp" }, - { "community", { NULL }, 2459, "udp" }, - { "ms-theater", { NULL }, 2460, "tcp" }, - { "ms-theater", { NULL }, 2460, "udp" }, - { "qadmifoper", { NULL }, 2461, "tcp" }, - { "qadmifoper", { NULL }, 2461, "udp" }, - { "qadmifevent", { NULL }, 2462, "tcp" }, - { "qadmifevent", { NULL }, 2462, "udp" }, - { "lsi-raid-mgmt", { NULL }, 2463, "tcp" }, - { "lsi-raid-mgmt", { NULL }, 2463, "udp" }, - { "direcpc-si", { NULL }, 2464, "tcp" }, - { "direcpc-si", { NULL }, 2464, "udp" }, - { "lbm", { NULL }, 2465, "tcp" }, - { "lbm", { NULL }, 2465, "udp" }, - { "lbf", { NULL }, 2466, "tcp" }, - { "lbf", { NULL }, 2466, "udp" }, - { "high-criteria", { NULL }, 2467, "tcp" }, - { "high-criteria", { NULL }, 2467, "udp" }, - { "qip-msgd", { NULL }, 2468, "tcp" }, - { "qip-msgd", { NULL }, 2468, "udp" }, - { "mti-tcs-comm", { NULL }, 2469, "tcp" }, - { "mti-tcs-comm", { NULL }, 2469, "udp" }, - { "taskman-port", { NULL }, 2470, "tcp" }, - { "taskman-port", { NULL }, 2470, "udp" }, - { "seaodbc", { NULL }, 2471, "tcp" }, - { "seaodbc", { NULL }, 2471, "udp" }, - { "c3", { NULL }, 2472, "tcp" }, - { "c3", { NULL }, 2472, "udp" }, - { "aker-cdp", { NULL }, 2473, "tcp" }, - { "aker-cdp", { NULL }, 2473, "udp" }, - { "vitalanalysis", { NULL }, 2474, "tcp" }, - { "vitalanalysis", { NULL }, 2474, "udp" }, - { "ace-server", { NULL }, 2475, "tcp" }, - { "ace-server", { NULL }, 2475, "udp" }, - { "ace-svr-prop", { NULL }, 2476, "tcp" }, - { "ace-svr-prop", { NULL }, 2476, "udp" }, - { "ssm-cvs", { NULL }, 2477, "tcp" }, - { "ssm-cvs", { NULL }, 2477, "udp" }, - { "ssm-cssps", { NULL }, 2478, "tcp" }, - { "ssm-cssps", { NULL }, 2478, "udp" }, - { "ssm-els", { NULL }, 2479, "tcp" }, - { "ssm-els", { NULL }, 2479, "udp" }, - { "powerexchange", { NULL }, 2480, "tcp" }, - { "powerexchange", { NULL }, 2480, "udp" }, - { "giop", { NULL }, 2481, "tcp" }, - { "giop", { NULL }, 2481, "udp" }, - { "giop-ssl", { NULL }, 2482, "tcp" }, - { "giop-ssl", { NULL }, 2482, "udp" }, - { "ttc", { NULL }, 2483, "tcp" }, - { "ttc", { NULL }, 2483, "udp" }, - { "ttc-ssl", { NULL }, 2484, "tcp" }, - { "ttc-ssl", { NULL }, 2484, "udp" }, - { "netobjects1", { NULL }, 2485, "tcp" }, - { "netobjects1", { NULL }, 2485, "udp" }, - { "netobjects2", { NULL }, 2486, "tcp" }, - { "netobjects2", { NULL }, 2486, "udp" }, - { "pns", { NULL }, 2487, "tcp" }, - { "pns", { NULL }, 2487, "udp" }, - { "moy-corp", { NULL }, 2488, "tcp" }, - { "moy-corp", { NULL }, 2488, "udp" }, - { "tsilb", { NULL }, 2489, "tcp" }, - { "tsilb", { NULL }, 2489, "udp" }, - { "qip-qdhcp", { NULL }, 2490, "tcp" }, - { "qip-qdhcp", { NULL }, 2490, "udp" }, - { "conclave-cpp", { NULL }, 2491, "tcp" }, - { "conclave-cpp", { NULL }, 2491, "udp" }, - { "groove", { NULL }, 2492, "tcp" }, - { "groove", { NULL }, 2492, "udp" }, - { "talarian-mqs", { NULL }, 2493, "tcp" }, - { "talarian-mqs", { NULL }, 2493, "udp" }, - { "bmc-ar", { NULL }, 2494, "tcp" }, - { "bmc-ar", { NULL }, 2494, "udp" }, - { "fast-rem-serv", { NULL }, 2495, "tcp" }, - { "fast-rem-serv", { NULL }, 2495, "udp" }, - { "dirgis", { NULL }, 2496, "tcp" }, - { "dirgis", { NULL }, 2496, "udp" }, - { "quaddb", { NULL }, 2497, "tcp" }, - { "quaddb", { NULL }, 2497, "udp" }, - { "odn-castraq", { NULL }, 2498, "tcp" }, - { "odn-castraq", { NULL }, 2498, "udp" }, - { "unicontrol", { NULL }, 2499, "tcp" }, - { "unicontrol", { NULL }, 2499, "udp" }, - { "rtsserv", { NULL }, 2500, "tcp" }, - { "rtsserv", { NULL }, 2500, "udp" }, - { "rtsclient", { NULL }, 2501, "tcp" }, - { "rtsclient", { NULL }, 2501, "udp" }, - { "kentrox-prot", { NULL }, 2502, "tcp" }, - { "kentrox-prot", { NULL }, 2502, "udp" }, - { "nms-dpnss", { NULL }, 2503, "tcp" }, - { "nms-dpnss", { NULL }, 2503, "udp" }, - { "wlbs", { NULL }, 2504, "tcp" }, - { "wlbs", { NULL }, 2504, "udp" }, - { "ppcontrol", { NULL }, 2505, "tcp" }, - { "ppcontrol", { NULL }, 2505, "udp" }, - { "jbroker", { NULL }, 2506, "tcp" }, - { "jbroker", { NULL }, 2506, "udp" }, - { "spock", { NULL }, 2507, "tcp" }, - { "spock", { NULL }, 2507, "udp" }, - { "jdatastore", { NULL }, 2508, "tcp" }, - { "jdatastore", { NULL }, 2508, "udp" }, - { "fjmpss", { NULL }, 2509, "tcp" }, - { "fjmpss", { NULL }, 2509, "udp" }, - { "fjappmgrbulk", { NULL }, 2510, "tcp" }, - { "fjappmgrbulk", { NULL }, 2510, "udp" }, - { "metastorm", { NULL }, 2511, "tcp" }, - { "metastorm", { NULL }, 2511, "udp" }, - { "citrixima", { NULL }, 2512, "tcp" }, - { "citrixima", { NULL }, 2512, "udp" }, - { "citrixadmin", { NULL }, 2513, "tcp" }, - { "citrixadmin", { NULL }, 2513, "udp" }, - { "facsys-ntp", { NULL }, 2514, "tcp" }, - { "facsys-ntp", { NULL }, 2514, "udp" }, - { "facsys-router", { NULL }, 2515, "tcp" }, - { "facsys-router", { NULL }, 2515, "udp" }, - { "maincontrol", { NULL }, 2516, "tcp" }, - { "maincontrol", { NULL }, 2516, "udp" }, - { "call-sig-trans", { NULL }, 2517, "tcp" }, - { "call-sig-trans", { NULL }, 2517, "udp" }, - { "willy", { NULL }, 2518, "tcp" }, - { "willy", { NULL }, 2518, "udp" }, - { "globmsgsvc", { NULL }, 2519, "tcp" }, - { "globmsgsvc", { NULL }, 2519, "udp" }, - { "pvsw", { NULL }, 2520, "tcp" }, - { "pvsw", { NULL }, 2520, "udp" }, - { "adaptecmgr", { NULL }, 2521, "tcp" }, - { "adaptecmgr", { NULL }, 2521, "udp" }, - { "windb", { NULL }, 2522, "tcp" }, - { "windb", { NULL }, 2522, "udp" }, - { "qke-llc-v3", { NULL }, 2523, "tcp" }, - { "qke-llc-v3", { NULL }, 2523, "udp" }, - { "optiwave-lm", { NULL }, 2524, "tcp" }, - { "optiwave-lm", { NULL }, 2524, "udp" }, - { "ms-v-worlds", { NULL }, 2525, "tcp" }, - { "ms-v-worlds", { NULL }, 2525, "udp" }, - { "ema-sent-lm", { NULL }, 2526, "tcp" }, - { "ema-sent-lm", { NULL }, 2526, "udp" }, - { "iqserver", { NULL }, 2527, "tcp" }, - { "iqserver", { NULL }, 2527, "udp" }, - { "ncr_ccl", { NULL }, 2528, "tcp" }, - { "ncr_ccl", { NULL }, 2528, "udp" }, - { "utsftp", { NULL }, 2529, "tcp" }, - { "utsftp", { NULL }, 2529, "udp" }, - { "vrcommerce", { NULL }, 2530, "tcp" }, - { "vrcommerce", { NULL }, 2530, "udp" }, - { "ito-e-gui", { NULL }, 2531, "tcp" }, - { "ito-e-gui", { NULL }, 2531, "udp" }, - { "ovtopmd", { NULL }, 2532, "tcp" }, - { "ovtopmd", { NULL }, 2532, "udp" }, - { "snifferserver", { NULL }, 2533, "tcp" }, - { "snifferserver", { NULL }, 2533, "udp" }, - { "combox-web-acc", { NULL }, 2534, "tcp" }, - { "combox-web-acc", { NULL }, 2534, "udp" }, - { "madcap", { NULL }, 2535, "tcp" }, - { "madcap", { NULL }, 2535, "udp" }, - { "btpp2audctr1", { NULL }, 2536, "tcp" }, - { "btpp2audctr1", { NULL }, 2536, "udp" }, - { "upgrade", { NULL }, 2537, "tcp" }, - { "upgrade", { NULL }, 2537, "udp" }, - { "vnwk-prapi", { NULL }, 2538, "tcp" }, - { "vnwk-prapi", { NULL }, 2538, "udp" }, - { "vsiadmin", { NULL }, 2539, "tcp" }, - { "vsiadmin", { NULL }, 2539, "udp" }, - { "lonworks", { NULL }, 2540, "tcp" }, - { "lonworks", { NULL }, 2540, "udp" }, - { "lonworks2", { NULL }, 2541, "tcp" }, - { "lonworks2", { NULL }, 2541, "udp" }, - { "udrawgraph", { NULL }, 2542, "tcp" }, - { "udrawgraph", { NULL }, 2542, "udp" }, - { "reftek", { NULL }, 2543, "tcp" }, - { "reftek", { NULL }, 2543, "udp" }, - { "novell-zen", { NULL }, 2544, "tcp" }, - { "novell-zen", { NULL }, 2544, "udp" }, - { "sis-emt", { NULL }, 2545, "tcp" }, - { "sis-emt", { NULL }, 2545, "udp" }, - { "vytalvaultbrtp", { NULL }, 2546, "tcp" }, - { "vytalvaultbrtp", { NULL }, 2546, "udp" }, - { "vytalvaultvsmp", { NULL }, 2547, "tcp" }, - { "vytalvaultvsmp", { NULL }, 2547, "udp" }, - { "vytalvaultpipe", { NULL }, 2548, "tcp" }, - { "vytalvaultpipe", { NULL }, 2548, "udp" }, - { "ipass", { NULL }, 2549, "tcp" }, - { "ipass", { NULL }, 2549, "udp" }, - { "ads", { NULL }, 2550, "tcp" }, - { "ads", { NULL }, 2550, "udp" }, - { "isg-uda-server", { NULL }, 2551, "tcp" }, - { "isg-uda-server", { NULL }, 2551, "udp" }, - { "call-logging", { NULL }, 2552, "tcp" }, - { "call-logging", { NULL }, 2552, "udp" }, - { "efidiningport", { NULL }, 2553, "tcp" }, - { "efidiningport", { NULL }, 2553, "udp" }, - { "vcnet-link-v10", { NULL }, 2554, "tcp" }, - { "vcnet-link-v10", { NULL }, 2554, "udp" }, - { "compaq-wcp", { NULL }, 2555, "tcp" }, - { "compaq-wcp", { NULL }, 2555, "udp" }, - { "nicetec-nmsvc", { NULL }, 2556, "tcp" }, - { "nicetec-nmsvc", { NULL }, 2556, "udp" }, - { "nicetec-mgmt", { NULL }, 2557, "tcp" }, - { "nicetec-mgmt", { NULL }, 2557, "udp" }, - { "pclemultimedia", { NULL }, 2558, "tcp" }, - { "pclemultimedia", { NULL }, 2558, "udp" }, - { "lstp", { NULL }, 2559, "tcp" }, - { "lstp", { NULL }, 2559, "udp" }, - { "labrat", { NULL }, 2560, "tcp" }, - { "labrat", { NULL }, 2560, "udp" }, - { "mosaixcc", { NULL }, 2561, "tcp" }, - { "mosaixcc", { NULL }, 2561, "udp" }, - { "delibo", { NULL }, 2562, "tcp" }, - { "delibo", { NULL }, 2562, "udp" }, - { "cti-redwood", { NULL }, 2563, "tcp" }, - { "cti-redwood", { NULL }, 2563, "udp" }, - { "hp-3000-telnet", { NULL }, 2564, "tcp" }, - { "coord-svr", { NULL }, 2565, "tcp" }, - { "coord-svr", { NULL }, 2565, "udp" }, - { "pcs-pcw", { NULL }, 2566, "tcp" }, - { "pcs-pcw", { NULL }, 2566, "udp" }, - { "clp", { NULL }, 2567, "tcp" }, - { "clp", { NULL }, 2567, "udp" }, - { "spamtrap", { NULL }, 2568, "tcp" }, - { "spamtrap", { NULL }, 2568, "udp" }, - { "sonuscallsig", { NULL }, 2569, "tcp" }, - { "sonuscallsig", { NULL }, 2569, "udp" }, - { "hs-port", { NULL }, 2570, "tcp" }, - { "hs-port", { NULL }, 2570, "udp" }, - { "cecsvc", { NULL }, 2571, "tcp" }, - { "cecsvc", { NULL }, 2571, "udp" }, - { "ibp", { NULL }, 2572, "tcp" }, - { "ibp", { NULL }, 2572, "udp" }, - { "trustestablish", { NULL }, 2573, "tcp" }, - { "trustestablish", { NULL }, 2573, "udp" }, - { "blockade-bpsp", { NULL }, 2574, "tcp" }, - { "blockade-bpsp", { NULL }, 2574, "udp" }, - { "hl7", { NULL }, 2575, "tcp" }, - { "hl7", { NULL }, 2575, "udp" }, - { "tclprodebugger", { NULL }, 2576, "tcp" }, - { "tclprodebugger", { NULL }, 2576, "udp" }, - { "scipticslsrvr", { NULL }, 2577, "tcp" }, - { "scipticslsrvr", { NULL }, 2577, "udp" }, - { "rvs-isdn-dcp", { NULL }, 2578, "tcp" }, - { "rvs-isdn-dcp", { NULL }, 2578, "udp" }, - { "mpfoncl", { NULL }, 2579, "tcp" }, - { "mpfoncl", { NULL }, 2579, "udp" }, - { "tributary", { NULL }, 2580, "tcp" }, - { "tributary", { NULL }, 2580, "udp" }, - { "argis-te", { NULL }, 2581, "tcp" }, - { "argis-te", { NULL }, 2581, "udp" }, - { "argis-ds", { NULL }, 2582, "tcp" }, - { "argis-ds", { NULL }, 2582, "udp" }, - { "mon", { NULL }, 2583, "tcp" }, - { "mon", { NULL }, 2583, "udp" }, - { "cyaserv", { NULL }, 2584, "tcp" }, - { "cyaserv", { NULL }, 2584, "udp" }, - { "netx-server", { NULL }, 2585, "tcp" }, - { "netx-server", { NULL }, 2585, "udp" }, - { "netx-agent", { NULL }, 2586, "tcp" }, - { "netx-agent", { NULL }, 2586, "udp" }, - { "masc", { NULL }, 2587, "tcp" }, - { "masc", { NULL }, 2587, "udp" }, - { "privilege", { NULL }, 2588, "tcp" }, - { "privilege", { NULL }, 2588, "udp" }, - { "quartus-tcl", { NULL }, 2589, "tcp" }, - { "quartus-tcl", { NULL }, 2589, "udp" }, - { "idotdist", { NULL }, 2590, "tcp" }, - { "idotdist", { NULL }, 2590, "udp" }, - { "maytagshuffle", { NULL }, 2591, "tcp" }, - { "maytagshuffle", { NULL }, 2591, "udp" }, - { "netrek", { NULL }, 2592, "tcp" }, - { "netrek", { NULL }, 2592, "udp" }, - { "mns-mail", { NULL }, 2593, "tcp" }, - { "mns-mail", { NULL }, 2593, "udp" }, - { "dts", { NULL }, 2594, "tcp" }, - { "dts", { NULL }, 2594, "udp" }, - { "worldfusion1", { NULL }, 2595, "tcp" }, - { "worldfusion1", { NULL }, 2595, "udp" }, - { "worldfusion2", { NULL }, 2596, "tcp" }, - { "worldfusion2", { NULL }, 2596, "udp" }, - { "homesteadglory", { NULL }, 2597, "tcp" }, - { "homesteadglory", { NULL }, 2597, "udp" }, - { "citriximaclient", { NULL }, 2598, "tcp" }, - { "citriximaclient", { NULL }, 2598, "udp" }, - { "snapd", { NULL }, 2599, "tcp" }, - { "snapd", { NULL }, 2599, "udp" }, - { "hpstgmgr", { NULL }, 2600, "tcp" }, - { "hpstgmgr", { NULL }, 2600, "udp" }, - { "discp-client", { NULL }, 2601, "tcp" }, - { "discp-client", { NULL }, 2601, "udp" }, - { "discp-server", { NULL }, 2602, "tcp" }, - { "discp-server", { NULL }, 2602, "udp" }, - { "servicemeter", { NULL }, 2603, "tcp" }, - { "servicemeter", { NULL }, 2603, "udp" }, - { "nsc-ccs", { NULL }, 2604, "tcp" }, - { "nsc-ccs", { NULL }, 2604, "udp" }, - { "nsc-posa", { NULL }, 2605, "tcp" }, - { "nsc-posa", { NULL }, 2605, "udp" }, - { "netmon", { NULL }, 2606, "tcp" }, - { "netmon", { NULL }, 2606, "udp" }, - { "connection", { NULL }, 2607, "tcp" }, - { "connection", { NULL }, 2607, "udp" }, - { "wag-service", { NULL }, 2608, "tcp" }, - { "wag-service", { NULL }, 2608, "udp" }, - { "system-monitor", { NULL }, 2609, "tcp" }, - { "system-monitor", { NULL }, 2609, "udp" }, - { "versa-tek", { NULL }, 2610, "tcp" }, - { "versa-tek", { NULL }, 2610, "udp" }, - { "lionhead", { NULL }, 2611, "tcp" }, - { "lionhead", { NULL }, 2611, "udp" }, - { "qpasa-agent", { NULL }, 2612, "tcp" }, - { "qpasa-agent", { NULL }, 2612, "udp" }, - { "smntubootstrap", { NULL }, 2613, "tcp" }, - { "smntubootstrap", { NULL }, 2613, "udp" }, - { "neveroffline", { NULL }, 2614, "tcp" }, - { "neveroffline", { NULL }, 2614, "udp" }, - { "firepower", { NULL }, 2615, "tcp" }, - { "firepower", { NULL }, 2615, "udp" }, - { "appswitch-emp", { NULL }, 2616, "tcp" }, - { "appswitch-emp", { NULL }, 2616, "udp" }, - { "cmadmin", { NULL }, 2617, "tcp" }, - { "cmadmin", { NULL }, 2617, "udp" }, - { "priority-e-com", { NULL }, 2618, "tcp" }, - { "priority-e-com", { NULL }, 2618, "udp" }, - { "bruce", { NULL }, 2619, "tcp" }, - { "bruce", { NULL }, 2619, "udp" }, - { "lpsrecommender", { NULL }, 2620, "tcp" }, - { "lpsrecommender", { NULL }, 2620, "udp" }, - { "miles-apart", { NULL }, 2621, "tcp" }, - { "miles-apart", { NULL }, 2621, "udp" }, - { "metricadbc", { NULL }, 2622, "tcp" }, - { "metricadbc", { NULL }, 2622, "udp" }, - { "lmdp", { NULL }, 2623, "tcp" }, - { "lmdp", { NULL }, 2623, "udp" }, - { "aria", { NULL }, 2624, "tcp" }, - { "aria", { NULL }, 2624, "udp" }, - { "blwnkl-port", { NULL }, 2625, "tcp" }, - { "blwnkl-port", { NULL }, 2625, "udp" }, - { "gbjd816", { NULL }, 2626, "tcp" }, - { "gbjd816", { NULL }, 2626, "udp" }, - { "moshebeeri", { NULL }, 2627, "tcp" }, - { "moshebeeri", { NULL }, 2627, "udp" }, - { "dict", { NULL }, 2628, "tcp" }, - { "dict", { NULL }, 2628, "udp" }, - { "sitaraserver", { NULL }, 2629, "tcp" }, - { "sitaraserver", { NULL }, 2629, "udp" }, - { "sitaramgmt", { NULL }, 2630, "tcp" }, - { "sitaramgmt", { NULL }, 2630, "udp" }, - { "sitaradir", { NULL }, 2631, "tcp" }, - { "sitaradir", { NULL }, 2631, "udp" }, - { "irdg-post", { NULL }, 2632, "tcp" }, - { "irdg-post", { NULL }, 2632, "udp" }, - { "interintelli", { NULL }, 2633, "tcp" }, - { "interintelli", { NULL }, 2633, "udp" }, - { "pk-electronics", { NULL }, 2634, "tcp" }, - { "pk-electronics", { NULL }, 2634, "udp" }, - { "backburner", { NULL }, 2635, "tcp" }, - { "backburner", { NULL }, 2635, "udp" }, - { "solve", { NULL }, 2636, "tcp" }, - { "solve", { NULL }, 2636, "udp" }, - { "imdocsvc", { NULL }, 2637, "tcp" }, - { "imdocsvc", { NULL }, 2637, "udp" }, - { "sybaseanywhere", { NULL }, 2638, "tcp" }, - { "sybaseanywhere", { NULL }, 2638, "udp" }, - { "aminet", { NULL }, 2639, "tcp" }, - { "aminet", { NULL }, 2639, "udp" }, - { "sai_sentlm", { NULL }, 2640, "tcp" }, - { "sai_sentlm", { NULL }, 2640, "udp" }, - { "hdl-srv", { NULL }, 2641, "tcp" }, - { "hdl-srv", { NULL }, 2641, "udp" }, - { "tragic", { NULL }, 2642, "tcp" }, - { "tragic", { NULL }, 2642, "udp" }, - { "gte-samp", { NULL }, 2643, "tcp" }, - { "gte-samp", { NULL }, 2643, "udp" }, - { "travsoft-ipx-t", { NULL }, 2644, "tcp" }, - { "travsoft-ipx-t", { NULL }, 2644, "udp" }, - { "novell-ipx-cmd", { NULL }, 2645, "tcp" }, - { "novell-ipx-cmd", { NULL }, 2645, "udp" }, - { "and-lm", { NULL }, 2646, "tcp" }, - { "and-lm", { NULL }, 2646, "udp" }, - { "syncserver", { NULL }, 2647, "tcp" }, - { "syncserver", { NULL }, 2647, "udp" }, - { "upsnotifyprot", { NULL }, 2648, "tcp" }, - { "upsnotifyprot", { NULL }, 2648, "udp" }, - { "vpsipport", { NULL }, 2649, "tcp" }, - { "vpsipport", { NULL }, 2649, "udp" }, - { "eristwoguns", { NULL }, 2650, "tcp" }, - { "eristwoguns", { NULL }, 2650, "udp" }, - { "ebinsite", { NULL }, 2651, "tcp" }, - { "ebinsite", { NULL }, 2651, "udp" }, - { "interpathpanel", { NULL }, 2652, "tcp" }, - { "interpathpanel", { NULL }, 2652, "udp" }, - { "sonus", { NULL }, 2653, "tcp" }, - { "sonus", { NULL }, 2653, "udp" }, - { "corel_vncadmin", { NULL }, 2654, "tcp" }, - { "corel_vncadmin", { NULL }, 2654, "udp" }, - { "unglue", { NULL }, 2655, "tcp" }, - { "unglue", { NULL }, 2655, "udp" }, - { "kana", { NULL }, 2656, "tcp" }, - { "kana", { NULL }, 2656, "udp" }, - { "sns-dispatcher", { NULL }, 2657, "tcp" }, - { "sns-dispatcher", { NULL }, 2657, "udp" }, - { "sns-admin", { NULL }, 2658, "tcp" }, - { "sns-admin", { NULL }, 2658, "udp" }, - { "sns-query", { NULL }, 2659, "tcp" }, - { "sns-query", { NULL }, 2659, "udp" }, - { "gcmonitor", { NULL }, 2660, "tcp" }, - { "gcmonitor", { NULL }, 2660, "udp" }, - { "olhost", { NULL }, 2661, "tcp" }, - { "olhost", { NULL }, 2661, "udp" }, - { "bintec-capi", { NULL }, 2662, "tcp" }, - { "bintec-capi", { NULL }, 2662, "udp" }, - { "bintec-tapi", { NULL }, 2663, "tcp" }, - { "bintec-tapi", { NULL }, 2663, "udp" }, - { "patrol-mq-gm", { NULL }, 2664, "tcp" }, - { "patrol-mq-gm", { NULL }, 2664, "udp" }, - { "patrol-mq-nm", { NULL }, 2665, "tcp" }, - { "patrol-mq-nm", { NULL }, 2665, "udp" }, - { "extensis", { NULL }, 2666, "tcp" }, - { "extensis", { NULL }, 2666, "udp" }, - { "alarm-clock-s", { NULL }, 2667, "tcp" }, - { "alarm-clock-s", { NULL }, 2667, "udp" }, - { "alarm-clock-c", { NULL }, 2668, "tcp" }, - { "alarm-clock-c", { NULL }, 2668, "udp" }, - { "toad", { NULL }, 2669, "tcp" }, - { "toad", { NULL }, 2669, "udp" }, - { "tve-announce", { NULL }, 2670, "tcp" }, - { "tve-announce", { NULL }, 2670, "udp" }, - { "newlixreg", { NULL }, 2671, "tcp" }, - { "newlixreg", { NULL }, 2671, "udp" }, - { "nhserver", { NULL }, 2672, "tcp" }, - { "nhserver", { NULL }, 2672, "udp" }, - { "firstcall42", { NULL }, 2673, "tcp" }, - { "firstcall42", { NULL }, 2673, "udp" }, - { "ewnn", { NULL }, 2674, "tcp" }, - { "ewnn", { NULL }, 2674, "udp" }, - { "ttc-etap", { NULL }, 2675, "tcp" }, - { "ttc-etap", { NULL }, 2675, "udp" }, - { "simslink", { NULL }, 2676, "tcp" }, - { "simslink", { NULL }, 2676, "udp" }, - { "gadgetgate1way", { NULL }, 2677, "tcp" }, - { "gadgetgate1way", { NULL }, 2677, "udp" }, - { "gadgetgate2way", { NULL }, 2678, "tcp" }, - { "gadgetgate2way", { NULL }, 2678, "udp" }, - { "syncserverssl", { NULL }, 2679, "tcp" }, - { "syncserverssl", { NULL }, 2679, "udp" }, - { "pxc-sapxom", { NULL }, 2680, "tcp" }, - { "pxc-sapxom", { NULL }, 2680, "udp" }, - { "mpnjsomb", { NULL }, 2681, "tcp" }, - { "mpnjsomb", { NULL }, 2681, "udp" }, - { "ncdloadbalance", { NULL }, 2683, "tcp" }, - { "ncdloadbalance", { NULL }, 2683, "udp" }, - { "mpnjsosv", { NULL }, 2684, "tcp" }, - { "mpnjsosv", { NULL }, 2684, "udp" }, - { "mpnjsocl", { NULL }, 2685, "tcp" }, - { "mpnjsocl", { NULL }, 2685, "udp" }, - { "mpnjsomg", { NULL }, 2686, "tcp" }, - { "mpnjsomg", { NULL }, 2686, "udp" }, - { "pq-lic-mgmt", { NULL }, 2687, "tcp" }, - { "pq-lic-mgmt", { NULL }, 2687, "udp" }, - { "md-cg-http", { NULL }, 2688, "tcp" }, - { "md-cg-http", { NULL }, 2688, "udp" }, - { "fastlynx", { NULL }, 2689, "tcp" }, - { "fastlynx", { NULL }, 2689, "udp" }, - { "hp-nnm-data", { NULL }, 2690, "tcp" }, - { "hp-nnm-data", { NULL }, 2690, "udp" }, - { "itinternet", { NULL }, 2691, "tcp" }, - { "itinternet", { NULL }, 2691, "udp" }, - { "admins-lms", { NULL }, 2692, "tcp" }, - { "admins-lms", { NULL }, 2692, "udp" }, - { "pwrsevent", { NULL }, 2694, "tcp" }, - { "pwrsevent", { NULL }, 2694, "udp" }, - { "vspread", { NULL }, 2695, "tcp" }, - { "vspread", { NULL }, 2695, "udp" }, - { "unifyadmin", { NULL }, 2696, "tcp" }, - { "unifyadmin", { NULL }, 2696, "udp" }, - { "oce-snmp-trap", { NULL }, 2697, "tcp" }, - { "oce-snmp-trap", { NULL }, 2697, "udp" }, - { "mck-ivpip", { NULL }, 2698, "tcp" }, - { "mck-ivpip", { NULL }, 2698, "udp" }, - { "csoft-plusclnt", { NULL }, 2699, "tcp" }, - { "csoft-plusclnt", { NULL }, 2699, "udp" }, - { "tqdata", { NULL }, 2700, "tcp" }, - { "tqdata", { NULL }, 2700, "udp" }, - { "sms-rcinfo", { NULL }, 2701, "tcp" }, - { "sms-rcinfo", { NULL }, 2701, "udp" }, - { "sms-xfer", { NULL }, 2702, "tcp" }, - { "sms-xfer", { NULL }, 2702, "udp" }, - { "sms-chat", { NULL }, 2703, "tcp" }, - { "sms-chat", { NULL }, 2703, "udp" }, - { "sms-remctrl", { NULL }, 2704, "tcp" }, - { "sms-remctrl", { NULL }, 2704, "udp" }, - { "sds-admin", { NULL }, 2705, "tcp" }, - { "sds-admin", { NULL }, 2705, "udp" }, - { "ncdmirroring", { NULL }, 2706, "tcp" }, - { "ncdmirroring", { NULL }, 2706, "udp" }, - { "emcsymapiport", { NULL }, 2707, "tcp" }, - { "emcsymapiport", { NULL }, 2707, "udp" }, - { "banyan-net", { NULL }, 2708, "tcp" }, - { "banyan-net", { NULL }, 2708, "udp" }, - { "supermon", { NULL }, 2709, "tcp" }, - { "supermon", { NULL }, 2709, "udp" }, - { "sso-service", { NULL }, 2710, "tcp" }, - { "sso-service", { NULL }, 2710, "udp" }, - { "sso-control", { NULL }, 2711, "tcp" }, - { "sso-control", { NULL }, 2711, "udp" }, - { "aocp", { NULL }, 2712, "tcp" }, - { "aocp", { NULL }, 2712, "udp" }, - { "raventbs", { NULL }, 2713, "tcp" }, - { "raventbs", { NULL }, 2713, "udp" }, - { "raventdm", { NULL }, 2714, "tcp" }, - { "raventdm", { NULL }, 2714, "udp" }, - { "hpstgmgr2", { NULL }, 2715, "tcp" }, - { "hpstgmgr2", { NULL }, 2715, "udp" }, - { "inova-ip-disco", { NULL }, 2716, "tcp" }, - { "inova-ip-disco", { NULL }, 2716, "udp" }, - { "pn-requester", { NULL }, 2717, "tcp" }, - { "pn-requester", { NULL }, 2717, "udp" }, - { "pn-requester2", { NULL }, 2718, "tcp" }, - { "pn-requester2", { NULL }, 2718, "udp" }, - { "scan-change", { NULL }, 2719, "tcp" }, - { "scan-change", { NULL }, 2719, "udp" }, - { "wkars", { NULL }, 2720, "tcp" }, - { "wkars", { NULL }, 2720, "udp" }, - { "smart-diagnose", { NULL }, 2721, "tcp" }, - { "smart-diagnose", { NULL }, 2721, "udp" }, - { "proactivesrvr", { NULL }, 2722, "tcp" }, - { "proactivesrvr", { NULL }, 2722, "udp" }, - { "watchdog-nt", { NULL }, 2723, "tcp" }, - { "watchdog-nt", { NULL }, 2723, "udp" }, - { "qotps", { NULL }, 2724, "tcp" }, - { "qotps", { NULL }, 2724, "udp" }, - { "msolap-ptp2", { NULL }, 2725, "tcp" }, - { "msolap-ptp2", { NULL }, 2725, "udp" }, - { "tams", { NULL }, 2726, "tcp" }, - { "tams", { NULL }, 2726, "udp" }, - { "mgcp-callagent", { NULL }, 2727, "tcp" }, - { "mgcp-callagent", { NULL }, 2727, "udp" }, - { "sqdr", { NULL }, 2728, "tcp" }, - { "sqdr", { NULL }, 2728, "udp" }, - { "tcim-control", { NULL }, 2729, "tcp" }, - { "tcim-control", { NULL }, 2729, "udp" }, - { "nec-raidplus", { NULL }, 2730, "tcp" }, - { "nec-raidplus", { NULL }, 2730, "udp" }, - { "fyre-messanger", { NULL }, 2731, "tcp" }, - { "fyre-messanger", { NULL }, 2731, "udp" }, - { "g5m", { NULL }, 2732, "tcp" }, - { "g5m", { NULL }, 2732, "udp" }, - { "signet-ctf", { NULL }, 2733, "tcp" }, - { "signet-ctf", { NULL }, 2733, "udp" }, - { "ccs-software", { NULL }, 2734, "tcp" }, - { "ccs-software", { NULL }, 2734, "udp" }, - { "netiq-mc", { NULL }, 2735, "tcp" }, - { "netiq-mc", { NULL }, 2735, "udp" }, - { "radwiz-nms-srv", { NULL }, 2736, "tcp" }, - { "radwiz-nms-srv", { NULL }, 2736, "udp" }, - { "srp-feedback", { NULL }, 2737, "tcp" }, - { "srp-feedback", { NULL }, 2737, "udp" }, - { "ndl-tcp-ois-gw", { NULL }, 2738, "tcp" }, - { "ndl-tcp-ois-gw", { NULL }, 2738, "udp" }, - { "tn-timing", { NULL }, 2739, "tcp" }, - { "tn-timing", { NULL }, 2739, "udp" }, - { "alarm", { NULL }, 2740, "tcp" }, - { "alarm", { NULL }, 2740, "udp" }, - { "tsb", { NULL }, 2741, "tcp" }, - { "tsb", { NULL }, 2741, "udp" }, - { "tsb2", { NULL }, 2742, "tcp" }, - { "tsb2", { NULL }, 2742, "udp" }, - { "murx", { NULL }, 2743, "tcp" }, - { "murx", { NULL }, 2743, "udp" }, - { "honyaku", { NULL }, 2744, "tcp" }, - { "honyaku", { NULL }, 2744, "udp" }, - { "urbisnet", { NULL }, 2745, "tcp" }, - { "urbisnet", { NULL }, 2745, "udp" }, - { "cpudpencap", { NULL }, 2746, "tcp" }, - { "cpudpencap", { NULL }, 2746, "udp" }, - { "fjippol-swrly", { NULL }, 2747, "tcp" }, - { "fjippol-swrly", { NULL }, 2747, "udp" }, - { "fjippol-polsvr", { NULL }, 2748, "tcp" }, - { "fjippol-polsvr", { NULL }, 2748, "udp" }, - { "fjippol-cnsl", { NULL }, 2749, "tcp" }, - { "fjippol-cnsl", { NULL }, 2749, "udp" }, - { "fjippol-port1", { NULL }, 2750, "tcp" }, - { "fjippol-port1", { NULL }, 2750, "udp" }, - { "fjippol-port2", { NULL }, 2751, "tcp" }, - { "fjippol-port2", { NULL }, 2751, "udp" }, - { "rsisysaccess", { NULL }, 2752, "tcp" }, - { "rsisysaccess", { NULL }, 2752, "udp" }, - { "de-spot", { NULL }, 2753, "tcp" }, - { "de-spot", { NULL }, 2753, "udp" }, - { "apollo-cc", { NULL }, 2754, "tcp" }, - { "apollo-cc", { NULL }, 2754, "udp" }, - { "expresspay", { NULL }, 2755, "tcp" }, - { "expresspay", { NULL }, 2755, "udp" }, - { "simplement-tie", { NULL }, 2756, "tcp" }, - { "simplement-tie", { NULL }, 2756, "udp" }, - { "cnrp", { NULL }, 2757, "tcp" }, - { "cnrp", { NULL }, 2757, "udp" }, - { "apollo-status", { NULL }, 2758, "tcp" }, - { "apollo-status", { NULL }, 2758, "udp" }, - { "apollo-gms", { NULL }, 2759, "tcp" }, - { "apollo-gms", { NULL }, 2759, "udp" }, - { "sabams", { NULL }, 2760, "tcp" }, - { "sabams", { NULL }, 2760, "udp" }, - { "dicom-iscl", { NULL }, 2761, "tcp" }, - { "dicom-iscl", { NULL }, 2761, "udp" }, - { "dicom-tls", { NULL }, 2762, "tcp" }, - { "dicom-tls", { NULL }, 2762, "udp" }, - { "desktop-dna", { NULL }, 2763, "tcp" }, - { "desktop-dna", { NULL }, 2763, "udp" }, - { "data-insurance", { NULL }, 2764, "tcp" }, - { "data-insurance", { NULL }, 2764, "udp" }, - { "qip-audup", { NULL }, 2765, "tcp" }, - { "qip-audup", { NULL }, 2765, "udp" }, - { "compaq-scp", { NULL }, 2766, "tcp" }, - { "compaq-scp", { NULL }, 2766, "udp" }, - { "uadtc", { NULL }, 2767, "tcp" }, - { "uadtc", { NULL }, 2767, "udp" }, - { "uacs", { NULL }, 2768, "tcp" }, - { "uacs", { NULL }, 2768, "udp" }, - { "exce", { NULL }, 2769, "tcp" }, - { "exce", { NULL }, 2769, "udp" }, - { "veronica", { NULL }, 2770, "tcp" }, - { "veronica", { NULL }, 2770, "udp" }, - { "vergencecm", { NULL }, 2771, "tcp" }, - { "vergencecm", { NULL }, 2771, "udp" }, - { "auris", { NULL }, 2772, "tcp" }, - { "auris", { NULL }, 2772, "udp" }, - { "rbakcup1", { NULL }, 2773, "tcp" }, - { "rbakcup1", { NULL }, 2773, "udp" }, - { "rbakcup2", { NULL }, 2774, "tcp" }, - { "rbakcup2", { NULL }, 2774, "udp" }, - { "smpp", { NULL }, 2775, "tcp" }, - { "smpp", { NULL }, 2775, "udp" }, - { "ridgeway1", { NULL }, 2776, "tcp" }, - { "ridgeway1", { NULL }, 2776, "udp" }, - { "ridgeway2", { NULL }, 2777, "tcp" }, - { "ridgeway2", { NULL }, 2777, "udp" }, - { "gwen-sonya", { NULL }, 2778, "tcp" }, - { "gwen-sonya", { NULL }, 2778, "udp" }, - { "lbc-sync", { NULL }, 2779, "tcp" }, - { "lbc-sync", { NULL }, 2779, "udp" }, - { "lbc-control", { NULL }, 2780, "tcp" }, - { "lbc-control", { NULL }, 2780, "udp" }, - { "whosells", { NULL }, 2781, "tcp" }, - { "whosells", { NULL }, 2781, "udp" }, - { "everydayrc", { NULL }, 2782, "tcp" }, - { "everydayrc", { NULL }, 2782, "udp" }, - { "aises", { NULL }, 2783, "tcp" }, - { "aises", { NULL }, 2783, "udp" }, - { "www-dev", { NULL }, 2784, "tcp" }, - { "www-dev", { NULL }, 2784, "udp" }, - { "aic-np", { NULL }, 2785, "tcp" }, - { "aic-np", { NULL }, 2785, "udp" }, - { "aic-oncrpc", { NULL }, 2786, "tcp" }, - { "aic-oncrpc", { NULL }, 2786, "udp" }, - { "piccolo", { NULL }, 2787, "tcp" }, - { "piccolo", { NULL }, 2787, "udp" }, - { "fryeserv", { NULL }, 2788, "tcp" }, - { "fryeserv", { NULL }, 2788, "udp" }, - { "media-agent", { NULL }, 2789, "tcp" }, - { "media-agent", { NULL }, 2789, "udp" }, - { "plgproxy", { NULL }, 2790, "tcp" }, - { "plgproxy", { NULL }, 2790, "udp" }, - { "mtport-regist", { NULL }, 2791, "tcp" }, - { "mtport-regist", { NULL }, 2791, "udp" }, - { "f5-globalsite", { NULL }, 2792, "tcp" }, - { "f5-globalsite", { NULL }, 2792, "udp" }, - { "initlsmsad", { NULL }, 2793, "tcp" }, - { "initlsmsad", { NULL }, 2793, "udp" }, - { "livestats", { NULL }, 2795, "tcp" }, - { "livestats", { NULL }, 2795, "udp" }, - { "ac-tech", { NULL }, 2796, "tcp" }, - { "ac-tech", { NULL }, 2796, "udp" }, - { "esp-encap", { NULL }, 2797, "tcp" }, - { "esp-encap", { NULL }, 2797, "udp" }, - { "tmesis-upshot", { NULL }, 2798, "tcp" }, - { "tmesis-upshot", { NULL }, 2798, "udp" }, - { "icon-discover", { NULL }, 2799, "tcp" }, - { "icon-discover", { NULL }, 2799, "udp" }, - { "acc-raid", { NULL }, 2800, "tcp" }, - { "acc-raid", { NULL }, 2800, "udp" }, - { "igcp", { NULL }, 2801, "tcp" }, - { "igcp", { NULL }, 2801, "udp" }, - { "veritas-tcp1", { NULL }, 2802, "tcp" }, - { "veritas-udp1", { NULL }, 2802, "udp" }, - { "btprjctrl", { NULL }, 2803, "tcp" }, - { "btprjctrl", { NULL }, 2803, "udp" }, - { "dvr-esm", { NULL }, 2804, "tcp" }, - { "dvr-esm", { NULL }, 2804, "udp" }, - { "wta-wsp-s", { NULL }, 2805, "tcp" }, - { "wta-wsp-s", { NULL }, 2805, "udp" }, - { "cspuni", { NULL }, 2806, "tcp" }, - { "cspuni", { NULL }, 2806, "udp" }, - { "cspmulti", { NULL }, 2807, "tcp" }, - { "cspmulti", { NULL }, 2807, "udp" }, - { "j-lan-p", { NULL }, 2808, "tcp" }, - { "j-lan-p", { NULL }, 2808, "udp" }, - { "corbaloc", { NULL }, 2809, "tcp" }, - { "corbaloc", { NULL }, 2809, "udp" }, - { "netsteward", { NULL }, 2810, "tcp" }, - { "netsteward", { NULL }, 2810, "udp" }, - { "gsiftp", { NULL }, 2811, "tcp" }, - { "gsiftp", { NULL }, 2811, "udp" }, - { "atmtcp", { NULL }, 2812, "tcp" }, - { "atmtcp", { NULL }, 2812, "udp" }, - { "llm-pass", { NULL }, 2813, "tcp" }, - { "llm-pass", { NULL }, 2813, "udp" }, - { "llm-csv", { NULL }, 2814, "tcp" }, - { "llm-csv", { NULL }, 2814, "udp" }, - { "lbc-measure", { NULL }, 2815, "tcp" }, - { "lbc-measure", { NULL }, 2815, "udp" }, - { "lbc-watchdog", { NULL }, 2816, "tcp" }, - { "lbc-watchdog", { NULL }, 2816, "udp" }, - { "nmsigport", { NULL }, 2817, "tcp" }, - { "nmsigport", { NULL }, 2817, "udp" }, - { "rmlnk", { NULL }, 2818, "tcp" }, - { "rmlnk", { NULL }, 2818, "udp" }, - { "fc-faultnotify", { NULL }, 2819, "tcp" }, - { "fc-faultnotify", { NULL }, 2819, "udp" }, - { "univision", { NULL }, 2820, "tcp" }, - { "univision", { NULL }, 2820, "udp" }, - { "vrts-at-port", { NULL }, 2821, "tcp" }, - { "vrts-at-port", { NULL }, 2821, "udp" }, - { "ka0wuc", { NULL }, 2822, "tcp" }, - { "ka0wuc", { NULL }, 2822, "udp" }, - { "cqg-netlan", { NULL }, 2823, "tcp" }, - { "cqg-netlan", { NULL }, 2823, "udp" }, - { "cqg-netlan-1", { NULL }, 2824, "tcp" }, - { "cqg-netlan-1", { NULL }, 2824, "udp" }, - { "slc-systemlog", { NULL }, 2826, "tcp" }, - { "slc-systemlog", { NULL }, 2826, "udp" }, - { "slc-ctrlrloops", { NULL }, 2827, "tcp" }, - { "slc-ctrlrloops", { NULL }, 2827, "udp" }, - { "itm-lm", { NULL }, 2828, "tcp" }, - { "itm-lm", { NULL }, 2828, "udp" }, - { "silkp1", { NULL }, 2829, "tcp" }, - { "silkp1", { NULL }, 2829, "udp" }, - { "silkp2", { NULL }, 2830, "tcp" }, - { "silkp2", { NULL }, 2830, "udp" }, - { "silkp3", { NULL }, 2831, "tcp" }, - { "silkp3", { NULL }, 2831, "udp" }, - { "silkp4", { NULL }, 2832, "tcp" }, - { "silkp4", { NULL }, 2832, "udp" }, - { "glishd", { NULL }, 2833, "tcp" }, - { "glishd", { NULL }, 2833, "udp" }, - { "evtp", { NULL }, 2834, "tcp" }, - { "evtp", { NULL }, 2834, "udp" }, - { "evtp-data", { NULL }, 2835, "tcp" }, - { "evtp-data", { NULL }, 2835, "udp" }, - { "catalyst", { NULL }, 2836, "tcp" }, - { "catalyst", { NULL }, 2836, "udp" }, - { "repliweb", { NULL }, 2837, "tcp" }, - { "repliweb", { NULL }, 2837, "udp" }, - { "starbot", { NULL }, 2838, "tcp" }, - { "starbot", { NULL }, 2838, "udp" }, - { "nmsigport", { NULL }, 2839, "tcp" }, - { "nmsigport", { NULL }, 2839, "udp" }, - { "l3-exprt", { NULL }, 2840, "tcp" }, - { "l3-exprt", { NULL }, 2840, "udp" }, - { "l3-ranger", { NULL }, 2841, "tcp" }, - { "l3-ranger", { NULL }, 2841, "udp" }, - { "l3-hawk", { NULL }, 2842, "tcp" }, - { "l3-hawk", { NULL }, 2842, "udp" }, - { "pdnet", { NULL }, 2843, "tcp" }, - { "pdnet", { NULL }, 2843, "udp" }, - { "bpcp-poll", { NULL }, 2844, "tcp" }, - { "bpcp-poll", { NULL }, 2844, "udp" }, - { "bpcp-trap", { NULL }, 2845, "tcp" }, - { "bpcp-trap", { NULL }, 2845, "udp" }, - { "aimpp-hello", { NULL }, 2846, "tcp" }, - { "aimpp-hello", { NULL }, 2846, "udp" }, - { "aimpp-port-req", { NULL }, 2847, "tcp" }, - { "aimpp-port-req", { NULL }, 2847, "udp" }, - { "amt-blc-port", { NULL }, 2848, "tcp" }, - { "amt-blc-port", { NULL }, 2848, "udp" }, - { "fxp", { NULL }, 2849, "tcp" }, - { "fxp", { NULL }, 2849, "udp" }, - { "metaconsole", { NULL }, 2850, "tcp" }, - { "metaconsole", { NULL }, 2850, "udp" }, - { "webemshttp", { NULL }, 2851, "tcp" }, - { "webemshttp", { NULL }, 2851, "udp" }, - { "bears-01", { NULL }, 2852, "tcp" }, - { "bears-01", { NULL }, 2852, "udp" }, - { "ispipes", { NULL }, 2853, "tcp" }, - { "ispipes", { NULL }, 2853, "udp" }, - { "infomover", { NULL }, 2854, "tcp" }, - { "infomover", { NULL }, 2854, "udp" }, - { "msrp", { NULL }, 2855, "tcp" }, - { "msrp", { NULL }, 2855, "udp" }, - { "cesdinv", { NULL }, 2856, "tcp" }, - { "cesdinv", { NULL }, 2856, "udp" }, - { "simctlp", { NULL }, 2857, "tcp" }, - { "simctlp", { NULL }, 2857, "udp" }, - { "ecnp", { NULL }, 2858, "tcp" }, - { "ecnp", { NULL }, 2858, "udp" }, - { "activememory", { NULL }, 2859, "tcp" }, - { "activememory", { NULL }, 2859, "udp" }, - { "dialpad-voice1", { NULL }, 2860, "tcp" }, - { "dialpad-voice1", { NULL }, 2860, "udp" }, - { "dialpad-voice2", { NULL }, 2861, "tcp" }, - { "dialpad-voice2", { NULL }, 2861, "udp" }, - { "ttg-protocol", { NULL }, 2862, "tcp" }, - { "ttg-protocol", { NULL }, 2862, "udp" }, - { "sonardata", { NULL }, 2863, "tcp" }, - { "sonardata", { NULL }, 2863, "udp" }, - { "astromed-main", { NULL }, 2864, "tcp" }, - { "astromed-main", { NULL }, 2864, "udp" }, - { "pit-vpn", { NULL }, 2865, "tcp" }, - { "pit-vpn", { NULL }, 2865, "udp" }, - { "iwlistener", { NULL }, 2866, "tcp" }, - { "iwlistener", { NULL }, 2866, "udp" }, - { "esps-portal", { NULL }, 2867, "tcp" }, - { "esps-portal", { NULL }, 2867, "udp" }, - { "npep-messaging", { NULL }, 2868, "tcp" }, - { "npep-messaging", { NULL }, 2868, "udp" }, - { "icslap", { NULL }, 2869, "tcp" }, - { "icslap", { NULL }, 2869, "udp" }, - { "daishi", { NULL }, 2870, "tcp" }, - { "daishi", { NULL }, 2870, "udp" }, - { "msi-selectplay", { NULL }, 2871, "tcp" }, - { "msi-selectplay", { NULL }, 2871, "udp" }, - { "radix", { NULL }, 2872, "tcp" }, - { "radix", { NULL }, 2872, "udp" }, - { "dxmessagebase1", { NULL }, 2874, "tcp" }, - { "dxmessagebase1", { NULL }, 2874, "udp" }, - { "dxmessagebase2", { NULL }, 2875, "tcp" }, - { "dxmessagebase2", { NULL }, 2875, "udp" }, - { "sps-tunnel", { NULL }, 2876, "tcp" }, - { "sps-tunnel", { NULL }, 2876, "udp" }, - { "bluelance", { NULL }, 2877, "tcp" }, - { "bluelance", { NULL }, 2877, "udp" }, - { "aap", { NULL }, 2878, "tcp" }, - { "aap", { NULL }, 2878, "udp" }, - { "ucentric-ds", { NULL }, 2879, "tcp" }, - { "ucentric-ds", { NULL }, 2879, "udp" }, - { "synapse", { NULL }, 2880, "tcp" }, - { "synapse", { NULL }, 2880, "udp" }, - { "ndsp", { NULL }, 2881, "tcp" }, - { "ndsp", { NULL }, 2881, "udp" }, - { "ndtp", { NULL }, 2882, "tcp" }, - { "ndtp", { NULL }, 2882, "udp" }, - { "ndnp", { NULL }, 2883, "tcp" }, - { "ndnp", { NULL }, 2883, "udp" }, - { "flashmsg", { NULL }, 2884, "tcp" }, - { "flashmsg", { NULL }, 2884, "udp" }, - { "topflow", { NULL }, 2885, "tcp" }, - { "topflow", { NULL }, 2885, "udp" }, - { "responselogic", { NULL }, 2886, "tcp" }, - { "responselogic", { NULL }, 2886, "udp" }, - { "aironetddp", { NULL }, 2887, "tcp" }, - { "aironetddp", { NULL }, 2887, "udp" }, - { "spcsdlobby", { NULL }, 2888, "tcp" }, - { "spcsdlobby", { NULL }, 2888, "udp" }, - { "rsom", { NULL }, 2889, "tcp" }, - { "rsom", { NULL }, 2889, "udp" }, - { "cspclmulti", { NULL }, 2890, "tcp" }, - { "cspclmulti", { NULL }, 2890, "udp" }, - { "cinegrfx-elmd", { NULL }, 2891, "tcp" }, - { "cinegrfx-elmd", { NULL }, 2891, "udp" }, - { "snifferdata", { NULL }, 2892, "tcp" }, - { "snifferdata", { NULL }, 2892, "udp" }, - { "vseconnector", { NULL }, 2893, "tcp" }, - { "vseconnector", { NULL }, 2893, "udp" }, - { "abacus-remote", { NULL }, 2894, "tcp" }, - { "abacus-remote", { NULL }, 2894, "udp" }, - { "natuslink", { NULL }, 2895, "tcp" }, - { "natuslink", { NULL }, 2895, "udp" }, - { "ecovisiong6-1", { NULL }, 2896, "tcp" }, - { "ecovisiong6-1", { NULL }, 2896, "udp" }, - { "citrix-rtmp", { NULL }, 2897, "tcp" }, - { "citrix-rtmp", { NULL }, 2897, "udp" }, - { "appliance-cfg", { NULL }, 2898, "tcp" }, - { "appliance-cfg", { NULL }, 2898, "udp" }, - { "powergemplus", { NULL }, 2899, "tcp" }, - { "powergemplus", { NULL }, 2899, "udp" }, - { "quicksuite", { NULL }, 2900, "tcp" }, - { "quicksuite", { NULL }, 2900, "udp" }, - { "allstorcns", { NULL }, 2901, "tcp" }, - { "allstorcns", { NULL }, 2901, "udp" }, - { "netaspi", { NULL }, 2902, "tcp" }, - { "netaspi", { NULL }, 2902, "udp" }, - { "suitcase", { NULL }, 2903, "tcp" }, - { "suitcase", { NULL }, 2903, "udp" }, - { "m2ua", { NULL }, 2904, "tcp" }, - { "m2ua", { NULL }, 2904, "udp" }, - { "m2ua", { NULL }, 2904, "sctp" }, - { "m3ua", { NULL }, 2905, "tcp" }, - { "m3ua", { NULL }, 2905, "sctp" }, - { "caller9", { NULL }, 2906, "tcp" }, - { "caller9", { NULL }, 2906, "udp" }, - { "webmethods-b2b", { NULL }, 2907, "tcp" }, - { "webmethods-b2b", { NULL }, 2907, "udp" }, - { "mao", { NULL }, 2908, "tcp" }, - { "mao", { NULL }, 2908, "udp" }, - { "funk-dialout", { NULL }, 2909, "tcp" }, - { "funk-dialout", { NULL }, 2909, "udp" }, - { "tdaccess", { NULL }, 2910, "tcp" }, - { "tdaccess", { NULL }, 2910, "udp" }, - { "blockade", { NULL }, 2911, "tcp" }, - { "blockade", { NULL }, 2911, "udp" }, - { "epicon", { NULL }, 2912, "tcp" }, - { "epicon", { NULL }, 2912, "udp" }, - { "boosterware", { NULL }, 2913, "tcp" }, - { "boosterware", { NULL }, 2913, "udp" }, - { "gamelobby", { NULL }, 2914, "tcp" }, - { "gamelobby", { NULL }, 2914, "udp" }, - { "tksocket", { NULL }, 2915, "tcp" }, - { "tksocket", { NULL }, 2915, "udp" }, - { "elvin_server", { NULL }, 2916, "tcp" }, - { "elvin_server", { NULL }, 2916, "udp" }, - { "elvin_client", { NULL }, 2917, "tcp" }, - { "elvin_client", { NULL }, 2917, "udp" }, - { "kastenchasepad", { NULL }, 2918, "tcp" }, - { "kastenchasepad", { NULL }, 2918, "udp" }, - { "roboer", { NULL }, 2919, "tcp" }, - { "roboer", { NULL }, 2919, "udp" }, - { "roboeda", { NULL }, 2920, "tcp" }, - { "roboeda", { NULL }, 2920, "udp" }, - { "cesdcdman", { NULL }, 2921, "tcp" }, - { "cesdcdman", { NULL }, 2921, "udp" }, - { "cesdcdtrn", { NULL }, 2922, "tcp" }, - { "cesdcdtrn", { NULL }, 2922, "udp" }, - { "wta-wsp-wtp-s", { NULL }, 2923, "tcp" }, - { "wta-wsp-wtp-s", { NULL }, 2923, "udp" }, - { "precise-vip", { NULL }, 2924, "tcp" }, - { "precise-vip", { NULL }, 2924, "udp" }, - { "mobile-file-dl", { NULL }, 2926, "tcp" }, - { "mobile-file-dl", { NULL }, 2926, "udp" }, - { "unimobilectrl", { NULL }, 2927, "tcp" }, - { "unimobilectrl", { NULL }, 2927, "udp" }, - { "redstone-cpss", { NULL }, 2928, "tcp" }, - { "redstone-cpss", { NULL }, 2928, "udp" }, - { "amx-webadmin", { NULL }, 2929, "tcp" }, - { "amx-webadmin", { NULL }, 2929, "udp" }, - { "amx-weblinx", { NULL }, 2930, "tcp" }, - { "amx-weblinx", { NULL }, 2930, "udp" }, - { "circle-x", { NULL }, 2931, "tcp" }, - { "circle-x", { NULL }, 2931, "udp" }, - { "incp", { NULL }, 2932, "tcp" }, - { "incp", { NULL }, 2932, "udp" }, - { "4-tieropmgw", { NULL }, 2933, "tcp" }, - { "4-tieropmgw", { NULL }, 2933, "udp" }, - { "4-tieropmcli", { NULL }, 2934, "tcp" }, - { "4-tieropmcli", { NULL }, 2934, "udp" }, - { "qtp", { NULL }, 2935, "tcp" }, - { "qtp", { NULL }, 2935, "udp" }, - { "otpatch", { NULL }, 2936, "tcp" }, - { "otpatch", { NULL }, 2936, "udp" }, - { "pnaconsult-lm", { NULL }, 2937, "tcp" }, - { "pnaconsult-lm", { NULL }, 2937, "udp" }, - { "sm-pas-1", { NULL }, 2938, "tcp" }, - { "sm-pas-1", { NULL }, 2938, "udp" }, - { "sm-pas-2", { NULL }, 2939, "tcp" }, - { "sm-pas-2", { NULL }, 2939, "udp" }, - { "sm-pas-3", { NULL }, 2940, "tcp" }, - { "sm-pas-3", { NULL }, 2940, "udp" }, - { "sm-pas-4", { NULL }, 2941, "tcp" }, - { "sm-pas-4", { NULL }, 2941, "udp" }, - { "sm-pas-5", { NULL }, 2942, "tcp" }, - { "sm-pas-5", { NULL }, 2942, "udp" }, - { "ttnrepository", { NULL }, 2943, "tcp" }, - { "ttnrepository", { NULL }, 2943, "udp" }, - { "megaco-h248", { NULL }, 2944, "tcp" }, - { "megaco-h248", { NULL }, 2944, "udp" }, - { "megaco-h248", { NULL }, 2944, "sctp" }, - { "h248-binary", { NULL }, 2945, "tcp" }, - { "h248-binary", { NULL }, 2945, "udp" }, - { "h248-binary", { NULL }, 2945, "sctp" }, - { "fjsvmpor", { NULL }, 2946, "tcp" }, - { "fjsvmpor", { NULL }, 2946, "udp" }, - { "gpsd", { NULL }, 2947, "tcp" }, - { "gpsd", { NULL }, 2947, "udp" }, - { "wap-push", { NULL }, 2948, "tcp" }, - { "wap-push", { NULL }, 2948, "udp" }, - { "wap-pushsecure", { NULL }, 2949, "tcp" }, - { "wap-pushsecure", { NULL }, 2949, "udp" }, - { "esip", { NULL }, 2950, "tcp" }, - { "esip", { NULL }, 2950, "udp" }, - { "ottp", { NULL }, 2951, "tcp" }, - { "ottp", { NULL }, 2951, "udp" }, - { "mpfwsas", { NULL }, 2952, "tcp" }, - { "mpfwsas", { NULL }, 2952, "udp" }, - { "ovalarmsrv", { NULL }, 2953, "tcp" }, - { "ovalarmsrv", { NULL }, 2953, "udp" }, - { "ovalarmsrv-cmd", { NULL }, 2954, "tcp" }, - { "ovalarmsrv-cmd", { NULL }, 2954, "udp" }, - { "csnotify", { NULL }, 2955, "tcp" }, - { "csnotify", { NULL }, 2955, "udp" }, - { "ovrimosdbman", { NULL }, 2956, "tcp" }, - { "ovrimosdbman", { NULL }, 2956, "udp" }, - { "jmact5", { NULL }, 2957, "tcp" }, - { "jmact5", { NULL }, 2957, "udp" }, - { "jmact6", { NULL }, 2958, "tcp" }, - { "jmact6", { NULL }, 2958, "udp" }, - { "rmopagt", { NULL }, 2959, "tcp" }, - { "rmopagt", { NULL }, 2959, "udp" }, - { "dfoxserver", { NULL }, 2960, "tcp" }, - { "dfoxserver", { NULL }, 2960, "udp" }, - { "boldsoft-lm", { NULL }, 2961, "tcp" }, - { "boldsoft-lm", { NULL }, 2961, "udp" }, - { "iph-policy-cli", { NULL }, 2962, "tcp" }, - { "iph-policy-cli", { NULL }, 2962, "udp" }, - { "iph-policy-adm", { NULL }, 2963, "tcp" }, - { "iph-policy-adm", { NULL }, 2963, "udp" }, - { "bullant-srap", { NULL }, 2964, "tcp" }, - { "bullant-srap", { NULL }, 2964, "udp" }, - { "bullant-rap", { NULL }, 2965, "tcp" }, - { "bullant-rap", { NULL }, 2965, "udp" }, - { "idp-infotrieve", { NULL }, 2966, "tcp" }, - { "idp-infotrieve", { NULL }, 2966, "udp" }, - { "ssc-agent", { NULL }, 2967, "tcp" }, - { "ssc-agent", { NULL }, 2967, "udp" }, - { "enpp", { NULL }, 2968, "tcp" }, - { "enpp", { NULL }, 2968, "udp" }, - { "essp", { NULL }, 2969, "tcp" }, - { "essp", { NULL }, 2969, "udp" }, - { "index-net", { NULL }, 2970, "tcp" }, - { "index-net", { NULL }, 2970, "udp" }, - { "netclip", { NULL }, 2971, "tcp" }, - { "netclip", { NULL }, 2971, "udp" }, - { "pmsm-webrctl", { NULL }, 2972, "tcp" }, - { "pmsm-webrctl", { NULL }, 2972, "udp" }, - { "svnetworks", { NULL }, 2973, "tcp" }, - { "svnetworks", { NULL }, 2973, "udp" }, - { "signal", { NULL }, 2974, "tcp" }, - { "signal", { NULL }, 2974, "udp" }, - { "fjmpcm", { NULL }, 2975, "tcp" }, - { "fjmpcm", { NULL }, 2975, "udp" }, - { "cns-srv-port", { NULL }, 2976, "tcp" }, - { "cns-srv-port", { NULL }, 2976, "udp" }, - { "ttc-etap-ns", { NULL }, 2977, "tcp" }, - { "ttc-etap-ns", { NULL }, 2977, "udp" }, - { "ttc-etap-ds", { NULL }, 2978, "tcp" }, - { "ttc-etap-ds", { NULL }, 2978, "udp" }, - { "h263-video", { NULL }, 2979, "tcp" }, - { "h263-video", { NULL }, 2979, "udp" }, - { "wimd", { NULL }, 2980, "tcp" }, - { "wimd", { NULL }, 2980, "udp" }, - { "mylxamport", { NULL }, 2981, "tcp" }, - { "mylxamport", { NULL }, 2981, "udp" }, - { "iwb-whiteboard", { NULL }, 2982, "tcp" }, - { "iwb-whiteboard", { NULL }, 2982, "udp" }, - { "netplan", { NULL }, 2983, "tcp" }, - { "netplan", { NULL }, 2983, "udp" }, - { "hpidsadmin", { NULL }, 2984, "tcp" }, - { "hpidsadmin", { NULL }, 2984, "udp" }, - { "hpidsagent", { NULL }, 2985, "tcp" }, - { "hpidsagent", { NULL }, 2985, "udp" }, - { "stonefalls", { NULL }, 2986, "tcp" }, - { "stonefalls", { NULL }, 2986, "udp" }, - { "identify", { NULL }, 2987, "tcp" }, - { "identify", { NULL }, 2987, "udp" }, - { "hippad", { NULL }, 2988, "tcp" }, - { "hippad", { NULL }, 2988, "udp" }, - { "zarkov", { NULL }, 2989, "tcp" }, - { "zarkov", { NULL }, 2989, "udp" }, - { "boscap", { NULL }, 2990, "tcp" }, - { "boscap", { NULL }, 2990, "udp" }, - { "wkstn-mon", { NULL }, 2991, "tcp" }, - { "wkstn-mon", { NULL }, 2991, "udp" }, - { "avenyo", { NULL }, 2992, "tcp" }, - { "avenyo", { NULL }, 2992, "udp" }, - { "veritas-vis1", { NULL }, 2993, "tcp" }, - { "veritas-vis1", { NULL }, 2993, "udp" }, - { "veritas-vis2", { NULL }, 2994, "tcp" }, - { "veritas-vis2", { NULL }, 2994, "udp" }, - { "idrs", { NULL }, 2995, "tcp" }, - { "idrs", { NULL }, 2995, "udp" }, - { "vsixml", { NULL }, 2996, "tcp" }, - { "vsixml", { NULL }, 2996, "udp" }, - { "rebol", { NULL }, 2997, "tcp" }, - { "rebol", { NULL }, 2997, "udp" }, - { "realsecure", { NULL }, 2998, "tcp" }, - { "realsecure", { NULL }, 2998, "udp" }, - { "remoteware-un", { NULL }, 2999, "tcp" }, - { "remoteware-un", { NULL }, 2999, "udp" }, - { "hbci", { NULL }, 3000, "tcp" }, - { "hbci", { NULL }, 3000, "udp" }, - { "remoteware-cl", { NULL }, 3000, "tcp" }, - { "remoteware-cl", { NULL }, 3000, "udp" }, - { "exlm-agent", { NULL }, 3002, "tcp" }, - { "exlm-agent", { NULL }, 3002, "udp" }, - { "remoteware-srv", { NULL }, 3002, "tcp" }, - { "remoteware-srv", { NULL }, 3002, "udp" }, - { "cgms", { NULL }, 3003, "tcp" }, - { "cgms", { NULL }, 3003, "udp" }, - { "csoftragent", { NULL }, 3004, "tcp" }, - { "csoftragent", { NULL }, 3004, "udp" }, - { "geniuslm", { NULL }, 3005, "tcp" }, - { "geniuslm", { NULL }, 3005, "udp" }, - { "ii-admin", { NULL }, 3006, "tcp" }, - { "ii-admin", { NULL }, 3006, "udp" }, - { "lotusmtap", { NULL }, 3007, "tcp" }, - { "lotusmtap", { NULL }, 3007, "udp" }, - { "midnight-tech", { NULL }, 3008, "tcp" }, - { "midnight-tech", { NULL }, 3008, "udp" }, - { "pxc-ntfy", { NULL }, 3009, "tcp" }, - { "pxc-ntfy", { NULL }, 3009, "udp" }, - { "gw", { NULL }, 3010, "tcp" }, - { "ping-pong", { NULL }, 3010, "udp" }, - { "trusted-web", { NULL }, 3011, "tcp" }, - { "trusted-web", { NULL }, 3011, "udp" }, - { "twsdss", { NULL }, 3012, "tcp" }, - { "twsdss", { NULL }, 3012, "udp" }, - { "gilatskysurfer", { NULL }, 3013, "tcp" }, - { "gilatskysurfer", { NULL }, 3013, "udp" }, - { "broker_service", { NULL }, 3014, "tcp" }, - { "broker_service", { NULL }, 3014, "udp" }, - { "nati-dstp", { NULL }, 3015, "tcp" }, - { "nati-dstp", { NULL }, 3015, "udp" }, - { "notify_srvr", { NULL }, 3016, "tcp" }, - { "notify_srvr", { NULL }, 3016, "udp" }, - { "event_listener", { NULL }, 3017, "tcp" }, - { "event_listener", { NULL }, 3017, "udp" }, - { "srvc_registry", { NULL }, 3018, "tcp" }, - { "srvc_registry", { NULL }, 3018, "udp" }, - { "resource_mgr", { NULL }, 3019, "tcp" }, - { "resource_mgr", { NULL }, 3019, "udp" }, - { "cifs", { NULL }, 3020, "tcp" }, - { "cifs", { NULL }, 3020, "udp" }, - { "agriserver", { NULL }, 3021, "tcp" }, - { "agriserver", { NULL }, 3021, "udp" }, - { "csregagent", { NULL }, 3022, "tcp" }, - { "csregagent", { NULL }, 3022, "udp" }, - { "magicnotes", { NULL }, 3023, "tcp" }, - { "magicnotes", { NULL }, 3023, "udp" }, - { "nds_sso", { NULL }, 3024, "tcp" }, - { "nds_sso", { NULL }, 3024, "udp" }, - { "arepa-raft", { NULL }, 3025, "tcp" }, - { "arepa-raft", { NULL }, 3025, "udp" }, - { "agri-gateway", { NULL }, 3026, "tcp" }, - { "agri-gateway", { NULL }, 3026, "udp" }, - { "LiebDevMgmt_C", { NULL }, 3027, "tcp" }, - { "LiebDevMgmt_C", { NULL }, 3027, "udp" }, - { "LiebDevMgmt_DM", { NULL }, 3028, "tcp" }, - { "LiebDevMgmt_DM", { NULL }, 3028, "udp" }, - { "LiebDevMgmt_A", { NULL }, 3029, "tcp" }, - { "LiebDevMgmt_A", { NULL }, 3029, "udp" }, - { "arepa-cas", { NULL }, 3030, "tcp" }, - { "arepa-cas", { NULL }, 3030, "udp" }, - { "eppc", { NULL }, 3031, "tcp" }, - { "eppc", { NULL }, 3031, "udp" }, - { "redwood-chat", { NULL }, 3032, "tcp" }, - { "redwood-chat", { NULL }, 3032, "udp" }, - { "pdb", { NULL }, 3033, "tcp" }, - { "pdb", { NULL }, 3033, "udp" }, - { "osmosis-aeea", { NULL }, 3034, "tcp" }, - { "osmosis-aeea", { NULL }, 3034, "udp" }, - { "fjsv-gssagt", { NULL }, 3035, "tcp" }, - { "fjsv-gssagt", { NULL }, 3035, "udp" }, - { "hagel-dump", { NULL }, 3036, "tcp" }, - { "hagel-dump", { NULL }, 3036, "udp" }, - { "hp-san-mgmt", { NULL }, 3037, "tcp" }, - { "hp-san-mgmt", { NULL }, 3037, "udp" }, - { "santak-ups", { NULL }, 3038, "tcp" }, - { "santak-ups", { NULL }, 3038, "udp" }, - { "cogitate", { NULL }, 3039, "tcp" }, - { "cogitate", { NULL }, 3039, "udp" }, - { "tomato-springs", { NULL }, 3040, "tcp" }, - { "tomato-springs", { NULL }, 3040, "udp" }, - { "di-traceware", { NULL }, 3041, "tcp" }, - { "di-traceware", { NULL }, 3041, "udp" }, - { "journee", { NULL }, 3042, "tcp" }, - { "journee", { NULL }, 3042, "udp" }, - { "brp", { NULL }, 3043, "tcp" }, - { "brp", { NULL }, 3043, "udp" }, - { "epp", { NULL }, 3044, "tcp" }, - { "epp", { NULL }, 3044, "udp" }, - { "responsenet", { NULL }, 3045, "tcp" }, - { "responsenet", { NULL }, 3045, "udp" }, - { "di-ase", { NULL }, 3046, "tcp" }, - { "di-ase", { NULL }, 3046, "udp" }, - { "hlserver", { NULL }, 3047, "tcp" }, - { "hlserver", { NULL }, 3047, "udp" }, - { "pctrader", { NULL }, 3048, "tcp" }, - { "pctrader", { NULL }, 3048, "udp" }, - { "nsws", { NULL }, 3049, "tcp" }, - { "nsws", { NULL }, 3049, "udp" }, - { "gds_db", { NULL }, 3050, "tcp" }, - { "gds_db", { NULL }, 3050, "udp" }, - { "galaxy-server", { NULL }, 3051, "tcp" }, - { "galaxy-server", { NULL }, 3051, "udp" }, - { "apc-3052", { NULL }, 3052, "tcp" }, - { "apc-3052", { NULL }, 3052, "udp" }, - { "dsom-server", { NULL }, 3053, "tcp" }, - { "dsom-server", { NULL }, 3053, "udp" }, - { "amt-cnf-prot", { NULL }, 3054, "tcp" }, - { "amt-cnf-prot", { NULL }, 3054, "udp" }, - { "policyserver", { NULL }, 3055, "tcp" }, - { "policyserver", { NULL }, 3055, "udp" }, - { "cdl-server", { NULL }, 3056, "tcp" }, - { "cdl-server", { NULL }, 3056, "udp" }, - { "goahead-fldup", { NULL }, 3057, "tcp" }, - { "goahead-fldup", { NULL }, 3057, "udp" }, - { "videobeans", { NULL }, 3058, "tcp" }, - { "videobeans", { NULL }, 3058, "udp" }, - { "qsoft", { NULL }, 3059, "tcp" }, - { "qsoft", { NULL }, 3059, "udp" }, - { "interserver", { NULL }, 3060, "tcp" }, - { "interserver", { NULL }, 3060, "udp" }, - { "cautcpd", { NULL }, 3061, "tcp" }, - { "cautcpd", { NULL }, 3061, "udp" }, - { "ncacn-ip-tcp", { NULL }, 3062, "tcp" }, - { "ncacn-ip-tcp", { NULL }, 3062, "udp" }, - { "ncadg-ip-udp", { NULL }, 3063, "tcp" }, - { "ncadg-ip-udp", { NULL }, 3063, "udp" }, - { "rprt", { NULL }, 3064, "tcp" }, - { "rprt", { NULL }, 3064, "udp" }, - { "slinterbase", { NULL }, 3065, "tcp" }, - { "slinterbase", { NULL }, 3065, "udp" }, - { "netattachsdmp", { NULL }, 3066, "tcp" }, - { "netattachsdmp", { NULL }, 3066, "udp" }, - { "fjhpjp", { NULL }, 3067, "tcp" }, - { "fjhpjp", { NULL }, 3067, "udp" }, - { "ls3bcast", { NULL }, 3068, "tcp" }, - { "ls3bcast", { NULL }, 3068, "udp" }, - { "ls3", { NULL }, 3069, "tcp" }, - { "ls3", { NULL }, 3069, "udp" }, - { "mgxswitch", { NULL }, 3070, "tcp" }, - { "mgxswitch", { NULL }, 3070, "udp" }, - { "csd-mgmt-port", { NULL }, 3071, "tcp" }, - { "csd-mgmt-port", { NULL }, 3071, "udp" }, - { "csd-monitor", { NULL }, 3072, "tcp" }, - { "csd-monitor", { NULL }, 3072, "udp" }, - { "vcrp", { NULL }, 3073, "tcp" }, - { "vcrp", { NULL }, 3073, "udp" }, - { "xbox", { NULL }, 3074, "tcp" }, - { "xbox", { NULL }, 3074, "udp" }, - { "orbix-locator", { NULL }, 3075, "tcp" }, - { "orbix-locator", { NULL }, 3075, "udp" }, - { "orbix-config", { NULL }, 3076, "tcp" }, - { "orbix-config", { NULL }, 3076, "udp" }, - { "orbix-loc-ssl", { NULL }, 3077, "tcp" }, - { "orbix-loc-ssl", { NULL }, 3077, "udp" }, - { "orbix-cfg-ssl", { NULL }, 3078, "tcp" }, - { "orbix-cfg-ssl", { NULL }, 3078, "udp" }, - { "lv-frontpanel", { NULL }, 3079, "tcp" }, - { "lv-frontpanel", { NULL }, 3079, "udp" }, - { "stm_pproc", { NULL }, 3080, "tcp" }, - { "stm_pproc", { NULL }, 3080, "udp" }, - { "tl1-lv", { NULL }, 3081, "tcp" }, - { "tl1-lv", { NULL }, 3081, "udp" }, - { "tl1-raw", { NULL }, 3082, "tcp" }, - { "tl1-raw", { NULL }, 3082, "udp" }, - { "tl1-telnet", { NULL }, 3083, "tcp" }, - { "tl1-telnet", { NULL }, 3083, "udp" }, - { "itm-mccs", { NULL }, 3084, "tcp" }, - { "itm-mccs", { NULL }, 3084, "udp" }, - { "pcihreq", { NULL }, 3085, "tcp" }, - { "pcihreq", { NULL }, 3085, "udp" }, - { "jdl-dbkitchen", { NULL }, 3086, "tcp" }, - { "jdl-dbkitchen", { NULL }, 3086, "udp" }, - { "asoki-sma", { NULL }, 3087, "tcp" }, - { "asoki-sma", { NULL }, 3087, "udp" }, - { "xdtp", { NULL }, 3088, "tcp" }, - { "xdtp", { NULL }, 3088, "udp" }, - { "ptk-alink", { NULL }, 3089, "tcp" }, - { "ptk-alink", { NULL }, 3089, "udp" }, - { "stss", { NULL }, 3090, "tcp" }, - { "stss", { NULL }, 3090, "udp" }, - { "1ci-smcs", { NULL }, 3091, "tcp" }, - { "1ci-smcs", { NULL }, 3091, "udp" }, - { "rapidmq-center", { NULL }, 3093, "tcp" }, - { "rapidmq-center", { NULL }, 3093, "udp" }, - { "rapidmq-reg", { NULL }, 3094, "tcp" }, - { "rapidmq-reg", { NULL }, 3094, "udp" }, - { "panasas", { NULL }, 3095, "tcp" }, - { "panasas", { NULL }, 3095, "udp" }, - { "ndl-aps", { NULL }, 3096, "tcp" }, - { "ndl-aps", { NULL }, 3096, "udp" }, - { "itu-bicc-stc", { NULL }, 3097, "sctp" }, - { "umm-port", { NULL }, 3098, "tcp" }, - { "umm-port", { NULL }, 3098, "udp" }, - { "chmd", { NULL }, 3099, "tcp" }, - { "chmd", { NULL }, 3099, "udp" }, - { "opcon-xps", { NULL }, 3100, "tcp" }, - { "opcon-xps", { NULL }, 3100, "udp" }, - { "hp-pxpib", { NULL }, 3101, "tcp" }, - { "hp-pxpib", { NULL }, 3101, "udp" }, - { "slslavemon", { NULL }, 3102, "tcp" }, - { "slslavemon", { NULL }, 3102, "udp" }, - { "autocuesmi", { NULL }, 3103, "tcp" }, - { "autocuesmi", { NULL }, 3103, "udp" }, - { "autocuelog", { NULL }, 3104, "tcp" }, - { "autocuetime", { NULL }, 3104, "udp" }, - { "cardbox", { NULL }, 3105, "tcp" }, - { "cardbox", { NULL }, 3105, "udp" }, - { "cardbox-http", { NULL }, 3106, "tcp" }, - { "cardbox-http", { NULL }, 3106, "udp" }, - { "business", { NULL }, 3107, "tcp" }, - { "business", { NULL }, 3107, "udp" }, - { "geolocate", { NULL }, 3108, "tcp" }, - { "geolocate", { NULL }, 3108, "udp" }, - { "personnel", { NULL }, 3109, "tcp" }, - { "personnel", { NULL }, 3109, "udp" }, - { "sim-control", { NULL }, 3110, "tcp" }, - { "sim-control", { NULL }, 3110, "udp" }, - { "wsynch", { NULL }, 3111, "tcp" }, - { "wsynch", { NULL }, 3111, "udp" }, - { "ksysguard", { NULL }, 3112, "tcp" }, - { "ksysguard", { NULL }, 3112, "udp" }, - { "cs-auth-svr", { NULL }, 3113, "tcp" }, - { "cs-auth-svr", { NULL }, 3113, "udp" }, - { "ccmad", { NULL }, 3114, "tcp" }, - { "ccmad", { NULL }, 3114, "udp" }, - { "mctet-master", { NULL }, 3115, "tcp" }, - { "mctet-master", { NULL }, 3115, "udp" }, - { "mctet-gateway", { NULL }, 3116, "tcp" }, - { "mctet-gateway", { NULL }, 3116, "udp" }, - { "mctet-jserv", { NULL }, 3117, "tcp" }, - { "mctet-jserv", { NULL }, 3117, "udp" }, - { "pkagent", { NULL }, 3118, "tcp" }, - { "pkagent", { NULL }, 3118, "udp" }, - { "d2000kernel", { NULL }, 3119, "tcp" }, - { "d2000kernel", { NULL }, 3119, "udp" }, - { "d2000webserver", { NULL }, 3120, "tcp" }, - { "d2000webserver", { NULL }, 3120, "udp" }, - { "vtr-emulator", { NULL }, 3122, "tcp" }, - { "vtr-emulator", { NULL }, 3122, "udp" }, - { "edix", { NULL }, 3123, "tcp" }, - { "edix", { NULL }, 3123, "udp" }, - { "beacon-port", { NULL }, 3124, "tcp" }, - { "beacon-port", { NULL }, 3124, "udp" }, - { "a13-an", { NULL }, 3125, "tcp" }, - { "a13-an", { NULL }, 3125, "udp" }, - { "ctx-bridge", { NULL }, 3127, "tcp" }, - { "ctx-bridge", { NULL }, 3127, "udp" }, - { "ndl-aas", { NULL }, 3128, "tcp" }, - { "ndl-aas", { NULL }, 3128, "udp" }, - { "netport-id", { NULL }, 3129, "tcp" }, - { "netport-id", { NULL }, 3129, "udp" }, - { "icpv2", { NULL }, 3130, "tcp" }, - { "icpv2", { NULL }, 3130, "udp" }, - { "netbookmark", { NULL }, 3131, "tcp" }, - { "netbookmark", { NULL }, 3131, "udp" }, - { "ms-rule-engine", { NULL }, 3132, "tcp" }, - { "ms-rule-engine", { NULL }, 3132, "udp" }, - { "prism-deploy", { NULL }, 3133, "tcp" }, - { "prism-deploy", { NULL }, 3133, "udp" }, - { "ecp", { NULL }, 3134, "tcp" }, - { "ecp", { NULL }, 3134, "udp" }, - { "peerbook-port", { NULL }, 3135, "tcp" }, - { "peerbook-port", { NULL }, 3135, "udp" }, - { "grubd", { NULL }, 3136, "tcp" }, - { "grubd", { NULL }, 3136, "udp" }, - { "rtnt-1", { NULL }, 3137, "tcp" }, - { "rtnt-1", { NULL }, 3137, "udp" }, - { "rtnt-2", { NULL }, 3138, "tcp" }, - { "rtnt-2", { NULL }, 3138, "udp" }, - { "incognitorv", { NULL }, 3139, "tcp" }, - { "incognitorv", { NULL }, 3139, "udp" }, - { "ariliamulti", { NULL }, 3140, "tcp" }, - { "ariliamulti", { NULL }, 3140, "udp" }, - { "vmodem", { NULL }, 3141, "tcp" }, - { "vmodem", { NULL }, 3141, "udp" }, - { "rdc-wh-eos", { NULL }, 3142, "tcp" }, - { "rdc-wh-eos", { NULL }, 3142, "udp" }, - { "seaview", { NULL }, 3143, "tcp" }, - { "seaview", { NULL }, 3143, "udp" }, - { "tarantella", { NULL }, 3144, "tcp" }, - { "tarantella", { NULL }, 3144, "udp" }, - { "csi-lfap", { NULL }, 3145, "tcp" }, - { "csi-lfap", { NULL }, 3145, "udp" }, - { "bears-02", { NULL }, 3146, "tcp" }, - { "bears-02", { NULL }, 3146, "udp" }, - { "rfio", { NULL }, 3147, "tcp" }, - { "rfio", { NULL }, 3147, "udp" }, - { "nm-game-admin", { NULL }, 3148, "tcp" }, - { "nm-game-admin", { NULL }, 3148, "udp" }, - { "nm-game-server", { NULL }, 3149, "tcp" }, - { "nm-game-server", { NULL }, 3149, "udp" }, - { "nm-asses-admin", { NULL }, 3150, "tcp" }, - { "nm-asses-admin", { NULL }, 3150, "udp" }, - { "nm-assessor", { NULL }, 3151, "tcp" }, - { "nm-assessor", { NULL }, 3151, "udp" }, - { "feitianrockey", { NULL }, 3152, "tcp" }, - { "feitianrockey", { NULL }, 3152, "udp" }, - { "s8-client-port", { NULL }, 3153, "tcp" }, - { "s8-client-port", { NULL }, 3153, "udp" }, - { "ccmrmi", { NULL }, 3154, "tcp" }, - { "ccmrmi", { NULL }, 3154, "udp" }, - { "jpegmpeg", { NULL }, 3155, "tcp" }, - { "jpegmpeg", { NULL }, 3155, "udp" }, - { "indura", { NULL }, 3156, "tcp" }, - { "indura", { NULL }, 3156, "udp" }, - { "e3consultants", { NULL }, 3157, "tcp" }, - { "e3consultants", { NULL }, 3157, "udp" }, - { "stvp", { NULL }, 3158, "tcp" }, - { "stvp", { NULL }, 3158, "udp" }, - { "navegaweb-port", { NULL }, 3159, "tcp" }, - { "navegaweb-port", { NULL }, 3159, "udp" }, - { "tip-app-server", { NULL }, 3160, "tcp" }, - { "tip-app-server", { NULL }, 3160, "udp" }, - { "doc1lm", { NULL }, 3161, "tcp" }, - { "doc1lm", { NULL }, 3161, "udp" }, - { "sflm", { NULL }, 3162, "tcp" }, - { "sflm", { NULL }, 3162, "udp" }, - { "res-sap", { NULL }, 3163, "tcp" }, - { "res-sap", { NULL }, 3163, "udp" }, - { "imprs", { NULL }, 3164, "tcp" }, - { "imprs", { NULL }, 3164, "udp" }, - { "newgenpay", { NULL }, 3165, "tcp" }, - { "newgenpay", { NULL }, 3165, "udp" }, - { "sossecollector", { NULL }, 3166, "tcp" }, - { "sossecollector", { NULL }, 3166, "udp" }, - { "nowcontact", { NULL }, 3167, "tcp" }, - { "nowcontact", { NULL }, 3167, "udp" }, - { "poweronnud", { NULL }, 3168, "tcp" }, - { "poweronnud", { NULL }, 3168, "udp" }, - { "serverview-as", { NULL }, 3169, "tcp" }, - { "serverview-as", { NULL }, 3169, "udp" }, - { "serverview-asn", { NULL }, 3170, "tcp" }, - { "serverview-asn", { NULL }, 3170, "udp" }, - { "serverview-gf", { NULL }, 3171, "tcp" }, - { "serverview-gf", { NULL }, 3171, "udp" }, - { "serverview-rm", { NULL }, 3172, "tcp" }, - { "serverview-rm", { NULL }, 3172, "udp" }, - { "serverview-icc", { NULL }, 3173, "tcp" }, - { "serverview-icc", { NULL }, 3173, "udp" }, - { "armi-server", { NULL }, 3174, "tcp" }, - { "armi-server", { NULL }, 3174, "udp" }, - { "t1-e1-over-ip", { NULL }, 3175, "tcp" }, - { "t1-e1-over-ip", { NULL }, 3175, "udp" }, - { "ars-master", { NULL }, 3176, "tcp" }, - { "ars-master", { NULL }, 3176, "udp" }, - { "phonex-port", { NULL }, 3177, "tcp" }, - { "phonex-port", { NULL }, 3177, "udp" }, - { "radclientport", { NULL }, 3178, "tcp" }, - { "radclientport", { NULL }, 3178, "udp" }, - { "h2gf-w-2m", { NULL }, 3179, "tcp" }, - { "h2gf-w-2m", { NULL }, 3179, "udp" }, - { "mc-brk-srv", { NULL }, 3180, "tcp" }, - { "mc-brk-srv", { NULL }, 3180, "udp" }, - { "bmcpatrolagent", { NULL }, 3181, "tcp" }, - { "bmcpatrolagent", { NULL }, 3181, "udp" }, - { "bmcpatrolrnvu", { NULL }, 3182, "tcp" }, - { "bmcpatrolrnvu", { NULL }, 3182, "udp" }, - { "cops-tls", { NULL }, 3183, "tcp" }, - { "cops-tls", { NULL }, 3183, "udp" }, - { "apogeex-port", { NULL }, 3184, "tcp" }, - { "apogeex-port", { NULL }, 3184, "udp" }, - { "smpppd", { NULL }, 3185, "tcp" }, - { "smpppd", { NULL }, 3185, "udp" }, - { "iiw-port", { NULL }, 3186, "tcp" }, - { "iiw-port", { NULL }, 3186, "udp" }, - { "odi-port", { NULL }, 3187, "tcp" }, - { "odi-port", { NULL }, 3187, "udp" }, - { "brcm-comm-port", { NULL }, 3188, "tcp" }, - { "brcm-comm-port", { NULL }, 3188, "udp" }, - { "pcle-infex", { NULL }, 3189, "tcp" }, - { "pcle-infex", { NULL }, 3189, "udp" }, - { "csvr-proxy", { NULL }, 3190, "tcp" }, - { "csvr-proxy", { NULL }, 3190, "udp" }, - { "csvr-sslproxy", { NULL }, 3191, "tcp" }, - { "csvr-sslproxy", { NULL }, 3191, "udp" }, - { "firemonrcc", { NULL }, 3192, "tcp" }, - { "firemonrcc", { NULL }, 3192, "udp" }, - { "spandataport", { NULL }, 3193, "tcp" }, - { "spandataport", { NULL }, 3193, "udp" }, - { "magbind", { NULL }, 3194, "tcp" }, - { "magbind", { NULL }, 3194, "udp" }, - { "ncu-1", { NULL }, 3195, "tcp" }, - { "ncu-1", { NULL }, 3195, "udp" }, - { "ncu-2", { NULL }, 3196, "tcp" }, - { "ncu-2", { NULL }, 3196, "udp" }, - { "embrace-dp-s", { NULL }, 3197, "tcp" }, - { "embrace-dp-s", { NULL }, 3197, "udp" }, - { "embrace-dp-c", { NULL }, 3198, "tcp" }, - { "embrace-dp-c", { NULL }, 3198, "udp" }, - { "dmod-workspace", { NULL }, 3199, "tcp" }, - { "dmod-workspace", { NULL }, 3199, "udp" }, - { "tick-port", { NULL }, 3200, "tcp" }, - { "tick-port", { NULL }, 3200, "udp" }, - { "cpq-tasksmart", { NULL }, 3201, "tcp" }, - { "cpq-tasksmart", { NULL }, 3201, "udp" }, - { "intraintra", { NULL }, 3202, "tcp" }, - { "intraintra", { NULL }, 3202, "udp" }, - { "netwatcher-mon", { NULL }, 3203, "tcp" }, - { "netwatcher-mon", { NULL }, 3203, "udp" }, - { "netwatcher-db", { NULL }, 3204, "tcp" }, - { "netwatcher-db", { NULL }, 3204, "udp" }, - { "isns", { NULL }, 3205, "tcp" }, - { "isns", { NULL }, 3205, "udp" }, - { "ironmail", { NULL }, 3206, "tcp" }, - { "ironmail", { NULL }, 3206, "udp" }, - { "vx-auth-port", { NULL }, 3207, "tcp" }, - { "vx-auth-port", { NULL }, 3207, "udp" }, - { "pfu-prcallback", { NULL }, 3208, "tcp" }, - { "pfu-prcallback", { NULL }, 3208, "udp" }, - { "netwkpathengine", { NULL }, 3209, "tcp" }, - { "netwkpathengine", { NULL }, 3209, "udp" }, - { "flamenco-proxy", { NULL }, 3210, "tcp" }, - { "flamenco-proxy", { NULL }, 3210, "udp" }, - { "avsecuremgmt", { NULL }, 3211, "tcp" }, - { "avsecuremgmt", { NULL }, 3211, "udp" }, - { "surveyinst", { NULL }, 3212, "tcp" }, - { "surveyinst", { NULL }, 3212, "udp" }, - { "neon24x7", { NULL }, 3213, "tcp" }, - { "neon24x7", { NULL }, 3213, "udp" }, - { "jmq-daemon-1", { NULL }, 3214, "tcp" }, - { "jmq-daemon-1", { NULL }, 3214, "udp" }, - { "jmq-daemon-2", { NULL }, 3215, "tcp" }, - { "jmq-daemon-2", { NULL }, 3215, "udp" }, - { "ferrari-foam", { NULL }, 3216, "tcp" }, - { "ferrari-foam", { NULL }, 3216, "udp" }, - { "unite", { NULL }, 3217, "tcp" }, - { "unite", { NULL }, 3217, "udp" }, - { "smartpackets", { NULL }, 3218, "tcp" }, - { "smartpackets", { NULL }, 3218, "udp" }, - { "wms-messenger", { NULL }, 3219, "tcp" }, - { "wms-messenger", { NULL }, 3219, "udp" }, - { "xnm-ssl", { NULL }, 3220, "tcp" }, - { "xnm-ssl", { NULL }, 3220, "udp" }, - { "xnm-clear-text", { NULL }, 3221, "tcp" }, - { "xnm-clear-text", { NULL }, 3221, "udp" }, - { "glbp", { NULL }, 3222, "tcp" }, - { "glbp", { NULL }, 3222, "udp" }, - { "digivote", { NULL }, 3223, "tcp" }, - { "digivote", { NULL }, 3223, "udp" }, - { "aes-discovery", { NULL }, 3224, "tcp" }, - { "aes-discovery", { NULL }, 3224, "udp" }, - { "fcip-port", { NULL }, 3225, "tcp" }, - { "fcip-port", { NULL }, 3225, "udp" }, - { "isi-irp", { NULL }, 3226, "tcp" }, - { "isi-irp", { NULL }, 3226, "udp" }, - { "dwnmshttp", { NULL }, 3227, "tcp" }, - { "dwnmshttp", { NULL }, 3227, "udp" }, - { "dwmsgserver", { NULL }, 3228, "tcp" }, - { "dwmsgserver", { NULL }, 3228, "udp" }, - { "global-cd-port", { NULL }, 3229, "tcp" }, - { "global-cd-port", { NULL }, 3229, "udp" }, - { "sftdst-port", { NULL }, 3230, "tcp" }, - { "sftdst-port", { NULL }, 3230, "udp" }, - { "vidigo", { NULL }, 3231, "tcp" }, - { "vidigo", { NULL }, 3231, "udp" }, - { "mdtp", { NULL }, 3232, "tcp" }, - { "mdtp", { NULL }, 3232, "udp" }, - { "whisker", { NULL }, 3233, "tcp" }, - { "whisker", { NULL }, 3233, "udp" }, - { "alchemy", { NULL }, 3234, "tcp" }, - { "alchemy", { NULL }, 3234, "udp" }, - { "mdap-port", { NULL }, 3235, "tcp" }, - { "mdap-port", { NULL }, 3235, "udp" }, - { "apparenet-ts", { NULL }, 3236, "tcp" }, - { "apparenet-ts", { NULL }, 3236, "udp" }, - { "apparenet-tps", { NULL }, 3237, "tcp" }, - { "apparenet-tps", { NULL }, 3237, "udp" }, - { "apparenet-as", { NULL }, 3238, "tcp" }, - { "apparenet-as", { NULL }, 3238, "udp" }, - { "apparenet-ui", { NULL }, 3239, "tcp" }, - { "apparenet-ui", { NULL }, 3239, "udp" }, - { "triomotion", { NULL }, 3240, "tcp" }, - { "triomotion", { NULL }, 3240, "udp" }, - { "sysorb", { NULL }, 3241, "tcp" }, - { "sysorb", { NULL }, 3241, "udp" }, - { "sdp-id-port", { NULL }, 3242, "tcp" }, - { "sdp-id-port", { NULL }, 3242, "udp" }, - { "timelot", { NULL }, 3243, "tcp" }, - { "timelot", { NULL }, 3243, "udp" }, - { "onesaf", { NULL }, 3244, "tcp" }, - { "onesaf", { NULL }, 3244, "udp" }, - { "vieo-fe", { NULL }, 3245, "tcp" }, - { "vieo-fe", { NULL }, 3245, "udp" }, - { "dvt-system", { NULL }, 3246, "tcp" }, - { "dvt-system", { NULL }, 3246, "udp" }, - { "dvt-data", { NULL }, 3247, "tcp" }, - { "dvt-data", { NULL }, 3247, "udp" }, - { "procos-lm", { NULL }, 3248, "tcp" }, - { "procos-lm", { NULL }, 3248, "udp" }, - { "ssp", { NULL }, 3249, "tcp" }, - { "ssp", { NULL }, 3249, "udp" }, - { "hicp", { NULL }, 3250, "tcp" }, - { "hicp", { NULL }, 3250, "udp" }, - { "sysscanner", { NULL }, 3251, "tcp" }, - { "sysscanner", { NULL }, 3251, "udp" }, - { "dhe", { NULL }, 3252, "tcp" }, - { "dhe", { NULL }, 3252, "udp" }, - { "pda-data", { NULL }, 3253, "tcp" }, - { "pda-data", { NULL }, 3253, "udp" }, - { "pda-sys", { NULL }, 3254, "tcp" }, - { "pda-sys", { NULL }, 3254, "udp" }, - { "semaphore", { NULL }, 3255, "tcp" }, - { "semaphore", { NULL }, 3255, "udp" }, - { "cpqrpm-agent", { NULL }, 3256, "tcp" }, - { "cpqrpm-agent", { NULL }, 3256, "udp" }, - { "cpqrpm-server", { NULL }, 3257, "tcp" }, - { "cpqrpm-server", { NULL }, 3257, "udp" }, - { "ivecon-port", { NULL }, 3258, "tcp" }, - { "ivecon-port", { NULL }, 3258, "udp" }, - { "epncdp2", { NULL }, 3259, "tcp" }, - { "epncdp2", { NULL }, 3259, "udp" }, - { "iscsi-target", { NULL }, 3260, "tcp" }, - { "iscsi-target", { NULL }, 3260, "udp" }, - { "winshadow", { NULL }, 3261, "tcp" }, - { "winshadow", { NULL }, 3261, "udp" }, - { "necp", { NULL }, 3262, "tcp" }, - { "necp", { NULL }, 3262, "udp" }, - { "ecolor-imager", { NULL }, 3263, "tcp" }, - { "ecolor-imager", { NULL }, 3263, "udp" }, - { "ccmail", { NULL }, 3264, "tcp" }, - { "ccmail", { NULL }, 3264, "udp" }, - { "altav-tunnel", { NULL }, 3265, "tcp" }, - { "altav-tunnel", { NULL }, 3265, "udp" }, - { "ns-cfg-server", { NULL }, 3266, "tcp" }, - { "ns-cfg-server", { NULL }, 3266, "udp" }, - { "ibm-dial-out", { NULL }, 3267, "tcp" }, - { "ibm-dial-out", { NULL }, 3267, "udp" }, - { "msft-gc", { NULL }, 3268, "tcp" }, - { "msft-gc", { NULL }, 3268, "udp" }, - { "msft-gc-ssl", { NULL }, 3269, "tcp" }, - { "msft-gc-ssl", { NULL }, 3269, "udp" }, - { "verismart", { NULL }, 3270, "tcp" }, - { "verismart", { NULL }, 3270, "udp" }, - { "csoft-prev", { NULL }, 3271, "tcp" }, - { "csoft-prev", { NULL }, 3271, "udp" }, - { "user-manager", { NULL }, 3272, "tcp" }, - { "user-manager", { NULL }, 3272, "udp" }, - { "sxmp", { NULL }, 3273, "tcp" }, - { "sxmp", { NULL }, 3273, "udp" }, - { "ordinox-server", { NULL }, 3274, "tcp" }, - { "ordinox-server", { NULL }, 3274, "udp" }, - { "samd", { NULL }, 3275, "tcp" }, - { "samd", { NULL }, 3275, "udp" }, - { "maxim-asics", { NULL }, 3276, "tcp" }, - { "maxim-asics", { NULL }, 3276, "udp" }, - { "awg-proxy", { NULL }, 3277, "tcp" }, - { "awg-proxy", { NULL }, 3277, "udp" }, - { "lkcmserver", { NULL }, 3278, "tcp" }, - { "lkcmserver", { NULL }, 3278, "udp" }, - { "admind", { NULL }, 3279, "tcp" }, - { "admind", { NULL }, 3279, "udp" }, - { "vs-server", { NULL }, 3280, "tcp" }, - { "vs-server", { NULL }, 3280, "udp" }, - { "sysopt", { NULL }, 3281, "tcp" }, - { "sysopt", { NULL }, 3281, "udp" }, - { "datusorb", { NULL }, 3282, "tcp" }, - { "datusorb", { NULL }, 3282, "udp" }, - { "net-assistant", { NULL }, 3283, "tcp" }, - { "net-assistant", { NULL }, 3283, "udp" }, - { "4talk", { NULL }, 3284, "tcp" }, - { "4talk", { NULL }, 3284, "udp" }, - { "plato", { NULL }, 3285, "tcp" }, - { "plato", { NULL }, 3285, "udp" }, - { "e-net", { NULL }, 3286, "tcp" }, - { "e-net", { NULL }, 3286, "udp" }, - { "directvdata", { NULL }, 3287, "tcp" }, - { "directvdata", { NULL }, 3287, "udp" }, - { "cops", { NULL }, 3288, "tcp" }, - { "cops", { NULL }, 3288, "udp" }, - { "enpc", { NULL }, 3289, "tcp" }, - { "enpc", { NULL }, 3289, "udp" }, - { "caps-lm", { NULL }, 3290, "tcp" }, - { "caps-lm", { NULL }, 3290, "udp" }, - { "sah-lm", { NULL }, 3291, "tcp" }, - { "sah-lm", { NULL }, 3291, "udp" }, - { "cart-o-rama", { NULL }, 3292, "tcp" }, - { "cart-o-rama", { NULL }, 3292, "udp" }, - { "fg-fps", { NULL }, 3293, "tcp" }, - { "fg-fps", { NULL }, 3293, "udp" }, - { "fg-gip", { NULL }, 3294, "tcp" }, - { "fg-gip", { NULL }, 3294, "udp" }, - { "dyniplookup", { NULL }, 3295, "tcp" }, - { "dyniplookup", { NULL }, 3295, "udp" }, - { "rib-slm", { NULL }, 3296, "tcp" }, - { "rib-slm", { NULL }, 3296, "udp" }, - { "cytel-lm", { NULL }, 3297, "tcp" }, - { "cytel-lm", { NULL }, 3297, "udp" }, - { "deskview", { NULL }, 3298, "tcp" }, - { "deskview", { NULL }, 3298, "udp" }, - { "pdrncs", { NULL }, 3299, "tcp" }, - { "pdrncs", { NULL }, 3299, "udp" }, - { "mcs-fastmail", { NULL }, 3302, "tcp" }, - { "mcs-fastmail", { NULL }, 3302, "udp" }, - { "opsession-clnt", { NULL }, 3303, "tcp" }, - { "opsession-clnt", { NULL }, 3303, "udp" }, - { "opsession-srvr", { NULL }, 3304, "tcp" }, - { "opsession-srvr", { NULL }, 3304, "udp" }, - { "odette-ftp", { NULL }, 3305, "tcp" }, - { "odette-ftp", { NULL }, 3305, "udp" }, - { "mysql", { NULL }, 3306, "tcp" }, - { "mysql", { NULL }, 3306, "udp" }, - { "opsession-prxy", { NULL }, 3307, "tcp" }, - { "opsession-prxy", { NULL }, 3307, "udp" }, - { "tns-server", { NULL }, 3308, "tcp" }, - { "tns-server", { NULL }, 3308, "udp" }, - { "tns-adv", { NULL }, 3309, "tcp" }, - { "tns-adv", { NULL }, 3309, "udp" }, - { "dyna-access", { NULL }, 3310, "tcp" }, - { "dyna-access", { NULL }, 3310, "udp" }, - { "mcns-tel-ret", { NULL }, 3311, "tcp" }, - { "mcns-tel-ret", { NULL }, 3311, "udp" }, - { "appman-server", { NULL }, 3312, "tcp" }, - { "appman-server", { NULL }, 3312, "udp" }, - { "uorb", { NULL }, 3313, "tcp" }, - { "uorb", { NULL }, 3313, "udp" }, - { "uohost", { NULL }, 3314, "tcp" }, - { "uohost", { NULL }, 3314, "udp" }, - { "cdid", { NULL }, 3315, "tcp" }, - { "cdid", { NULL }, 3315, "udp" }, - { "aicc-cmi", { NULL }, 3316, "tcp" }, - { "aicc-cmi", { NULL }, 3316, "udp" }, - { "vsaiport", { NULL }, 3317, "tcp" }, - { "vsaiport", { NULL }, 3317, "udp" }, - { "ssrip", { NULL }, 3318, "tcp" }, - { "ssrip", { NULL }, 3318, "udp" }, - { "sdt-lmd", { NULL }, 3319, "tcp" }, - { "sdt-lmd", { NULL }, 3319, "udp" }, - { "officelink2000", { NULL }, 3320, "tcp" }, - { "officelink2000", { NULL }, 3320, "udp" }, - { "vnsstr", { NULL }, 3321, "tcp" }, - { "vnsstr", { NULL }, 3321, "udp" }, - { "sftu", { NULL }, 3326, "tcp" }, - { "sftu", { NULL }, 3326, "udp" }, - { "bbars", { NULL }, 3327, "tcp" }, - { "bbars", { NULL }, 3327, "udp" }, - { "egptlm", { NULL }, 3328, "tcp" }, - { "egptlm", { NULL }, 3328, "udp" }, - { "hp-device-disc", { NULL }, 3329, "tcp" }, - { "hp-device-disc", { NULL }, 3329, "udp" }, - { "mcs-calypsoicf", { NULL }, 3330, "tcp" }, - { "mcs-calypsoicf", { NULL }, 3330, "udp" }, - { "mcs-messaging", { NULL }, 3331, "tcp" }, - { "mcs-messaging", { NULL }, 3331, "udp" }, - { "mcs-mailsvr", { NULL }, 3332, "tcp" }, - { "mcs-mailsvr", { NULL }, 3332, "udp" }, - { "dec-notes", { NULL }, 3333, "tcp" }, - { "dec-notes", { NULL }, 3333, "udp" }, - { "directv-web", { NULL }, 3334, "tcp" }, - { "directv-web", { NULL }, 3334, "udp" }, - { "directv-soft", { NULL }, 3335, "tcp" }, - { "directv-soft", { NULL }, 3335, "udp" }, - { "directv-tick", { NULL }, 3336, "tcp" }, - { "directv-tick", { NULL }, 3336, "udp" }, - { "directv-catlg", { NULL }, 3337, "tcp" }, - { "directv-catlg", { NULL }, 3337, "udp" }, - { "anet-b", { NULL }, 3338, "tcp" }, - { "anet-b", { NULL }, 3338, "udp" }, - { "anet-l", { NULL }, 3339, "tcp" }, - { "anet-l", { NULL }, 3339, "udp" }, - { "anet-m", { NULL }, 3340, "tcp" }, - { "anet-m", { NULL }, 3340, "udp" }, - { "anet-h", { NULL }, 3341, "tcp" }, - { "anet-h", { NULL }, 3341, "udp" }, - { "webtie", { NULL }, 3342, "tcp" }, - { "webtie", { NULL }, 3342, "udp" }, - { "ms-cluster-net", { NULL }, 3343, "tcp" }, - { "ms-cluster-net", { NULL }, 3343, "udp" }, - { "bnt-manager", { NULL }, 3344, "tcp" }, - { "bnt-manager", { NULL }, 3344, "udp" }, - { "influence", { NULL }, 3345, "tcp" }, - { "influence", { NULL }, 3345, "udp" }, - { "trnsprntproxy", { NULL }, 3346, "tcp" }, - { "trnsprntproxy", { NULL }, 3346, "udp" }, - { "phoenix-rpc", { NULL }, 3347, "tcp" }, - { "phoenix-rpc", { NULL }, 3347, "udp" }, - { "pangolin-laser", { NULL }, 3348, "tcp" }, - { "pangolin-laser", { NULL }, 3348, "udp" }, - { "chevinservices", { NULL }, 3349, "tcp" }, - { "chevinservices", { NULL }, 3349, "udp" }, - { "findviatv", { NULL }, 3350, "tcp" }, - { "findviatv", { NULL }, 3350, "udp" }, - { "btrieve", { NULL }, 3351, "tcp" }, - { "btrieve", { NULL }, 3351, "udp" }, - { "ssql", { NULL }, 3352, "tcp" }, - { "ssql", { NULL }, 3352, "udp" }, - { "fatpipe", { NULL }, 3353, "tcp" }, - { "fatpipe", { NULL }, 3353, "udp" }, - { "suitjd", { NULL }, 3354, "tcp" }, - { "suitjd", { NULL }, 3354, "udp" }, - { "ordinox-dbase", { NULL }, 3355, "tcp" }, - { "ordinox-dbase", { NULL }, 3355, "udp" }, - { "upnotifyps", { NULL }, 3356, "tcp" }, - { "upnotifyps", { NULL }, 3356, "udp" }, - { "adtech-test", { NULL }, 3357, "tcp" }, - { "adtech-test", { NULL }, 3357, "udp" }, - { "mpsysrmsvr", { NULL }, 3358, "tcp" }, - { "mpsysrmsvr", { NULL }, 3358, "udp" }, - { "wg-netforce", { NULL }, 3359, "tcp" }, - { "wg-netforce", { NULL }, 3359, "udp" }, - { "kv-server", { NULL }, 3360, "tcp" }, - { "kv-server", { NULL }, 3360, "udp" }, - { "kv-agent", { NULL }, 3361, "tcp" }, - { "kv-agent", { NULL }, 3361, "udp" }, - { "dj-ilm", { NULL }, 3362, "tcp" }, - { "dj-ilm", { NULL }, 3362, "udp" }, - { "nati-vi-server", { NULL }, 3363, "tcp" }, - { "nati-vi-server", { NULL }, 3363, "udp" }, - { "creativeserver", { NULL }, 3364, "tcp" }, - { "creativeserver", { NULL }, 3364, "udp" }, - { "contentserver", { NULL }, 3365, "tcp" }, - { "contentserver", { NULL }, 3365, "udp" }, - { "creativepartnr", { NULL }, 3366, "tcp" }, - { "creativepartnr", { NULL }, 3366, "udp" }, - { "tip2", { NULL }, 3372, "tcp" }, - { "tip2", { NULL }, 3372, "udp" }, - { "lavenir-lm", { NULL }, 3373, "tcp" }, - { "lavenir-lm", { NULL }, 3373, "udp" }, - { "cluster-disc", { NULL }, 3374, "tcp" }, - { "cluster-disc", { NULL }, 3374, "udp" }, - { "vsnm-agent", { NULL }, 3375, "tcp" }, - { "vsnm-agent", { NULL }, 3375, "udp" }, - { "cdbroker", { NULL }, 3376, "tcp" }, - { "cdbroker", { NULL }, 3376, "udp" }, - { "cogsys-lm", { NULL }, 3377, "tcp" }, - { "cogsys-lm", { NULL }, 3377, "udp" }, - { "wsicopy", { NULL }, 3378, "tcp" }, - { "wsicopy", { NULL }, 3378, "udp" }, - { "socorfs", { NULL }, 3379, "tcp" }, - { "socorfs", { NULL }, 3379, "udp" }, - { "sns-channels", { NULL }, 3380, "tcp" }, - { "sns-channels", { NULL }, 3380, "udp" }, - { "geneous", { NULL }, 3381, "tcp" }, - { "geneous", { NULL }, 3381, "udp" }, - { "fujitsu-neat", { NULL }, 3382, "tcp" }, - { "fujitsu-neat", { NULL }, 3382, "udp" }, - { "esp-lm", { NULL }, 3383, "tcp" }, - { "esp-lm", { NULL }, 3383, "udp" }, - { "hp-clic", { NULL }, 3384, "tcp" }, - { "hp-clic", { NULL }, 3384, "udp" }, - { "qnxnetman", { NULL }, 3385, "tcp" }, - { "qnxnetman", { NULL }, 3385, "udp" }, - { "gprs-data", { NULL }, 3386, "tcp" }, - { "gprs-sig", { NULL }, 3386, "udp" }, - { "backroomnet", { NULL }, 3387, "tcp" }, - { "backroomnet", { NULL }, 3387, "udp" }, - { "cbserver", { NULL }, 3388, "tcp" }, - { "cbserver", { NULL }, 3388, "udp" }, - { "ms-wbt-server", { NULL }, 3389, "tcp" }, - { "ms-wbt-server", { NULL }, 3389, "udp" }, - { "dsc", { NULL }, 3390, "tcp" }, - { "dsc", { NULL }, 3390, "udp" }, - { "savant", { NULL }, 3391, "tcp" }, - { "savant", { NULL }, 3391, "udp" }, - { "efi-lm", { NULL }, 3392, "tcp" }, - { "efi-lm", { NULL }, 3392, "udp" }, - { "d2k-tapestry1", { NULL }, 3393, "tcp" }, - { "d2k-tapestry1", { NULL }, 3393, "udp" }, - { "d2k-tapestry2", { NULL }, 3394, "tcp" }, - { "d2k-tapestry2", { NULL }, 3394, "udp" }, - { "dyna-lm", { NULL }, 3395, "tcp" }, - { "dyna-lm", { NULL }, 3395, "udp" }, - { "printer_agent", { NULL }, 3396, "tcp" }, - { "printer_agent", { NULL }, 3396, "udp" }, - { "cloanto-lm", { NULL }, 3397, "tcp" }, - { "cloanto-lm", { NULL }, 3397, "udp" }, - { "mercantile", { NULL }, 3398, "tcp" }, - { "mercantile", { NULL }, 3398, "udp" }, - { "csms", { NULL }, 3399, "tcp" }, - { "csms", { NULL }, 3399, "udp" }, - { "csms2", { NULL }, 3400, "tcp" }, - { "csms2", { NULL }, 3400, "udp" }, - { "filecast", { NULL }, 3401, "tcp" }, - { "filecast", { NULL }, 3401, "udp" }, - { "fxaengine-net", { NULL }, 3402, "tcp" }, - { "fxaengine-net", { NULL }, 3402, "udp" }, - { "nokia-ann-ch1", { NULL }, 3405, "tcp" }, - { "nokia-ann-ch1", { NULL }, 3405, "udp" }, - { "nokia-ann-ch2", { NULL }, 3406, "tcp" }, - { "nokia-ann-ch2", { NULL }, 3406, "udp" }, - { "ldap-admin", { NULL }, 3407, "tcp" }, - { "ldap-admin", { NULL }, 3407, "udp" }, - { "BESApi", { NULL }, 3408, "tcp" }, - { "BESApi", { NULL }, 3408, "udp" }, - { "networklens", { NULL }, 3409, "tcp" }, - { "networklens", { NULL }, 3409, "udp" }, - { "networklenss", { NULL }, 3410, "tcp" }, - { "networklenss", { NULL }, 3410, "udp" }, - { "biolink-auth", { NULL }, 3411, "tcp" }, - { "biolink-auth", { NULL }, 3411, "udp" }, - { "xmlblaster", { NULL }, 3412, "tcp" }, - { "xmlblaster", { NULL }, 3412, "udp" }, - { "svnet", { NULL }, 3413, "tcp" }, - { "svnet", { NULL }, 3413, "udp" }, - { "wip-port", { NULL }, 3414, "tcp" }, - { "wip-port", { NULL }, 3414, "udp" }, - { "bcinameservice", { NULL }, 3415, "tcp" }, - { "bcinameservice", { NULL }, 3415, "udp" }, - { "commandport", { NULL }, 3416, "tcp" }, - { "commandport", { NULL }, 3416, "udp" }, - { "csvr", { NULL }, 3417, "tcp" }, - { "csvr", { NULL }, 3417, "udp" }, - { "rnmap", { NULL }, 3418, "tcp" }, - { "rnmap", { NULL }, 3418, "udp" }, - { "softaudit", { NULL }, 3419, "tcp" }, - { "softaudit", { NULL }, 3419, "udp" }, - { "ifcp-port", { NULL }, 3420, "tcp" }, - { "ifcp-port", { NULL }, 3420, "udp" }, - { "bmap", { NULL }, 3421, "tcp" }, - { "bmap", { NULL }, 3421, "udp" }, - { "rusb-sys-port", { NULL }, 3422, "tcp" }, - { "rusb-sys-port", { NULL }, 3422, "udp" }, - { "xtrm", { NULL }, 3423, "tcp" }, - { "xtrm", { NULL }, 3423, "udp" }, - { "xtrms", { NULL }, 3424, "tcp" }, - { "xtrms", { NULL }, 3424, "udp" }, - { "agps-port", { NULL }, 3425, "tcp" }, - { "agps-port", { NULL }, 3425, "udp" }, - { "arkivio", { NULL }, 3426, "tcp" }, - { "arkivio", { NULL }, 3426, "udp" }, - { "websphere-snmp", { NULL }, 3427, "tcp" }, - { "websphere-snmp", { NULL }, 3427, "udp" }, - { "twcss", { NULL }, 3428, "tcp" }, - { "twcss", { NULL }, 3428, "udp" }, - { "gcsp", { NULL }, 3429, "tcp" }, - { "gcsp", { NULL }, 3429, "udp" }, - { "ssdispatch", { NULL }, 3430, "tcp" }, - { "ssdispatch", { NULL }, 3430, "udp" }, - { "ndl-als", { NULL }, 3431, "tcp" }, - { "ndl-als", { NULL }, 3431, "udp" }, - { "osdcp", { NULL }, 3432, "tcp" }, - { "osdcp", { NULL }, 3432, "udp" }, - { "alta-smp", { NULL }, 3433, "tcp" }, - { "alta-smp", { NULL }, 3433, "udp" }, - { "opencm", { NULL }, 3434, "tcp" }, - { "opencm", { NULL }, 3434, "udp" }, - { "pacom", { NULL }, 3435, "tcp" }, - { "pacom", { NULL }, 3435, "udp" }, - { "gc-config", { NULL }, 3436, "tcp" }, - { "gc-config", { NULL }, 3436, "udp" }, - { "autocueds", { NULL }, 3437, "tcp" }, - { "autocueds", { NULL }, 3437, "udp" }, - { "spiral-admin", { NULL }, 3438, "tcp" }, - { "spiral-admin", { NULL }, 3438, "udp" }, - { "hri-port", { NULL }, 3439, "tcp" }, - { "hri-port", { NULL }, 3439, "udp" }, - { "ans-console", { NULL }, 3440, "tcp" }, - { "ans-console", { NULL }, 3440, "udp" }, - { "connect-client", { NULL }, 3441, "tcp" }, - { "connect-client", { NULL }, 3441, "udp" }, - { "connect-server", { NULL }, 3442, "tcp" }, - { "connect-server", { NULL }, 3442, "udp" }, - { "ov-nnm-websrv", { NULL }, 3443, "tcp" }, - { "ov-nnm-websrv", { NULL }, 3443, "udp" }, - { "denali-server", { NULL }, 3444, "tcp" }, - { "denali-server", { NULL }, 3444, "udp" }, - { "monp", { NULL }, 3445, "tcp" }, - { "monp", { NULL }, 3445, "udp" }, - { "3comfaxrpc", { NULL }, 3446, "tcp" }, - { "3comfaxrpc", { NULL }, 3446, "udp" }, - { "directnet", { NULL }, 3447, "tcp" }, - { "directnet", { NULL }, 3447, "udp" }, - { "dnc-port", { NULL }, 3448, "tcp" }, - { "dnc-port", { NULL }, 3448, "udp" }, - { "hotu-chat", { NULL }, 3449, "tcp" }, - { "hotu-chat", { NULL }, 3449, "udp" }, - { "castorproxy", { NULL }, 3450, "tcp" }, - { "castorproxy", { NULL }, 3450, "udp" }, - { "asam", { NULL }, 3451, "tcp" }, - { "asam", { NULL }, 3451, "udp" }, - { "sabp-signal", { NULL }, 3452, "tcp" }, - { "sabp-signal", { NULL }, 3452, "udp" }, - { "pscupd", { NULL }, 3453, "tcp" }, - { "pscupd", { NULL }, 3453, "udp" }, - { "mira", { NULL }, 3454, "tcp" }, - { "prsvp", { NULL }, 3455, "tcp" }, - { "prsvp", { NULL }, 3455, "udp" }, - { "vat", { NULL }, 3456, "tcp" }, - { "vat", { NULL }, 3456, "udp" }, - { "vat-control", { NULL }, 3457, "tcp" }, - { "vat-control", { NULL }, 3457, "udp" }, - { "d3winosfi", { NULL }, 3458, "tcp" }, - { "d3winosfi", { NULL }, 3458, "udp" }, - { "integral", { NULL }, 3459, "tcp" }, - { "integral", { NULL }, 3459, "udp" }, - { "edm-manager", { NULL }, 3460, "tcp" }, - { "edm-manager", { NULL }, 3460, "udp" }, - { "edm-stager", { NULL }, 3461, "tcp" }, - { "edm-stager", { NULL }, 3461, "udp" }, - { "edm-std-notify", { NULL }, 3462, "tcp" }, - { "edm-std-notify", { NULL }, 3462, "udp" }, - { "edm-adm-notify", { NULL }, 3463, "tcp" }, - { "edm-adm-notify", { NULL }, 3463, "udp" }, - { "edm-mgr-sync", { NULL }, 3464, "tcp" }, - { "edm-mgr-sync", { NULL }, 3464, "udp" }, - { "edm-mgr-cntrl", { NULL }, 3465, "tcp" }, - { "edm-mgr-cntrl", { NULL }, 3465, "udp" }, - { "workflow", { NULL }, 3466, "tcp" }, - { "workflow", { NULL }, 3466, "udp" }, - { "rcst", { NULL }, 3467, "tcp" }, - { "rcst", { NULL }, 3467, "udp" }, - { "ttcmremotectrl", { NULL }, 3468, "tcp" }, - { "ttcmremotectrl", { NULL }, 3468, "udp" }, - { "pluribus", { NULL }, 3469, "tcp" }, - { "pluribus", { NULL }, 3469, "udp" }, - { "jt400", { NULL }, 3470, "tcp" }, - { "jt400", { NULL }, 3470, "udp" }, - { "jt400-ssl", { NULL }, 3471, "tcp" }, - { "jt400-ssl", { NULL }, 3471, "udp" }, - { "jaugsremotec-1", { NULL }, 3472, "tcp" }, - { "jaugsremotec-1", { NULL }, 3472, "udp" }, - { "jaugsremotec-2", { NULL }, 3473, "tcp" }, - { "jaugsremotec-2", { NULL }, 3473, "udp" }, - { "ttntspauto", { NULL }, 3474, "tcp" }, - { "ttntspauto", { NULL }, 3474, "udp" }, - { "genisar-port", { NULL }, 3475, "tcp" }, - { "genisar-port", { NULL }, 3475, "udp" }, - { "nppmp", { NULL }, 3476, "tcp" }, - { "nppmp", { NULL }, 3476, "udp" }, - { "ecomm", { NULL }, 3477, "tcp" }, - { "ecomm", { NULL }, 3477, "udp" }, - { "stun", { NULL }, 3478, "tcp" }, - { "stun", { NULL }, 3478, "udp" }, - { "turn", { NULL }, 3478, "tcp" }, - { "turn", { NULL }, 3478, "udp" }, - { "stun-behavior", { NULL }, 3478, "tcp" }, - { "stun-behavior", { NULL }, 3478, "udp" }, - { "twrpc", { NULL }, 3479, "tcp" }, - { "twrpc", { NULL }, 3479, "udp" }, - { "plethora", { NULL }, 3480, "tcp" }, - { "plethora", { NULL }, 3480, "udp" }, - { "cleanerliverc", { NULL }, 3481, "tcp" }, - { "cleanerliverc", { NULL }, 3481, "udp" }, - { "vulture", { NULL }, 3482, "tcp" }, - { "vulture", { NULL }, 3482, "udp" }, - { "slim-devices", { NULL }, 3483, "tcp" }, - { "slim-devices", { NULL }, 3483, "udp" }, - { "gbs-stp", { NULL }, 3484, "tcp" }, - { "gbs-stp", { NULL }, 3484, "udp" }, - { "celatalk", { NULL }, 3485, "tcp" }, - { "celatalk", { NULL }, 3485, "udp" }, - { "ifsf-hb-port", { NULL }, 3486, "tcp" }, - { "ifsf-hb-port", { NULL }, 3486, "udp" }, - { "ltctcp", { NULL }, 3487, "tcp" }, - { "ltcudp", { NULL }, 3487, "udp" }, - { "fs-rh-srv", { NULL }, 3488, "tcp" }, - { "fs-rh-srv", { NULL }, 3488, "udp" }, - { "dtp-dia", { NULL }, 3489, "tcp" }, - { "dtp-dia", { NULL }, 3489, "udp" }, - { "colubris", { NULL }, 3490, "tcp" }, - { "colubris", { NULL }, 3490, "udp" }, - { "swr-port", { NULL }, 3491, "tcp" }, - { "swr-port", { NULL }, 3491, "udp" }, - { "tvdumtray-port", { NULL }, 3492, "tcp" }, - { "tvdumtray-port", { NULL }, 3492, "udp" }, - { "nut", { NULL }, 3493, "tcp" }, - { "nut", { NULL }, 3493, "udp" }, - { "ibm3494", { NULL }, 3494, "tcp" }, - { "ibm3494", { NULL }, 3494, "udp" }, - { "seclayer-tcp", { NULL }, 3495, "tcp" }, - { "seclayer-tcp", { NULL }, 3495, "udp" }, - { "seclayer-tls", { NULL }, 3496, "tcp" }, - { "seclayer-tls", { NULL }, 3496, "udp" }, - { "ipether232port", { NULL }, 3497, "tcp" }, - { "ipether232port", { NULL }, 3497, "udp" }, - { "dashpas-port", { NULL }, 3498, "tcp" }, - { "dashpas-port", { NULL }, 3498, "udp" }, - { "sccip-media", { NULL }, 3499, "tcp" }, - { "sccip-media", { NULL }, 3499, "udp" }, - { "rtmp-port", { NULL }, 3500, "tcp" }, - { "rtmp-port", { NULL }, 3500, "udp" }, - { "isoft-p2p", { NULL }, 3501, "tcp" }, - { "isoft-p2p", { NULL }, 3501, "udp" }, - { "avinstalldisc", { NULL }, 3502, "tcp" }, - { "avinstalldisc", { NULL }, 3502, "udp" }, - { "lsp-ping", { NULL }, 3503, "tcp" }, - { "lsp-ping", { NULL }, 3503, "udp" }, - { "ironstorm", { NULL }, 3504, "tcp" }, - { "ironstorm", { NULL }, 3504, "udp" }, - { "ccmcomm", { NULL }, 3505, "tcp" }, - { "ccmcomm", { NULL }, 3505, "udp" }, - { "apc-3506", { NULL }, 3506, "tcp" }, - { "apc-3506", { NULL }, 3506, "udp" }, - { "nesh-broker", { NULL }, 3507, "tcp" }, - { "nesh-broker", { NULL }, 3507, "udp" }, - { "interactionweb", { NULL }, 3508, "tcp" }, - { "interactionweb", { NULL }, 3508, "udp" }, - { "vt-ssl", { NULL }, 3509, "tcp" }, - { "vt-ssl", { NULL }, 3509, "udp" }, - { "xss-port", { NULL }, 3510, "tcp" }, - { "xss-port", { NULL }, 3510, "udp" }, - { "webmail-2", { NULL }, 3511, "tcp" }, - { "webmail-2", { NULL }, 3511, "udp" }, - { "aztec", { NULL }, 3512, "tcp" }, - { "aztec", { NULL }, 3512, "udp" }, - { "arcpd", { NULL }, 3513, "tcp" }, - { "arcpd", { NULL }, 3513, "udp" }, - { "must-p2p", { NULL }, 3514, "tcp" }, - { "must-p2p", { NULL }, 3514, "udp" }, - { "must-backplane", { NULL }, 3515, "tcp" }, - { "must-backplane", { NULL }, 3515, "udp" }, - { "smartcard-port", { NULL }, 3516, "tcp" }, - { "smartcard-port", { NULL }, 3516, "udp" }, - { "802-11-iapp", { NULL }, 3517, "tcp" }, - { "802-11-iapp", { NULL }, 3517, "udp" }, - { "artifact-msg", { NULL }, 3518, "tcp" }, - { "artifact-msg", { NULL }, 3518, "udp" }, - { "nvmsgd", { NULL }, 3519, "tcp" }, - { "galileo", { NULL }, 3519, "udp" }, - { "galileolog", { NULL }, 3520, "tcp" }, - { "galileolog", { NULL }, 3520, "udp" }, - { "mc3ss", { NULL }, 3521, "tcp" }, - { "mc3ss", { NULL }, 3521, "udp" }, - { "nssocketport", { NULL }, 3522, "tcp" }, - { "nssocketport", { NULL }, 3522, "udp" }, - { "odeumservlink", { NULL }, 3523, "tcp" }, - { "odeumservlink", { NULL }, 3523, "udp" }, - { "ecmport", { NULL }, 3524, "tcp" }, - { "ecmport", { NULL }, 3524, "udp" }, - { "eisport", { NULL }, 3525, "tcp" }, - { "eisport", { NULL }, 3525, "udp" }, - { "starquiz-port", { NULL }, 3526, "tcp" }, - { "starquiz-port", { NULL }, 3526, "udp" }, - { "beserver-msg-q", { NULL }, 3527, "tcp" }, - { "beserver-msg-q", { NULL }, 3527, "udp" }, - { "jboss-iiop", { NULL }, 3528, "tcp" }, - { "jboss-iiop", { NULL }, 3528, "udp" }, - { "jboss-iiop-ssl", { NULL }, 3529, "tcp" }, - { "jboss-iiop-ssl", { NULL }, 3529, "udp" }, - { "gf", { NULL }, 3530, "tcp" }, - { "gf", { NULL }, 3530, "udp" }, - { "joltid", { NULL }, 3531, "tcp" }, - { "joltid", { NULL }, 3531, "udp" }, - { "raven-rmp", { NULL }, 3532, "tcp" }, - { "raven-rmp", { NULL }, 3532, "udp" }, - { "raven-rdp", { NULL }, 3533, "tcp" }, - { "raven-rdp", { NULL }, 3533, "udp" }, - { "urld-port", { NULL }, 3534, "tcp" }, - { "urld-port", { NULL }, 3534, "udp" }, - { "ms-la", { NULL }, 3535, "tcp" }, - { "ms-la", { NULL }, 3535, "udp" }, - { "snac", { NULL }, 3536, "tcp" }, - { "snac", { NULL }, 3536, "udp" }, - { "ni-visa-remote", { NULL }, 3537, "tcp" }, - { "ni-visa-remote", { NULL }, 3537, "udp" }, - { "ibm-diradm", { NULL }, 3538, "tcp" }, - { "ibm-diradm", { NULL }, 3538, "udp" }, - { "ibm-diradm-ssl", { NULL }, 3539, "tcp" }, - { "ibm-diradm-ssl", { NULL }, 3539, "udp" }, - { "pnrp-port", { NULL }, 3540, "tcp" }, - { "pnrp-port", { NULL }, 3540, "udp" }, - { "voispeed-port", { NULL }, 3541, "tcp" }, - { "voispeed-port", { NULL }, 3541, "udp" }, - { "hacl-monitor", { NULL }, 3542, "tcp" }, - { "hacl-monitor", { NULL }, 3542, "udp" }, - { "qftest-lookup", { NULL }, 3543, "tcp" }, - { "qftest-lookup", { NULL }, 3543, "udp" }, - { "teredo", { NULL }, 3544, "tcp" }, - { "teredo", { NULL }, 3544, "udp" }, - { "camac", { NULL }, 3545, "tcp" }, - { "camac", { NULL }, 3545, "udp" }, - { "symantec-sim", { NULL }, 3547, "tcp" }, - { "symantec-sim", { NULL }, 3547, "udp" }, - { "interworld", { NULL }, 3548, "tcp" }, - { "interworld", { NULL }, 3548, "udp" }, - { "tellumat-nms", { NULL }, 3549, "tcp" }, - { "tellumat-nms", { NULL }, 3549, "udp" }, - { "ssmpp", { NULL }, 3550, "tcp" }, - { "ssmpp", { NULL }, 3550, "udp" }, - { "apcupsd", { NULL }, 3551, "tcp" }, - { "apcupsd", { NULL }, 3551, "udp" }, - { "taserver", { NULL }, 3552, "tcp" }, - { "taserver", { NULL }, 3552, "udp" }, - { "rbr-discovery", { NULL }, 3553, "tcp" }, - { "rbr-discovery", { NULL }, 3553, "udp" }, - { "questnotify", { NULL }, 3554, "tcp" }, - { "questnotify", { NULL }, 3554, "udp" }, - { "razor", { NULL }, 3555, "tcp" }, - { "razor", { NULL }, 3555, "udp" }, - { "sky-transport", { NULL }, 3556, "tcp" }, - { "sky-transport", { NULL }, 3556, "udp" }, - { "personalos-001", { NULL }, 3557, "tcp" }, - { "personalos-001", { NULL }, 3557, "udp" }, - { "mcp-port", { NULL }, 3558, "tcp" }, - { "mcp-port", { NULL }, 3558, "udp" }, - { "cctv-port", { NULL }, 3559, "tcp" }, - { "cctv-port", { NULL }, 3559, "udp" }, - { "iniserve-port", { NULL }, 3560, "tcp" }, - { "iniserve-port", { NULL }, 3560, "udp" }, - { "bmc-onekey", { NULL }, 3561, "tcp" }, - { "bmc-onekey", { NULL }, 3561, "udp" }, - { "sdbproxy", { NULL }, 3562, "tcp" }, - { "sdbproxy", { NULL }, 3562, "udp" }, - { "watcomdebug", { NULL }, 3563, "tcp" }, - { "watcomdebug", { NULL }, 3563, "udp" }, - { "esimport", { NULL }, 3564, "tcp" }, - { "esimport", { NULL }, 3564, "udp" }, - { "m2pa", { NULL }, 3565, "tcp" }, - { "m2pa", { NULL }, 3565, "sctp" }, - { "quest-data-hub", { NULL }, 3566, "tcp" }, - { "oap", { NULL }, 3567, "tcp" }, - { "oap", { NULL }, 3567, "udp" }, - { "oap-s", { NULL }, 3568, "tcp" }, - { "oap-s", { NULL }, 3568, "udp" }, - { "mbg-ctrl", { NULL }, 3569, "tcp" }, - { "mbg-ctrl", { NULL }, 3569, "udp" }, - { "mccwebsvr-port", { NULL }, 3570, "tcp" }, - { "mccwebsvr-port", { NULL }, 3570, "udp" }, - { "megardsvr-port", { NULL }, 3571, "tcp" }, - { "megardsvr-port", { NULL }, 3571, "udp" }, - { "megaregsvrport", { NULL }, 3572, "tcp" }, - { "megaregsvrport", { NULL }, 3572, "udp" }, - { "tag-ups-1", { NULL }, 3573, "tcp" }, - { "tag-ups-1", { NULL }, 3573, "udp" }, - { "dmaf-server", { NULL }, 3574, "tcp" }, - { "dmaf-caster", { NULL }, 3574, "udp" }, - { "ccm-port", { NULL }, 3575, "tcp" }, - { "ccm-port", { NULL }, 3575, "udp" }, - { "cmc-port", { NULL }, 3576, "tcp" }, - { "cmc-port", { NULL }, 3576, "udp" }, - { "config-port", { NULL }, 3577, "tcp" }, - { "config-port", { NULL }, 3577, "udp" }, - { "data-port", { NULL }, 3578, "tcp" }, - { "data-port", { NULL }, 3578, "udp" }, - { "ttat3lb", { NULL }, 3579, "tcp" }, - { "ttat3lb", { NULL }, 3579, "udp" }, - { "nati-svrloc", { NULL }, 3580, "tcp" }, - { "nati-svrloc", { NULL }, 3580, "udp" }, - { "kfxaclicensing", { NULL }, 3581, "tcp" }, - { "kfxaclicensing", { NULL }, 3581, "udp" }, - { "press", { NULL }, 3582, "tcp" }, - { "press", { NULL }, 3582, "udp" }, - { "canex-watch", { NULL }, 3583, "tcp" }, - { "canex-watch", { NULL }, 3583, "udp" }, - { "u-dbap", { NULL }, 3584, "tcp" }, - { "u-dbap", { NULL }, 3584, "udp" }, - { "emprise-lls", { NULL }, 3585, "tcp" }, - { "emprise-lls", { NULL }, 3585, "udp" }, - { "emprise-lsc", { NULL }, 3586, "tcp" }, - { "emprise-lsc", { NULL }, 3586, "udp" }, - { "p2pgroup", { NULL }, 3587, "tcp" }, - { "p2pgroup", { NULL }, 3587, "udp" }, - { "sentinel", { NULL }, 3588, "tcp" }, - { "sentinel", { NULL }, 3588, "udp" }, - { "isomair", { NULL }, 3589, "tcp" }, - { "isomair", { NULL }, 3589, "udp" }, - { "wv-csp-sms", { NULL }, 3590, "tcp" }, - { "wv-csp-sms", { NULL }, 3590, "udp" }, - { "gtrack-server", { NULL }, 3591, "tcp" }, - { "gtrack-server", { NULL }, 3591, "udp" }, - { "gtrack-ne", { NULL }, 3592, "tcp" }, - { "gtrack-ne", { NULL }, 3592, "udp" }, - { "bpmd", { NULL }, 3593, "tcp" }, - { "bpmd", { NULL }, 3593, "udp" }, - { "mediaspace", { NULL }, 3594, "tcp" }, - { "mediaspace", { NULL }, 3594, "udp" }, - { "shareapp", { NULL }, 3595, "tcp" }, - { "shareapp", { NULL }, 3595, "udp" }, - { "iw-mmogame", { NULL }, 3596, "tcp" }, - { "iw-mmogame", { NULL }, 3596, "udp" }, - { "a14", { NULL }, 3597, "tcp" }, - { "a14", { NULL }, 3597, "udp" }, - { "a15", { NULL }, 3598, "tcp" }, - { "a15", { NULL }, 3598, "udp" }, - { "quasar-server", { NULL }, 3599, "tcp" }, - { "quasar-server", { NULL }, 3599, "udp" }, - { "trap-daemon", { NULL }, 3600, "tcp" }, - { "trap-daemon", { NULL }, 3600, "udp" }, - { "visinet-gui", { NULL }, 3601, "tcp" }, - { "visinet-gui", { NULL }, 3601, "udp" }, - { "infiniswitchcl", { NULL }, 3602, "tcp" }, - { "infiniswitchcl", { NULL }, 3602, "udp" }, - { "int-rcv-cntrl", { NULL }, 3603, "tcp" }, - { "int-rcv-cntrl", { NULL }, 3603, "udp" }, - { "bmc-jmx-port", { NULL }, 3604, "tcp" }, - { "bmc-jmx-port", { NULL }, 3604, "udp" }, - { "comcam-io", { NULL }, 3605, "tcp" }, - { "comcam-io", { NULL }, 3605, "udp" }, - { "splitlock", { NULL }, 3606, "tcp" }, - { "splitlock", { NULL }, 3606, "udp" }, - { "precise-i3", { NULL }, 3607, "tcp" }, - { "precise-i3", { NULL }, 3607, "udp" }, - { "trendchip-dcp", { NULL }, 3608, "tcp" }, - { "trendchip-dcp", { NULL }, 3608, "udp" }, - { "cpdi-pidas-cm", { NULL }, 3609, "tcp" }, - { "cpdi-pidas-cm", { NULL }, 3609, "udp" }, - { "echonet", { NULL }, 3610, "tcp" }, - { "echonet", { NULL }, 3610, "udp" }, - { "six-degrees", { NULL }, 3611, "tcp" }, - { "six-degrees", { NULL }, 3611, "udp" }, - { "hp-dataprotect", { NULL }, 3612, "tcp" }, - { "hp-dataprotect", { NULL }, 3612, "udp" }, - { "alaris-disc", { NULL }, 3613, "tcp" }, - { "alaris-disc", { NULL }, 3613, "udp" }, - { "sigma-port", { NULL }, 3614, "tcp" }, - { "sigma-port", { NULL }, 3614, "udp" }, - { "start-network", { NULL }, 3615, "tcp" }, - { "start-network", { NULL }, 3615, "udp" }, - { "cd3o-protocol", { NULL }, 3616, "tcp" }, - { "cd3o-protocol", { NULL }, 3616, "udp" }, - { "sharp-server", { NULL }, 3617, "tcp" }, - { "sharp-server", { NULL }, 3617, "udp" }, - { "aairnet-1", { NULL }, 3618, "tcp" }, - { "aairnet-1", { NULL }, 3618, "udp" }, - { "aairnet-2", { NULL }, 3619, "tcp" }, - { "aairnet-2", { NULL }, 3619, "udp" }, - { "ep-pcp", { NULL }, 3620, "tcp" }, - { "ep-pcp", { NULL }, 3620, "udp" }, - { "ep-nsp", { NULL }, 3621, "tcp" }, - { "ep-nsp", { NULL }, 3621, "udp" }, - { "ff-lr-port", { NULL }, 3622, "tcp" }, - { "ff-lr-port", { NULL }, 3622, "udp" }, - { "haipe-discover", { NULL }, 3623, "tcp" }, - { "haipe-discover", { NULL }, 3623, "udp" }, - { "dist-upgrade", { NULL }, 3624, "tcp" }, - { "dist-upgrade", { NULL }, 3624, "udp" }, - { "volley", { NULL }, 3625, "tcp" }, - { "volley", { NULL }, 3625, "udp" }, - { "bvcdaemon-port", { NULL }, 3626, "tcp" }, - { "bvcdaemon-port", { NULL }, 3626, "udp" }, - { "jamserverport", { NULL }, 3627, "tcp" }, - { "jamserverport", { NULL }, 3627, "udp" }, - { "ept-machine", { NULL }, 3628, "tcp" }, - { "ept-machine", { NULL }, 3628, "udp" }, - { "escvpnet", { NULL }, 3629, "tcp" }, - { "escvpnet", { NULL }, 3629, "udp" }, - { "cs-remote-db", { NULL }, 3630, "tcp" }, - { "cs-remote-db", { NULL }, 3630, "udp" }, - { "cs-services", { NULL }, 3631, "tcp" }, - { "cs-services", { NULL }, 3631, "udp" }, - { "distcc", { NULL }, 3632, "tcp" }, - { "distcc", { NULL }, 3632, "udp" }, - { "wacp", { NULL }, 3633, "tcp" }, - { "wacp", { NULL }, 3633, "udp" }, - { "hlibmgr", { NULL }, 3634, "tcp" }, - { "hlibmgr", { NULL }, 3634, "udp" }, - { "sdo", { NULL }, 3635, "tcp" }, - { "sdo", { NULL }, 3635, "udp" }, - { "servistaitsm", { NULL }, 3636, "tcp" }, - { "servistaitsm", { NULL }, 3636, "udp" }, - { "scservp", { NULL }, 3637, "tcp" }, - { "scservp", { NULL }, 3637, "udp" }, - { "ehp-backup", { NULL }, 3638, "tcp" }, - { "ehp-backup", { NULL }, 3638, "udp" }, - { "xap-ha", { NULL }, 3639, "tcp" }, - { "xap-ha", { NULL }, 3639, "udp" }, - { "netplay-port1", { NULL }, 3640, "tcp" }, - { "netplay-port1", { NULL }, 3640, "udp" }, - { "netplay-port2", { NULL }, 3641, "tcp" }, - { "netplay-port2", { NULL }, 3641, "udp" }, - { "juxml-port", { NULL }, 3642, "tcp" }, - { "juxml-port", { NULL }, 3642, "udp" }, - { "audiojuggler", { NULL }, 3643, "tcp" }, - { "audiojuggler", { NULL }, 3643, "udp" }, - { "ssowatch", { NULL }, 3644, "tcp" }, - { "ssowatch", { NULL }, 3644, "udp" }, - { "cyc", { NULL }, 3645, "tcp" }, - { "cyc", { NULL }, 3645, "udp" }, - { "xss-srv-port", { NULL }, 3646, "tcp" }, - { "xss-srv-port", { NULL }, 3646, "udp" }, - { "splitlock-gw", { NULL }, 3647, "tcp" }, - { "splitlock-gw", { NULL }, 3647, "udp" }, - { "fjcp", { NULL }, 3648, "tcp" }, - { "fjcp", { NULL }, 3648, "udp" }, - { "nmmp", { NULL }, 3649, "tcp" }, - { "nmmp", { NULL }, 3649, "udp" }, - { "prismiq-plugin", { NULL }, 3650, "tcp" }, - { "prismiq-plugin", { NULL }, 3650, "udp" }, - { "xrpc-registry", { NULL }, 3651, "tcp" }, - { "xrpc-registry", { NULL }, 3651, "udp" }, - { "vxcrnbuport", { NULL }, 3652, "tcp" }, - { "vxcrnbuport", { NULL }, 3652, "udp" }, - { "tsp", { NULL }, 3653, "tcp" }, - { "tsp", { NULL }, 3653, "udp" }, - { "vaprtm", { NULL }, 3654, "tcp" }, - { "vaprtm", { NULL }, 3654, "udp" }, - { "abatemgr", { NULL }, 3655, "tcp" }, - { "abatemgr", { NULL }, 3655, "udp" }, - { "abatjss", { NULL }, 3656, "tcp" }, - { "abatjss", { NULL }, 3656, "udp" }, - { "immedianet-bcn", { NULL }, 3657, "tcp" }, - { "immedianet-bcn", { NULL }, 3657, "udp" }, - { "ps-ams", { NULL }, 3658, "tcp" }, - { "ps-ams", { NULL }, 3658, "udp" }, - { "apple-sasl", { NULL }, 3659, "tcp" }, - { "apple-sasl", { NULL }, 3659, "udp" }, - { "can-nds-ssl", { NULL }, 3660, "tcp" }, - { "can-nds-ssl", { NULL }, 3660, "udp" }, - { "can-ferret-ssl", { NULL }, 3661, "tcp" }, - { "can-ferret-ssl", { NULL }, 3661, "udp" }, - { "pserver", { NULL }, 3662, "tcp" }, - { "pserver", { NULL }, 3662, "udp" }, - { "dtp", { NULL }, 3663, "tcp" }, - { "dtp", { NULL }, 3663, "udp" }, - { "ups-engine", { NULL }, 3664, "tcp" }, - { "ups-engine", { NULL }, 3664, "udp" }, - { "ent-engine", { NULL }, 3665, "tcp" }, - { "ent-engine", { NULL }, 3665, "udp" }, - { "eserver-pap", { NULL }, 3666, "tcp" }, - { "eserver-pap", { NULL }, 3666, "udp" }, - { "infoexch", { NULL }, 3667, "tcp" }, - { "infoexch", { NULL }, 3667, "udp" }, - { "dell-rm-port", { NULL }, 3668, "tcp" }, - { "dell-rm-port", { NULL }, 3668, "udp" }, - { "casanswmgmt", { NULL }, 3669, "tcp" }, - { "casanswmgmt", { NULL }, 3669, "udp" }, - { "smile", { NULL }, 3670, "tcp" }, - { "smile", { NULL }, 3670, "udp" }, - { "efcp", { NULL }, 3671, "tcp" }, - { "efcp", { NULL }, 3671, "udp" }, - { "lispworks-orb", { NULL }, 3672, "tcp" }, - { "lispworks-orb", { NULL }, 3672, "udp" }, - { "mediavault-gui", { NULL }, 3673, "tcp" }, - { "mediavault-gui", { NULL }, 3673, "udp" }, - { "wininstall-ipc", { NULL }, 3674, "tcp" }, - { "wininstall-ipc", { NULL }, 3674, "udp" }, - { "calltrax", { NULL }, 3675, "tcp" }, - { "calltrax", { NULL }, 3675, "udp" }, - { "va-pacbase", { NULL }, 3676, "tcp" }, - { "va-pacbase", { NULL }, 3676, "udp" }, - { "roverlog", { NULL }, 3677, "tcp" }, - { "roverlog", { NULL }, 3677, "udp" }, - { "ipr-dglt", { NULL }, 3678, "tcp" }, - { "ipr-dglt", { NULL }, 3678, "udp" }, - { "newton-dock", { NULL }, 3679, "tcp" }, - { "newton-dock", { NULL }, 3679, "udp" }, - { "npds-tracker", { NULL }, 3680, "tcp" }, - { "npds-tracker", { NULL }, 3680, "udp" }, - { "bts-x73", { NULL }, 3681, "tcp" }, - { "bts-x73", { NULL }, 3681, "udp" }, - { "cas-mapi", { NULL }, 3682, "tcp" }, - { "cas-mapi", { NULL }, 3682, "udp" }, - { "bmc-ea", { NULL }, 3683, "tcp" }, - { "bmc-ea", { NULL }, 3683, "udp" }, - { "faxstfx-port", { NULL }, 3684, "tcp" }, - { "faxstfx-port", { NULL }, 3684, "udp" }, - { "dsx-agent", { NULL }, 3685, "tcp" }, - { "dsx-agent", { NULL }, 3685, "udp" }, - { "tnmpv2", { NULL }, 3686, "tcp" }, - { "tnmpv2", { NULL }, 3686, "udp" }, - { "simple-push", { NULL }, 3687, "tcp" }, - { "simple-push", { NULL }, 3687, "udp" }, - { "simple-push-s", { NULL }, 3688, "tcp" }, - { "simple-push-s", { NULL }, 3688, "udp" }, - { "daap", { NULL }, 3689, "tcp" }, - { "daap", { NULL }, 3689, "udp" }, - { "svn", { NULL }, 3690, "tcp" }, - { "svn", { NULL }, 3690, "udp" }, - { "magaya-network", { NULL }, 3691, "tcp" }, - { "magaya-network", { NULL }, 3691, "udp" }, - { "intelsync", { NULL }, 3692, "tcp" }, - { "intelsync", { NULL }, 3692, "udp" }, - { "bmc-data-coll", { NULL }, 3695, "tcp" }, - { "bmc-data-coll", { NULL }, 3695, "udp" }, - { "telnetcpcd", { NULL }, 3696, "tcp" }, - { "telnetcpcd", { NULL }, 3696, "udp" }, - { "nw-license", { NULL }, 3697, "tcp" }, - { "nw-license", { NULL }, 3697, "udp" }, - { "sagectlpanel", { NULL }, 3698, "tcp" }, - { "sagectlpanel", { NULL }, 3698, "udp" }, - { "kpn-icw", { NULL }, 3699, "tcp" }, - { "kpn-icw", { NULL }, 3699, "udp" }, - { "lrs-paging", { NULL }, 3700, "tcp" }, - { "lrs-paging", { NULL }, 3700, "udp" }, - { "netcelera", { NULL }, 3701, "tcp" }, - { "netcelera", { NULL }, 3701, "udp" }, - { "ws-discovery", { NULL }, 3702, "tcp" }, - { "ws-discovery", { NULL }, 3702, "udp" }, - { "adobeserver-3", { NULL }, 3703, "tcp" }, - { "adobeserver-3", { NULL }, 3703, "udp" }, - { "adobeserver-4", { NULL }, 3704, "tcp" }, - { "adobeserver-4", { NULL }, 3704, "udp" }, - { "adobeserver-5", { NULL }, 3705, "tcp" }, - { "adobeserver-5", { NULL }, 3705, "udp" }, - { "rt-event", { NULL }, 3706, "tcp" }, - { "rt-event", { NULL }, 3706, "udp" }, - { "rt-event-s", { NULL }, 3707, "tcp" }, - { "rt-event-s", { NULL }, 3707, "udp" }, - { "sun-as-iiops", { NULL }, 3708, "tcp" }, - { "sun-as-iiops", { NULL }, 3708, "udp" }, - { "ca-idms", { NULL }, 3709, "tcp" }, - { "ca-idms", { NULL }, 3709, "udp" }, - { "portgate-auth", { NULL }, 3710, "tcp" }, - { "portgate-auth", { NULL }, 3710, "udp" }, - { "edb-server2", { NULL }, 3711, "tcp" }, - { "edb-server2", { NULL }, 3711, "udp" }, - { "sentinel-ent", { NULL }, 3712, "tcp" }, - { "sentinel-ent", { NULL }, 3712, "udp" }, - { "tftps", { NULL }, 3713, "tcp" }, - { "tftps", { NULL }, 3713, "udp" }, - { "delos-dms", { NULL }, 3714, "tcp" }, - { "delos-dms", { NULL }, 3714, "udp" }, - { "anoto-rendezv", { NULL }, 3715, "tcp" }, - { "anoto-rendezv", { NULL }, 3715, "udp" }, - { "wv-csp-sms-cir", { NULL }, 3716, "tcp" }, - { "wv-csp-sms-cir", { NULL }, 3716, "udp" }, - { "wv-csp-udp-cir", { NULL }, 3717, "tcp" }, - { "wv-csp-udp-cir", { NULL }, 3717, "udp" }, - { "opus-services", { NULL }, 3718, "tcp" }, - { "opus-services", { NULL }, 3718, "udp" }, - { "itelserverport", { NULL }, 3719, "tcp" }, - { "itelserverport", { NULL }, 3719, "udp" }, - { "ufastro-instr", { NULL }, 3720, "tcp" }, - { "ufastro-instr", { NULL }, 3720, "udp" }, - { "xsync", { NULL }, 3721, "tcp" }, - { "xsync", { NULL }, 3721, "udp" }, - { "xserveraid", { NULL }, 3722, "tcp" }, - { "xserveraid", { NULL }, 3722, "udp" }, - { "sychrond", { NULL }, 3723, "tcp" }, - { "sychrond", { NULL }, 3723, "udp" }, - { "blizwow", { NULL }, 3724, "tcp" }, - { "blizwow", { NULL }, 3724, "udp" }, - { "na-er-tip", { NULL }, 3725, "tcp" }, - { "na-er-tip", { NULL }, 3725, "udp" }, - { "array-manager", { NULL }, 3726, "tcp" }, - { "array-manager", { NULL }, 3726, "udp" }, - { "e-mdu", { NULL }, 3727, "tcp" }, - { "e-mdu", { NULL }, 3727, "udp" }, - { "e-woa", { NULL }, 3728, "tcp" }, - { "e-woa", { NULL }, 3728, "udp" }, - { "fksp-audit", { NULL }, 3729, "tcp" }, - { "fksp-audit", { NULL }, 3729, "udp" }, - { "client-ctrl", { NULL }, 3730, "tcp" }, - { "client-ctrl", { NULL }, 3730, "udp" }, - { "smap", { NULL }, 3731, "tcp" }, - { "smap", { NULL }, 3731, "udp" }, - { "m-wnn", { NULL }, 3732, "tcp" }, - { "m-wnn", { NULL }, 3732, "udp" }, - { "multip-msg", { NULL }, 3733, "tcp" }, - { "multip-msg", { NULL }, 3733, "udp" }, - { "synel-data", { NULL }, 3734, "tcp" }, - { "synel-data", { NULL }, 3734, "udp" }, - { "pwdis", { NULL }, 3735, "tcp" }, - { "pwdis", { NULL }, 3735, "udp" }, - { "rs-rmi", { NULL }, 3736, "tcp" }, - { "rs-rmi", { NULL }, 3736, "udp" }, - { "xpanel", { NULL }, 3737, "tcp" }, - { "versatalk", { NULL }, 3738, "tcp" }, - { "versatalk", { NULL }, 3738, "udp" }, - { "launchbird-lm", { NULL }, 3739, "tcp" }, - { "launchbird-lm", { NULL }, 3739, "udp" }, - { "heartbeat", { NULL }, 3740, "tcp" }, - { "heartbeat", { NULL }, 3740, "udp" }, - { "wysdma", { NULL }, 3741, "tcp" }, - { "wysdma", { NULL }, 3741, "udp" }, - { "cst-port", { NULL }, 3742, "tcp" }, - { "cst-port", { NULL }, 3742, "udp" }, - { "ipcs-command", { NULL }, 3743, "tcp" }, - { "ipcs-command", { NULL }, 3743, "udp" }, - { "sasg", { NULL }, 3744, "tcp" }, - { "sasg", { NULL }, 3744, "udp" }, - { "gw-call-port", { NULL }, 3745, "tcp" }, - { "gw-call-port", { NULL }, 3745, "udp" }, - { "linktest", { NULL }, 3746, "tcp" }, - { "linktest", { NULL }, 3746, "udp" }, - { "linktest-s", { NULL }, 3747, "tcp" }, - { "linktest-s", { NULL }, 3747, "udp" }, - { "webdata", { NULL }, 3748, "tcp" }, - { "webdata", { NULL }, 3748, "udp" }, - { "cimtrak", { NULL }, 3749, "tcp" }, - { "cimtrak", { NULL }, 3749, "udp" }, - { "cbos-ip-port", { NULL }, 3750, "tcp" }, - { "cbos-ip-port", { NULL }, 3750, "udp" }, - { "gprs-cube", { NULL }, 3751, "tcp" }, - { "gprs-cube", { NULL }, 3751, "udp" }, - { "vipremoteagent", { NULL }, 3752, "tcp" }, - { "vipremoteagent", { NULL }, 3752, "udp" }, - { "nattyserver", { NULL }, 3753, "tcp" }, - { "nattyserver", { NULL }, 3753, "udp" }, - { "timestenbroker", { NULL }, 3754, "tcp" }, - { "timestenbroker", { NULL }, 3754, "udp" }, - { "sas-remote-hlp", { NULL }, 3755, "tcp" }, - { "sas-remote-hlp", { NULL }, 3755, "udp" }, - { "canon-capt", { NULL }, 3756, "tcp" }, - { "canon-capt", { NULL }, 3756, "udp" }, - { "grf-port", { NULL }, 3757, "tcp" }, - { "grf-port", { NULL }, 3757, "udp" }, - { "apw-registry", { NULL }, 3758, "tcp" }, - { "apw-registry", { NULL }, 3758, "udp" }, - { "exapt-lmgr", { NULL }, 3759, "tcp" }, - { "exapt-lmgr", { NULL }, 3759, "udp" }, - { "adtempusclient", { NULL }, 3760, "tcp" }, - { "adtempusclient", { NULL }, 3760, "udp" }, - { "gsakmp", { NULL }, 3761, "tcp" }, - { "gsakmp", { NULL }, 3761, "udp" }, - { "gbs-smp", { NULL }, 3762, "tcp" }, - { "gbs-smp", { NULL }, 3762, "udp" }, - { "xo-wave", { NULL }, 3763, "tcp" }, - { "xo-wave", { NULL }, 3763, "udp" }, - { "mni-prot-rout", { NULL }, 3764, "tcp" }, - { "mni-prot-rout", { NULL }, 3764, "udp" }, - { "rtraceroute", { NULL }, 3765, "tcp" }, - { "rtraceroute", { NULL }, 3765, "udp" }, - { "listmgr-port", { NULL }, 3767, "tcp" }, - { "listmgr-port", { NULL }, 3767, "udp" }, - { "rblcheckd", { NULL }, 3768, "tcp" }, - { "rblcheckd", { NULL }, 3768, "udp" }, - { "haipe-otnk", { NULL }, 3769, "tcp" }, - { "haipe-otnk", { NULL }, 3769, "udp" }, - { "cindycollab", { NULL }, 3770, "tcp" }, - { "cindycollab", { NULL }, 3770, "udp" }, - { "paging-port", { NULL }, 3771, "tcp" }, - { "paging-port", { NULL }, 3771, "udp" }, - { "ctp", { NULL }, 3772, "tcp" }, - { "ctp", { NULL }, 3772, "udp" }, - { "ctdhercules", { NULL }, 3773, "tcp" }, - { "ctdhercules", { NULL }, 3773, "udp" }, - { "zicom", { NULL }, 3774, "tcp" }, - { "zicom", { NULL }, 3774, "udp" }, - { "ispmmgr", { NULL }, 3775, "tcp" }, - { "ispmmgr", { NULL }, 3775, "udp" }, - { "dvcprov-port", { NULL }, 3776, "tcp" }, - { "dvcprov-port", { NULL }, 3776, "udp" }, - { "jibe-eb", { NULL }, 3777, "tcp" }, - { "jibe-eb", { NULL }, 3777, "udp" }, - { "c-h-it-port", { NULL }, 3778, "tcp" }, - { "c-h-it-port", { NULL }, 3778, "udp" }, - { "cognima", { NULL }, 3779, "tcp" }, - { "cognima", { NULL }, 3779, "udp" }, - { "nnp", { NULL }, 3780, "tcp" }, - { "nnp", { NULL }, 3780, "udp" }, - { "abcvoice-port", { NULL }, 3781, "tcp" }, - { "abcvoice-port", { NULL }, 3781, "udp" }, - { "iso-tp0s", { NULL }, 3782, "tcp" }, - { "iso-tp0s", { NULL }, 3782, "udp" }, - { "bim-pem", { NULL }, 3783, "tcp" }, - { "bim-pem", { NULL }, 3783, "udp" }, - { "bfd-control", { NULL }, 3784, "tcp" }, - { "bfd-control", { NULL }, 3784, "udp" }, - { "bfd-echo", { NULL }, 3785, "tcp" }, - { "bfd-echo", { NULL }, 3785, "udp" }, - { "upstriggervsw", { NULL }, 3786, "tcp" }, - { "upstriggervsw", { NULL }, 3786, "udp" }, - { "fintrx", { NULL }, 3787, "tcp" }, - { "fintrx", { NULL }, 3787, "udp" }, - { "isrp-port", { NULL }, 3788, "tcp" }, - { "isrp-port", { NULL }, 3788, "udp" }, - { "remotedeploy", { NULL }, 3789, "tcp" }, - { "remotedeploy", { NULL }, 3789, "udp" }, - { "quickbooksrds", { NULL }, 3790, "tcp" }, - { "quickbooksrds", { NULL }, 3790, "udp" }, - { "tvnetworkvideo", { NULL }, 3791, "tcp" }, - { "tvnetworkvideo", { NULL }, 3791, "udp" }, - { "sitewatch", { NULL }, 3792, "tcp" }, - { "sitewatch", { NULL }, 3792, "udp" }, - { "dcsoftware", { NULL }, 3793, "tcp" }, - { "dcsoftware", { NULL }, 3793, "udp" }, - { "jaus", { NULL }, 3794, "tcp" }, - { "jaus", { NULL }, 3794, "udp" }, - { "myblast", { NULL }, 3795, "tcp" }, - { "myblast", { NULL }, 3795, "udp" }, - { "spw-dialer", { NULL }, 3796, "tcp" }, - { "spw-dialer", { NULL }, 3796, "udp" }, - { "idps", { NULL }, 3797, "tcp" }, - { "idps", { NULL }, 3797, "udp" }, - { "minilock", { NULL }, 3798, "tcp" }, - { "minilock", { NULL }, 3798, "udp" }, - { "radius-dynauth", { NULL }, 3799, "tcp" }, - { "radius-dynauth", { NULL }, 3799, "udp" }, - { "pwgpsi", { NULL }, 3800, "tcp" }, - { "pwgpsi", { NULL }, 3800, "udp" }, - { "ibm-mgr", { NULL }, 3801, "tcp" }, - { "ibm-mgr", { NULL }, 3801, "udp" }, - { "vhd", { NULL }, 3802, "tcp" }, - { "vhd", { NULL }, 3802, "udp" }, - { "soniqsync", { NULL }, 3803, "tcp" }, - { "soniqsync", { NULL }, 3803, "udp" }, - { "iqnet-port", { NULL }, 3804, "tcp" }, - { "iqnet-port", { NULL }, 3804, "udp" }, - { "tcpdataserver", { NULL }, 3805, "tcp" }, - { "tcpdataserver", { NULL }, 3805, "udp" }, - { "wsmlb", { NULL }, 3806, "tcp" }, - { "wsmlb", { NULL }, 3806, "udp" }, - { "spugna", { NULL }, 3807, "tcp" }, - { "spugna", { NULL }, 3807, "udp" }, - { "sun-as-iiops-ca", { NULL }, 3808, "tcp" }, - { "sun-as-iiops-ca", { NULL }, 3808, "udp" }, - { "apocd", { NULL }, 3809, "tcp" }, - { "apocd", { NULL }, 3809, "udp" }, - { "wlanauth", { NULL }, 3810, "tcp" }, - { "wlanauth", { NULL }, 3810, "udp" }, - { "amp", { NULL }, 3811, "tcp" }, - { "amp", { NULL }, 3811, "udp" }, - { "neto-wol-server", { NULL }, 3812, "tcp" }, - { "neto-wol-server", { NULL }, 3812, "udp" }, - { "rap-ip", { NULL }, 3813, "tcp" }, - { "rap-ip", { NULL }, 3813, "udp" }, - { "neto-dcs", { NULL }, 3814, "tcp" }, - { "neto-dcs", { NULL }, 3814, "udp" }, - { "lansurveyorxml", { NULL }, 3815, "tcp" }, - { "lansurveyorxml", { NULL }, 3815, "udp" }, - { "sunlps-http", { NULL }, 3816, "tcp" }, - { "sunlps-http", { NULL }, 3816, "udp" }, - { "tapeware", { NULL }, 3817, "tcp" }, - { "tapeware", { NULL }, 3817, "udp" }, - { "crinis-hb", { NULL }, 3818, "tcp" }, - { "crinis-hb", { NULL }, 3818, "udp" }, - { "epl-slp", { NULL }, 3819, "tcp" }, - { "epl-slp", { NULL }, 3819, "udp" }, - { "scp", { NULL }, 3820, "tcp" }, - { "scp", { NULL }, 3820, "udp" }, - { "pmcp", { NULL }, 3821, "tcp" }, - { "pmcp", { NULL }, 3821, "udp" }, - { "acp-discovery", { NULL }, 3822, "tcp" }, - { "acp-discovery", { NULL }, 3822, "udp" }, - { "acp-conduit", { NULL }, 3823, "tcp" }, - { "acp-conduit", { NULL }, 3823, "udp" }, - { "acp-policy", { NULL }, 3824, "tcp" }, - { "acp-policy", { NULL }, 3824, "udp" }, - { "ffserver", { NULL }, 3825, "tcp" }, - { "ffserver", { NULL }, 3825, "udp" }, - { "wormux", { NULL }, 3826, "tcp" }, - { "wormux", { NULL }, 3826, "udp" }, - { "netmpi", { NULL }, 3827, "tcp" }, - { "netmpi", { NULL }, 3827, "udp" }, - { "neteh", { NULL }, 3828, "tcp" }, - { "neteh", { NULL }, 3828, "udp" }, - { "neteh-ext", { NULL }, 3829, "tcp" }, - { "neteh-ext", { NULL }, 3829, "udp" }, - { "cernsysmgmtagt", { NULL }, 3830, "tcp" }, - { "cernsysmgmtagt", { NULL }, 3830, "udp" }, - { "dvapps", { NULL }, 3831, "tcp" }, - { "dvapps", { NULL }, 3831, "udp" }, - { "xxnetserver", { NULL }, 3832, "tcp" }, - { "xxnetserver", { NULL }, 3832, "udp" }, - { "aipn-auth", { NULL }, 3833, "tcp" }, - { "aipn-auth", { NULL }, 3833, "udp" }, - { "spectardata", { NULL }, 3834, "tcp" }, - { "spectardata", { NULL }, 3834, "udp" }, - { "spectardb", { NULL }, 3835, "tcp" }, - { "spectardb", { NULL }, 3835, "udp" }, - { "markem-dcp", { NULL }, 3836, "tcp" }, - { "markem-dcp", { NULL }, 3836, "udp" }, - { "mkm-discovery", { NULL }, 3837, "tcp" }, - { "mkm-discovery", { NULL }, 3837, "udp" }, - { "sos", { NULL }, 3838, "tcp" }, - { "sos", { NULL }, 3838, "udp" }, - { "amx-rms", { NULL }, 3839, "tcp" }, - { "amx-rms", { NULL }, 3839, "udp" }, - { "flirtmitmir", { NULL }, 3840, "tcp" }, - { "flirtmitmir", { NULL }, 3840, "udp" }, - { "zfirm-shiprush3", { NULL }, 3841, "tcp" }, - { "zfirm-shiprush3", { NULL }, 3841, "udp" }, - { "nhci", { NULL }, 3842, "tcp" }, - { "nhci", { NULL }, 3842, "udp" }, - { "quest-agent", { NULL }, 3843, "tcp" }, - { "quest-agent", { NULL }, 3843, "udp" }, - { "rnm", { NULL }, 3844, "tcp" }, - { "rnm", { NULL }, 3844, "udp" }, - { "v-one-spp", { NULL }, 3845, "tcp" }, - { "v-one-spp", { NULL }, 3845, "udp" }, - { "an-pcp", { NULL }, 3846, "tcp" }, - { "an-pcp", { NULL }, 3846, "udp" }, - { "msfw-control", { NULL }, 3847, "tcp" }, - { "msfw-control", { NULL }, 3847, "udp" }, - { "item", { NULL }, 3848, "tcp" }, - { "item", { NULL }, 3848, "udp" }, - { "spw-dnspreload", { NULL }, 3849, "tcp" }, - { "spw-dnspreload", { NULL }, 3849, "udp" }, - { "qtms-bootstrap", { NULL }, 3850, "tcp" }, - { "qtms-bootstrap", { NULL }, 3850, "udp" }, - { "spectraport", { NULL }, 3851, "tcp" }, - { "spectraport", { NULL }, 3851, "udp" }, - { "sse-app-config", { NULL }, 3852, "tcp" }, - { "sse-app-config", { NULL }, 3852, "udp" }, - { "sscan", { NULL }, 3853, "tcp" }, - { "sscan", { NULL }, 3853, "udp" }, - { "stryker-com", { NULL }, 3854, "tcp" }, - { "stryker-com", { NULL }, 3854, "udp" }, - { "opentrac", { NULL }, 3855, "tcp" }, - { "opentrac", { NULL }, 3855, "udp" }, - { "informer", { NULL }, 3856, "tcp" }, - { "informer", { NULL }, 3856, "udp" }, - { "trap-port", { NULL }, 3857, "tcp" }, - { "trap-port", { NULL }, 3857, "udp" }, - { "trap-port-mom", { NULL }, 3858, "tcp" }, - { "trap-port-mom", { NULL }, 3858, "udp" }, - { "nav-port", { NULL }, 3859, "tcp" }, - { "nav-port", { NULL }, 3859, "udp" }, - { "sasp", { NULL }, 3860, "tcp" }, - { "sasp", { NULL }, 3860, "udp" }, - { "winshadow-hd", { NULL }, 3861, "tcp" }, - { "winshadow-hd", { NULL }, 3861, "udp" }, - { "giga-pocket", { NULL }, 3862, "tcp" }, - { "giga-pocket", { NULL }, 3862, "udp" }, - { "asap-tcp", { NULL }, 3863, "tcp" }, - { "asap-udp", { NULL }, 3863, "udp" }, - { "asap-sctp", { NULL }, 3863, "sctp" }, - { "asap-tcp-tls", { NULL }, 3864, "tcp" }, - { "asap-sctp-tls", { NULL }, 3864, "sctp" }, - { "xpl", { NULL }, 3865, "tcp" }, - { "xpl", { NULL }, 3865, "udp" }, - { "dzdaemon", { NULL }, 3866, "tcp" }, - { "dzdaemon", { NULL }, 3866, "udp" }, - { "dzoglserver", { NULL }, 3867, "tcp" }, - { "dzoglserver", { NULL }, 3867, "udp" }, - { "diameter", { NULL }, 3868, "tcp" }, - { "diameter", { NULL }, 3868, "sctp" }, - { "ovsam-mgmt", { NULL }, 3869, "tcp" }, - { "ovsam-mgmt", { NULL }, 3869, "udp" }, - { "ovsam-d-agent", { NULL }, 3870, "tcp" }, - { "ovsam-d-agent", { NULL }, 3870, "udp" }, - { "avocent-adsap", { NULL }, 3871, "tcp" }, - { "avocent-adsap", { NULL }, 3871, "udp" }, - { "oem-agent", { NULL }, 3872, "tcp" }, - { "oem-agent", { NULL }, 3872, "udp" }, - { "fagordnc", { NULL }, 3873, "tcp" }, - { "fagordnc", { NULL }, 3873, "udp" }, - { "sixxsconfig", { NULL }, 3874, "tcp" }, - { "sixxsconfig", { NULL }, 3874, "udp" }, - { "pnbscada", { NULL }, 3875, "tcp" }, - { "pnbscada", { NULL }, 3875, "udp" }, - { "dl_agent", { NULL }, 3876, "tcp" }, - { "dl_agent", { NULL }, 3876, "udp" }, - { "xmpcr-interface", { NULL }, 3877, "tcp" }, - { "xmpcr-interface", { NULL }, 3877, "udp" }, - { "fotogcad", { NULL }, 3878, "tcp" }, - { "fotogcad", { NULL }, 3878, "udp" }, - { "appss-lm", { NULL }, 3879, "tcp" }, - { "appss-lm", { NULL }, 3879, "udp" }, - { "igrs", { NULL }, 3880, "tcp" }, - { "igrs", { NULL }, 3880, "udp" }, - { "idac", { NULL }, 3881, "tcp" }, - { "idac", { NULL }, 3881, "udp" }, - { "msdts1", { NULL }, 3882, "tcp" }, - { "msdts1", { NULL }, 3882, "udp" }, - { "vrpn", { NULL }, 3883, "tcp" }, - { "vrpn", { NULL }, 3883, "udp" }, - { "softrack-meter", { NULL }, 3884, "tcp" }, - { "softrack-meter", { NULL }, 3884, "udp" }, - { "topflow-ssl", { NULL }, 3885, "tcp" }, - { "topflow-ssl", { NULL }, 3885, "udp" }, - { "nei-management", { NULL }, 3886, "tcp" }, - { "nei-management", { NULL }, 3886, "udp" }, - { "ciphire-data", { NULL }, 3887, "tcp" }, - { "ciphire-data", { NULL }, 3887, "udp" }, - { "ciphire-serv", { NULL }, 3888, "tcp" }, - { "ciphire-serv", { NULL }, 3888, "udp" }, - { "dandv-tester", { NULL }, 3889, "tcp" }, - { "dandv-tester", { NULL }, 3889, "udp" }, - { "ndsconnect", { NULL }, 3890, "tcp" }, - { "ndsconnect", { NULL }, 3890, "udp" }, - { "rtc-pm-port", { NULL }, 3891, "tcp" }, - { "rtc-pm-port", { NULL }, 3891, "udp" }, - { "pcc-image-port", { NULL }, 3892, "tcp" }, - { "pcc-image-port", { NULL }, 3892, "udp" }, - { "cgi-starapi", { NULL }, 3893, "tcp" }, - { "cgi-starapi", { NULL }, 3893, "udp" }, - { "syam-agent", { NULL }, 3894, "tcp" }, - { "syam-agent", { NULL }, 3894, "udp" }, - { "syam-smc", { NULL }, 3895, "tcp" }, - { "syam-smc", { NULL }, 3895, "udp" }, - { "sdo-tls", { NULL }, 3896, "tcp" }, - { "sdo-tls", { NULL }, 3896, "udp" }, - { "sdo-ssh", { NULL }, 3897, "tcp" }, - { "sdo-ssh", { NULL }, 3897, "udp" }, - { "senip", { NULL }, 3898, "tcp" }, - { "senip", { NULL }, 3898, "udp" }, - { "itv-control", { NULL }, 3899, "tcp" }, - { "itv-control", { NULL }, 3899, "udp" }, - { "udt_os", { NULL }, 3900, "tcp" }, - { "udt_os", { NULL }, 3900, "udp" }, - { "nimsh", { NULL }, 3901, "tcp" }, - { "nimsh", { NULL }, 3901, "udp" }, - { "nimaux", { NULL }, 3902, "tcp" }, - { "nimaux", { NULL }, 3902, "udp" }, - { "charsetmgr", { NULL }, 3903, "tcp" }, - { "charsetmgr", { NULL }, 3903, "udp" }, - { "omnilink-port", { NULL }, 3904, "tcp" }, - { "omnilink-port", { NULL }, 3904, "udp" }, - { "mupdate", { NULL }, 3905, "tcp" }, - { "mupdate", { NULL }, 3905, "udp" }, - { "topovista-data", { NULL }, 3906, "tcp" }, - { "topovista-data", { NULL }, 3906, "udp" }, - { "imoguia-port", { NULL }, 3907, "tcp" }, - { "imoguia-port", { NULL }, 3907, "udp" }, - { "hppronetman", { NULL }, 3908, "tcp" }, - { "hppronetman", { NULL }, 3908, "udp" }, - { "surfcontrolcpa", { NULL }, 3909, "tcp" }, - { "surfcontrolcpa", { NULL }, 3909, "udp" }, - { "prnrequest", { NULL }, 3910, "tcp" }, - { "prnrequest", { NULL }, 3910, "udp" }, - { "prnstatus", { NULL }, 3911, "tcp" }, - { "prnstatus", { NULL }, 3911, "udp" }, - { "gbmt-stars", { NULL }, 3912, "tcp" }, - { "gbmt-stars", { NULL }, 3912, "udp" }, - { "listcrt-port", { NULL }, 3913, "tcp" }, - { "listcrt-port", { NULL }, 3913, "udp" }, - { "listcrt-port-2", { NULL }, 3914, "tcp" }, - { "listcrt-port-2", { NULL }, 3914, "udp" }, - { "agcat", { NULL }, 3915, "tcp" }, - { "agcat", { NULL }, 3915, "udp" }, - { "wysdmc", { NULL }, 3916, "tcp" }, - { "wysdmc", { NULL }, 3916, "udp" }, - { "aftmux", { NULL }, 3917, "tcp" }, - { "aftmux", { NULL }, 3917, "udp" }, - { "pktcablemmcops", { NULL }, 3918, "tcp" }, - { "pktcablemmcops", { NULL }, 3918, "udp" }, - { "hyperip", { NULL }, 3919, "tcp" }, - { "hyperip", { NULL }, 3919, "udp" }, - { "exasoftport1", { NULL }, 3920, "tcp" }, - { "exasoftport1", { NULL }, 3920, "udp" }, - { "herodotus-net", { NULL }, 3921, "tcp" }, - { "herodotus-net", { NULL }, 3921, "udp" }, - { "sor-update", { NULL }, 3922, "tcp" }, - { "sor-update", { NULL }, 3922, "udp" }, - { "symb-sb-port", { NULL }, 3923, "tcp" }, - { "symb-sb-port", { NULL }, 3923, "udp" }, - { "mpl-gprs-port", { NULL }, 3924, "tcp" }, - { "mpl-gprs-port", { NULL }, 3924, "udp" }, - { "zmp", { NULL }, 3925, "tcp" }, - { "zmp", { NULL }, 3925, "udp" }, - { "winport", { NULL }, 3926, "tcp" }, - { "winport", { NULL }, 3926, "udp" }, - { "natdataservice", { NULL }, 3927, "tcp" }, - { "natdataservice", { NULL }, 3927, "udp" }, - { "netboot-pxe", { NULL }, 3928, "tcp" }, - { "netboot-pxe", { NULL }, 3928, "udp" }, - { "smauth-port", { NULL }, 3929, "tcp" }, - { "smauth-port", { NULL }, 3929, "udp" }, - { "syam-webserver", { NULL }, 3930, "tcp" }, - { "syam-webserver", { NULL }, 3930, "udp" }, - { "msr-plugin-port", { NULL }, 3931, "tcp" }, - { "msr-plugin-port", { NULL }, 3931, "udp" }, - { "dyn-site", { NULL }, 3932, "tcp" }, - { "dyn-site", { NULL }, 3932, "udp" }, - { "plbserve-port", { NULL }, 3933, "tcp" }, - { "plbserve-port", { NULL }, 3933, "udp" }, - { "sunfm-port", { NULL }, 3934, "tcp" }, - { "sunfm-port", { NULL }, 3934, "udp" }, - { "sdp-portmapper", { NULL }, 3935, "tcp" }, - { "sdp-portmapper", { NULL }, 3935, "udp" }, - { "mailprox", { NULL }, 3936, "tcp" }, - { "mailprox", { NULL }, 3936, "udp" }, - { "dvbservdsc", { NULL }, 3937, "tcp" }, - { "dvbservdsc", { NULL }, 3937, "udp" }, - { "dbcontrol_agent", { NULL }, 3938, "tcp" }, - { "dbcontrol_agent", { NULL }, 3938, "udp" }, - { "aamp", { NULL }, 3939, "tcp" }, - { "aamp", { NULL }, 3939, "udp" }, - { "xecp-node", { NULL }, 3940, "tcp" }, - { "xecp-node", { NULL }, 3940, "udp" }, - { "homeportal-web", { NULL }, 3941, "tcp" }, - { "homeportal-web", { NULL }, 3941, "udp" }, - { "srdp", { NULL }, 3942, "tcp" }, - { "srdp", { NULL }, 3942, "udp" }, - { "tig", { NULL }, 3943, "tcp" }, - { "tig", { NULL }, 3943, "udp" }, - { "sops", { NULL }, 3944, "tcp" }, - { "sops", { NULL }, 3944, "udp" }, - { "emcads", { NULL }, 3945, "tcp" }, - { "emcads", { NULL }, 3945, "udp" }, - { "backupedge", { NULL }, 3946, "tcp" }, - { "backupedge", { NULL }, 3946, "udp" }, - { "ccp", { NULL }, 3947, "tcp" }, - { "ccp", { NULL }, 3947, "udp" }, - { "apdap", { NULL }, 3948, "tcp" }, - { "apdap", { NULL }, 3948, "udp" }, - { "drip", { NULL }, 3949, "tcp" }, - { "drip", { NULL }, 3949, "udp" }, - { "namemunge", { NULL }, 3950, "tcp" }, - { "namemunge", { NULL }, 3950, "udp" }, - { "pwgippfax", { NULL }, 3951, "tcp" }, - { "pwgippfax", { NULL }, 3951, "udp" }, - { "i3-sessionmgr", { NULL }, 3952, "tcp" }, - { "i3-sessionmgr", { NULL }, 3952, "udp" }, - { "xmlink-connect", { NULL }, 3953, "tcp" }, - { "xmlink-connect", { NULL }, 3953, "udp" }, - { "adrep", { NULL }, 3954, "tcp" }, - { "adrep", { NULL }, 3954, "udp" }, - { "p2pcommunity", { NULL }, 3955, "tcp" }, - { "p2pcommunity", { NULL }, 3955, "udp" }, - { "gvcp", { NULL }, 3956, "tcp" }, - { "gvcp", { NULL }, 3956, "udp" }, - { "mqe-broker", { NULL }, 3957, "tcp" }, - { "mqe-broker", { NULL }, 3957, "udp" }, - { "mqe-agent", { NULL }, 3958, "tcp" }, - { "mqe-agent", { NULL }, 3958, "udp" }, - { "treehopper", { NULL }, 3959, "tcp" }, - { "treehopper", { NULL }, 3959, "udp" }, - { "bess", { NULL }, 3960, "tcp" }, - { "bess", { NULL }, 3960, "udp" }, - { "proaxess", { NULL }, 3961, "tcp" }, - { "proaxess", { NULL }, 3961, "udp" }, - { "sbi-agent", { NULL }, 3962, "tcp" }, - { "sbi-agent", { NULL }, 3962, "udp" }, - { "thrp", { NULL }, 3963, "tcp" }, - { "thrp", { NULL }, 3963, "udp" }, - { "sasggprs", { NULL }, 3964, "tcp" }, - { "sasggprs", { NULL }, 3964, "udp" }, - { "ati-ip-to-ncpe", { NULL }, 3965, "tcp" }, - { "ati-ip-to-ncpe", { NULL }, 3965, "udp" }, - { "bflckmgr", { NULL }, 3966, "tcp" }, - { "bflckmgr", { NULL }, 3966, "udp" }, - { "ppsms", { NULL }, 3967, "tcp" }, - { "ppsms", { NULL }, 3967, "udp" }, - { "ianywhere-dbns", { NULL }, 3968, "tcp" }, - { "ianywhere-dbns", { NULL }, 3968, "udp" }, - { "landmarks", { NULL }, 3969, "tcp" }, - { "landmarks", { NULL }, 3969, "udp" }, - { "lanrevagent", { NULL }, 3970, "tcp" }, - { "lanrevagent", { NULL }, 3970, "udp" }, - { "lanrevserver", { NULL }, 3971, "tcp" }, - { "lanrevserver", { NULL }, 3971, "udp" }, - { "iconp", { NULL }, 3972, "tcp" }, - { "iconp", { NULL }, 3972, "udp" }, - { "progistics", { NULL }, 3973, "tcp" }, - { "progistics", { NULL }, 3973, "udp" }, - { "citysearch", { NULL }, 3974, "tcp" }, - { "citysearch", { NULL }, 3974, "udp" }, - { "airshot", { NULL }, 3975, "tcp" }, - { "airshot", { NULL }, 3975, "udp" }, - { "opswagent", { NULL }, 3976, "tcp" }, - { "opswagent", { NULL }, 3976, "udp" }, - { "opswmanager", { NULL }, 3977, "tcp" }, - { "opswmanager", { NULL }, 3977, "udp" }, - { "secure-cfg-svr", { NULL }, 3978, "tcp" }, - { "secure-cfg-svr", { NULL }, 3978, "udp" }, - { "smwan", { NULL }, 3979, "tcp" }, - { "smwan", { NULL }, 3979, "udp" }, - { "acms", { NULL }, 3980, "tcp" }, - { "acms", { NULL }, 3980, "udp" }, - { "starfish", { NULL }, 3981, "tcp" }, - { "starfish", { NULL }, 3981, "udp" }, - { "eis", { NULL }, 3982, "tcp" }, - { "eis", { NULL }, 3982, "udp" }, - { "eisp", { NULL }, 3983, "tcp" }, - { "eisp", { NULL }, 3983, "udp" }, - { "mapper-nodemgr", { NULL }, 3984, "tcp" }, - { "mapper-nodemgr", { NULL }, 3984, "udp" }, - { "mapper-mapethd", { NULL }, 3985, "tcp" }, - { "mapper-mapethd", { NULL }, 3985, "udp" }, - { "mapper-ws_ethd", { NULL }, 3986, "tcp" }, - { "mapper-ws_ethd", { NULL }, 3986, "udp" }, - { "centerline", { NULL }, 3987, "tcp" }, - { "centerline", { NULL }, 3987, "udp" }, - { "dcs-config", { NULL }, 3988, "tcp" }, - { "dcs-config", { NULL }, 3988, "udp" }, - { "bv-queryengine", { NULL }, 3989, "tcp" }, - { "bv-queryengine", { NULL }, 3989, "udp" }, - { "bv-is", { NULL }, 3990, "tcp" }, - { "bv-is", { NULL }, 3990, "udp" }, - { "bv-smcsrv", { NULL }, 3991, "tcp" }, - { "bv-smcsrv", { NULL }, 3991, "udp" }, - { "bv-ds", { NULL }, 3992, "tcp" }, - { "bv-ds", { NULL }, 3992, "udp" }, - { "bv-agent", { NULL }, 3993, "tcp" }, - { "bv-agent", { NULL }, 3993, "udp" }, - { "iss-mgmt-ssl", { NULL }, 3995, "tcp" }, - { "iss-mgmt-ssl", { NULL }, 3995, "udp" }, - { "abcsoftware", { NULL }, 3996, "tcp" }, - { "abcsoftware", { NULL }, 3996, "udp" }, - { "agentsease-db", { NULL }, 3997, "tcp" }, - { "agentsease-db", { NULL }, 3997, "udp" }, - { "dnx", { NULL }, 3998, "tcp" }, - { "dnx", { NULL }, 3998, "udp" }, - { "nvcnet", { NULL }, 3999, "tcp" }, - { "nvcnet", { NULL }, 3999, "udp" }, - { "terabase", { NULL }, 4000, "tcp" }, - { "terabase", { NULL }, 4000, "udp" }, - { "newoak", { NULL }, 4001, "tcp" }, - { "newoak", { NULL }, 4001, "udp" }, - { "pxc-spvr-ft", { NULL }, 4002, "tcp" }, - { "pxc-spvr-ft", { NULL }, 4002, "udp" }, - { "pxc-splr-ft", { NULL }, 4003, "tcp" }, - { "pxc-splr-ft", { NULL }, 4003, "udp" }, - { "pxc-roid", { NULL }, 4004, "tcp" }, - { "pxc-roid", { NULL }, 4004, "udp" }, - { "pxc-pin", { NULL }, 4005, "tcp" }, - { "pxc-pin", { NULL }, 4005, "udp" }, - { "pxc-spvr", { NULL }, 4006, "tcp" }, - { "pxc-spvr", { NULL }, 4006, "udp" }, - { "pxc-splr", { NULL }, 4007, "tcp" }, - { "pxc-splr", { NULL }, 4007, "udp" }, - { "netcheque", { NULL }, 4008, "tcp" }, - { "netcheque", { NULL }, 4008, "udp" }, - { "chimera-hwm", { NULL }, 4009, "tcp" }, - { "chimera-hwm", { NULL }, 4009, "udp" }, - { "samsung-unidex", { NULL }, 4010, "tcp" }, - { "samsung-unidex", { NULL }, 4010, "udp" }, - { "altserviceboot", { NULL }, 4011, "tcp" }, - { "altserviceboot", { NULL }, 4011, "udp" }, - { "pda-gate", { NULL }, 4012, "tcp" }, - { "pda-gate", { NULL }, 4012, "udp" }, - { "acl-manager", { NULL }, 4013, "tcp" }, - { "acl-manager", { NULL }, 4013, "udp" }, - { "taiclock", { NULL }, 4014, "tcp" }, - { "taiclock", { NULL }, 4014, "udp" }, - { "talarian-mcast1", { NULL }, 4015, "tcp" }, - { "talarian-mcast1", { NULL }, 4015, "udp" }, - { "talarian-mcast2", { NULL }, 4016, "tcp" }, - { "talarian-mcast2", { NULL }, 4016, "udp" }, - { "talarian-mcast3", { NULL }, 4017, "tcp" }, - { "talarian-mcast3", { NULL }, 4017, "udp" }, - { "talarian-mcast4", { NULL }, 4018, "tcp" }, - { "talarian-mcast4", { NULL }, 4018, "udp" }, - { "talarian-mcast5", { NULL }, 4019, "tcp" }, - { "talarian-mcast5", { NULL }, 4019, "udp" }, - { "trap", { NULL }, 4020, "tcp" }, - { "trap", { NULL }, 4020, "udp" }, - { "nexus-portal", { NULL }, 4021, "tcp" }, - { "nexus-portal", { NULL }, 4021, "udp" }, - { "dnox", { NULL }, 4022, "tcp" }, - { "dnox", { NULL }, 4022, "udp" }, - { "esnm-zoning", { NULL }, 4023, "tcp" }, - { "esnm-zoning", { NULL }, 4023, "udp" }, - { "tnp1-port", { NULL }, 4024, "tcp" }, - { "tnp1-port", { NULL }, 4024, "udp" }, - { "partimage", { NULL }, 4025, "tcp" }, - { "partimage", { NULL }, 4025, "udp" }, - { "as-debug", { NULL }, 4026, "tcp" }, - { "as-debug", { NULL }, 4026, "udp" }, - { "bxp", { NULL }, 4027, "tcp" }, - { "bxp", { NULL }, 4027, "udp" }, - { "dtserver-port", { NULL }, 4028, "tcp" }, - { "dtserver-port", { NULL }, 4028, "udp" }, - { "ip-qsig", { NULL }, 4029, "tcp" }, - { "ip-qsig", { NULL }, 4029, "udp" }, - { "jdmn-port", { NULL }, 4030, "tcp" }, - { "jdmn-port", { NULL }, 4030, "udp" }, - { "suucp", { NULL }, 4031, "tcp" }, - { "suucp", { NULL }, 4031, "udp" }, - { "vrts-auth-port", { NULL }, 4032, "tcp" }, - { "vrts-auth-port", { NULL }, 4032, "udp" }, - { "sanavigator", { NULL }, 4033, "tcp" }, - { "sanavigator", { NULL }, 4033, "udp" }, - { "ubxd", { NULL }, 4034, "tcp" }, - { "ubxd", { NULL }, 4034, "udp" }, - { "wap-push-http", { NULL }, 4035, "tcp" }, - { "wap-push-http", { NULL }, 4035, "udp" }, - { "wap-push-https", { NULL }, 4036, "tcp" }, - { "wap-push-https", { NULL }, 4036, "udp" }, - { "ravehd", { NULL }, 4037, "tcp" }, - { "ravehd", { NULL }, 4037, "udp" }, - { "fazzt-ptp", { NULL }, 4038, "tcp" }, - { "fazzt-ptp", { NULL }, 4038, "udp" }, - { "fazzt-admin", { NULL }, 4039, "tcp" }, - { "fazzt-admin", { NULL }, 4039, "udp" }, - { "yo-main", { NULL }, 4040, "tcp" }, - { "yo-main", { NULL }, 4040, "udp" }, - { "houston", { NULL }, 4041, "tcp" }, - { "houston", { NULL }, 4041, "udp" }, - { "ldxp", { NULL }, 4042, "tcp" }, - { "ldxp", { NULL }, 4042, "udp" }, - { "nirp", { NULL }, 4043, "tcp" }, - { "nirp", { NULL }, 4043, "udp" }, - { "ltp", { NULL }, 4044, "tcp" }, - { "ltp", { NULL }, 4044, "udp" }, - { "npp", { NULL }, 4045, "tcp" }, - { "npp", { NULL }, 4045, "udp" }, - { "acp-proto", { NULL }, 4046, "tcp" }, - { "acp-proto", { NULL }, 4046, "udp" }, - { "ctp-state", { NULL }, 4047, "tcp" }, - { "ctp-state", { NULL }, 4047, "udp" }, - { "wafs", { NULL }, 4049, "tcp" }, - { "wafs", { NULL }, 4049, "udp" }, - { "cisco-wafs", { NULL }, 4050, "tcp" }, - { "cisco-wafs", { NULL }, 4050, "udp" }, - { "cppdp", { NULL }, 4051, "tcp" }, - { "cppdp", { NULL }, 4051, "udp" }, - { "interact", { NULL }, 4052, "tcp" }, - { "interact", { NULL }, 4052, "udp" }, - { "ccu-comm-1", { NULL }, 4053, "tcp" }, - { "ccu-comm-1", { NULL }, 4053, "udp" }, - { "ccu-comm-2", { NULL }, 4054, "tcp" }, - { "ccu-comm-2", { NULL }, 4054, "udp" }, - { "ccu-comm-3", { NULL }, 4055, "tcp" }, - { "ccu-comm-3", { NULL }, 4055, "udp" }, - { "lms", { NULL }, 4056, "tcp" }, - { "lms", { NULL }, 4056, "udp" }, - { "wfm", { NULL }, 4057, "tcp" }, - { "wfm", { NULL }, 4057, "udp" }, - { "kingfisher", { NULL }, 4058, "tcp" }, - { "kingfisher", { NULL }, 4058, "udp" }, - { "dlms-cosem", { NULL }, 4059, "tcp" }, - { "dlms-cosem", { NULL }, 4059, "udp" }, - { "dsmeter_iatc", { NULL }, 4060, "tcp" }, - { "dsmeter_iatc", { NULL }, 4060, "udp" }, - { "ice-location", { NULL }, 4061, "tcp" }, - { "ice-location", { NULL }, 4061, "udp" }, - { "ice-slocation", { NULL }, 4062, "tcp" }, - { "ice-slocation", { NULL }, 4062, "udp" }, - { "ice-router", { NULL }, 4063, "tcp" }, - { "ice-router", { NULL }, 4063, "udp" }, - { "ice-srouter", { NULL }, 4064, "tcp" }, - { "ice-srouter", { NULL }, 4064, "udp" }, - { "avanti_cdp", { NULL }, 4065, "tcp" }, - { "avanti_cdp", { NULL }, 4065, "udp" }, - { "pmas", { NULL }, 4066, "tcp" }, - { "pmas", { NULL }, 4066, "udp" }, - { "idp", { NULL }, 4067, "tcp" }, - { "idp", { NULL }, 4067, "udp" }, - { "ipfltbcst", { NULL }, 4068, "tcp" }, - { "ipfltbcst", { NULL }, 4068, "udp" }, - { "minger", { NULL }, 4069, "tcp" }, - { "minger", { NULL }, 4069, "udp" }, - { "tripe", { NULL }, 4070, "tcp" }, - { "tripe", { NULL }, 4070, "udp" }, - { "aibkup", { NULL }, 4071, "tcp" }, - { "aibkup", { NULL }, 4071, "udp" }, - { "zieto-sock", { NULL }, 4072, "tcp" }, - { "zieto-sock", { NULL }, 4072, "udp" }, - { "iRAPP", { NULL }, 4073, "tcp" }, - { "iRAPP", { NULL }, 4073, "udp" }, - { "cequint-cityid", { NULL }, 4074, "tcp" }, - { "cequint-cityid", { NULL }, 4074, "udp" }, - { "perimlan", { NULL }, 4075, "tcp" }, - { "perimlan", { NULL }, 4075, "udp" }, - { "seraph", { NULL }, 4076, "tcp" }, - { "seraph", { NULL }, 4076, "udp" }, - { "ascomalarm", { NULL }, 4077, "udp" }, - { "cssp", { NULL }, 4078, "tcp" }, - { "santools", { NULL }, 4079, "tcp" }, - { "santools", { NULL }, 4079, "udp" }, - { "lorica-in", { NULL }, 4080, "tcp" }, - { "lorica-in", { NULL }, 4080, "udp" }, - { "lorica-in-sec", { NULL }, 4081, "tcp" }, - { "lorica-in-sec", { NULL }, 4081, "udp" }, - { "lorica-out", { NULL }, 4082, "tcp" }, - { "lorica-out", { NULL }, 4082, "udp" }, - { "lorica-out-sec", { NULL }, 4083, "tcp" }, - { "lorica-out-sec", { NULL }, 4083, "udp" }, - { "fortisphere-vm", { NULL }, 4084, "udp" }, - { "ezmessagesrv", { NULL }, 4085, "tcp" }, - { "ftsync", { NULL }, 4086, "udp" }, - { "applusservice", { NULL }, 4087, "tcp" }, - { "npsp", { NULL }, 4088, "tcp" }, - { "opencore", { NULL }, 4089, "tcp" }, - { "opencore", { NULL }, 4089, "udp" }, - { "omasgport", { NULL }, 4090, "tcp" }, - { "omasgport", { NULL }, 4090, "udp" }, - { "ewinstaller", { NULL }, 4091, "tcp" }, - { "ewinstaller", { NULL }, 4091, "udp" }, - { "ewdgs", { NULL }, 4092, "tcp" }, - { "ewdgs", { NULL }, 4092, "udp" }, - { "pvxpluscs", { NULL }, 4093, "tcp" }, - { "pvxpluscs", { NULL }, 4093, "udp" }, - { "sysrqd", { NULL }, 4094, "tcp" }, - { "sysrqd", { NULL }, 4094, "udp" }, - { "xtgui", { NULL }, 4095, "tcp" }, - { "xtgui", { NULL }, 4095, "udp" }, - { "bre", { NULL }, 4096, "tcp" }, - { "bre", { NULL }, 4096, "udp" }, - { "patrolview", { NULL }, 4097, "tcp" }, - { "patrolview", { NULL }, 4097, "udp" }, - { "drmsfsd", { NULL }, 4098, "tcp" }, - { "drmsfsd", { NULL }, 4098, "udp" }, - { "dpcp", { NULL }, 4099, "tcp" }, - { "dpcp", { NULL }, 4099, "udp" }, - { "igo-incognito", { NULL }, 4100, "tcp" }, - { "igo-incognito", { NULL }, 4100, "udp" }, - { "brlp-0", { NULL }, 4101, "tcp" }, - { "brlp-0", { NULL }, 4101, "udp" }, - { "brlp-1", { NULL }, 4102, "tcp" }, - { "brlp-1", { NULL }, 4102, "udp" }, - { "brlp-2", { NULL }, 4103, "tcp" }, - { "brlp-2", { NULL }, 4103, "udp" }, - { "brlp-3", { NULL }, 4104, "tcp" }, - { "brlp-3", { NULL }, 4104, "udp" }, - { "shofarplayer", { NULL }, 4105, "tcp" }, - { "shofarplayer", { NULL }, 4105, "udp" }, - { "synchronite", { NULL }, 4106, "tcp" }, - { "synchronite", { NULL }, 4106, "udp" }, - { "j-ac", { NULL }, 4107, "tcp" }, - { "j-ac", { NULL }, 4107, "udp" }, - { "accel", { NULL }, 4108, "tcp" }, - { "accel", { NULL }, 4108, "udp" }, - { "izm", { NULL }, 4109, "tcp" }, - { "izm", { NULL }, 4109, "udp" }, - { "g2tag", { NULL }, 4110, "tcp" }, - { "g2tag", { NULL }, 4110, "udp" }, - { "xgrid", { NULL }, 4111, "tcp" }, - { "xgrid", { NULL }, 4111, "udp" }, - { "apple-vpns-rp", { NULL }, 4112, "tcp" }, - { "apple-vpns-rp", { NULL }, 4112, "udp" }, - { "aipn-reg", { NULL }, 4113, "tcp" }, - { "aipn-reg", { NULL }, 4113, "udp" }, - { "jomamqmonitor", { NULL }, 4114, "tcp" }, - { "jomamqmonitor", { NULL }, 4114, "udp" }, - { "cds", { NULL }, 4115, "tcp" }, - { "cds", { NULL }, 4115, "udp" }, - { "smartcard-tls", { NULL }, 4116, "tcp" }, - { "smartcard-tls", { NULL }, 4116, "udp" }, - { "hillrserv", { NULL }, 4117, "tcp" }, - { "hillrserv", { NULL }, 4117, "udp" }, - { "netscript", { NULL }, 4118, "tcp" }, - { "netscript", { NULL }, 4118, "udp" }, - { "assuria-slm", { NULL }, 4119, "tcp" }, - { "assuria-slm", { NULL }, 4119, "udp" }, - { "e-builder", { NULL }, 4121, "tcp" }, - { "e-builder", { NULL }, 4121, "udp" }, - { "fprams", { NULL }, 4122, "tcp" }, - { "fprams", { NULL }, 4122, "udp" }, - { "z-wave", { NULL }, 4123, "tcp" }, - { "z-wave", { NULL }, 4123, "udp" }, - { "tigv2", { NULL }, 4124, "tcp" }, - { "tigv2", { NULL }, 4124, "udp" }, - { "opsview-envoy", { NULL }, 4125, "tcp" }, - { "opsview-envoy", { NULL }, 4125, "udp" }, - { "ddrepl", { NULL }, 4126, "tcp" }, - { "ddrepl", { NULL }, 4126, "udp" }, - { "unikeypro", { NULL }, 4127, "tcp" }, - { "unikeypro", { NULL }, 4127, "udp" }, - { "nufw", { NULL }, 4128, "tcp" }, - { "nufw", { NULL }, 4128, "udp" }, - { "nuauth", { NULL }, 4129, "tcp" }, - { "nuauth", { NULL }, 4129, "udp" }, - { "fronet", { NULL }, 4130, "tcp" }, - { "fronet", { NULL }, 4130, "udp" }, - { "stars", { NULL }, 4131, "tcp" }, - { "stars", { NULL }, 4131, "udp" }, - { "nuts_dem", { NULL }, 4132, "tcp" }, - { "nuts_dem", { NULL }, 4132, "udp" }, - { "nuts_bootp", { NULL }, 4133, "tcp" }, - { "nuts_bootp", { NULL }, 4133, "udp" }, - { "nifty-hmi", { NULL }, 4134, "tcp" }, - { "nifty-hmi", { NULL }, 4134, "udp" }, - { "cl-db-attach", { NULL }, 4135, "tcp" }, - { "cl-db-attach", { NULL }, 4135, "udp" }, - { "cl-db-request", { NULL }, 4136, "tcp" }, - { "cl-db-request", { NULL }, 4136, "udp" }, - { "cl-db-remote", { NULL }, 4137, "tcp" }, - { "cl-db-remote", { NULL }, 4137, "udp" }, - { "nettest", { NULL }, 4138, "tcp" }, - { "nettest", { NULL }, 4138, "udp" }, - { "thrtx", { NULL }, 4139, "tcp" }, - { "thrtx", { NULL }, 4139, "udp" }, - { "cedros_fds", { NULL }, 4140, "tcp" }, - { "cedros_fds", { NULL }, 4140, "udp" }, - { "oirtgsvc", { NULL }, 4141, "tcp" }, - { "oirtgsvc", { NULL }, 4141, "udp" }, - { "oidocsvc", { NULL }, 4142, "tcp" }, - { "oidocsvc", { NULL }, 4142, "udp" }, - { "oidsr", { NULL }, 4143, "tcp" }, - { "oidsr", { NULL }, 4143, "udp" }, - { "vvr-control", { NULL }, 4145, "tcp" }, - { "vvr-control", { NULL }, 4145, "udp" }, - { "tgcconnect", { NULL }, 4146, "tcp" }, - { "tgcconnect", { NULL }, 4146, "udp" }, - { "vrxpservman", { NULL }, 4147, "tcp" }, - { "vrxpservman", { NULL }, 4147, "udp" }, - { "hhb-handheld", { NULL }, 4148, "tcp" }, - { "hhb-handheld", { NULL }, 4148, "udp" }, - { "agslb", { NULL }, 4149, "tcp" }, - { "agslb", { NULL }, 4149, "udp" }, - { "PowerAlert-nsa", { NULL }, 4150, "tcp" }, - { "PowerAlert-nsa", { NULL }, 4150, "udp" }, - { "menandmice_noh", { NULL }, 4151, "tcp" }, - { "menandmice_noh", { NULL }, 4151, "udp" }, - { "idig_mux", { NULL }, 4152, "tcp" }, - { "idig_mux", { NULL }, 4152, "udp" }, - { "mbl-battd", { NULL }, 4153, "tcp" }, - { "mbl-battd", { NULL }, 4153, "udp" }, - { "atlinks", { NULL }, 4154, "tcp" }, - { "atlinks", { NULL }, 4154, "udp" }, - { "bzr", { NULL }, 4155, "tcp" }, - { "bzr", { NULL }, 4155, "udp" }, - { "stat-results", { NULL }, 4156, "tcp" }, - { "stat-results", { NULL }, 4156, "udp" }, - { "stat-scanner", { NULL }, 4157, "tcp" }, - { "stat-scanner", { NULL }, 4157, "udp" }, - { "stat-cc", { NULL }, 4158, "tcp" }, - { "stat-cc", { NULL }, 4158, "udp" }, - { "nss", { NULL }, 4159, "tcp" }, - { "nss", { NULL }, 4159, "udp" }, - { "jini-discovery", { NULL }, 4160, "tcp" }, - { "jini-discovery", { NULL }, 4160, "udp" }, - { "omscontact", { NULL }, 4161, "tcp" }, - { "omscontact", { NULL }, 4161, "udp" }, - { "omstopology", { NULL }, 4162, "tcp" }, - { "omstopology", { NULL }, 4162, "udp" }, - { "silverpeakpeer", { NULL }, 4163, "tcp" }, - { "silverpeakpeer", { NULL }, 4163, "udp" }, - { "silverpeakcomm", { NULL }, 4164, "tcp" }, - { "silverpeakcomm", { NULL }, 4164, "udp" }, - { "altcp", { NULL }, 4165, "tcp" }, - { "altcp", { NULL }, 4165, "udp" }, - { "joost", { NULL }, 4166, "tcp" }, - { "joost", { NULL }, 4166, "udp" }, - { "ddgn", { NULL }, 4167, "tcp" }, - { "ddgn", { NULL }, 4167, "udp" }, - { "pslicser", { NULL }, 4168, "tcp" }, - { "pslicser", { NULL }, 4168, "udp" }, - { "iadt", { NULL }, 4169, "tcp" }, - { "iadt-disc", { NULL }, 4169, "udp" }, - { "d-cinema-csp", { NULL }, 4170, "tcp" }, - { "ml-svnet", { NULL }, 4171, "tcp" }, - { "pcoip", { NULL }, 4172, "tcp" }, - { "pcoip", { NULL }, 4172, "udp" }, - { "smcluster", { NULL }, 4174, "tcp" }, - { "bccp", { NULL }, 4175, "tcp" }, - { "tl-ipcproxy", { NULL }, 4176, "tcp" }, - { "wello", { NULL }, 4177, "tcp" }, - { "wello", { NULL }, 4177, "udp" }, - { "storman", { NULL }, 4178, "tcp" }, - { "storman", { NULL }, 4178, "udp" }, - { "MaxumSP", { NULL }, 4179, "tcp" }, - { "MaxumSP", { NULL }, 4179, "udp" }, - { "httpx", { NULL }, 4180, "tcp" }, - { "httpx", { NULL }, 4180, "udp" }, - { "macbak", { NULL }, 4181, "tcp" }, - { "macbak", { NULL }, 4181, "udp" }, - { "pcptcpservice", { NULL }, 4182, "tcp" }, - { "pcptcpservice", { NULL }, 4182, "udp" }, - { "gmmp", { NULL }, 4183, "tcp" }, - { "gmmp", { NULL }, 4183, "udp" }, - { "universe_suite", { NULL }, 4184, "tcp" }, - { "universe_suite", { NULL }, 4184, "udp" }, - { "wcpp", { NULL }, 4185, "tcp" }, - { "wcpp", { NULL }, 4185, "udp" }, - { "boxbackupstore", { NULL }, 4186, "tcp" }, - { "csc_proxy", { NULL }, 4187, "tcp" }, - { "vatata", { NULL }, 4188, "tcp" }, - { "vatata", { NULL }, 4188, "udp" }, - { "pcep", { NULL }, 4189, "tcp" }, - { "sieve", { NULL }, 4190, "tcp" }, - { "dsmipv6", { NULL }, 4191, "udp" }, - { "azeti", { NULL }, 4192, "tcp" }, - { "azeti-bd", { NULL }, 4192, "udp" }, - { "pvxplusio", { NULL }, 4193, "tcp" }, - { "eims-admin", { NULL }, 4199, "tcp" }, - { "eims-admin", { NULL }, 4199, "udp" }, - { "corelccam", { NULL }, 4300, "tcp" }, - { "corelccam", { NULL }, 4300, "udp" }, - { "d-data", { NULL }, 4301, "tcp" }, - { "d-data", { NULL }, 4301, "udp" }, - { "d-data-control", { NULL }, 4302, "tcp" }, - { "d-data-control", { NULL }, 4302, "udp" }, - { "srcp", { NULL }, 4303, "tcp" }, - { "srcp", { NULL }, 4303, "udp" }, - { "owserver", { NULL }, 4304, "tcp" }, - { "owserver", { NULL }, 4304, "udp" }, - { "batman", { NULL }, 4305, "tcp" }, - { "batman", { NULL }, 4305, "udp" }, - { "pinghgl", { NULL }, 4306, "tcp" }, - { "pinghgl", { NULL }, 4306, "udp" }, - { "visicron-vs", { NULL }, 4307, "tcp" }, - { "visicron-vs", { NULL }, 4307, "udp" }, - { "compx-lockview", { NULL }, 4308, "tcp" }, - { "compx-lockview", { NULL }, 4308, "udp" }, - { "dserver", { NULL }, 4309, "tcp" }, - { "dserver", { NULL }, 4309, "udp" }, - { "mirrtex", { NULL }, 4310, "tcp" }, - { "mirrtex", { NULL }, 4310, "udp" }, - { "p6ssmc", { NULL }, 4311, "tcp" }, - { "pscl-mgt", { NULL }, 4312, "tcp" }, - { "perrla", { NULL }, 4313, "tcp" }, - { "fdt-rcatp", { NULL }, 4320, "tcp" }, - { "fdt-rcatp", { NULL }, 4320, "udp" }, - { "rwhois", { NULL }, 4321, "tcp" }, - { "rwhois", { NULL }, 4321, "udp" }, - { "trim-event", { NULL }, 4322, "tcp" }, - { "trim-event", { NULL }, 4322, "udp" }, - { "trim-ice", { NULL }, 4323, "tcp" }, - { "trim-ice", { NULL }, 4323, "udp" }, - { "balour", { NULL }, 4324, "tcp" }, - { "balour", { NULL }, 4324, "udp" }, - { "geognosisman", { NULL }, 4325, "tcp" }, - { "geognosisman", { NULL }, 4325, "udp" }, - { "geognosis", { NULL }, 4326, "tcp" }, - { "geognosis", { NULL }, 4326, "udp" }, - { "jaxer-web", { NULL }, 4327, "tcp" }, - { "jaxer-web", { NULL }, 4327, "udp" }, - { "jaxer-manager", { NULL }, 4328, "tcp" }, - { "jaxer-manager", { NULL }, 4328, "udp" }, - { "publiqare-sync", { NULL }, 4329, "tcp" }, - { "gaia", { NULL }, 4340, "tcp" }, - { "gaia", { NULL }, 4340, "udp" }, - { "lisp-data", { NULL }, 4341, "tcp" }, - { "lisp-data", { NULL }, 4341, "udp" }, - { "lisp-cons", { NULL }, 4342, "tcp" }, - { "lisp-control", { NULL }, 4342, "udp" }, - { "unicall", { NULL }, 4343, "tcp" }, - { "unicall", { NULL }, 4343, "udp" }, - { "vinainstall", { NULL }, 4344, "tcp" }, - { "vinainstall", { NULL }, 4344, "udp" }, - { "m4-network-as", { NULL }, 4345, "tcp" }, - { "m4-network-as", { NULL }, 4345, "udp" }, - { "elanlm", { NULL }, 4346, "tcp" }, - { "elanlm", { NULL }, 4346, "udp" }, - { "lansurveyor", { NULL }, 4347, "tcp" }, - { "lansurveyor", { NULL }, 4347, "udp" }, - { "itose", { NULL }, 4348, "tcp" }, - { "itose", { NULL }, 4348, "udp" }, - { "fsportmap", { NULL }, 4349, "tcp" }, - { "fsportmap", { NULL }, 4349, "udp" }, - { "net-device", { NULL }, 4350, "tcp" }, - { "net-device", { NULL }, 4350, "udp" }, - { "plcy-net-svcs", { NULL }, 4351, "tcp" }, - { "plcy-net-svcs", { NULL }, 4351, "udp" }, - { "pjlink", { NULL }, 4352, "tcp" }, - { "pjlink", { NULL }, 4352, "udp" }, - { "f5-iquery", { NULL }, 4353, "tcp" }, - { "f5-iquery", { NULL }, 4353, "udp" }, - { "qsnet-trans", { NULL }, 4354, "tcp" }, - { "qsnet-trans", { NULL }, 4354, "udp" }, - { "qsnet-workst", { NULL }, 4355, "tcp" }, - { "qsnet-workst", { NULL }, 4355, "udp" }, - { "qsnet-assist", { NULL }, 4356, "tcp" }, - { "qsnet-assist", { NULL }, 4356, "udp" }, - { "qsnet-cond", { NULL }, 4357, "tcp" }, - { "qsnet-cond", { NULL }, 4357, "udp" }, - { "qsnet-nucl", { NULL }, 4358, "tcp" }, - { "qsnet-nucl", { NULL }, 4358, "udp" }, - { "omabcastltkm", { NULL }, 4359, "tcp" }, - { "omabcastltkm", { NULL }, 4359, "udp" }, - { "matrix_vnet", { NULL }, 4360, "tcp" }, - { "nacnl", { NULL }, 4361, "udp" }, - { "afore-vdp-disc", { NULL }, 4362, "udp" }, - { "wxbrief", { NULL }, 4368, "tcp" }, - { "wxbrief", { NULL }, 4368, "udp" }, - { "epmd", { NULL }, 4369, "tcp" }, - { "epmd", { NULL }, 4369, "udp" }, - { "elpro_tunnel", { NULL }, 4370, "tcp" }, - { "elpro_tunnel", { NULL }, 4370, "udp" }, - { "l2c-control", { NULL }, 4371, "tcp" }, - { "l2c-disc", { NULL }, 4371, "udp" }, - { "l2c-data", { NULL }, 4372, "tcp" }, - { "l2c-data", { NULL }, 4372, "udp" }, - { "remctl", { NULL }, 4373, "tcp" }, - { "remctl", { NULL }, 4373, "udp" }, - { "psi-ptt", { NULL }, 4374, "tcp" }, - { "tolteces", { NULL }, 4375, "tcp" }, - { "tolteces", { NULL }, 4375, "udp" }, - { "bip", { NULL }, 4376, "tcp" }, - { "bip", { NULL }, 4376, "udp" }, - { "cp-spxsvr", { NULL }, 4377, "tcp" }, - { "cp-spxsvr", { NULL }, 4377, "udp" }, - { "cp-spxdpy", { NULL }, 4378, "tcp" }, - { "cp-spxdpy", { NULL }, 4378, "udp" }, - { "ctdb", { NULL }, 4379, "tcp" }, - { "ctdb", { NULL }, 4379, "udp" }, - { "xandros-cms", { NULL }, 4389, "tcp" }, - { "xandros-cms", { NULL }, 4389, "udp" }, - { "wiegand", { NULL }, 4390, "tcp" }, - { "wiegand", { NULL }, 4390, "udp" }, - { "apwi-imserver", { NULL }, 4391, "tcp" }, - { "apwi-rxserver", { NULL }, 4392, "tcp" }, - { "apwi-rxspooler", { NULL }, 4393, "tcp" }, - { "apwi-disc", { NULL }, 4394, "udp" }, - { "omnivisionesx", { NULL }, 4395, "tcp" }, - { "omnivisionesx", { NULL }, 4395, "udp" }, - { "fly", { NULL }, 4396, "tcp" }, - { "ds-srv", { NULL }, 4400, "tcp" }, - { "ds-srv", { NULL }, 4400, "udp" }, - { "ds-srvr", { NULL }, 4401, "tcp" }, - { "ds-srvr", { NULL }, 4401, "udp" }, - { "ds-clnt", { NULL }, 4402, "tcp" }, - { "ds-clnt", { NULL }, 4402, "udp" }, - { "ds-user", { NULL }, 4403, "tcp" }, - { "ds-user", { NULL }, 4403, "udp" }, - { "ds-admin", { NULL }, 4404, "tcp" }, - { "ds-admin", { NULL }, 4404, "udp" }, - { "ds-mail", { NULL }, 4405, "tcp" }, - { "ds-mail", { NULL }, 4405, "udp" }, - { "ds-slp", { NULL }, 4406, "tcp" }, - { "ds-slp", { NULL }, 4406, "udp" }, - { "nacagent", { NULL }, 4407, "tcp" }, - { "slscc", { NULL }, 4408, "tcp" }, - { "netcabinet-com", { NULL }, 4409, "tcp" }, - { "itwo-server", { NULL }, 4410, "tcp" }, - { "netrockey6", { NULL }, 4425, "tcp" }, - { "netrockey6", { NULL }, 4425, "udp" }, - { "beacon-port-2", { NULL }, 4426, "tcp" }, - { "beacon-port-2", { NULL }, 4426, "udp" }, - { "drizzle", { NULL }, 4427, "tcp" }, - { "omviserver", { NULL }, 4428, "tcp" }, - { "omviagent", { NULL }, 4429, "tcp" }, - { "rsqlserver", { NULL }, 4430, "tcp" }, - { "rsqlserver", { NULL }, 4430, "udp" }, - { "wspipe", { NULL }, 4431, "tcp" }, - { "netblox", { NULL }, 4441, "udp" }, - { "saris", { NULL }, 4442, "tcp" }, - { "saris", { NULL }, 4442, "udp" }, - { "pharos", { NULL }, 4443, "tcp" }, - { "pharos", { NULL }, 4443, "udp" }, - { "krb524", { NULL }, 4444, "tcp" }, - { "krb524", { NULL }, 4444, "udp" }, - { "nv-video", { NULL }, 4444, "tcp" }, - { "nv-video", { NULL }, 4444, "udp" }, - { "upnotifyp", { NULL }, 4445, "tcp" }, - { "upnotifyp", { NULL }, 4445, "udp" }, - { "n1-fwp", { NULL }, 4446, "tcp" }, - { "n1-fwp", { NULL }, 4446, "udp" }, - { "n1-rmgmt", { NULL }, 4447, "tcp" }, - { "n1-rmgmt", { NULL }, 4447, "udp" }, - { "asc-slmd", { NULL }, 4448, "tcp" }, - { "asc-slmd", { NULL }, 4448, "udp" }, - { "privatewire", { NULL }, 4449, "tcp" }, - { "privatewire", { NULL }, 4449, "udp" }, - { "camp", { NULL }, 4450, "tcp" }, - { "camp", { NULL }, 4450, "udp" }, - { "ctisystemmsg", { NULL }, 4451, "tcp" }, - { "ctisystemmsg", { NULL }, 4451, "udp" }, - { "ctiprogramload", { NULL }, 4452, "tcp" }, - { "ctiprogramload", { NULL }, 4452, "udp" }, - { "nssalertmgr", { NULL }, 4453, "tcp" }, - { "nssalertmgr", { NULL }, 4453, "udp" }, - { "nssagentmgr", { NULL }, 4454, "tcp" }, - { "nssagentmgr", { NULL }, 4454, "udp" }, - { "prchat-user", { NULL }, 4455, "tcp" }, - { "prchat-user", { NULL }, 4455, "udp" }, - { "prchat-server", { NULL }, 4456, "tcp" }, - { "prchat-server", { NULL }, 4456, "udp" }, - { "prRegister", { NULL }, 4457, "tcp" }, - { "prRegister", { NULL }, 4457, "udp" }, - { "mcp", { NULL }, 4458, "tcp" }, - { "mcp", { NULL }, 4458, "udp" }, - { "hpssmgmt", { NULL }, 4484, "tcp" }, - { "hpssmgmt", { NULL }, 4484, "udp" }, - { "assyst-dr", { NULL }, 4485, "tcp" }, - { "icms", { NULL }, 4486, "tcp" }, - { "icms", { NULL }, 4486, "udp" }, - { "prex-tcp", { NULL }, 4487, "tcp" }, - { "awacs-ice", { NULL }, 4488, "tcp" }, - { "awacs-ice", { NULL }, 4488, "udp" }, - { "ipsec-nat-t", { NULL }, 4500, "tcp" }, - { "ipsec-nat-t", { NULL }, 4500, "udp" }, - { "ehs", { NULL }, 4535, "tcp" }, - { "ehs", { NULL }, 4535, "udp" }, - { "ehs-ssl", { NULL }, 4536, "tcp" }, - { "ehs-ssl", { NULL }, 4536, "udp" }, - { "wssauthsvc", { NULL }, 4537, "tcp" }, - { "wssauthsvc", { NULL }, 4537, "udp" }, - { "swx-gate", { NULL }, 4538, "tcp" }, - { "swx-gate", { NULL }, 4538, "udp" }, - { "worldscores", { NULL }, 4545, "tcp" }, - { "worldscores", { NULL }, 4545, "udp" }, - { "sf-lm", { NULL }, 4546, "tcp" }, - { "sf-lm", { NULL }, 4546, "udp" }, - { "lanner-lm", { NULL }, 4547, "tcp" }, - { "lanner-lm", { NULL }, 4547, "udp" }, - { "synchromesh", { NULL }, 4548, "tcp" }, - { "synchromesh", { NULL }, 4548, "udp" }, - { "aegate", { NULL }, 4549, "tcp" }, - { "aegate", { NULL }, 4549, "udp" }, - { "gds-adppiw-db", { NULL }, 4550, "tcp" }, - { "gds-adppiw-db", { NULL }, 4550, "udp" }, - { "ieee-mih", { NULL }, 4551, "tcp" }, - { "ieee-mih", { NULL }, 4551, "udp" }, - { "menandmice-mon", { NULL }, 4552, "tcp" }, - { "menandmice-mon", { NULL }, 4552, "udp" }, - { "icshostsvc", { NULL }, 4553, "tcp" }, - { "msfrs", { NULL }, 4554, "tcp" }, - { "msfrs", { NULL }, 4554, "udp" }, - { "rsip", { NULL }, 4555, "tcp" }, - { "rsip", { NULL }, 4555, "udp" }, - { "dtn-bundle-tcp", { NULL }, 4556, "tcp" }, - { "dtn-bundle-udp", { NULL }, 4556, "udp" }, - { "mtcevrunqss", { NULL }, 4557, "udp" }, - { "mtcevrunqman", { NULL }, 4558, "udp" }, - { "hylafax", { NULL }, 4559, "tcp" }, - { "hylafax", { NULL }, 4559, "udp" }, - { "kwtc", { NULL }, 4566, "tcp" }, - { "kwtc", { NULL }, 4566, "udp" }, - { "tram", { NULL }, 4567, "tcp" }, - { "tram", { NULL }, 4567, "udp" }, - { "bmc-reporting", { NULL }, 4568, "tcp" }, - { "bmc-reporting", { NULL }, 4568, "udp" }, - { "iax", { NULL }, 4569, "tcp" }, - { "iax", { NULL }, 4569, "udp" }, - { "rid", { NULL }, 4590, "tcp" }, - { "l3t-at-an", { NULL }, 4591, "tcp" }, - { "l3t-at-an", { NULL }, 4591, "udp" }, - { "hrpd-ith-at-an", { NULL }, 4592, "udp" }, - { "ipt-anri-anri", { NULL }, 4593, "tcp" }, - { "ipt-anri-anri", { NULL }, 4593, "udp" }, - { "ias-session", { NULL }, 4594, "tcp" }, - { "ias-session", { NULL }, 4594, "udp" }, - { "ias-paging", { NULL }, 4595, "tcp" }, - { "ias-paging", { NULL }, 4595, "udp" }, - { "ias-neighbor", { NULL }, 4596, "tcp" }, - { "ias-neighbor", { NULL }, 4596, "udp" }, - { "a21-an-1xbs", { NULL }, 4597, "tcp" }, - { "a21-an-1xbs", { NULL }, 4597, "udp" }, - { "a16-an-an", { NULL }, 4598, "tcp" }, - { "a16-an-an", { NULL }, 4598, "udp" }, - { "a17-an-an", { NULL }, 4599, "tcp" }, - { "a17-an-an", { NULL }, 4599, "udp" }, - { "piranha1", { NULL }, 4600, "tcp" }, - { "piranha1", { NULL }, 4600, "udp" }, - { "piranha2", { NULL }, 4601, "tcp" }, - { "piranha2", { NULL }, 4601, "udp" }, - { "mtsserver", { NULL }, 4602, "tcp" }, - { "menandmice-upg", { NULL }, 4603, "tcp" }, - { "playsta2-app", { NULL }, 4658, "tcp" }, - { "playsta2-app", { NULL }, 4658, "udp" }, - { "playsta2-lob", { NULL }, 4659, "tcp" }, - { "playsta2-lob", { NULL }, 4659, "udp" }, - { "smaclmgr", { NULL }, 4660, "tcp" }, - { "smaclmgr", { NULL }, 4660, "udp" }, - { "kar2ouche", { NULL }, 4661, "tcp" }, - { "kar2ouche", { NULL }, 4661, "udp" }, - { "oms", { NULL }, 4662, "tcp" }, - { "oms", { NULL }, 4662, "udp" }, - { "noteit", { NULL }, 4663, "tcp" }, - { "noteit", { NULL }, 4663, "udp" }, - { "ems", { NULL }, 4664, "tcp" }, - { "ems", { NULL }, 4664, "udp" }, - { "contclientms", { NULL }, 4665, "tcp" }, - { "contclientms", { NULL }, 4665, "udp" }, - { "eportcomm", { NULL }, 4666, "tcp" }, - { "eportcomm", { NULL }, 4666, "udp" }, - { "mmacomm", { NULL }, 4667, "tcp" }, - { "mmacomm", { NULL }, 4667, "udp" }, - { "mmaeds", { NULL }, 4668, "tcp" }, - { "mmaeds", { NULL }, 4668, "udp" }, - { "eportcommdata", { NULL }, 4669, "tcp" }, - { "eportcommdata", { NULL }, 4669, "udp" }, - { "light", { NULL }, 4670, "tcp" }, - { "light", { NULL }, 4670, "udp" }, - { "acter", { NULL }, 4671, "tcp" }, - { "acter", { NULL }, 4671, "udp" }, - { "rfa", { NULL }, 4672, "tcp" }, - { "rfa", { NULL }, 4672, "udp" }, - { "cxws", { NULL }, 4673, "tcp" }, - { "cxws", { NULL }, 4673, "udp" }, - { "appiq-mgmt", { NULL }, 4674, "tcp" }, - { "appiq-mgmt", { NULL }, 4674, "udp" }, - { "dhct-status", { NULL }, 4675, "tcp" }, - { "dhct-status", { NULL }, 4675, "udp" }, - { "dhct-alerts", { NULL }, 4676, "tcp" }, - { "dhct-alerts", { NULL }, 4676, "udp" }, - { "bcs", { NULL }, 4677, "tcp" }, - { "bcs", { NULL }, 4677, "udp" }, - { "traversal", { NULL }, 4678, "tcp" }, - { "traversal", { NULL }, 4678, "udp" }, - { "mgesupervision", { NULL }, 4679, "tcp" }, - { "mgesupervision", { NULL }, 4679, "udp" }, - { "mgemanagement", { NULL }, 4680, "tcp" }, - { "mgemanagement", { NULL }, 4680, "udp" }, - { "parliant", { NULL }, 4681, "tcp" }, - { "parliant", { NULL }, 4681, "udp" }, - { "finisar", { NULL }, 4682, "tcp" }, - { "finisar", { NULL }, 4682, "udp" }, - { "spike", { NULL }, 4683, "tcp" }, - { "spike", { NULL }, 4683, "udp" }, - { "rfid-rp1", { NULL }, 4684, "tcp" }, - { "rfid-rp1", { NULL }, 4684, "udp" }, - { "autopac", { NULL }, 4685, "tcp" }, - { "autopac", { NULL }, 4685, "udp" }, - { "msp-os", { NULL }, 4686, "tcp" }, - { "msp-os", { NULL }, 4686, "udp" }, - { "nst", { NULL }, 4687, "tcp" }, - { "nst", { NULL }, 4687, "udp" }, - { "mobile-p2p", { NULL }, 4688, "tcp" }, - { "mobile-p2p", { NULL }, 4688, "udp" }, - { "altovacentral", { NULL }, 4689, "tcp" }, - { "altovacentral", { NULL }, 4689, "udp" }, - { "prelude", { NULL }, 4690, "tcp" }, - { "prelude", { NULL }, 4690, "udp" }, - { "mtn", { NULL }, 4691, "tcp" }, - { "mtn", { NULL }, 4691, "udp" }, - { "conspiracy", { NULL }, 4692, "tcp" }, - { "conspiracy", { NULL }, 4692, "udp" }, - { "netxms-agent", { NULL }, 4700, "tcp" }, - { "netxms-agent", { NULL }, 4700, "udp" }, - { "netxms-mgmt", { NULL }, 4701, "tcp" }, - { "netxms-mgmt", { NULL }, 4701, "udp" }, - { "netxms-sync", { NULL }, 4702, "tcp" }, - { "netxms-sync", { NULL }, 4702, "udp" }, - { "npqes-test", { NULL }, 4703, "tcp" }, - { "assuria-ins", { NULL }, 4704, "tcp" }, - { "truckstar", { NULL }, 4725, "tcp" }, - { "truckstar", { NULL }, 4725, "udp" }, - { "a26-fap-fgw", { NULL }, 4726, "udp" }, - { "fcis", { NULL }, 4727, "tcp" }, - { "fcis-disc", { NULL }, 4727, "udp" }, - { "capmux", { NULL }, 4728, "tcp" }, - { "capmux", { NULL }, 4728, "udp" }, - { "gsmtap", { NULL }, 4729, "udp" }, - { "gearman", { NULL }, 4730, "tcp" }, - { "gearman", { NULL }, 4730, "udp" }, - { "remcap", { NULL }, 4731, "tcp" }, - { "ohmtrigger", { NULL }, 4732, "udp" }, - { "resorcs", { NULL }, 4733, "tcp" }, - { "ipdr-sp", { NULL }, 4737, "tcp" }, - { "ipdr-sp", { NULL }, 4737, "udp" }, - { "solera-lpn", { NULL }, 4738, "tcp" }, - { "solera-lpn", { NULL }, 4738, "udp" }, - { "ipfix", { NULL }, 4739, "tcp" }, - { "ipfix", { NULL }, 4739, "udp" }, - { "ipfix", { NULL }, 4739, "sctp" }, - { "ipfixs", { NULL }, 4740, "tcp" }, - { "ipfixs", { NULL }, 4740, "sctp" }, - { "ipfixs", { NULL }, 4740, "udp" }, - { "lumimgrd", { NULL }, 4741, "tcp" }, - { "lumimgrd", { NULL }, 4741, "udp" }, - { "sicct", { NULL }, 4742, "tcp" }, - { "sicct-sdp", { NULL }, 4742, "udp" }, - { "openhpid", { NULL }, 4743, "tcp" }, - { "openhpid", { NULL }, 4743, "udp" }, - { "ifsp", { NULL }, 4744, "tcp" }, - { "ifsp", { NULL }, 4744, "udp" }, - { "fmp", { NULL }, 4745, "tcp" }, - { "fmp", { NULL }, 4745, "udp" }, - { "profilemac", { NULL }, 4749, "tcp" }, - { "profilemac", { NULL }, 4749, "udp" }, - { "ssad", { NULL }, 4750, "tcp" }, - { "ssad", { NULL }, 4750, "udp" }, - { "spocp", { NULL }, 4751, "tcp" }, - { "spocp", { NULL }, 4751, "udp" }, - { "snap", { NULL }, 4752, "tcp" }, - { "snap", { NULL }, 4752, "udp" }, - { "bfd-multi-ctl", { NULL }, 4784, "tcp" }, - { "bfd-multi-ctl", { NULL }, 4784, "udp" }, - { "cncp", { NULL }, 4785, "udp" }, - { "smart-install", { NULL }, 4786, "tcp" }, - { "sia-ctrl-plane", { NULL }, 4787, "tcp" }, - { "iims", { NULL }, 4800, "tcp" }, - { "iims", { NULL }, 4800, "udp" }, - { "iwec", { NULL }, 4801, "tcp" }, - { "iwec", { NULL }, 4801, "udp" }, - { "ilss", { NULL }, 4802, "tcp" }, - { "ilss", { NULL }, 4802, "udp" }, - { "notateit", { NULL }, 4803, "tcp" }, - { "notateit-disc", { NULL }, 4803, "udp" }, - { "aja-ntv4-disc", { NULL }, 4804, "udp" }, - { "htcp", { NULL }, 4827, "tcp" }, - { "htcp", { NULL }, 4827, "udp" }, - { "varadero-0", { NULL }, 4837, "tcp" }, - { "varadero-0", { NULL }, 4837, "udp" }, - { "varadero-1", { NULL }, 4838, "tcp" }, - { "varadero-1", { NULL }, 4838, "udp" }, - { "varadero-2", { NULL }, 4839, "tcp" }, - { "varadero-2", { NULL }, 4839, "udp" }, - { "opcua-tcp", { NULL }, 4840, "tcp" }, - { "opcua-udp", { NULL }, 4840, "udp" }, - { "quosa", { NULL }, 4841, "tcp" }, - { "quosa", { NULL }, 4841, "udp" }, - { "gw-asv", { NULL }, 4842, "tcp" }, - { "gw-asv", { NULL }, 4842, "udp" }, - { "opcua-tls", { NULL }, 4843, "tcp" }, - { "opcua-tls", { NULL }, 4843, "udp" }, - { "gw-log", { NULL }, 4844, "tcp" }, - { "gw-log", { NULL }, 4844, "udp" }, - { "wcr-remlib", { NULL }, 4845, "tcp" }, - { "wcr-remlib", { NULL }, 4845, "udp" }, - { "contamac_icm", { NULL }, 4846, "tcp" }, - { "contamac_icm", { NULL }, 4846, "udp" }, - { "wfc", { NULL }, 4847, "tcp" }, - { "wfc", { NULL }, 4847, "udp" }, - { "appserv-http", { NULL }, 4848, "tcp" }, - { "appserv-http", { NULL }, 4848, "udp" }, - { "appserv-https", { NULL }, 4849, "tcp" }, - { "appserv-https", { NULL }, 4849, "udp" }, - { "sun-as-nodeagt", { NULL }, 4850, "tcp" }, - { "sun-as-nodeagt", { NULL }, 4850, "udp" }, - { "derby-repli", { NULL }, 4851, "tcp" }, - { "derby-repli", { NULL }, 4851, "udp" }, - { "unify-debug", { NULL }, 4867, "tcp" }, - { "unify-debug", { NULL }, 4867, "udp" }, - { "phrelay", { NULL }, 4868, "tcp" }, - { "phrelay", { NULL }, 4868, "udp" }, - { "phrelaydbg", { NULL }, 4869, "tcp" }, - { "phrelaydbg", { NULL }, 4869, "udp" }, - { "cc-tracking", { NULL }, 4870, "tcp" }, - { "cc-tracking", { NULL }, 4870, "udp" }, - { "wired", { NULL }, 4871, "tcp" }, - { "wired", { NULL }, 4871, "udp" }, - { "tritium-can", { NULL }, 4876, "tcp" }, - { "tritium-can", { NULL }, 4876, "udp" }, - { "lmcs", { NULL }, 4877, "tcp" }, - { "lmcs", { NULL }, 4877, "udp" }, - { "inst-discovery", { NULL }, 4878, "udp" }, - { "wsdl-event", { NULL }, 4879, "tcp" }, - { "hislip", { NULL }, 4880, "tcp" }, - { "socp-t", { NULL }, 4881, "udp" }, - { "socp-c", { NULL }, 4882, "udp" }, - { "wmlserver", { NULL }, 4883, "tcp" }, - { "hivestor", { NULL }, 4884, "tcp" }, - { "hivestor", { NULL }, 4884, "udp" }, - { "abbs", { NULL }, 4885, "tcp" }, - { "abbs", { NULL }, 4885, "udp" }, - { "lyskom", { NULL }, 4894, "tcp" }, - { "lyskom", { NULL }, 4894, "udp" }, - { "radmin-port", { NULL }, 4899, "tcp" }, - { "radmin-port", { NULL }, 4899, "udp" }, - { "hfcs", { NULL }, 4900, "tcp" }, - { "hfcs", { NULL }, 4900, "udp" }, - { "flr_agent", { NULL }, 4901, "tcp" }, - { "magiccontrol", { NULL }, 4902, "tcp" }, - { "lutap", { NULL }, 4912, "tcp" }, - { "lutcp", { NULL }, 4913, "tcp" }, - { "bones", { NULL }, 4914, "tcp" }, - { "bones", { NULL }, 4914, "udp" }, - { "frcs", { NULL }, 4915, "tcp" }, - { "atsc-mh-ssc", { NULL }, 4937, "udp" }, - { "eq-office-4940", { NULL }, 4940, "tcp" }, - { "eq-office-4940", { NULL }, 4940, "udp" }, - { "eq-office-4941", { NULL }, 4941, "tcp" }, - { "eq-office-4941", { NULL }, 4941, "udp" }, - { "eq-office-4942", { NULL }, 4942, "tcp" }, - { "eq-office-4942", { NULL }, 4942, "udp" }, - { "munin", { NULL }, 4949, "tcp" }, - { "munin", { NULL }, 4949, "udp" }, - { "sybasesrvmon", { NULL }, 4950, "tcp" }, - { "sybasesrvmon", { NULL }, 4950, "udp" }, - { "pwgwims", { NULL }, 4951, "tcp" }, - { "pwgwims", { NULL }, 4951, "udp" }, - { "sagxtsds", { NULL }, 4952, "tcp" }, - { "sagxtsds", { NULL }, 4952, "udp" }, - { "dbsyncarbiter", { NULL }, 4953, "tcp" }, - { "ccss-qmm", { NULL }, 4969, "tcp" }, - { "ccss-qmm", { NULL }, 4969, "udp" }, - { "ccss-qsm", { NULL }, 4970, "tcp" }, - { "ccss-qsm", { NULL }, 4970, "udp" }, - { "webyast", { NULL }, 4984, "tcp" }, - { "gerhcs", { NULL }, 4985, "tcp" }, - { "mrip", { NULL }, 4986, "tcp" }, - { "mrip", { NULL }, 4986, "udp" }, - { "smar-se-port1", { NULL }, 4987, "tcp" }, - { "smar-se-port1", { NULL }, 4987, "udp" }, - { "smar-se-port2", { NULL }, 4988, "tcp" }, - { "smar-se-port2", { NULL }, 4988, "udp" }, - { "parallel", { NULL }, 4989, "tcp" }, - { "parallel", { NULL }, 4989, "udp" }, - { "busycal", { NULL }, 4990, "tcp" }, - { "busycal", { NULL }, 4990, "udp" }, - { "vrt", { NULL }, 4991, "tcp" }, - { "vrt", { NULL }, 4991, "udp" }, - { "hfcs-manager", { NULL }, 4999, "tcp" }, - { "hfcs-manager", { NULL }, 4999, "udp" }, - { "commplex-main", { NULL }, 5000, "tcp" }, - { "commplex-main", { NULL }, 5000, "udp" }, - { "commplex-link", { NULL }, 5001, "tcp" }, - { "commplex-link", { NULL }, 5001, "udp" }, - { "rfe", { NULL }, 5002, "tcp" }, - { "rfe", { NULL }, 5002, "udp" }, - { "fmpro-internal", { NULL }, 5003, "tcp" }, - { "fmpro-internal", { NULL }, 5003, "udp" }, - { "avt-profile-1", { NULL }, 5004, "tcp" }, - { "avt-profile-1", { NULL }, 5004, "udp" }, - { "avt-profile-1", { NULL }, 5004, "dccp" }, - { "avt-profile-2", { NULL }, 5005, "tcp" }, - { "avt-profile-2", { NULL }, 5005, "udp" }, - { "avt-profile-2", { NULL }, 5005, "dccp" }, - { "wsm-server", { NULL }, 5006, "tcp" }, - { "wsm-server", { NULL }, 5006, "udp" }, - { "wsm-server-ssl", { NULL }, 5007, "tcp" }, - { "wsm-server-ssl", { NULL }, 5007, "udp" }, - { "synapsis-edge", { NULL }, 5008, "tcp" }, - { "synapsis-edge", { NULL }, 5008, "udp" }, - { "winfs", { NULL }, 5009, "tcp" }, - { "winfs", { NULL }, 5009, "udp" }, - { "telelpathstart", { NULL }, 5010, "tcp" }, - { "telelpathstart", { NULL }, 5010, "udp" }, - { "telelpathattack", { NULL }, 5011, "tcp" }, - { "telelpathattack", { NULL }, 5011, "udp" }, - { "nsp", { NULL }, 5012, "tcp" }, - { "nsp", { NULL }, 5012, "udp" }, - { "fmpro-v6", { NULL }, 5013, "tcp" }, - { "fmpro-v6", { NULL }, 5013, "udp" }, - { "onpsocket", { NULL }, 5014, "udp" }, - { "fmwp", { NULL }, 5015, "tcp" }, - { "zenginkyo-1", { NULL }, 5020, "tcp" }, - { "zenginkyo-1", { NULL }, 5020, "udp" }, - { "zenginkyo-2", { NULL }, 5021, "tcp" }, - { "zenginkyo-2", { NULL }, 5021, "udp" }, - { "mice", { NULL }, 5022, "tcp" }, - { "mice", { NULL }, 5022, "udp" }, - { "htuilsrv", { NULL }, 5023, "tcp" }, - { "htuilsrv", { NULL }, 5023, "udp" }, - { "scpi-telnet", { NULL }, 5024, "tcp" }, - { "scpi-telnet", { NULL }, 5024, "udp" }, - { "scpi-raw", { NULL }, 5025, "tcp" }, - { "scpi-raw", { NULL }, 5025, "udp" }, - { "strexec-d", { NULL }, 5026, "tcp" }, - { "strexec-d", { NULL }, 5026, "udp" }, - { "strexec-s", { NULL }, 5027, "tcp" }, - { "strexec-s", { NULL }, 5027, "udp" }, - { "qvr", { NULL }, 5028, "tcp" }, - { "infobright", { NULL }, 5029, "tcp" }, - { "infobright", { NULL }, 5029, "udp" }, - { "surfpass", { NULL }, 5030, "tcp" }, - { "surfpass", { NULL }, 5030, "udp" }, - { "dmp", { NULL }, 5031, "udp" }, - { "asnaacceler8db", { NULL }, 5042, "tcp" }, - { "asnaacceler8db", { NULL }, 5042, "udp" }, - { "swxadmin", { NULL }, 5043, "tcp" }, - { "swxadmin", { NULL }, 5043, "udp" }, - { "lxi-evntsvc", { NULL }, 5044, "tcp" }, - { "lxi-evntsvc", { NULL }, 5044, "udp" }, - { "osp", { NULL }, 5045, "tcp" }, - { "vpm-udp", { NULL }, 5046, "udp" }, - { "iscape", { NULL }, 5047, "udp" }, - { "texai", { NULL }, 5048, "tcp" }, - { "ivocalize", { NULL }, 5049, "tcp" }, - { "ivocalize", { NULL }, 5049, "udp" }, - { "mmcc", { NULL }, 5050, "tcp" }, - { "mmcc", { NULL }, 5050, "udp" }, - { "ita-agent", { NULL }, 5051, "tcp" }, - { "ita-agent", { NULL }, 5051, "udp" }, - { "ita-manager", { NULL }, 5052, "tcp" }, - { "ita-manager", { NULL }, 5052, "udp" }, - { "rlm", { NULL }, 5053, "tcp" }, - { "rlm-admin", { NULL }, 5054, "tcp" }, - { "unot", { NULL }, 5055, "tcp" }, - { "unot", { NULL }, 5055, "udp" }, - { "intecom-ps1", { NULL }, 5056, "tcp" }, - { "intecom-ps1", { NULL }, 5056, "udp" }, - { "intecom-ps2", { NULL }, 5057, "tcp" }, - { "intecom-ps2", { NULL }, 5057, "udp" }, - { "locus-disc", { NULL }, 5058, "udp" }, - { "sds", { NULL }, 5059, "tcp" }, - { "sds", { NULL }, 5059, "udp" }, - { "sip", { NULL }, 5060, "tcp" }, - { "sip", { NULL }, 5060, "udp" }, - { "sip-tls", { NULL }, 5061, "tcp" }, - { "sip-tls", { NULL }, 5061, "udp" }, - { "na-localise", { NULL }, 5062, "tcp" }, - { "na-localise", { NULL }, 5062, "udp" }, - { "csrpc", { NULL }, 5063, "tcp" }, - { "ca-1", { NULL }, 5064, "tcp" }, - { "ca-1", { NULL }, 5064, "udp" }, - { "ca-2", { NULL }, 5065, "tcp" }, - { "ca-2", { NULL }, 5065, "udp" }, - { "stanag-5066", { NULL }, 5066, "tcp" }, - { "stanag-5066", { NULL }, 5066, "udp" }, - { "authentx", { NULL }, 5067, "tcp" }, - { "authentx", { NULL }, 5067, "udp" }, - { "bitforestsrv", { NULL }, 5068, "tcp" }, - { "i-net-2000-npr", { NULL }, 5069, "tcp" }, - { "i-net-2000-npr", { NULL }, 5069, "udp" }, - { "vtsas", { NULL }, 5070, "tcp" }, - { "vtsas", { NULL }, 5070, "udp" }, - { "powerschool", { NULL }, 5071, "tcp" }, - { "powerschool", { NULL }, 5071, "udp" }, - { "ayiya", { NULL }, 5072, "tcp" }, - { "ayiya", { NULL }, 5072, "udp" }, - { "tag-pm", { NULL }, 5073, "tcp" }, - { "tag-pm", { NULL }, 5073, "udp" }, - { "alesquery", { NULL }, 5074, "tcp" }, - { "alesquery", { NULL }, 5074, "udp" }, - { "cp-spxrpts", { NULL }, 5079, "udp" }, - { "onscreen", { NULL }, 5080, "tcp" }, - { "onscreen", { NULL }, 5080, "udp" }, - { "sdl-ets", { NULL }, 5081, "tcp" }, - { "sdl-ets", { NULL }, 5081, "udp" }, - { "qcp", { NULL }, 5082, "tcp" }, - { "qcp", { NULL }, 5082, "udp" }, - { "qfp", { NULL }, 5083, "tcp" }, - { "qfp", { NULL }, 5083, "udp" }, - { "llrp", { NULL }, 5084, "tcp" }, - { "llrp", { NULL }, 5084, "udp" }, - { "encrypted-llrp", { NULL }, 5085, "tcp" }, - { "encrypted-llrp", { NULL }, 5085, "udp" }, - { "aprigo-cs", { NULL }, 5086, "tcp" }, - { "car", { NULL }, 5090, "sctp" }, - { "cxtp", { NULL }, 5091, "sctp" }, - { "magpie", { NULL }, 5092, "udp" }, - { "sentinel-lm", { NULL }, 5093, "tcp" }, - { "sentinel-lm", { NULL }, 5093, "udp" }, - { "hart-ip", { NULL }, 5094, "tcp" }, - { "hart-ip", { NULL }, 5094, "udp" }, - { "sentlm-srv2srv", { NULL }, 5099, "tcp" }, - { "sentlm-srv2srv", { NULL }, 5099, "udp" }, - { "socalia", { NULL }, 5100, "tcp" }, - { "socalia", { NULL }, 5100, "udp" }, - { "talarian-tcp", { NULL }, 5101, "tcp" }, - { "talarian-udp", { NULL }, 5101, "udp" }, - { "oms-nonsecure", { NULL }, 5102, "tcp" }, - { "oms-nonsecure", { NULL }, 5102, "udp" }, - { "actifio-c2c", { NULL }, 5103, "tcp" }, - { "tinymessage", { NULL }, 5104, "udp" }, - { "hughes-ap", { NULL }, 5105, "udp" }, - { "taep-as-svc", { NULL }, 5111, "tcp" }, - { "taep-as-svc", { NULL }, 5111, "udp" }, - { "pm-cmdsvr", { NULL }, 5112, "tcp" }, - { "pm-cmdsvr", { NULL }, 5112, "udp" }, - { "ev-services", { NULL }, 5114, "tcp" }, - { "autobuild", { NULL }, 5115, "tcp" }, - { "emb-proj-cmd", { NULL }, 5116, "udp" }, - { "gradecam", { NULL }, 5117, "tcp" }, - { "nbt-pc", { NULL }, 5133, "tcp" }, - { "nbt-pc", { NULL }, 5133, "udp" }, - { "ppactivation", { NULL }, 5134, "tcp" }, - { "erp-scale", { NULL }, 5135, "tcp" }, - { "minotaur-sa", { NULL }, 5136, "udp" }, - { "ctsd", { NULL }, 5137, "tcp" }, - { "ctsd", { NULL }, 5137, "udp" }, - { "rmonitor_secure", { NULL }, 5145, "tcp" }, - { "rmonitor_secure", { NULL }, 5145, "udp" }, - { "social-alarm", { NULL }, 5146, "tcp" }, - { "atmp", { NULL }, 5150, "tcp" }, - { "atmp", { NULL }, 5150, "udp" }, - { "esri_sde", { NULL }, 5151, "tcp" }, - { "esri_sde", { NULL }, 5151, "udp" }, - { "sde-discovery", { NULL }, 5152, "tcp" }, - { "sde-discovery", { NULL }, 5152, "udp" }, - { "toruxserver", { NULL }, 5153, "tcp" }, - { "bzflag", { NULL }, 5154, "tcp" }, - { "bzflag", { NULL }, 5154, "udp" }, - { "asctrl-agent", { NULL }, 5155, "tcp" }, - { "asctrl-agent", { NULL }, 5155, "udp" }, - { "rugameonline", { NULL }, 5156, "tcp" }, - { "mediat", { NULL }, 5157, "tcp" }, - { "snmpssh", { NULL }, 5161, "tcp" }, - { "snmpssh-trap", { NULL }, 5162, "tcp" }, - { "sbackup", { NULL }, 5163, "tcp" }, - { "vpa", { NULL }, 5164, "tcp" }, - { "vpa-disc", { NULL }, 5164, "udp" }, - { "ife_icorp", { NULL }, 5165, "tcp" }, - { "ife_icorp", { NULL }, 5165, "udp" }, - { "winpcs", { NULL }, 5166, "tcp" }, - { "winpcs", { NULL }, 5166, "udp" }, - { "scte104", { NULL }, 5167, "tcp" }, - { "scte104", { NULL }, 5167, "udp" }, - { "scte30", { NULL }, 5168, "tcp" }, - { "scte30", { NULL }, 5168, "udp" }, - { "aol", { NULL }, 5190, "tcp" }, - { "aol", { NULL }, 5190, "udp" }, - { "aol-1", { NULL }, 5191, "tcp" }, - { "aol-1", { NULL }, 5191, "udp" }, - { "aol-2", { NULL }, 5192, "tcp" }, - { "aol-2", { NULL }, 5192, "udp" }, - { "aol-3", { NULL }, 5193, "tcp" }, - { "aol-3", { NULL }, 5193, "udp" }, - { "cpscomm", { NULL }, 5194, "tcp" }, - { "targus-getdata", { NULL }, 5200, "tcp" }, - { "targus-getdata", { NULL }, 5200, "udp" }, - { "targus-getdata1", { NULL }, 5201, "tcp" }, - { "targus-getdata1", { NULL }, 5201, "udp" }, - { "targus-getdata2", { NULL }, 5202, "tcp" }, - { "targus-getdata2", { NULL }, 5202, "udp" }, - { "targus-getdata3", { NULL }, 5203, "tcp" }, - { "targus-getdata3", { NULL }, 5203, "udp" }, - { "3exmp", { NULL }, 5221, "tcp" }, - { "xmpp-client", { NULL }, 5222, "tcp" }, - { "hpvirtgrp", { NULL }, 5223, "tcp" }, - { "hpvirtgrp", { NULL }, 5223, "udp" }, - { "hpvirtctrl", { NULL }, 5224, "tcp" }, - { "hpvirtctrl", { NULL }, 5224, "udp" }, - { "hp-server", { NULL }, 5225, "tcp" }, - { "hp-server", { NULL }, 5225, "udp" }, - { "hp-status", { NULL }, 5226, "tcp" }, - { "hp-status", { NULL }, 5226, "udp" }, - { "perfd", { NULL }, 5227, "tcp" }, - { "perfd", { NULL }, 5227, "udp" }, - { "hpvroom", { NULL }, 5228, "tcp" }, - { "csedaemon", { NULL }, 5232, "tcp" }, - { "enfs", { NULL }, 5233, "tcp" }, - { "eenet", { NULL }, 5234, "tcp" }, - { "eenet", { NULL }, 5234, "udp" }, - { "galaxy-network", { NULL }, 5235, "tcp" }, - { "galaxy-network", { NULL }, 5235, "udp" }, - { "padl2sim", { NULL }, 5236, "tcp" }, - { "padl2sim", { NULL }, 5236, "udp" }, - { "mnet-discovery", { NULL }, 5237, "tcp" }, - { "mnet-discovery", { NULL }, 5237, "udp" }, - { "downtools", { NULL }, 5245, "tcp" }, - { "downtools-disc", { NULL }, 5245, "udp" }, - { "capwap-control", { NULL }, 5246, "udp" }, - { "capwap-data", { NULL }, 5247, "udp" }, - { "caacws", { NULL }, 5248, "tcp" }, - { "caacws", { NULL }, 5248, "udp" }, - { "caaclang2", { NULL }, 5249, "tcp" }, - { "caaclang2", { NULL }, 5249, "udp" }, - { "soagateway", { NULL }, 5250, "tcp" }, - { "soagateway", { NULL }, 5250, "udp" }, - { "caevms", { NULL }, 5251, "tcp" }, - { "caevms", { NULL }, 5251, "udp" }, - { "movaz-ssc", { NULL }, 5252, "tcp" }, - { "movaz-ssc", { NULL }, 5252, "udp" }, - { "kpdp", { NULL }, 5253, "tcp" }, - { "3com-njack-1", { NULL }, 5264, "tcp" }, - { "3com-njack-1", { NULL }, 5264, "udp" }, - { "3com-njack-2", { NULL }, 5265, "tcp" }, - { "3com-njack-2", { NULL }, 5265, "udp" }, - { "xmpp-server", { NULL }, 5269, "tcp" }, - { "xmp", { NULL }, 5270, "tcp" }, - { "xmp", { NULL }, 5270, "udp" }, - { "cuelink", { NULL }, 5271, "tcp" }, - { "cuelink-disc", { NULL }, 5271, "udp" }, - { "pk", { NULL }, 5272, "tcp" }, - { "pk", { NULL }, 5272, "udp" }, - { "xmpp-bosh", { NULL }, 5280, "tcp" }, - { "undo-lm", { NULL }, 5281, "tcp" }, - { "transmit-port", { NULL }, 5282, "tcp" }, - { "transmit-port", { NULL }, 5282, "udp" }, - { "presence", { NULL }, 5298, "tcp" }, - { "presence", { NULL }, 5298, "udp" }, - { "nlg-data", { NULL }, 5299, "tcp" }, - { "nlg-data", { NULL }, 5299, "udp" }, - { "hacl-hb", { NULL }, 5300, "tcp" }, - { "hacl-hb", { NULL }, 5300, "udp" }, - { "hacl-gs", { NULL }, 5301, "tcp" }, - { "hacl-gs", { NULL }, 5301, "udp" }, - { "hacl-cfg", { NULL }, 5302, "tcp" }, - { "hacl-cfg", { NULL }, 5302, "udp" }, - { "hacl-probe", { NULL }, 5303, "tcp" }, - { "hacl-probe", { NULL }, 5303, "udp" }, - { "hacl-local", { NULL }, 5304, "tcp" }, - { "hacl-local", { NULL }, 5304, "udp" }, - { "hacl-test", { NULL }, 5305, "tcp" }, - { "hacl-test", { NULL }, 5305, "udp" }, - { "sun-mc-grp", { NULL }, 5306, "tcp" }, - { "sun-mc-grp", { NULL }, 5306, "udp" }, - { "sco-aip", { NULL }, 5307, "tcp" }, - { "sco-aip", { NULL }, 5307, "udp" }, - { "cfengine", { NULL }, 5308, "tcp" }, - { "cfengine", { NULL }, 5308, "udp" }, - { "jprinter", { NULL }, 5309, "tcp" }, - { "jprinter", { NULL }, 5309, "udp" }, - { "outlaws", { NULL }, 5310, "tcp" }, - { "outlaws", { NULL }, 5310, "udp" }, - { "permabit-cs", { NULL }, 5312, "tcp" }, - { "permabit-cs", { NULL }, 5312, "udp" }, - { "rrdp", { NULL }, 5313, "tcp" }, - { "rrdp", { NULL }, 5313, "udp" }, - { "opalis-rbt-ipc", { NULL }, 5314, "tcp" }, - { "opalis-rbt-ipc", { NULL }, 5314, "udp" }, - { "hacl-poll", { NULL }, 5315, "tcp" }, - { "hacl-poll", { NULL }, 5315, "udp" }, - { "hpdevms", { NULL }, 5316, "tcp" }, - { "hpdevms", { NULL }, 5316, "udp" }, - { "bsfserver-zn", { NULL }, 5320, "tcp" }, - { "bsfsvr-zn-ssl", { NULL }, 5321, "tcp" }, - { "kfserver", { NULL }, 5343, "tcp" }, - { "kfserver", { NULL }, 5343, "udp" }, - { "xkotodrcp", { NULL }, 5344, "tcp" }, - { "xkotodrcp", { NULL }, 5344, "udp" }, - { "stuns", { NULL }, 5349, "tcp" }, - { "stuns", { NULL }, 5349, "udp" }, - { "turns", { NULL }, 5349, "tcp" }, - { "turns", { NULL }, 5349, "udp" }, - { "stun-behaviors", { NULL }, 5349, "tcp" }, - { "stun-behaviors", { NULL }, 5349, "udp" }, - { "nat-pmp-status", { NULL }, 5350, "tcp" }, - { "nat-pmp-status", { NULL }, 5350, "udp" }, - { "nat-pmp", { NULL }, 5351, "tcp" }, - { "nat-pmp", { NULL }, 5351, "udp" }, - { "dns-llq", { NULL }, 5352, "tcp" }, - { "dns-llq", { NULL }, 5352, "udp" }, - { "mdns", { NULL }, 5353, "tcp" }, - { "mdns", { NULL }, 5353, "udp" }, - { "mdnsresponder", { NULL }, 5354, "tcp" }, - { "mdnsresponder", { NULL }, 5354, "udp" }, - { "llmnr", { NULL }, 5355, "tcp" }, - { "llmnr", { NULL }, 5355, "udp" }, - { "ms-smlbiz", { NULL }, 5356, "tcp" }, - { "ms-smlbiz", { NULL }, 5356, "udp" }, - { "wsdapi", { NULL }, 5357, "tcp" }, - { "wsdapi", { NULL }, 5357, "udp" }, - { "wsdapi-s", { NULL }, 5358, "tcp" }, - { "wsdapi-s", { NULL }, 5358, "udp" }, - { "ms-alerter", { NULL }, 5359, "tcp" }, - { "ms-alerter", { NULL }, 5359, "udp" }, - { "ms-sideshow", { NULL }, 5360, "tcp" }, - { "ms-sideshow", { NULL }, 5360, "udp" }, - { "ms-s-sideshow", { NULL }, 5361, "tcp" }, - { "ms-s-sideshow", { NULL }, 5361, "udp" }, - { "serverwsd2", { NULL }, 5362, "tcp" }, - { "serverwsd2", { NULL }, 5362, "udp" }, - { "net-projection", { NULL }, 5363, "tcp" }, - { "net-projection", { NULL }, 5363, "udp" }, - { "stresstester", { NULL }, 5397, "tcp" }, - { "stresstester", { NULL }, 5397, "udp" }, - { "elektron-admin", { NULL }, 5398, "tcp" }, - { "elektron-admin", { NULL }, 5398, "udp" }, - { "securitychase", { NULL }, 5399, "tcp" }, - { "securitychase", { NULL }, 5399, "udp" }, - { "excerpt", { NULL }, 5400, "tcp" }, - { "excerpt", { NULL }, 5400, "udp" }, - { "excerpts", { NULL }, 5401, "tcp" }, - { "excerpts", { NULL }, 5401, "udp" }, - { "mftp", { NULL }, 5402, "tcp" }, - { "mftp", { NULL }, 5402, "udp" }, - { "hpoms-ci-lstn", { NULL }, 5403, "tcp" }, - { "hpoms-ci-lstn", { NULL }, 5403, "udp" }, - { "hpoms-dps-lstn", { NULL }, 5404, "tcp" }, - { "hpoms-dps-lstn", { NULL }, 5404, "udp" }, - { "netsupport", { NULL }, 5405, "tcp" }, - { "netsupport", { NULL }, 5405, "udp" }, - { "systemics-sox", { NULL }, 5406, "tcp" }, - { "systemics-sox", { NULL }, 5406, "udp" }, - { "foresyte-clear", { NULL }, 5407, "tcp" }, - { "foresyte-clear", { NULL }, 5407, "udp" }, - { "foresyte-sec", { NULL }, 5408, "tcp" }, - { "foresyte-sec", { NULL }, 5408, "udp" }, - { "salient-dtasrv", { NULL }, 5409, "tcp" }, - { "salient-dtasrv", { NULL }, 5409, "udp" }, - { "salient-usrmgr", { NULL }, 5410, "tcp" }, - { "salient-usrmgr", { NULL }, 5410, "udp" }, - { "actnet", { NULL }, 5411, "tcp" }, - { "actnet", { NULL }, 5411, "udp" }, - { "continuus", { NULL }, 5412, "tcp" }, - { "continuus", { NULL }, 5412, "udp" }, - { "wwiotalk", { NULL }, 5413, "tcp" }, - { "wwiotalk", { NULL }, 5413, "udp" }, - { "statusd", { NULL }, 5414, "tcp" }, - { "statusd", { NULL }, 5414, "udp" }, - { "ns-server", { NULL }, 5415, "tcp" }, - { "ns-server", { NULL }, 5415, "udp" }, - { "sns-gateway", { NULL }, 5416, "tcp" }, - { "sns-gateway", { NULL }, 5416, "udp" }, - { "sns-agent", { NULL }, 5417, "tcp" }, - { "sns-agent", { NULL }, 5417, "udp" }, - { "mcntp", { NULL }, 5418, "tcp" }, - { "mcntp", { NULL }, 5418, "udp" }, - { "dj-ice", { NULL }, 5419, "tcp" }, - { "dj-ice", { NULL }, 5419, "udp" }, - { "cylink-c", { NULL }, 5420, "tcp" }, - { "cylink-c", { NULL }, 5420, "udp" }, - { "netsupport2", { NULL }, 5421, "tcp" }, - { "netsupport2", { NULL }, 5421, "udp" }, - { "salient-mux", { NULL }, 5422, "tcp" }, - { "salient-mux", { NULL }, 5422, "udp" }, - { "virtualuser", { NULL }, 5423, "tcp" }, - { "virtualuser", { NULL }, 5423, "udp" }, - { "beyond-remote", { NULL }, 5424, "tcp" }, - { "beyond-remote", { NULL }, 5424, "udp" }, - { "br-channel", { NULL }, 5425, "tcp" }, - { "br-channel", { NULL }, 5425, "udp" }, - { "devbasic", { NULL }, 5426, "tcp" }, - { "devbasic", { NULL }, 5426, "udp" }, - { "sco-peer-tta", { NULL }, 5427, "tcp" }, - { "sco-peer-tta", { NULL }, 5427, "udp" }, - { "telaconsole", { NULL }, 5428, "tcp" }, - { "telaconsole", { NULL }, 5428, "udp" }, - { "base", { NULL }, 5429, "tcp" }, - { "base", { NULL }, 5429, "udp" }, - { "radec-corp", { NULL }, 5430, "tcp" }, - { "radec-corp", { NULL }, 5430, "udp" }, - { "park-agent", { NULL }, 5431, "tcp" }, - { "park-agent", { NULL }, 5431, "udp" }, - { "postgresql", { NULL }, 5432, "tcp" }, - { "postgresql", { NULL }, 5432, "udp" }, - { "pyrrho", { NULL }, 5433, "tcp" }, - { "pyrrho", { NULL }, 5433, "udp" }, - { "sgi-arrayd", { NULL }, 5434, "tcp" }, - { "sgi-arrayd", { NULL }, 5434, "udp" }, - { "sceanics", { NULL }, 5435, "tcp" }, - { "sceanics", { NULL }, 5435, "udp" }, - { "pmip6-cntl", { NULL }, 5436, "udp" }, - { "pmip6-data", { NULL }, 5437, "udp" }, - { "spss", { NULL }, 5443, "tcp" }, - { "spss", { NULL }, 5443, "udp" }, - { "surebox", { NULL }, 5453, "tcp" }, - { "surebox", { NULL }, 5453, "udp" }, - { "apc-5454", { NULL }, 5454, "tcp" }, - { "apc-5454", { NULL }, 5454, "udp" }, - { "apc-5455", { NULL }, 5455, "tcp" }, - { "apc-5455", { NULL }, 5455, "udp" }, - { "apc-5456", { NULL }, 5456, "tcp" }, - { "apc-5456", { NULL }, 5456, "udp" }, - { "silkmeter", { NULL }, 5461, "tcp" }, - { "silkmeter", { NULL }, 5461, "udp" }, - { "ttl-publisher", { NULL }, 5462, "tcp" }, - { "ttl-publisher", { NULL }, 5462, "udp" }, - { "ttlpriceproxy", { NULL }, 5463, "tcp" }, - { "ttlpriceproxy", { NULL }, 5463, "udp" }, - { "quailnet", { NULL }, 5464, "tcp" }, - { "quailnet", { NULL }, 5464, "udp" }, - { "netops-broker", { NULL }, 5465, "tcp" }, - { "netops-broker", { NULL }, 5465, "udp" }, - { "fcp-addr-srvr1", { NULL }, 5500, "tcp" }, - { "fcp-addr-srvr1", { NULL }, 5500, "udp" }, - { "fcp-addr-srvr2", { NULL }, 5501, "tcp" }, - { "fcp-addr-srvr2", { NULL }, 5501, "udp" }, - { "fcp-srvr-inst1", { NULL }, 5502, "tcp" }, - { "fcp-srvr-inst1", { NULL }, 5502, "udp" }, - { "fcp-srvr-inst2", { NULL }, 5503, "tcp" }, - { "fcp-srvr-inst2", { NULL }, 5503, "udp" }, - { "fcp-cics-gw1", { NULL }, 5504, "tcp" }, - { "fcp-cics-gw1", { NULL }, 5504, "udp" }, - { "checkoutdb", { NULL }, 5505, "tcp" }, - { "checkoutdb", { NULL }, 5505, "udp" }, - { "amc", { NULL }, 5506, "tcp" }, - { "amc", { NULL }, 5506, "udp" }, - { "sgi-eventmond", { NULL }, 5553, "tcp" }, - { "sgi-eventmond", { NULL }, 5553, "udp" }, - { "sgi-esphttp", { NULL }, 5554, "tcp" }, - { "sgi-esphttp", { NULL }, 5554, "udp" }, - { "personal-agent", { NULL }, 5555, "tcp" }, - { "personal-agent", { NULL }, 5555, "udp" }, - { "freeciv", { NULL }, 5556, "tcp" }, - { "freeciv", { NULL }, 5556, "udp" }, - { "farenet", { NULL }, 5557, "tcp" }, - { "westec-connect", { NULL }, 5566, "tcp" }, - { "m-oap", { NULL }, 5567, "tcp" }, - { "m-oap", { NULL }, 5567, "udp" }, - { "sdt", { NULL }, 5568, "tcp" }, - { "sdt", { NULL }, 5568, "udp" }, - { "sdmmp", { NULL }, 5573, "tcp" }, - { "sdmmp", { NULL }, 5573, "udp" }, - { "lsi-bobcat", { NULL }, 5574, "tcp" }, - { "ora-oap", { NULL }, 5575, "tcp" }, - { "fdtracks", { NULL }, 5579, "tcp" }, - { "tmosms0", { NULL }, 5580, "tcp" }, - { "tmosms0", { NULL }, 5580, "udp" }, - { "tmosms1", { NULL }, 5581, "tcp" }, - { "tmosms1", { NULL }, 5581, "udp" }, - { "fac-restore", { NULL }, 5582, "tcp" }, - { "fac-restore", { NULL }, 5582, "udp" }, - { "tmo-icon-sync", { NULL }, 5583, "tcp" }, - { "tmo-icon-sync", { NULL }, 5583, "udp" }, - { "bis-web", { NULL }, 5584, "tcp" }, - { "bis-web", { NULL }, 5584, "udp" }, - { "bis-sync", { NULL }, 5585, "tcp" }, - { "bis-sync", { NULL }, 5585, "udp" }, - { "ininmessaging", { NULL }, 5597, "tcp" }, - { "ininmessaging", { NULL }, 5597, "udp" }, - { "mctfeed", { NULL }, 5598, "tcp" }, - { "mctfeed", { NULL }, 5598, "udp" }, - { "esinstall", { NULL }, 5599, "tcp" }, - { "esinstall", { NULL }, 5599, "udp" }, - { "esmmanager", { NULL }, 5600, "tcp" }, - { "esmmanager", { NULL }, 5600, "udp" }, - { "esmagent", { NULL }, 5601, "tcp" }, - { "esmagent", { NULL }, 5601, "udp" }, - { "a1-msc", { NULL }, 5602, "tcp" }, - { "a1-msc", { NULL }, 5602, "udp" }, - { "a1-bs", { NULL }, 5603, "tcp" }, - { "a1-bs", { NULL }, 5603, "udp" }, - { "a3-sdunode", { NULL }, 5604, "tcp" }, - { "a3-sdunode", { NULL }, 5604, "udp" }, - { "a4-sdunode", { NULL }, 5605, "tcp" }, - { "a4-sdunode", { NULL }, 5605, "udp" }, - { "ninaf", { NULL }, 5627, "tcp" }, - { "ninaf", { NULL }, 5627, "udp" }, - { "htrust", { NULL }, 5628, "tcp" }, - { "htrust", { NULL }, 5628, "udp" }, - { "symantec-sfdb", { NULL }, 5629, "tcp" }, - { "symantec-sfdb", { NULL }, 5629, "udp" }, - { "precise-comm", { NULL }, 5630, "tcp" }, - { "precise-comm", { NULL }, 5630, "udp" }, - { "pcanywheredata", { NULL }, 5631, "tcp" }, - { "pcanywheredata", { NULL }, 5631, "udp" }, - { "pcanywherestat", { NULL }, 5632, "tcp" }, - { "pcanywherestat", { NULL }, 5632, "udp" }, - { "beorl", { NULL }, 5633, "tcp" }, - { "beorl", { NULL }, 5633, "udp" }, - { "xprtld", { NULL }, 5634, "tcp" }, - { "xprtld", { NULL }, 5634, "udp" }, - { "sfmsso", { NULL }, 5635, "tcp" }, - { "sfm-db-server", { NULL }, 5636, "tcp" }, - { "cssc", { NULL }, 5637, "tcp" }, - { "amqps", { NULL }, 5671, "tcp" }, - { "amqps", { NULL }, 5671, "udp" }, - { "amqp", { NULL }, 5672, "tcp" }, - { "amqp", { NULL }, 5672, "udp" }, - { "amqp", { NULL }, 5672, "sctp" }, - { "jms", { NULL }, 5673, "tcp" }, - { "jms", { NULL }, 5673, "udp" }, - { "hyperscsi-port", { NULL }, 5674, "tcp" }, - { "hyperscsi-port", { NULL }, 5674, "udp" }, - { "v5ua", { NULL }, 5675, "tcp" }, - { "v5ua", { NULL }, 5675, "udp" }, - { "v5ua", { NULL }, 5675, "sctp" }, - { "raadmin", { NULL }, 5676, "tcp" }, - { "raadmin", { NULL }, 5676, "udp" }, - { "questdb2-lnchr", { NULL }, 5677, "tcp" }, - { "questdb2-lnchr", { NULL }, 5677, "udp" }, - { "rrac", { NULL }, 5678, "tcp" }, - { "rrac", { NULL }, 5678, "udp" }, - { "dccm", { NULL }, 5679, "tcp" }, - { "dccm", { NULL }, 5679, "udp" }, - { "auriga-router", { NULL }, 5680, "tcp" }, - { "auriga-router", { NULL }, 5680, "udp" }, - { "ncxcp", { NULL }, 5681, "tcp" }, - { "ncxcp", { NULL }, 5681, "udp" }, - { "brightcore", { NULL }, 5682, "udp" }, - { "ggz", { NULL }, 5688, "tcp" }, - { "ggz", { NULL }, 5688, "udp" }, - { "qmvideo", { NULL }, 5689, "tcp" }, - { "qmvideo", { NULL }, 5689, "udp" }, - { "proshareaudio", { NULL }, 5713, "tcp" }, - { "proshareaudio", { NULL }, 5713, "udp" }, - { "prosharevideo", { NULL }, 5714, "tcp" }, - { "prosharevideo", { NULL }, 5714, "udp" }, - { "prosharedata", { NULL }, 5715, "tcp" }, - { "prosharedata", { NULL }, 5715, "udp" }, - { "prosharerequest", { NULL }, 5716, "tcp" }, - { "prosharerequest", { NULL }, 5716, "udp" }, - { "prosharenotify", { NULL }, 5717, "tcp" }, - { "prosharenotify", { NULL }, 5717, "udp" }, - { "dpm", { NULL }, 5718, "tcp" }, - { "dpm", { NULL }, 5718, "udp" }, - { "dpm-agent", { NULL }, 5719, "tcp" }, - { "dpm-agent", { NULL }, 5719, "udp" }, - { "ms-licensing", { NULL }, 5720, "tcp" }, - { "ms-licensing", { NULL }, 5720, "udp" }, - { "dtpt", { NULL }, 5721, "tcp" }, - { "dtpt", { NULL }, 5721, "udp" }, - { "msdfsr", { NULL }, 5722, "tcp" }, - { "msdfsr", { NULL }, 5722, "udp" }, - { "omhs", { NULL }, 5723, "tcp" }, - { "omhs", { NULL }, 5723, "udp" }, - { "omsdk", { NULL }, 5724, "tcp" }, - { "omsdk", { NULL }, 5724, "udp" }, - { "ms-ilm", { NULL }, 5725, "tcp" }, - { "ms-ilm-sts", { NULL }, 5726, "tcp" }, - { "asgenf", { NULL }, 5727, "tcp" }, - { "io-dist-data", { NULL }, 5728, "tcp" }, - { "io-dist-group", { NULL }, 5728, "udp" }, - { "openmail", { NULL }, 5729, "tcp" }, - { "openmail", { NULL }, 5729, "udp" }, - { "unieng", { NULL }, 5730, "tcp" }, - { "unieng", { NULL }, 5730, "udp" }, - { "ida-discover1", { NULL }, 5741, "tcp" }, - { "ida-discover1", { NULL }, 5741, "udp" }, - { "ida-discover2", { NULL }, 5742, "tcp" }, - { "ida-discover2", { NULL }, 5742, "udp" }, - { "watchdoc-pod", { NULL }, 5743, "tcp" }, - { "watchdoc-pod", { NULL }, 5743, "udp" }, - { "watchdoc", { NULL }, 5744, "tcp" }, - { "watchdoc", { NULL }, 5744, "udp" }, - { "fcopy-server", { NULL }, 5745, "tcp" }, - { "fcopy-server", { NULL }, 5745, "udp" }, - { "fcopys-server", { NULL }, 5746, "tcp" }, - { "fcopys-server", { NULL }, 5746, "udp" }, - { "tunatic", { NULL }, 5747, "tcp" }, - { "tunatic", { NULL }, 5747, "udp" }, - { "tunalyzer", { NULL }, 5748, "tcp" }, - { "tunalyzer", { NULL }, 5748, "udp" }, - { "rscd", { NULL }, 5750, "tcp" }, - { "rscd", { NULL }, 5750, "udp" }, - { "openmailg", { NULL }, 5755, "tcp" }, - { "openmailg", { NULL }, 5755, "udp" }, - { "x500ms", { NULL }, 5757, "tcp" }, - { "x500ms", { NULL }, 5757, "udp" }, - { "openmailns", { NULL }, 5766, "tcp" }, - { "openmailns", { NULL }, 5766, "udp" }, - { "s-openmail", { NULL }, 5767, "tcp" }, - { "s-openmail", { NULL }, 5767, "udp" }, - { "openmailpxy", { NULL }, 5768, "tcp" }, - { "openmailpxy", { NULL }, 5768, "udp" }, - { "spramsca", { NULL }, 5769, "tcp" }, - { "spramsca", { NULL }, 5769, "udp" }, - { "spramsd", { NULL }, 5770, "tcp" }, - { "spramsd", { NULL }, 5770, "udp" }, - { "netagent", { NULL }, 5771, "tcp" }, - { "netagent", { NULL }, 5771, "udp" }, - { "dali-port", { NULL }, 5777, "tcp" }, - { "dali-port", { NULL }, 5777, "udp" }, - { "vts-rpc", { NULL }, 5780, "tcp" }, - { "3par-evts", { NULL }, 5781, "tcp" }, - { "3par-evts", { NULL }, 5781, "udp" }, - { "3par-mgmt", { NULL }, 5782, "tcp" }, - { "3par-mgmt", { NULL }, 5782, "udp" }, - { "3par-mgmt-ssl", { NULL }, 5783, "tcp" }, - { "3par-mgmt-ssl", { NULL }, 5783, "udp" }, - { "ibar", { NULL }, 5784, "udp" }, - { "3par-rcopy", { NULL }, 5785, "tcp" }, - { "3par-rcopy", { NULL }, 5785, "udp" }, - { "cisco-redu", { NULL }, 5786, "udp" }, - { "waascluster", { NULL }, 5787, "udp" }, - { "xtreamx", { NULL }, 5793, "tcp" }, - { "xtreamx", { NULL }, 5793, "udp" }, - { "spdp", { NULL }, 5794, "udp" }, - { "icmpd", { NULL }, 5813, "tcp" }, - { "icmpd", { NULL }, 5813, "udp" }, - { "spt-automation", { NULL }, 5814, "tcp" }, - { "spt-automation", { NULL }, 5814, "udp" }, - { "wherehoo", { NULL }, 5859, "tcp" }, - { "wherehoo", { NULL }, 5859, "udp" }, - { "ppsuitemsg", { NULL }, 5863, "tcp" }, - { "ppsuitemsg", { NULL }, 5863, "udp" }, - { "rfb", { NULL }, 5900, "tcp" }, - { "rfb", { NULL }, 5900, "udp" }, - { "cm", { NULL }, 5910, "tcp" }, - { "cm", { NULL }, 5910, "udp" }, - { "cpdlc", { NULL }, 5911, "tcp" }, - { "cpdlc", { NULL }, 5911, "udp" }, - { "fis", { NULL }, 5912, "tcp" }, - { "fis", { NULL }, 5912, "udp" }, - { "ads-c", { NULL }, 5913, "tcp" }, - { "ads-c", { NULL }, 5913, "udp" }, - { "indy", { NULL }, 5963, "tcp" }, - { "indy", { NULL }, 5963, "udp" }, - { "mppolicy-v5", { NULL }, 5968, "tcp" }, - { "mppolicy-v5", { NULL }, 5968, "udp" }, - { "mppolicy-mgr", { NULL }, 5969, "tcp" }, - { "mppolicy-mgr", { NULL }, 5969, "udp" }, - { "couchdb", { NULL }, 5984, "tcp" }, - { "couchdb", { NULL }, 5984, "udp" }, - { "wsman", { NULL }, 5985, "tcp" }, - { "wsman", { NULL }, 5985, "udp" }, - { "wsmans", { NULL }, 5986, "tcp" }, - { "wsmans", { NULL }, 5986, "udp" }, - { "wbem-rmi", { NULL }, 5987, "tcp" }, - { "wbem-rmi", { NULL }, 5987, "udp" }, - { "wbem-http", { NULL }, 5988, "tcp" }, - { "wbem-http", { NULL }, 5988, "udp" }, - { "wbem-https", { NULL }, 5989, "tcp" }, - { "wbem-https", { NULL }, 5989, "udp" }, - { "wbem-exp-https", { NULL }, 5990, "tcp" }, - { "wbem-exp-https", { NULL }, 5990, "udp" }, - { "nuxsl", { NULL }, 5991, "tcp" }, - { "nuxsl", { NULL }, 5991, "udp" }, - { "consul-insight", { NULL }, 5992, "tcp" }, - { "consul-insight", { NULL }, 5992, "udp" }, - { "cvsup", { NULL }, 5999, "tcp" }, - { "cvsup", { NULL }, 5999, "udp" }, - { "ndl-ahp-svc", { NULL }, 6064, "tcp" }, - { "ndl-ahp-svc", { NULL }, 6064, "udp" }, - { "winpharaoh", { NULL }, 6065, "tcp" }, - { "winpharaoh", { NULL }, 6065, "udp" }, - { "ewctsp", { NULL }, 6066, "tcp" }, - { "ewctsp", { NULL }, 6066, "udp" }, - { "gsmp", { NULL }, 6068, "tcp" }, - { "gsmp", { NULL }, 6068, "udp" }, - { "trip", { NULL }, 6069, "tcp" }, - { "trip", { NULL }, 6069, "udp" }, - { "messageasap", { NULL }, 6070, "tcp" }, - { "messageasap", { NULL }, 6070, "udp" }, - { "ssdtp", { NULL }, 6071, "tcp" }, - { "ssdtp", { NULL }, 6071, "udp" }, - { "diagnose-proc", { NULL }, 6072, "tcp" }, - { "diagnose-proc", { NULL }, 6072, "udp" }, - { "directplay8", { NULL }, 6073, "tcp" }, - { "directplay8", { NULL }, 6073, "udp" }, - { "max", { NULL }, 6074, "tcp" }, - { "max", { NULL }, 6074, "udp" }, - { "dpm-acm", { NULL }, 6075, "tcp" }, - { "miami-bcast", { NULL }, 6083, "udp" }, - { "p2p-sip", { NULL }, 6084, "tcp" }, - { "konspire2b", { NULL }, 6085, "tcp" }, - { "konspire2b", { NULL }, 6085, "udp" }, - { "pdtp", { NULL }, 6086, "tcp" }, - { "pdtp", { NULL }, 6086, "udp" }, - { "ldss", { NULL }, 6087, "tcp" }, - { "ldss", { NULL }, 6087, "udp" }, - { "raxa-mgmt", { NULL }, 6099, "tcp" }, - { "synchronet-db", { NULL }, 6100, "tcp" }, - { "synchronet-db", { NULL }, 6100, "udp" }, - { "synchronet-rtc", { NULL }, 6101, "tcp" }, - { "synchronet-rtc", { NULL }, 6101, "udp" }, - { "synchronet-upd", { NULL }, 6102, "tcp" }, - { "synchronet-upd", { NULL }, 6102, "udp" }, - { "rets", { NULL }, 6103, "tcp" }, - { "rets", { NULL }, 6103, "udp" }, - { "dbdb", { NULL }, 6104, "tcp" }, - { "dbdb", { NULL }, 6104, "udp" }, - { "primaserver", { NULL }, 6105, "tcp" }, - { "primaserver", { NULL }, 6105, "udp" }, - { "mpsserver", { NULL }, 6106, "tcp" }, - { "mpsserver", { NULL }, 6106, "udp" }, - { "etc-control", { NULL }, 6107, "tcp" }, - { "etc-control", { NULL }, 6107, "udp" }, - { "sercomm-scadmin", { NULL }, 6108, "tcp" }, - { "sercomm-scadmin", { NULL }, 6108, "udp" }, - { "globecast-id", { NULL }, 6109, "tcp" }, - { "globecast-id", { NULL }, 6109, "udp" }, - { "softcm", { NULL }, 6110, "tcp" }, - { "softcm", { NULL }, 6110, "udp" }, - { "spc", { NULL }, 6111, "tcp" }, - { "spc", { NULL }, 6111, "udp" }, - { "dtspcd", { NULL }, 6112, "tcp" }, - { "dtspcd", { NULL }, 6112, "udp" }, - { "dayliteserver", { NULL }, 6113, "tcp" }, - { "wrspice", { NULL }, 6114, "tcp" }, - { "xic", { NULL }, 6115, "tcp" }, - { "xtlserv", { NULL }, 6116, "tcp" }, - { "daylitetouch", { NULL }, 6117, "tcp" }, - { "spdy", { NULL }, 6121, "tcp" }, - { "bex-webadmin", { NULL }, 6122, "tcp" }, - { "bex-webadmin", { NULL }, 6122, "udp" }, - { "backup-express", { NULL }, 6123, "tcp" }, - { "backup-express", { NULL }, 6123, "udp" }, - { "pnbs", { NULL }, 6124, "tcp" }, - { "pnbs", { NULL }, 6124, "udp" }, - { "nbt-wol", { NULL }, 6133, "tcp" }, - { "nbt-wol", { NULL }, 6133, "udp" }, - { "pulsonixnls", { NULL }, 6140, "tcp" }, - { "pulsonixnls", { NULL }, 6140, "udp" }, - { "meta-corp", { NULL }, 6141, "tcp" }, - { "meta-corp", { NULL }, 6141, "udp" }, - { "aspentec-lm", { NULL }, 6142, "tcp" }, - { "aspentec-lm", { NULL }, 6142, "udp" }, - { "watershed-lm", { NULL }, 6143, "tcp" }, - { "watershed-lm", { NULL }, 6143, "udp" }, - { "statsci1-lm", { NULL }, 6144, "tcp" }, - { "statsci1-lm", { NULL }, 6144, "udp" }, - { "statsci2-lm", { NULL }, 6145, "tcp" }, - { "statsci2-lm", { NULL }, 6145, "udp" }, - { "lonewolf-lm", { NULL }, 6146, "tcp" }, - { "lonewolf-lm", { NULL }, 6146, "udp" }, - { "montage-lm", { NULL }, 6147, "tcp" }, - { "montage-lm", { NULL }, 6147, "udp" }, - { "ricardo-lm", { NULL }, 6148, "tcp" }, - { "ricardo-lm", { NULL }, 6148, "udp" }, - { "tal-pod", { NULL }, 6149, "tcp" }, - { "tal-pod", { NULL }, 6149, "udp" }, - { "efb-aci", { NULL }, 6159, "tcp" }, - { "patrol-ism", { NULL }, 6161, "tcp" }, - { "patrol-ism", { NULL }, 6161, "udp" }, - { "patrol-coll", { NULL }, 6162, "tcp" }, - { "patrol-coll", { NULL }, 6162, "udp" }, - { "pscribe", { NULL }, 6163, "tcp" }, - { "pscribe", { NULL }, 6163, "udp" }, - { "lm-x", { NULL }, 6200, "tcp" }, - { "lm-x", { NULL }, 6200, "udp" }, - { "radmind", { NULL }, 6222, "tcp" }, - { "radmind", { NULL }, 6222, "udp" }, - { "jeol-nsdtp-1", { NULL }, 6241, "tcp" }, - { "jeol-nsddp-1", { NULL }, 6241, "udp" }, - { "jeol-nsdtp-2", { NULL }, 6242, "tcp" }, - { "jeol-nsddp-2", { NULL }, 6242, "udp" }, - { "jeol-nsdtp-3", { NULL }, 6243, "tcp" }, - { "jeol-nsddp-3", { NULL }, 6243, "udp" }, - { "jeol-nsdtp-4", { NULL }, 6244, "tcp" }, - { "jeol-nsddp-4", { NULL }, 6244, "udp" }, - { "tl1-raw-ssl", { NULL }, 6251, "tcp" }, - { "tl1-raw-ssl", { NULL }, 6251, "udp" }, - { "tl1-ssh", { NULL }, 6252, "tcp" }, - { "tl1-ssh", { NULL }, 6252, "udp" }, - { "crip", { NULL }, 6253, "tcp" }, - { "crip", { NULL }, 6253, "udp" }, - { "gld", { NULL }, 6267, "tcp" }, - { "grid", { NULL }, 6268, "tcp" }, - { "grid", { NULL }, 6268, "udp" }, - { "grid-alt", { NULL }, 6269, "tcp" }, - { "grid-alt", { NULL }, 6269, "udp" }, - { "bmc-grx", { NULL }, 6300, "tcp" }, - { "bmc-grx", { NULL }, 6300, "udp" }, - { "bmc_ctd_ldap", { NULL }, 6301, "tcp" }, - { "bmc_ctd_ldap", { NULL }, 6301, "udp" }, - { "ufmp", { NULL }, 6306, "tcp" }, - { "ufmp", { NULL }, 6306, "udp" }, - { "scup", { NULL }, 6315, "tcp" }, - { "scup-disc", { NULL }, 6315, "udp" }, - { "abb-escp", { NULL }, 6316, "tcp" }, - { "abb-escp", { NULL }, 6316, "udp" }, - { "repsvc", { NULL }, 6320, "tcp" }, - { "repsvc", { NULL }, 6320, "udp" }, - { "emp-server1", { NULL }, 6321, "tcp" }, - { "emp-server1", { NULL }, 6321, "udp" }, - { "emp-server2", { NULL }, 6322, "tcp" }, - { "emp-server2", { NULL }, 6322, "udp" }, - { "sflow", { NULL }, 6343, "tcp" }, - { "sflow", { NULL }, 6343, "udp" }, - { "gnutella-svc", { NULL }, 6346, "tcp" }, - { "gnutella-svc", { NULL }, 6346, "udp" }, - { "gnutella-rtr", { NULL }, 6347, "tcp" }, - { "gnutella-rtr", { NULL }, 6347, "udp" }, - { "adap", { NULL }, 6350, "tcp" }, - { "adap", { NULL }, 6350, "udp" }, - { "pmcs", { NULL }, 6355, "tcp" }, - { "pmcs", { NULL }, 6355, "udp" }, - { "metaedit-mu", { NULL }, 6360, "tcp" }, - { "metaedit-mu", { NULL }, 6360, "udp" }, - { "metaedit-se", { NULL }, 6370, "tcp" }, - { "metaedit-se", { NULL }, 6370, "udp" }, - { "metatude-mds", { NULL }, 6382, "tcp" }, - { "metatude-mds", { NULL }, 6382, "udp" }, - { "clariion-evr01", { NULL }, 6389, "tcp" }, - { "clariion-evr01", { NULL }, 6389, "udp" }, - { "metaedit-ws", { NULL }, 6390, "tcp" }, - { "metaedit-ws", { NULL }, 6390, "udp" }, - { "faxcomservice", { NULL }, 6417, "tcp" }, - { "faxcomservice", { NULL }, 6417, "udp" }, - { "syserverremote", { NULL }, 6418, "tcp" }, - { "svdrp", { NULL }, 6419, "tcp" }, - { "nim-vdrshell", { NULL }, 6420, "tcp" }, - { "nim-vdrshell", { NULL }, 6420, "udp" }, - { "nim-wan", { NULL }, 6421, "tcp" }, - { "nim-wan", { NULL }, 6421, "udp" }, - { "pgbouncer", { NULL }, 6432, "tcp" }, - { "sun-sr-https", { NULL }, 6443, "tcp" }, - { "sun-sr-https", { NULL }, 6443, "udp" }, - { "sge_qmaster", { NULL }, 6444, "tcp" }, - { "sge_qmaster", { NULL }, 6444, "udp" }, - { "sge_execd", { NULL }, 6445, "tcp" }, - { "sge_execd", { NULL }, 6445, "udp" }, - { "mysql-proxy", { NULL }, 6446, "tcp" }, - { "mysql-proxy", { NULL }, 6446, "udp" }, - { "skip-cert-recv", { NULL }, 6455, "tcp" }, - { "skip-cert-send", { NULL }, 6456, "udp" }, - { "lvision-lm", { NULL }, 6471, "tcp" }, - { "lvision-lm", { NULL }, 6471, "udp" }, - { "sun-sr-http", { NULL }, 6480, "tcp" }, - { "sun-sr-http", { NULL }, 6480, "udp" }, - { "servicetags", { NULL }, 6481, "tcp" }, - { "servicetags", { NULL }, 6481, "udp" }, - { "ldoms-mgmt", { NULL }, 6482, "tcp" }, - { "ldoms-mgmt", { NULL }, 6482, "udp" }, - { "SunVTS-RMI", { NULL }, 6483, "tcp" }, - { "SunVTS-RMI", { NULL }, 6483, "udp" }, - { "sun-sr-jms", { NULL }, 6484, "tcp" }, - { "sun-sr-jms", { NULL }, 6484, "udp" }, - { "sun-sr-iiop", { NULL }, 6485, "tcp" }, - { "sun-sr-iiop", { NULL }, 6485, "udp" }, - { "sun-sr-iiops", { NULL }, 6486, "tcp" }, - { "sun-sr-iiops", { NULL }, 6486, "udp" }, - { "sun-sr-iiop-aut", { NULL }, 6487, "tcp" }, - { "sun-sr-iiop-aut", { NULL }, 6487, "udp" }, - { "sun-sr-jmx", { NULL }, 6488, "tcp" }, - { "sun-sr-jmx", { NULL }, 6488, "udp" }, - { "sun-sr-admin", { NULL }, 6489, "tcp" }, - { "sun-sr-admin", { NULL }, 6489, "udp" }, - { "boks", { NULL }, 6500, "tcp" }, - { "boks", { NULL }, 6500, "udp" }, - { "boks_servc", { NULL }, 6501, "tcp" }, - { "boks_servc", { NULL }, 6501, "udp" }, - { "boks_servm", { NULL }, 6502, "tcp" }, - { "boks_servm", { NULL }, 6502, "udp" }, - { "boks_clntd", { NULL }, 6503, "tcp" }, - { "boks_clntd", { NULL }, 6503, "udp" }, - { "badm_priv", { NULL }, 6505, "tcp" }, - { "badm_priv", { NULL }, 6505, "udp" }, - { "badm_pub", { NULL }, 6506, "tcp" }, - { "badm_pub", { NULL }, 6506, "udp" }, - { "bdir_priv", { NULL }, 6507, "tcp" }, - { "bdir_priv", { NULL }, 6507, "udp" }, - { "bdir_pub", { NULL }, 6508, "tcp" }, - { "bdir_pub", { NULL }, 6508, "udp" }, - { "mgcs-mfp-port", { NULL }, 6509, "tcp" }, - { "mgcs-mfp-port", { NULL }, 6509, "udp" }, - { "mcer-port", { NULL }, 6510, "tcp" }, - { "mcer-port", { NULL }, 6510, "udp" }, - { "netconf-tls", { NULL }, 6513, "tcp" }, - { "syslog-tls", { NULL }, 6514, "tcp" }, - { "syslog-tls", { NULL }, 6514, "udp" }, - { "syslog-tls", { NULL }, 6514, "dccp" }, - { "elipse-rec", { NULL }, 6515, "tcp" }, - { "elipse-rec", { NULL }, 6515, "udp" }, - { "lds-distrib", { NULL }, 6543, "tcp" }, - { "lds-distrib", { NULL }, 6543, "udp" }, - { "lds-dump", { NULL }, 6544, "tcp" }, - { "lds-dump", { NULL }, 6544, "udp" }, - { "apc-6547", { NULL }, 6547, "tcp" }, - { "apc-6547", { NULL }, 6547, "udp" }, - { "apc-6548", { NULL }, 6548, "tcp" }, - { "apc-6548", { NULL }, 6548, "udp" }, - { "apc-6549", { NULL }, 6549, "tcp" }, - { "apc-6549", { NULL }, 6549, "udp" }, - { "fg-sysupdate", { NULL }, 6550, "tcp" }, - { "fg-sysupdate", { NULL }, 6550, "udp" }, - { "sum", { NULL }, 6551, "tcp" }, - { "sum", { NULL }, 6551, "udp" }, - { "xdsxdm", { NULL }, 6558, "tcp" }, - { "xdsxdm", { NULL }, 6558, "udp" }, - { "sane-port", { NULL }, 6566, "tcp" }, - { "sane-port", { NULL }, 6566, "udp" }, - { "esp", { NULL }, 6567, "tcp" }, - { "esp", { NULL }, 6567, "udp" }, - { "canit_store", { NULL }, 6568, "tcp" }, - { "rp-reputation", { NULL }, 6568, "udp" }, - { "affiliate", { NULL }, 6579, "tcp" }, - { "affiliate", { NULL }, 6579, "udp" }, - { "parsec-master", { NULL }, 6580, "tcp" }, - { "parsec-master", { NULL }, 6580, "udp" }, - { "parsec-peer", { NULL }, 6581, "tcp" }, - { "parsec-peer", { NULL }, 6581, "udp" }, - { "parsec-game", { NULL }, 6582, "tcp" }, - { "parsec-game", { NULL }, 6582, "udp" }, - { "joaJewelSuite", { NULL }, 6583, "tcp" }, - { "joaJewelSuite", { NULL }, 6583, "udp" }, - { "mshvlm", { NULL }, 6600, "tcp" }, - { "mstmg-sstp", { NULL }, 6601, "tcp" }, - { "wsscomfrmwk", { NULL }, 6602, "tcp" }, - { "odette-ftps", { NULL }, 6619, "tcp" }, - { "odette-ftps", { NULL }, 6619, "udp" }, - { "kftp-data", { NULL }, 6620, "tcp" }, - { "kftp-data", { NULL }, 6620, "udp" }, - { "kftp", { NULL }, 6621, "tcp" }, - { "kftp", { NULL }, 6621, "udp" }, - { "mcftp", { NULL }, 6622, "tcp" }, - { "mcftp", { NULL }, 6622, "udp" }, - { "ktelnet", { NULL }, 6623, "tcp" }, - { "ktelnet", { NULL }, 6623, "udp" }, - { "datascaler-db", { NULL }, 6624, "tcp" }, - { "datascaler-ctl", { NULL }, 6625, "tcp" }, - { "wago-service", { NULL }, 6626, "tcp" }, - { "wago-service", { NULL }, 6626, "udp" }, - { "nexgen", { NULL }, 6627, "tcp" }, - { "nexgen", { NULL }, 6627, "udp" }, - { "afesc-mc", { NULL }, 6628, "tcp" }, - { "afesc-mc", { NULL }, 6628, "udp" }, - { "mxodbc-connect", { NULL }, 6632, "tcp" }, - { "pcs-sf-ui-man", { NULL }, 6655, "tcp" }, - { "emgmsg", { NULL }, 6656, "tcp" }, - { "palcom-disc", { NULL }, 6657, "udp" }, - { "vocaltec-gold", { NULL }, 6670, "tcp" }, - { "vocaltec-gold", { NULL }, 6670, "udp" }, - { "p4p-portal", { NULL }, 6671, "tcp" }, - { "p4p-portal", { NULL }, 6671, "udp" }, - { "vision_server", { NULL }, 6672, "tcp" }, - { "vision_server", { NULL }, 6672, "udp" }, - { "vision_elmd", { NULL }, 6673, "tcp" }, - { "vision_elmd", { NULL }, 6673, "udp" }, - { "vfbp", { NULL }, 6678, "tcp" }, - { "vfbp-disc", { NULL }, 6678, "udp" }, - { "osaut", { NULL }, 6679, "tcp" }, - { "osaut", { NULL }, 6679, "udp" }, - { "clever-ctrace", { NULL }, 6687, "tcp" }, - { "clever-tcpip", { NULL }, 6688, "tcp" }, - { "tsa", { NULL }, 6689, "tcp" }, - { "tsa", { NULL }, 6689, "udp" }, - { "babel", { NULL }, 6697, "udp" }, - { "kti-icad-srvr", { NULL }, 6701, "tcp" }, - { "kti-icad-srvr", { NULL }, 6701, "udp" }, - { "e-design-net", { NULL }, 6702, "tcp" }, - { "e-design-net", { NULL }, 6702, "udp" }, - { "e-design-web", { NULL }, 6703, "tcp" }, - { "e-design-web", { NULL }, 6703, "udp" }, - { "frc-hp", { NULL }, 6704, "sctp" }, - { "frc-mp", { NULL }, 6705, "sctp" }, - { "frc-lp", { NULL }, 6706, "sctp" }, - { "ibprotocol", { NULL }, 6714, "tcp" }, - { "ibprotocol", { NULL }, 6714, "udp" }, - { "fibotrader-com", { NULL }, 6715, "tcp" }, - { "fibotrader-com", { NULL }, 6715, "udp" }, - { "bmc-perf-agent", { NULL }, 6767, "tcp" }, - { "bmc-perf-agent", { NULL }, 6767, "udp" }, - { "bmc-perf-mgrd", { NULL }, 6768, "tcp" }, - { "bmc-perf-mgrd", { NULL }, 6768, "udp" }, - { "adi-gxp-srvprt", { NULL }, 6769, "tcp" }, - { "adi-gxp-srvprt", { NULL }, 6769, "udp" }, - { "plysrv-http", { NULL }, 6770, "tcp" }, - { "plysrv-http", { NULL }, 6770, "udp" }, - { "plysrv-https", { NULL }, 6771, "tcp" }, - { "plysrv-https", { NULL }, 6771, "udp" }, - { "dgpf-exchg", { NULL }, 6785, "tcp" }, - { "dgpf-exchg", { NULL }, 6785, "udp" }, - { "smc-jmx", { NULL }, 6786, "tcp" }, - { "smc-jmx", { NULL }, 6786, "udp" }, - { "smc-admin", { NULL }, 6787, "tcp" }, - { "smc-admin", { NULL }, 6787, "udp" }, - { "smc-http", { NULL }, 6788, "tcp" }, - { "smc-http", { NULL }, 6788, "udp" }, - { "smc-https", { NULL }, 6789, "tcp" }, - { "smc-https", { NULL }, 6789, "udp" }, - { "hnmp", { NULL }, 6790, "tcp" }, - { "hnmp", { NULL }, 6790, "udp" }, - { "hnm", { NULL }, 6791, "tcp" }, - { "hnm", { NULL }, 6791, "udp" }, - { "acnet", { NULL }, 6801, "tcp" }, - { "acnet", { NULL }, 6801, "udp" }, - { "pentbox-sim", { NULL }, 6817, "tcp" }, - { "ambit-lm", { NULL }, 6831, "tcp" }, - { "ambit-lm", { NULL }, 6831, "udp" }, - { "netmo-default", { NULL }, 6841, "tcp" }, - { "netmo-default", { NULL }, 6841, "udp" }, - { "netmo-http", { NULL }, 6842, "tcp" }, - { "netmo-http", { NULL }, 6842, "udp" }, - { "iccrushmore", { NULL }, 6850, "tcp" }, - { "iccrushmore", { NULL }, 6850, "udp" }, - { "acctopus-cc", { NULL }, 6868, "tcp" }, - { "acctopus-st", { NULL }, 6868, "udp" }, - { "muse", { NULL }, 6888, "tcp" }, - { "muse", { NULL }, 6888, "udp" }, - { "jetstream", { NULL }, 6901, "tcp" }, - { "xsmsvc", { NULL }, 6936, "tcp" }, - { "xsmsvc", { NULL }, 6936, "udp" }, - { "bioserver", { NULL }, 6946, "tcp" }, - { "bioserver", { NULL }, 6946, "udp" }, - { "otlp", { NULL }, 6951, "tcp" }, - { "otlp", { NULL }, 6951, "udp" }, - { "jmact3", { NULL }, 6961, "tcp" }, - { "jmact3", { NULL }, 6961, "udp" }, - { "jmevt2", { NULL }, 6962, "tcp" }, - { "jmevt2", { NULL }, 6962, "udp" }, - { "swismgr1", { NULL }, 6963, "tcp" }, - { "swismgr1", { NULL }, 6963, "udp" }, - { "swismgr2", { NULL }, 6964, "tcp" }, - { "swismgr2", { NULL }, 6964, "udp" }, - { "swistrap", { NULL }, 6965, "tcp" }, - { "swistrap", { NULL }, 6965, "udp" }, - { "swispol", { NULL }, 6966, "tcp" }, - { "swispol", { NULL }, 6966, "udp" }, - { "acmsoda", { NULL }, 6969, "tcp" }, - { "acmsoda", { NULL }, 6969, "udp" }, - { "MobilitySrv", { NULL }, 6997, "tcp" }, - { "MobilitySrv", { NULL }, 6997, "udp" }, - { "iatp-highpri", { NULL }, 6998, "tcp" }, - { "iatp-highpri", { NULL }, 6998, "udp" }, - { "iatp-normalpri", { NULL }, 6999, "tcp" }, - { "iatp-normalpri", { NULL }, 6999, "udp" }, - { "afs3-fileserver", { NULL }, 7000, "tcp" }, - { "afs3-fileserver", { NULL }, 7000, "udp" }, - { "afs3-callback", { NULL }, 7001, "tcp" }, - { "afs3-callback", { NULL }, 7001, "udp" }, - { "afs3-prserver", { NULL }, 7002, "tcp" }, - { "afs3-prserver", { NULL }, 7002, "udp" }, - { "afs3-vlserver", { NULL }, 7003, "tcp" }, - { "afs3-vlserver", { NULL }, 7003, "udp" }, - { "afs3-kaserver", { NULL }, 7004, "tcp" }, - { "afs3-kaserver", { NULL }, 7004, "udp" }, - { "afs3-volser", { NULL }, 7005, "tcp" }, - { "afs3-volser", { NULL }, 7005, "udp" }, - { "afs3-errors", { NULL }, 7006, "tcp" }, - { "afs3-errors", { NULL }, 7006, "udp" }, - { "afs3-bos", { NULL }, 7007, "tcp" }, - { "afs3-bos", { NULL }, 7007, "udp" }, - { "afs3-update", { NULL }, 7008, "tcp" }, - { "afs3-update", { NULL }, 7008, "udp" }, - { "afs3-rmtsys", { NULL }, 7009, "tcp" }, - { "afs3-rmtsys", { NULL }, 7009, "udp" }, - { "ups-onlinet", { NULL }, 7010, "tcp" }, - { "ups-onlinet", { NULL }, 7010, "udp" }, - { "talon-disc", { NULL }, 7011, "tcp" }, - { "talon-disc", { NULL }, 7011, "udp" }, - { "talon-engine", { NULL }, 7012, "tcp" }, - { "talon-engine", { NULL }, 7012, "udp" }, - { "microtalon-dis", { NULL }, 7013, "tcp" }, - { "microtalon-dis", { NULL }, 7013, "udp" }, - { "microtalon-com", { NULL }, 7014, "tcp" }, - { "microtalon-com", { NULL }, 7014, "udp" }, - { "talon-webserver", { NULL }, 7015, "tcp" }, - { "talon-webserver", { NULL }, 7015, "udp" }, - { "dpserve", { NULL }, 7020, "tcp" }, - { "dpserve", { NULL }, 7020, "udp" }, - { "dpserveadmin", { NULL }, 7021, "tcp" }, - { "dpserveadmin", { NULL }, 7021, "udp" }, - { "ctdp", { NULL }, 7022, "tcp" }, - { "ctdp", { NULL }, 7022, "udp" }, - { "ct2nmcs", { NULL }, 7023, "tcp" }, - { "ct2nmcs", { NULL }, 7023, "udp" }, - { "vmsvc", { NULL }, 7024, "tcp" }, - { "vmsvc", { NULL }, 7024, "udp" }, - { "vmsvc-2", { NULL }, 7025, "tcp" }, - { "vmsvc-2", { NULL }, 7025, "udp" }, - { "op-probe", { NULL }, 7030, "tcp" }, - { "op-probe", { NULL }, 7030, "udp" }, - { "arcp", { NULL }, 7070, "tcp" }, - { "arcp", { NULL }, 7070, "udp" }, - { "iwg1", { NULL }, 7071, "tcp" }, - { "iwg1", { NULL }, 7071, "udp" }, - { "empowerid", { NULL }, 7080, "tcp" }, - { "empowerid", { NULL }, 7080, "udp" }, - { "lazy-ptop", { NULL }, 7099, "tcp" }, - { "lazy-ptop", { NULL }, 7099, "udp" }, - { "font-service", { NULL }, 7100, "tcp" }, - { "font-service", { NULL }, 7100, "udp" }, - { "elcn", { NULL }, 7101, "tcp" }, - { "elcn", { NULL }, 7101, "udp" }, - { "aes-x170", { NULL }, 7107, "udp" }, - { "virprot-lm", { NULL }, 7121, "tcp" }, - { "virprot-lm", { NULL }, 7121, "udp" }, - { "scenidm", { NULL }, 7128, "tcp" }, - { "scenidm", { NULL }, 7128, "udp" }, - { "scenccs", { NULL }, 7129, "tcp" }, - { "scenccs", { NULL }, 7129, "udp" }, - { "cabsm-comm", { NULL }, 7161, "tcp" }, - { "cabsm-comm", { NULL }, 7161, "udp" }, - { "caistoragemgr", { NULL }, 7162, "tcp" }, - { "caistoragemgr", { NULL }, 7162, "udp" }, - { "cacsambroker", { NULL }, 7163, "tcp" }, - { "cacsambroker", { NULL }, 7163, "udp" }, - { "fsr", { NULL }, 7164, "tcp" }, - { "fsr", { NULL }, 7164, "udp" }, - { "doc-server", { NULL }, 7165, "tcp" }, - { "doc-server", { NULL }, 7165, "udp" }, - { "aruba-server", { NULL }, 7166, "tcp" }, - { "aruba-server", { NULL }, 7166, "udp" }, - { "casrmagent", { NULL }, 7167, "tcp" }, - { "cnckadserver", { NULL }, 7168, "tcp" }, - { "ccag-pib", { NULL }, 7169, "tcp" }, - { "ccag-pib", { NULL }, 7169, "udp" }, - { "nsrp", { NULL }, 7170, "tcp" }, - { "nsrp", { NULL }, 7170, "udp" }, - { "drm-production", { NULL }, 7171, "tcp" }, - { "drm-production", { NULL }, 7171, "udp" }, - { "zsecure", { NULL }, 7173, "tcp" }, - { "clutild", { NULL }, 7174, "tcp" }, - { "clutild", { NULL }, 7174, "udp" }, - { "fodms", { NULL }, 7200, "tcp" }, - { "fodms", { NULL }, 7200, "udp" }, - { "dlip", { NULL }, 7201, "tcp" }, - { "dlip", { NULL }, 7201, "udp" }, - { "ramp", { NULL }, 7227, "tcp" }, - { "ramp", { NULL }, 7227, "udp" }, - { "citrixupp", { NULL }, 7228, "tcp" }, - { "citrixuppg", { NULL }, 7229, "tcp" }, - { "pads", { NULL }, 7237, "tcp" }, - { "cnap", { NULL }, 7262, "tcp" }, - { "cnap", { NULL }, 7262, "udp" }, - { "watchme-7272", { NULL }, 7272, "tcp" }, - { "watchme-7272", { NULL }, 7272, "udp" }, - { "oma-rlp", { NULL }, 7273, "tcp" }, - { "oma-rlp", { NULL }, 7273, "udp" }, - { "oma-rlp-s", { NULL }, 7274, "tcp" }, - { "oma-rlp-s", { NULL }, 7274, "udp" }, - { "oma-ulp", { NULL }, 7275, "tcp" }, - { "oma-ulp", { NULL }, 7275, "udp" }, - { "oma-ilp", { NULL }, 7276, "tcp" }, - { "oma-ilp", { NULL }, 7276, "udp" }, - { "oma-ilp-s", { NULL }, 7277, "tcp" }, - { "oma-ilp-s", { NULL }, 7277, "udp" }, - { "oma-dcdocbs", { NULL }, 7278, "tcp" }, - { "oma-dcdocbs", { NULL }, 7278, "udp" }, - { "ctxlic", { NULL }, 7279, "tcp" }, - { "ctxlic", { NULL }, 7279, "udp" }, - { "itactionserver1", { NULL }, 7280, "tcp" }, - { "itactionserver1", { NULL }, 7280, "udp" }, - { "itactionserver2", { NULL }, 7281, "tcp" }, - { "itactionserver2", { NULL }, 7281, "udp" }, - { "mzca-action", { NULL }, 7282, "tcp" }, - { "mzca-alert", { NULL }, 7282, "udp" }, - { "lcm-server", { NULL }, 7365, "tcp" }, - { "lcm-server", { NULL }, 7365, "udp" }, - { "mindfilesys", { NULL }, 7391, "tcp" }, - { "mindfilesys", { NULL }, 7391, "udp" }, - { "mrssrendezvous", { NULL }, 7392, "tcp" }, - { "mrssrendezvous", { NULL }, 7392, "udp" }, - { "nfoldman", { NULL }, 7393, "tcp" }, - { "nfoldman", { NULL }, 7393, "udp" }, - { "fse", { NULL }, 7394, "tcp" }, - { "fse", { NULL }, 7394, "udp" }, - { "winqedit", { NULL }, 7395, "tcp" }, - { "winqedit", { NULL }, 7395, "udp" }, - { "hexarc", { NULL }, 7397, "tcp" }, - { "hexarc", { NULL }, 7397, "udp" }, - { "rtps-discovery", { NULL }, 7400, "tcp" }, - { "rtps-discovery", { NULL }, 7400, "udp" }, - { "rtps-dd-ut", { NULL }, 7401, "tcp" }, - { "rtps-dd-ut", { NULL }, 7401, "udp" }, - { "rtps-dd-mt", { NULL }, 7402, "tcp" }, - { "rtps-dd-mt", { NULL }, 7402, "udp" }, - { "ionixnetmon", { NULL }, 7410, "tcp" }, - { "ionixnetmon", { NULL }, 7410, "udp" }, - { "mtportmon", { NULL }, 7421, "tcp" }, - { "mtportmon", { NULL }, 7421, "udp" }, - { "pmdmgr", { NULL }, 7426, "tcp" }, - { "pmdmgr", { NULL }, 7426, "udp" }, - { "oveadmgr", { NULL }, 7427, "tcp" }, - { "oveadmgr", { NULL }, 7427, "udp" }, - { "ovladmgr", { NULL }, 7428, "tcp" }, - { "ovladmgr", { NULL }, 7428, "udp" }, - { "opi-sock", { NULL }, 7429, "tcp" }, - { "opi-sock", { NULL }, 7429, "udp" }, - { "xmpv7", { NULL }, 7430, "tcp" }, - { "xmpv7", { NULL }, 7430, "udp" }, - { "pmd", { NULL }, 7431, "tcp" }, - { "pmd", { NULL }, 7431, "udp" }, - { "faximum", { NULL }, 7437, "tcp" }, - { "faximum", { NULL }, 7437, "udp" }, - { "oracleas-https", { NULL }, 7443, "tcp" }, - { "oracleas-https", { NULL }, 7443, "udp" }, - { "rise", { NULL }, 7473, "tcp" }, - { "rise", { NULL }, 7473, "udp" }, - { "telops-lmd", { NULL }, 7491, "tcp" }, - { "telops-lmd", { NULL }, 7491, "udp" }, - { "silhouette", { NULL }, 7500, "tcp" }, - { "silhouette", { NULL }, 7500, "udp" }, - { "ovbus", { NULL }, 7501, "tcp" }, - { "ovbus", { NULL }, 7501, "udp" }, - { "acplt", { NULL }, 7509, "tcp" }, - { "ovhpas", { NULL }, 7510, "tcp" }, - { "ovhpas", { NULL }, 7510, "udp" }, - { "pafec-lm", { NULL }, 7511, "tcp" }, - { "pafec-lm", { NULL }, 7511, "udp" }, - { "saratoga", { NULL }, 7542, "tcp" }, - { "saratoga", { NULL }, 7542, "udp" }, - { "atul", { NULL }, 7543, "tcp" }, - { "atul", { NULL }, 7543, "udp" }, - { "nta-ds", { NULL }, 7544, "tcp" }, - { "nta-ds", { NULL }, 7544, "udp" }, - { "nta-us", { NULL }, 7545, "tcp" }, - { "nta-us", { NULL }, 7545, "udp" }, - { "cfs", { NULL }, 7546, "tcp" }, - { "cfs", { NULL }, 7546, "udp" }, - { "cwmp", { NULL }, 7547, "tcp" }, - { "cwmp", { NULL }, 7547, "udp" }, - { "tidp", { NULL }, 7548, "tcp" }, - { "tidp", { NULL }, 7548, "udp" }, - { "nls-tl", { NULL }, 7549, "tcp" }, - { "nls-tl", { NULL }, 7549, "udp" }, - { "sncp", { NULL }, 7560, "tcp" }, - { "sncp", { NULL }, 7560, "udp" }, - { "cfw", { NULL }, 7563, "tcp" }, - { "vsi-omega", { NULL }, 7566, "tcp" }, - { "vsi-omega", { NULL }, 7566, "udp" }, - { "dell-eql-asm", { NULL }, 7569, "tcp" }, - { "aries-kfinder", { NULL }, 7570, "tcp" }, - { "aries-kfinder", { NULL }, 7570, "udp" }, - { "sun-lm", { NULL }, 7588, "tcp" }, - { "sun-lm", { NULL }, 7588, "udp" }, - { "indi", { NULL }, 7624, "tcp" }, - { "indi", { NULL }, 7624, "udp" }, - { "simco", { NULL }, 7626, "tcp" }, - { "simco", { NULL }, 7626, "sctp" }, - { "soap-http", { NULL }, 7627, "tcp" }, - { "soap-http", { NULL }, 7627, "udp" }, - { "zen-pawn", { NULL }, 7628, "tcp" }, - { "zen-pawn", { NULL }, 7628, "udp" }, - { "xdas", { NULL }, 7629, "tcp" }, - { "xdas", { NULL }, 7629, "udp" }, - { "hawk", { NULL }, 7630, "tcp" }, - { "tesla-sys-msg", { NULL }, 7631, "tcp" }, - { "pmdfmgt", { NULL }, 7633, "tcp" }, - { "pmdfmgt", { NULL }, 7633, "udp" }, - { "cuseeme", { NULL }, 7648, "tcp" }, - { "cuseeme", { NULL }, 7648, "udp" }, - { "imqstomp", { NULL }, 7672, "tcp" }, - { "imqstomps", { NULL }, 7673, "tcp" }, - { "imqtunnels", { NULL }, 7674, "tcp" }, - { "imqtunnels", { NULL }, 7674, "udp" }, - { "imqtunnel", { NULL }, 7675, "tcp" }, - { "imqtunnel", { NULL }, 7675, "udp" }, - { "imqbrokerd", { NULL }, 7676, "tcp" }, - { "imqbrokerd", { NULL }, 7676, "udp" }, - { "sun-user-https", { NULL }, 7677, "tcp" }, - { "sun-user-https", { NULL }, 7677, "udp" }, - { "pando-pub", { NULL }, 7680, "tcp" }, - { "pando-pub", { NULL }, 7680, "udp" }, - { "collaber", { NULL }, 7689, "tcp" }, - { "collaber", { NULL }, 7689, "udp" }, - { "klio", { NULL }, 7697, "tcp" }, - { "klio", { NULL }, 7697, "udp" }, - { "em7-secom", { NULL }, 7700, "tcp" }, - { "sync-em7", { NULL }, 7707, "tcp" }, - { "sync-em7", { NULL }, 7707, "udp" }, - { "scinet", { NULL }, 7708, "tcp" }, - { "scinet", { NULL }, 7708, "udp" }, - { "medimageportal", { NULL }, 7720, "tcp" }, - { "medimageportal", { NULL }, 7720, "udp" }, - { "nsdeepfreezectl", { NULL }, 7724, "tcp" }, - { "nsdeepfreezectl", { NULL }, 7724, "udp" }, - { "nitrogen", { NULL }, 7725, "tcp" }, - { "nitrogen", { NULL }, 7725, "udp" }, - { "freezexservice", { NULL }, 7726, "tcp" }, - { "freezexservice", { NULL }, 7726, "udp" }, - { "trident-data", { NULL }, 7727, "tcp" }, - { "trident-data", { NULL }, 7727, "udp" }, - { "smip", { NULL }, 7734, "tcp" }, - { "smip", { NULL }, 7734, "udp" }, - { "aiagent", { NULL }, 7738, "tcp" }, - { "aiagent", { NULL }, 7738, "udp" }, - { "scriptview", { NULL }, 7741, "tcp" }, - { "scriptview", { NULL }, 7741, "udp" }, - { "msss", { NULL }, 7742, "tcp" }, - { "sstp-1", { NULL }, 7743, "tcp" }, - { "sstp-1", { NULL }, 7743, "udp" }, - { "raqmon-pdu", { NULL }, 7744, "tcp" }, - { "raqmon-pdu", { NULL }, 7744, "udp" }, - { "prgp", { NULL }, 7747, "tcp" }, - { "prgp", { NULL }, 7747, "udp" }, - { "cbt", { NULL }, 7777, "tcp" }, - { "cbt", { NULL }, 7777, "udp" }, - { "interwise", { NULL }, 7778, "tcp" }, - { "interwise", { NULL }, 7778, "udp" }, - { "vstat", { NULL }, 7779, "tcp" }, - { "vstat", { NULL }, 7779, "udp" }, - { "accu-lmgr", { NULL }, 7781, "tcp" }, - { "accu-lmgr", { NULL }, 7781, "udp" }, - { "minivend", { NULL }, 7786, "tcp" }, - { "minivend", { NULL }, 7786, "udp" }, - { "popup-reminders", { NULL }, 7787, "tcp" }, - { "popup-reminders", { NULL }, 7787, "udp" }, - { "office-tools", { NULL }, 7789, "tcp" }, - { "office-tools", { NULL }, 7789, "udp" }, - { "q3ade", { NULL }, 7794, "tcp" }, - { "q3ade", { NULL }, 7794, "udp" }, - { "pnet-conn", { NULL }, 7797, "tcp" }, - { "pnet-conn", { NULL }, 7797, "udp" }, - { "pnet-enc", { NULL }, 7798, "tcp" }, - { "pnet-enc", { NULL }, 7798, "udp" }, - { "altbsdp", { NULL }, 7799, "tcp" }, - { "altbsdp", { NULL }, 7799, "udp" }, - { "asr", { NULL }, 7800, "tcp" }, - { "asr", { NULL }, 7800, "udp" }, - { "ssp-client", { NULL }, 7801, "tcp" }, - { "ssp-client", { NULL }, 7801, "udp" }, - { "rbt-wanopt", { NULL }, 7810, "tcp" }, - { "rbt-wanopt", { NULL }, 7810, "udp" }, - { "apc-7845", { NULL }, 7845, "tcp" }, - { "apc-7845", { NULL }, 7845, "udp" }, - { "apc-7846", { NULL }, 7846, "tcp" }, - { "apc-7846", { NULL }, 7846, "udp" }, - { "mobileanalyzer", { NULL }, 7869, "tcp" }, - { "rbt-smc", { NULL }, 7870, "tcp" }, - { "pss", { NULL }, 7880, "tcp" }, - { "pss", { NULL }, 7880, "udp" }, - { "ubroker", { NULL }, 7887, "tcp" }, - { "ubroker", { NULL }, 7887, "udp" }, - { "mevent", { NULL }, 7900, "tcp" }, - { "mevent", { NULL }, 7900, "udp" }, - { "tnos-sp", { NULL }, 7901, "tcp" }, - { "tnos-sp", { NULL }, 7901, "udp" }, - { "tnos-dp", { NULL }, 7902, "tcp" }, - { "tnos-dp", { NULL }, 7902, "udp" }, - { "tnos-dps", { NULL }, 7903, "tcp" }, - { "tnos-dps", { NULL }, 7903, "udp" }, - { "qo-secure", { NULL }, 7913, "tcp" }, - { "qo-secure", { NULL }, 7913, "udp" }, - { "t2-drm", { NULL }, 7932, "tcp" }, - { "t2-drm", { NULL }, 7932, "udp" }, - { "t2-brm", { NULL }, 7933, "tcp" }, - { "t2-brm", { NULL }, 7933, "udp" }, - { "supercell", { NULL }, 7967, "tcp" }, - { "supercell", { NULL }, 7967, "udp" }, - { "micromuse-ncps", { NULL }, 7979, "tcp" }, - { "micromuse-ncps", { NULL }, 7979, "udp" }, - { "quest-vista", { NULL }, 7980, "tcp" }, - { "quest-vista", { NULL }, 7980, "udp" }, - { "sossd-collect", { NULL }, 7981, "tcp" }, - { "sossd-agent", { NULL }, 7982, "tcp" }, - { "sossd-disc", { NULL }, 7982, "udp" }, - { "pushns", { NULL }, 7997, "tcp" }, - { "usicontentpush", { NULL }, 7998, "udp" }, - { "irdmi2", { NULL }, 7999, "tcp" }, - { "irdmi2", { NULL }, 7999, "udp" }, - { "irdmi", { NULL }, 8000, "tcp" }, - { "irdmi", { NULL }, 8000, "udp" }, - { "vcom-tunnel", { NULL }, 8001, "tcp" }, - { "vcom-tunnel", { NULL }, 8001, "udp" }, - { "teradataordbms", { NULL }, 8002, "tcp" }, - { "teradataordbms", { NULL }, 8002, "udp" }, - { "mcreport", { NULL }, 8003, "tcp" }, - { "mcreport", { NULL }, 8003, "udp" }, - { "mxi", { NULL }, 8005, "tcp" }, - { "mxi", { NULL }, 8005, "udp" }, - { "http-alt", { NULL }, 8008, "tcp" }, - { "http-alt", { NULL }, 8008, "udp" }, - { "qbdb", { NULL }, 8019, "tcp" }, - { "qbdb", { NULL }, 8019, "udp" }, - { "intu-ec-svcdisc", { NULL }, 8020, "tcp" }, - { "intu-ec-svcdisc", { NULL }, 8020, "udp" }, - { "intu-ec-client", { NULL }, 8021, "tcp" }, - { "intu-ec-client", { NULL }, 8021, "udp" }, - { "oa-system", { NULL }, 8022, "tcp" }, - { "oa-system", { NULL }, 8022, "udp" }, - { "ca-audit-da", { NULL }, 8025, "tcp" }, - { "ca-audit-da", { NULL }, 8025, "udp" }, - { "ca-audit-ds", { NULL }, 8026, "tcp" }, - { "ca-audit-ds", { NULL }, 8026, "udp" }, - { "pro-ed", { NULL }, 8032, "tcp" }, - { "pro-ed", { NULL }, 8032, "udp" }, - { "mindprint", { NULL }, 8033, "tcp" }, - { "mindprint", { NULL }, 8033, "udp" }, - { "vantronix-mgmt", { NULL }, 8034, "tcp" }, - { "vantronix-mgmt", { NULL }, 8034, "udp" }, - { "ampify", { NULL }, 8040, "tcp" }, - { "ampify", { NULL }, 8040, "udp" }, - { "fs-agent", { NULL }, 8042, "tcp" }, - { "fs-server", { NULL }, 8043, "tcp" }, - { "fs-mgmt", { NULL }, 8044, "tcp" }, - { "senomix01", { NULL }, 8052, "tcp" }, - { "senomix01", { NULL }, 8052, "udp" }, - { "senomix02", { NULL }, 8053, "tcp" }, - { "senomix02", { NULL }, 8053, "udp" }, - { "senomix03", { NULL }, 8054, "tcp" }, - { "senomix03", { NULL }, 8054, "udp" }, - { "senomix04", { NULL }, 8055, "tcp" }, - { "senomix04", { NULL }, 8055, "udp" }, - { "senomix05", { NULL }, 8056, "tcp" }, - { "senomix05", { NULL }, 8056, "udp" }, - { "senomix06", { NULL }, 8057, "tcp" }, - { "senomix06", { NULL }, 8057, "udp" }, - { "senomix07", { NULL }, 8058, "tcp" }, - { "senomix07", { NULL }, 8058, "udp" }, - { "senomix08", { NULL }, 8059, "tcp" }, - { "senomix08", { NULL }, 8059, "udp" }, - { "gadugadu", { NULL }, 8074, "tcp" }, - { "gadugadu", { NULL }, 8074, "udp" }, - { "http-alt", { NULL }, 8080, "tcp" }, - { "http-alt", { NULL }, 8080, "udp" }, - { "sunproxyadmin", { NULL }, 8081, "tcp" }, - { "sunproxyadmin", { NULL }, 8081, "udp" }, - { "us-cli", { NULL }, 8082, "tcp" }, - { "us-cli", { NULL }, 8082, "udp" }, - { "us-srv", { NULL }, 8083, "tcp" }, - { "us-srv", { NULL }, 8083, "udp" }, - { "d-s-n", { NULL }, 8086, "tcp" }, - { "d-s-n", { NULL }, 8086, "udp" }, - { "simplifymedia", { NULL }, 8087, "tcp" }, - { "simplifymedia", { NULL }, 8087, "udp" }, - { "radan-http", { NULL }, 8088, "tcp" }, - { "radan-http", { NULL }, 8088, "udp" }, - { "jamlink", { NULL }, 8091, "tcp" }, - { "sac", { NULL }, 8097, "tcp" }, - { "sac", { NULL }, 8097, "udp" }, - { "xprint-server", { NULL }, 8100, "tcp" }, - { "xprint-server", { NULL }, 8100, "udp" }, - { "ldoms-migr", { NULL }, 8101, "tcp" }, - { "mtl8000-matrix", { NULL }, 8115, "tcp" }, - { "mtl8000-matrix", { NULL }, 8115, "udp" }, - { "cp-cluster", { NULL }, 8116, "tcp" }, - { "cp-cluster", { NULL }, 8116, "udp" }, - { "privoxy", { NULL }, 8118, "tcp" }, - { "privoxy", { NULL }, 8118, "udp" }, - { "apollo-data", { NULL }, 8121, "tcp" }, - { "apollo-data", { NULL }, 8121, "udp" }, - { "apollo-admin", { NULL }, 8122, "tcp" }, - { "apollo-admin", { NULL }, 8122, "udp" }, - { "paycash-online", { NULL }, 8128, "tcp" }, - { "paycash-online", { NULL }, 8128, "udp" }, - { "paycash-wbp", { NULL }, 8129, "tcp" }, - { "paycash-wbp", { NULL }, 8129, "udp" }, - { "indigo-vrmi", { NULL }, 8130, "tcp" }, - { "indigo-vrmi", { NULL }, 8130, "udp" }, - { "indigo-vbcp", { NULL }, 8131, "tcp" }, - { "indigo-vbcp", { NULL }, 8131, "udp" }, - { "dbabble", { NULL }, 8132, "tcp" }, - { "dbabble", { NULL }, 8132, "udp" }, - { "isdd", { NULL }, 8148, "tcp" }, - { "isdd", { NULL }, 8148, "udp" }, - { "patrol", { NULL }, 8160, "tcp" }, - { "patrol", { NULL }, 8160, "udp" }, - { "patrol-snmp", { NULL }, 8161, "tcp" }, - { "patrol-snmp", { NULL }, 8161, "udp" }, - { "vmware-fdm", { NULL }, 8182, "tcp" }, - { "vmware-fdm", { NULL }, 8182, "udp" }, - { "proremote", { NULL }, 8183, "tcp" }, - { "itach", { NULL }, 8184, "tcp" }, - { "itach", { NULL }, 8184, "udp" }, - { "spytechphone", { NULL }, 8192, "tcp" }, - { "spytechphone", { NULL }, 8192, "udp" }, - { "blp1", { NULL }, 8194, "tcp" }, - { "blp1", { NULL }, 8194, "udp" }, - { "blp2", { NULL }, 8195, "tcp" }, - { "blp2", { NULL }, 8195, "udp" }, - { "vvr-data", { NULL }, 8199, "tcp" }, - { "vvr-data", { NULL }, 8199, "udp" }, - { "trivnet1", { NULL }, 8200, "tcp" }, - { "trivnet1", { NULL }, 8200, "udp" }, - { "trivnet2", { NULL }, 8201, "tcp" }, - { "trivnet2", { NULL }, 8201, "udp" }, - { "lm-perfworks", { NULL }, 8204, "tcp" }, - { "lm-perfworks", { NULL }, 8204, "udp" }, - { "lm-instmgr", { NULL }, 8205, "tcp" }, - { "lm-instmgr", { NULL }, 8205, "udp" }, - { "lm-dta", { NULL }, 8206, "tcp" }, - { "lm-dta", { NULL }, 8206, "udp" }, - { "lm-sserver", { NULL }, 8207, "tcp" }, - { "lm-sserver", { NULL }, 8207, "udp" }, - { "lm-webwatcher", { NULL }, 8208, "tcp" }, - { "lm-webwatcher", { NULL }, 8208, "udp" }, - { "rexecj", { NULL }, 8230, "tcp" }, - { "rexecj", { NULL }, 8230, "udp" }, - { "synapse-nhttps", { NULL }, 8243, "tcp" }, - { "synapse-nhttps", { NULL }, 8243, "udp" }, - { "pando-sec", { NULL }, 8276, "tcp" }, - { "pando-sec", { NULL }, 8276, "udp" }, - { "synapse-nhttp", { NULL }, 8280, "tcp" }, - { "synapse-nhttp", { NULL }, 8280, "udp" }, - { "blp3", { NULL }, 8292, "tcp" }, - { "blp3", { NULL }, 8292, "udp" }, - { "hiperscan-id", { NULL }, 8293, "tcp" }, - { "blp4", { NULL }, 8294, "tcp" }, - { "blp4", { NULL }, 8294, "udp" }, - { "tmi", { NULL }, 8300, "tcp" }, - { "tmi", { NULL }, 8300, "udp" }, - { "amberon", { NULL }, 8301, "tcp" }, - { "amberon", { NULL }, 8301, "udp" }, - { "tnp-discover", { NULL }, 8320, "tcp" }, - { "tnp-discover", { NULL }, 8320, "udp" }, - { "tnp", { NULL }, 8321, "tcp" }, - { "tnp", { NULL }, 8321, "udp" }, - { "server-find", { NULL }, 8351, "tcp" }, - { "server-find", { NULL }, 8351, "udp" }, - { "cruise-enum", { NULL }, 8376, "tcp" }, - { "cruise-enum", { NULL }, 8376, "udp" }, - { "cruise-swroute", { NULL }, 8377, "tcp" }, - { "cruise-swroute", { NULL }, 8377, "udp" }, - { "cruise-config", { NULL }, 8378, "tcp" }, - { "cruise-config", { NULL }, 8378, "udp" }, - { "cruise-diags", { NULL }, 8379, "tcp" }, - { "cruise-diags", { NULL }, 8379, "udp" }, - { "cruise-update", { NULL }, 8380, "tcp" }, - { "cruise-update", { NULL }, 8380, "udp" }, - { "m2mservices", { NULL }, 8383, "tcp" }, - { "m2mservices", { NULL }, 8383, "udp" }, - { "cvd", { NULL }, 8400, "tcp" }, - { "cvd", { NULL }, 8400, "udp" }, - { "sabarsd", { NULL }, 8401, "tcp" }, - { "sabarsd", { NULL }, 8401, "udp" }, - { "abarsd", { NULL }, 8402, "tcp" }, - { "abarsd", { NULL }, 8402, "udp" }, - { "admind", { NULL }, 8403, "tcp" }, - { "admind", { NULL }, 8403, "udp" }, - { "svcloud", { NULL }, 8404, "tcp" }, - { "svbackup", { NULL }, 8405, "tcp" }, - { "espeech", { NULL }, 8416, "tcp" }, - { "espeech", { NULL }, 8416, "udp" }, - { "espeech-rtp", { NULL }, 8417, "tcp" }, - { "espeech-rtp", { NULL }, 8417, "udp" }, - { "cybro-a-bus", { NULL }, 8442, "tcp" }, - { "cybro-a-bus", { NULL }, 8442, "udp" }, - { "pcsync-https", { NULL }, 8443, "tcp" }, - { "pcsync-https", { NULL }, 8443, "udp" }, - { "pcsync-http", { NULL }, 8444, "tcp" }, - { "pcsync-http", { NULL }, 8444, "udp" }, - { "npmp", { NULL }, 8450, "tcp" }, - { "npmp", { NULL }, 8450, "udp" }, - { "cisco-avp", { NULL }, 8470, "tcp" }, - { "pim-port", { NULL }, 8471, "tcp" }, - { "pim-port", { NULL }, 8471, "sctp" }, - { "otv", { NULL }, 8472, "tcp" }, - { "otv", { NULL }, 8472, "udp" }, - { "vp2p", { NULL }, 8473, "tcp" }, - { "vp2p", { NULL }, 8473, "udp" }, - { "noteshare", { NULL }, 8474, "tcp" }, - { "noteshare", { NULL }, 8474, "udp" }, - { "fmtp", { NULL }, 8500, "tcp" }, - { "fmtp", { NULL }, 8500, "udp" }, - { "rtsp-alt", { NULL }, 8554, "tcp" }, - { "rtsp-alt", { NULL }, 8554, "udp" }, - { "d-fence", { NULL }, 8555, "tcp" }, - { "d-fence", { NULL }, 8555, "udp" }, - { "oap-admin", { NULL }, 8567, "tcp" }, - { "oap-admin", { NULL }, 8567, "udp" }, - { "asterix", { NULL }, 8600, "tcp" }, - { "asterix", { NULL }, 8600, "udp" }, - { "canon-mfnp", { NULL }, 8610, "tcp" }, - { "canon-mfnp", { NULL }, 8610, "udp" }, - { "canon-bjnp1", { NULL }, 8611, "tcp" }, - { "canon-bjnp1", { NULL }, 8611, "udp" }, - { "canon-bjnp2", { NULL }, 8612, "tcp" }, - { "canon-bjnp2", { NULL }, 8612, "udp" }, - { "canon-bjnp3", { NULL }, 8613, "tcp" }, - { "canon-bjnp3", { NULL }, 8613, "udp" }, - { "canon-bjnp4", { NULL }, 8614, "tcp" }, - { "canon-bjnp4", { NULL }, 8614, "udp" }, - { "sun-as-jmxrmi", { NULL }, 8686, "tcp" }, - { "sun-as-jmxrmi", { NULL }, 8686, "udp" }, - { "vnyx", { NULL }, 8699, "tcp" }, - { "vnyx", { NULL }, 8699, "udp" }, - { "dtp-net", { NULL }, 8732, "udp" }, - { "ibus", { NULL }, 8733, "tcp" }, - { "ibus", { NULL }, 8733, "udp" }, - { "mc-appserver", { NULL }, 8763, "tcp" }, - { "mc-appserver", { NULL }, 8763, "udp" }, - { "openqueue", { NULL }, 8764, "tcp" }, - { "openqueue", { NULL }, 8764, "udp" }, - { "ultraseek-http", { NULL }, 8765, "tcp" }, - { "ultraseek-http", { NULL }, 8765, "udp" }, - { "dpap", { NULL }, 8770, "tcp" }, - { "dpap", { NULL }, 8770, "udp" }, - { "msgclnt", { NULL }, 8786, "tcp" }, - { "msgclnt", { NULL }, 8786, "udp" }, - { "msgsrvr", { NULL }, 8787, "tcp" }, - { "msgsrvr", { NULL }, 8787, "udp" }, - { "sunwebadmin", { NULL }, 8800, "tcp" }, - { "sunwebadmin", { NULL }, 8800, "udp" }, - { "truecm", { NULL }, 8804, "tcp" }, - { "truecm", { NULL }, 8804, "udp" }, - { "dxspider", { NULL }, 8873, "tcp" }, - { "dxspider", { NULL }, 8873, "udp" }, - { "cddbp-alt", { NULL }, 8880, "tcp" }, - { "cddbp-alt", { NULL }, 8880, "udp" }, - { "secure-mqtt", { NULL }, 8883, "tcp" }, - { "secure-mqtt", { NULL }, 8883, "udp" }, - { "ddi-tcp-1", { NULL }, 8888, "tcp" }, - { "ddi-udp-1", { NULL }, 8888, "udp" }, - { "ddi-tcp-2", { NULL }, 8889, "tcp" }, - { "ddi-udp-2", { NULL }, 8889, "udp" }, - { "ddi-tcp-3", { NULL }, 8890, "tcp" }, - { "ddi-udp-3", { NULL }, 8890, "udp" }, - { "ddi-tcp-4", { NULL }, 8891, "tcp" }, - { "ddi-udp-4", { NULL }, 8891, "udp" }, - { "ddi-tcp-5", { NULL }, 8892, "tcp" }, - { "ddi-udp-5", { NULL }, 8892, "udp" }, - { "ddi-tcp-6", { NULL }, 8893, "tcp" }, - { "ddi-udp-6", { NULL }, 8893, "udp" }, - { "ddi-tcp-7", { NULL }, 8894, "tcp" }, - { "ddi-udp-7", { NULL }, 8894, "udp" }, - { "ospf-lite", { NULL }, 8899, "tcp" }, - { "ospf-lite", { NULL }, 8899, "udp" }, - { "jmb-cds1", { NULL }, 8900, "tcp" }, - { "jmb-cds1", { NULL }, 8900, "udp" }, - { "jmb-cds2", { NULL }, 8901, "tcp" }, - { "jmb-cds2", { NULL }, 8901, "udp" }, - { "manyone-http", { NULL }, 8910, "tcp" }, - { "manyone-http", { NULL }, 8910, "udp" }, - { "manyone-xml", { NULL }, 8911, "tcp" }, - { "manyone-xml", { NULL }, 8911, "udp" }, - { "wcbackup", { NULL }, 8912, "tcp" }, - { "wcbackup", { NULL }, 8912, "udp" }, - { "dragonfly", { NULL }, 8913, "tcp" }, - { "dragonfly", { NULL }, 8913, "udp" }, - { "twds", { NULL }, 8937, "tcp" }, - { "cumulus-admin", { NULL }, 8954, "tcp" }, - { "cumulus-admin", { NULL }, 8954, "udp" }, - { "sunwebadmins", { NULL }, 8989, "tcp" }, - { "sunwebadmins", { NULL }, 8989, "udp" }, - { "http-wmap", { NULL }, 8990, "tcp" }, - { "http-wmap", { NULL }, 8990, "udp" }, - { "https-wmap", { NULL }, 8991, "tcp" }, - { "https-wmap", { NULL }, 8991, "udp" }, - { "bctp", { NULL }, 8999, "tcp" }, - { "bctp", { NULL }, 8999, "udp" }, - { "cslistener", { NULL }, 9000, "tcp" }, - { "cslistener", { NULL }, 9000, "udp" }, - { "etlservicemgr", { NULL }, 9001, "tcp" }, - { "etlservicemgr", { NULL }, 9001, "udp" }, - { "dynamid", { NULL }, 9002, "tcp" }, - { "dynamid", { NULL }, 9002, "udp" }, - { "ogs-client", { NULL }, 9007, "udp" }, - { "ogs-server", { NULL }, 9008, "tcp" }, - { "pichat", { NULL }, 9009, "tcp" }, - { "pichat", { NULL }, 9009, "udp" }, - { "sdr", { NULL }, 9010, "tcp" }, - { "tambora", { NULL }, 9020, "tcp" }, - { "tambora", { NULL }, 9020, "udp" }, - { "panagolin-ident", { NULL }, 9021, "tcp" }, - { "panagolin-ident", { NULL }, 9021, "udp" }, - { "paragent", { NULL }, 9022, "tcp" }, - { "paragent", { NULL }, 9022, "udp" }, - { "swa-1", { NULL }, 9023, "tcp" }, - { "swa-1", { NULL }, 9023, "udp" }, - { "swa-2", { NULL }, 9024, "tcp" }, - { "swa-2", { NULL }, 9024, "udp" }, - { "swa-3", { NULL }, 9025, "tcp" }, - { "swa-3", { NULL }, 9025, "udp" }, - { "swa-4", { NULL }, 9026, "tcp" }, - { "swa-4", { NULL }, 9026, "udp" }, - { "versiera", { NULL }, 9050, "tcp" }, - { "fio-cmgmt", { NULL }, 9051, "tcp" }, - { "glrpc", { NULL }, 9080, "tcp" }, - { "glrpc", { NULL }, 9080, "udp" }, - { "lcs-ap", { NULL }, 9082, "sctp" }, - { "emc-pp-mgmtsvc", { NULL }, 9083, "tcp" }, - { "aurora", { NULL }, 9084, "tcp" }, - { "aurora", { NULL }, 9084, "udp" }, - { "aurora", { NULL }, 9084, "sctp" }, - { "ibm-rsyscon", { NULL }, 9085, "tcp" }, - { "ibm-rsyscon", { NULL }, 9085, "udp" }, - { "net2display", { NULL }, 9086, "tcp" }, - { "net2display", { NULL }, 9086, "udp" }, - { "classic", { NULL }, 9087, "tcp" }, - { "classic", { NULL }, 9087, "udp" }, - { "sqlexec", { NULL }, 9088, "tcp" }, - { "sqlexec", { NULL }, 9088, "udp" }, - { "sqlexec-ssl", { NULL }, 9089, "tcp" }, - { "sqlexec-ssl", { NULL }, 9089, "udp" }, - { "websm", { NULL }, 9090, "tcp" }, - { "websm", { NULL }, 9090, "udp" }, - { "xmltec-xmlmail", { NULL }, 9091, "tcp" }, - { "xmltec-xmlmail", { NULL }, 9091, "udp" }, - { "XmlIpcRegSvc", { NULL }, 9092, "tcp" }, - { "XmlIpcRegSvc", { NULL }, 9092, "udp" }, - { "hp-pdl-datastr", { NULL }, 9100, "tcp" }, - { "hp-pdl-datastr", { NULL }, 9100, "udp" }, - { "pdl-datastream", { NULL }, 9100, "tcp" }, - { "pdl-datastream", { NULL }, 9100, "udp" }, - { "bacula-dir", { NULL }, 9101, "tcp" }, - { "bacula-dir", { NULL }, 9101, "udp" }, - { "bacula-fd", { NULL }, 9102, "tcp" }, - { "bacula-fd", { NULL }, 9102, "udp" }, - { "bacula-sd", { NULL }, 9103, "tcp" }, - { "bacula-sd", { NULL }, 9103, "udp" }, - { "peerwire", { NULL }, 9104, "tcp" }, - { "peerwire", { NULL }, 9104, "udp" }, - { "xadmin", { NULL }, 9105, "tcp" }, - { "xadmin", { NULL }, 9105, "udp" }, - { "astergate", { NULL }, 9106, "tcp" }, - { "astergate-disc", { NULL }, 9106, "udp" }, - { "astergatefax", { NULL }, 9107, "tcp" }, - { "mxit", { NULL }, 9119, "tcp" }, - { "mxit", { NULL }, 9119, "udp" }, - { "dddp", { NULL }, 9131, "tcp" }, - { "dddp", { NULL }, 9131, "udp" }, - { "apani1", { NULL }, 9160, "tcp" }, - { "apani1", { NULL }, 9160, "udp" }, - { "apani2", { NULL }, 9161, "tcp" }, - { "apani2", { NULL }, 9161, "udp" }, - { "apani3", { NULL }, 9162, "tcp" }, - { "apani3", { NULL }, 9162, "udp" }, - { "apani4", { NULL }, 9163, "tcp" }, - { "apani4", { NULL }, 9163, "udp" }, - { "apani5", { NULL }, 9164, "tcp" }, - { "apani5", { NULL }, 9164, "udp" }, - { "sun-as-jpda", { NULL }, 9191, "tcp" }, - { "sun-as-jpda", { NULL }, 9191, "udp" }, - { "wap-wsp", { NULL }, 9200, "tcp" }, - { "wap-wsp", { NULL }, 9200, "udp" }, - { "wap-wsp-wtp", { NULL }, 9201, "tcp" }, - { "wap-wsp-wtp", { NULL }, 9201, "udp" }, - { "wap-wsp-s", { NULL }, 9202, "tcp" }, - { "wap-wsp-s", { NULL }, 9202, "udp" }, - { "wap-wsp-wtp-s", { NULL }, 9203, "tcp" }, - { "wap-wsp-wtp-s", { NULL }, 9203, "udp" }, - { "wap-vcard", { NULL }, 9204, "tcp" }, - { "wap-vcard", { NULL }, 9204, "udp" }, - { "wap-vcal", { NULL }, 9205, "tcp" }, - { "wap-vcal", { NULL }, 9205, "udp" }, - { "wap-vcard-s", { NULL }, 9206, "tcp" }, - { "wap-vcard-s", { NULL }, 9206, "udp" }, - { "wap-vcal-s", { NULL }, 9207, "tcp" }, - { "wap-vcal-s", { NULL }, 9207, "udp" }, - { "rjcdb-vcards", { NULL }, 9208, "tcp" }, - { "rjcdb-vcards", { NULL }, 9208, "udp" }, - { "almobile-system", { NULL }, 9209, "tcp" }, - { "almobile-system", { NULL }, 9209, "udp" }, - { "oma-mlp", { NULL }, 9210, "tcp" }, - { "oma-mlp", { NULL }, 9210, "udp" }, - { "oma-mlp-s", { NULL }, 9211, "tcp" }, - { "oma-mlp-s", { NULL }, 9211, "udp" }, - { "serverviewdbms", { NULL }, 9212, "tcp" }, - { "serverviewdbms", { NULL }, 9212, "udp" }, - { "serverstart", { NULL }, 9213, "tcp" }, - { "serverstart", { NULL }, 9213, "udp" }, - { "ipdcesgbs", { NULL }, 9214, "tcp" }, - { "ipdcesgbs", { NULL }, 9214, "udp" }, - { "insis", { NULL }, 9215, "tcp" }, - { "insis", { NULL }, 9215, "udp" }, - { "acme", { NULL }, 9216, "tcp" }, - { "acme", { NULL }, 9216, "udp" }, - { "fsc-port", { NULL }, 9217, "tcp" }, - { "fsc-port", { NULL }, 9217, "udp" }, - { "teamcoherence", { NULL }, 9222, "tcp" }, - { "teamcoherence", { NULL }, 9222, "udp" }, - { "mon", { NULL }, 9255, "tcp" }, - { "mon", { NULL }, 9255, "udp" }, - { "pegasus", { NULL }, 9278, "tcp" }, - { "pegasus", { NULL }, 9278, "udp" }, - { "pegasus-ctl", { NULL }, 9279, "tcp" }, - { "pegasus-ctl", { NULL }, 9279, "udp" }, - { "pgps", { NULL }, 9280, "tcp" }, - { "pgps", { NULL }, 9280, "udp" }, - { "swtp-port1", { NULL }, 9281, "tcp" }, - { "swtp-port1", { NULL }, 9281, "udp" }, - { "swtp-port2", { NULL }, 9282, "tcp" }, - { "swtp-port2", { NULL }, 9282, "udp" }, - { "callwaveiam", { NULL }, 9283, "tcp" }, - { "callwaveiam", { NULL }, 9283, "udp" }, - { "visd", { NULL }, 9284, "tcp" }, - { "visd", { NULL }, 9284, "udp" }, - { "n2h2server", { NULL }, 9285, "tcp" }, - { "n2h2server", { NULL }, 9285, "udp" }, - { "n2receive", { NULL }, 9286, "udp" }, - { "cumulus", { NULL }, 9287, "tcp" }, - { "cumulus", { NULL }, 9287, "udp" }, - { "armtechdaemon", { NULL }, 9292, "tcp" }, - { "armtechdaemon", { NULL }, 9292, "udp" }, - { "storview", { NULL }, 9293, "tcp" }, - { "storview", { NULL }, 9293, "udp" }, - { "armcenterhttp", { NULL }, 9294, "tcp" }, - { "armcenterhttp", { NULL }, 9294, "udp" }, - { "armcenterhttps", { NULL }, 9295, "tcp" }, - { "armcenterhttps", { NULL }, 9295, "udp" }, - { "vrace", { NULL }, 9300, "tcp" }, - { "vrace", { NULL }, 9300, "udp" }, - { "sphinxql", { NULL }, 9306, "tcp" }, - { "sphinxapi", { NULL }, 9312, "tcp" }, - { "secure-ts", { NULL }, 9318, "tcp" }, - { "secure-ts", { NULL }, 9318, "udp" }, - { "guibase", { NULL }, 9321, "tcp" }, - { "guibase", { NULL }, 9321, "udp" }, - { "mpidcmgr", { NULL }, 9343, "tcp" }, - { "mpidcmgr", { NULL }, 9343, "udp" }, - { "mphlpdmc", { NULL }, 9344, "tcp" }, - { "mphlpdmc", { NULL }, 9344, "udp" }, - { "ctechlicensing", { NULL }, 9346, "tcp" }, - { "ctechlicensing", { NULL }, 9346, "udp" }, - { "fjdmimgr", { NULL }, 9374, "tcp" }, - { "fjdmimgr", { NULL }, 9374, "udp" }, - { "boxp", { NULL }, 9380, "tcp" }, - { "boxp", { NULL }, 9380, "udp" }, - { "d2dconfig", { NULL }, 9387, "tcp" }, - { "d2ddatatrans", { NULL }, 9388, "tcp" }, - { "adws", { NULL }, 9389, "tcp" }, - { "otp", { NULL }, 9390, "tcp" }, - { "fjinvmgr", { NULL }, 9396, "tcp" }, - { "fjinvmgr", { NULL }, 9396, "udp" }, - { "mpidcagt", { NULL }, 9397, "tcp" }, - { "mpidcagt", { NULL }, 9397, "udp" }, - { "sec-t4net-srv", { NULL }, 9400, "tcp" }, - { "sec-t4net-srv", { NULL }, 9400, "udp" }, - { "sec-t4net-clt", { NULL }, 9401, "tcp" }, - { "sec-t4net-clt", { NULL }, 9401, "udp" }, - { "sec-pc2fax-srv", { NULL }, 9402, "tcp" }, - { "sec-pc2fax-srv", { NULL }, 9402, "udp" }, - { "git", { NULL }, 9418, "tcp" }, - { "git", { NULL }, 9418, "udp" }, - { "tungsten-https", { NULL }, 9443, "tcp" }, - { "tungsten-https", { NULL }, 9443, "udp" }, - { "wso2esb-console", { NULL }, 9444, "tcp" }, - { "wso2esb-console", { NULL }, 9444, "udp" }, - { "sntlkeyssrvr", { NULL }, 9450, "tcp" }, - { "sntlkeyssrvr", { NULL }, 9450, "udp" }, - { "ismserver", { NULL }, 9500, "tcp" }, - { "ismserver", { NULL }, 9500, "udp" }, - { "sma-spw", { NULL }, 9522, "udp" }, - { "mngsuite", { NULL }, 9535, "tcp" }, - { "mngsuite", { NULL }, 9535, "udp" }, - { "laes-bf", { NULL }, 9536, "tcp" }, - { "laes-bf", { NULL }, 9536, "udp" }, - { "trispen-sra", { NULL }, 9555, "tcp" }, - { "trispen-sra", { NULL }, 9555, "udp" }, - { "ldgateway", { NULL }, 9592, "tcp" }, - { "ldgateway", { NULL }, 9592, "udp" }, - { "cba8", { NULL }, 9593, "tcp" }, - { "cba8", { NULL }, 9593, "udp" }, - { "msgsys", { NULL }, 9594, "tcp" }, - { "msgsys", { NULL }, 9594, "udp" }, - { "pds", { NULL }, 9595, "tcp" }, - { "pds", { NULL }, 9595, "udp" }, - { "mercury-disc", { NULL }, 9596, "tcp" }, - { "mercury-disc", { NULL }, 9596, "udp" }, - { "pd-admin", { NULL }, 9597, "tcp" }, - { "pd-admin", { NULL }, 9597, "udp" }, - { "vscp", { NULL }, 9598, "tcp" }, - { "vscp", { NULL }, 9598, "udp" }, - { "robix", { NULL }, 9599, "tcp" }, - { "robix", { NULL }, 9599, "udp" }, - { "micromuse-ncpw", { NULL }, 9600, "tcp" }, - { "micromuse-ncpw", { NULL }, 9600, "udp" }, - { "streamcomm-ds", { NULL }, 9612, "tcp" }, - { "streamcomm-ds", { NULL }, 9612, "udp" }, - { "iadt-tls", { NULL }, 9614, "tcp" }, - { "erunbook_agent", { NULL }, 9616, "tcp" }, - { "erunbook_server", { NULL }, 9617, "tcp" }, - { "condor", { NULL }, 9618, "tcp" }, - { "condor", { NULL }, 9618, "udp" }, - { "odbcpathway", { NULL }, 9628, "tcp" }, - { "odbcpathway", { NULL }, 9628, "udp" }, - { "uniport", { NULL }, 9629, "tcp" }, - { "uniport", { NULL }, 9629, "udp" }, - { "peoctlr", { NULL }, 9630, "tcp" }, - { "peocoll", { NULL }, 9631, "tcp" }, - { "mc-comm", { NULL }, 9632, "udp" }, - { "pqsflows", { NULL }, 9640, "tcp" }, - { "xmms2", { NULL }, 9667, "tcp" }, - { "xmms2", { NULL }, 9667, "udp" }, - { "tec5-sdctp", { NULL }, 9668, "tcp" }, - { "tec5-sdctp", { NULL }, 9668, "udp" }, - { "client-wakeup", { NULL }, 9694, "tcp" }, - { "client-wakeup", { NULL }, 9694, "udp" }, - { "ccnx", { NULL }, 9695, "tcp" }, - { "ccnx", { NULL }, 9695, "udp" }, - { "board-roar", { NULL }, 9700, "tcp" }, - { "board-roar", { NULL }, 9700, "udp" }, - { "l5nas-parchan", { NULL }, 9747, "tcp" }, - { "l5nas-parchan", { NULL }, 9747, "udp" }, - { "board-voip", { NULL }, 9750, "tcp" }, - { "board-voip", { NULL }, 9750, "udp" }, - { "rasadv", { NULL }, 9753, "tcp" }, - { "rasadv", { NULL }, 9753, "udp" }, - { "tungsten-http", { NULL }, 9762, "tcp" }, - { "tungsten-http", { NULL }, 9762, "udp" }, - { "davsrc", { NULL }, 9800, "tcp" }, - { "davsrc", { NULL }, 9800, "udp" }, - { "sstp-2", { NULL }, 9801, "tcp" }, - { "sstp-2", { NULL }, 9801, "udp" }, - { "davsrcs", { NULL }, 9802, "tcp" }, - { "davsrcs", { NULL }, 9802, "udp" }, - { "sapv1", { NULL }, 9875, "tcp" }, - { "sapv1", { NULL }, 9875, "udp" }, - { "sd", { NULL }, 9876, "tcp" }, - { "sd", { NULL }, 9876, "udp" }, - { "cyborg-systems", { NULL }, 9888, "tcp" }, - { "cyborg-systems", { NULL }, 9888, "udp" }, - { "gt-proxy", { NULL }, 9889, "tcp" }, - { "gt-proxy", { NULL }, 9889, "udp" }, - { "monkeycom", { NULL }, 9898, "tcp" }, - { "monkeycom", { NULL }, 9898, "udp" }, - { "sctp-tunneling", { NULL }, 9899, "tcp" }, - { "sctp-tunneling", { NULL }, 9899, "udp" }, - { "iua", { NULL }, 9900, "tcp" }, - { "iua", { NULL }, 9900, "udp" }, - { "iua", { NULL }, 9900, "sctp" }, - { "enrp", { NULL }, 9901, "udp" }, - { "enrp-sctp", { NULL }, 9901, "sctp" }, - { "enrp-sctp-tls", { NULL }, 9902, "sctp" }, - { "domaintime", { NULL }, 9909, "tcp" }, - { "domaintime", { NULL }, 9909, "udp" }, - { "sype-transport", { NULL }, 9911, "tcp" }, - { "sype-transport", { NULL }, 9911, "udp" }, - { "apc-9950", { NULL }, 9950, "tcp" }, - { "apc-9950", { NULL }, 9950, "udp" }, - { "apc-9951", { NULL }, 9951, "tcp" }, - { "apc-9951", { NULL }, 9951, "udp" }, - { "apc-9952", { NULL }, 9952, "tcp" }, - { "apc-9952", { NULL }, 9952, "udp" }, - { "acis", { NULL }, 9953, "tcp" }, - { "acis", { NULL }, 9953, "udp" }, - { "odnsp", { NULL }, 9966, "tcp" }, - { "odnsp", { NULL }, 9966, "udp" }, - { "dsm-scm-target", { NULL }, 9987, "tcp" }, - { "dsm-scm-target", { NULL }, 9987, "udp" }, - { "nsesrvr", { NULL }, 9988, "tcp" }, - { "osm-appsrvr", { NULL }, 9990, "tcp" }, - { "osm-appsrvr", { NULL }, 9990, "udp" }, - { "osm-oev", { NULL }, 9991, "tcp" }, - { "osm-oev", { NULL }, 9991, "udp" }, - { "palace-1", { NULL }, 9992, "tcp" }, - { "palace-1", { NULL }, 9992, "udp" }, - { "palace-2", { NULL }, 9993, "tcp" }, - { "palace-2", { NULL }, 9993, "udp" }, - { "palace-3", { NULL }, 9994, "tcp" }, - { "palace-3", { NULL }, 9994, "udp" }, - { "palace-4", { NULL }, 9995, "tcp" }, - { "palace-4", { NULL }, 9995, "udp" }, - { "palace-5", { NULL }, 9996, "tcp" }, - { "palace-5", { NULL }, 9996, "udp" }, - { "palace-6", { NULL }, 9997, "tcp" }, - { "palace-6", { NULL }, 9997, "udp" }, - { "distinct32", { NULL }, 9998, "tcp" }, - { "distinct32", { NULL }, 9998, "udp" }, - { "distinct", { NULL }, 9999, "tcp" }, - { "distinct", { NULL }, 9999, "udp" }, - { "ndmp", { NULL }, 10000, "tcp" }, - { "ndmp", { NULL }, 10000, "udp" }, - { "scp-config", { NULL }, 10001, "tcp" }, - { "scp-config", { NULL }, 10001, "udp" }, - { "documentum", { NULL }, 10002, "tcp" }, - { "documentum", { NULL }, 10002, "udp" }, - { "documentum_s", { NULL }, 10003, "tcp" }, - { "documentum_s", { NULL }, 10003, "udp" }, - { "emcrmirccd", { NULL }, 10004, "tcp" }, - { "emcrmird", { NULL }, 10005, "tcp" }, - { "mvs-capacity", { NULL }, 10007, "tcp" }, - { "mvs-capacity", { NULL }, 10007, "udp" }, - { "octopus", { NULL }, 10008, "tcp" }, - { "octopus", { NULL }, 10008, "udp" }, - { "swdtp-sv", { NULL }, 10009, "tcp" }, - { "swdtp-sv", { NULL }, 10009, "udp" }, - { "rxapi", { NULL }, 10010, "tcp" }, - { "zabbix-agent", { NULL }, 10050, "tcp" }, - { "zabbix-agent", { NULL }, 10050, "udp" }, - { "zabbix-trapper", { NULL }, 10051, "tcp" }, - { "zabbix-trapper", { NULL }, 10051, "udp" }, - { "qptlmd", { NULL }, 10055, "tcp" }, - { "amanda", { NULL }, 10080, "tcp" }, - { "amanda", { NULL }, 10080, "udp" }, - { "famdc", { NULL }, 10081, "tcp" }, - { "famdc", { NULL }, 10081, "udp" }, - { "itap-ddtp", { NULL }, 10100, "tcp" }, - { "itap-ddtp", { NULL }, 10100, "udp" }, - { "ezmeeting-2", { NULL }, 10101, "tcp" }, - { "ezmeeting-2", { NULL }, 10101, "udp" }, - { "ezproxy-2", { NULL }, 10102, "tcp" }, - { "ezproxy-2", { NULL }, 10102, "udp" }, - { "ezrelay", { NULL }, 10103, "tcp" }, - { "ezrelay", { NULL }, 10103, "udp" }, - { "swdtp", { NULL }, 10104, "tcp" }, - { "swdtp", { NULL }, 10104, "udp" }, - { "bctp-server", { NULL }, 10107, "tcp" }, - { "bctp-server", { NULL }, 10107, "udp" }, - { "nmea-0183", { NULL }, 10110, "tcp" }, - { "nmea-0183", { NULL }, 10110, "udp" }, - { "netiq-endpoint", { NULL }, 10113, "tcp" }, - { "netiq-endpoint", { NULL }, 10113, "udp" }, - { "netiq-qcheck", { NULL }, 10114, "tcp" }, - { "netiq-qcheck", { NULL }, 10114, "udp" }, - { "netiq-endpt", { NULL }, 10115, "tcp" }, - { "netiq-endpt", { NULL }, 10115, "udp" }, - { "netiq-voipa", { NULL }, 10116, "tcp" }, - { "netiq-voipa", { NULL }, 10116, "udp" }, - { "iqrm", { NULL }, 10117, "tcp" }, - { "iqrm", { NULL }, 10117, "udp" }, - { "bmc-perf-sd", { NULL }, 10128, "tcp" }, - { "bmc-perf-sd", { NULL }, 10128, "udp" }, - { "bmc-gms", { NULL }, 10129, "tcp" }, - { "qb-db-server", { NULL }, 10160, "tcp" }, - { "qb-db-server", { NULL }, 10160, "udp" }, - { "snmptls", { NULL }, 10161, "tcp" }, - { "snmpdtls", { NULL }, 10161, "udp" }, - { "snmptls-trap", { NULL }, 10162, "tcp" }, - { "snmpdtls-trap", { NULL }, 10162, "udp" }, - { "trisoap", { NULL }, 10200, "tcp" }, - { "trisoap", { NULL }, 10200, "udp" }, - { "rsms", { NULL }, 10201, "tcp" }, - { "rscs", { NULL }, 10201, "udp" }, - { "apollo-relay", { NULL }, 10252, "tcp" }, - { "apollo-relay", { NULL }, 10252, "udp" }, - { "axis-wimp-port", { NULL }, 10260, "tcp" }, - { "axis-wimp-port", { NULL }, 10260, "udp" }, - { "blocks", { NULL }, 10288, "tcp" }, - { "blocks", { NULL }, 10288, "udp" }, - { "cosir", { NULL }, 10321, "tcp" }, - { "hip-nat-t", { NULL }, 10500, "udp" }, - { "MOS-lower", { NULL }, 10540, "tcp" }, - { "MOS-lower", { NULL }, 10540, "udp" }, - { "MOS-upper", { NULL }, 10541, "tcp" }, - { "MOS-upper", { NULL }, 10541, "udp" }, - { "MOS-aux", { NULL }, 10542, "tcp" }, - { "MOS-aux", { NULL }, 10542, "udp" }, - { "MOS-soap", { NULL }, 10543, "tcp" }, - { "MOS-soap", { NULL }, 10543, "udp" }, - { "MOS-soap-opt", { NULL }, 10544, "tcp" }, - { "MOS-soap-opt", { NULL }, 10544, "udp" }, - { "gap", { NULL }, 10800, "tcp" }, - { "gap", { NULL }, 10800, "udp" }, - { "lpdg", { NULL }, 10805, "tcp" }, - { "lpdg", { NULL }, 10805, "udp" }, - { "nbd", { NULL }, 10809, "tcp" }, - { "nmc-disc", { NULL }, 10810, "udp" }, - { "helix", { NULL }, 10860, "tcp" }, - { "helix", { NULL }, 10860, "udp" }, - { "rmiaux", { NULL }, 10990, "tcp" }, - { "rmiaux", { NULL }, 10990, "udp" }, - { "irisa", { NULL }, 11000, "tcp" }, - { "irisa", { NULL }, 11000, "udp" }, - { "metasys", { NULL }, 11001, "tcp" }, - { "metasys", { NULL }, 11001, "udp" }, - { "netapp-icmgmt", { NULL }, 11104, "tcp" }, - { "netapp-icdata", { NULL }, 11105, "tcp" }, - { "sgi-lk", { NULL }, 11106, "tcp" }, - { "sgi-lk", { NULL }, 11106, "udp" }, - { "vce", { NULL }, 11111, "tcp" }, - { "vce", { NULL }, 11111, "udp" }, - { "dicom", { NULL }, 11112, "tcp" }, - { "dicom", { NULL }, 11112, "udp" }, - { "suncacao-snmp", { NULL }, 11161, "tcp" }, - { "suncacao-snmp", { NULL }, 11161, "udp" }, - { "suncacao-jmxmp", { NULL }, 11162, "tcp" }, - { "suncacao-jmxmp", { NULL }, 11162, "udp" }, - { "suncacao-rmi", { NULL }, 11163, "tcp" }, - { "suncacao-rmi", { NULL }, 11163, "udp" }, - { "suncacao-csa", { NULL }, 11164, "tcp" }, - { "suncacao-csa", { NULL }, 11164, "udp" }, - { "suncacao-websvc", { NULL }, 11165, "tcp" }, - { "suncacao-websvc", { NULL }, 11165, "udp" }, - { "snss", { NULL }, 11171, "udp" }, - { "oemcacao-jmxmp", { NULL }, 11172, "tcp" }, - { "oemcacao-rmi", { NULL }, 11174, "tcp" }, - { "oemcacao-websvc", { NULL }, 11175, "tcp" }, - { "smsqp", { NULL }, 11201, "tcp" }, - { "smsqp", { NULL }, 11201, "udp" }, - { "wifree", { NULL }, 11208, "tcp" }, - { "wifree", { NULL }, 11208, "udp" }, - { "memcache", { NULL }, 11211, "tcp" }, - { "memcache", { NULL }, 11211, "udp" }, - { "imip", { NULL }, 11319, "tcp" }, - { "imip", { NULL }, 11319, "udp" }, - { "imip-channels", { NULL }, 11320, "tcp" }, - { "imip-channels", { NULL }, 11320, "udp" }, - { "arena-server", { NULL }, 11321, "tcp" }, - { "arena-server", { NULL }, 11321, "udp" }, - { "atm-uhas", { NULL }, 11367, "tcp" }, - { "atm-uhas", { NULL }, 11367, "udp" }, - { "hkp", { NULL }, 11371, "tcp" }, - { "hkp", { NULL }, 11371, "udp" }, - { "asgcypresstcps", { NULL }, 11489, "tcp" }, - { "tempest-port", { NULL }, 11600, "tcp" }, - { "tempest-port", { NULL }, 11600, "udp" }, - { "h323callsigalt", { NULL }, 11720, "tcp" }, - { "h323callsigalt", { NULL }, 11720, "udp" }, - { "intrepid-ssl", { NULL }, 11751, "tcp" }, - { "intrepid-ssl", { NULL }, 11751, "udp" }, - { "xoraya", { NULL }, 11876, "tcp" }, - { "xoraya", { NULL }, 11876, "udp" }, - { "x2e-disc", { NULL }, 11877, "udp" }, - { "sysinfo-sp", { NULL }, 11967, "tcp" }, - { "sysinfo-sp", { NULL }, 11967, "udp" }, - { "wmereceiving", { NULL }, 11997, "sctp" }, - { "wmedistribution", { NULL }, 11998, "sctp" }, - { "wmereporting", { NULL }, 11999, "sctp" }, - { "entextxid", { NULL }, 12000, "tcp" }, - { "entextxid", { NULL }, 12000, "udp" }, - { "entextnetwk", { NULL }, 12001, "tcp" }, - { "entextnetwk", { NULL }, 12001, "udp" }, - { "entexthigh", { NULL }, 12002, "tcp" }, - { "entexthigh", { NULL }, 12002, "udp" }, - { "entextmed", { NULL }, 12003, "tcp" }, - { "entextmed", { NULL }, 12003, "udp" }, - { "entextlow", { NULL }, 12004, "tcp" }, - { "entextlow", { NULL }, 12004, "udp" }, - { "dbisamserver1", { NULL }, 12005, "tcp" }, - { "dbisamserver1", { NULL }, 12005, "udp" }, - { "dbisamserver2", { NULL }, 12006, "tcp" }, - { "dbisamserver2", { NULL }, 12006, "udp" }, - { "accuracer", { NULL }, 12007, "tcp" }, - { "accuracer", { NULL }, 12007, "udp" }, - { "accuracer-dbms", { NULL }, 12008, "tcp" }, - { "accuracer-dbms", { NULL }, 12008, "udp" }, - { "edbsrvr", { NULL }, 12010, "tcp" }, - { "vipera", { NULL }, 12012, "tcp" }, - { "vipera", { NULL }, 12012, "udp" }, - { "vipera-ssl", { NULL }, 12013, "tcp" }, - { "vipera-ssl", { NULL }, 12013, "udp" }, - { "rets-ssl", { NULL }, 12109, "tcp" }, - { "rets-ssl", { NULL }, 12109, "udp" }, - { "nupaper-ss", { NULL }, 12121, "tcp" }, - { "nupaper-ss", { NULL }, 12121, "udp" }, - { "cawas", { NULL }, 12168, "tcp" }, - { "cawas", { NULL }, 12168, "udp" }, - { "hivep", { NULL }, 12172, "tcp" }, - { "hivep", { NULL }, 12172, "udp" }, - { "linogridengine", { NULL }, 12300, "tcp" }, - { "linogridengine", { NULL }, 12300, "udp" }, - { "warehouse-sss", { NULL }, 12321, "tcp" }, - { "warehouse-sss", { NULL }, 12321, "udp" }, - { "warehouse", { NULL }, 12322, "tcp" }, - { "warehouse", { NULL }, 12322, "udp" }, - { "italk", { NULL }, 12345, "tcp" }, - { "italk", { NULL }, 12345, "udp" }, - { "tsaf", { NULL }, 12753, "tcp" }, - { "tsaf", { NULL }, 12753, "udp" }, - { "i-zipqd", { NULL }, 13160, "tcp" }, - { "i-zipqd", { NULL }, 13160, "udp" }, - { "bcslogc", { NULL }, 13216, "tcp" }, - { "bcslogc", { NULL }, 13216, "udp" }, - { "rs-pias", { NULL }, 13217, "tcp" }, - { "rs-pias", { NULL }, 13217, "udp" }, - { "emc-vcas-tcp", { NULL }, 13218, "tcp" }, - { "emc-vcas-udp", { NULL }, 13218, "udp" }, - { "powwow-client", { NULL }, 13223, "tcp" }, - { "powwow-client", { NULL }, 13223, "udp" }, - { "powwow-server", { NULL }, 13224, "tcp" }, - { "powwow-server", { NULL }, 13224, "udp" }, - { "doip-data", { NULL }, 13400, "tcp" }, - { "doip-disc", { NULL }, 13400, "udp" }, - { "bprd", { NULL }, 13720, "tcp" }, - { "bprd", { NULL }, 13720, "udp" }, - { "bpdbm", { NULL }, 13721, "tcp" }, - { "bpdbm", { NULL }, 13721, "udp" }, - { "bpjava-msvc", { NULL }, 13722, "tcp" }, - { "bpjava-msvc", { NULL }, 13722, "udp" }, - { "vnetd", { NULL }, 13724, "tcp" }, - { "vnetd", { NULL }, 13724, "udp" }, - { "bpcd", { NULL }, 13782, "tcp" }, - { "bpcd", { NULL }, 13782, "udp" }, - { "vopied", { NULL }, 13783, "tcp" }, - { "vopied", { NULL }, 13783, "udp" }, - { "nbdb", { NULL }, 13785, "tcp" }, - { "nbdb", { NULL }, 13785, "udp" }, - { "nomdb", { NULL }, 13786, "tcp" }, - { "nomdb", { NULL }, 13786, "udp" }, - { "dsmcc-config", { NULL }, 13818, "tcp" }, - { "dsmcc-config", { NULL }, 13818, "udp" }, - { "dsmcc-session", { NULL }, 13819, "tcp" }, - { "dsmcc-session", { NULL }, 13819, "udp" }, - { "dsmcc-passthru", { NULL }, 13820, "tcp" }, - { "dsmcc-passthru", { NULL }, 13820, "udp" }, - { "dsmcc-download", { NULL }, 13821, "tcp" }, - { "dsmcc-download", { NULL }, 13821, "udp" }, - { "dsmcc-ccp", { NULL }, 13822, "tcp" }, - { "dsmcc-ccp", { NULL }, 13822, "udp" }, - { "bmdss", { NULL }, 13823, "tcp" }, - { "dta-systems", { NULL }, 13929, "tcp" }, - { "dta-systems", { NULL }, 13929, "udp" }, - { "medevolve", { NULL }, 13930, "tcp" }, - { "scotty-ft", { NULL }, 14000, "tcp" }, - { "scotty-ft", { NULL }, 14000, "udp" }, - { "sua", { NULL }, 14001, "tcp" }, - { "sua", { NULL }, 14001, "udp" }, - { "sua", { NULL }, 14001, "sctp" }, - { "sage-best-com1", { NULL }, 14033, "tcp" }, - { "sage-best-com1", { NULL }, 14033, "udp" }, - { "sage-best-com2", { NULL }, 14034, "tcp" }, - { "sage-best-com2", { NULL }, 14034, "udp" }, - { "vcs-app", { NULL }, 14141, "tcp" }, - { "vcs-app", { NULL }, 14141, "udp" }, - { "icpp", { NULL }, 14142, "tcp" }, - { "icpp", { NULL }, 14142, "udp" }, - { "gcm-app", { NULL }, 14145, "tcp" }, - { "gcm-app", { NULL }, 14145, "udp" }, - { "vrts-tdd", { NULL }, 14149, "tcp" }, - { "vrts-tdd", { NULL }, 14149, "udp" }, - { "vcscmd", { NULL }, 14150, "tcp" }, - { "vad", { NULL }, 14154, "tcp" }, - { "vad", { NULL }, 14154, "udp" }, - { "cps", { NULL }, 14250, "tcp" }, - { "cps", { NULL }, 14250, "udp" }, - { "ca-web-update", { NULL }, 14414, "tcp" }, - { "ca-web-update", { NULL }, 14414, "udp" }, - { "hde-lcesrvr-1", { NULL }, 14936, "tcp" }, - { "hde-lcesrvr-1", { NULL }, 14936, "udp" }, - { "hde-lcesrvr-2", { NULL }, 14937, "tcp" }, - { "hde-lcesrvr-2", { NULL }, 14937, "udp" }, - { "hydap", { NULL }, 15000, "tcp" }, - { "hydap", { NULL }, 15000, "udp" }, - { "xpilot", { NULL }, 15345, "tcp" }, - { "xpilot", { NULL }, 15345, "udp" }, - { "3link", { NULL }, 15363, "tcp" }, - { "3link", { NULL }, 15363, "udp" }, - { "cisco-snat", { NULL }, 15555, "tcp" }, - { "cisco-snat", { NULL }, 15555, "udp" }, - { "bex-xr", { NULL }, 15660, "tcp" }, - { "bex-xr", { NULL }, 15660, "udp" }, - { "ptp", { NULL }, 15740, "tcp" }, - { "ptp", { NULL }, 15740, "udp" }, - { "2ping", { NULL }, 15998, "udp" }, - { "programmar", { NULL }, 15999, "tcp" }, - { "fmsas", { NULL }, 16000, "tcp" }, - { "fmsascon", { NULL }, 16001, "tcp" }, - { "gsms", { NULL }, 16002, "tcp" }, - { "alfin", { NULL }, 16003, "udp" }, - { "jwpc", { NULL }, 16020, "tcp" }, - { "jwpc-bin", { NULL }, 16021, "tcp" }, - { "sun-sea-port", { NULL }, 16161, "tcp" }, - { "sun-sea-port", { NULL }, 16161, "udp" }, - { "solaris-audit", { NULL }, 16162, "tcp" }, - { "etb4j", { NULL }, 16309, "tcp" }, - { "etb4j", { NULL }, 16309, "udp" }, - { "pduncs", { NULL }, 16310, "tcp" }, - { "pduncs", { NULL }, 16310, "udp" }, - { "pdefmns", { NULL }, 16311, "tcp" }, - { "pdefmns", { NULL }, 16311, "udp" }, - { "netserialext1", { NULL }, 16360, "tcp" }, - { "netserialext1", { NULL }, 16360, "udp" }, - { "netserialext2", { NULL }, 16361, "tcp" }, - { "netserialext2", { NULL }, 16361, "udp" }, - { "netserialext3", { NULL }, 16367, "tcp" }, - { "netserialext3", { NULL }, 16367, "udp" }, - { "netserialext4", { NULL }, 16368, "tcp" }, - { "netserialext4", { NULL }, 16368, "udp" }, - { "connected", { NULL }, 16384, "tcp" }, - { "connected", { NULL }, 16384, "udp" }, - { "xoms", { NULL }, 16619, "tcp" }, - { "newbay-snc-mc", { NULL }, 16900, "tcp" }, - { "newbay-snc-mc", { NULL }, 16900, "udp" }, - { "sgcip", { NULL }, 16950, "tcp" }, - { "sgcip", { NULL }, 16950, "udp" }, - { "intel-rci-mp", { NULL }, 16991, "tcp" }, - { "intel-rci-mp", { NULL }, 16991, "udp" }, - { "amt-soap-http", { NULL }, 16992, "tcp" }, - { "amt-soap-http", { NULL }, 16992, "udp" }, - { "amt-soap-https", { NULL }, 16993, "tcp" }, - { "amt-soap-https", { NULL }, 16993, "udp" }, - { "amt-redir-tcp", { NULL }, 16994, "tcp" }, - { "amt-redir-tcp", { NULL }, 16994, "udp" }, - { "amt-redir-tls", { NULL }, 16995, "tcp" }, - { "amt-redir-tls", { NULL }, 16995, "udp" }, - { "isode-dua", { NULL }, 17007, "tcp" }, - { "isode-dua", { NULL }, 17007, "udp" }, - { "soundsvirtual", { NULL }, 17185, "tcp" }, - { "soundsvirtual", { NULL }, 17185, "udp" }, - { "chipper", { NULL }, 17219, "tcp" }, - { "chipper", { NULL }, 17219, "udp" }, - { "integrius-stp", { NULL }, 17234, "tcp" }, - { "integrius-stp", { NULL }, 17234, "udp" }, - { "ssh-mgmt", { NULL }, 17235, "tcp" }, - { "ssh-mgmt", { NULL }, 17235, "udp" }, - { "db-lsp", { NULL }, 17500, "tcp" }, - { "db-lsp-disc", { NULL }, 17500, "udp" }, - { "ea", { NULL }, 17729, "tcp" }, - { "ea", { NULL }, 17729, "udp" }, - { "zep", { NULL }, 17754, "tcp" }, - { "zep", { NULL }, 17754, "udp" }, - { "zigbee-ip", { NULL }, 17755, "tcp" }, - { "zigbee-ip", { NULL }, 17755, "udp" }, - { "zigbee-ips", { NULL }, 17756, "tcp" }, - { "zigbee-ips", { NULL }, 17756, "udp" }, - { "sw-orion", { NULL }, 17777, "tcp" }, - { "biimenu", { NULL }, 18000, "tcp" }, - { "biimenu", { NULL }, 18000, "udp" }, - { "radpdf", { NULL }, 18104, "tcp" }, - { "racf", { NULL }, 18136, "tcp" }, - { "opsec-cvp", { NULL }, 18181, "tcp" }, - { "opsec-cvp", { NULL }, 18181, "udp" }, - { "opsec-ufp", { NULL }, 18182, "tcp" }, - { "opsec-ufp", { NULL }, 18182, "udp" }, - { "opsec-sam", { NULL }, 18183, "tcp" }, - { "opsec-sam", { NULL }, 18183, "udp" }, - { "opsec-lea", { NULL }, 18184, "tcp" }, - { "opsec-lea", { NULL }, 18184, "udp" }, - { "opsec-omi", { NULL }, 18185, "tcp" }, - { "opsec-omi", { NULL }, 18185, "udp" }, - { "ohsc", { NULL }, 18186, "tcp" }, - { "ohsc", { NULL }, 18186, "udp" }, - { "opsec-ela", { NULL }, 18187, "tcp" }, - { "opsec-ela", { NULL }, 18187, "udp" }, - { "checkpoint-rtm", { NULL }, 18241, "tcp" }, - { "checkpoint-rtm", { NULL }, 18241, "udp" }, - { "gv-pf", { NULL }, 18262, "tcp" }, - { "gv-pf", { NULL }, 18262, "udp" }, - { "ac-cluster", { NULL }, 18463, "tcp" }, - { "ac-cluster", { NULL }, 18463, "udp" }, - { "rds-ib", { NULL }, 18634, "tcp" }, - { "rds-ib", { NULL }, 18634, "udp" }, - { "rds-ip", { NULL }, 18635, "tcp" }, - { "rds-ip", { NULL }, 18635, "udp" }, - { "ique", { NULL }, 18769, "tcp" }, - { "ique", { NULL }, 18769, "udp" }, - { "infotos", { NULL }, 18881, "tcp" }, - { "infotos", { NULL }, 18881, "udp" }, - { "apc-necmp", { NULL }, 18888, "tcp" }, - { "apc-necmp", { NULL }, 18888, "udp" }, - { "igrid", { NULL }, 19000, "tcp" }, - { "igrid", { NULL }, 19000, "udp" }, - { "j-link", { NULL }, 19020, "tcp" }, - { "opsec-uaa", { NULL }, 19191, "tcp" }, - { "opsec-uaa", { NULL }, 19191, "udp" }, - { "ua-secureagent", { NULL }, 19194, "tcp" }, - { "ua-secureagent", { NULL }, 19194, "udp" }, - { "keysrvr", { NULL }, 19283, "tcp" }, - { "keysrvr", { NULL }, 19283, "udp" }, - { "keyshadow", { NULL }, 19315, "tcp" }, - { "keyshadow", { NULL }, 19315, "udp" }, - { "mtrgtrans", { NULL }, 19398, "tcp" }, - { "mtrgtrans", { NULL }, 19398, "udp" }, - { "hp-sco", { NULL }, 19410, "tcp" }, - { "hp-sco", { NULL }, 19410, "udp" }, - { "hp-sca", { NULL }, 19411, "tcp" }, - { "hp-sca", { NULL }, 19411, "udp" }, - { "hp-sessmon", { NULL }, 19412, "tcp" }, - { "hp-sessmon", { NULL }, 19412, "udp" }, - { "fxuptp", { NULL }, 19539, "tcp" }, - { "fxuptp", { NULL }, 19539, "udp" }, - { "sxuptp", { NULL }, 19540, "tcp" }, - { "sxuptp", { NULL }, 19540, "udp" }, - { "jcp", { NULL }, 19541, "tcp" }, - { "jcp", { NULL }, 19541, "udp" }, - { "iec-104-sec", { NULL }, 19998, "tcp" }, - { "dnp-sec", { NULL }, 19999, "tcp" }, - { "dnp-sec", { NULL }, 19999, "udp" }, - { "dnp", { NULL }, 20000, "tcp" }, - { "dnp", { NULL }, 20000, "udp" }, - { "microsan", { NULL }, 20001, "tcp" }, - { "microsan", { NULL }, 20001, "udp" }, - { "commtact-http", { NULL }, 20002, "tcp" }, - { "commtact-http", { NULL }, 20002, "udp" }, - { "commtact-https", { NULL }, 20003, "tcp" }, - { "commtact-https", { NULL }, 20003, "udp" }, - { "openwebnet", { NULL }, 20005, "tcp" }, - { "openwebnet", { NULL }, 20005, "udp" }, - { "ss-idi-disc", { NULL }, 20012, "udp" }, - { "ss-idi", { NULL }, 20013, "tcp" }, - { "opendeploy", { NULL }, 20014, "tcp" }, - { "opendeploy", { NULL }, 20014, "udp" }, - { "nburn_id", { NULL }, 20034, "tcp" }, - { "nburn_id", { NULL }, 20034, "udp" }, - { "tmophl7mts", { NULL }, 20046, "tcp" }, - { "tmophl7mts", { NULL }, 20046, "udp" }, - { "mountd", { NULL }, 20048, "tcp" }, - { "mountd", { NULL }, 20048, "udp" }, - { "nfsrdma", { NULL }, 20049, "tcp" }, - { "nfsrdma", { NULL }, 20049, "udp" }, - { "nfsrdma", { NULL }, 20049, "sctp" }, - { "tolfab", { NULL }, 20167, "tcp" }, - { "tolfab", { NULL }, 20167, "udp" }, - { "ipdtp-port", { NULL }, 20202, "tcp" }, - { "ipdtp-port", { NULL }, 20202, "udp" }, - { "ipulse-ics", { NULL }, 20222, "tcp" }, - { "ipulse-ics", { NULL }, 20222, "udp" }, - { "emwavemsg", { NULL }, 20480, "tcp" }, - { "emwavemsg", { NULL }, 20480, "udp" }, - { "track", { NULL }, 20670, "tcp" }, - { "track", { NULL }, 20670, "udp" }, - { "athand-mmp", { NULL }, 20999, "tcp" }, - { "athand-mmp", { NULL }, 20999, "udp" }, - { "irtrans", { NULL }, 21000, "tcp" }, - { "irtrans", { NULL }, 21000, "udp" }, - { "dfserver", { NULL }, 21554, "tcp" }, - { "dfserver", { NULL }, 21554, "udp" }, - { "vofr-gateway", { NULL }, 21590, "tcp" }, - { "vofr-gateway", { NULL }, 21590, "udp" }, - { "tvpm", { NULL }, 21800, "tcp" }, - { "tvpm", { NULL }, 21800, "udp" }, - { "webphone", { NULL }, 21845, "tcp" }, - { "webphone", { NULL }, 21845, "udp" }, - { "netspeak-is", { NULL }, 21846, "tcp" }, - { "netspeak-is", { NULL }, 21846, "udp" }, - { "netspeak-cs", { NULL }, 21847, "tcp" }, - { "netspeak-cs", { NULL }, 21847, "udp" }, - { "netspeak-acd", { NULL }, 21848, "tcp" }, - { "netspeak-acd", { NULL }, 21848, "udp" }, - { "netspeak-cps", { NULL }, 21849, "tcp" }, - { "netspeak-cps", { NULL }, 21849, "udp" }, - { "snapenetio", { NULL }, 22000, "tcp" }, - { "snapenetio", { NULL }, 22000, "udp" }, - { "optocontrol", { NULL }, 22001, "tcp" }, - { "optocontrol", { NULL }, 22001, "udp" }, - { "optohost002", { NULL }, 22002, "tcp" }, - { "optohost002", { NULL }, 22002, "udp" }, - { "optohost003", { NULL }, 22003, "tcp" }, - { "optohost003", { NULL }, 22003, "udp" }, - { "optohost004", { NULL }, 22004, "tcp" }, - { "optohost004", { NULL }, 22004, "udp" }, - { "optohost004", { NULL }, 22005, "tcp" }, - { "optohost004", { NULL }, 22005, "udp" }, - { "dcap", { NULL }, 22125, "tcp" }, - { "gsidcap", { NULL }, 22128, "tcp" }, - { "wnn6", { NULL }, 22273, "tcp" }, - { "wnn6", { NULL }, 22273, "udp" }, - { "cis", { NULL }, 22305, "tcp" }, - { "cis", { NULL }, 22305, "udp" }, - { "cis-secure", { NULL }, 22343, "tcp" }, - { "cis-secure", { NULL }, 22343, "udp" }, - { "WibuKey", { NULL }, 22347, "tcp" }, - { "WibuKey", { NULL }, 22347, "udp" }, - { "CodeMeter", { NULL }, 22350, "tcp" }, - { "CodeMeter", { NULL }, 22350, "udp" }, - { "vocaltec-wconf", { NULL }, 22555, "tcp" }, - { "vocaltec-phone", { NULL }, 22555, "udp" }, - { "talikaserver", { NULL }, 22763, "tcp" }, - { "talikaserver", { NULL }, 22763, "udp" }, - { "aws-brf", { NULL }, 22800, "tcp" }, - { "aws-brf", { NULL }, 22800, "udp" }, - { "brf-gw", { NULL }, 22951, "tcp" }, - { "brf-gw", { NULL }, 22951, "udp" }, - { "inovaport1", { NULL }, 23000, "tcp" }, - { "inovaport1", { NULL }, 23000, "udp" }, - { "inovaport2", { NULL }, 23001, "tcp" }, - { "inovaport2", { NULL }, 23001, "udp" }, - { "inovaport3", { NULL }, 23002, "tcp" }, - { "inovaport3", { NULL }, 23002, "udp" }, - { "inovaport4", { NULL }, 23003, "tcp" }, - { "inovaport4", { NULL }, 23003, "udp" }, - { "inovaport5", { NULL }, 23004, "tcp" }, - { "inovaport5", { NULL }, 23004, "udp" }, - { "inovaport6", { NULL }, 23005, "tcp" }, - { "inovaport6", { NULL }, 23005, "udp" }, - { "s102", { NULL }, 23272, "udp" }, - { "elxmgmt", { NULL }, 23333, "tcp" }, - { "elxmgmt", { NULL }, 23333, "udp" }, - { "novar-dbase", { NULL }, 23400, "tcp" }, - { "novar-dbase", { NULL }, 23400, "udp" }, - { "novar-alarm", { NULL }, 23401, "tcp" }, - { "novar-alarm", { NULL }, 23401, "udp" }, - { "novar-global", { NULL }, 23402, "tcp" }, - { "novar-global", { NULL }, 23402, "udp" }, - { "aequus", { NULL }, 23456, "tcp" }, - { "aequus-alt", { NULL }, 23457, "tcp" }, - { "med-ltp", { NULL }, 24000, "tcp" }, - { "med-ltp", { NULL }, 24000, "udp" }, - { "med-fsp-rx", { NULL }, 24001, "tcp" }, - { "med-fsp-rx", { NULL }, 24001, "udp" }, - { "med-fsp-tx", { NULL }, 24002, "tcp" }, - { "med-fsp-tx", { NULL }, 24002, "udp" }, - { "med-supp", { NULL }, 24003, "tcp" }, - { "med-supp", { NULL }, 24003, "udp" }, - { "med-ovw", { NULL }, 24004, "tcp" }, - { "med-ovw", { NULL }, 24004, "udp" }, - { "med-ci", { NULL }, 24005, "tcp" }, - { "med-ci", { NULL }, 24005, "udp" }, - { "med-net-svc", { NULL }, 24006, "tcp" }, - { "med-net-svc", { NULL }, 24006, "udp" }, - { "filesphere", { NULL }, 24242, "tcp" }, - { "filesphere", { NULL }, 24242, "udp" }, - { "vista-4gl", { NULL }, 24249, "tcp" }, - { "vista-4gl", { NULL }, 24249, "udp" }, - { "ild", { NULL }, 24321, "tcp" }, - { "ild", { NULL }, 24321, "udp" }, - { "intel_rci", { NULL }, 24386, "tcp" }, - { "intel_rci", { NULL }, 24386, "udp" }, - { "tonidods", { NULL }, 24465, "tcp" }, - { "tonidods", { NULL }, 24465, "udp" }, - { "binkp", { NULL }, 24554, "tcp" }, - { "binkp", { NULL }, 24554, "udp" }, - { "canditv", { NULL }, 24676, "tcp" }, - { "canditv", { NULL }, 24676, "udp" }, - { "flashfiler", { NULL }, 24677, "tcp" }, - { "flashfiler", { NULL }, 24677, "udp" }, - { "proactivate", { NULL }, 24678, "tcp" }, - { "proactivate", { NULL }, 24678, "udp" }, - { "tcc-http", { NULL }, 24680, "tcp" }, - { "tcc-http", { NULL }, 24680, "udp" }, - { "cslg", { NULL }, 24754, "tcp" }, - { "find", { NULL }, 24922, "tcp" }, - { "find", { NULL }, 24922, "udp" }, - { "icl-twobase1", { NULL }, 25000, "tcp" }, - { "icl-twobase1", { NULL }, 25000, "udp" }, - { "icl-twobase2", { NULL }, 25001, "tcp" }, - { "icl-twobase2", { NULL }, 25001, "udp" }, - { "icl-twobase3", { NULL }, 25002, "tcp" }, - { "icl-twobase3", { NULL }, 25002, "udp" }, - { "icl-twobase4", { NULL }, 25003, "tcp" }, - { "icl-twobase4", { NULL }, 25003, "udp" }, - { "icl-twobase5", { NULL }, 25004, "tcp" }, - { "icl-twobase5", { NULL }, 25004, "udp" }, - { "icl-twobase6", { NULL }, 25005, "tcp" }, - { "icl-twobase6", { NULL }, 25005, "udp" }, - { "icl-twobase7", { NULL }, 25006, "tcp" }, - { "icl-twobase7", { NULL }, 25006, "udp" }, - { "icl-twobase8", { NULL }, 25007, "tcp" }, - { "icl-twobase8", { NULL }, 25007, "udp" }, - { "icl-twobase9", { NULL }, 25008, "tcp" }, - { "icl-twobase9", { NULL }, 25008, "udp" }, - { "icl-twobase10", { NULL }, 25009, "tcp" }, - { "icl-twobase10", { NULL }, 25009, "udp" }, - { "rna", { NULL }, 25471, "sctp" }, - { "sauterdongle", { NULL }, 25576, "tcp" }, - { "vocaltec-hos", { NULL }, 25793, "tcp" }, - { "vocaltec-hos", { NULL }, 25793, "udp" }, - { "tasp-net", { NULL }, 25900, "tcp" }, - { "tasp-net", { NULL }, 25900, "udp" }, - { "niobserver", { NULL }, 25901, "tcp" }, - { "niobserver", { NULL }, 25901, "udp" }, - { "nilinkanalyst", { NULL }, 25902, "tcp" }, - { "nilinkanalyst", { NULL }, 25902, "udp" }, - { "niprobe", { NULL }, 25903, "tcp" }, - { "niprobe", { NULL }, 25903, "udp" }, - { "quake", { NULL }, 26000, "tcp" }, - { "quake", { NULL }, 26000, "udp" }, - { "scscp", { NULL }, 26133, "tcp" }, - { "scscp", { NULL }, 26133, "udp" }, - { "wnn6-ds", { NULL }, 26208, "tcp" }, - { "wnn6-ds", { NULL }, 26208, "udp" }, - { "ezproxy", { NULL }, 26260, "tcp" }, - { "ezproxy", { NULL }, 26260, "udp" }, - { "ezmeeting", { NULL }, 26261, "tcp" }, - { "ezmeeting", { NULL }, 26261, "udp" }, - { "k3software-svr", { NULL }, 26262, "tcp" }, - { "k3software-svr", { NULL }, 26262, "udp" }, - { "k3software-cli", { NULL }, 26263, "tcp" }, - { "k3software-cli", { NULL }, 26263, "udp" }, - { "exoline-tcp", { NULL }, 26486, "tcp" }, - { "exoline-udp", { NULL }, 26486, "udp" }, - { "exoconfig", { NULL }, 26487, "tcp" }, - { "exoconfig", { NULL }, 26487, "udp" }, - { "exonet", { NULL }, 26489, "tcp" }, - { "exonet", { NULL }, 26489, "udp" }, - { "imagepump", { NULL }, 27345, "tcp" }, - { "imagepump", { NULL }, 27345, "udp" }, - { "jesmsjc", { NULL }, 27442, "tcp" }, - { "jesmsjc", { NULL }, 27442, "udp" }, - { "kopek-httphead", { NULL }, 27504, "tcp" }, - { "kopek-httphead", { NULL }, 27504, "udp" }, - { "ars-vista", { NULL }, 27782, "tcp" }, - { "ars-vista", { NULL }, 27782, "udp" }, - { "tw-auth-key", { NULL }, 27999, "tcp" }, - { "tw-auth-key", { NULL }, 27999, "udp" }, - { "nxlmd", { NULL }, 28000, "tcp" }, - { "nxlmd", { NULL }, 28000, "udp" }, - { "pqsp", { NULL }, 28001, "tcp" }, - { "siemensgsm", { NULL }, 28240, "tcp" }, - { "siemensgsm", { NULL }, 28240, "udp" }, - { "sgsap", { NULL }, 29118, "sctp" }, - { "otmp", { NULL }, 29167, "tcp" }, - { "otmp", { NULL }, 29167, "udp" }, - { "sbcap", { NULL }, 29168, "sctp" }, - { "iuhsctpassoc", { NULL }, 29169, "sctp" }, - { "pago-services1", { NULL }, 30001, "tcp" }, - { "pago-services1", { NULL }, 30001, "udp" }, - { "pago-services2", { NULL }, 30002, "tcp" }, - { "pago-services2", { NULL }, 30002, "udp" }, - { "kingdomsonline", { NULL }, 30260, "tcp" }, - { "kingdomsonline", { NULL }, 30260, "udp" }, - { "ovobs", { NULL }, 30999, "tcp" }, - { "ovobs", { NULL }, 30999, "udp" }, - { "autotrac-acp", { NULL }, 31020, "tcp" }, - { "yawn", { NULL }, 31029, "udp" }, - { "xqosd", { NULL }, 31416, "tcp" }, - { "xqosd", { NULL }, 31416, "udp" }, - { "tetrinet", { NULL }, 31457, "tcp" }, - { "tetrinet", { NULL }, 31457, "udp" }, - { "lm-mon", { NULL }, 31620, "tcp" }, - { "lm-mon", { NULL }, 31620, "udp" }, - { "dsx_monitor", { NULL }, 31685, "tcp" }, - { "gamesmith-port", { NULL }, 31765, "tcp" }, - { "gamesmith-port", { NULL }, 31765, "udp" }, - { "iceedcp_tx", { NULL }, 31948, "tcp" }, - { "iceedcp_tx", { NULL }, 31948, "udp" }, - { "iceedcp_rx", { NULL }, 31949, "tcp" }, - { "iceedcp_rx", { NULL }, 31949, "udp" }, - { "iracinghelper", { NULL }, 32034, "tcp" }, - { "iracinghelper", { NULL }, 32034, "udp" }, - { "t1distproc60", { NULL }, 32249, "tcp" }, - { "t1distproc60", { NULL }, 32249, "udp" }, - { "apm-link", { NULL }, 32483, "tcp" }, - { "apm-link", { NULL }, 32483, "udp" }, - { "sec-ntb-clnt", { NULL }, 32635, "tcp" }, - { "sec-ntb-clnt", { NULL }, 32635, "udp" }, - { "DMExpress", { NULL }, 32636, "tcp" }, - { "DMExpress", { NULL }, 32636, "udp" }, - { "filenet-powsrm", { NULL }, 32767, "tcp" }, - { "filenet-powsrm", { NULL }, 32767, "udp" }, - { "filenet-tms", { NULL }, 32768, "tcp" }, - { "filenet-tms", { NULL }, 32768, "udp" }, - { "filenet-rpc", { NULL }, 32769, "tcp" }, - { "filenet-rpc", { NULL }, 32769, "udp" }, - { "filenet-nch", { NULL }, 32770, "tcp" }, - { "filenet-nch", { NULL }, 32770, "udp" }, - { "filenet-rmi", { NULL }, 32771, "tcp" }, - { "filenet-rmi", { NULL }, 32771, "udp" }, - { "filenet-pa", { NULL }, 32772, "tcp" }, - { "filenet-pa", { NULL }, 32772, "udp" }, - { "filenet-cm", { NULL }, 32773, "tcp" }, - { "filenet-cm", { NULL }, 32773, "udp" }, - { "filenet-re", { NULL }, 32774, "tcp" }, - { "filenet-re", { NULL }, 32774, "udp" }, - { "filenet-pch", { NULL }, 32775, "tcp" }, - { "filenet-pch", { NULL }, 32775, "udp" }, - { "filenet-peior", { NULL }, 32776, "tcp" }, - { "filenet-peior", { NULL }, 32776, "udp" }, - { "filenet-obrok", { NULL }, 32777, "tcp" }, - { "filenet-obrok", { NULL }, 32777, "udp" }, - { "mlsn", { NULL }, 32801, "tcp" }, - { "mlsn", { NULL }, 32801, "udp" }, - { "retp", { NULL }, 32811, "tcp" }, - { "idmgratm", { NULL }, 32896, "tcp" }, - { "idmgratm", { NULL }, 32896, "udp" }, - { "aurora-balaena", { NULL }, 33123, "tcp" }, - { "aurora-balaena", { NULL }, 33123, "udp" }, - { "diamondport", { NULL }, 33331, "tcp" }, - { "diamondport", { NULL }, 33331, "udp" }, - { "dgi-serv", { NULL }, 33333, "tcp" }, - { "traceroute", { NULL }, 33434, "tcp" }, - { "traceroute", { NULL }, 33434, "udp" }, - { "snip-slave", { NULL }, 33656, "tcp" }, - { "snip-slave", { NULL }, 33656, "udp" }, - { "turbonote-2", { NULL }, 34249, "tcp" }, - { "turbonote-2", { NULL }, 34249, "udp" }, - { "p-net-local", { NULL }, 34378, "tcp" }, - { "p-net-local", { NULL }, 34378, "udp" }, - { "p-net-remote", { NULL }, 34379, "tcp" }, - { "p-net-remote", { NULL }, 34379, "udp" }, - { "dhanalakshmi", { NULL }, 34567, "tcp" }, - { "profinet-rt", { NULL }, 34962, "tcp" }, - { "profinet-rt", { NULL }, 34962, "udp" }, - { "profinet-rtm", { NULL }, 34963, "tcp" }, - { "profinet-rtm", { NULL }, 34963, "udp" }, - { "profinet-cm", { NULL }, 34964, "tcp" }, - { "profinet-cm", { NULL }, 34964, "udp" }, - { "ethercat", { NULL }, 34980, "tcp" }, - { "ethercat", { NULL }, 34980, "udp" }, - { "allpeers", { NULL }, 36001, "tcp" }, - { "allpeers", { NULL }, 36001, "udp" }, - { "s1-control", { NULL }, 36412, "sctp" }, - { "x2-control", { NULL }, 36422, "sctp" }, - { "m2ap", { NULL }, 36443, "sctp" }, - { "m3ap", { NULL }, 36444, "sctp" }, - { "kastenxpipe", { NULL }, 36865, "tcp" }, - { "kastenxpipe", { NULL }, 36865, "udp" }, - { "neckar", { NULL }, 37475, "tcp" }, - { "neckar", { NULL }, 37475, "udp" }, - { "unisys-eportal", { NULL }, 37654, "tcp" }, - { "unisys-eportal", { NULL }, 37654, "udp" }, - { "galaxy7-data", { NULL }, 38201, "tcp" }, - { "galaxy7-data", { NULL }, 38201, "udp" }, - { "fairview", { NULL }, 38202, "tcp" }, - { "fairview", { NULL }, 38202, "udp" }, - { "agpolicy", { NULL }, 38203, "tcp" }, - { "agpolicy", { NULL }, 38203, "udp" }, - { "turbonote-1", { NULL }, 39681, "tcp" }, - { "turbonote-1", { NULL }, 39681, "udp" }, - { "safetynetp", { NULL }, 40000, "tcp" }, - { "safetynetp", { NULL }, 40000, "udp" }, - { "cscp", { NULL }, 40841, "tcp" }, - { "cscp", { NULL }, 40841, "udp" }, - { "csccredir", { NULL }, 40842, "tcp" }, - { "csccredir", { NULL }, 40842, "udp" }, - { "csccfirewall", { NULL }, 40843, "tcp" }, - { "csccfirewall", { NULL }, 40843, "udp" }, - { "ortec-disc", { NULL }, 40853, "udp" }, - { "fs-qos", { NULL }, 41111, "tcp" }, - { "fs-qos", { NULL }, 41111, "udp" }, - { "tentacle", { NULL }, 41121, "tcp" }, - { "crestron-cip", { NULL }, 41794, "tcp" }, - { "crestron-cip", { NULL }, 41794, "udp" }, - { "crestron-ctp", { NULL }, 41795, "tcp" }, - { "crestron-ctp", { NULL }, 41795, "udp" }, - { "candp", { NULL }, 42508, "tcp" }, - { "candp", { NULL }, 42508, "udp" }, - { "candrp", { NULL }, 42509, "tcp" }, - { "candrp", { NULL }, 42509, "udp" }, - { "caerpc", { NULL }, 42510, "tcp" }, - { "caerpc", { NULL }, 42510, "udp" }, - { "reachout", { NULL }, 43188, "tcp" }, - { "reachout", { NULL }, 43188, "udp" }, - { "ndm-agent-port", { NULL }, 43189, "tcp" }, - { "ndm-agent-port", { NULL }, 43189, "udp" }, - { "ip-provision", { NULL }, 43190, "tcp" }, - { "ip-provision", { NULL }, 43190, "udp" }, - { "noit-transport", { NULL }, 43191, "tcp" }, - { "ew-mgmt", { NULL }, 43440, "tcp" }, - { "ew-disc-cmd", { NULL }, 43440, "udp" }, - { "ciscocsdb", { NULL }, 43441, "tcp" }, - { "ciscocsdb", { NULL }, 43441, "udp" }, - { "pmcd", { NULL }, 44321, "tcp" }, - { "pmcd", { NULL }, 44321, "udp" }, - { "pmcdproxy", { NULL }, 44322, "tcp" }, - { "pmcdproxy", { NULL }, 44322, "udp" }, - { "pcp", { NULL }, 44323, "udp" }, - { "rbr-debug", { NULL }, 44553, "tcp" }, - { "rbr-debug", { NULL }, 44553, "udp" }, - { "EtherNet/IP-2", { NULL }, 44818, "tcp" }, - { "EtherNet/IP-2", { NULL }, 44818, "udp" }, - { "invision-ag", { NULL }, 45054, "tcp" }, - { "invision-ag", { NULL }, 45054, "udp" }, - { "eba", { NULL }, 45678, "tcp" }, - { "eba", { NULL }, 45678, "udp" }, - { "qdb2service", { NULL }, 45825, "tcp" }, - { "qdb2service", { NULL }, 45825, "udp" }, - { "ssr-servermgr", { NULL }, 45966, "tcp" }, - { "ssr-servermgr", { NULL }, 45966, "udp" }, - { "mediabox", { NULL }, 46999, "tcp" }, - { "mediabox", { NULL }, 46999, "udp" }, - { "mbus", { NULL }, 47000, "tcp" }, - { "mbus", { NULL }, 47000, "udp" }, - { "winrm", { NULL }, 47001, "tcp" }, - { "dbbrowse", { NULL }, 47557, "tcp" }, - { "dbbrowse", { NULL }, 47557, "udp" }, - { "directplaysrvr", { NULL }, 47624, "tcp" }, - { "directplaysrvr", { NULL }, 47624, "udp" }, - { "ap", { NULL }, 47806, "tcp" }, - { "ap", { NULL }, 47806, "udp" }, - { "bacnet", { NULL }, 47808, "tcp" }, - { "bacnet", { NULL }, 47808, "udp" }, - { "nimcontroller", { NULL }, 48000, "tcp" }, - { "nimcontroller", { NULL }, 48000, "udp" }, - { "nimspooler", { NULL }, 48001, "tcp" }, - { "nimspooler", { NULL }, 48001, "udp" }, - { "nimhub", { NULL }, 48002, "tcp" }, - { "nimhub", { NULL }, 48002, "udp" }, - { "nimgtw", { NULL }, 48003, "tcp" }, - { "nimgtw", { NULL }, 48003, "udp" }, - { "nimbusdb", { NULL }, 48004, "tcp" }, - { "nimbusdbctrl", { NULL }, 48005, "tcp" }, - { "3gpp-cbsp", { NULL }, 48049, "tcp" }, - { "isnetserv", { NULL }, 48128, "tcp" }, - { "isnetserv", { NULL }, 48128, "udp" }, - { "blp5", { NULL }, 48129, "tcp" }, - { "blp5", { NULL }, 48129, "udp" }, - { "com-bardac-dw", { NULL }, 48556, "tcp" }, - { "com-bardac-dw", { NULL }, 48556, "udp" }, - { "iqobject", { NULL }, 48619, "tcp" }, - { "iqobject", { NULL }, 48619, "udp" }, -# endif /* USE_IANA_REGISTERED_PORTS */ - { NULL, { NULL }, 0, NULL } -}; - -struct servent *getservbyport(int port, const char *proto) -{ - unsigned short u_port; - const char *protocol = NULL; - int error = 0; - size_t i; - - u_port = ntohs((unsigned short)port); - - if (proto) { - switch (ares_strlen(proto)) { - case 3: - if (!strncasecmp(proto, "tcp", 3)) { - protocol = "tcp"; - } else if (!strncasecmp(proto, "udp", 3)) { - protocol = "udp"; - } else { - error = WSAEFAULT; - } - break; - case 4: - if (!strncasecmp(proto, "sctp", 4)) { - protocol = "sctp"; - } else if (!strncasecmp(proto, "dccp", 4)) { - protocol = "dccp"; - } else { - error = WSAEFAULT; - } - break; - default: - error = WSAEFAULT; - } - } - - if (!error) { - for (i = 0; i < (sizeof(IANAports) / sizeof(IANAports[0])) - 1; i++) { - if (u_port == IANAports[i].s_port) { - if (!protocol || !strcasecmp(protocol, IANAports[i].s_proto)) { - return (struct servent *)&IANAports[i]; - } - } - } - error = WSANO_DATA; - } - - SET_SOCKERRNO(error); - return NULL; -} - -#endif /* _WIN32_WCE */ diff --git a/lib/c-ares-1.33.1/src/lib/ares_private.h b/lib/c-ares-1.33.1/src/lib/ares_private.h deleted file mode 100644 index 263c2a606d3..00000000000 --- a/lib/c-ares-1.33.1/src/lib/ares_private.h +++ /dev/null @@ -1,807 +0,0 @@ -/* MIT License - * - * Copyright (c) 1998 Massachusetts Institute of Technology - * Copyright (c) 2010 Daniel Stenberg - * - * 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_PRIVATE_H -#define __ARES_PRIVATE_H - -/* ============================================================================ - * NOTE: All c-ares source files should include ares_private.h as the first - * header. - * ============================================================================ - */ - -#include "ares_setup.h" -#include "ares.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif - -#define DEFAULT_TIMEOUT 2000 /* milliseconds */ -#define DEFAULT_TRIES 3 -#ifndef INADDR_NONE -# define INADDR_NONE 0xffffffff -#endif - -/* By using a double cast, we can get rid of the bogus warning of - * warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *' - * increases required alignment from 1 to 4 [-Wcast-align] - */ -#define CARES_INADDR_CAST(type, var) ((type)((const void *)var)) - -#if defined(USE_WINSOCK) - -# define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" -# define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" -# define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" -# define WIN_NT_DNSCLIENT \ - "Software\\Policies\\Microsoft\\Windows NT\\DNSClient" -# define NAMESERVER "NameServer" -# define DHCPNAMESERVER "DhcpNameServer" -# define DATABASEPATH "DatabasePath" -# define WIN_PATH_HOSTS "\\hosts" -# define SEARCHLIST_KEY "SearchList" -# define PRIMARYDNSSUFFIX_KEY "PrimaryDNSSuffix" -# define INTERFACES_KEY "Interfaces" -# define DOMAIN_KEY "Domain" -# define DHCPDOMAIN_KEY "DhcpDomain" -# define PATH_RESOLV_CONF "" -#elif defined(WATT32) - -# define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf" -W32_FUNC const char *_w32_GetHostsFile(void); - -#elif defined(NETWARE) - -# define PATH_RESOLV_CONF "sys:/etc/resolv.cfg" -# define PATH_HOSTS "sys:/etc/hosts" - -#elif defined(__riscos__) - -# define PATH_RESOLV_CONF "" -# define PATH_HOSTS "InetDBase:Hosts" - -#elif defined(__HAIKU__) - -# define PATH_RESOLV_CONF "/system/settings/network/resolv.conf" -# define PATH_HOSTS "/system/settings/network/hosts" - -#else - -# define PATH_RESOLV_CONF "/etc/resolv.conf" -# ifdef ETC_INET -# define PATH_HOSTS "/etc/inet/hosts" -# else -# define PATH_HOSTS "/etc/hosts" -# endif - -#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 \ - https://www.dnsflagday.net/2020/#faq */ -#define MAXENDSSZ 4096 /* Maximum (local) limit for edns packet size */ -#define EDNSFIXEDSZ 11 /* Size of EDNS header */ - -/********* EDNS defines section ******/ - -/* Default values for server failover behavior. We retry failed servers with - * a 10% probability and a minimum delay of 5 seconds between retries. - */ -#define DEFAULT_SERVER_RETRY_CHANCE 10 -#define DEFAULT_SERVER_RETRY_DELAY 5000 - -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 */ - unsigned short qid; /* host byte order */ - ares_timeval_t ts; /*!< Timestamp query was sent */ - ares_timeval_t timeout; - ares_channel_t *channel; - - /* - * 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; - - /* connection handle query is associated with */ - ares_conn_t *conn; - - /* Query */ - ares_dns_record_t *query; - - ares_callback_dnsrec callback; - void *arg; - - /* Query status */ - size_t try_count; /* Number of times we tried this query already. */ - size_t cookie_try_count; /* Attempt count for cookie resends */ - ares_bool_t using_tcp; - ares_status_t error_status; - size_t timeouts; /* number of timeouts we saw for this request */ - ares_bool_t no_retries; /* do not perform any additional retries, this is - * set when a query is to be canceled */ -}; - -struct apattern { - struct ares_addr addr; - unsigned char mask; -}; - -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; - - /* 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]; - - /* Thread safety lock */ - ares__thread_mutex_t *lock; - - /* Conditional to wake waiters when queue is 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; - - /* random state to use when generating new ids and generating retry penalties - */ - ares_rand_state *rand_state; - - /* All active queries in a single list */ - ares__llist_t *all_queries; - /* Queries bucketed by qid, for quickly dispatching DNS responses: */ - ares__htable_szvp_t *queries_by_qid; - - /* Queries bucketed by timeout, for quickly handling timeouts: */ - 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_sock_state_cb sock_state_cb; - void *sock_state_cb_data; - - ares_sock_create_callback sock_create_cb; - void *sock_create_cb_data; - - ares_sock_config_callback sock_config_cb; - void *sock_config_cb_data; - - const struct ares_socket_functions *sock_funcs; - void *sock_func_cb_data; - - /* Path for resolv.conf file, configurable via ares_options */ - char *resolvconf_path; - - /* Path for hosts file, configurable via ares_options */ - char *hosts_path; - - /* Maximum UDP queries per connection allowed */ - size_t udp_max_queries; - - /* Cache of local hosts file */ - ares_hosts_file_t *hf; - - /* Query Cache */ - ares__qcache_t *qcache; - - /* Fields controlling server failover behavior. - * The retry chance is the probability (1/N) by which we will retry a failed - * server instead of the best server when selecting a server to send queries - * to. - * The retry delay is the minimum time in milliseconds to wait between doing - * such retries (applied per-server). - */ - unsigned short server_retry_chance; - size_t server_retry_delay; - - /* Callback triggered when a server has a successful or failed response */ - ares_server_state_callback server_state_cb; - void *server_state_cb_data; - - /* TRUE if a reinit is pending. Reinit spawns a thread to read the system - * configuration and then apply the configuration since configuration - * reading may block. The thread handle is provided for waiting on thread - * exit. */ - ares_bool_t reinit_pending; - 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 - * system config changes might get triggered and we need a flag to make - * sure we don't take action. */ - ares_bool_t sys_up; -}; - -/* 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); - -/* 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); - -/*! Count the number of labels (dots+1) in a domain */ -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 - * as well as uses channel configuration to determine the search order. - * - * \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() - * 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); - -/*! Function to create callback arg for converting from ares_callback_dnsrec - * to ares_calback */ -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__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); - -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, - 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, - const struct ares_options *options, - int optmask); -ares_status_t ares__init_by_sysconfig(ares_channel_t *channel); - -typedef struct { - ares__llist_t *sconfig; - struct apattern *sortlist; - size_t nsortlist; - char **domains; - size_t ndomains; - char *lookups; - size_t ndots; - size_t tries; - ares_bool_t rotate; - size_t timeout_ms; - 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__init_by_environment(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); -#endif -#ifdef USE_WINSOCK -ares_status_t ares__init_sysconfig_windows(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); - -/* 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__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); - -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); - -void ares__freeaddrinfo_cnames(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); - -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__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_get_server_addr(const ares_server_t *server, - 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); - -/* Same as ares_query_dnsrec() except does not take a channel lock. Use this - * if a channel lock is already held */ -ares_status_t ares_query_nolock(ares_channel_t *channel, const char *name, - ares_dns_class_t dnsclass, - ares_dns_rec_type_t type, - 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, - const ares_dns_record_t *dnsrec, - ares_callback_dnsrec callback, void *arg, - unsigned short *qid); - -/* Same as ares_gethostbyaddr() except does not take a channel lock. Use this - * if a channel lock is already held */ -void ares_gethostbyaddr_nolock(ares_channel_t *channel, const void *addr, - int addrlen, int family, - ares_host_callback callback, void *arg); - -/*! Parse a compressed DNS name as defined in RFC1035 starting at the current - * 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. - * - * \param[in] buf Initialized buffer object - * \param[out] name Pointer passed by reference to be filled in with - * allocated string of the parsed name that must be - * ares_free()'d by the caller. - * \param[in] is_hostname if ARES_TRUE, will validate the character set for - * 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); - -/*! 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 - * each label being a maximum of 63 characters. If the validate_hostname - * flag is set, it will strictly validate the character set. - * - * \param[in,out] buf Initialized buffer object to write name to - * \param[in,out] list Pointer passed by reference to maintain a list of - * domain name to indexes used for name compression. - * Pass NULL (not by reference) if name compression isn't - * desired. Otherwise the list will be automatically - * created upon first entry. - * \param[in] validate_hostname Validate the hostname character set. - * \param[in] name Name to write out, it may have escape - * sequences. - * \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); - -/*! Check if the queue is empty, if so, wake any waiters. This is only - * effective if built with threading support. - * - * Must be holding a channel lock when calling this function. - * - * \param[in] channel Initialized ares channel object - */ -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 && \ - 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__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); -ares_status_t ares_qcache_insert(ares_channel_t *channel, - const ares_timeval_t *now, - const ares_query_t *query, - ares_dns_record_t *dnsrec); -ares_status_t ares_qcache_fetch(ares_channel_t *channel, - const ares_timeval_t *now, - const ares_dns_record_t *dnsrec, - const ares_dns_record_t **dnsrec_resp); - -void ares_metrics_record(const ares_query_t *query, ares_server_t *server, - ares_status_t status, const ares_dns_record_t *dnsrec); -size_t ares_metrics_server_timeout(const ares_server_t *server, - const ares_timeval_t *now); - -ares_status_t ares_cookie_apply(ares_dns_record_t *dnsrec, ares_conn_t *conn, - const ares_timeval_t *now); -ares_status_t ares_cookie_validate(ares_query_t *query, - const ares_dns_record_t *dnsresp, - 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); - -struct ares_event_thread; -typedef struct ares_event_thread ares_event_thread_t; - -void ares_event_thread_destroy(ares_channel_t *channel); -ares_status_t ares_event_thread_init(ares_channel_t *channel); - - -#ifdef _WIN32 -# define HOSTENT_ADDRTYPE_TYPE short -# define HOSTENT_LENGTH_TYPE short -#else -# define HOSTENT_ADDRTYPE_TYPE int -# define HOSTENT_LENGTH_TYPE int -#endif - -#endif /* __ARES_PRIVATE_H */ diff --git a/lib/c-ares-1.33.1/src/lib/record/ares_dns_multistring.c b/lib/c-ares-1.33.1/src/lib/record/ares_dns_multistring.c deleted file mode 100644 index bff5afb9f2a..00000000000 --- a/lib/c-ares-1.33.1/src/lib/record/ares_dns_multistring.c +++ /dev/null @@ -1,224 +0,0 @@ -/* 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_dns_private.h" - -typedef struct { - unsigned char *data; - size_t len; -} multistring_data_t; - -struct ares__dns_multistring { - /*! whether or not cached concatenated string is valid */ - ares_bool_t cache_invalidated; - /*! combined/concatenated string cache */ - unsigned char *cache_str; - /*! length of combined/concatenated string */ - size_t cache_str_len; - /*! Data making up strings */ - ares__array_t *strs; /*!< multistring_data_t type */ -}; - -static void ares__dns_multistring_free_cb(void *arg) -{ - multistring_data_t *data = arg; - if (data == NULL) { - return; - } - ares_free(data->data); -} - -ares__dns_multistring_t *ares__dns_multistring_create(void) -{ - ares__dns_multistring_t *strs = ares_malloc_zero(sizeof(*strs)); - if (strs == NULL) { - return NULL; - } - - strs->strs = ares__array_create(sizeof(multistring_data_t), - ares__dns_multistring_free_cb); - if (strs->strs == NULL) { - ares_free(strs); - return NULL; - } - - return strs; -} - -void ares__dns_multistring_clear(ares__dns_multistring_t *strs) -{ - if (strs == NULL) { - return; - } - - while (ares__array_len(strs->strs)) { - ares__array_remove_last(strs->strs); - } -} - -void ares__dns_multistring_destroy(ares__dns_multistring_t *strs) -{ - if (strs == NULL) { - return; - } - ares__dns_multistring_clear(strs); - ares__array_destroy(strs->strs); - ares_free(strs->cache_str); - ares_free(strs); -} - -ares_status_t ares__dns_multistring_replace_own(ares__dns_multistring_t *strs, - size_t idx, unsigned char *str, - size_t len) -{ - multistring_data_t *data; - - if (strs == NULL || str == NULL || len == 0) { - return ARES_EFORMERR; - } - - strs->cache_invalidated = ARES_TRUE; - - data = ares__array_at(strs->strs, idx); - if (data == NULL) { - return ARES_EFORMERR; - } - - ares_free(data->data); - data->data = str; - data->len = len; - return ARES_SUCCESS; -} - -ares_status_t ares__dns_multistring_del(ares__dns_multistring_t *strs, - size_t idx) -{ - if (strs == NULL) { - return ARES_EFORMERR; - } - - strs->cache_invalidated = ARES_TRUE; - - return ares__array_remove_at(strs->strs, idx); -} - -ares_status_t ares__dns_multistring_add_own(ares__dns_multistring_t *strs, - unsigned char *str, size_t len) -{ - multistring_data_t *data; - ares_status_t status; - - if (strs == NULL) { - return ARES_EFORMERR; - } - - strs->cache_invalidated = ARES_TRUE; - - /* NOTE: its ok to have an empty string added */ - if (str == NULL && len != 0) { - return ARES_EFORMERR; - } - - status = ares__array_insert_last((void **)&data, strs->strs); - if (status != ARES_SUCCESS) { - return status; - } - - data->data = str; - data->len = len; - - return ARES_SUCCESS; -} - -size_t ares__dns_multistring_cnt(const ares__dns_multistring_t *strs) -{ - if (strs == NULL) { - return 0; - } - return ares__array_len(strs->strs); -} - -const unsigned char * - ares__dns_multistring_get(const ares__dns_multistring_t *strs, size_t idx, - size_t *len) -{ - const multistring_data_t *data; - - if (strs == NULL || len == NULL) { - return NULL; - } - - data = ares__array_at_const(strs->strs, idx); - if (data == NULL) { - return NULL; - } - - *len = data->len; - return data->data; -} - -const unsigned char * - ares__dns_multistring_get_combined(ares__dns_multistring_t *strs, size_t *len) -{ - ares__buf_t *buf = NULL; - size_t i; - - if (strs == NULL || len == NULL) { - return NULL; - } - - *len = 0; - - /* Return cache if possible */ - if (!strs->cache_invalidated) { - *len = strs->cache_str_len; - return strs->cache_str; - } - - /* Clear cache */ - ares_free(strs->cache_str); - strs->cache_str = NULL; - strs->cache_str_len = 0; - - buf = ares__buf_create(); - - for (i = 0; i < ares__array_len(strs->strs); i++) { - const multistring_data_t *data = ares__array_at_const(strs->strs, i); - if (data == NULL || - ares__buf_append(buf, data->data, data->len) != ARES_SUCCESS) { - ares__buf_destroy(buf); - return NULL; - } - } - - strs->cache_str = - (unsigned char *)ares__buf_finish_str(buf, &strs->cache_str_len); - if (strs->cache_str != NULL) { - strs->cache_invalidated = ARES_FALSE; - } - *len = strs->cache_str_len; - return strs->cache_str; -} diff --git a/lib/c-ares-1.33.1/src/lib/record/ares_dns_multistring.h b/lib/c-ares-1.33.1/src/lib/record/ares_dns_multistring.h deleted file mode 100644 index d9aa7ae3784..00000000000 --- a/lib/c-ares-1.33.1/src/lib/record/ares_dns_multistring.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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_DNS_MULTISTRING_H -#define __ARES_DNS_MULTISTRING_H - -struct ares__dns_multistring; -typedef struct ares__dns_multistring ares__dns_multistring_t; - -ares__dns_multistring_t *ares__dns_multistring_create(void); -void ares__dns_multistring_clear(ares__dns_multistring_t *strs); -void ares__dns_multistring_destroy(ares__dns_multistring_t *strs); -ares_status_t ares__dns_multistring_replace_own(ares__dns_multistring_t *strs, - size_t idx, unsigned char *str, - size_t len); -ares_status_t ares__dns_multistring_del(ares__dns_multistring_t *strs, - size_t idx); -ares_status_t ares__dns_multistring_add_own(ares__dns_multistring_t *strs, - unsigned char *str, size_t len); -size_t ares__dns_multistring_cnt(const ares__dns_multistring_t *strs); -const unsigned char * - ares__dns_multistring_get(const ares__dns_multistring_t *strs, size_t idx, - size_t *len); -const unsigned char * - ares__dns_multistring_get_combined(ares__dns_multistring_t *strs, - size_t *len); - -#endif diff --git a/lib/c-ares-1.33.1/src/lib/str/ares_str.c b/lib/c-ares-1.33.1/src/lib/str/ares_str.c deleted file mode 100644 index ade61041eb9..00000000000 --- a/lib/c-ares-1.33.1/src/lib/str/ares_str.c +++ /dev/null @@ -1,288 +0,0 @@ -/* MIT License - * - * Copyright (c) 1998 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" -#include "ares_str.h" - -#ifdef HAVE_STDINT_H -# include -#endif - -size_t ares_strlen(const char *str) -{ - if (str == NULL) { - return 0; - } - - return strlen(str); -} - -char *ares_strdup(const char *s1) -{ - size_t len; - char *out; - - if (s1 == NULL) { - return NULL; - } - - len = ares_strlen(s1); - - /* Don't see how this is possible */ - if (len == SIZE_MAX) { - return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */ - } - - out = ares_malloc(len + 1); - if (out == NULL) { - return NULL; - } - - if (len) { - memcpy(out, s1, len); - } - - out[len] = 0; - return out; -} - -size_t ares_strcpy(char *dest, const char *src, size_t dest_size) -{ - size_t len = 0; - - if (dest == NULL || dest_size == 0) { - return 0; /* LCOV_EXCL_LINE: DefensiveCoding */ - } - - len = ares_strlen(src); - - if (len >= dest_size) { - len = dest_size - 1; - } - - if (len) { - memcpy(dest, src, len); - } - - dest[len] = 0; - return len; -} - -ares_bool_t ares_str_isnum(const char *str) -{ - size_t i; - - if (str == NULL || *str == 0) { - return ARES_FALSE; - } - - for (i = 0; str[i] != 0; i++) { - if (str[i] < '0' || str[i] > '9') { - return ARES_FALSE; - } - } - return ARES_TRUE; -} - -void ares__str_rtrim(char *str) -{ - size_t len; - size_t i; - - if (str == NULL) { - return; /* LCOV_EXCL_LINE: DefensiveCoding */ - } - - len = ares_strlen(str); - for (i = len; i > 0; i--) { - if (!ares__isspace(str[i - 1])) { - break; - } - } - str[i] = 0; -} - -void ares__str_ltrim(char *str) -{ - size_t i; - size_t len; - - if (str == NULL) { - return; /* LCOV_EXCL_LINE: DefensiveCoding */ - } - - for (i = 0; str[i] != 0 && ares__isspace(str[i]); i++) { - /* Do nothing */ - } - - if (i == 0) { - return; - } - - len = ares_strlen(str); - if (i != len) { - memmove(str, str + i, len - i); - } - str[len - i] = 0; -} - -void ares__str_trim(char *str) -{ - ares__str_ltrim(str); - ares__str_rtrim(str); -} - -/* tolower() is locale-specific. Use a lookup table fast conversion that only - * operates on ASCII */ -static const unsigned char ares__tolower_lookup[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, - 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, - 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, - 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, - 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, - 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, - 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, - 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, - 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, - 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, - 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, - 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, - 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, - 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, - 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, - 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, - 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, - 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, - 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF -}; - -unsigned char ares__tolower(unsigned char c) -{ - return ares__tolower_lookup[c]; -} - -ares_bool_t ares__memeq_ci(const unsigned char *ptr, const unsigned char *val, - size_t len) -{ - size_t i; - for (i = 0; i < len; i++) { - if (ares__tolower_lookup[ptr[i]] != ares__tolower_lookup[val[i]]) { - return ARES_FALSE; - } - } - return ARES_TRUE; -} - -ares_bool_t ares__isspace(int ch) -{ - switch (ch) { - case '\r': - case '\t': - case ' ': - case '\v': - case '\f': - case '\n': - return ARES_TRUE; - default: - break; - } - return ARES_FALSE; -} - -ares_bool_t ares__isprint(int ch) -{ - if (ch >= 0x20 && ch <= 0x7E) { - return ARES_TRUE; - } - return ARES_FALSE; -} - -/* Character set allowed by hostnames. This is to include the normal - * domain name character set plus: - * - underscores which are used in SRV records. - * - Forward slashes such as are used for classless in-addr.arpa - * delegation (CNAMEs) - * - Asterisks may be used for wildcard domains in CNAMEs as seen in the - * real world. - * While RFC 2181 section 11 does state not to do validation, - * that applies to servers, not clients. Vulnerabilities have been - * reported when this validation is not performed. Security is more - * important than edge-case compatibility (which is probably invalid - * anyhow). */ -ares_bool_t ares__is_hostnamech(int ch) -{ - /* [A-Za-z0-9-*._/] - * Don't use isalnum() as it is locale-specific - */ - if (ch >= 'A' && ch <= 'Z') { - return ARES_TRUE; - } - if (ch >= 'a' && ch <= 'z') { - return ARES_TRUE; - } - if (ch >= '0' && ch <= '9') { - return ARES_TRUE; - } - if (ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '*') { - return ARES_TRUE; - } - - return ARES_FALSE; -} - -ares_bool_t ares__is_hostname(const char *str) -{ - size_t i; - - if (str == NULL) { - return ARES_FALSE; /* LCOV_EXCL_LINE: DefensiveCoding */ - } - - for (i = 0; str[i] != 0; i++) { - if (!ares__is_hostnamech(str[i])) { - return ARES_FALSE; - } - } - return ARES_TRUE; -} - -ares_bool_t ares__str_isprint(const char *str, size_t len) -{ - size_t i; - - if (str == NULL && len != 0) { - return ARES_FALSE; - } - - for (i = 0; i < len; i++) { - if (!ares__isprint(str[i])) { - return ARES_FALSE; - } - } - return ARES_TRUE; -} diff --git a/lib/c-ares-1.33.1/src/lib/str/ares_str.h b/lib/c-ares-1.33.1/src/lib/str/ares_str.h deleted file mode 100644 index 440758c21be..00000000000 --- a/lib/c-ares-1.33.1/src/lib/str/ares_str.h +++ /dev/null @@ -1,89 +0,0 @@ -/* MIT License - * - * Copyright (c) 1998 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 - */ -#ifndef __ARES_STR_H -#define __ARES_STR_H - -char *ares_strdup(const char *s1); - -size_t ares_strlen(const char *str); - -/*! Copy string from source to destination with destination buffer size - * provided. The destination is guaranteed to be null terminated, if the - * provided buffer isn't large enough, only those bytes from the source that - * will fit will be copied. - * - * \param[out] dest Destination buffer - * \param[in] src Source to copy - * \param[in] dest_size Size of destination buffer - * \return String length. Will be at most dest_size-1 - */ -size_t ares_strcpy(char *dest, const char *src, size_t dest_size); - -ares_bool_t ares_str_isnum(const char *str); - -void ares__str_ltrim(char *str); -void ares__str_rtrim(char *str); -void ares__str_trim(char *str); - -unsigned char ares__tolower(unsigned char c); -ares_bool_t ares__memeq_ci(const unsigned char *ptr, const unsigned char *val, - size_t len); - -ares_bool_t ares__isspace(int ch); -ares_bool_t ares__isprint(int ch); -ares_bool_t ares__is_hostnamech(int ch); - -ares_bool_t ares__is_hostname(const char *str); - -/*! Validate the string provided is printable. The length specified must be - * at least the size of the buffer provided. If a NULL-terminator is hit - * before the length provided is hit, this will not be considered a valid - * printable string. This does not validate that the string is actually - * NULL terminated. - * - * \param[in] str Buffer containing string to evaluate. - * \param[in] len Number of characters to evaluate within provided buffer. - * If 0, will return TRUE since it did not hit an exception. - * \return ARES_TRUE if the entire string is printable, ARES_FALSE if not. - */ -ares_bool_t ares__str_isprint(const char *str, size_t len); - -/* We only care about ASCII rules */ -#define ares__isascii(x) (((unsigned char)x) <= 127) -#define ares__isdigit(x) \ - (((unsigned char)x) >= '0' && ((unsigned char)x) <= '9') -#define ares__isxdigit(x) \ - (ares__isdigit(x) || \ - (((unsigned char)x) >= 'a' && ((unsigned char)x) <= 'f') || \ - (((unsigned char)x) >= 'A' && ((unsigned char)x) <= 'F')) -#define ares__isupper(x) \ - (((unsigned char)x) >= 'A' && ((unsigned char)x) <= 'Z') -#define ares__islower(x) \ - (((unsigned char)x) >= 'a' && ((unsigned char)x) <= 'z') -#define ares__isalpha(x) (ares__islower(x) || ares__isupper(x)) - -#endif /* __ARES_STR_H */ diff --git a/lib/c-ares-1.33.1/src/lib/util/ares__threads.h b/lib/c-ares-1.33.1/src/lib/util/ares__threads.h deleted file mode 100644 index 108354dfc1e..00000000000 --- a/lib/c-ares-1.33.1/src/lib/util/ares__threads.h +++ /dev/null @@ -1,60 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 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__THREADS_H -#define __ARES__THREADS_H - -struct ares__thread_mutex; -typedef struct ares__thread_mutex ares__thread_mutex_t; - -ares__thread_mutex_t *ares__thread_mutex_create(void); -void ares__thread_mutex_destroy(ares__thread_mutex_t *mut); -void ares__thread_mutex_lock(ares__thread_mutex_t *mut); -void ares__thread_mutex_unlock(ares__thread_mutex_t *mut); - - -struct ares__thread_cond; -typedef struct ares__thread_cond ares__thread_cond_t; - -ares__thread_cond_t *ares__thread_cond_create(void); -void ares__thread_cond_destroy(ares__thread_cond_t *cond); -void ares__thread_cond_signal(ares__thread_cond_t *cond); -void ares__thread_cond_broadcast(ares__thread_cond_t *cond); -ares_status_t ares__thread_cond_wait(ares__thread_cond_t *cond, - ares__thread_mutex_t *mut); -ares_status_t ares__thread_cond_timedwait(ares__thread_cond_t *cond, - ares__thread_mutex_t *mut, - unsigned long timeout_ms); - - -struct ares__thread; -typedef struct ares__thread ares__thread_t; - -typedef void *(*ares__thread_func_t)(void *arg); -ares_status_t ares__thread_create(ares__thread_t **thread, - ares__thread_func_t func, void *arg); -ares_status_t ares__thread_join(ares__thread_t *thread, void **rv); - -#endif diff --git a/lib/c-ares-1.33.1/src/tools/Makefile.inc b/lib/c-ares-1.33.1/src/tools/Makefile.inc deleted file mode 100644 index 4c6b6aaa978..00000000000 --- a/lib/c-ares-1.33.1/src/tools/Makefile.inc +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) The c-ares project and its contributors -# SPDX-License-Identifier: MIT -SAMPLESOURCES = ares_getopt.c \ - ../lib/str/ares_strcasecmp.c - -SAMPLEHEADERS = ares_getopt.h \ - ../lib/str/ares_strcasecmp.h diff --git a/lib/c-ares-1.33.1/src/tools/adig.c b/lib/c-ares-1.33.1/src/tools/adig.c deleted file mode 100644 index 8b2ad2e96a6..00000000000 --- a/lib/c-ares-1.33.1/src/tools/adig.c +++ /dev/null @@ -1,1010 +0,0 @@ -/* MIT License - * - * Copyright (c) 1998 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_setup.h" - -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif - -#include "ares_nameser.h" - -#ifdef HAVE_STRINGS_H -# include -#endif - -#include "ares.h" -#include "ares_dns.h" - -#ifndef HAVE_STRDUP -# include "str/ares_str.h" -# define strdup(ptr) ares_strdup(ptr) -#endif - -#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 - -#include "ares_getopt.h" - -typedef struct { - ares_bool_t is_help; - struct ares_options options; - int optmask; - ares_dns_class_t qclass; - ares_dns_rec_type_t qtype; - int args_processed; - char *servers; - char error[256]; -} adig_config_t; - -typedef struct { - const char *name; - int value; -} nv_t; - -static const nv_t configflags[] = { - { "usevc", ARES_FLAG_USEVC }, - { "primary", ARES_FLAG_PRIMARY }, - { "igntc", ARES_FLAG_IGNTC }, - { "norecurse", ARES_FLAG_NORECURSE }, - { "stayopen", ARES_FLAG_STAYOPEN }, - { "noaliases", ARES_FLAG_NOALIASES }, - { "edns", ARES_FLAG_EDNS }, - { "dns0x20", ARES_FLAG_DNS0x20 } -}; -static const size_t nconfigflags = sizeof(configflags) / sizeof(*configflags); - -static int lookup_flag(const nv_t *nv, size_t num_nv, const char *name) -{ - size_t i; - - if (name == NULL) { - return 0; - } - - for (i = 0; i < num_nv; i++) { - if (strcasecmp(nv[i].name, name) == 0) { - return nv[i].value; - } - } - - return 0; -} - -static void free_config(adig_config_t *config) -{ - free(config->servers); - memset(config, 0, sizeof(*config)); -} - -static void print_help(void) -{ - /* Split due to maximum c89 string literal of 509 bytes */ - printf("adig version %s\n\n", ares_version(NULL)); - printf( - "usage: adig [-h] [-d] [-f flag] [[-s server] ...] [-T|U port] [-c class]\n" - " [-t type] name ...\n\n"); - printf(" -h : Display this help and exit.\n"); - printf(" -d : Print some extra debugging output.\n"); - printf( - " -f flag : Add a behavior control flag. May be specified more than " - "once\n" - " to add additional flags. Possible values are:\n" - " igntc - do not retry a truncated query as TCP, just\n" - " return the truncated answer\n" - " noaliases - don't honor the HOSTALIASES environment\n" - " variable\n"); - printf(" norecurse - don't query upstream servers recursively\n" - " primary - use the first server\n" - " stayopen - don't close the communication sockets\n" - " usevc - use TCP only\n" - " edns - use EDNS\n" - " dns0x20 - enable DNS 0x20 support\n"); - printf( - " -s server : Connect to the specified DNS server, instead of the\n" - " system's default one(s). Servers are tried in round-robin,\n" - " if the previous one failed.\n"); - printf(" -T port : Connect to the specified TCP port of DNS server.\n"); - printf(" -U port : Connect to the specified UDP port of DNS server.\n"); - printf(" -c class : Set the query class. Possible values for class are:\n" - " ANY, CHAOS, HS and IN (default)\n"); - printf( - " -t type : Query records of the specified type. Possible values for\n" - " type are:\n" - " A (default), AAAA, ANY, CNAME, HINFO, MX, NAPTR, NS, PTR,\n" - " SOA, SRV, TXT, TLSA, URI, CAA, SVCB, HTTPS\n\n"); -} - -static ares_bool_t read_cmdline(int argc, const char * const *argv, - adig_config_t *config) -{ - ares_getopt_state_t state; - int c; - - ares_getopt_init(&state, argc, argv); - state.opterr = 0; - - while ((c = ares_getopt(&state, "dh?f:s:c:t:T:U:")) != -1) { - int f; - - switch (c) { - case 'd': -#ifdef WATT32 - dbug_init(); -#endif - break; - - case 'h': - config->is_help = ARES_TRUE; - return ARES_TRUE; - - case 'f': - f = lookup_flag(configflags, nconfigflags, state.optarg); - if (f == 0) { - snprintf(config->error, sizeof(config->error), "flag %s unknown", - state.optarg); - } - - config->options.flags |= f; - config->optmask |= ARES_OPT_FLAGS; - break; - - case 's': - if (state.optarg == NULL) { - snprintf(config->error, sizeof(config->error), "%s", - "missing servers"); - return ARES_FALSE; - } - if (config->servers) { - free(config->servers); - } - config->servers = strdup(state.optarg); - break; - - case 'c': - if (!ares_dns_class_fromstr(&config->qclass, state.optarg)) { - snprintf(config->error, sizeof(config->error), - "unrecognized class %s", state.optarg); - return ARES_FALSE; - } - break; - - case 't': - if (!ares_dns_rec_type_fromstr(&config->qtype, state.optarg)) { - snprintf(config->error, sizeof(config->error), "unrecognized type %s", - state.optarg); - return ARES_FALSE; - } - break; - - case 'T': - { - /* Set the TCP port number. */ - long port = strtol(state.optarg, NULL, 0); - - if (port <= 0 || port > 65535) { - snprintf(config->error, sizeof(config->error), - "invalid port number"); - return ARES_FALSE; - } - config->options.tcp_port = (unsigned short)port; - config->options.flags |= ARES_FLAG_USEVC; - config->optmask |= ARES_OPT_TCP_PORT; - } - break; - - case 'U': - { - /* Set the TCP port number. */ - long port = strtol(state.optarg, NULL, 0); - - if (port <= 0 || port > 65535) { - snprintf(config->error, sizeof(config->error), - "invalid port number"); - return ARES_FALSE; - } - config->options.udp_port = (unsigned short)port; - config->options.flags |= ARES_FLAG_USEVC; - config->optmask |= ARES_OPT_UDP_PORT; - } - break; - - case ':': - snprintf(config->error, sizeof(config->error), - "%c requires an argument", state.optopt); - return ARES_FALSE; - - default: - snprintf(config->error, sizeof(config->error), - "unrecognized option: %c", state.optopt); - return ARES_FALSE; - } - } - - config->args_processed = state.optind; - if (config->args_processed >= argc) { - snprintf(config->error, sizeof(config->error), "missing query name"); - return ARES_FALSE; - } - return ARES_TRUE; -} - -static void print_flags(ares_dns_flags_t flags) -{ - if (flags & ARES_FLAG_QR) { - printf(" qr"); - } - if (flags & ARES_FLAG_AA) { - printf(" aa"); - } - if (flags & ARES_FLAG_TC) { - printf(" tc"); - } - if (flags & ARES_FLAG_RD) { - printf(" rd"); - } - if (flags & ARES_FLAG_RA) { - printf(" ra"); - } - if (flags & ARES_FLAG_AD) { - printf(" ad"); - } - if (flags & ARES_FLAG_CD) { - printf(" cd"); - } -} - -static void print_header(const ares_dns_record_t *dnsrec) -{ - printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n", - ares_dns_opcode_tostr(ares_dns_record_get_opcode(dnsrec)), - ares_dns_rcode_tostr(ares_dns_record_get_rcode(dnsrec)), - ares_dns_record_get_id(dnsrec)); - printf(";; flags:"); - print_flags(ares_dns_record_get_flags(dnsrec)); - printf("; QUERY: %u, ANSWER: %u, AUTHORITY: %u, ADDITIONAL: %u\n\n", - (unsigned int)ares_dns_record_query_cnt(dnsrec), - (unsigned int)ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ANSWER), - (unsigned int)ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_AUTHORITY), - (unsigned int)ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ADDITIONAL)); -} - -static void print_question(const ares_dns_record_t *dnsrec) -{ - size_t i; - printf(";; QUESTION SECTION:\n"); - for (i = 0; i < ares_dns_record_query_cnt(dnsrec); i++) { - const char *name; - ares_dns_rec_type_t qtype; - ares_dns_class_t qclass; - size_t len; - if (ares_dns_record_query_get(dnsrec, i, &name, &qtype, &qclass) != - ARES_SUCCESS) { - return; - } - if (name == NULL) { - return; - } - len = strlen(name); - printf(";%s.\t", name); - if (len + 1 < 24) { - printf("\t"); - } - if (len + 1 < 16) { - printf("\t"); - } - printf("%s\t%s\n", ares_dns_class_tostr(qclass), - ares_dns_rec_type_tostr(qtype)); - } - printf("\n"); -} - -static void print_opt_none(const unsigned char *val, size_t val_len) -{ - (void)val; - if (val_len != 0) { - printf("INVALID!"); - } -} - -static void print_opt_addr_list(const unsigned char *val, size_t val_len) -{ - size_t i; - if (val_len % 4 != 0) { - printf("INVALID!"); - return; - } - for (i = 0; i < val_len; i += 4) { - char buf[256] = ""; - ares_inet_ntop(AF_INET, val + i, buf, sizeof(buf)); - if (i != 0) { - printf(","); - } - printf("%s", buf); - } -} - -static void print_opt_addr6_list(const unsigned char *val, size_t val_len) -{ - size_t i; - if (val_len % 16 != 0) { - printf("INVALID!"); - return; - } - for (i = 0; i < val_len; i += 16) { - char buf[256] = ""; - - ares_inet_ntop(AF_INET6, val + i, buf, sizeof(buf)); - if (i != 0) { - printf(","); - } - printf("%s", buf); - } -} - -static void print_opt_u8_list(const unsigned char *val, size_t val_len) -{ - size_t i; - - for (i = 0; i < val_len; i++) { - if (i != 0) { - printf(","); - } - printf("%u", (unsigned int)val[i]); - } -} - -static void print_opt_u16_list(const unsigned char *val, size_t val_len) -{ - size_t i; - if (val_len < 2 || val_len % 2 != 0) { - printf("INVALID!"); - return; - } - for (i = 0; i < val_len; i += 2) { - unsigned short u16 = 0; - unsigned short c; - /* Jumping over backwards to try to avoid odd compiler warnings */ - c = (unsigned short)val[i]; - u16 |= (unsigned short)((c << 8) & 0xFFFF); - c = (unsigned short)val[i + 1]; - u16 |= c; - if (i != 0) { - printf(","); - } - printf("%u", (unsigned int)u16); - } -} - -static void print_opt_u32_list(const unsigned char *val, size_t val_len) -{ - size_t i; - if (val_len < 4 || val_len % 4 != 0) { - printf("INVALID!"); - return; - } - for (i = 0; i < val_len; i += 4) { - unsigned int u32 = 0; - - u32 |= (unsigned int)(val[i] << 24); - u32 |= (unsigned int)(val[i + 1] << 16); - u32 |= (unsigned int)(val[i + 2] << 8); - u32 |= (unsigned int)(val[i + 3]); - if (i != 0) { - printf(","); - } - printf("%u", u32); - } -} - -static void print_opt_str_list(const unsigned char *val, size_t val_len) -{ - size_t cnt = 0; - - printf("\""); - while (val_len) { - long read_len = 0; - unsigned char *str = NULL; - ares_status_t status; - - if (cnt) { - printf(","); - } - - status = (ares_status_t)ares_expand_string(val, val, (int)val_len, &str, - &read_len); - if (status != ARES_SUCCESS) { - printf("INVALID"); - break; - } - printf("%s", str); - ares_free_string(str); - val_len -= (size_t)read_len; - val += read_len; - cnt++; - } - printf("\""); -} - -static void print_opt_name(const unsigned char *val, size_t val_len) -{ - char *str = NULL; - long read_len = 0; - - if (ares_expand_name(val, val, (int)val_len, &str, &read_len) != - ARES_SUCCESS) { - printf("INVALID!"); - return; - } - - printf("%s.", str); - ares_free_string(str); -} - -static void print_opt_bin(const unsigned char *val, size_t val_len) -{ - size_t i; - - for (i = 0; i < val_len; i++) { - printf("%02x", (unsigned int)val[i]); - } -} - -static ares_bool_t adig_isprint(int ch) -{ - if (ch >= 0x20 && ch <= 0x7E) { - return ARES_TRUE; - } - return ARES_FALSE; -} - -static void print_opt_binp(const unsigned char *val, size_t val_len) -{ - size_t i; - printf("\""); - for (i = 0; i < val_len; i++) { - if (adig_isprint(val[i])) { - printf("%c", val[i]); - } else { - printf("\\%03d", val[i]); - } - } - printf("\""); -} - -static void print_opts(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - size_t i; - - for (i = 0; i < ares_dns_rr_get_opt_cnt(rr, key); i++) { - size_t val_len = 0; - const unsigned char *val = NULL; - unsigned short opt; - const char *name; - - if (i != 0) { - printf(" "); - } - - opt = ares_dns_rr_get_opt(rr, key, i, &val, &val_len); - name = ares_dns_opt_get_name(key, opt); - if (name == NULL) { - printf("key%u", (unsigned int)opt); - } else { - printf("%s", name); - } - if (val_len == 0) { - return; - } - - printf("="); - - switch (ares_dns_opt_get_datatype(key, opt)) { - case ARES_OPT_DATATYPE_NONE: - print_opt_none(val, val_len); - break; - case ARES_OPT_DATATYPE_U8_LIST: - print_opt_u8_list(val, val_len); - break; - case ARES_OPT_DATATYPE_INADDR4_LIST: - print_opt_addr_list(val, val_len); - break; - case ARES_OPT_DATATYPE_INADDR6_LIST: - print_opt_addr6_list(val, val_len); - break; - case ARES_OPT_DATATYPE_U16: - case ARES_OPT_DATATYPE_U16_LIST: - print_opt_u16_list(val, val_len); - break; - case ARES_OPT_DATATYPE_U32: - case ARES_OPT_DATATYPE_U32_LIST: - print_opt_u32_list(val, val_len); - break; - case ARES_OPT_DATATYPE_STR_LIST: - print_opt_str_list(val, val_len); - break; - case ARES_OPT_DATATYPE_BIN: - print_opt_bin(val, val_len); - break; - case ARES_OPT_DATATYPE_NAME: - print_opt_name(val, val_len); - break; - } - } -} - -static void print_addr(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - const struct in_addr *addr = ares_dns_rr_get_addr(rr, key); - char buf[256] = ""; - - ares_inet_ntop(AF_INET, addr, buf, sizeof(buf)); - printf("%s", buf); -} - -static void print_addr6(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - const struct ares_in6_addr *addr = ares_dns_rr_get_addr6(rr, key); - char buf[256] = ""; - - ares_inet_ntop(AF_INET6, addr, buf, sizeof(buf)); - printf("%s", buf); -} - -static void print_u8(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - unsigned char u8 = ares_dns_rr_get_u8(rr, key); - printf("%u", (unsigned int)u8); -} - -static void print_u16(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - unsigned short u16 = ares_dns_rr_get_u16(rr, key); - printf("%u", (unsigned int)u16); -} - -static void print_u32(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - unsigned int u32 = ares_dns_rr_get_u32(rr, key); - printf("%u", u32); -} - -static void print_name(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - const char *str = ares_dns_rr_get_str(rr, key); - printf("%s.", str); -} - -static void print_str(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - const char *str = ares_dns_rr_get_str(rr, key); - printf("\"%s\"", str); -} - -static void print_bin(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - size_t len = 0; - const unsigned char *binp = ares_dns_rr_get_bin(rr, key, &len); - print_opt_bin(binp, len); -} - -static void print_binp(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - size_t len; - const unsigned char *binp = ares_dns_rr_get_bin(rr, key, &len); - - print_opt_binp(binp, len); -} - -static void print_abinp(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) -{ - size_t i; - size_t cnt = ares_dns_rr_get_abin_cnt(rr, key); - - for (i = 0; i < cnt; i++) { - size_t len; - const unsigned char *binp = ares_dns_rr_get_abin(rr, key, i, &len); - if (i != 0) { - printf(" "); - } - print_opt_binp(binp, len); - } -} - -static void print_rr(const ares_dns_rr_t *rr) -{ - const char *name = ares_dns_rr_get_name(rr); - size_t len = 0; - size_t keys_cnt = 0; - ares_dns_rec_type_t rtype = ares_dns_rr_get_type(rr); - const ares_dns_rr_key_t *keys = ares_dns_rr_get_keys(rtype, &keys_cnt); - size_t i; - - if (name == NULL) { - return; - } - - len = strlen(name); - - printf("%s.\t", name); - if (len < 24) { - printf("\t"); - } - - printf("%u\t%s\t%s\t", ares_dns_rr_get_ttl(rr), - ares_dns_class_tostr(ares_dns_rr_get_class(rr)), - ares_dns_rec_type_tostr(rtype)); - - /* Output params here */ - for (i = 0; i < keys_cnt; i++) { - ares_dns_datatype_t datatype = ares_dns_rr_key_datatype(keys[i]); - if (i != 0) { - printf(" "); - } - - switch (datatype) { - case ARES_DATATYPE_INADDR: - print_addr(rr, keys[i]); - break; - case ARES_DATATYPE_INADDR6: - print_addr6(rr, keys[i]); - break; - case ARES_DATATYPE_U8: - print_u8(rr, keys[i]); - break; - case ARES_DATATYPE_U16: - print_u16(rr, keys[i]); - break; - case ARES_DATATYPE_U32: - print_u32(rr, keys[i]); - break; - case ARES_DATATYPE_NAME: - print_name(rr, keys[i]); - break; - case ARES_DATATYPE_STR: - print_str(rr, keys[i]); - break; - case ARES_DATATYPE_BIN: - print_bin(rr, keys[i]); - break; - case ARES_DATATYPE_BINP: - print_binp(rr, keys[i]); - break; - case ARES_DATATYPE_ABINP: - print_abinp(rr, keys[i]); - break; - case ARES_DATATYPE_OPT: - print_opts(rr, keys[i]); - break; - } - } - - printf("\n"); -} - -static const ares_dns_rr_t *has_opt(ares_dns_record_t *dnsrec, - ares_dns_section_t section) -{ - size_t i; - for (i = 0; i < ares_dns_record_rr_cnt(dnsrec, section); i++) { - const ares_dns_rr_t *rr = ares_dns_record_rr_get(dnsrec, section, i); - if (ares_dns_rr_get_type(rr) == ARES_REC_TYPE_OPT) { - return rr; - } - } - return NULL; -} - -static void print_section(ares_dns_record_t *dnsrec, ares_dns_section_t section) -{ - size_t i; - - if (ares_dns_record_rr_cnt(dnsrec, section) == 0 || - (ares_dns_record_rr_cnt(dnsrec, section) == 1 && - has_opt(dnsrec, section) != NULL)) { - return; - } - - printf(";; %s SECTION:\n", ares_dns_section_tostr(section)); - for (i = 0; i < ares_dns_record_rr_cnt(dnsrec, section); i++) { - const ares_dns_rr_t *rr = ares_dns_record_rr_get(dnsrec, section, i); - if (ares_dns_rr_get_type(rr) == ARES_REC_TYPE_OPT) { - continue; - } - print_rr(rr); - } - printf("\n"); -} - -static void print_opt_psuedosection(ares_dns_record_t *dnsrec) -{ - const ares_dns_rr_t *rr = has_opt(dnsrec, ARES_SECTION_ADDITIONAL); - const unsigned char *cookie = NULL; - size_t cookie_len = 0; - - if (rr == NULL) { - return; - } - - if (!ares_dns_rr_get_opt_byid(rr, ARES_RR_OPT_OPTIONS, ARES_OPT_PARAM_COOKIE, - &cookie, &cookie_len)) { - cookie = NULL; - } - - - printf(";; OPT PSEUDOSECTION:\n"); - printf("; EDNS: version: %u, flags: %u; udp: %u\n", - (unsigned int)ares_dns_rr_get_u8(rr, ARES_RR_OPT_VERSION), - (unsigned int)ares_dns_rr_get_u16(rr, ARES_RR_OPT_FLAGS), - (unsigned int)ares_dns_rr_get_u16(rr, ARES_RR_OPT_UDP_SIZE)); - - if (cookie) { - printf("; COOKIE: "); - print_opt_bin(cookie, cookie_len); - printf(" (good)\n"); - } -} - -static void callback(void *arg, int status, int timeouts, unsigned char *abuf, - int alen) -{ - ares_dns_record_t *dnsrec = NULL; - (void)arg; - (void)timeouts; - - /* We got a "Server status" */ - if (status >= ARES_SUCCESS && status <= ARES_EREFUSED) { - printf(";; Got answer:"); - } else { - printf(";;"); - } - - if (status != ARES_SUCCESS) { - printf(" %s", ares_strerror(status)); - } - printf("\n"); - - if (abuf == NULL || alen == 0) { - return; - } - - status = (int)ares_dns_parse(abuf, (size_t)alen, 0, &dnsrec); - if (status != ARES_SUCCESS) { - fprintf(stderr, ";; FAILED TO PARSE DNS PACKET: %s\n", - ares_strerror(status)); - return; - } - - print_header(dnsrec); - print_opt_psuedosection(dnsrec); - print_question(dnsrec); - print_section(dnsrec, ARES_SECTION_ANSWER); - print_section(dnsrec, ARES_SECTION_ADDITIONAL); - print_section(dnsrec, ARES_SECTION_AUTHORITY); - - printf(";; MSG SIZE rcvd: %d\n\n", alen); - ares_dns_record_destroy(dnsrec); -} - -static ares_status_t enqueue_query(ares_channel_t *channel, - const adig_config_t *config, - const char *name) -{ - ares_dns_record_t *dnsrec = NULL; - ares_dns_rr_t *rr = NULL; - ares_status_t status; - unsigned char *buf = NULL; - size_t buf_len = 0; - unsigned short flags = 0; - char *nametemp = NULL; - - if (!(config->options.flags & ARES_FLAG_NORECURSE)) { - flags |= ARES_FLAG_RD; - } - - status = ares_dns_record_create(&dnsrec, 0, flags, ARES_OPCODE_QUERY, - ARES_RCODE_NOERROR); - if (status != ARES_SUCCESS) { - goto done; - } - - /* If it is a PTR record, convert from ip address into in-arpa form - * automatically */ - if (config->qtype == ARES_REC_TYPE_PTR) { - struct ares_addr addr; - size_t len; - addr.family = AF_UNSPEC; - - if (ares_dns_pton(name, &addr, &len) != NULL) { - nametemp = ares_dns_addr_to_ptr(&addr); - name = nametemp; - } - } - - status = - ares_dns_record_query_add(dnsrec, name, config->qtype, config->qclass); - if (status != ARES_SUCCESS) { - goto done; - } - - status = ares_dns_record_rr_add(&rr, dnsrec, ARES_SECTION_ADDITIONAL, "", - ARES_REC_TYPE_OPT, ARES_CLASS_IN, 0); - if (status != ARES_SUCCESS) { - goto done; - } - ares_dns_rr_set_u16(rr, ARES_RR_OPT_UDP_SIZE, 1280); - ares_dns_rr_set_u8(rr, ARES_RR_OPT_VERSION, 0); - - status = ares_dns_write(dnsrec, &buf, &buf_len); - if (status != ARES_SUCCESS) { - goto done; - } - - ares_send(channel, buf, (int)buf_len, callback, NULL); - ares_free_string(buf); - -done: - ares_free_string(nametemp); - ares_dns_record_destroy(dnsrec); - return status; -} - -static int event_loop(ares_channel_t *channel) -{ - while (1) { - fd_set read_fds; - fd_set write_fds; - int nfds; - struct timeval tv; - struct timeval *tvp; - int count; - - FD_ZERO(&read_fds); - FD_ZERO(&write_fds); - memset(&tv, 0, sizeof(tv)); - - nfds = ares_fds(channel, &read_fds, &write_fds); - if (nfds == 0) { - break; - } - tvp = ares_timeout(channel, NULL, &tv); - if (tvp == NULL) { - break; - } - count = select(nfds, &read_fds, &write_fds, NULL, tvp); - if (count < 0) { -#ifdef USE_WINSOCK - int err = WSAGetLastError(); -#else - int err = errno; -#endif - if (err != EAGAIN && err != EINTR) { - fprintf(stderr, "select fail: %d", err); - return 1; - } - } - ares_process(channel, &read_fds, &write_fds); - } - return 0; -} - -int main(int argc, char **argv) -{ - ares_channel_t *channel = NULL; - ares_status_t status; - adig_config_t config; - int i; - int rv = 0; - -#ifdef USE_WINSOCK - WORD wVersionRequested = MAKEWORD(USE_WINSOCK, USE_WINSOCK); - WSADATA wsaData; - WSAStartup(wVersionRequested, &wsaData); -#endif - - status = (ares_status_t)ares_library_init(ARES_LIB_INIT_ALL); - if (status != ARES_SUCCESS) { - fprintf(stderr, "ares_library_init: %s\n", ares_strerror((int)status)); - return 1; - } - - memset(&config, 0, sizeof(config)); - config.qclass = ARES_CLASS_IN; - config.qtype = ARES_REC_TYPE_A; - if (!read_cmdline(argc, (const char * const *)argv, &config)) { - printf("\n** ERROR: %s\n\n", config.error); - print_help(); - rv = 1; - goto done; - } - - if (config.is_help) { - print_help(); - goto done; - } - - status = - (ares_status_t)ares_init_options(&channel, &config.options, config.optmask); - if (status != ARES_SUCCESS) { - fprintf(stderr, "ares_init_options: %s\n", ares_strerror((int)status)); - rv = 1; - goto done; - } - - if (config.servers) { - status = (ares_status_t)ares_set_servers_ports_csv(channel, config.servers); - if (status != ARES_SUCCESS) { - fprintf(stderr, "ares_set_servers_ports_csv: %s\n", - ares_strerror((int)status)); - rv = 1; - goto done; - } - } - - /* Enqueue a query for each separate name */ - for (i = config.args_processed; i < argc; i++) { - status = enqueue_query(channel, &config, argv[i]); - if (status != ARES_SUCCESS) { - fprintf(stderr, "Failed to create query for %s: %s\n", argv[i], - ares_strerror((int)status)); - rv = 1; - goto done; - } - } - - /* Debug */ - printf("\n; <<>> c-ares DiG %s <<>>", ares_version(NULL)); - for (i = config.args_processed; i < argc; i++) { - printf(" %s", argv[i]); - } - printf("\n"); - - /* Process events */ - rv = event_loop(channel); - -done: - free_config(&config); - ares_destroy(channel); - ares_library_cleanup(); - -#ifdef USE_WINSOCK - WSACleanup(); -#endif - return rv; -} diff --git a/lib/c-ares-1.33.1/test/ares-test-fuzz.c b/lib/c-ares-1.33.1/test/ares-test-fuzz.c deleted file mode 100644 index 8746405b9fd..00000000000 --- a/lib/c-ares-1.33.1/test/ares-test-fuzz.c +++ /dev/null @@ -1,108 +0,0 @@ -/* MIT License - * - * 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 -#include -#include "ares.h" - -int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size); - -/* Entrypoint for Clang's libfuzzer */ -int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) -{ - /* Feed the data into each of the ares_parse_*_reply functions. */ - struct hostent *host = NULL; - struct ares_addrttl info[5]; - struct ares_addr6ttl info6[5]; - unsigned char addrv4[4] = { 0x10, 0x20, 0x30, 0x40 }; - struct ares_srv_reply *srv = NULL; - struct ares_mx_reply *mx = NULL; - struct ares_txt_reply *txt = NULL; - struct ares_soa_reply *soa = NULL; - struct ares_naptr_reply *naptr = NULL; - struct ares_caa_reply *caa = NULL; - struct ares_uri_reply *uri = NULL; - int count = 5; - ares_parse_a_reply(data, (int)size, &host, info, &count); - if (host) { - ares_free_hostent(host); - } - - host = NULL; - count = 5; - ares_parse_aaaa_reply(data, (int)size, &host, info6, &count); - if (host) { - ares_free_hostent(host); - } - - host = NULL; - ares_parse_ptr_reply(data, (int)size, addrv4, sizeof(addrv4), AF_INET, &host); - if (host) { - ares_free_hostent(host); - } - - host = NULL; - ares_parse_ns_reply(data, (int)size, &host); - if (host) { - ares_free_hostent(host); - } - - ares_parse_srv_reply(data, (int)size, &srv); - if (srv) { - ares_free_data(srv); - } - - ares_parse_mx_reply(data, (int)size, &mx); - if (mx) { - ares_free_data(mx); - } - - ares_parse_txt_reply(data, (int)size, &txt); - if (txt) { - ares_free_data(txt); - } - - ares_parse_soa_reply(data, (int)size, &soa); - if (soa) { - ares_free_data(soa); - } - - ares_parse_naptr_reply(data, (int)size, &naptr); - if (naptr) { - ares_free_data(naptr); - } - - ares_parse_caa_reply(data, (int)size, &caa); - if (caa) { - ares_free_data(caa); - } - - ares_parse_uri_reply(data, (int)size, &uri); - if (uri) { - ares_free_data(uri); - } - - return 0; -} diff --git a/lib/c-ares-1.33.1/AUTHORS b/lib/c-ares-1.34.4/AUTHORS similarity index 100% rename from lib/c-ares-1.33.1/AUTHORS rename to lib/c-ares-1.34.4/AUTHORS diff --git a/lib/c-ares-1.33.1/CMakeLists.txt b/lib/c-ares-1.34.4/CMakeLists.txt similarity index 97% rename from lib/c-ares-1.33.1/CMakeLists.txt rename to lib/c-ares-1.34.4/CMakeLists.txt index 9862406495f..139defd8ffd 100644 --- a/lib/c-ares-1.33.1/CMakeLists.txt +++ b/lib/c-ares-1.34.4/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT -CMAKE_MINIMUM_REQUIRED (VERSION 3.5.0) +CMAKE_MINIMUM_REQUIRED (VERSION 3.5.0...3.10.0) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") @@ -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.4" ) # 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:3:19") OPTION (CARES_STATIC "Build as a static library" OFF) @@ -263,7 +263,7 @@ ENDIF () # Set system-specific compiler flags IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin") LIST (APPEND SYSFLAGS -D_DARWIN_C_SOURCE) -ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Linux") +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android") LIST (APPEND SYSFLAGS -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700) ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "SunOS") LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=600) @@ -271,6 +271,8 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX") LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=700 -D_USE_IRS) ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") # Don't define _XOPEN_SOURCE on FreeBSD, it actually reduces visibility instead of increasing it +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "QNX") + LIST (APPEND SYSFLAGS -D_QNX_SOURCE) ELSEIF (WIN32) LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602) ENDIF () @@ -406,7 +408,8 @@ 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 (strnlen "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNLEN) +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 +446,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 +504,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 +695,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 +761,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 +784,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") diff --git a/lib/c-ares-1.33.1/CONTRIBUTING.md b/lib/c-ares-1.34.4/CONTRIBUTING.md similarity index 100% rename from lib/c-ares-1.33.1/CONTRIBUTING.md rename to lib/c-ares-1.34.4/CONTRIBUTING.md diff --git a/lib/c-ares-1.33.1/DEVELOPER-NOTES.md b/lib/c-ares-1.34.4/DEVELOPER-NOTES.md similarity index 100% rename from lib/c-ares-1.33.1/DEVELOPER-NOTES.md rename to lib/c-ares-1.34.4/DEVELOPER-NOTES.md diff --git a/lib/c-ares-1.33.1/INSTALL.md b/lib/c-ares-1.34.4/INSTALL.md similarity index 100% rename from lib/c-ares-1.33.1/INSTALL.md rename to lib/c-ares-1.34.4/INSTALL.md diff --git a/lib/c-ares-1.33.1/LICENSE.md b/lib/c-ares-1.34.4/LICENSE.md similarity index 100% rename from lib/c-ares-1.33.1/LICENSE.md rename to lib/c-ares-1.34.4/LICENSE.md diff --git a/lib/c-ares-1.33.1/Makefile.Watcom b/lib/c-ares-1.34.4/Makefile.Watcom similarity index 98% rename from lib/c-ares-1.33.1/Makefile.Watcom rename to lib/c-ares-1.34.4/Makefile.Watcom index 96ffedb1eb3..1e445f287a5 100644 --- a/lib/c-ares-1.33.1/Makefile.Watcom +++ b/lib/c-ares-1.34.4/Makefile.Watcom @@ -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 diff --git a/lib/c-ares-1.33.1/Makefile.am b/lib/c-ares-1.34.4/Makefile.am similarity index 56% rename from lib/c-ares-1.33.1/Makefile.am rename to lib/c-ares-1.34.4/Makefile.am index e99161a45f7..51b5f6be32b 100644 --- a/lib/c-ares-1.33.1/Makefile.am +++ b/lib/c-ares-1.34.4/Makefile.am @@ -3,17 +3,24 @@ # Copyright (C) the Massachusetts Institute of Technology. # Copyright (C) Daniel Stenberg # -# Permission to use, copy, modify, and distribute this -# software and its documentation for any purpose and without -# fee is hereby granted, provided that the above copyright -# notice appear in all copies and that both that copyright -# notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in -# advertising or publicity pertaining to distribution of the -# software without specific, written prior permission. -# M.I.T. makes no representations about the suitability of -# this software for any purpose. It is provided "as is" -# without express or implied warranty. +# 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 # diff --git a/lib/c-ares-1.33.1/Makefile.dj b/lib/c-ares-1.34.4/Makefile.dj similarity index 98% rename from lib/c-ares-1.33.1/Makefile.dj rename to lib/c-ares-1.34.4/Makefile.dj index 69b3ca31851..8dca20cb42b 100644 --- a/lib/c-ares-1.33.1/Makefile.dj +++ b/lib/c-ares-1.34.4/Makefile.dj @@ -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 \ diff --git a/lib/c-ares-1.33.1/Makefile.in b/lib/c-ares-1.34.4/Makefile.in similarity index 93% rename from lib/c-ares-1.33.1/Makefile.in rename to lib/c-ares-1.34.4/Makefile.in index 706dafdbdfc..2342125d136 100644 --- a/lib/c-ares-1.33.1/Makefile.in +++ b/lib/c-ares-1.34.4/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2024 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -19,17 +19,24 @@ # Copyright (C) the Massachusetts Institute of Technology. # Copyright (C) Daniel Stenberg # -# Permission to use, copy, modify, and distribute this -# software and its documentation for any purpose and without -# fee is hereby granted, provided that the above copyright -# notice appear in all copies and that both that copyright -# notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in -# advertising or publicity pertaining to distribution of the -# software without specific, written prior permission. -# M.I.T. makes no representations about the suitability of -# this software for any purpose. It is provided "as is" -# without express or implied warranty. +# 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 # @@ -91,8 +98,6 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -am__rm_f = rm -f $(am__rm_f_notfound) -am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -113,7 +118,9 @@ build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ + $(top_srcdir)/m4/ares_check_uts_namespace.m4 \ + $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ @@ -123,8 +130,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_user_namespace.m4 \ - $(top_srcdir)/m4/ax_check_uts_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ @@ -196,9 +201,10 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ - { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) @@ -239,8 +245,8 @@ distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \ - ; rm -rf "$(distdir)" \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) @@ -270,16 +276,14 @@ am__relativize = \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = -9 +GZIP_ENV = --best DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = \ - find . \( -type f -a \! \ - \( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print +distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ @@ -325,7 +329,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ @@ -392,10 +395,8 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ -am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ @@ -641,7 +642,7 @@ distdir: $(BUILT_SOURCES) distdir-am: $(DISTFILES) $(am__remove_distdir) - $(AM_V_at)$(MKDIR_P) "$(distdir)" + test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -755,7 +756,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -765,7 +766,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - eval GZIP= gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ @@ -866,12 +867,12 @@ install-strip: mostlyclean-generic: clean-generic: - -$(am__rm_f) $(CLEANFILES) + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -$(am__rm_f) $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) - -$(am__rm_f) $(DISTCLEANFILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -980,10 +981,3 @@ dist-hook: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - -# Tell GNU make to disable its built-in pattern rules. -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% diff --git a/lib/c-ares-1.33.1/Makefile.m32 b/lib/c-ares-1.34.4/Makefile.m32 similarity index 98% rename from lib/c-ares-1.33.1/Makefile.m32 rename to lib/c-ares-1.34.4/Makefile.m32 index 36ae674c635..7bd85165978 100644 --- a/lib/c-ares-1.33.1/Makefile.m32 +++ b/lib/c-ares-1.34.4/Makefile.m32 @@ -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 diff --git a/lib/c-ares-1.33.1/Makefile.msvc b/lib/c-ares-1.34.4/Makefile.msvc similarity index 92% rename from lib/c-ares-1.33.1/Makefile.msvc rename to lib/c-ares-1.34.4/Makefile.msvc index 619c2d39274..3266db415e0 100644 --- a/lib/c-ares-1.33.1/Makefile.msvc +++ b/lib/c-ares-1.34.4/Makefile.msvc @@ -1,17 +1,24 @@ # Copyright (C) 2009-2013 by Daniel Stenberg # -# Permission to use, copy, modify, and distribute this -# software and its documentation for any purpose and without -# fee is hereby granted, provided that the above copyright -# notice appear in all copies and that both that copyright -# notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in -# advertising or publicity pertaining to distribution of the -# software without specific, written prior permission. -# M.I.T. makes no representations about the suitability of -# this software for any purpose. It is provided "as is" -# without express or implied warranty. +# 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 @@ -192,7 +199,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 +351,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, # diff --git a/lib/c-ares-1.33.1/Makefile.netware b/lib/c-ares-1.34.4/Makefile.netware similarity index 100% rename from lib/c-ares-1.33.1/Makefile.netware rename to lib/c-ares-1.34.4/Makefile.netware diff --git a/lib/c-ares-1.33.1/README.md b/lib/c-ares-1.34.4/README.md similarity index 95% rename from lib/c-ares-1.33.1/README.md rename to lib/c-ares-1.34.4/README.md index c32d0677c83..6566c9fe6aa 100644 --- a/lib/c-ares-1.33.1/README.md +++ b/lib/c-ares-1.34.4/README.md @@ -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. diff --git a/lib/c-ares-1.33.1/README.msvc b/lib/c-ares-1.34.4/README.msvc similarity index 100% rename from lib/c-ares-1.33.1/README.msvc rename to lib/c-ares-1.34.4/README.msvc diff --git a/lib/c-ares-1.34.4/RELEASE-NOTES.md b/lib/c-ares-1.34.4/RELEASE-NOTES.md new file mode 100644 index 00000000000..19a204b3ea9 --- /dev/null +++ b/lib/c-ares-1.34.4/RELEASE-NOTES.md @@ -0,0 +1,25 @@ +## c-ares version 1.34.4 - December 14 2024 + +This is a bugfix release. + +Changes: +* QNX Port: Port to QNX 8, add primary config reading support, add CI build. [PR #934](https://github.com/c-ares/c-ares/pull/934), [PR #937](https://github.com/c-ares/c-ares/pull/937), [PR #938](https://github.com/c-ares/c-ares/pull/938) + +Bugfixes: +* Empty TXT records were not being preserved. [PR #922](https://github.com/c-ares/c-ares/pull/922) +* docs: update deprecation notices for `ares_create_query()` and `ares_mkquery()`. [PR #910](https://github.com/c-ares/c-ares/pull/910) +* license: some files weren't properly updated. [PR #920](https://github.com/c-ares/c-ares/pull/920) +* Fix bind local device regression from 1.34.0. [PR #929](https://github.com/c-ares/c-ares/pull/929), [PR #931](https://github.com/c-ares/c-ares/pull/931), [PR #935](https://github.com/c-ares/c-ares/pull/935) +* CMake: set policy version to prevent deprecation warnings. [PR #932](https://github.com/c-ares/c-ares/pull/932) +* CMake: shared and static library names should be the same on unix platforms like autotools uses. [PR #933](https://github.com/c-ares/c-ares/pull/933) +* Update to latest autoconf archive macros for enhanced system compatibility. [PR #936](https://github.com/c-ares/c-ares/pull/936) + +Thanks go to these friendly people for their efforts and contributions for this +release: + +* Brad House (@bradh352) +* Daniel Stenberg (@bagder) +* Gregor Jasny (@gjasny) +* @marcovsz +* Nikolaos Chatzikonstantinou (@createyourpersonalaccount) +* @vlasovsoft1979 diff --git a/lib/c-ares-1.33.1/SECURITY.md b/lib/c-ares-1.34.4/SECURITY.md similarity index 100% rename from lib/c-ares-1.33.1/SECURITY.md rename to lib/c-ares-1.34.4/SECURITY.md diff --git a/lib/c-ares-1.33.1/aclocal.m4 b/lib/c-ares-1.34.4/aclocal.m4 similarity index 78% rename from lib/c-ares-1.33.1/aclocal.m4 rename to lib/c-ares-1.34.4/aclocal.m4 index 68e283c8e59..04f8786c9c0 100644 --- a/lib/c-ares-1.33.1/aclocal.m4 +++ b/lib/c-ares-1.34.4/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.17 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],, -[m4_warning([this file was generated for autoconf 2.72. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2024 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.17' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.17], [], +m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.17])dnl +[AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_COND_IF -*- Autoconf -*- -# Copyright (C) 2008-2024 Free Software Foundation, Inc. +# Copyright (C) 2008-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -147,7 +147,7 @@ fi[]dnl # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2024 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -178,7 +178,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2024 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -310,7 +310,7 @@ AC_CACHE_CHECK([dependency style of $depcc], # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thus: + # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported @@ -369,7 +369,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2024 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -437,7 +437,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -571,7 +571,7 @@ if test -z "$CSCOPE"; then fi AC_SUBST([CSCOPE]) -AC_REQUIRE([_AM_SILENT_RULES])dnl +AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. @@ -579,9 +579,47 @@ AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -AC_REQUIRE([_AM_PROG_RM_F]) -AC_REQUIRE([_AM_PROG_XARGS_N]) +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. @@ -614,7 +652,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -635,7 +673,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2024 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -657,7 +695,7 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -692,7 +730,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -735,7 +773,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2024 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -769,7 +807,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -798,7 +836,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2024 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -845,23 +883,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2022-2024 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_RM_F -# --------------- -# Check whether 'rm -f' without any arguments works. -# https://bugs.gnu.org/10828 -AC_DEFUN([_AM_PROG_RM_F], -[am__rm_f_notfound= -AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""']) -AC_SUBST(am__rm_f_notfound) -]) - -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -880,169 +902,16 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# _AM_SLEEP_FRACTIONAL_SECONDS -# ---------------------------- -AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl -AC_CACHE_CHECK([whether sleep supports fractional seconds], - am_cv_sleep_fractional_seconds, [dnl -AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes], - [am_cv_sleep_fractional_seconds=no]) -])]) - -# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION -# ----------------------------------- -# Determine the filesystem's resolution for file modification -# timestamps. The coarsest we know of is FAT, with a resolution -# of only two seconds, even with the most recent "exFAT" extensions. -# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one -# nanosecond, matching clock_gettime. However, it is probably not -# possible to delay execution of a shell script for less than one -# millisecond, due to process creation overhead and scheduling -# granularity, so we don't check for anything finer than that. (See below.) -AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl -AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) -AC_CACHE_CHECK([filesystem timestamp resolution], - am_cv_filesystem_timestamp_resolution, [dnl -# Default to the worst case. -am_cv_filesystem_timestamp_resolution=2 - -# Only try to go finer than 1 sec if sleep can do it. -# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, -# - 1 sec is not much of a win compared to 2 sec, and -# - it takes 2 seconds to perform the test whether 1 sec works. -# -# Instead, just use the default 2s on platforms that have 1s resolution, -# accept the extra 1s delay when using $sleep in the Automake tests, in -# exchange for not incurring the 2s delay for running the test for all -# packages. -# -am_try_resolutions= -if test "$am_cv_sleep_fractional_seconds" = yes; then - # Even a millisecond often causes a bunch of false positives, - # so just try a hundredth of a second. The time saved between .001 and - # .01 is not terribly consequential. - am_try_resolutions="0.01 0.1 $am_try_resolutions" -fi - -# In order to catch current-generation FAT out, we must *modify* files -# that already exist; the *creation* timestamp is finer. Use names -# that make ls -t sort them differently when they have equal -# timestamps than when they have distinct timestamps, keeping -# in mind that ls -t prints the *newest* file first. -rm -f conftest.ts? -: > conftest.ts1 -: > conftest.ts2 -: > conftest.ts3 - -# Make sure ls -t actually works. Do 'set' in a subshell so we don't -# clobber the current shell's arguments. (Outer-level square brackets -# are removed by m4; they're present so that m4 does not expand -# ; be careful, easy to get confused.) -if ( - set X `[ls -t conftest.ts[12]]` && - { - test "$[]*" != "X conftest.ts1 conftest.ts2" || - test "$[]*" != "X conftest.ts2 conftest.ts1"; - } -); then :; else - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - _AS_ECHO_UNQUOTED( - ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""], - [AS_MESSAGE_LOG_FD]) - AC_MSG_FAILURE([ls -t produces unexpected output. -Make sure there is not a broken ls alias in your environment.]) -fi - -for am_try_res in $am_try_resolutions; do - # Any one fine-grained sleep might happen to cross the boundary - # between two values of a coarser actual resolution, but if we do - # two fine-grained sleeps in a row, at least one of them will fall - # entirely within a coarse interval. - echo alpha > conftest.ts1 - sleep $am_try_res - echo beta > conftest.ts2 - sleep $am_try_res - echo gamma > conftest.ts3 - - # We assume that 'ls -t' will make use of high-resolution - # timestamps if the operating system supports them at all. - if (set X `ls -t conftest.ts?` && - test "$[]2" = conftest.ts3 && - test "$[]3" = conftest.ts2 && - test "$[]4" = conftest.ts1); then - # - # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, - # because we don't need to test make. - make_ok=true - if test $am_try_res != 1; then - # But if we've succeeded so far with a subsecond resolution, we - # have one more thing to check: make. It can happen that - # everything else supports the subsecond mtimes, but make doesn't; - # notably on macOS, which ships make 3.81 from 2006 (the last one - # released under GPLv2). https://bugs.gnu.org/68808 - # - # We test $MAKE if it is defined in the environment, else "make". - # It might get overridden later, but our hope is that in practice - # it does not matter: it is the system "make" which is (by far) - # the most likely to be broken, whereas if the user overrides it, - # probably they did so with a better, or at least not worse, make. - # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html - # - # Create a Makefile (real tab character here): - rm -f conftest.mk - echo 'conftest.ts1: conftest.ts2' >conftest.mk - echo ' touch conftest.ts2' >>conftest.mk - # - # Now, running - # touch conftest.ts1; touch conftest.ts2; make - # should touch ts1 because ts2 is newer. This could happen by luck, - # but most often, it will fail if make's support is insufficient. So - # test for several consecutive successes. - # - # (We reuse conftest.ts[12] because we still want to modify existing - # files, not create new ones, per above.) - n=0 - make=${MAKE-make} - until test $n -eq 3; do - echo one > conftest.ts1 - sleep $am_try_res - echo two > conftest.ts2 # ts2 should now be newer than ts1 - if $make -f conftest.mk | grep 'up to date' >/dev/null; then - make_ok=false - break # out of $n loop - fi - n=`expr $n + 1` - done - fi - # - if $make_ok; then - # Everything we know to check worked out, so call this resolution good. - am_cv_filesystem_timestamp_resolution=$am_try_res - break # out of $am_try_res loop - fi - # Otherwise, we'll go on to check the next resolution. - fi -done -rm -f conftest.ts? -# (end _am_filesystem_timestamp_resolution) -])]) - # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], -[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) -# This check should not be cached, as it may vary across builds of -# different projects. -AC_MSG_CHECKING([whether build environment is sane]) +[AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -1061,40 +930,49 @@ esac # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). -am_build_env_is_sane=no -am_has_slept=no -rm -f conftest.file -for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[]*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - test "$[]2" = conftest.file - ); then - am_build_env_is_sane=yes - break - fi - # Just in case. - sleep "$am_cv_filesystem_timestamp_resolution" - am_has_slept=yes -done - -AC_MSG_RESULT([$am_build_env_is_sane]) -if test "$am_build_env_is_sane" = no; then - AC_MSG_ERROR([newly created file is older than distributed files! +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi - +AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= -AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl - ( sleep "$am_cv_filesystem_timestamp_resolution" ) & +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & am_sleep_pid=$! -]) +fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then @@ -1105,18 +983,18 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2024 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# _AM_SILENT_RULES -# ---------------- -# Enable less verbose build rules support. -AC_DEFUN([_AM_SILENT_RULES], -[AM_DEFAULT_VERBOSITY=1 -AC_ARG_ENABLE([silent-rules], [dnl +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) @@ -1124,6 +1002,11 @@ AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. @@ -1142,21 +1025,6 @@ am__doit: else am_cv_make_support_nested_variables=no fi]) -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls -dnl to AM_SILENT_RULES to change the default value. -AC_CONFIG_COMMANDS_PRE([dnl -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; -esac if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' @@ -1165,18 +1033,17 @@ else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi -])dnl +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or -# empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_REQUIRE([_AM_SILENT_RULES]) -AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])]) - -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1204,7 +1071,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2024 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1223,7 +1090,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2024 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1269,19 +1136,15 @@ m4_if([$1], [v7], am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test x$am_uid = xunknown; then - AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work]) - elif test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) else - AC_MSG_RESULT([no]) - _am_tools=none + AC_MSG_RESULT([no]) + _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test x$gm_gid = xunknown; then - AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work]) - elif test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none @@ -1358,26 +1221,8 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -# Copyright (C) 2022-2024 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_XARGS_N -# ---------------- -# Check whether 'xargs -n' works. It should work everywhere, so the fallback -# is not optimized at all as we never expect to use it. -AC_DEFUN([_AM_PROG_XARGS_N], -[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl -AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 -3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])]) -AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl - am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }' -])dnl -AC_SUBST(am__xargs_n) -]) - +m4_include([m4/ares_check_user_namespace.m4]) +m4_include([m4/ares_check_uts_namespace.m4]) m4_include([m4/ax_ac_append_to_file.m4]) m4_include([m4/ax_ac_print_to_file.m4]) m4_include([m4/ax_add_am_macro_static.m4]) @@ -1388,8 +1233,6 @@ m4_include([m4/ax_append_link_flags.m4]) m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_check_gnu_make.m4]) m4_include([m4/ax_check_link_flag.m4]) -m4_include([m4/ax_check_user_namespace.m4]) -m4_include([m4/ax_check_uts_namespace.m4]) m4_include([m4/ax_code_coverage.m4]) m4_include([m4/ax_compiler_vendor.m4]) m4_include([m4/ax_cxx_compile_stdcxx.m4]) diff --git a/lib/c-ares-1.33.1/aminclude_static.am b/lib/c-ares-1.34.4/aminclude_static.am similarity index 94% rename from lib/c-ares-1.33.1/aminclude_static.am rename to lib/c-ares-1.34.4/aminclude_static.am index 538a810c9eb..ec7a86a43e6 100644 --- a/lib/c-ares-1.33.1/aminclude_static.am +++ b/lib/c-ares-1.34.4/aminclude_static.am @@ -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 Sat Dec 14 15:15:44 UTC 2024 # Code coverage @@ -66,7 +66,7 @@ code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE); code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN); +code_coverage_v_lcov_ign_0 = @echo " LCOV --remove" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN); code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"; @@ -85,7 +85,7 @@ check-code-coverage: # Capture code coverage data code-coverage-capture: code-coverage-capture-hook $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) - $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) + $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) -@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" diff --git a/lib/c-ares-1.33.1/buildconf b/lib/c-ares-1.34.4/buildconf similarity index 100% rename from lib/c-ares-1.33.1/buildconf rename to lib/c-ares-1.34.4/buildconf diff --git a/lib/c-ares-1.33.1/buildconf.bat b/lib/c-ares-1.34.4/buildconf.bat similarity index 100% rename from lib/c-ares-1.33.1/buildconf.bat rename to lib/c-ares-1.34.4/buildconf.bat diff --git a/lib/c-ares-1.33.1/c-ares-config.cmake.in b/lib/c-ares-1.34.4/c-ares-config.cmake.in similarity index 100% rename from lib/c-ares-1.33.1/c-ares-config.cmake.in rename to lib/c-ares-1.34.4/c-ares-config.cmake.in diff --git a/lib/c-ares-1.33.1/cmake/EnableWarnings.cmake b/lib/c-ares-1.34.4/cmake/EnableWarnings.cmake similarity index 100% rename from lib/c-ares-1.33.1/cmake/EnableWarnings.cmake rename to lib/c-ares-1.34.4/cmake/EnableWarnings.cmake diff --git a/lib/c-ares-1.33.1/config/compile b/lib/c-ares-1.34.4/config/compile similarity index 95% rename from lib/c-ares-1.33.1/config/compile rename to lib/c-ares-1.34.4/config/compile index 49b3d05fde4..df363c8fbfb 100755 --- a/lib/c-ares-1.33.1/config/compile +++ b/lib/c-ares-1.34.4/config/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2024-06-19.01; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2024 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -143,7 +143,7 @@ func_cl_wrapper () # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in - *.o | *.lo | *.[oO][bB][jJ]) + *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift @@ -248,17 +248,14 @@ If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . -GNU Automake home page: . -General help using GNU software: . EOF exit $? ;; -v | --v*) - echo "compile (GNU Automake) $scriptversion" + echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ - clang-cl | *[/\\]clang-cl | clang-cl.exe | *[/\\]clang-cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; diff --git a/lib/c-ares-1.33.1/config/config.guess b/lib/c-ares-1.34.4/config/config.guess similarity index 95% rename from lib/c-ares-1.33.1/config/config.guess rename to lib/c-ares-1.34.4/config/config.guess index f6d217a49f8..7f76b6228f7 100755 --- a/lib/c-ares-1.33.1/config/config.guess +++ b/lib/c-ares-1.34.4/config/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2024 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2024-01-01' +timestamp='2022-01-09' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of the system '$me' is run on. +Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit @@ -60,13 +60,13 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2024 Free Software Foundation, Inc. +Copyright 1992-2022 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." help=" -Try '$me --help' for more information." +Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do @@ -102,8 +102,8 @@ GUESS= # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. -# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still -# use 'HOST_CC' if defined, but it is deprecated. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. @@ -155,9 +155,6 @@ Linux|GNU|GNU/*) set_cc_for_build cat <<-EOF > "$dummy.c" - #if defined(__ANDROID__) - LIBC=android - #else #include #if defined(__UCLIBC__) LIBC=uclibc @@ -165,8 +162,6 @@ Linux|GNU|GNU/*) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu - #elif defined(__LLVM_LIBC__) - LIBC=llvm #else #include /* First heuristic to detect musl libc. */ @@ -174,7 +169,6 @@ Linux|GNU|GNU/*) LIBC=musl #endif #endif - #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" @@ -465,7 +459,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in UNAME_RELEASE=`uname -v` ;; esac - # Japanese Language versions have a version number like '4.1.3-JL'. + # Japanese Language versions have a version number like `4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; @@ -910,7 +904,7 @@ EOF fi ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=`uname -p` + UNAME_PROCESSOR=`/usr/bin/uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; @@ -972,37 +966,11 @@ EOF GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; - x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) - GUESS="$UNAME_MACHINE-pc-managarm-mlibc" - ;; - *:[Mm]anagarm:*:*) - GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" - ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) - set_cc_for_build - CPU=$UNAME_MACHINE - LIBCABI=$LIBC - if test "$CC_FOR_BUILD" != no_compiler_found; then - ABI=64 - sed 's/^ //' << EOF > "$dummy.c" - #ifdef __ARM_EABI__ - #ifdef __ARM_PCS_VFP - ABI=eabihf - #else - ABI=eabi - #endif - #endif -EOF - cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` - eval "$cc_set_abi" - case $ABI in - eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; - esac - fi - GUESS=$CPU-unknown-linux-$LIBCABI + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be @@ -1068,16 +1036,7 @@ EOF k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; - kvx:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - kvx:cos:*:*) - GUESS=$UNAME_MACHINE-unknown-cos - ;; - kvx:mbr:*:*) - GUESS=$UNAME_MACHINE-unknown-mbr - ;; - loongarch32:Linux:*:* | loongarch64:Linux:*:*) + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) @@ -1192,27 +1151,16 @@ EOF ;; x86_64:Linux:*:*) set_cc_for_build - CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then - ABI=64 - sed 's/^ //' << EOF > "$dummy.c" - #ifdef __i386__ - ABI=x86 - #else - #ifdef __ILP32__ - ABI=x32 - #endif - #endif -EOF - cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` - eval "$cc_set_abi" - case $ABI in - x86) CPU=i686 ;; - x32) LIBCABI=${LIBC}x32 ;; - esac + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI=${LIBC}x32 + fi fi - GUESS=$CPU-pc-linux-$LIBCABI + GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC @@ -1232,7 +1180,7 @@ EOF GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) - # If we were able to find 'uname', then EMX Unix compatibility + # If we were able to find `uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; @@ -1373,7 +1321,7 @@ EOF GUESS=ns32k-sni-sysv fi ;; - PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; @@ -1419,11 +1367,8 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; - ppc:Haiku:*:*) # Haiku running on Apple PowerPC - GUESS=powerpc-apple-haiku - ;; - *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) - GUESS=$UNAME_MACHINE-unknown-haiku + x86_64:Haiku:*:*) + GUESS=x86_64-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE @@ -1595,9 +1540,6 @@ EOF *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; - *:Ironclad:*:*) - GUESS=$UNAME_MACHINE-unknown-ironclad - ;; esac # Do we have a guess based on uname results? diff --git a/lib/c-ares-1.33.1/config/config.sub b/lib/c-ares-1.34.4/config/config.sub similarity index 89% rename from lib/c-ares-1.33.1/config/config.sub rename to lib/c-ares-1.34.4/config/config.sub index 2c6a07ab3c3..dba16e84c77 100755 --- a/lib/c-ares-1.33.1/config/config.sub +++ b/lib/c-ares-1.34.4/config/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2024 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2024-01-01' +timestamp='2022-01-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -76,13 +76,13 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2024 Free Software Foundation, Inc. +Copyright 1992-2022 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." help=" -Try '$me --help' for more information." +Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do @@ -130,7 +130,7 @@ IFS=$saved_IFS # Separate into logical components for further validation case $1 in *-*-*-*-*) - echo "Invalid configuration '$1': more than four components" >&2 + echo Invalid configuration \`"$1"\': more than four components >&2 exit 1 ;; *-*-*-*) @@ -145,8 +145,7 @@ case $1 in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ - | windows-* ) + | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 basic_os=$maybe_os ;; @@ -944,7 +943,7 @@ $basic_machine EOF IFS=$saved_IFS ;; - # We use 'pc' rather than 'unknown' + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) @@ -1076,7 +1075,7 @@ case $cpu-$vendor in pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) cpu=i586 ;; - pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) + pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) cpu=i686 ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) @@ -1181,7 +1180,7 @@ case $cpu-$vendor in case $cpu in 1750a | 580 \ | a29k \ - | aarch64 | aarch64_be | aarch64c | arm64ec \ + | aarch64 | aarch64_be \ | abacus \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ @@ -1200,29 +1199,50 @@ case $cpu-$vendor in | d10v | d30v | dlx | dsp16xx \ | e2k | elxsi | epiphany \ | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ - | javascript \ | h8300 | h8500 \ | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i*86 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ - | kvx \ | le32 | le64 \ | lm32 \ - | loongarch32 | loongarch64 \ + | loongarch32 | loongarch64 | loongarchx32 \ | m32c | m32r | m32rle \ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ | m88110 | m88k | maxq | mb | mcore | mep | metag \ | microblaze | microblazeel \ - | mips* \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64eb | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r3 | mipsisa32r3el \ + | mipsisa32r5 | mipsisa32r5el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r3 | mipsisa64r3el \ + | mipsisa64r5 | mipsisa64r5el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ | mmix \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ - | nanomips* \ | nds32 | nds32le | nds32be \ | nfp \ | nios | nios2 | nios2eb | nios2el \ @@ -1254,7 +1274,6 @@ case $cpu-$vendor in | ubicom32 \ | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ | vax \ - | vc4 \ | visium \ | w65 \ | wasm32 | wasm64 \ @@ -1266,7 +1285,7 @@ case $cpu-$vendor in ;; *) - echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 exit 1 ;; esac @@ -1287,12 +1306,11 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if test x"$basic_os" != x +if test x$basic_os != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. -obj= case $basic_os in gnu/linux*) kernel=linux @@ -1323,10 +1341,6 @@ EOF kernel=linux os=`echo "$basic_os" | sed -e 's|linux|gnu|'` ;; - managarm*) - kernel=managarm - os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` - ;; *) kernel= os=$basic_os @@ -1492,16 +1506,10 @@ case $os in os=eabi ;; *) - os= - obj=elf + os=elf ;; esac ;; - aout* | coff* | elf* | pe*) - # These are machine code file formats, not OSes - obj=$os - os= - ;; *) # No normalization, but not necessarily accepted, that comes below. ;; @@ -1520,15 +1528,12 @@ else # system, and we'll never get to this point. kernel= -obj= case $cpu-$vendor in score-*) - os= - obj=elf + os=elf ;; spu-*) - os= - obj=elf + os=elf ;; *-acorn) os=riscix1.2 @@ -1538,35 +1543,28 @@ case $cpu-$vendor in os=gnu ;; arm*-semi) - os= - obj=aout + os=aout ;; c4x-* | tic4x-*) - os= - obj=coff + os=coff ;; c8051-*) - os= - obj=elf + os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) - os= - obj=elf + os=elf ;; tic54x-*) - os= - obj=coff + os=coff ;; tic55x-*) - os= - obj=coff + os=coff ;; tic6x-*) - os= - obj=coff + os=coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1588,24 +1586,19 @@ case $cpu-$vendor in os=sunos3 ;; m68*-cisco) - os= - obj=aout + os=aout ;; mep-*) - os= - obj=elf + os=elf ;; mips*-cisco) - os= - obj=elf + os=elf ;; - mips*-*|nanomips*-*) - os= - obj=elf + mips*-*) + os=elf ;; or32-*) - os= - obj=coff + os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 @@ -1614,8 +1607,7 @@ case $cpu-$vendor in os=sunos4.1.1 ;; pru-*) - os= - obj=elf + os=elf ;; *-be) os=beos @@ -1696,12 +1688,10 @@ case $cpu-$vendor in os=uxpv ;; *-rom68k) - os= - obj=coff + os=coff ;; *-*bug) - os= - obj=coff + os=coff ;; *-apple) os=macos @@ -1719,11 +1709,10 @@ esac fi -# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). - +# Now, validate our (potentially fixed-up) OS. case $os in # Sometimes we do "kernel-libc", so those need to count as OSes. - llvm* | musl* | newlib* | relibc* | uclibc*) + musl* | newlib* | relibc* | uclibc*) ;; # Likewise for "kernel-abi" eabi* | gnueabi*) @@ -1731,9 +1720,6 @@ case $os in # VxWorks passes extra cpu info in the 4th filed. simlinux | simwindows | spe) ;; - # See `case $cpu-$os` validation below - ghcjs) - ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. @@ -1742,7 +1728,7 @@ case $os in | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ | hiux* | abug | nacl* | netware* | windows* \ - | os9* | macos* | osx* | ios* | tvos* | watchos* \ + | os9* | macos* | osx* | ios* \ | mpw* | magic* | mmixware* | mon960* | lnews* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \ @@ -1751,11 +1737,11 @@ case $os in | mirbsd* | netbsd* | dicos* | openedition* | ose* \ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ - | bosx* | nextstep* | cxux* | oabi* \ - | ptx* | ecoff* | winnt* | domain* | vsta* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* | serenity* \ - | cygwin* | msys* | moss* | proelf* | rtems* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | mint* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ @@ -1768,116 +1754,49 @@ case $os in | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ - | fiwix* | mlibc* | cos* | mbr* | ironclad* ) + | fiwix* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; - # This refers to builds using the UEFI calling convention - # (which depends on the architecture) and PE file format. - # Note that this is both a different calling convention and - # different file format than that of GNU-EFI - # (x86_64-w64-mingw32). - uefi) - ;; none) ;; - kernel* | msvc* ) - # Restricted further below - ;; - '') - if test x"$obj" = x - then - echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 - fi - ;; - *) - echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 - exit 1 - ;; -esac - -case $obj in - aout* | coff* | elf* | pe*) - ;; - '') - # empty is fine - ;; *) - echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 - exit 1 - ;; -esac - -# Here we handle the constraint that a (synthetic) cpu and os are -# valid only in combination with each other and nowhere else. -case $cpu-$os in - # The "javascript-unknown-ghcjs" triple is used by GHC; we - # accept it here in order to tolerate that, but reject any - # variations. - javascript-ghcjs) - ;; - javascript-* | *-ghcjs) - echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. -case $kernel-$os-$obj in - linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ - | linux-mlibc*- | linux-musl*- | linux-newlib*- \ - | linux-relibc*- | linux-uclibc*- ) - ;; - uclinux-uclibc*- ) - ;; - managarm-mlibc*- | managarm-kernel*- ) +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* ) ;; - windows*-msvc*-) + uclinux-uclibc* ) ;; - -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ - | -uclibc*- ) + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. - echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 - exit 1 - ;; - -kernel*- ) - echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 - exit 1 - ;; - *-kernel*- ) - echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; - *-msvc*- ) - echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 - exit 1 - ;; - kfreebsd*-gnu*- | kopensolaris*-gnu*-) + kfreebsd*-gnu* | kopensolaris*-gnu*) ;; - vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) + vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; - nto-qnx*-) - ;; - os2-emx-) + nto-qnx*) ;; - *-eabi*- | *-gnueabi*-) + os2-emx) ;; - none--*) - # None (no kernel, i.e. freestanding / bare metal), - # can be paired with an machine code file format + *-eabi* | *-gnueabi*) ;; - -*-) + -*) # Blank kernel with real OS is always fine. ;; - --*) - # Blank kernel and OS with real machine code file format is always fine. - ;; - *-*-*) - echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac @@ -1960,7 +1879,7 @@ case $vendor in ;; esac -echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" +echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: diff --git a/lib/c-ares-1.33.1/config/depcomp b/lib/c-ares-1.34.4/config/depcomp similarity index 98% rename from lib/c-ares-1.33.1/config/depcomp rename to lib/c-ares-1.34.4/config/depcomp index 1f0aa972c93..715e34311ed 100755 --- a/lib/c-ares-1.33.1/config/depcomp +++ b/lib/c-ares-1.34.4/config/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2024-06-19.01; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2024 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -47,13 +47,11 @@ Environment variables: libtool Whether libtool is used (yes/no). Report bugs to . -GNU Automake home page: . -General help using GNU software: . EOF exit $? ;; -v | --v*) - echo "depcomp (GNU Automake) $scriptversion" + echo "depcomp $scriptversion" exit $? ;; esac @@ -115,6 +113,7 @@ nl=' # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then @@ -129,7 +128,7 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" -# Avoid interference from the environment. +# Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We @@ -199,8 +198,8 @@ gcc3) ;; gcc) -## Note that this doesn't just cater to obsolete pre-3.x GCC compilers. -## but also to in-use compilers like IBM xlc/xlC and the HP C compiler. +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: diff --git a/lib/c-ares-1.33.1/config/install-sh b/lib/c-ares-1.34.4/config/install-sh similarity index 97% rename from lib/c-ares-1.33.1/config/install-sh rename to lib/c-ares-1.34.4/config/install-sh index b1d7a6f67f6..ec298b53740 100755 --- a/lib/c-ares-1.33.1/config/install-sh +++ b/lib/c-ares-1.34.4/config/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2024-06-19.01; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -124,9 +124,9 @@ it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. -Report bugs to . -GNU Automake home page: . -General help using GNU software: ." +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" while test $# -ne 0; do case $1 in @@ -170,7 +170,7 @@ while test $# -ne 0; do -T) is_target_a_directory=never;; - --version) echo "$0 (GNU Automake) $scriptversion"; exit $?;; + --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; @@ -345,7 +345,7 @@ do ' 0 # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writable /tmp, make sure that the '$tmpdir' + # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && @@ -353,7 +353,7 @@ do exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { - # Check for POSIX incompatibility with -m. + # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. diff --git a/lib/c-ares-1.33.1/config/ltmain.sh b/lib/c-ares-1.34.4/config/ltmain.sh old mode 100644 new mode 100755 similarity index 94% rename from lib/c-ares-1.33.1/config/ltmain.sh rename to lib/c-ares-1.34.4/config/ltmain.sh index 2a50d7f6f72..540a92ab547 --- a/lib/c-ares-1.33.1/config/ltmain.sh +++ b/lib/c-ares-1.34.4/config/ltmain.sh @@ -1,12 +1,12 @@ -#! /usr/bin/env sh +#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in -## by inline-source v2019-02-19.15 +## by inline-source v2014-01-03.01 -# libtool (GNU libtool) 2.4.7 +# libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. +# Copyright (C) 1996-2015 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. @@ -31,8 +31,8 @@ PROGRAM=libtool PACKAGE=libtool -VERSION=2.4.7 -package_revision=2.4.7 +VERSION="2.4.6 Debian-2.4.6-15build2" +package_revision=2.4.6 ## ------ ## @@ -64,25 +64,34 @@ package_revision=2.4.7 # libraries, which are installed to $pkgauxdir. # Set a version string for this script. -scriptversion=2019-02-19.15; # UTC +scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 -# This is free software. There is NO warranty; not even for -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# -# Copyright (C) 2004-2019, 2021 Bootstrap Authors -# -# This file is dual licensed under the terms of the MIT license -# , and GPL version 2 or later -# . You must apply one of -# these licenses when using or redistributing this software or any of -# the files within it. See the URLs above, or the file `LICENSE` -# included in the Bootstrap distribution for the full license texts. +# Copyright (C) 2004-2015 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. + +# This program 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 3 of the License, or +# (at your option) any later version. + +# As a special exception to the GNU General Public License, if you distribute +# this file as part of a program or library that is built using GNU Libtool, +# you may include this file under the same distribution terms that you use +# for the rest of that program. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . -# Please report bugs or propose patches to: -# +# Please report bugs or propose patches to gary@gnu.org. ## ------ ## @@ -130,12 +139,9 @@ do _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done -# These NLS vars are set unconditionally (bootstrap issue #24). Unset those -# in case the environment reset is needed later and the $save_* variant is not -# defined (see the code above). -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' @@ -153,26 +159,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# func_unset VAR -# -------------- -# Portably unset VAR. -# In some shells, an 'unset VAR' statement leaves a non-zero return -# status if VAR is already unset, which might be problematic if the -# statement is used at the end of a function (thus poisoning its return -# value) or when 'set -e' is active (causing even a spurious abort of -# the script in this case). -func_unset () -{ - { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } -} - - -# Make sure CDPATH doesn't cause `cd` commands to output the target dir. -func_unset CDPATH - -# Make sure ${,E,F}GREP behave sanely. -func_unset GREP_OPTIONS - ## ------------------------- ## ## Locate command utilities. ## @@ -273,7 +259,7 @@ test -z "$SED" && { rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } @@ -309,7 +295,7 @@ test -z "$GREP" && { rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } @@ -374,35 +360,6 @@ sed_double_backslash="\ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" -# require_check_ifs_backslash -# --------------------------- -# Check if we can use backslash as IFS='\' separator, and set -# $check_ifs_backshlash_broken to ':' or 'false'. -require_check_ifs_backslash=func_require_check_ifs_backslash -func_require_check_ifs_backslash () -{ - _G_save_IFS=$IFS - IFS='\' - _G_check_ifs_backshlash='a\\b' - for _G_i in $_G_check_ifs_backshlash - do - case $_G_i in - a) - check_ifs_backshlash_broken=false - ;; - '') - break - ;; - *) - check_ifs_backshlash_broken=: - break - ;; - esac - done - IFS=$_G_save_IFS - require_check_ifs_backslash=: -} - ## ----------------- ## ## Global variables. ## @@ -430,7 +387,7 @@ EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # -# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +# debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: @@ -623,16 +580,16 @@ if test yes = "$_G_HAVE_PLUSEQ_OP"; then { $debug_cmd - func_quote_arg pretty "$2" - eval "$1+=\\ \$func_quote_arg_result" + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd - func_quote_arg pretty "$2" - eval "$1=\$$1\\ \$func_quote_arg_result" + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi @@ -1134,203 +1091,85 @@ func_relative_path () } -# func_quote_portable EVAL ARG -# ---------------------------- -# Internal function to portably implement func_quote_arg. Note that we still -# keep attention to performance here so we as much as possible try to avoid -# calling sed binary (so far O(N) complexity as long as func_append is O(1)). -func_quote_portable () +# func_quote_for_eval ARG... +# -------------------------- +# Aesthetically quote ARGs to be evaled later. +# This function returns two values: +# i) func_quote_for_eval_result +# double-quoted, suitable for a subsequent eval +# ii) func_quote_for_eval_unquoted_result +# has all characters that are still active within double +# quotes backslashified. +func_quote_for_eval () { $debug_cmd - $require_check_ifs_backslash - - func_quote_portable_result=$2 - - # one-time-loop (easy break) - while true - do - if $1; then - func_quote_portable_result=`$ECHO "$2" | $SED \ - -e "$sed_double_quote_subst" -e "$sed_double_backslash"` - break - fi - - # Quote for eval. - case $func_quote_portable_result in + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in *[\\\`\"\$]*) - # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string - # contains the shell wildcard characters. - case $check_ifs_backshlash_broken$func_quote_portable_result in - :*|*[\[\*\?]*) - func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ - | $SED "$sed_quote_subst"` - break - ;; - esac + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; + *) + _G_unquoted_arg=$1 ;; + esac + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + fi - func_quote_portable_old_IFS=$IFS - for _G_char in '\' '`' '"' '$' - do - # STATE($1) PREV($2) SEPARATOR($3) - set start "" "" - func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy - IFS=$_G_char - for _G_part in $func_quote_portable_result - do - case $1 in - quote) - func_append func_quote_portable_result "$3$2" - set quote "$_G_part" "\\$_G_char" - ;; - start) - set first "" "" - func_quote_portable_result= - ;; - first) - set quote "$_G_part" "" - ;; - esac - done - done - IFS=$func_quote_portable_old_IFS + case $_G_unquoted_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_quoted_arg=\"$_G_unquoted_arg\" ;; - *) ;; + *) + _G_quoted_arg=$_G_unquoted_arg + ;; esac - break - done - func_quote_portable_unquoted_result=$func_quote_portable_result - case $func_quote_portable_result in - # double-quote args containing shell metacharacters to delay - # word splitting, command substitution and variable expansion - # for a subsequent eval. - # many bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_portable_result=\"$func_quote_portable_result\" - ;; - esac + if test -n "$func_quote_for_eval_result"; then + func_append func_quote_for_eval_result " $_G_quoted_arg" + else + func_append func_quote_for_eval_result "$_G_quoted_arg" + fi + shift + done } -# func_quotefast_eval ARG -# ----------------------- -# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', -# but optimized for speed. Result is stored in $func_quotefast_eval. -if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then - printf -v _GL_test_printf_tilde %q '~' - if test '\~' = "$_GL_test_printf_tilde"; then - func_quotefast_eval () - { - printf -v func_quotefast_eval_result %q "$1" - } - else - # Broken older Bash implementations. Make those faster too if possible. - func_quotefast_eval () - { - case $1 in - '~'*) - func_quote_portable false "$1" - func_quotefast_eval_result=$func_quote_portable_result - ;; - *) - printf -v func_quotefast_eval_result %q "$1" - ;; - esac - } - fi -else - func_quotefast_eval () - { - func_quote_portable false "$1" - func_quotefast_eval_result=$func_quote_portable_result - } -fi - +# func_quote_for_expand ARG +# ------------------------- +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + $debug_cmd -# func_quote_arg MODEs ARG -# ------------------------ -# Quote one ARG to be evaled later. MODEs argument may contain zero or more -# specifiers listed below separated by ',' character. This function returns two -# values: -# i) func_quote_arg_result -# double-quoted (when needed), suitable for a subsequent eval -# ii) func_quote_arg_unquoted_result -# has all characters that are still active within double -# quotes backslashified. Available only if 'unquoted' is specified. -# -# Available modes: -# ---------------- -# 'eval' (default) -# - escape shell special characters -# 'expand' -# - the same as 'eval'; but do not quote variable references -# 'pretty' -# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might -# be used later in func_quote to get output like: 'echo "a b"' instead -# of 'echo a\ b'. This is slower than default on some shells. -# 'unquoted' -# - produce also $func_quote_arg_unquoted_result which does not contain -# wrapping double-quotes. -# -# Examples for 'func_quote_arg pretty,unquoted string': -# -# string | *_result | *_unquoted_result -# ------------+-----------------------+------------------- -# " | \" | \" -# a b | "a b" | a b -# "a b" | "\"a b\"" | \"a b\" -# * | "*" | * -# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" -# -# Examples for 'func_quote_arg pretty,unquoted,expand string': -# -# string | *_result | *_unquoted_result -# --------------+---------------------+-------------------- -# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" -func_quote_arg () -{ - _G_quote_expand=false - case ,$1, in - *,expand,*) - _G_quote_expand=: - ;; + case $1 in + *[\\\`\"]*) + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + *) + _G_arg=$1 ;; esac - case ,$1, in - *,pretty,*|*,expand,*|*,unquoted,*) - func_quote_portable $_G_quote_expand "$2" - func_quote_arg_result=$func_quote_portable_result - func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result - ;; - *) - # Faster quote-for-eval for some shells. - func_quotefast_eval "$2" - func_quote_arg_result=$func_quotefast_eval_result + case $_G_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_arg=\"$_G_arg\" ;; esac -} - -# func_quote MODEs ARGs... -# ------------------------ -# Quote all ARGs to be evaled later and join them into single command. See -# func_quote_arg's description for more info. -func_quote () -{ - $debug_cmd - _G_func_quote_mode=$1 ; shift - func_quote_result= - while test 0 -lt $#; do - func_quote_arg "$_G_func_quote_mode" "$1" - if test -n "$func_quote_result"; then - func_append func_quote_result " $func_quote_arg_result" - else - func_append func_quote_result "$func_quote_arg_result" - fi - shift - done + func_quote_for_expand_result=$_G_arg } @@ -1376,8 +1215,8 @@ func_show_eval () _G_cmd=$1 _G_fail_exp=${2-':'} - func_quote_arg pretty,expand "$_G_cmd" - eval "func_notquiet $func_quote_arg_result" + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" @@ -1402,8 +1241,8 @@ func_show_eval_locale () _G_fail_exp=${2-':'} $opt_quiet || { - func_quote_arg expand,pretty "$_G_cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$_G_cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { @@ -1530,26 +1369,30 @@ func_lt_ver () # End: #! /bin/sh +# Set a version string for this script. +scriptversion=2015-10-07.11; # UTC + # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 -# This is free software. There is NO warranty; not even for -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# -# Copyright (C) 2010-2019, 2021 Bootstrap Authors -# -# This file is dual licensed under the terms of the MIT license -# , and GPL version 2 or later -# . You must apply one of -# these licenses when using or redistributing this software or any of -# the files within it. See the URLs above, or the file `LICENSE` -# included in the Bootstrap distribution for the full license texts. +# Copyright (C) 2010-2015 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. + +# This program 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 3 of the License, or +# (at your option) any later version. -# Please report bugs or propose patches to: -# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. -# Set a version string for this script. -scriptversion=2019-02-19.15; # UTC +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please report bugs or propose patches to gary@gnu.org. ## ------ ## @@ -1572,7 +1415,7 @@ scriptversion=2019-02-19.15; # UTC # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file -# starting with '# Written by ' and ending with '# Copyright'. +# starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the @@ -1584,7 +1427,7 @@ scriptversion=2019-02-19.15; # UTC # to display verbose messages only when your user has specified # '--verbose'. # -# After sourcing this file, you can plug in processing for additional +# After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. @@ -1633,8 +1476,8 @@ fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## # This section contains functions for adding, removing, and running hooks -# in the main code. A hook is just a list of function names that can be -# run in order later on. +# to the main code. A hook is just a named list of of function, that can +# be run in order later on. # func_hookable FUNC_NAME # ----------------------- @@ -1667,8 +1510,7 @@ func_add_hook () # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ -# Remove HOOK_FUNC from the list of hook functions to be called by -# FUNC_NAME. +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd @@ -1677,28 +1519,10 @@ func_remove_hook () } -# func_propagate_result FUNC_NAME_A FUNC_NAME_B -# --------------------------------------------- -# If the *_result variable of FUNC_NAME_A _is set_, assign its value to -# *_result variable of FUNC_NAME_B. -func_propagate_result () -{ - $debug_cmd - - func_propagate_result_result=: - if eval "test \"\${${1}_result+set}\" = set" - then - eval "${2}_result=\$${1}_result" - else - func_propagate_result_result=false - fi -} - - # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. -# It's assumed that the list of hook functions contains nothing more +# It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. @@ -1706,21 +1530,26 @@ func_run_hooks () { $debug_cmd + _G_rc_run_hooks=false + case " $hookable_fns " in *" $1 "*) ;; - *) func_fatal_error "'$1' does not support hook functions." ;; + *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do - func_unset "${_G_hook}_result" - eval $_G_hook '${1+"$@"}' - func_propagate_result $_G_hook func_run_hooks - if $func_propagate_result_result; then - eval set dummy "$func_run_hooks_result"; shift + if eval $_G_hook '"$@"'; then + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + _G_rc_run_hooks=: fi done + + $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result } @@ -1730,16 +1559,14 @@ func_run_hooks () ## --------------- ## # In order to add your own option parsing hooks, you must accept the -# full positional parameter list from your hook function. You may remove -# or edit any options that you action, and then pass back the remaining -# unprocessed options in '_result', escaped -# suitably for 'eval'. -# -# The '_result' variable is automatically unset -# before your hook gets called; for best performance, only set the -# *_result variable when necessary (i.e. don't call the 'func_quote' -# function unnecessarily because it can be an expensive operation on some -# machines). +# full positional parameter list in your hook function, you may remove/edit +# any options that you action, and then pass back the remaining unprocessed +# options in '_result', escaped suitably for +# 'eval'. In this case you also must return $EXIT_SUCCESS to let the +# hook's caller know that it should pay attention to +# '_result'. Returning $EXIT_FAILURE signalizes that +# arguments are left untouched by the hook and therefore caller will ignore the +# result variable. # # Like this: # @@ -1751,8 +1578,11 @@ func_run_hooks () # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' -# # No change in '$@' (ignored completely by this hook). Leave -# # my_options_prep_result variable intact. +# # No change in '$@' (ignored completely by this hook). There is +# # no need to do the equivalent (but slower) action: +# # func_quote_for_eval ${1+"$@"} +# # my_options_prep_result=$func_quote_for_eval_result +# false # } # func_add_hook func_options_prep my_options_prep # @@ -1763,7 +1593,7 @@ func_run_hooks () # # args_changed=false # -# # Note that, for efficiency, we parse as many options as we can +# # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do @@ -1780,17 +1610,18 @@ func_run_hooks () # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" -# # is added back to "$@" in case we need it later, -# # if $args_changed was set to 'true'. +# # is added back to "$@", we could need that later +# # if $args_changed is true. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # -# # Only call 'func_quote' here if we processed at least one argument. # if $args_changed; then -# func_quote eval ${1+"$@"} -# my_silent_option_result=$func_quote_result +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result # fi +# +# $args_changed # } # func_add_hook func_parse_options my_silent_option # @@ -1801,6 +1632,8 @@ func_run_hooks () # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." +# +# false # } # func_add_hook func_validate_options my_option_validation # @@ -1816,8 +1649,13 @@ func_options_finish () { $debug_cmd - func_run_hooks func_options ${1+"$@"} - func_propagate_result func_run_hooks func_options_finish + _G_func_options_finish_exit=false + if func_run_hooks func_options ${1+"$@"}; then + func_options_finish_result=$func_run_hooks_result + _G_func_options_finish_exit=: + fi + + $_G_func_options_finish_exit } @@ -1830,27 +1668,28 @@ func_options () { $debug_cmd - _G_options_quoted=false + _G_rc_options=false for my_func in options_prep parse_options validate_options options_finish do - func_unset func_${my_func}_result - func_unset func_run_hooks_result - eval func_$my_func '${1+"$@"}' - func_propagate_result func_$my_func func_options - if $func_propagate_result_result; then - eval set dummy "$func_options_result"; shift - _G_options_quoted=: + if eval func_$my_func '${1+"$@"}'; then + eval _G_res_var='$'"func_${my_func}_result" + eval set dummy "$_G_res_var" ; shift + _G_rc_options=: fi done - $_G_options_quoted || { - # As we (func_options) are top-level options-parser function and - # nobody quoted "$@" for us yet, we need to do it explicitly for - # caller. - func_quote eval ${1+"$@"} - func_options_result=$func_quote_result - } + # Save modified positional parameters for caller. As a top-level + # options-parser function we always need to set the 'func_options_result' + # variable (regardless the $_G_rc_options value). + if $_G_rc_options; then + func_options_result=$_G_res_var + else + func_quote_for_eval ${1+"$@"} + func_options_result=$func_quote_for_eval_result + fi + + $_G_rc_options } @@ -1860,7 +1699,8 @@ func_options () # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propagate that back to rest of this script, then the complete -# modified list must be put in 'func_run_hooks_result' before returning. +# modified list must be put in 'func_run_hooks_result' before +# returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). func_hookable func_options_prep func_options_prep () { @@ -1870,8 +1710,14 @@ func_options_prep () opt_verbose=false opt_warning_types= - func_run_hooks func_options_prep ${1+"$@"} - func_propagate_result func_run_hooks func_options_prep + _G_rc_options_prep=false + if func_run_hooks func_options_prep ${1+"$@"}; then + _G_rc_options_prep=: + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result + fi + + $_G_rc_options_prep } @@ -1883,32 +1729,27 @@ func_parse_options () { $debug_cmd - _G_parse_options_requote=false + func_parse_options_result= + + _G_rc_parse_options=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. - func_run_hooks func_parse_options ${1+"$@"} - func_propagate_result func_run_hooks func_parse_options - if $func_propagate_result_result; then - eval set dummy "$func_parse_options_result"; shift - # Even though we may have changed "$@", we passed the "$@" array - # down into the hook and it quoted it for us (because we are in - # this if-branch). No need to quote it again. - _G_parse_options_requote=false + if func_run_hooks func_parse_options ${1+"$@"}; then + eval set dummy "$func_run_hooks_result"; shift + _G_rc_parse_options=: fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break - # We expect that one of the options parsed in this function matches - # and thus we remove _G_opt from "$@" and need to re-quote. _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' - func_echo "enabling shell trace mode" >&2 + func_echo "enabling shell trace mode" $debug_cmd ;; @@ -1919,7 +1760,7 @@ func_parse_options () --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then - _G_parse_options_requote=: + _G_rc_parse_options=: break fi case " $warning_categories $1" in @@ -1974,7 +1815,7 @@ func_parse_options () shift ;; - --) _G_parse_options_requote=: ; break ;; + --) _G_rc_parse_options=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false @@ -1982,16 +1823,17 @@ func_parse_options () ;; esac - if $_G_match_parse_options; then - _G_parse_options_requote=: - fi + $_G_match_parse_options && _G_rc_parse_options=: done - if $_G_parse_options_requote; then + + if $_G_rc_parse_options; then # save modified positional parameters for caller - func_quote eval ${1+"$@"} - func_parse_options_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result fi + + $_G_rc_parse_options } @@ -2004,14 +1846,21 @@ func_validate_options () { $debug_cmd + _G_rc_validate_options=false + # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" - func_run_hooks func_validate_options ${1+"$@"} - func_propagate_result func_run_hooks func_validate_options + if func_run_hooks func_validate_options ${1+"$@"}; then + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result + _G_rc_validate_options=: + fi # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE + + $_G_rc_validate_options } @@ -2067,8 +1916,8 @@ func_missing_arg () # func_split_equals STRING # ------------------------ -# Set func_split_equals_lhs and func_split_equals_rhs shell variables -# after splitting STRING at the '=' sign. +# Set func_split_equals_lhs and func_split_equals_rhs shell variables after +# splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ @@ -2083,9 +1932,8 @@ then func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} - if test "x$func_split_equals_lhs" = "x$1"; then - func_split_equals_rhs= - fi + test "x$func_split_equals_lhs" = "x$1" \ + && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. @@ -2095,7 +1943,7 @@ else func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= - test "x$func_split_equals_lhs=" = "x$1" \ + test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals @@ -2121,7 +1969,7 @@ else { $debug_cmd - func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` + func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt @@ -2163,44 +2011,31 @@ func_usage_message () # func_version # ------------ # Echo version message to standard output and exit. -# The version message is extracted from the calling file's header -# comments, with leading '# ' stripped: -# 1. First display the progname and version -# 2. Followed by the header comment line matching /^# Written by / -# 3. Then a blank line followed by the first following line matching -# /^# Copyright / -# 4. Immediately followed by any lines between the previous matches, -# except lines preceding the intervening completely blank line. -# For example, see the header comments of this file. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' - /^# Written by /!b - s|^# ||; p; n - - :fwd2blnk - /./ { - n - b fwd2blnk + /(C)/!b go + :more + /\./!{ + N + s|\n# | | + b more } - p; n - - :holdwrnt - s|^# || - s|^# *$|| - /^Copyright /!{ - /./H - n - b holdwrnt + :go + /^# Written by /,/# warranty; / { + s|^# || + s|^# *$|| + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + p } - - s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| - G - s|\(\n\)\n*|\1|g - p; q' < "$progpath" + /^# Written by / { + s|^# || + p + } + /^warranty; /q' < "$progpath" exit $? } @@ -2210,12 +2045,12 @@ func_version () # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. -scriptversion='(GNU libtool) 2.4.7' +scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... @@ -2306,12 +2141,12 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname (GNU libtool) 2.4.7 + version: $progname $scriptversion Debian-2.4.6-15build2 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . -GNU libtool home page: . +GNU libtool home page: . General help using GNU software: ." exit 0 } @@ -2362,7 +2197,7 @@ fi # a configuration failure hint, and exit. func_fatal_configuration () { - func_fatal_error ${1+"$@"} \ + func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } @@ -2540,9 +2375,11 @@ libtool_options_prep () if $_G_rc_lt_options_prep; then # Pass back the list of options. - func_quote eval ${1+"$@"} - libtool_options_prep_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result fi + + $_G_rc_lt_options_prep } func_add_hook func_options_prep libtool_options_prep @@ -2645,9 +2482,11 @@ libtool_parse_options () if $_G_rc_lt_parse_options; then # save modified positional parameters for caller - func_quote eval ${1+"$@"} - libtool_parse_options_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result fi + + $_G_rc_lt_parse_options } func_add_hook func_parse_options libtool_parse_options @@ -2704,8 +2543,8 @@ libtool_validate_options () } # Pass back the unparsed argument list - func_quote eval ${1+"$@"} - libtool_validate_options_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options @@ -3671,8 +3510,8 @@ func_mode_compile () esac done - func_quote_arg pretty "$libobj" - test "X$libobj" != "X$func_quote_arg_result" \ + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" @@ -3745,8 +3584,8 @@ compiler." func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result - func_quote_arg pretty "$srcfile" - qsrcfile=$func_quote_arg_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then @@ -3901,8 +3740,7 @@ This mode accepts the following additional options: -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking - -Wc,FLAG - -Xcompiler FLAG pass FLAG directly to the compiler + -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. @@ -4008,8 +3846,6 @@ The following components of LINK-COMMAND are treated specially: -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wa,FLAG - -Xassembler FLAG pass linker-specific FLAG directly to the assembler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) @@ -4352,8 +4188,8 @@ func_mode_install () case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. - func_quote_arg pretty "$nonopt" - install_prog="$func_quote_arg_result " + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " arg=$1 shift else @@ -4363,8 +4199,8 @@ func_mode_install () # The real first argument should be the name of the installation program. # Aesthetically quote it. - func_quote_arg pretty "$arg" - func_append install_prog "$func_quote_arg_result" + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; @@ -4421,12 +4257,12 @@ func_mode_install () esac # Aesthetically quote the argument. - func_quote_arg pretty "$arg" - func_append install_prog " $func_quote_arg_result" + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then - func_quote_arg pretty "$arg2" + func_quote_for_eval "$arg2" fi - func_append install_shared_prog " $func_quote_arg_result" + func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -4437,8 +4273,8 @@ func_mode_install () if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else - func_quote_arg pretty "$install_override_mode" - func_append install_shared_prog " -m $func_quote_arg_result" + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi @@ -4734,8 +4570,8 @@ func_mode_install () relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { - func_quote_arg expand,pretty "$relink_command" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else @@ -5514,8 +5350,7 @@ else if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" - func_quote_arg pretty "$ECHO" - qECHO=$func_quote_arg_result + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. @@ -5525,7 +5360,7 @@ func_fallback_echo () \$1 _LTECHO_EOF' } - ECHO=$qECHO + ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to @@ -6868,9 +6703,9 @@ func_mode_link () while test "$#" -gt 0; do arg=$1 shift - func_quote_arg pretty,unquoted "$arg" - qarg=$func_quote_arg_unquoted_result - func_append libtool_args " $func_quote_arg_result" + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then @@ -7106,13 +6941,6 @@ func_mode_link () prev= continue ;; - xassembler) - func_append compiler_flags " -Xassembler $qarg" - prev= - func_append compile_command " -Xassembler $qarg" - func_append finalize_command " -Xassembler $qarg" - continue - ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" @@ -7283,7 +7111,7 @@ func_mode_link () # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; @@ -7303,7 +7131,7 @@ func_mode_link () esac elif test X-lc_r = "X$arg"; then case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -7333,20 +7161,8 @@ func_mode_link () prev=xcompiler continue ;; - # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. - -pthread) - case $host in - *solaris2*) ;; - *) - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - ;; - esac - continue - ;; - -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" @@ -7487,9 +7303,9 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_arg pretty "$flag" - func_append arg " $func_quote_arg_result" - func_append compiler_flags " $func_quote_arg_result" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" @@ -7503,21 +7319,16 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_arg pretty "$flag" - func_append arg " $wl$func_quote_arg_result" - func_append compiler_flags " $wl$func_quote_arg_result" - func_append linker_flags " $func_quote_arg_result" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; - -Xassembler) - prev=xassembler - continue - ;; - -Xcompiler) prev=xcompiler continue @@ -7535,8 +7346,8 @@ func_mode_link () # -msg_* for osf cc -msg_*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: @@ -7557,13 +7368,14 @@ func_mode_link () # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC - # -Wa,* Pass flags directly to the assembler + # -static-* direct GCC to link specific libraries statically + # -fcilkplus Cilk Plus language extension features for C/C++ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" @@ -7584,15 +7396,15 @@ func_mode_link () continue else # Otherwise treat like 'Some other compiler flag' below - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; *.$objext) @@ -7712,8 +7524,8 @@ func_mode_link () *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; esac # arg @@ -7854,7 +7666,10 @@ func_mode_link () case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then @@ -8173,19 +7988,19 @@ func_mode_link () # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done continue fi # $pass = conv @@ -8918,7 +8733,7 @@ func_mode_link () test CXX = "$tagname" && { case $host_os in linux*) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi @@ -9091,7 +8906,7 @@ func_mode_link () # case $version_type in # correct linux to gnu/linux during the next big refactor - darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) + darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor @@ -9109,6 +8924,9 @@ func_mode_link () revision=$number_minor lt_irix_increment=no ;; + *) + func_fatal_configuration "$modename: unknown library version type '$version_type'" + ;; esac ;; no) @@ -9182,7 +9000,7 @@ func_mode_link () versuffix=.$current.$revision ;; - freebsd-elf | midnightbsd-elf) + freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision @@ -9408,7 +9226,7 @@ func_mode_link () *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -10219,8 +10037,8 @@ EOF for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { - func_quote_arg expand,pretty "$cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10313,8 +10131,8 @@ EOF eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { - func_quote_arg expand,pretty "$cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10788,13 +10606,12 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_arg pretty "$var_value" - relink_command="$var=$func_quote_arg_result; export $var; $relink_command" + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done - func_quote eval cd "`pwd`" - func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" - relink_command=$func_quote_arg_unquoted_result + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. @@ -11034,15 +10851,13 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_arg pretty,unquoted "$var_value" - relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. - func_quote eval cd "`pwd`" - relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - func_quote_arg pretty,unquoted "$relink_command" - relink_command=$func_quote_arg_unquoted_result + relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi diff --git a/lib/c-ares-1.33.1/config/missing b/lib/c-ares-1.34.4/config/missing similarity index 77% rename from lib/c-ares-1.33.1/config/missing rename to lib/c-ares-1.34.4/config/missing index 7e7d78ec52c..1fe1611f185 100755 --- a/lib/c-ares-1.33.1/config/missing +++ b/lib/c-ares-1.34.4/config/missing @@ -1,11 +1,9 @@ #! /bin/sh -# Common wrapper for a few potentially missing GNU and other programs. +# Common wrapper for a few potentially missing GNU programs. -scriptversion=2024-06-07.14; # UTC +scriptversion=2018-03-07.03; # UTC -# shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells - -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -56,20 +54,18 @@ Options: -v, --version output version information and exit Supported PROGRAM values: -aclocal autoconf autogen autoheader autom4te automake autoreconf -bison flex help2man lex makeinfo perl yacc + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. -Report bugs to . -GNU Automake home page: . -General help using GNU software: ." +Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing (GNU Automake) $scriptversion" + echo "missing $scriptversion (GNU Automake)" exit $? ;; @@ -112,7 +108,7 @@ gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in - aclocal|automake|autoreconf) + aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" @@ -127,9 +123,6 @@ program_details () echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; - *) - : - ;; esac } @@ -144,55 +137,48 @@ give_advice () printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" - autoheader_deps="'acconfig.h'" - automake_deps="'Makefile.am'" - aclocal_deps="'acinclude.m4'" case $normalized_program in - aclocal*) - echo "You should only need it if you modified $aclocal_deps or" - echo "$configure_deps." - ;; autoconf*) - echo "You should only need it if you modified $configure_deps." - ;; - autogen*) - echo "You should only need it if you modified a '.def' or '.tpl' file." - echo "You may want to install the GNU AutoGen package:" - echo "<$gnu_software_URL/autogen/>" + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' ;; autoheader*) - echo "You should only need it if you modified $autoheader_deps or" + echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." + program_details 'autoheader' ;; automake*) - echo "You should only need it if you modified $automake_deps or" + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." + program_details 'aclocal' ;; - autom4te*) + autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." - ;; - autoreconf*) - echo "You should only need it if you modified $aclocal_deps or" - echo "$automake_deps or $autoheader_deps or $automake_deps or" - echo "$configure_deps." + program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; - lex*|flex*) - echo "You should only need it if you modified a '.l' file." - echo "You may want to install the Fast Lexical Analyzer package:" - echo "<$flex_URL>" - ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." @@ -203,12 +189,6 @@ give_advice () echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; - perl*) - echo "You should only need it to run GNU Autoconf, GNU Automake, " - echo " assorted other tools, or if you modified a Perl source file." - echo "You may want to install the Perl 5 language interpreter:" - echo "<$perl_URL>" - ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" @@ -217,7 +197,6 @@ give_advice () echo "case some other package contains this missing '$1' program." ;; esac - program_details "$normalized_program" } give_advice "$1" | sed -e '1s/^/WARNING: /' \ diff --git a/lib/c-ares-1.33.1/config/test-driver b/lib/c-ares-1.34.4/config/test-driver similarity index 89% rename from lib/c-ares-1.33.1/config/test-driver rename to lib/c-ares-1.34.4/config/test-driver index dc38f623f43..be73b80adf9 100755 --- a/lib/c-ares-1.33.1/config/test-driver +++ b/lib/c-ares-1.34.4/config/test-driver @@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2024-06-19.01; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2024 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,16 +44,11 @@ print_usage () Usage: test-driver --test-name NAME --log-file PATH --trs-file PATH [--expect-failure {yes|no}] [--color-tests {yes|no}] - [--collect-skipped-logs {yes|no}] [--enable-hard-errors {yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name', '--log-file' and '--trs-file' options are mandatory. See the GNU Automake documentation for information. - -Report bugs to . -GNU Automake home page: . -General help using GNU software: . END } @@ -62,17 +57,15 @@ log_file= # Where to save the output of the test script. trs_file= # Where to save the metadata of the test run. expect_failure=no color_tests=no -collect_skipped_logs=yes enable_hard_errors=yes while test $# -gt 0; do case $1 in --help) print_usage; exit $?;; - --version) echo "test-driver (GNU Automake) $scriptversion"; exit $?;; + --version) echo "test-driver $scriptversion"; exit $?;; --test-name) test_name=$2; shift;; --log-file) log_file=$2; shift;; --trs-file) trs_file=$2; shift;; --color-tests) color_tests=$2; shift;; - --collect-skipped-logs) collect_skipped_logs=$2; shift;; --expect-failure) expect_failure=$2; shift;; --enable-hard-errors) enable_hard_errors=$2; shift;; --) shift; break;; @@ -128,7 +121,7 @@ fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; - 77:*) col=$blu res=SKIP recheck=no gcopy=$collect_skipped_logs;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; diff --git a/lib/c-ares-1.33.1/configure b/lib/c-ares-1.34.4/configure similarity index 91% rename from lib/c-ares-1.33.1/configure rename to lib/c-ares-1.34.4/configure index 74e9741fe6e..d02f117d2f0 100755 --- a/lib/c-ares-1.33.1/configure +++ b/lib/c-ares-1.34.4/configure @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.72 for c-ares 1.33.1. +# Generated by GNU Autoconf 2.71 for c-ares 1.34.4. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # @@ -17,6 +17,7 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh @@ -25,13 +26,12 @@ then : # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else case e in #( - e) case `(set -o) 2>/dev/null` in #( +else $as_nop + case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; -esac ;; esac fi @@ -103,7 +103,7 @@ IFS=$as_save_IFS ;; esac -# We did not find ourselves, most probably we were run as 'sh COMMAND' +# We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 @@ -133,14 +133,15 @@ case $- in # (((( esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed 'exec'. +# out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: @@ -148,13 +149,12 @@ then : # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else case e in #( - e) case \`(set -o) 2>/dev/null\` in #( +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; -esac ;; esac fi " @@ -172,9 +172,8 @@ as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : -else case e in #( - e) exitcode=1; echo positional parameters were not saved. ;; -esac +else \$as_nop + exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) @@ -196,15 +195,14 @@ test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes -else case e in #( - e) as_have_required=no ;; -esac +else $as_nop + as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : -else case e in #( - e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do @@ -237,13 +235,12 @@ IFS=$as_save_IFS if $as_found then : -else case e in #( - e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes -fi ;; -esac +fi fi @@ -265,7 +262,7 @@ case $- in # (((( esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed 'exec'. +# out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi @@ -285,8 +282,7 @@ $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 -fi ;; -esac +fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} @@ -325,6 +321,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -393,12 +397,11 @@ then : { eval $1+=\$2 }' -else case e in #( - e) as_fn_append () +else $as_nop + as_fn_append () { eval $1=\$$1\$2 - } ;; -esac + } fi # as_fn_append # as_fn_arith ARG... @@ -412,14 +415,21 @@ then : { as_val=$(( $* )) }' -else case e in #( - e) as_fn_arith () +else $as_nop + as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` - } ;; -esac + } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -493,8 +503,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits /[$]LINENO/= ' <$as_myself | sed ' - t clear - :clear s/[$]LINENO.*/&-/ t lineno b @@ -543,6 +551,7 @@ esac as_echo='printf %s\n' as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -554,9 +563,9 @@ if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: - # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. - # In both cases, we have to default to 'cp -pR'. + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then @@ -581,12 +590,10 @@ as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. -as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" -as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" -as_tr_sh="eval sed '$as_sed_sh'" # deprecated +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} @@ -614,8 +621,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='c-ares' PACKAGE_TARNAME='c-ares' -PACKAGE_VERSION='1.33.1' -PACKAGE_STRING='c-ares 1.33.1' +PACKAGE_VERSION='1.34.4' +PACKAGE_STRING='c-ares 1.34.4' PACKAGE_BUGREPORT='c-ares mailing list: http://lists.haxx.se/listinfo/c-ares' PACKAGE_URL='' @@ -652,7 +659,6 @@ ac_includes_default="\ #endif" ac_header_c_list= -enable_year2038=no ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS @@ -709,7 +715,6 @@ MANIFEST_TOOL RANLIB ac_ct_AR AR -FILECMD LN_S NM ac_ct_DUMPBIN @@ -731,8 +736,6 @@ LIBTOOL OBJDUMP DLLTOOL AS -am__xargs_n -am__rm_f_notfound AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V @@ -850,7 +853,7 @@ with_gcov enable_code_coverage enable_largefile enable_libgcc -enable_year2038 +enable_tests_crossbuild ' ac_precious_vars='build_alias host_alias @@ -981,7 +984,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: '$ac_useropt'" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1007,7 +1010,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: '$ac_useropt'" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1220,7 +1223,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: '$ac_useropt'" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1236,7 +1239,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: '$ac_useropt'" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1266,8 +1269,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error $? "unrecognized option: '$ac_option' -Try '$0 --help' for more information" + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1275,7 +1278,7 @@ Try '$0 --help' for more information" # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: '$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1325,7 +1328,7 @@ do as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done -# There might be people who depend on the old broken behavior: '$host' +# There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias @@ -1393,7 +1396,7 @@ if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi -ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` @@ -1421,7 +1424,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -'configure' configures c-ares 1.33.1 to adapt to many kinds of systems. +\`configure' configures c-ares 1.34.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1435,11 +1438,11 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print 'checking ...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for '--cache-file=config.cache' + -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or '..'] + --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX @@ -1447,10 +1450,10 @@ Installation directories: --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] -By default, 'make install' will install all the files in -'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify -an installation prefix other than '$ac_default_prefix' using '--prefix', -for instance '--prefix=\$HOME'. +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. For better control, use the options below. @@ -1492,7 +1495,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of c-ares 1.33.1:";; + short | recursive ) echo "Configuration of c-ares 1.34.4:";; esac cat <<\_ACEOF @@ -1523,7 +1526,8 @@ Optional Features: --enable-code-coverage Whether to enable code coverage support --disable-largefile omit support for large files --enable-libgcc use libgcc when linking - --enable-year2038 support timestamps after 2038 + --enable-tests-crossbuild + Enable test building even when cross building Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1566,7 +1570,7 @@ Some influential environment variables: GMOCK112_LIBS linker flags for GMOCK112, overriding pkg-config -Use these variables to override the choices made by 'configure' or to help +Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . @@ -1633,10 +1637,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -c-ares configure 1.33.1 -generated by GNU Autoconf 2.72 +c-ares configure 1.34.4 +generated by GNU Autoconf 2.71 -Copyright (C) 2023 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1675,12 +1679,11 @@ printf "%s\n" "$ac_try_echo"; } >&5 } && test -s conftest.$ac_objext then : ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 ;; -esac + ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval @@ -1699,8 +1702,8 @@ printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> @@ -1708,12 +1711,10 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" -else case e in #( - e) eval "$3=no" ;; -esac +else $as_nop + eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -1750,12 +1751,11 @@ printf "%s\n" "$ac_try_echo"; } >&5 } && test -s conftest.$ac_objext then : ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 ;; -esac + ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval @@ -1793,12 +1793,11 @@ printf "%s\n" "$ac_try_echo"; } >&5 } then : ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 ;; -esac + ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would @@ -1821,15 +1820,15 @@ printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (void); below. */ + which can conflict with char $2 (); below. */ #include #undef $2 @@ -1840,7 +1839,7 @@ else case e in #( #ifdef __cplusplus extern "C" #endif -char $2 (void); +char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ @@ -1859,13 +1858,11 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" -else case e in #( - e) eval "$3=no" ;; -esac +else $as_nop + eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext ;; -esac + conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -1901,12 +1898,11 @@ printf "%s\n" "$ac_try_echo"; } >&5 } then : ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 ;; -esac + ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval @@ -1944,12 +1940,11 @@ printf "%s\n" "$ac_try_echo"; } >&5 } then : ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 ;; -esac + ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would @@ -1988,12 +1983,11 @@ printf "%s\n" "$ac_try_echo"; } >&5 } then : ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 ;; -esac + ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval @@ -2012,20 +2006,18 @@ printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO" then : eval "$3=yes" -else case e in #( - e) eval "$3=no" ;; -esac +else $as_nop + eval "$3=no" fi -rm -f conftest.err conftest.i conftest.$ac_ext ;; -esac +rm -f conftest.err conftest.i conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -2047,8 +2039,8 @@ printf %s "checking whether $as_decl_name is declared... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else case e in #( - e) as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` +else $as_nop + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` eval ac_save_FLAGS=\$$6 as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2072,14 +2064,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" -else case e in #( - e) eval "$3=no" ;; -esac +else $as_nop + eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval $6=\$ac_save_FLAGS - ;; -esac + fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -2100,8 +2090,8 @@ printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else case e in #( - e) eval "$3=no" +else $as_nop + eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 @@ -2131,14 +2121,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else case e in #( - e) eval "$3=yes" ;; -esac +else $as_nop + eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -2159,8 +2147,8 @@ printf %s "checking for $2.$3... " >&6; } if eval test \${$4+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int @@ -2176,8 +2164,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int @@ -2193,15 +2181,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" -else case e in #( - e) eval "$4=no" ;; -esac +else $as_nop + eval "$4=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$4 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -2240,13 +2225,12 @@ printf "%s\n" "$ac_try_echo"; } >&5 test $ac_status = 0; }; } then : ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=$ac_status ;; -esac + ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno @@ -2277,8 +2261,8 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by c-ares $as_me 1.33.1, which was -generated by GNU Autoconf 2.72. Invocation command line was +It was created by c-ares $as_me 1.34.4, which was +generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -2524,10 +2508,10 @@ esac printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See 'config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2564,7 +2548,9 @@ struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (char **p, int i) +static char *e (p, i) + char **p; + int i; { return p[i]; } @@ -2578,21 +2564,6 @@ static char *f (char * (*g) (char **, int), char **p, ...) return s; } -/* C89 style stringification. */ -#define noexpand_stringify(a) #a -const char *stringified = noexpand_stringify(arbitrary+token=sequence); - -/* C89 style token pasting. Exercises some of the corner cases that - e.g. old MSVC gets wrong, but not very hard. */ -#define noexpand_concat(a,b) a##b -#define expand_concat(a,b) noexpand_concat(a,b) -extern int vA; -extern int vbee; -#define aye A -#define bee B -int *pvA = &expand_concat(v,aye); -int *pvbee = &noexpand_concat(v,bee); - /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated @@ -2620,19 +2591,16 @@ ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' -/* Does the compiler advertise C99 conformance? */ +// Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif -// See if C++-style comments work. - #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); -extern void free (void *); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare @@ -2682,6 +2650,7 @@ typedef const char *ccp; static inline int test_restrict (ccp restrict text) { + // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) @@ -2747,8 +2716,6 @@ ac_c_conftest_c99_main=' ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; - // Work around memory leak warnings. - free (ia); // Check named initializers. struct named_init ni = { @@ -2770,7 +2737,7 @@ ac_c_conftest_c99_main=' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' -/* Does the compiler advertise C11 conformance? */ +// Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif @@ -3179,9 +3146,8 @@ IFS=$as_save_IFS if $as_found then : -else case e in #( - e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; -esac +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi @@ -3209,12 +3175,12 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 -printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 -printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -3223,18 +3189,18 @@ printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 -printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 -printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 -printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 -printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. @@ -3250,11 +3216,11 @@ printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## @@ -3269,7 +3235,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -CARES_VERSION_INFO="20:1:18" +CARES_VERSION_INFO="21:3:19" @@ -3304,8 +3270,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3327,8 +3293,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3350,8 +3315,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then +else $as_nop + if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3373,8 +3338,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -3409,8 +3373,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3432,8 +3396,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3455,8 +3418,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no @@ -3495,8 +3458,7 @@ if test $ac_prog_rejected = yes; then ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3520,8 +3482,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3543,8 +3505,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3570,8 +3531,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then +else $as_nop + if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3593,8 +3554,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -3632,8 +3592,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3655,8 +3615,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3678,8 +3637,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then +else $as_nop + if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3701,8 +3660,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -3731,10 +3689,10 @@ fi fi -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See 'config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3806,8 +3764,8 @@ printf "%s\n" "$ac_try_echo"; } >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : - # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. -# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. @@ -3827,7 +3785,7 @@ do ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an '-o' + # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. @@ -3838,9 +3796,8 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else case e in #( - e) ac_file='' ;; -esac +else $as_nop + ac_file='' fi if test -z "$ac_file" then : @@ -3849,14 +3806,13 @@ printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See 'config.log' for more details" "$LINENO" 5; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } ;; -esac +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } @@ -3880,10 +3836,10 @@ printf "%s\n" "$ac_try_echo"; } >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : - # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) -# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will -# work properly (i.e., refer to 'conftest.exe'), while it won't with -# 'rm'. + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in @@ -3893,12 +3849,11 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else case e in #( - e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See 'config.log' for more details" "$LINENO" 5; } ;; -esac +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3914,8 +3869,6 @@ int main (void) { FILE *f = fopen ("conftest.out", "w"); - if (!f) - return 1; return ferror (f) || fclose (f) != 0; ; @@ -3955,27 +3908,26 @@ printf "%s\n" "$ac_try_echo"; } >&5 if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. -If you meant to cross compile, use '--host'. -See 'config.log' for more details" "$LINENO" 5; } +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } -rm -f conftest.$ac_ext conftest$ac_cv_exeext \ - conftest.o conftest.obj conftest.out +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4007,18 +3959,16 @@ then : break;; esac done -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See 'config.log' for more details" "$LINENO" 5; } ;; -esac +See \`config.log' for more details" "$LINENO" 5; } fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; -esac +rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } @@ -4029,8 +3979,8 @@ printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4047,14 +3997,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes -else case e in #( - e) ac_compiler_gnu=no ;; -esac +else $as_nop + ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } @@ -4072,8 +4020,8 @@ printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_save_c_werror_flag=$ac_c_werror_flag +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" @@ -4091,8 +4039,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes -else case e in #( - e) CFLAGS="" +else $as_nop + CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4107,8 +4055,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else case e in #( - e) ac_c_werror_flag=$ac_save_c_werror_flag +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4125,15 +4073,12 @@ if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag ;; -esac + ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } @@ -4160,8 +4105,8 @@ printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c11=no +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4178,28 +4123,25 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac +CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c11" = x +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" ;; -esac + CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 ;; -esac + ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno @@ -4209,8 +4151,8 @@ printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c99=no +else $as_nop + ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4227,28 +4169,25 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac +CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c99" = x +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" ;; -esac + CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 ;; -esac + ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno @@ -4258,8 +4197,8 @@ printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c89=no +else $as_nop + ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4276,28 +4215,25 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac +CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c89" = x +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" ;; -esac + CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 ;; -esac + ac_prog_cc_stdc=c89 fi fi @@ -4318,8 +4254,8 @@ printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4349,8 +4285,7 @@ _ACEOF fi done rm -f core conftest* - unset am_i ;; -esac + unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } @@ -4410,8 +4345,8 @@ printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } if test ${ac_cv_safe_to_define___extensions__+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 @@ -4427,12 +4362,10 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_safe_to_define___extensions__=yes -else case e in #( - e) ac_cv_safe_to_define___extensions__=no ;; -esac +else $as_nop + ac_cv_safe_to_define___extensions__=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } @@ -4442,8 +4375,8 @@ printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } if test ${ac_cv_should_define__xopen_source+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_should_define__xopen_source=no +else $as_nop + ac_cv_should_define__xopen_source=no if test $ac_cv_header_wchar_h = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4462,8 +4395,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE 500 @@ -4481,12 +4414,10 @@ if ac_fn_c_try_compile "$LINENO" then : ac_cv_should_define__xopen_source=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi ;; -esac +fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } @@ -4511,8 +4442,6 @@ printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h - printf "%s\n" "#define __STDC_WANT_IEC_60559_EXT__ 1" >>confdefs.h - printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h @@ -4532,9 +4461,8 @@ then : printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h -else case e in #( - e) MINIX= ;; -esac +else $as_nop + MINIX= fi if test $ac_cv_safe_to_define___extensions__ = yes then : @@ -4572,8 +4500,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CXX"; then +else $as_nop + if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -4595,8 +4523,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then @@ -4622,8 +4549,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CXX"; then +else $as_nop + if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -4645,8 +4572,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then @@ -4706,8 +4632,8 @@ printf %s "checking whether the compiler supports GNU C++... " >&6; } if test ${ac_cv_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4724,14 +4650,12 @@ _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes -else case e in #( - e) ac_compiler_gnu=no ;; -esac +else $as_nop + ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } @@ -4749,8 +4673,8 @@ printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag +else $as_nop + ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" @@ -4768,8 +4692,8 @@ _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes -else case e in #( - e) CXXFLAGS="" +else $as_nop + CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4784,8 +4708,8 @@ _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : -else case e in #( - e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag +else $as_nop + ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4802,15 +4726,12 @@ if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; -esac + ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } @@ -4834,11 +4755,11 @@ if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_cxx11+y} +if test ${ac_cv_prog_cxx_11+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cxx_cxx11=no +else $as_nop + ac_cv_prog_cxx_11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4855,39 +4776,36 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext -CXX=$ac_save_CXX ;; -esac +CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cxx_cxx11" = x +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; -esac + CXX="$CXX $ac_cv_prog_cxx_cxx11" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_prog_cxx_stdcxx=cxx11 ;; -esac + ac_prog_cxx_stdcxx=cxx11 fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_cxx98+y} +if test ${ac_cv_prog_cxx_98+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cxx_cxx98=no +else $as_nop + ac_cv_prog_cxx_98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4904,28 +4822,25 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext -CXX=$ac_save_CXX ;; -esac +CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cxx_cxx98" = x +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; -esac + CXX="$CXX $ac_cv_prog_cxx_cxx98" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 - ac_prog_cxx_stdcxx=cxx98 ;; -esac + ac_prog_cxx_stdcxx=cxx98 fi fi @@ -4953,17 +4868,17 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do if test x"$switch" = xMSVC; then switch=-std:c++${alternative} - cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx14_${switch}_MSVC" | sed "$as_sed_sh"` + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx14_${switch}_MSVC" | $as_tr_sh` else - cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx14_$switch" | sed "$as_sed_sh"` + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx14_$switch" | $as_tr_sh` fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features with $switch" >&5 printf %s "checking whether $CXX supports C++14 features with $switch... " >&6; } if eval test \${$cachevar+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_save_CXX="$CXX" +else $as_nop + ac_save_CXX="$CXX" CXX="$CXX $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4979,7 +4894,17 @@ else case e in #( // MSVC always sets __cplusplus to 199711L in older versions; newer versions // only set it correctly if /Zc:__cplusplus is specified as well as a // /std:c++NN switch: +// // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +// +// The value __cplusplus ought to have is available in _MSVC_LANG since +// Visual Studio 2015 Update 3: +// +// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros +// +// This was also the first MSVC version to support C++14 so we can't use the +// value of either __cplusplus or _MSVC_LANG to quickly rule out MSVC having +// C++11 or C++14 support, but we can check _MSVC_LANG for C++17 and later. #elif __cplusplus < 201103L && !defined _MSC_VER #error "This is not a C++11 compiler" @@ -5383,13 +5308,11 @@ _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : eval $cachevar=yes -else case e in #( - e) eval $cachevar=no ;; -esac +else $as_nop + eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CXX="$ac_save_CXX" ;; -esac + CXX="$ac_save_CXX" fi eval ac_res=\$$cachevar { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -5431,7 +5354,7 @@ printf "%s\n" "#define HAVE_CXX14 1" >>confdefs.h fi -am__api_version='1.17' +am__api_version='1.16' # Find a good install program. We prefer a C program (faster), @@ -5454,8 +5377,8 @@ if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 -else case e in #( - e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS @@ -5509,8 +5432,7 @@ esac IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir - ;; -esac + fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install @@ -5533,165 +5455,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether sleep supports fractional seconds" >&5 -printf %s "checking whether sleep supports fractional seconds... " >&6; } -if test ${am_cv_sleep_fractional_seconds+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if sleep 0.001 2>/dev/null -then : - am_cv_sleep_fractional_seconds=yes -else case e in #( - e) am_cv_sleep_fractional_seconds=no ;; -esac -fi - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_sleep_fractional_seconds" >&5 -printf "%s\n" "$am_cv_sleep_fractional_seconds" >&6; } - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking filesystem timestamp resolution" >&5 -printf %s "checking filesystem timestamp resolution... " >&6; } -if test ${am_cv_filesystem_timestamp_resolution+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) # Default to the worst case. -am_cv_filesystem_timestamp_resolution=2 - -# Only try to go finer than 1 sec if sleep can do it. -# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, -# - 1 sec is not much of a win compared to 2 sec, and -# - it takes 2 seconds to perform the test whether 1 sec works. -# -# Instead, just use the default 2s on platforms that have 1s resolution, -# accept the extra 1s delay when using $sleep in the Automake tests, in -# exchange for not incurring the 2s delay for running the test for all -# packages. -# -am_try_resolutions= -if test "$am_cv_sleep_fractional_seconds" = yes; then - # Even a millisecond often causes a bunch of false positives, - # so just try a hundredth of a second. The time saved between .001 and - # .01 is not terribly consequential. - am_try_resolutions="0.01 0.1 $am_try_resolutions" -fi - -# In order to catch current-generation FAT out, we must *modify* files -# that already exist; the *creation* timestamp is finer. Use names -# that make ls -t sort them differently when they have equal -# timestamps than when they have distinct timestamps, keeping -# in mind that ls -t prints the *newest* file first. -rm -f conftest.ts? -: > conftest.ts1 -: > conftest.ts2 -: > conftest.ts3 - -# Make sure ls -t actually works. Do 'set' in a subshell so we don't -# clobber the current shell's arguments. (Outer-level square brackets -# are removed by m4; they're present so that m4 does not expand -# ; be careful, easy to get confused.) -if ( - set X `ls -t conftest.ts[12]` && - { - test "$*" != "X conftest.ts1 conftest.ts2" || - test "$*" != "X conftest.ts2 conftest.ts1"; - } -); then :; else - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - printf "%s\n" ""Bad output from ls -t: \"`ls -t conftest.ts[12]`\""" >&5 - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "ls -t produces unexpected output. -Make sure there is not a broken ls alias in your environment. -See 'config.log' for more details" "$LINENO" 5; } -fi - -for am_try_res in $am_try_resolutions; do - # Any one fine-grained sleep might happen to cross the boundary - # between two values of a coarser actual resolution, but if we do - # two fine-grained sleeps in a row, at least one of them will fall - # entirely within a coarse interval. - echo alpha > conftest.ts1 - sleep $am_try_res - echo beta > conftest.ts2 - sleep $am_try_res - echo gamma > conftest.ts3 - - # We assume that 'ls -t' will make use of high-resolution - # timestamps if the operating system supports them at all. - if (set X `ls -t conftest.ts?` && - test "$2" = conftest.ts3 && - test "$3" = conftest.ts2 && - test "$4" = conftest.ts1); then - # - # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, - # because we don't need to test make. - make_ok=true - if test $am_try_res != 1; then - # But if we've succeeded so far with a subsecond resolution, we - # have one more thing to check: make. It can happen that - # everything else supports the subsecond mtimes, but make doesn't; - # notably on macOS, which ships make 3.81 from 2006 (the last one - # released under GPLv2). https://bugs.gnu.org/68808 - # - # We test $MAKE if it is defined in the environment, else "make". - # It might get overridden later, but our hope is that in practice - # it does not matter: it is the system "make" which is (by far) - # the most likely to be broken, whereas if the user overrides it, - # probably they did so with a better, or at least not worse, make. - # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html - # - # Create a Makefile (real tab character here): - rm -f conftest.mk - echo 'conftest.ts1: conftest.ts2' >conftest.mk - echo ' touch conftest.ts2' >>conftest.mk - # - # Now, running - # touch conftest.ts1; touch conftest.ts2; make - # should touch ts1 because ts2 is newer. This could happen by luck, - # but most often, it will fail if make's support is insufficient. So - # test for several consecutive successes. - # - # (We reuse conftest.ts[12] because we still want to modify existing - # files, not create new ones, per above.) - n=0 - make=${MAKE-make} - until test $n -eq 3; do - echo one > conftest.ts1 - sleep $am_try_res - echo two > conftest.ts2 # ts2 should now be newer than ts1 - if $make -f conftest.mk | grep 'up to date' >/dev/null; then - make_ok=false - break # out of $n loop - fi - n=`expr $n + 1` - done - fi - # - if $make_ok; then - # Everything we know to check worked out, so call this resolution good. - am_cv_filesystem_timestamp_resolution=$am_try_res - break # out of $am_try_res loop - fi - # Otherwise, we'll go on to check the next resolution. - fi -done -rm -f conftest.ts? -# (end _am_filesystem_timestamp_resolution) - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_filesystem_timestamp_resolution" >&5 -printf "%s\n" "$am_cv_filesystem_timestamp_resolution" >&6; } - -# This check should not be cached, as it may vary across builds of -# different projects. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory @@ -5712,45 +5475,49 @@ esac # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). -am_build_env_is_sane=no -am_has_slept=no -rm -f conftest.file -for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - test "$2" = conftest.file - ); then - am_build_env_is_sane=yes - break - fi - # Just in case. - sleep "$am_cv_filesystem_timestamp_resolution" - am_has_slept=yes -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_build_env_is_sane" >&5 -printf "%s\n" "$am_build_env_is_sane" >&6; } -if test "$am_build_env_is_sane" = no; then - as_fn_error $? "newly created file is older than distributed files! +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= -if test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1 -then : - -else case e in #( - e) ( sleep "$am_cv_filesystem_timestamp_resolution" ) & +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & am_sleep_pid=$! - ;; -esac fi rm -f conftest.file @@ -5761,7 +5528,7 @@ test "$program_prefix" != NONE && test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. -# By default was 's,x,x', remove it if useless. +# By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` @@ -5800,8 +5567,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$STRIP"; then +else $as_nop + if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5823,8 +5590,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then @@ -5846,8 +5612,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_STRIP"; then +else $as_nop + if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5869,8 +5635,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then @@ -5906,8 +5671,8 @@ if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 -else case e in #( - e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS @@ -5921,7 +5686,7 @@ do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ - *'BusyBox '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; @@ -5930,17 +5695,18 @@ do done done IFS=$as_save_IFS - ;; -esac + fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else - # As a last resort, use plain mkdir -p, - # in the hope it doesn't have the bugs of ancient mkdir. - MKDIR_P='mkdir -p' + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 @@ -5955,8 +5721,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$AWK"; then +else $as_nop + if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5978,8 +5744,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then @@ -6001,8 +5766,8 @@ ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat >conftest.make <<\_ACEOF +else $as_nop + cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' @@ -6014,8 +5779,7 @@ case `${MAKE-make} -f conftest.make 2>/dev/null` in *) eval ac_cv_prog_make_${ac_make}_set=no;; esac -rm -f conftest.make ;; -esac +rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -6100,21 +5864,25 @@ else fi -AM_DEFAULT_VERBOSITY=1 # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if printf "%s\n" 'TRUE=$(BAR$(V)) +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -6124,49 +5892,18 @@ am__doit: am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no -fi ;; -esac +fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } -AM_BACKSLASH='\' - -am__rm_f_notfound= -if (rm -f && rm -fr && rm -rf) 2>/dev/null -then : - -else case e in #( - e) am__rm_f_notfound='""' ;; -esac -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking xargs -n works" >&5 -printf %s "checking xargs -n works... " >&6; } -if test ${am_cv_xargs_n_works+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 -3" -then : - am_cv_xargs_n_works=yes -else case e in #( - e) am_cv_xargs_n_works=no ;; -esac -fi ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_xargs_n_works" >&5 -printf "%s\n" "$am_cv_xargs_n_works" >&6; } -if test "$am_cv_xargs_n_works" = yes -then : - am__xargs_n='xargs -n' -else case e in #( - e) am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "" "$am__xargs_n_arg"; done; }' - ;; -esac +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi +AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output @@ -6190,7 +5927,7 @@ fi # Define the identity of the package. PACKAGE='c-ares' - VERSION='1.33.1' + VERSION='1.34.4' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -6243,8 +5980,8 @@ printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up @@ -6331,7 +6068,7 @@ else case e in #( # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thus: + # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported @@ -6348,8 +6085,7 @@ else case e in #( else am_cv_CC_dependencies_compiler_type=none fi - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } @@ -6373,8 +6109,8 @@ printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CXX_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up @@ -6461,7 +6197,7 @@ else case e in #( # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thus: + # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported @@ -6478,8 +6214,7 @@ else case e in #( else am_cv_CXX_dependencies_compiler_type=none fi - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } @@ -6511,9 +6246,47 @@ fi +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi case `pwd` in *\ * | *\ *) @@ -6523,8 +6296,8 @@ esac -macro_version='2.4.7' -macro_revision='2.4.7' +macro_version='2.4.6' +macro_revision='2.4.6' @@ -6552,16 +6325,15 @@ printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_build_alias=$build_alias +else $as_nop + ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } @@ -6588,15 +6360,14 @@ printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test "x$host_alias" = x; then +else $as_nop + if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } @@ -6692,8 +6463,8 @@ printf %s "checking for a sed that does not truncate output... " >&6; } if test ${ac_cv_path_SED+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ +else $as_nop + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done @@ -6718,10 +6489,9 @@ do as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in #( +case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -#( *) ac_count=0 printf %s 0123456789 >"conftest.in" @@ -6756,8 +6526,7 @@ IFS=$as_save_IFS else ac_cv_path_SED=$SED fi - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 printf "%s\n" "$ac_cv_path_SED" >&6; } @@ -6782,8 +6551,8 @@ printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -z "$GREP"; then +else $as_nop + if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -6802,10 +6571,9 @@ do as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in #( +case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -#( *) ac_count=0 printf %s 0123456789 >"conftest.in" @@ -6840,8 +6608,7 @@ IFS=$as_save_IFS else ac_cv_path_GREP=$GREP fi - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } @@ -6853,8 +6620,8 @@ printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then @@ -6876,10 +6643,9 @@ do as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in #( +case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -#( *) ac_count=0 printf %s 0123456789 >"conftest.in" @@ -6915,23 +6681,20 @@ else ac_cv_path_EGREP=$EGREP fi - fi ;; -esac + fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" - EGREP_TRADITIONAL=$EGREP - ac_cv_path_EGREP_TRADITIONAL=$EGREP { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 printf %s "checking for fgrep... " >&6; } if test ${ac_cv_path_FGREP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 +else $as_nop + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then @@ -6953,10 +6716,9 @@ do as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in #( +case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -#( *) ac_count=0 printf %s 0123456789 >"conftest.in" @@ -6992,8 +6754,7 @@ else ac_cv_path_FGREP=$FGREP fi - fi ;; -esac + fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 printf "%s\n" "$ac_cv_path_FGREP" >&6; } @@ -7024,9 +6785,8 @@ test -z "$GREP" && GREP=grep if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else case e in #( - e) with_gnu_ld=no ;; -esac +else $as_nop + with_gnu_ld=no fi ac_prog=ld @@ -7071,8 +6831,8 @@ fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -z "$LD"; then +else $as_nop + if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs @@ -7095,8 +6855,7 @@ else case e in #( IFS=$lt_save_ifs else lt_cv_path_LD=$LD # Let the user override the test with a path. -fi ;; -esac +fi fi LD=$lt_cv_path_LD @@ -7113,8 +6872,8 @@ printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 -else case e in #( - e) # I'd rather use --version here, but apparently some GNU lds only accept -v. +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &1 &5 @@ -7142,8 +6900,8 @@ printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test ${lt_cv_path_NM+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$NM"; then +else $as_nop + if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else @@ -7167,13 +6925,13 @@ else mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) - case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 @@ -7190,8 +6948,7 @@ else IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} -fi ;; -esac +fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 printf "%s\n" "$lt_cv_path_NM" >&6; } @@ -7212,8 +6969,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DUMPBIN+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$DUMPBIN"; then +else $as_nop + if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -7235,8 +6992,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then @@ -7262,8 +7018,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DUMPBIN+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_DUMPBIN"; then +else $as_nop + if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -7285,8 +7041,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then @@ -7314,7 +7069,7 @@ esac fi fi - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; @@ -7340,8 +7095,8 @@ printf %s "checking the name lister ($NM) interface... " >&6; } if test ${lt_cv_nm_interface+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_nm_interface="BSD nm" +else $as_nop + lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) @@ -7354,8 +7109,7 @@ else case e in #( if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi - rm -f conftest* ;; -esac + rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 printf "%s\n" "$lt_cv_nm_interface" >&6; } @@ -7377,8 +7131,8 @@ printf %s "checking the maximum length of command line arguments... " >&6; } if test ${lt_cv_sys_max_cmd_len+y} then : printf %s "(cached) " >&6 -else case e in #( - e) i=0 +else $as_nop + i=0 teststring=ABCD case $build_os in @@ -7419,7 +7173,7 @@ else case e in #( lt_cv_sys_max_cmd_len=8192; ;; - bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + bitrig* | darwin* | dragonfly* | freebsd* | 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` @@ -7462,7 +7216,7 @@ else case e in #( sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'` + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi @@ -7500,8 +7254,7 @@ else case e in #( fi ;; esac - ;; -esac + fi if test -n "$lt_cv_sys_max_cmd_len"; then @@ -7558,8 +7311,8 @@ printf %s "checking how to convert $build file names to $host format... " >&6; } if test ${lt_cv_to_host_file_cmd+y} then : printf %s "(cached) " >&6 -else case e in #( - e) case $host in +else $as_nop + case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys @@ -7590,8 +7343,7 @@ else case e in #( lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac - ;; -esac + fi to_host_file_cmd=$lt_cv_to_host_file_cmd @@ -7607,8 +7359,8 @@ printf %s "checking how to convert $build file names to toolchain format... " >& if test ${lt_cv_to_tool_file_cmd+y} then : printf %s "(cached) " >&6 -else case e in #( - e) #assume ordinary cross tools, or native build. +else $as_nop + #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) @@ -7619,8 +7371,7 @@ case $host in esac ;; esac - ;; -esac + fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd @@ -7636,9 +7387,8 @@ printf %s "checking for $LD option to reload object files... " >&6; } if test ${lt_cv_ld_reload_flag+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_ld_reload_flag='-r' ;; -esac +else $as_nop + lt_cv_ld_reload_flag='-r' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } @@ -7671,116 +7421,6 @@ esac -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. -set dummy ${ac_tool_prefix}file; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_FILECMD+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$FILECMD"; then - ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_FILECMD="${ac_tool_prefix}file" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -FILECMD=$ac_cv_prog_FILECMD -if test -n "$FILECMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 -printf "%s\n" "$FILECMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_FILECMD"; then - ac_ct_FILECMD=$FILECMD - # Extract the first word of "file", so it can be a program name with args. -set dummy file; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_FILECMD+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_FILECMD"; then - ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_FILECMD="file" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD -if test -n "$ac_ct_FILECMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 -printf "%s\n" "$ac_ct_FILECMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_FILECMD" = x; then - FILECMD=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - FILECMD=$ac_ct_FILECMD - fi -else - FILECMD="$ac_cv_prog_FILECMD" -fi - - - - - - - if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 @@ -7789,8 +7429,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OBJDUMP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$OBJDUMP"; then +else $as_nop + if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -7812,8 +7452,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then @@ -7835,8 +7474,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OBJDUMP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_OBJDUMP"; then +else $as_nop + if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -7858,8 +7497,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then @@ -7897,8 +7535,8 @@ printf %s "checking how to recognize dependent libraries... " >&6; } if test ${lt_cv_deplibs_check_method+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_file_magic_cmd='$MAGIC_CMD' +else $as_nop + lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support @@ -7923,7 +7561,7 @@ beos*) bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='$FILECMD -L' + lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; @@ -7957,14 +7595,14 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | dragonfly* | midnightbsd*) +freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac @@ -7978,7 +7616,7 @@ haiku*) ;; hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' @@ -8015,7 +7653,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else @@ -8025,7 +7663,7 @@ netbsd*) newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; @@ -8091,8 +7729,7 @@ os2*) lt_cv_deplibs_check_method=pass_all ;; esac - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } @@ -8144,8 +7781,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DLLTOOL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$DLLTOOL"; then +else $as_nop + if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -8167,8 +7804,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then @@ -8190,8 +7826,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DLLTOOL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_DLLTOOL"; then +else $as_nop + if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -8213,8 +7849,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then @@ -8253,8 +7888,8 @@ printf %s "checking how to associate runtime and link libraries... " >&6; } if test ${lt_cv_sharedlib_from_linklib_cmd+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_sharedlib_from_linklib_cmd='unknown' +else $as_nop + lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) @@ -8274,8 +7909,7 @@ cygwin* | mingw* | pw32* | cegcc*) lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } @@ -8298,8 +7932,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$AR"; then +else $as_nop + if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -8321,8 +7955,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then @@ -8348,8 +7981,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_AR"; then +else $as_nop + if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -8371,8 +8004,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then @@ -8401,29 +8033,13 @@ esac fi : ${AR=ar} +: ${AR_FLAGS=cr} -# 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 -# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS -# variable obsoleted/removed. - -test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} -lt_ar_flags=$AR_FLAGS - - - - - - -# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override -# by AR_FLAGS because that was never working and AR_FLAGS is about to die. - @@ -8434,8 +8050,8 @@ printf %s "checking for archiver @FILE support... " >&6; } if test ${lt_cv_ar_at_file+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_ar_at_file=no +else $as_nop + lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8472,8 +8088,7 @@ then : fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 printf "%s\n" "$lt_cv_ar_at_file" >&6; } @@ -8498,8 +8113,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$STRIP"; then +else $as_nop + if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -8521,8 +8136,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then @@ -8544,8 +8158,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_STRIP"; then +else $as_nop + if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -8567,8 +8181,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then @@ -8609,8 +8222,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$RANLIB"; then +else $as_nop + if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -8632,8 +8245,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then @@ -8655,8 +8267,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_RANLIB"; then +else $as_nop + if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -8678,8 +8290,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then @@ -8790,8 +8401,8 @@ printf %s "checking command to parse $NM output from $compiler object... " >&6; if test ${lt_cv_sys_global_symbol_pipe+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] @@ -8845,7 +8456,7 @@ esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" @@ -8863,20 +8474,20 @@ fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ @@ -8900,7 +8511,7 @@ for ac_symprfx in "" "_"; do if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++ or ICC, + # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ @@ -8918,9 +8529,9 @@ for ac_symprfx in "" "_"; do " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else - lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -8946,11 +8557,8 @@ _LT_EOF test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -9046,8 +8654,7 @@ _LT_EOF lt_cv_sys_global_symbol_pipe= fi done - ;; -esac + fi if test -z "$lt_cv_sys_global_symbol_pipe"; then @@ -9111,9 +8718,8 @@ printf %s "checking for sysroot... " >&6; } if test ${with_sysroot+y} then : withval=$with_sysroot; -else case e in #( - e) with_sysroot=no ;; -esac +else $as_nop + with_sysroot=no fi @@ -9125,7 +8731,7 @@ case $with_sysroot in #( fi ;; #( /*) - lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( @@ -9148,8 +8754,8 @@ printf %s "checking for a working dd... " >&6; } if test ${ac_cv_path_lt_DD+y} then : printf %s "(cached) " >&6 -else case e in #( - e) printf 0123456789abcdef0123456789abcdef >conftest.i +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then @@ -9185,8 +8791,7 @@ else ac_cv_path_lt_DD=$lt_DD fi -rm -f conftest.i conftest2.i conftest.out ;; -esac +rm -f conftest.i conftest2.i conftest.out fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 printf "%s\n" "$ac_cv_path_lt_DD" >&6; } @@ -9197,8 +8802,8 @@ printf %s "checking how to truncate binary pipes... " >&6; } if test ${lt_cv_truncate_bin+y} then : printf %s "(cached) " >&6 -else case e in #( - e) printf 0123456789abcdef0123456789abcdef >conftest.i +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then @@ -9206,8 +8811,7 @@ if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; the && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out -test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" ;; -esac +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 printf "%s\n" "$lt_cv_truncate_bin" >&6; } @@ -9252,7 +8856,7 @@ ia64-*-hpux*) ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; @@ -9273,7 +8877,7 @@ ia64-*-hpux*) printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; @@ -9285,7 +8889,7 @@ ia64-*-hpux*) ;; esac else - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; @@ -9311,7 +8915,7 @@ mips64*-*linux*) printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; @@ -9319,7 +8923,7 @@ mips64*-*linux*) emul="${emul}64" ;; esac - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; @@ -9327,7 +8931,7 @@ mips64*-*linux*) emul="${emul}ltsmip" ;; esac - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; @@ -9351,14 +8955,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - case `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; @@ -9417,8 +9021,8 @@ printf %s "checking whether the C compiler needs -belf... " >&6; } if test ${lt_cv_cc_needs_belf+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_ext=c +else $as_nop + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' @@ -9438,9 +9042,8 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_cc_needs_belf=yes -else case e in #( - e) lt_cv_cc_needs_belf=no ;; -esac +else $as_nop + lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext @@ -9449,8 +9052,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } @@ -9468,7 +9070,7 @@ printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) @@ -9508,8 +9110,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$MANIFEST_TOOL"; then +else $as_nop + if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9531,8 +9133,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then @@ -9554,8 +9155,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_MANIFEST_TOOL"; then +else $as_nop + if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9577,8 +9178,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then @@ -9610,16 +9210,15 @@ printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if test ${lt_cv_path_mainfest_tool+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_path_mainfest_tool=no +else $as_nop + lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi - rm -f conftest* ;; -esac + rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } @@ -9642,8 +9241,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DSYMUTIL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$DSYMUTIL"; then +else $as_nop + if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9665,8 +9264,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then @@ -9688,8 +9286,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_DSYMUTIL"; then +else $as_nop + if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9711,8 +9309,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then @@ -9746,8 +9343,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_NMEDIT+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$NMEDIT"; then +else $as_nop + if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9769,8 +9366,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then @@ -9792,8 +9388,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_NMEDIT+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_NMEDIT"; then +else $as_nop + if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9815,8 +9411,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then @@ -9850,8 +9445,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LIPO+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$LIPO"; then +else $as_nop + if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9873,8 +9468,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then @@ -9896,8 +9490,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_LIPO+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_LIPO"; then +else $as_nop + if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9919,8 +9513,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then @@ -9954,8 +9547,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$OTOOL"; then +else $as_nop + if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9977,8 +9570,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then @@ -10000,8 +9592,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_OTOOL"; then +else $as_nop + if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10023,8 +9615,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then @@ -10058,8 +9649,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL64+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$OTOOL64"; then +else $as_nop + if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10081,8 +9672,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then @@ -10104,8 +9694,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL64+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_OTOOL64"; then +else $as_nop + if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10127,8 +9717,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then @@ -10185,8 +9774,8 @@ printf %s "checking for -single_module linker flag... " >&6; } if test ${lt_cv_apple_cc_single_mod+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_apple_cc_single_mod=no +else $as_nop + lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE @@ -10212,8 +9801,7 @@ else case e in #( fi rm -rf libconftest.dylib* rm -f conftest.* - fi ;; -esac + fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } @@ -10223,8 +9811,8 @@ printf %s "checking for -exported_symbols_list linker flag... " >&6; } if test ${lt_cv_ld_exported_symbols_list+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_ld_exported_symbols_list=no +else $as_nop + lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" @@ -10242,15 +9830,13 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_ld_exported_symbols_list=yes -else case e in #( - e) lt_cv_ld_exported_symbols_list=no ;; -esac +else $as_nop + lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } @@ -10260,15 +9846,15 @@ printf %s "checking for -force_load linker flag... " >&6; } if test ${lt_cv_ld_force_load+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_ld_force_load=no +else $as_nop + lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 - $AR $AR_FLAGS libconftest.a conftest.o 2>&5 + echo "$AR cr libconftest.a conftest.o" >&5 + $AR cr libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF @@ -10286,8 +9872,7 @@ _LT_EOF fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 printf "%s\n" "$lt_cv_ld_force_load" >&6; } @@ -10296,12 +9881,17 @@ printf "%s\n" "$lt_cv_ld_force_load" >&6; } _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) - case $MACOSX_DEPLOYMENT_TARGET,$host in - 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' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[912]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[012][,.]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*|11.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac @@ -10391,8 +9981,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AS+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$AS"; then +else $as_nop + if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10414,8 +10004,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then @@ -10437,8 +10026,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AS+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_AS"; then +else $as_nop + if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10460,8 +10049,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then @@ -10495,8 +10083,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DLLTOOL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$DLLTOOL"; then +else $as_nop + if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10518,8 +10106,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then @@ -10541,8 +10128,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DLLTOOL+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_DLLTOOL"; then +else $as_nop + if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10564,8 +10151,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then @@ -10599,8 +10185,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OBJDUMP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$OBJDUMP"; then +else $as_nop + if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10622,8 +10208,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then @@ -10645,8 +10230,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OBJDUMP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_OBJDUMP"; then +else $as_nop + if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10668,8 +10253,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then @@ -10742,9 +10326,8 @@ then : IFS=$lt_save_ifs ;; esac -else case e in #( - e) enable_shared=yes ;; -esac +else $as_nop + enable_shared=yes fi @@ -10775,9 +10358,8 @@ then : IFS=$lt_save_ifs ;; esac -else case e in #( - e) enable_static=yes ;; -esac +else $as_nop + enable_static=yes fi @@ -10808,9 +10390,8 @@ then : IFS=$lt_save_ifs ;; esac -else case e in #( - e) pic_mode=default ;; -esac +else $as_nop + pic_mode=default fi @@ -10840,9 +10421,8 @@ then : IFS=$lt_save_ifs ;; esac -else case e in #( - e) enable_fast_install=yes ;; -esac +else $as_nop + enable_fast_install=yes fi @@ -10869,17 +10449,15 @@ then : ;; esac lt_cv_with_aix_soname=$with_aix_soname -else case e in #( - e) if test ${lt_cv_with_aix_soname+y} +else $as_nop + if test ${lt_cv_with_aix_soname+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_with_aix_soname=aix ;; -esac +else $as_nop + lt_cv_with_aix_soname=aix fi - with_aix_soname=$lt_cv_with_aix_soname ;; -esac + with_aix_soname=$lt_cv_with_aix_soname fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 @@ -10970,8 +10548,8 @@ printf %s "checking for objdir... " >&6; } if test ${lt_cv_objdir+y} then : printf %s "(cached) " >&6 -else case e in #( - e) rm -f .libs 2>/dev/null +else $as_nop + rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs @@ -10979,8 +10557,7 @@ else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi -rmdir .libs 2>/dev/null ;; -esac +rmdir .libs 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 printf "%s\n" "$lt_cv_objdir" >&6; } @@ -11011,8 +10588,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC and -# ICC, which need '.lib'). +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld @@ -11041,8 +10618,8 @@ printf %s "checking for ${ac_tool_prefix}file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 -else case e in #( - e) case $MAGIC_CMD in +else $as_nop + case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; @@ -11085,7 +10662,6 @@ _LT_EOF IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; -esac ;; esac fi @@ -11109,8 +10685,8 @@ printf %s "checking for file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 -else case e in #( - e) case $MAGIC_CMD in +else $as_nop + case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; @@ -11153,7 +10729,6 @@ _LT_EOF IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; -esac ;; esac fi @@ -11253,8 +10828,8 @@ printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test ${lt_cv_prog_compiler_rtti_exceptions+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_rtti_exceptions=no +else $as_nop + lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment @@ -11282,8 +10857,7 @@ else case e in #( fi fi $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } @@ -11483,6 +11057,12 @@ lt_prog_compiler_static= lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -11527,7 +11107,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-qstaticlink' ;; *) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' @@ -11648,9 +11228,8 @@ printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_pic=$lt_prog_compiler_pic ;; -esac +else $as_nop + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } @@ -11665,8 +11244,8 @@ printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; if test ${lt_cv_prog_compiler_pic_works+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_pic_works=no +else $as_nop + lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment @@ -11694,8 +11273,7 @@ else case e in #( fi fi $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } @@ -11731,8 +11309,8 @@ printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; if test ${lt_cv_prog_compiler_static_works+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_static_works=no +else $as_nop + lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext @@ -11753,8 +11331,7 @@ else case e in #( fi $RM -r conftest* LDFLAGS=$save_LDFLAGS - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } @@ -11776,8 +11353,8 @@ printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_c_o=no +else $as_nop + lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest @@ -11817,8 +11394,7 @@ else case e in #( cd .. $RM -r conftest $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } @@ -11833,8 +11409,8 @@ printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_c_o=no +else $as_nop + lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest @@ -11874,8 +11450,7 @@ else case e in #( cd .. $RM -r conftest $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } @@ -11955,20 +11530,23 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time + # FIXME: the MSVC++ 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. + # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) + # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; esac ld_shlibs=yes @@ -12015,7 +11593,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries whole_archive_flag_spec= fi supports_anon_versioning=no - case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... @@ -12127,7 +11705,6 @@ _LT_EOF emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes - file_list_spec='@' ;; interix[3-9]*) @@ -12142,7 +11719,7 @@ _LT_EOF # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) @@ -12185,7 +11762,7 @@ _LT_EOF compiler_needs_object=yes ;; esac - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes @@ -12197,7 +11774,7 @@ _LT_EOF if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi @@ -12213,7 +11790,7 @@ _LT_EOF archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi @@ -12224,7 +11801,7 @@ _LT_EOF fi ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -12345,7 +11922,7 @@ _LT_EOF if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no @@ -12470,8 +12047,8 @@ else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -12503,8 +12080,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi - ;; -esac + fi aix_libpath=$lt_cv_aix_libpath_ @@ -12526,8 +12102,8 @@ else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -12559,8 +12135,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi - ;; -esac + fi aix_libpath=$lt_cv_aix_libpath_ @@ -12618,12 +12193,12 @@ fi cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using - # Microsoft Visual C++ or Intel C++ Compiler. + # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl* | icl*) - # Native MSVC or ICC + cl*) + # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes @@ -12664,7 +12239,7 @@ fi fi' ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. @@ -12705,8 +12280,8 @@ fi output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no @@ -12740,7 +12315,7 @@ fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -12811,8 +12386,8 @@ printf %s "checking if $CC understands -b... " >&6; } if test ${lt_cv_prog_compiler__b+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler__b=no +else $as_nop + lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext @@ -12833,8 +12408,7 @@ else case e in #( fi $RM -r conftest* LDFLAGS=$save_LDFLAGS - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } @@ -12882,8 +12456,8 @@ printf %s "checking whether the $host_os linker accepts -exported_symbol... " >& if test ${lt_cv_irix_exported_symbol+y} then : printf %s "(cached) " >&6 -else case e in #( - e) save_LDFLAGS=$LDFLAGS +else $as_nop + save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -12892,20 +12466,19 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_irix_exported_symbol=yes -else case e in #( - e) lt_cv_irix_exported_symbol=no ;; -esac +else $as_nop + lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS ;; -esac + LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi + link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' @@ -12927,7 +12500,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -12994,7 +12567,6 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes - file_list_spec='@' ;; osf3*) @@ -13225,8 +12797,8 @@ printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc+y} then : printf %s "(cached) " >&6 -else case e in #( - e) $RM conftest* +else $as_nop + $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 @@ -13262,8 +12834,7 @@ else case e in #( cat conftest.err 1>&5 fi $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } @@ -13688,7 +13259,7 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; @@ -13698,14 +13269,14 @@ cygwin* | mingw* | pw32* | cegcc*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; - *,cl* | *,icl*) - # Native MSVC or ICC + *,cl*) + # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -13724,7 +13295,7 @@ cygwin* | mingw* | pw32* | cegcc*) done IFS=$lt_save_ifs # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form @@ -13761,7 +13332,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -13794,7 +13365,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly* | midnightbsd*) +freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -13990,8 +13561,8 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_shlibpath_overrides_runpath=no +else $as_nop + lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ @@ -14018,8 +13589,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir - ;; -esac + fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath @@ -14049,6 +13619,18 @@ fi dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -14444,22 +14026,16 @@ printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_check_lib_save_LIBS=$LIBS +else $as_nop + ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (void); + builtin and then its argument prototype would still apply. */ +char dlopen (); int main (void) { @@ -14471,27 +14047,24 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes -else case e in #( - e) ac_cv_lib_dl_dlopen=no ;; -esac +else $as_nop + ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; -esac +LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else case e in #( - e) +else $as_nop + lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes - ;; -esac + fi ;; @@ -14509,28 +14082,22 @@ fi if test "x$ac_cv_func_shl_load" = xyes then : lt_cv_dlopen=shl_load -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 printf %s "checking for shl_load in -ldld... " >&6; } if test ${ac_cv_lib_dld_shl_load+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_check_lib_save_LIBS=$LIBS +else $as_nop + ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (void); + builtin and then its argument prototype would still apply. */ +char shl_load (); int main (void) { @@ -14542,47 +14109,39 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_shl_load=yes -else case e in #( - e) ac_cv_lib_dld_shl_load=no ;; -esac +else $as_nop + ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; -esac +LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld -else case e in #( - e) ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +else $as_nop + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes then : lt_cv_dlopen=dlopen -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_check_lib_save_LIBS=$LIBS +else $as_nop + ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (void); + builtin and then its argument prototype would still apply. */ +char dlopen (); int main (void) { @@ -14594,42 +14153,34 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes -else case e in #( - e) ac_cv_lib_dl_dlopen=no ;; -esac +else $as_nop + ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; -esac +LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 printf %s "checking for dlopen in -lsvld... " >&6; } if test ${ac_cv_lib_svld_dlopen+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_check_lib_save_LIBS=$LIBS +else $as_nop + ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (void); + builtin and then its argument prototype would still apply. */ +char dlopen (); int main (void) { @@ -14641,42 +14192,34 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_svld_dlopen=yes -else case e in #( - e) ac_cv_lib_svld_dlopen=no ;; -esac +else $as_nop + ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; -esac +LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 printf %s "checking for dld_link in -ldld... " >&6; } if test ${ac_cv_lib_dld_dld_link+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_check_lib_save_LIBS=$LIBS +else $as_nop + ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (void); + builtin and then its argument prototype would still apply. */ +char dld_link (); int main (void) { @@ -14688,14 +14231,12 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_dld_link=yes -else case e in #( - e) ac_cv_lib_dld_dld_link=no ;; -esac +else $as_nop + ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; -esac +LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } @@ -14704,24 +14245,19 @@ then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi - ;; -esac + fi - ;; -esac + fi - ;; -esac + fi - ;; -esac + fi - ;; -esac + fi ;; @@ -14749,8 +14285,8 @@ printf %s "checking whether a program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test yes = "$cross_compiling"; then : +else $as_nop + if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 @@ -14844,8 +14380,7 @@ _LT_EOF fi rm -fr conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 printf "%s\n" "$lt_cv_dlopen_self" >&6; } @@ -14857,8 +14392,8 @@ printf %s "checking whether a statically linked program can dlopen itself... " > if test ${lt_cv_dlopen_self_static+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test yes = "$cross_compiling"; then : +else $as_nop + if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 @@ -14952,8 +14487,7 @@ _LT_EOF fi rm -fr conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } @@ -14996,41 +14530,30 @@ striplib= old_striplib= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 printf %s "checking whether stripping libraries is possible... " >&6; } -if test -z "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -else - if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - else - case $host_os in - darwin*) - # FIXME - insert some real tests, host_os isn't really good enough +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - ;; - freebsd*) - if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fi - ;; - *) + else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - ;; - esac - fi + fi + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; + esac fi @@ -15111,8 +14634,8 @@ if test -z "$CXXCPP"; then if test ${ac_cv_prog_CXXCPP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) # Double quotes because $CXX needs to be expanded +else $as_nop + # Double quotes because $CXX needs to be expanded for CXXCPP in "$CXX -E" cpp /lib/cpp do ac_preproc_ok=false @@ -15130,10 +14653,9 @@ _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : -else case e in #( - e) # Broken: fails on valid input. -continue ;; -esac +else $as_nop + # Broken: fails on valid input. +continue fi rm -f conftest.err conftest.i conftest.$ac_ext @@ -15147,16 +14669,15 @@ if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue -else case e in #( - e) # Passes both tests. +else $as_nop + # Passes both tests. ac_preproc_ok=: -break ;; -esac +break fi rm -f conftest.err conftest.i conftest.$ac_ext done -# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : @@ -15165,8 +14686,7 @@ fi done ac_cv_prog_CXXCPP=$CXXCPP - ;; -esac + fi CXXCPP=$ac_cv_prog_CXXCPP else @@ -15189,10 +14709,9 @@ _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : -else case e in #( - e) # Broken: fails on valid input. -continue ;; -esac +else $as_nop + # Broken: fails on valid input. +continue fi rm -f conftest.err conftest.i conftest.$ac_ext @@ -15206,26 +14725,24 @@ if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue -else case e in #( - e) # Passes both tests. +else $as_nop + # Passes both tests. ac_preproc_ok=: -break ;; -esac +break fi rm -f conftest.err conftest.i conftest.$ac_ext done -# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : -else case e in #( - e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See 'config.log' for more details" "$LINENO" 5; } ;; -esac +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -15362,9 +14879,8 @@ cc_basename=$func_cc_basename_result if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else case e in #( - e) with_gnu_ld=no ;; -esac +else $as_nop + with_gnu_ld=no fi ac_prog=ld @@ -15409,8 +14925,8 @@ fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -z "$LD"; then +else $as_nop + if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs @@ -15433,8 +14949,7 @@ else case e in #( IFS=$lt_save_ifs else lt_cv_path_LD=$LD # Let the user override the test with a path. -fi ;; -esac +fi fi LD=$lt_cv_path_LD @@ -15451,8 +14966,8 @@ printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 -else case e in #( - e) # I'd rather use --version here, but apparently some GNU lds only accept -v. +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &1 &5 @@ -15509,7 +15023,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld # 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 @@ -15660,8 +15174,8 @@ else if test ${lt_cv_aix_libpath__CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -15693,8 +15207,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi - ;; -esac + fi aix_libpath=$lt_cv_aix_libpath__CXX @@ -15717,8 +15230,8 @@ else if test ${lt_cv_aix_libpath__CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -15750,8 +15263,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi - ;; -esac + fi aix_libpath=$lt_cv_aix_libpath__CXX @@ -15811,8 +15323,8 @@ fi cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl* | ,icl* | no,icl*) - # Native MSVC or ICC + ,cl* | no,cl*) + # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' @@ -15903,11 +15415,11 @@ fi output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds_CXX="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" - archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else @@ -15942,7 +15454,6 @@ fi emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes - file_list_spec_CXX='@' ;; dgux*) @@ -15973,7 +15484,7 @@ fi archive_cmds_need_lc_CXX=no ;; - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes @@ -16008,7 +15519,7 @@ fi # 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 @@ -16073,7 +15584,7 @@ fi # 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 @@ -16110,7 +15621,7 @@ fi # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in @@ -16250,13 +15761,13 @@ fi archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' @@ -16412,7 +15923,7 @@ fi # 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 @@ -16496,7 +16007,7 @@ fi # 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. @@ -16507,7 +16018,7 @@ fi # 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 hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' @@ -16913,7 +16424,7 @@ lt_prog_compiler_static_CXX= ;; esac ;; - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -16996,7 +16507,7 @@ lt_prog_compiler_static_CXX= lt_prog_compiler_static_CXX='-qstaticlink' ;; *) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' @@ -17020,7 +16531,7 @@ lt_prog_compiler_static_CXX= ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -17123,9 +16634,8 @@ printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX ;; -esac +else $as_nop + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } @@ -17140,8 +16650,8 @@ printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " > if test ${lt_cv_prog_compiler_pic_works_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_pic_works_CXX=no +else $as_nop + lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment @@ -17169,8 +16679,7 @@ else case e in #( fi fi $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } @@ -17200,8 +16709,8 @@ printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; if test ${lt_cv_prog_compiler_static_works_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_static_works_CXX=no +else $as_nop + lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext @@ -17222,8 +16731,7 @@ else case e in #( fi $RM -r conftest* LDFLAGS=$save_LDFLAGS - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } @@ -17242,8 +16750,8 @@ printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_c_o_CXX=no +else $as_nop + lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest @@ -17283,8 +16791,7 @@ else case e in #( cd .. $RM -r conftest $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } @@ -17296,8 +16803,8 @@ printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_prog_compiler_c_o_CXX=no +else $as_nop + lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest @@ -17337,8 +16844,7 @@ else case e in #( cd .. $RM -r conftest $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } @@ -17388,7 +16894,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) @@ -17396,7 +16902,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries ;; cygwin* | mingw* | cegcc*) case $cc_basename in - cl* | icl*) + cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) @@ -17405,6 +16911,9 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries ;; esac ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs_CXX=no + ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; @@ -17443,8 +16952,8 @@ printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) $RM conftest* +else $as_nop + $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 @@ -17480,8 +16989,7 @@ else case e in #( cat conftest.err 1>&5 fi $RM conftest* - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } @@ -17745,7 +17253,7 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) @@ -17754,14 +17262,14 @@ cygwin* | mingw* | pw32* | cegcc*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; - *,cl* | *,icl*) - # Native MSVC or ICC + *,cl*) + # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -17780,7 +17288,7 @@ cygwin* | mingw* | pw32* | cegcc*) done IFS=$lt_save_ifs # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form @@ -17817,7 +17325,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -17849,7 +17357,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly* | midnightbsd*) +freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -18045,8 +17553,8 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 -else case e in #( - e) lt_cv_shlibpath_overrides_runpath=no +else $as_nop + lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ @@ -18073,8 +17581,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir - ;; -esac + fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath @@ -18104,6 +17611,18 @@ fi dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -18472,8 +17991,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -18495,8 +18014,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -18518,8 +18036,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then +else $as_nop + if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -18541,8 +18059,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -18577,8 +18094,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -18600,8 +18117,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -18623,8 +18139,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no @@ -18663,8 +18179,7 @@ if test $ac_prog_rejected = yes; then ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -18688,8 +18203,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -18711,8 +18226,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -18738,8 +18252,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then +else $as_nop + if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -18761,8 +18275,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -18800,8 +18313,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then +else $as_nop + if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -18823,8 +18336,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -18846,8 +18358,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then +else $as_nop + if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -18869,8 +18381,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -18899,10 +18410,10 @@ fi fi -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See 'config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -18934,8 +18445,8 @@ printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -18952,14 +18463,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes -else case e in #( - e) ac_compiler_gnu=no ;; -esac +else $as_nop + ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } @@ -18977,8 +18486,8 @@ printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_save_c_werror_flag=$ac_c_werror_flag +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" @@ -18996,8 +18505,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes -else case e in #( - e) CFLAGS="" +else $as_nop + CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19012,8 +18521,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else case e in #( - e) ac_c_werror_flag=$ac_save_c_werror_flag +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19030,15 +18539,12 @@ if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag ;; -esac + ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } @@ -19065,8 +18571,8 @@ printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c11=no +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19083,28 +18589,25 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac +CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c11" = x +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" ;; -esac + CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 ;; -esac + ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno @@ -19114,8 +18617,8 @@ printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c99=no +else $as_nop + ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19132,28 +18635,25 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac +CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c99" = x +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" ;; -esac + CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 ;; -esac + ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno @@ -19163,8 +18663,8 @@ printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c89=no +else $as_nop + ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19181,28 +18681,25 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac +CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c89" = x +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" ;; -esac + CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 ;; -esac + ac_prog_cc_stdc=c89 fi fi @@ -19223,8 +18720,8 @@ printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -19254,8 +18751,7 @@ _ACEOF fi done rm -f core conftest* - unset am_i ;; -esac + unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } @@ -19280,8 +18776,8 @@ printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then @@ -19303,10 +18799,9 @@ do as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in #( +case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -#( *) ac_count=0 printf %s 0123456789 >"conftest.in" @@ -19342,15 +18837,12 @@ else ac_cv_path_EGREP=$EGREP fi - fi ;; -esac + fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" - EGREP_TRADITIONAL=$EGREP - ac_cv_path_EGREP_TRADITIONAL=$EGREP @@ -19359,8 +18851,8 @@ printf %s "checking for C compiler vendor... " >&6; } if test ${ax_cv_c_compiler_vendor+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + vendors=" intel: __ICC,__ECC,__INTEL_COMPILER ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__ @@ -19421,8 +18913,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done ax_cv_c_compiler_vendor=`echo $vendor | cut -d: -f1` - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_compiler_vendor" >&5 printf "%s\n" "$ax_cv_c_compiler_vendor" >&6; } @@ -19469,9 +18960,8 @@ then : IFS=$lt_save_ifs ;; esac -else case e in #( - e) enable_shared=yes ;; -esac +else $as_nop + enable_shared=yes fi @@ -19502,9 +18992,8 @@ then : IFS=$lt_save_ifs ;; esac -else case e in #( - e) enable_static=no ;; -esac +else $as_nop + enable_static=no fi @@ -19512,8 +19001,8 @@ fi -else case e in #( - e) # Check whether --enable-static was given. +else $as_nop + # Check whether --enable-static was given. if test ${enable_static+y} then : enableval=$enable_static; p=${PACKAGE-default} @@ -19533,26 +19022,23 @@ then : IFS=$lt_save_ifs ;; esac -else case e in #( - e) enable_static=yes ;; -esac +else $as_nop + enable_static=yes fi - ;; -esac + fi # Check whether --enable-warnings was given. if test ${enable_warnings+y} then : enableval=$enable_warnings; enable_warnings=${enableval} -else case e in #( - e) enable_warnings=yes ;; -esac +else $as_nop + enable_warnings=yes fi @@ -19569,16 +19055,15 @@ then : esac fi -else case e in #( - e) +else $as_nop + if test "x$enable_shared" = "xyes" ; then symbol_hiding="maybe" else symbol_hiding="no" fi - ;; -esac + fi @@ -19586,15 +19071,14 @@ fi if test ${enable_tests+y} then : enableval=$enable_tests; build_tests="$enableval" -else case e in #( - e) if test "x$HAVE_CXX14" = "x1" && test "x$cross_compiling" = "xno" ; then +else $as_nop + if test "x$HAVE_CXX14" = "x1" && test "x$cross_compiling" = "xno" ; then build_tests="maybe" else build_tests="no" fi - ;; -esac + fi @@ -19602,9 +19086,8 @@ fi if test ${enable_cares_threads+y} then : enableval=$enable_cares_threads; CARES_THREADS=${enableval} -else case e in #( - e) CARES_THREADS=yes ;; -esac +else $as_nop + CARES_THREADS=yes fi @@ -19613,10 +19096,9 @@ fi if test ${with_random+y} then : withval=$with_random; CARES_RANDOM_FILE="$withval" -else case e in #( - e) CARES_RANDOM_FILE="/dev/urandom" - ;; -esac +else $as_nop + CARES_RANDOM_FILE="/dev/urandom" + fi if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then @@ -19633,9 +19115,8 @@ printf %s "checking whether to enable maintainer-specific portions of Makefiles. if test ${enable_maintainer_mode+y} then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else case e in #( - e) USE_MAINTAINER_MODE=no ;; -esac +else $as_nop + USE_MAINTAINER_MODE=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 @@ -19651,8 +19132,47 @@ fi MAINT=$MAINTAINER_MODE_TRUE +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' -AM_DEFAULT_VERBOSITY=0 @@ -19678,9 +19198,8 @@ AM_DEFAULT_VERBOSITY=0 if test ${with_gcov+y} then : withval=$with_gcov; _AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov -else case e in #( - e) _AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov ;; -esac +else $as_nop + _AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov fi @@ -19690,9 +19209,8 @@ printf %s "checking whether to build with code coverage support... " >&6; } if test ${enable_code_coverage+y} then : enableval=$enable_code_coverage; -else case e in #( - e) enable_code_coverage=no ;; -esac +else $as_nop + enable_code_coverage=no fi @@ -19722,8 +19240,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$AWK"; then +else $as_nop + if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -19745,8 +19263,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then @@ -19766,8 +19283,8 @@ printf %s "checking for GNU make... " >&6; } if test ${_cv_gnu_make_command+y} then : printf %s "(cached) " >&6 -else case e in #( - e) _cv_gnu_make_command="" ; +else $as_nop + _cv_gnu_make_command="" ; for a in "$MAKE" make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then @@ -19776,31 +19293,27 @@ else case e in #( ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') break ; fi - done ; ;; -esac + done ; fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $_cv_gnu_make_command" >&5 printf "%s\n" "$_cv_gnu_make_command" >&6; } if test "x$_cv_gnu_make_command" = x"" then : ifGNUmake="#" -else case e in #( - e) ifGNUmake="" ;; -esac +else $as_nop + ifGNUmake="" fi if test "x$_cv_gnu_make_command" = x"" then : ifnGNUmake="" -else case e in #( - e) ifnGNUmake="#" ;; -esac +else $as_nop + ifnGNUmake="#" fi if test "x$_cv_gnu_make_command" = x"" then : { ax_cv_gnu_make_command=; unset ax_cv_gnu_make_command;} -else case e in #( - e) ax_cv_gnu_make_command=${_cv_gnu_make_command} ;; -esac +else $as_nop + ax_cv_gnu_make_command=${_cv_gnu_make_command} fi if test "x$_cv_gnu_make_command" = x"" then : @@ -19819,8 +19332,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_GCOV+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$GCOV"; then +else $as_nop + if test -n "$GCOV"; then ac_cv_prog_GCOV="$GCOV" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -19842,8 +19355,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi GCOV=$ac_cv_prog_GCOV if test -n "$GCOV"; then @@ -19865,8 +19377,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_GCOV+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_GCOV"; then +else $as_nop + if test -n "$ac_ct_GCOV"; then ac_cv_prog_ac_ct_GCOV="$ac_ct_GCOV" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -19888,8 +19400,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi ac_ct_GCOV=$ac_cv_prog_ac_ct_GCOV if test -n "$ac_ct_GCOV"; then @@ -19935,8 +19446,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LCOV+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$LCOV"; then +else $as_nop + if test -n "$LCOV"; then ac_cv_prog_LCOV="$LCOV" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -19958,8 +19469,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi LCOV=$ac_cv_prog_LCOV if test -n "$LCOV"; then @@ -19978,8 +19488,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_GENHTML+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$GENHTML"; then +else $as_nop + if test -n "$GENHTML"; then ac_cv_prog_GENHTML="$GENHTML" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -20001,8 +19511,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi GENHTML=$ac_cv_prog_GENHTML if test -n "$GENHTML"; then @@ -20029,15 +19538,57 @@ then : fi - CODE_COVERAGE_CPPFLAGS="-DNDEBUG" - CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_LIBS="-lgcov" - - - - - + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _gcov_init in -lgcov" >&5 +printf %s "checking for _gcov_init in -lgcov... " >&6; } +if test ${ac_cv_lib_gcov__gcov_init+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcov $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char _gcov_init (); +int +main (void) +{ +return _gcov_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_gcov__gcov_init=yes +else $as_nop + ac_cv_lib_gcov__gcov_init=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcov__gcov_init" >&5 +printf "%s\n" "$ac_cv_lib_gcov__gcov_init" >&6; } +if test "x$ac_cv_lib_gcov__gcov_init" = xyes +then : + CODE_COVERAGE_LIBS="-lgcov" +else $as_nop + CODE_COVERAGE_LIBS="" +fi + + + CODE_COVERAGE_CPPFLAGS="-DNDEBUG" + CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" + CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" + + + + + fi @@ -20057,34 +19608,31 @@ if test ${enable_largefile+y} then : enableval=$enable_largefile; fi -if test "$enable_largefile,$enable_year2038" != no,no -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable large file support" >&5 -printf %s "checking for $CC option to enable large file support... " >&6; } -if test ${ac_cv_sys_largefile_opts+y} + +if test "$enable_largefile" != no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +printf %s "checking for special C compiler options needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_save_CC="$CC" - ac_opt_found=no - for ac_opt in "none needed" "-D_FILE_OFFSET_BITS=64" "-D_LARGE_FILES=1" "-n32"; do - if test x"$ac_opt" != x"none needed" -then : - CC="$ac_save_CC $ac_opt" -fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include -#ifndef FTYPE -# define FTYPE off_t -#endif - /* Check that FTYPE can represent 2**63 - 1 correctly. - We can't simply define LARGE_FTYPE to be 9223372036854775807, + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31)) - int FTYPE_is_large[(LARGE_FTYPE % 2147483629 == 721 - && LARGE_FTYPE % 2147483647 == 1) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) @@ -20094,88 +19642,142 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - if test x"$ac_opt" = x"none needed" -then : - # GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t. - CC="$CC -DFTYPE=ino_t" if ac_fn_c_try_compile "$LINENO" then : - -else case e in #( - e) CC="$CC -D_FILE_OFFSET_BITS=64" - if ac_fn_c_try_compile "$LINENO" -then : - ac_opt='-D_FILE_OFFSET_BITS=64' + break fi -rm -f core conftest.err conftest.$ac_objext conftest.beam ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi fi - ac_cv_sys_largefile_opts=$ac_opt - ac_opt_found=yes +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test ${ac_cv_sys_file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - test $ac_opt_found = no || break - done - CC="$ac_save_CC" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ - test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected" ;; -esac + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=64; break fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_opts" >&5 -printf "%s\n" "$ac_cv_sys_largefile_opts" >&6; } - -ac_have_largefile=yes -case $ac_cv_sys_largefile_opts in #( - "none needed") : - ;; #( - "supported through gnulib") : - ;; #( - "support not detected") : - ac_have_largefile=no ;; #( - "-D_FILE_OFFSET_BITS=64") : - -printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h - ;; #( - "-D_LARGE_FILES=1") : - -printf "%s\n" "#define _LARGE_FILES 1" >>confdefs.h - ;; #( - "-n32") : - CC="$CC -n32" ;; #( - *) : - as_fn_error $? "internal error: bad value for \$ac_cv_sys_largefile_opts" "$LINENO" 5 ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h +;; esac - -if test "$enable_year2038" != no -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option for timestamps after 2038" >&5 -printf %s "checking for $CC option for timestamps after 2038... " >&6; } -if test ${ac_cv_sys_year2038_opts+y} +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } +if test ${ac_cv_sys_large_files+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_save_CPPFLAGS="$CPPFLAGS" - ac_opt_found=no - for ac_opt in "none needed" "-D_TIME_BITS=64" "-D__MINGW_USE_VC2005_COMPAT" "-U_USE_32_BIT_TIME_T -D__MINGW_USE_VC2005_COMPAT"; do - if test x"$ac_opt" != x"none needed" +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - CPPFLAGS="$ac_save_CPPFLAGS $ac_opt" + ac_cv_sys_large_files=no; break fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include - /* Check that time_t can represent 2**32 - 1 correctly. */ - #define LARGE_TIME_T \\ - ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) - int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 - && LARGE_TIME_T % 65537 == 0) - ? 1 : -1]; - +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main (void) { @@ -20186,47 +19788,25 @@ main (void) _ACEOF if ac_fn_c_try_compile "$LINENO" then : - ac_cv_sys_year2038_opts="$ac_opt" - ac_opt_found=yes + ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - test $ac_opt_found = no || break - done - CPPFLAGS="$ac_save_CPPFLAGS" - test $ac_opt_found = yes || ac_cv_sys_year2038_opts="support not detected" ;; -esac + ac_cv_sys_large_files=unknown + break +done fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_year2038_opts" >&5 -printf "%s\n" "$ac_cv_sys_year2038_opts" >&6; } - -ac_have_year2038=yes -case $ac_cv_sys_year2038_opts in #( - "none needed") : - ;; #( - "support not detected") : - ac_have_year2038=no ;; #( - "-D_TIME_BITS=64") : - -printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h - ;; #( - "-D__MINGW_USE_VC2005_COMPAT") : - -printf "%s\n" "#define __MINGW_USE_VC2005_COMPAT 1" >>confdefs.h - ;; #( - "-U_USE_32_BIT_TIME_T"*) : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "the 'time_t' type is currently forced to be 32-bit. It -will stop working after mid-January 2038. Remove -_USE_32BIT_TIME_T from the compiler flags. -See 'config.log' for more details" "$LINENO" 5; } ;; #( - *) : - as_fn_error $? "internal error: bad value for \$ac_cv_sys_year2038_opts" "$LINENO" 5 ;; +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +printf "%s\n" "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h +;; esac - +rm -rf conftest* + fi fi -fi case $host_os in solaris*) @@ -20244,14 +19824,14 @@ case $host_os in for flag in -mimpure-text; do - as_CACHEVAR=`printf "%s\n" "ax_cv_check_ldflags__$flag" | sed "$as_sed_sh"` + as_CACHEVAR=`printf "%s\n" "ax_cv_check_ldflags__$flag" | $as_tr_sh` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5 printf %s "checking whether the linker accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20268,47 +19848,53 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$as_CACHEVAR=yes" -else case e in #( - e) eval "$as_CACHEVAR=no" ;; -esac +else $as_nop + eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$ax_check_save_flags ;; -esac + LDFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : - if test ${LDFLAGS+y} + +if test ${LDFLAGS+y} then : - case " $LDFLAGS " in - *" $flag "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains \$flag"; } >&5 + + case " $LDFLAGS " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains \$flag"; } >&5 (: LDFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS \$flag\""; } >&5 - (: LDFLAGS="$LDFLAGS $flag") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append LDFLAGS " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS\""; } >&5 + (: LDFLAGS="$LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - LDFLAGS="$LDFLAGS $flag" - ;; - esac -else case e in #( - e) LDFLAGS="$flag" ;; + ;; esac + +else $as_nop + + LDFLAGS=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS\""; } >&5 + (: LDFLAGS="$LDFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi -else case e in #( - e) : ;; -esac +else $as_nop + : fi done @@ -20349,28 +19935,37 @@ if test "x$enable_shared" = "xno" -a "x$enable_static" = "xyes" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need CARES_STATICLIB definition" >&5 printf %s "checking whether we need CARES_STATICLIB definition... " >&6; } if test "$ac_cv_native_windows" = "yes" ; then - if test ${AM_CPPFLAGS+y} + +if test ${AM_CPPFLAGS+y} then : - case " $AM_CPPFLAGS " in - *" -DCARES_STATICLIB "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CPPFLAGS already contains -DCARES_STATICLIB"; } >&5 + + case " $AM_CPPFLAGS " in #( + *" -DCARES_STATICLIB "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CPPFLAGS already contains -DCARES_STATICLIB"; } >&5 (: AM_CPPFLAGS already contains -DCARES_STATICLIB) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CPPFLAGS=\"\$AM_CPPFLAGS -DCARES_STATICLIB\""; } >&5 - (: AM_CPPFLAGS="$AM_CPPFLAGS -DCARES_STATICLIB") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append AM_CPPFLAGS " -DCARES_STATICLIB" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CPPFLAGS=\"\$AM_CPPFLAGS\""; } >&5 + (: AM_CPPFLAGS="$AM_CPPFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - AM_CPPFLAGS="$AM_CPPFLAGS -DCARES_STATICLIB" - ;; - esac -else case e in #( - e) AM_CPPFLAGS="-DCARES_STATICLIB" ;; + ;; esac + +else $as_nop + + AM_CPPFLAGS=-DCARES_STATICLIB + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CPPFLAGS=\"\$AM_CPPFLAGS\""; } >&5 + (: AM_CPPFLAGS="$AM_CPPFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi PKGCONFIG_CFLAGS="-DCARES_STATICLIB" @@ -20390,60 +19985,24 @@ if test "$symbol_hiding" != "no" ; then else case "$ax_cv_c_compiler_vendor" in clang|gnu|intel) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts " >&5 -printf %s "checking whether C compiler accepts ... " >&6; } -if test ${ax_cv_check_cflags__+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS " - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ax_cv_check_cflags__=yes -else case e in #( - e) ax_cv_check_cflags__=no ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$ax_check_save_flags ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__" >&5 -printf "%s\n" "$ax_cv_check_cflags__" >&6; } -if test x"$ax_cv_check_cflags__" = xyes -then : - : -else case e in #( - e) : ;; -esac -fi for flag in -fvisibility=hidden; do - as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 -printf %s "checking whether C compiler accepts $flag... " >&6; } + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 +printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS $flag" + if test x"$GCC" = xyes ; then + add_gnu_werror="-Werror" + fi + CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20458,46 +20017,52 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" -else case e in #( - e) eval "$as_CACHEVAR=no" ;; -esac +else $as_nop + eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$ax_check_save_flags ;; -esac + CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : - if test ${CARES_SYMBOL_HIDING_CFLAG+y} + +if test ${CARES_SYMBOL_HIDING_CFLAG+y} then : - case " $CARES_SYMBOL_HIDING_CFLAG " in - *" $flag "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG already contains \$flag"; } >&5 + + case " $CARES_SYMBOL_HIDING_CFLAG " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG already contains \$flag"; } >&5 (: CARES_SYMBOL_HIDING_CFLAG already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG=\"\$CARES_SYMBOL_HIDING_CFLAG \$flag\""; } >&5 - (: CARES_SYMBOL_HIDING_CFLAG="$CARES_SYMBOL_HIDING_CFLAG $flag") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append CARES_SYMBOL_HIDING_CFLAG " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG=\"\$CARES_SYMBOL_HIDING_CFLAG\""; } >&5 + (: CARES_SYMBOL_HIDING_CFLAG="$CARES_SYMBOL_HIDING_CFLAG") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - CARES_SYMBOL_HIDING_CFLAG="$CARES_SYMBOL_HIDING_CFLAG $flag" - ;; - esac -else case e in #( - e) CARES_SYMBOL_HIDING_CFLAG="$flag" ;; + ;; esac + +else $as_nop + + CARES_SYMBOL_HIDING_CFLAG=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG=\"\$CARES_SYMBOL_HIDING_CFLAG\""; } >&5 + (: CARES_SYMBOL_HIDING_CFLAG="$CARES_SYMBOL_HIDING_CFLAG") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi -else case e in #( - e) : ;; -esac +else $as_nop + : fi done @@ -20509,17 +20074,22 @@ done sun) + + for flag in -xldscope=hidden; do - as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 -printf %s "checking whether C compiler accepts $flag... " >&6; } + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 +printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS $flag" + if test x"$GCC" = xyes ; then + add_gnu_werror="-Werror" + fi + CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20534,46 +20104,52 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" -else case e in #( - e) eval "$as_CACHEVAR=no" ;; -esac +else $as_nop + eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$ax_check_save_flags ;; -esac + CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : - if test ${CARES_SYMBOL_HIDING_CFLAG+y} + +if test ${CARES_SYMBOL_HIDING_CFLAG+y} then : - case " $CARES_SYMBOL_HIDING_CFLAG " in - *" $flag "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG already contains \$flag"; } >&5 + + case " $CARES_SYMBOL_HIDING_CFLAG " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG already contains \$flag"; } >&5 (: CARES_SYMBOL_HIDING_CFLAG already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG=\"\$CARES_SYMBOL_HIDING_CFLAG \$flag\""; } >&5 - (: CARES_SYMBOL_HIDING_CFLAG="$CARES_SYMBOL_HIDING_CFLAG $flag") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append CARES_SYMBOL_HIDING_CFLAG " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG=\"\$CARES_SYMBOL_HIDING_CFLAG\""; } >&5 + (: CARES_SYMBOL_HIDING_CFLAG="$CARES_SYMBOL_HIDING_CFLAG") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - CARES_SYMBOL_HIDING_CFLAG="$CARES_SYMBOL_HIDING_CFLAG $flag" - ;; - esac -else case e in #( - e) CARES_SYMBOL_HIDING_CFLAG="$flag" ;; + ;; esac + +else $as_nop + + CARES_SYMBOL_HIDING_CFLAG=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CARES_SYMBOL_HIDING_CFLAG=\"\$CARES_SYMBOL_HIDING_CFLAG\""; } >&5 + (: CARES_SYMBOL_HIDING_CFLAG="$CARES_SYMBOL_HIDING_CFLAG") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi -else case e in #( - e) : ;; -esac +else $as_nop + : fi done @@ -20611,17 +20187,22 @@ fi if test "$enable_warnings" = "yes"; then + + for flag in -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Wno-long-long ; do - as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_$flag" | sed "$as_sed_sh"` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 -printf %s "checking whether C compiler accepts $flag... " >&6; } + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 +printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror $flag" + if test x"$GCC" = xyes ; then + add_gnu_werror="-Werror" + fi + CFLAGS="$CFLAGS -Werror $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20636,66 +20217,78 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" -else case e in #( - e) eval "$as_CACHEVAR=no" ;; -esac +else $as_nop + eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$ax_check_save_flags ;; -esac + CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : - if test ${AM_CFLAGS+y} + +if test ${AM_CFLAGS+y} then : - case " $AM_CFLAGS " in - *" $flag "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS already contains \$flag"; } >&5 + + case " $AM_CFLAGS " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS already contains \$flag"; } >&5 (: AM_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS \$flag\""; } >&5 - (: AM_CFLAGS="$AM_CFLAGS $flag") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append AM_CFLAGS " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS\""; } >&5 + (: AM_CFLAGS="$AM_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - AM_CFLAGS="$AM_CFLAGS $flag" - ;; - esac -else case e in #( - e) AM_CFLAGS="$flag" ;; + ;; esac + +else $as_nop + + AM_CFLAGS=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS\""; } >&5 + (: AM_CFLAGS="$AM_CFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi -else case e in #( - e) : ;; -esac +else $as_nop + : fi done +fi + +case $host_os in + *qnx*|*android*) + - case $host_os in - *android*) for flag in -std=c99; do - as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_$flag" | sed "$as_sed_sh"` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 -printf %s "checking whether C compiler accepts $flag... " >&6; } + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 +printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror $flag" + if test x"$GCC" = xyes ; then + add_gnu_werror="-Werror" + fi + CFLAGS="$CFLAGS -Werror $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20710,65 +20303,76 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" -else case e in #( - e) eval "$as_CACHEVAR=no" ;; -esac +else $as_nop + eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$ax_check_save_flags ;; -esac + CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : - if test ${AM_CFLAGS+y} + +if test ${AM_CFLAGS+y} then : - case " $AM_CFLAGS " in - *" $flag "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS already contains \$flag"; } >&5 + + case " $AM_CFLAGS " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS already contains \$flag"; } >&5 (: AM_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS \$flag\""; } >&5 - (: AM_CFLAGS="$AM_CFLAGS $flag") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append AM_CFLAGS " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS\""; } >&5 + (: AM_CFLAGS="$AM_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - AM_CFLAGS="$AM_CFLAGS $flag" - ;; - esac -else case e in #( - e) AM_CFLAGS="$flag" ;; + ;; esac + +else $as_nop + + AM_CFLAGS=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS\""; } >&5 + (: AM_CFLAGS="$AM_CFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi -else case e in #( - e) : ;; -esac +else $as_nop + : fi done - ;; - *) + ;; + *) + + for flag in -std=c90; do - as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_$flag" | sed "$as_sed_sh"` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 -printf %s "checking whether C compiler accepts $flag... " >&6; } + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 +printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror $flag" + if test x"$GCC" = xyes ; then + add_gnu_werror="-Werror" + fi + CFLAGS="$CFLAGS -Werror $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20783,68 +20387,165 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" -else case e in #( - e) eval "$as_CACHEVAR=no" ;; -esac +else $as_nop + eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$ax_check_save_flags ;; -esac + CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : - if test ${AM_CFLAGS+y} + +if test ${AM_CFLAGS+y} then : - case " $AM_CFLAGS " in - *" $flag "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS already contains \$flag"; } >&5 + + case " $AM_CFLAGS " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS already contains \$flag"; } >&5 (: AM_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append AM_CFLAGS " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS\""; } >&5 + (: AM_CFLAGS="$AM_CFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS \$flag\""; } >&5 - (: AM_CFLAGS="$AM_CFLAGS $flag") 2>&5 + ;; +esac + +else $as_nop + + AM_CFLAGS=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS\""; } >&5 + (: AM_CFLAGS="$AM_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - AM_CFLAGS="$AM_CFLAGS $flag" - ;; - esac -else case e in #( - e) AM_CFLAGS="$flag" ;; + +fi + +else $as_nop + : +fi + +done + + ;; esac + +case $host_os in + *qnx*) + + + + +for flag in -D_QNX_SOURCE; do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 +printf %s "checking whether the C compiler accepts $flag... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + if test x"$GCC" = xyes ; then + add_gnu_werror="-Werror" + fi + CFLAGS="$CFLAGS -Werror $flag $add_gnu_werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" +then : -else case e in #( - e) : ;; +if test ${AM_CPPFLAGS+y} +then : + + case " $AM_CPPFLAGS " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CPPFLAGS already contains \$flag"; } >&5 + (: AM_CPPFLAGS already contains $flag) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append AM_CPPFLAGS " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CPPFLAGS=\"\$AM_CPPFLAGS\""; } >&5 + (: AM_CPPFLAGS="$AM_CPPFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; esac + +else $as_nop + + AM_CPPFLAGS=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CPPFLAGS=\"\$AM_CPPFLAGS\""; } >&5 + (: AM_CPPFLAGS="$AM_CPPFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + +fi + +else $as_nop + : fi done - ;; - esac -fi + ;; +esac if test "$ax_cv_c_compiler_vendor" = "intel"; then + + for flag in -shared-intel; do - as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 -printf %s "checking whether C compiler accepts $flag... " >&6; } + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 +printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS $flag" + if test x"$GCC" = xyes ; then + add_gnu_werror="-Werror" + fi + CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20859,46 +20560,52 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" -else case e in #( - e) eval "$as_CACHEVAR=no" ;; -esac +else $as_nop + eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$ax_check_save_flags ;; -esac + CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : - if test ${AM_CFLAGS+y} + +if test ${AM_CFLAGS+y} then : - case " $AM_CFLAGS " in - *" $flag "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS already contains \$flag"; } >&5 + + case " $AM_CFLAGS " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS already contains \$flag"; } >&5 (: AM_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS \$flag\""; } >&5 - (: AM_CFLAGS="$AM_CFLAGS $flag") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append AM_CFLAGS " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS\""; } >&5 + (: AM_CFLAGS="$AM_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - AM_CFLAGS="$AM_CFLAGS $flag" - ;; - esac -else case e in #( - e) AM_CFLAGS="$flag" ;; + ;; esac + +else $as_nop + + AM_CFLAGS=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : AM_CFLAGS=\"\$AM_CFLAGS\""; } >&5 + (: AM_CFLAGS="$AM_CFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi -else case e in #( - e) : ;; -esac +else $as_nop + : fi done @@ -20922,8 +20629,8 @@ if test -z "$CPP"; then if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 -else case e in #( - e) # Double quotes because $CC needs to be expanded +else $as_nop + # Double quotes because $CC needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false @@ -20941,10 +20648,9 @@ _ACEOF if ac_fn_c_try_cpp "$LINENO" then : -else case e in #( - e) # Broken: fails on valid input. -continue ;; -esac +else $as_nop + # Broken: fails on valid input. +continue fi rm -f conftest.err conftest.i conftest.$ac_ext @@ -20958,16 +20664,15 @@ if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue -else case e in #( - e) # Passes both tests. +else $as_nop + # Passes both tests. ac_preproc_ok=: -break ;; -esac +break fi rm -f conftest.err conftest.i conftest.$ac_ext done -# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : @@ -20976,8 +20681,7 @@ fi done ac_cv_prog_CPP=$CPP - ;; -esac + fi CPP=$ac_cv_prog_CPP else @@ -21000,10 +20704,9 @@ _ACEOF if ac_fn_c_try_cpp "$LINENO" then : -else case e in #( - e) # Broken: fails on valid input. -continue ;; -esac +else $as_nop + # Broken: fails on valid input. +continue fi rm -f conftest.err conftest.i conftest.$ac_ext @@ -21017,26 +20720,24 @@ if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue -else case e in #( - e) # Passes both tests. +else $as_nop + # Passes both tests. ac_preproc_ok=: -break ;; -esac +break fi rm -f conftest.err conftest.i conftest.$ac_ext done -# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : -else case e in #( - e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See 'config.log' for more details" "$LINENO" 5; } ;; -esac +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -21119,21 +20820,15 @@ printf %s "checking for library containing getservbyport... " >&6; } if test ${ac_cv_search_getservbyport+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_func_search_save_LIBS=$LIBS +else $as_nop + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char getservbyport (void); + builtin and then its argument prototype would still apply. */ +char getservbyport (); int main (void) { @@ -21164,13 +20859,11 @@ done if test ${ac_cv_search_getservbyport+y} then : -else case e in #( - e) ac_cv_search_getservbyport=no ;; -esac +else $as_nop + ac_cv_search_getservbyport=no fi rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS ;; -esac +LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getservbyport" >&5 printf "%s\n" "$ac_cv_search_getservbyport" >&6; } @@ -21193,14 +20886,14 @@ case $host_os in for flag in -lxnet; do - as_CACHEVAR=`printf "%s\n" "ax_cv_check_ldflags__$flag" | sed "$as_sed_sh"` + as_CACHEVAR=`printf "%s\n" "ax_cv_check_ldflags__$flag" | $as_tr_sh` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5 printf %s "checking whether the linker accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21217,47 +20910,53 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$as_CACHEVAR=yes" -else case e in #( - e) eval "$as_CACHEVAR=no" ;; -esac +else $as_nop + eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$ax_check_save_flags ;; -esac + LDFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : - if test ${XNET_LIBS+y} + +if test ${XNET_LIBS+y} then : - case " $XNET_LIBS " in - *" $flag "*) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : XNET_LIBS already contains \$flag"; } >&5 + + case " $XNET_LIBS " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : XNET_LIBS already contains \$flag"; } >&5 (: XNET_LIBS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : XNET_LIBS=\"\$XNET_LIBS \$flag\""; } >&5 - (: XNET_LIBS="$XNET_LIBS $flag") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append XNET_LIBS " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : XNET_LIBS=\"\$XNET_LIBS\""; } >&5 + (: XNET_LIBS="$XNET_LIBS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - XNET_LIBS="$XNET_LIBS $flag" - ;; - esac -else case e in #( - e) XNET_LIBS="$flag" ;; + ;; esac + +else $as_nop + + XNET_LIBS=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : XNET_LIBS=\"\$XNET_LIBS\""; } >&5 + (: XNET_LIBS="$XNET_LIBS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi -else case e in #( - e) : ;; -esac +else $as_nop + : fi done @@ -21279,21 +20978,15 @@ printf %s "checking for library containing res_init... " >&6; } if test ${ac_cv_search_res_init+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_func_search_save_LIBS=$LIBS +else $as_nop + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char res_init (void); + builtin and then its argument prototype would still apply. */ +char res_init (); int main (void) { @@ -21324,13 +21017,11 @@ done if test ${ac_cv_search_res_init+y} then : -else case e in #( - e) ac_cv_search_res_init=no ;; -esac +else $as_nop + ac_cv_search_res_init=no fi rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS ;; -esac +LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_res_init" >&5 printf "%s\n" "$ac_cv_search_res_init" >&6; } @@ -21343,11 +21034,10 @@ then : printf "%s\n" "#define CARES_USE_LIBRESOLV 1" >>confdefs.h -else case e in #( - e) +else $as_nop + as_fn_error $? "Unable to find libresolv which is required for z/OS" "$LINENO" 5 - ;; -esac + fi @@ -21388,12 +21078,11 @@ then : printf "%s\n" "yes" >&6; } ac_cv_ios_10="yes" -else case e in #( - e) +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - ;; -esac + fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -21436,12 +21125,11 @@ then : printf "%s\n" "yes" >&6; } ac_cv_macos_10_12="yes" -else case e in #( - e) +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - ;; -esac + fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -21463,11 +21151,10 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "no" >&6; } ;; esac -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - ;; -esac + fi @@ -22321,6 +22008,31 @@ then : printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "sys/system_properties.h" "ac_cv_header_sys_system_properties_h" " +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_ARPA_NAMESER_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif + + +" +if test "x$ac_cv_header_sys_system_properties_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SYSTEM_PROPERTIES_H 1" >>confdefs.h + +fi @@ -22408,6 +22120,9 @@ cares_all_includes=" #ifdef HAVE_RESOLV_H # include #endif +#ifdef HAVE_SYS_SYSTEM_PROPERTIES_H +# include +#endif #ifdef HAVE_IPHLPAPI_H # include #endif @@ -22433,8 +22148,8 @@ printf %s "checking for $CC options needed to detect all undeclared functions... if test ${ac_cv_c_undeclared_builtin_options+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_save_CFLAGS=$CFLAGS +else $as_nop + ac_save_CFLAGS=$CFLAGS ac_cv_c_undeclared_builtin_options='cannot detect' for ac_arg in '' -fno-builtin; do CFLAGS="$ac_save_CFLAGS $ac_arg" @@ -22453,8 +22168,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else case e in #( - e) # This test program should compile successfully. +else $as_nop + # This test program should compile successfully. # No library function is consistently available on # freestanding implementations, so test against a dummy # declaration. Include always-available headers on the @@ -22482,29 +22197,26 @@ then : if test x"$ac_arg" = x then : ac_cv_c_undeclared_builtin_options='none needed' -else case e in #( - e) ac_cv_c_undeclared_builtin_options=$ac_arg ;; -esac +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg fi break fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done CFLAGS=$ac_save_CFLAGS - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } case $ac_cv_c_undeclared_builtin_options in #( 'cannot detect') : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot make $CC report undeclared builtins -See 'config.log' for more details" "$LINENO" 5; } ;; #( +See \`config.log' for more details" "$LINENO" 5; } ;; #( 'none needed') : ac_c_undeclared_builtin_options='' ;; #( *) : @@ -22541,9 +22253,8 @@ ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_defaul if test "x$ac_cv_type_ssize_t" = xyes then : CARES_TYPEOF_ARES_SSIZE_T=ssize_t -else case e in #( - e) CARES_TYPEOF_ARES_SSIZE_T=int ;; -esac +else $as_nop + CARES_TYPEOF_ARES_SSIZE_T=int fi @@ -22565,13 +22276,12 @@ cat >>confdefs.h <<_EOF _EOF -else case e in #( - e) +else $as_nop + cat >>confdefs.h <<_EOF #define CARES_TYPEOF_ARES_SOCKLEN_T int _EOF - ;; -esac + fi @@ -22589,21 +22299,15 @@ printf %s "checking for library containing clock_gettime... " >&6; } if test ${ac_cv_search_clock_gettime+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_func_search_save_LIBS=$LIBS +else $as_nop + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char clock_gettime (void); + builtin and then its argument prototype would still apply. */ +char clock_gettime (); int main (void) { @@ -22634,13 +22338,11 @@ done if test ${ac_cv_search_clock_gettime+y} then : -else case e in #( - e) ac_cv_search_clock_gettime=no ;; -esac +else $as_nop + ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS ;; -esac +LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 printf "%s\n" "$ac_cv_search_clock_gettime" >&6; } @@ -22653,6 +22355,22 @@ fi +ac_fn_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$cares_all_includes +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_strnlen" = xyes +then : + +printf "%s\n" "#define HAVE_STRNLEN 1" >>confdefs.h + +fi +ac_fn_check_decl "$LINENO" "memmem" "ac_cv_have_decl_memmem" "$cares_all_includes +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_memmem" = xyes +then : + +printf "%s\n" "#define HAVE_MEMMEM 1" >>confdefs.h + +fi ac_fn_check_decl "$LINENO" "recv" "ac_cv_have_decl_recv" "$cares_all_includes " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_recv" = xyes @@ -22676,6 +22394,14 @@ then : printf "%s\n" "#define HAVE_SEND 1" >>confdefs.h +fi +ac_fn_check_decl "$LINENO" "sendto" "ac_cv_have_decl_sendto" "$cares_all_includes +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_sendto" = xyes +then : + +printf "%s\n" "#define HAVE_SENDTO 1" >>confdefs.h + fi ac_fn_check_decl "$LINENO" "getnameinfo" "ac_cv_have_decl_getnameinfo" "$cares_all_includes " "$ac_c_undeclared_builtin_options" "CFLAGS" @@ -23186,11 +22912,10 @@ ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : -else case e in #( - e) +else $as_nop + printf "%s\n" "#define size_t unsigned int" >>confdefs.h - ;; -esac + fi ac_fn_check_decl "$LINENO" "AF_INET6" "ac_cv_have_decl_AF_INET6" "$cares_all_includes @@ -23397,140 +23122,6 @@ fi if test "${CARES_THREADS}" = "yes" -a "x${ac_cv_native_windows}" != "xyes" ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep -e" >&5 -printf %s "checking for egrep -e... " >&6; } -if test ${ac_cv_path_EGREP_TRADITIONAL+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -z "$EGREP_TRADITIONAL"; then - ac_path_EGREP_TRADITIONAL_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue -# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. - # Check for GNU $ac_path_EGREP_TRADITIONAL -case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( -*GNU*) - ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;; -#( -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl" - "$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" - ac_path_EGREP_TRADITIONAL_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_TRADITIONAL_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then - : - fi -else - ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL -fi - - if test "$ac_cv_path_EGREP_TRADITIONAL" -then : - ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E" -else case e in #( - e) if test -z "$EGREP_TRADITIONAL"; then - ac_path_EGREP_TRADITIONAL_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue -# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. - # Check for GNU $ac_path_EGREP_TRADITIONAL -case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( -*GNU*) - ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;; -#( -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl" - "$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" - ac_path_EGREP_TRADITIONAL_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_TRADITIONAL_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL -fi - ;; -esac -fi ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5 -printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; } - EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL - @@ -23571,14 +23162,8 @@ printf %s "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_join (void); + builtin and then its argument prototype would still apply. */ +char pthread_join (); int main (void) { @@ -23672,7 +23257,7 @@ case $host_os in _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP_TRADITIONAL "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1 + $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1 then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 printf "%s\n" "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} @@ -23702,8 +23287,8 @@ printf %s "checking whether $CC is Clang... " >&6; } if test ${ax_cv_PTHREAD_CLANG+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ax_cv_PTHREAD_CLANG=no +else $as_nop + ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -23715,15 +23300,14 @@ else case e in #( _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP_TRADITIONAL "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1 + $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1 then : ax_cv_PTHREAD_CLANG=yes fi rm -rf conftest* fi - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 printf "%s\n" "$ax_cv_PTHREAD_CLANG" >&6; } @@ -23773,9 +23357,8 @@ esac if test "x$ax_pthread_check_macro" = "x--" then : ax_pthread_check_cond=0 -else case e in #( - e) ax_pthread_check_cond="!defined($ax_pthread_check_macro)" ;; -esac +else $as_nop + ax_pthread_check_cond="!defined($ax_pthread_check_macro)" fi @@ -23809,8 +23392,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ax_pthread_config+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ax_pthread_config"; then +else $as_nop + if test -n "$ax_pthread_config"; then ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -23833,8 +23416,7 @@ done IFS=$as_save_IFS test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" -fi ;; -esac +fi fi ax_pthread_config=$ac_cv_prog_ax_pthread_config if test -n "$ax_pthread_config"; then @@ -23967,8 +23549,8 @@ printf %s "checking whether Clang needs flag to prevent \"argument unused\" warn if test ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown +else $as_nop + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown # Create an alternate version of $ac_link that compiles and # links in two steps (.c -> .o, .o -> exe) instead of one # (.c -> exe), because the warning occurs only in the second @@ -24014,8 +23596,7 @@ then : ax_pthread_try=no fi ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 printf "%s\n" "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } @@ -24042,8 +23623,8 @@ printf %s "checking for joinable pthread attribute... " >&6; } if test ${ax_cv_PTHREAD_JOINABLE_ATTR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ax_cv_PTHREAD_JOINABLE_ATTR=unknown +else $as_nop + ax_cv_PTHREAD_JOINABLE_ATTR=unknown for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24063,8 +23644,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 printf "%s\n" "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } @@ -24084,15 +23664,14 @@ printf %s "checking whether more special flags are required for pthreads... " >& if test ${ax_cv_PTHREAD_SPECIAL_FLAGS+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ax_cv_PTHREAD_SPECIAL_FLAGS=no +else $as_nop + ax_cv_PTHREAD_SPECIAL_FLAGS=no case $host_os in solaris*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 printf "%s\n" "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } @@ -24108,8 +23687,8 @@ printf %s "checking for PTHREAD_PRIO_INHERIT... " >&6; } if test ${ax_cv_PTHREAD_PRIO_INHERIT+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -24124,14 +23703,12 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ax_cv_PTHREAD_PRIO_INHERIT=yes -else case e in #( - e) ax_cv_PTHREAD_PRIO_INHERIT=no ;; -esac +else $as_nop + ax_cv_PTHREAD_PRIO_INHERIT=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 printf "%s\n" "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } @@ -24181,8 +23758,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_PTHREAD_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$PTHREAD_CC"; then +else $as_nop + if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -24204,8 +23781,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then @@ -24232,8 +23808,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_PTHREAD_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$PTHREAD_CXX"; then +else $as_nop + if test -n "$PTHREAD_CXX"; then ac_cv_prog_PTHREAD_CXX="$PTHREAD_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -24255,8 +23831,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi PTHREAD_CXX=$ac_cv_prog_PTHREAD_CXX if test -n "$PTHREAD_CXX"; then @@ -24365,6 +23940,15 @@ printf "%s\n" "$as_me: WARNING: cannot build tests when cross compiling" >&2;} as_fn_error $? "*** Tests not supported when cross compiling" "$LINENO" 5 fi fi + +# Check whether --enable-tests-crossbuild was given. +if test ${enable_tests_crossbuild+y} +then : + enableval=$enable_tests_crossbuild; build_tests="$enableval" + +fi + + if test "x$build_tests" != "xno" ; then @@ -24382,8 +23966,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_PKG_CONFIG+y} then : printf %s "(cached) " >&6 -else case e in #( - e) case $PKG_CONFIG in +else $as_nop + case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; @@ -24408,7 +23992,6 @@ done IFS=$as_save_IFS ;; -esac ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG @@ -24431,8 +24014,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} then : printf %s "(cached) " >&6 -else case e in #( - e) case $ac_pt_PKG_CONFIG in +else $as_nop + case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; @@ -24457,7 +24040,6 @@ done IFS=$as_save_IFS ;; -esac ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG @@ -24652,11 +24234,11 @@ fi if test "x$have_gmock_v112" = "xyes" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether user namespaces are supported" >&5 printf %s "checking whether user namespaces are supported... " >&6; } -if test ${ax_cv_user_namespace+y} +if test ${ares_cv_user_namespace+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -24665,9 +24247,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes then : - ax_cv_user_namespace=no -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ares_cv_user_namespace=no +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _GNU_SOURCE @@ -24705,14 +24287,12 @@ int main() { _ACEOF if ac_fn_c_try_run "$LINENO" then : - ax_cv_user_namespace=yes -else case e in #( - e) ax_cv_user_namespace=no ;; -esac + ares_cv_user_namespace=yes +else $as_nop + ares_cv_user_namespace=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac + conftest.$ac_objext conftest.beam conftest.$ac_ext fi ac_ext=c @@ -24721,12 +24301,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - ;; -esac + fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_user_namespace" >&5 -printf "%s\n" "$ax_cv_user_namespace" >&6; } - if test "$ax_cv_user_namespace" = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ares_cv_user_namespace" >&5 +printf "%s\n" "$ares_cv_user_namespace" >&6; } + if test "$ares_cv_user_namespace" = yes; then printf "%s\n" "#define HAVE_USER_NAMESPACE 1" >>confdefs.h @@ -24734,11 +24313,11 @@ printf "%s\n" "#define HAVE_USER_NAMESPACE 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether UTS namespaces are supported" >&5 printf %s "checking whether UTS namespaces are supported... " >&6; } -if test ${ax_cv_uts_namespace+y} +if test ${ares_cv_uts_namespace+y} then : printf %s "(cached) " >&6 -else case e in #( - e) +else $as_nop + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -24747,9 +24326,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes then : - ax_cv_uts_namespace=no -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ares_cv_uts_namespace=no +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _GNU_SOURCE @@ -24807,14 +24386,12 @@ int main() { _ACEOF if ac_fn_c_try_run "$LINENO" then : - ax_cv_uts_namespace=yes -else case e in #( - e) ax_cv_uts_namespace=no ;; -esac + ares_cv_uts_namespace=yes +else $as_nop + ares_cv_uts_namespace=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac + conftest.$ac_objext conftest.beam conftest.$ac_ext fi ac_ext=c @@ -24823,12 +24400,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - ;; -esac + fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_uts_namespace" >&5 -printf "%s\n" "$ax_cv_uts_namespace" >&6; } - if test "$ax_cv_uts_namespace" = yes; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ares_cv_uts_namespace" >&5 +printf "%s\n" "$ares_cv_uts_namespace" >&6; } + if test "$ares_cv_uts_namespace" = yes; then printf "%s\n" "#define HAVE_UTS_NAMESPACE 1" >>confdefs.h @@ -24857,17 +24433,17 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do if test x"$switch" = xMSVC; then switch=-std:c++${alternative} - cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx14_${switch}_MSVC" | sed "$as_sed_sh"` + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx14_${switch}_MSVC" | $as_tr_sh` else - cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx14_$switch" | sed "$as_sed_sh"` + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx14_$switch" | $as_tr_sh` fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features with $switch" >&5 printf %s "checking whether $CXX supports C++14 features with $switch... " >&6; } if eval test \${$cachevar+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ac_save_CXX="$CXX" +else $as_nop + ac_save_CXX="$CXX" CXX="$CXX $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24883,7 +24459,17 @@ else case e in #( // MSVC always sets __cplusplus to 199711L in older versions; newer versions // only set it correctly if /Zc:__cplusplus is specified as well as a // /std:c++NN switch: +// // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +// +// The value __cplusplus ought to have is available in _MSVC_LANG since +// Visual Studio 2015 Update 3: +// +// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros +// +// This was also the first MSVC version to support C++14 so we can't use the +// value of either __cplusplus or _MSVC_LANG to quickly rule out MSVC having +// C++11 or C++14 support, but we can check _MSVC_LANG for C++17 and later. #elif __cplusplus < 201103L && !defined _MSC_VER #error "This is not a C++11 compiler" @@ -25287,13 +24873,11 @@ _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : eval $cachevar=yes -else case e in #( - e) eval $cachevar=no ;; -esac +else $as_nop + eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CXX="$ac_save_CXX" ;; -esac + CXX="$ac_save_CXX" fi eval ac_res=\$$cachevar { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -25376,14 +24960,8 @@ printf %s "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_join (void); + builtin and then its argument prototype would still apply. */ +char pthread_join (); int main (void) { @@ -25477,7 +25055,7 @@ case $host_os in _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP_TRADITIONAL "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1 + $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1 then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 printf "%s\n" "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} @@ -25507,8 +25085,8 @@ printf %s "checking whether $CC is Clang... " >&6; } if test ${ax_cv_PTHREAD_CLANG+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ax_cv_PTHREAD_CLANG=no +else $as_nop + ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25520,15 +25098,14 @@ else case e in #( _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP_TRADITIONAL "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1 + $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1 then : ax_cv_PTHREAD_CLANG=yes fi rm -rf conftest* fi - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 printf "%s\n" "$ax_cv_PTHREAD_CLANG" >&6; } @@ -25578,9 +25155,8 @@ esac if test "x$ax_pthread_check_macro" = "x--" then : ax_pthread_check_cond=0 -else case e in #( - e) ax_pthread_check_cond="!defined($ax_pthread_check_macro)" ;; -esac +else $as_nop + ax_pthread_check_cond="!defined($ax_pthread_check_macro)" fi @@ -25614,8 +25190,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ax_pthread_config+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ax_pthread_config"; then +else $as_nop + if test -n "$ax_pthread_config"; then ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -25638,8 +25214,7 @@ done IFS=$as_save_IFS test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" -fi ;; -esac +fi fi ax_pthread_config=$ac_cv_prog_ax_pthread_config if test -n "$ax_pthread_config"; then @@ -25772,8 +25347,8 @@ printf %s "checking whether Clang needs flag to prevent \"argument unused\" warn if test ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown +else $as_nop + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown # Create an alternate version of $ac_link that compiles and # links in two steps (.c -> .o, .o -> exe) instead of one # (.c -> exe), because the warning occurs only in the second @@ -25819,8 +25394,7 @@ then : ax_pthread_try=no fi ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 printf "%s\n" "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } @@ -25847,8 +25421,8 @@ printf %s "checking for joinable pthread attribute... " >&6; } if test ${ax_cv_PTHREAD_JOINABLE_ATTR+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ax_cv_PTHREAD_JOINABLE_ATTR=unknown +else $as_nop + ax_cv_PTHREAD_JOINABLE_ATTR=unknown for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25868,8 +25442,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 printf "%s\n" "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } @@ -25889,15 +25462,14 @@ printf %s "checking whether more special flags are required for pthreads... " >& if test ${ax_cv_PTHREAD_SPECIAL_FLAGS+y} then : printf %s "(cached) " >&6 -else case e in #( - e) ax_cv_PTHREAD_SPECIAL_FLAGS=no +else $as_nop + ax_cv_PTHREAD_SPECIAL_FLAGS=no case $host_os in solaris*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 printf "%s\n" "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } @@ -25913,8 +25485,8 @@ printf %s "checking for PTHREAD_PRIO_INHERIT... " >&6; } if test ${ax_cv_PTHREAD_PRIO_INHERIT+y} then : printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -25929,14 +25501,12 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ax_cv_PTHREAD_PRIO_INHERIT=yes -else case e in #( - e) ax_cv_PTHREAD_PRIO_INHERIT=no ;; -esac +else $as_nop + ax_cv_PTHREAD_PRIO_INHERIT=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; -esac + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 printf "%s\n" "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } @@ -25986,8 +25556,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_PTHREAD_CC+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$PTHREAD_CC"; then +else $as_nop + if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -26009,8 +25579,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then @@ -26037,8 +25606,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_PTHREAD_CXX+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$PTHREAD_CXX"; then +else $as_nop + if test -n "$PTHREAD_CXX"; then ac_cv_prog_PTHREAD_CXX="$PTHREAD_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -26060,8 +25629,7 @@ done done IFS=$as_save_IFS -fi ;; -esac +fi fi PTHREAD_CXX=$ac_cv_prog_PTHREAD_CXX if test -n "$PTHREAD_CXX"; then @@ -26153,8 +25721,8 @@ cat >confcache <<\_ACEOF # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # -# 'ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* 'ac_cv_foo' will be assigned the +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF @@ -26184,14 +25752,14 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # 'set' does not quote correctly, so add quotes: double-quote + # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) - # 'set' quotes correctly as required by POSIX, so do not add quotes. + # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | @@ -26272,18 +25840,6 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; -esac -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi - if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -26300,12 +25856,6 @@ if test -z "${CODE_COVERAGE_ENABLED_TRUE}" && test -z "${CODE_COVERAGE_ENABLED_F as_fn_error $? "conditional \"CODE_COVERAGE_ENABLED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -# Check whether --enable-year2038 was given. -if test ${enable_year2038+y} -then : - enableval=$enable_year2038; -fi - if test -z "${CARES_USE_NO_UNDEFINED_TRUE}" && test -z "${CARES_USE_NO_UNDEFINED_FALSE}"; then as_fn_error $? "conditional \"CARES_USE_NO_UNDEFINED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -26347,6 +25897,7 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh @@ -26355,13 +25906,12 @@ then : # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else case e in #( - e) case `(set -o) 2>/dev/null` in #( +else $as_nop + case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; -esac ;; esac fi @@ -26433,7 +25983,7 @@ IFS=$as_save_IFS ;; esac -# We did not find ourselves, most probably we were run as 'sh COMMAND' +# We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 @@ -26462,6 +26012,7 @@ as_fn_error () } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -26501,12 +26052,11 @@ then : { eval $1+=\$2 }' -else case e in #( - e) as_fn_append () +else $as_nop + as_fn_append () { eval $1=\$$1\$2 - } ;; -esac + } fi # as_fn_append # as_fn_arith ARG... @@ -26520,12 +26070,11 @@ then : { as_val=$(( $* )) }' -else case e in #( - e) as_fn_arith () +else $as_nop + as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` - } ;; -esac + } fi # as_fn_arith @@ -26608,9 +26157,9 @@ if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: - # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. - # In both cases, we have to default to 'cp -pR'. + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then @@ -26691,12 +26240,10 @@ as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. -as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" -as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" -as_tr_sh="eval sed '$as_sed_sh'" # deprecated +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 @@ -26711,8 +26258,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by c-ares $as_me 1.33.1, which was -generated by GNU Autoconf 2.72. Invocation command line was +This file was extended by c-ares $as_me 1.34.4, which was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -26744,7 +26291,7 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -'$as_me' instantiates files and other configuration actions +\`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. @@ -26779,11 +26326,11 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -c-ares config.status 1.33.1 -configured by $0, generated by GNU Autoconf 2.72, +c-ares config.status 1.34.4 +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2023 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -26845,8 +26392,8 @@ do ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error $? "ambiguous option: '$1' -Try '$0 --help' for more information.";; + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -26854,8 +26401,8 @@ Try '$0 --help' for more information.";; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error $? "unrecognized option: '$1' -Try '$0 --help' for more information." ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; @@ -26945,14 +26492,12 @@ lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_q lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' @@ -27130,13 +26675,13 @@ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ -FILECMD \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ +AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ @@ -27306,7 +26851,7 @@ do "libcares.pc") CONFIG_FILES="$CONFIG_FILES libcares.pc" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; - *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -27326,7 +26871,7 @@ fi # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to '$tmp'. +# after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= @@ -27350,7 +26895,7 @@ ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. -# This happens for instance with './config.status config.h'. +# This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then @@ -27508,13 +27053,13 @@ fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with './config.status Makefile'. +# This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF -# Transform confdefs.h into an awk script 'defines.awk', embedded as +# Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. @@ -27624,7 +27169,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -27646,19 +27191,19 @@ do -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain ':'. + # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done - # Let's still pretend it is 'configure' which instantiates (i.e., don't + # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` @@ -27791,7 +27336,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 esac _ACEOF -# Neutralize VPATH when '$srcdir' = '.'. +# Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 @@ -27822,9 +27367,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -27979,15 +27524,15 @@ printf "%s\n" X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). -See 'config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} @@ -28011,7 +27556,6 @@ See 'config.log' for more details" "$LINENO" 5; } 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. @@ -28140,9 +27684,6 @@ to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd -# A file(cmd) program that detects file types. -FILECMD=$lt_FILECMD - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -28161,11 +27702,8 @@ sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR -# Flags to create an archive (by configure). -lt_ar_flags=$lt_ar_flags - # Flags to create an archive. -AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} +AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec @@ -28555,7 +28093,7 @@ ltmain=$ac_aux_dir/ltmain.sh # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - $SED '$q' "$ltmain" >> "$cfgfile" \ + sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || diff --git a/lib/c-ares-1.33.1/configure.ac b/lib/c-ares-1.34.4/configure.ac similarity index 96% rename from lib/c-ares-1.33.1/configure.ac rename to lib/c-ares-1.34.4/configure.ac index 59fd975b64f..9dacf1fb2e4 100644 --- a/lib/c-ares-1.33.1/configure.ac +++ b/lib/c-ares-1.34.4/configure.ac @@ -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.4], [c-ares mailing list: http://lists.haxx.se/listinfo/c-ares]) -CARES_VERSION_INFO="20:1:18" +CARES_VERSION_INFO="21:3: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. @@ -245,18 +245,25 @@ AC_SUBST(CARES_SYMBOL_HIDING_CFLAG) if test "$enable_warnings" = "yes"; then AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Wno-long-long ], [AM_CFLAGS], [-Werror]) - - dnl Android requires c99, all others should use c90 - case $host_os in - *android*) - AX_APPEND_COMPILE_FLAGS([-std=c99], [AM_CFLAGS], [-Werror]) - ;; - *) - AX_APPEND_COMPILE_FLAGS([-std=c90], [AM_CFLAGS], [-Werror]) - ;; - esac fi +dnl Android and QNX require c99, all others should use c90 +case $host_os in + *qnx*|*android*) + AX_APPEND_COMPILE_FLAGS([-std=c99], [AM_CFLAGS], [-Werror]) + ;; + *) + AX_APPEND_COMPILE_FLAGS([-std=c90], [AM_CFLAGS], [-Werror]) + ;; +esac + +dnl QNX needs -D_QNX_SOURCE +case $host_os in + *qnx*) + AX_APPEND_COMPILE_FLAGS([-D_QNX_SOURCE], [AM_CPPFLAGS], [-Werror]) + ;; +esac + if test "$ax_cv_c_compiler_vendor" = "intel"; then AX_APPEND_COMPILE_FLAGS([-shared-intel], [AM_CFLAGS]) fi @@ -373,7 +380,7 @@ AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]), dnl check for a few basic system headers we need. It would be nice if we could dnl split these on separate lines, but for some reason autotools on Windows doesn't dnl allow this, even tried ending lines with a backslash. -AC_CHECK_HEADERS([malloc.h memory.h AvailabilityMacros.h sys/types.h sys/time.h sys/select.h sys/socket.h sys/filio.h sys/ioctl.h sys/param.h sys/uio.h sys/random.h sys/event.h sys/epoll.h assert.h iphlpapi.h netioapi.h netdb.h netinet/in.h netinet6/in6.h netinet/tcp.h net/if.h ifaddrs.h fcntl.h errno.h socket.h strings.h stdbool.h time.h poll.h limits.h arpa/nameser.h arpa/nameser_compat.h arpa/inet.h ], +AC_CHECK_HEADERS([malloc.h memory.h AvailabilityMacros.h sys/types.h sys/time.h sys/select.h sys/socket.h sys/filio.h sys/ioctl.h sys/param.h sys/uio.h sys/random.h sys/event.h sys/epoll.h assert.h iphlpapi.h netioapi.h netdb.h netinet/in.h netinet6/in6.h netinet/tcp.h net/if.h ifaddrs.h fcntl.h errno.h socket.h strings.h stdbool.h time.h poll.h limits.h arpa/nameser.h arpa/nameser_compat.h arpa/inet.h sys/system_properties.h ], dnl to do if not found [], dnl to do if found @@ -488,6 +495,9 @@ cares_all_includes=" #ifdef HAVE_RESOLV_H # include #endif +#ifdef HAVE_SYS_SYSTEM_PROPERTIES_H +# include +#endif #ifdef HAVE_IPHLPAPI_H # include #endif @@ -540,9 +550,12 @@ 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(strnlen, [AC_DEFINE([HAVE_STRNLEN], 1, [Define to 1 if you have `strnlen`] )], [], $cares_all_includes) +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) @@ -808,6 +821,13 @@ if test "x$build_tests" != "xno" -a "x$cross_compiling" = "xyes" ; then AC_MSG_ERROR([*** Tests not supported when cross compiling]) fi fi + +dnl Forces compiling of tests even when cross-compiling. +AC_ARG_ENABLE(tests-crossbuild, + AS_HELP_STRING([--enable-tests-crossbuild], [Enable test building even when cross building]), + [build_tests="$enableval"] +) + if test "x$build_tests" != "xno" ; then PKG_CHECK_MODULES([GMOCK], [gmock], [ have_gmock=yes ], [ have_gmock=no ]) if test "x$have_gmock" = "xno" ; then @@ -820,8 +840,8 @@ if test "x$build_tests" != "xno" ; then else PKG_CHECK_MODULES([GMOCK112], [gmock >= 1.12.0], [ have_gmock_v112=yes ], [ have_gmock_v112=no ]) if test "x$have_gmock_v112" = "xyes" ; then - AX_CHECK_USER_NAMESPACE - AX_CHECK_UTS_NAMESPACE + ARES_CHECK_USER_NAMESPACE + ARES_CHECK_UTS_NAMESPACE fi fi fi diff --git a/lib/c-ares-1.33.1/docs/CMakeLists.txt b/lib/c-ares-1.34.4/docs/CMakeLists.txt similarity index 100% rename from lib/c-ares-1.33.1/docs/CMakeLists.txt rename to lib/c-ares-1.34.4/docs/CMakeLists.txt diff --git a/lib/c-ares-1.33.1/docs/Makefile.am b/lib/c-ares-1.34.4/docs/Makefile.am similarity index 100% rename from lib/c-ares-1.33.1/docs/Makefile.am rename to lib/c-ares-1.34.4/docs/Makefile.am diff --git a/lib/c-ares-1.33.1/docs/Makefile.in b/lib/c-ares-1.34.4/docs/Makefile.in similarity index 96% rename from lib/c-ares-1.33.1/docs/Makefile.in rename to lib/c-ares-1.34.4/docs/Makefile.in index a57cd0abc18..0d1873c9662 100644 --- a/lib/c-ares-1.33.1/docs/Makefile.in +++ b/lib/c-ares-1.34.4/docs/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2024 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -72,8 +72,6 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -am__rm_f = rm -f $(am__rm_f_notfound) -am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -94,7 +92,9 @@ build_triplet = @build@ host_triplet = @host@ subdir = docs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ + $(top_srcdir)/m4/ares_check_uts_namespace.m4 \ + $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ @@ -104,8 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_user_namespace.m4 \ - $(top_srcdir)/m4/ax_check_uts_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ @@ -168,9 +166,10 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ - { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ } man3dir = $(mandir)/man3 am__installdirs = "$(DESTDIR)$(man3dir)" @@ -224,7 +223,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ @@ -291,10 +289,8 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ -am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ @@ -386,6 +382,7 @@ MANPAGES = ares_cancel.3 \ ares_dns_rr.3 \ ares_dns_rr_add_abin.3 \ ares_dns_rr_del_abin.3 \ + ares_dns_rr_del_opt_byid.3 \ ares_dns_rr_get_abin.3 \ ares_dns_rr_get_abin_cnt.3 \ ares_dns_rr_get_addr.3 \ @@ -457,6 +454,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 +471,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 \ @@ -479,6 +480,7 @@ MANPAGES = ares_cancel.3 \ ares_set_socket_callback.3 \ ares_set_socket_configure_callback.3 \ ares_set_socket_functions.3 \ + ares_set_socket_functions_ex.3 \ ares_set_sortlist.3 \ ares_strerror.3 \ ares_svcb_param_t.3 \ @@ -643,8 +645,8 @@ mostlyclean-generic: clean-generic: distclean-generic: - -$(am__rm_f) $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -738,10 +740,3 @@ uninstall-man: uninstall-man3 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - -# Tell GNU make to disable its built-in pattern rules. -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% diff --git a/lib/c-ares-1.33.1/docs/Makefile.inc b/lib/c-ares-1.34.4/docs/Makefile.inc similarity index 95% rename from lib/c-ares-1.33.1/docs/Makefile.inc rename to lib/c-ares-1.34.4/docs/Makefile.inc index 46e30346cfb..b5519369aa9 100644 --- a/lib/c-ares-1.33.1/docs/Makefile.inc +++ b/lib/c-ares-1.34.4/docs/Makefile.inc @@ -43,6 +43,7 @@ MANPAGES = ares_cancel.3 \ ares_dns_rr.3 \ ares_dns_rr_add_abin.3 \ ares_dns_rr_del_abin.3 \ + ares_dns_rr_del_opt_byid.3 \ ares_dns_rr_get_abin.3 \ ares_dns_rr_get_abin_cnt.3 \ ares_dns_rr_get_addr.3 \ @@ -114,6 +115,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 +132,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 \ @@ -136,6 +141,7 @@ MANPAGES = ares_cancel.3 \ ares_set_socket_callback.3 \ ares_set_socket_configure_callback.3 \ ares_set_socket_functions.3 \ + ares_set_socket_functions_ex.3 \ ares_set_sortlist.3 \ ares_strerror.3 \ ares_svcb_param_t.3 \ diff --git a/lib/c-ares-1.34.4/docs/adig.1 b/lib/c-ares-1.34.4/docs/adig.1 new file mode 100644 index 00000000000..e0b81c91e3f --- /dev/null +++ b/lib/c-ares-1.34.4/docs/adig.1 @@ -0,0 +1,179 @@ +.\" +.\" Copyright (C) the Massachusetts Institute of Technology. +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.\" +.TH ADIG "1" "Sept 2024" "c-ares utilities" +.SH NAME +adig \- print information collected from Domain Name System (DNS) servers +.SH SYNOPSIS +\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 +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. +.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 +Sets the query class, defaults to IN. May also be HS or CH. +.TP +\fB\-h\fR +Prints the help. +.TP +\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\-q\fR name +Specifies the domain name to query. Useful to distinguish name from other +arguments +.TP +\fB\-r\fR +Skip adigrc processing +.TP +\fB\-s\fR +Server (alias for @server syntax), compatibility with old cmdline +.TP +\fB\-t\fR type +Indicates resource record type to query. Useful to distinguish type from other +arguments +.TP +\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+[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 github issues tracker +.br +\fBhttps://github.com/c-ares/c-ares/issues\fR +.SH "SEE ALSO" +.PP +ahost(1). diff --git a/lib/c-ares-1.33.1/docs/ahost.1 b/lib/c-ares-1.34.4/docs/ahost.1 similarity index 100% rename from lib/c-ares-1.33.1/docs/ahost.1 rename to lib/c-ares-1.34.4/docs/ahost.1 diff --git a/lib/c-ares-1.33.1/docs/ares_cancel.3 b/lib/c-ares-1.34.4/docs/ares_cancel.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_cancel.3 rename to lib/c-ares-1.34.4/docs/ares_cancel.3 diff --git a/lib/c-ares-1.33.1/docs/ares_create_query.3 b/lib/c-ares-1.34.4/docs/ares_create_query.3 similarity index 95% rename from lib/c-ares-1.33.1/docs/ares_create_query.3 rename to lib/c-ares-1.34.4/docs/ares_create_query.3 index a54eec3e2a6..3af6ba4cc3d 100644 --- a/lib/c-ares-1.33.1/docs/ares_create_query.3 +++ b/lib/c-ares-1.34.4/docs/ares_create_query.3 @@ -19,6 +19,9 @@ int ares_create_query(const char *\fIname\fP, int \fImax_udp_size\fP) .fi .SH DESCRIPTION +This function is deprecated as of c-ares 1.22, please use +\fIares_dns_record_create(3)\fP instead. + The \fIares_create_query(3)\fP function composes a DNS query with a single question. The parameter \fIname\fP gives the query name as a NUL-terminated C string of period-separated labels optionally ending with a period; periods and diff --git a/lib/c-ares-1.33.1/docs/ares_destroy.3 b/lib/c-ares-1.34.4/docs/ares_destroy.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_destroy.3 rename to lib/c-ares-1.34.4/docs/ares_destroy.3 diff --git a/lib/c-ares-1.33.1/docs/ares_destroy_options.3 b/lib/c-ares-1.34.4/docs/ares_destroy_options.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_destroy_options.3 rename to lib/c-ares-1.34.4/docs/ares_destroy_options.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_class_fromstr.3 b/lib/c-ares-1.34.4/docs/ares_dns_class_fromstr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_class_fromstr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_class_fromstr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_class_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_class_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_class_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_class_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_class_tostr.3 b/lib/c-ares-1.34.4/docs/ares_dns_class_tostr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_class_tostr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_class_tostr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_datatype_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_datatype_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_datatype_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_datatype_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_flags_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_flags_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_flags_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_flags_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_mapping.3 b/lib/c-ares-1.34.4/docs/ares_dns_mapping.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_mapping.3 rename to lib/c-ares-1.34.4/docs/ares_dns_mapping.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_opcode_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_opcode_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_opcode_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_opcode_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_opcode_tostr.3 b/lib/c-ares-1.34.4/docs/ares_dns_opcode_tostr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_opcode_tostr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_opcode_tostr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_opt_datatype_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_opt_datatype_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_opt_datatype_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_opt_datatype_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_opt_get_datatype.3 b/lib/c-ares-1.34.4/docs/ares_dns_opt_get_datatype.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_opt_get_datatype.3 rename to lib/c-ares-1.34.4/docs/ares_dns_opt_get_datatype.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_opt_get_name.3 b/lib/c-ares-1.34.4/docs/ares_dns_opt_get_name.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_opt_get_name.3 rename to lib/c-ares-1.34.4/docs/ares_dns_opt_get_name.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_parse.3 b/lib/c-ares-1.34.4/docs/ares_dns_parse.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_parse.3 rename to lib/c-ares-1.34.4/docs/ares_dns_parse.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rcode_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_rcode_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rcode_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rcode_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rcode_tostr.3 b/lib/c-ares-1.34.4/docs/ares_dns_rcode_tostr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rcode_tostr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rcode_tostr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rec_type_fromstr.3 b/lib/c-ares-1.34.4/docs/ares_dns_rec_type_fromstr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rec_type_fromstr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rec_type_fromstr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rec_type_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_rec_type_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rec_type_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rec_type_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rec_type_tostr.3 b/lib/c-ares-1.34.4/docs/ares_dns_rec_type_tostr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rec_type_tostr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rec_type_tostr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record.3 b/lib/c-ares-1.34.4/docs/ares_dns_record.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_create.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_create.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_create.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_create.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_destroy.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_destroy.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_destroy.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_destroy.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_duplicate.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_duplicate.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_duplicate.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_duplicate.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_get_flags.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_get_flags.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_get_flags.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_get_flags.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_get_id.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_get_id.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_get_id.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_get_id.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_get_opcode.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_get_opcode.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_get_opcode.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_get_opcode.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_get_rcode.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_get_rcode.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_get_rcode.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_get_rcode.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_query_add.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_query_add.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_query_add.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_query_add.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_query_cnt.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_query_cnt.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_query_cnt.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_query_cnt.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_query_get.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_query_get.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_query_get.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_query_get.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_query_set_name.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_query_set_name.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_query_set_name.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_query_set_name.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_query_set_type.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_query_set_type.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_query_set_type.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_query_set_type.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_rr_add.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_rr_add.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_rr_add.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_rr_add.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_rr_cnt.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_rr_cnt.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_rr_cnt.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_rr_cnt.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_rr_del.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_rr_del.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_rr_del.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_rr_del.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_rr_get.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_rr_get.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_rr_get.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_rr_get.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_rr_get_const.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_rr_get_const.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_rr_get_const.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_rr_get_const.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_record_set_id.3 b/lib/c-ares-1.34.4/docs/ares_dns_record_set_id.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_record_set_id.3 rename to lib/c-ares-1.34.4/docs/ares_dns_record_set_id.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_add_abin.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_add_abin.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_add_abin.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_add_abin.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_del_abin.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_del_abin.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_del_abin.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_del_abin.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_abin.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_del_opt_byid.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_abin.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_del_opt_byid.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_abin_cnt.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_abin.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_abin_cnt.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_abin.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_addr.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_abin_cnt.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_addr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_abin_cnt.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_addr6.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_addr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_addr6.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_addr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_bin.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_addr6.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_bin.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_addr6.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_class.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_bin.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_class.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_bin.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_name.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_class.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_name.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_class.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_keys.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_keys.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_keys.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_keys.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_opt.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_name.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_opt.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_name.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_opt_byid.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_opt.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_opt_byid.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_opt.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_opt_cnt.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_opt_byid.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_opt_cnt.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_opt_byid.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_str.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_opt_cnt.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_str.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_opt_cnt.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_ttl.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_str.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_ttl.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_str.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_type.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_ttl.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_type.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_ttl.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_u16.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_type.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_u16.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_type.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_u32.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_u16.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_u32.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_u16.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_get_u8.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_u32.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_get_u8.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_u32.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_key_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_get_u8.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_key_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_get_u8.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_key_datatype.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_key_datatype.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_key_datatype.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_key_datatype.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_set_addr.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_key_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_set_addr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_key_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_key_to_rec_type.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_key_to_rec_type.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_key_to_rec_type.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_key_to_rec_type.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_key_tostr.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_key_tostr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_key_tostr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_key_tostr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_set_addr6.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_set_addr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_set_addr6.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_set_addr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_set_bin.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_set_addr6.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_set_bin.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_set_addr6.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_set_opt.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_set_bin.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_set_opt.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_set_bin.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_set_str.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_set_opt.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_set_str.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_set_opt.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_set_u16.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_set_str.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_set_u16.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_set_str.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_set_u32.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_set_u16.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_set_u32.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_set_u16.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_rr_set_u8.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_set_u32.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_rr_set_u8.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_set_u32.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_section_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_rr_set_u8.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_section_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_rr_set_u8.3 diff --git a/lib/c-ares-1.33.1/docs/ares_tlsa_match_t.3 b/lib/c-ares-1.34.4/docs/ares_dns_section_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_tlsa_match_t.3 rename to lib/c-ares-1.34.4/docs/ares_dns_section_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_section_tostr.3 b/lib/c-ares-1.34.4/docs/ares_dns_section_tostr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_section_tostr.3 rename to lib/c-ares-1.34.4/docs/ares_dns_section_tostr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dns_write.3 b/lib/c-ares-1.34.4/docs/ares_dns_write.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dns_write.3 rename to lib/c-ares-1.34.4/docs/ares_dns_write.3 diff --git a/lib/c-ares-1.33.1/docs/ares_dup.3 b/lib/c-ares-1.34.4/docs/ares_dup.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_dup.3 rename to lib/c-ares-1.34.4/docs/ares_dup.3 diff --git a/lib/c-ares-1.33.1/docs/ares_expand_name.3 b/lib/c-ares-1.34.4/docs/ares_expand_name.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_expand_name.3 rename to lib/c-ares-1.34.4/docs/ares_expand_name.3 diff --git a/lib/c-ares-1.33.1/docs/ares_expand_string.3 b/lib/c-ares-1.34.4/docs/ares_expand_string.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_expand_string.3 rename to lib/c-ares-1.34.4/docs/ares_expand_string.3 diff --git a/lib/c-ares-1.33.1/docs/ares_fds.3 b/lib/c-ares-1.34.4/docs/ares_fds.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_fds.3 rename to lib/c-ares-1.34.4/docs/ares_fds.3 diff --git a/lib/c-ares-1.33.1/docs/ares_free_data.3 b/lib/c-ares-1.34.4/docs/ares_free_data.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_free_data.3 rename to lib/c-ares-1.34.4/docs/ares_free_data.3 diff --git a/lib/c-ares-1.33.1/docs/ares_free_hostent.3 b/lib/c-ares-1.34.4/docs/ares_free_hostent.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_free_hostent.3 rename to lib/c-ares-1.34.4/docs/ares_free_hostent.3 diff --git a/lib/c-ares-1.33.1/docs/ares_free_string.3 b/lib/c-ares-1.34.4/docs/ares_free_string.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_free_string.3 rename to lib/c-ares-1.34.4/docs/ares_free_string.3 diff --git a/lib/c-ares-1.33.1/docs/ares_freeaddrinfo.3 b/lib/c-ares-1.34.4/docs/ares_freeaddrinfo.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_freeaddrinfo.3 rename to lib/c-ares-1.34.4/docs/ares_freeaddrinfo.3 diff --git a/lib/c-ares-1.33.1/docs/ares_get_servers.3 b/lib/c-ares-1.34.4/docs/ares_get_servers.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_get_servers.3 rename to lib/c-ares-1.34.4/docs/ares_get_servers.3 diff --git a/lib/c-ares-1.33.1/docs/ares_get_servers_csv.3 b/lib/c-ares-1.34.4/docs/ares_get_servers_csv.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_get_servers_csv.3 rename to lib/c-ares-1.34.4/docs/ares_get_servers_csv.3 diff --git a/lib/c-ares-1.33.1/docs/ares_get_servers_ports.3 b/lib/c-ares-1.34.4/docs/ares_get_servers_ports.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_get_servers_ports.3 rename to lib/c-ares-1.34.4/docs/ares_get_servers_ports.3 diff --git a/lib/c-ares-1.33.1/docs/ares_getaddrinfo.3 b/lib/c-ares-1.34.4/docs/ares_getaddrinfo.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_getaddrinfo.3 rename to lib/c-ares-1.34.4/docs/ares_getaddrinfo.3 diff --git a/lib/c-ares-1.33.1/docs/ares_gethostbyaddr.3 b/lib/c-ares-1.34.4/docs/ares_gethostbyaddr.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_gethostbyaddr.3 rename to lib/c-ares-1.34.4/docs/ares_gethostbyaddr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_gethostbyname.3 b/lib/c-ares-1.34.4/docs/ares_gethostbyname.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_gethostbyname.3 rename to lib/c-ares-1.34.4/docs/ares_gethostbyname.3 diff --git a/lib/c-ares-1.33.1/docs/ares_gethostbyname_file.3 b/lib/c-ares-1.34.4/docs/ares_gethostbyname_file.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_gethostbyname_file.3 rename to lib/c-ares-1.34.4/docs/ares_gethostbyname_file.3 diff --git a/lib/c-ares-1.33.1/docs/ares_getnameinfo.3 b/lib/c-ares-1.34.4/docs/ares_getnameinfo.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_getnameinfo.3 rename to lib/c-ares-1.34.4/docs/ares_getnameinfo.3 diff --git a/lib/c-ares-1.33.1/docs/ares_getsock.3 b/lib/c-ares-1.34.4/docs/ares_getsock.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_getsock.3 rename to lib/c-ares-1.34.4/docs/ares_getsock.3 diff --git a/lib/c-ares-1.33.1/docs/ares_inet_ntop.3 b/lib/c-ares-1.34.4/docs/ares_inet_ntop.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_inet_ntop.3 rename to lib/c-ares-1.34.4/docs/ares_inet_ntop.3 diff --git a/lib/c-ares-1.33.1/docs/ares_inet_pton.3 b/lib/c-ares-1.34.4/docs/ares_inet_pton.3 similarity index 77% rename from lib/c-ares-1.33.1/docs/ares_inet_pton.3 rename to lib/c-ares-1.34.4/docs/ares_inet_pton.3 index 5b7b8010d22..34b2df063c6 100644 --- a/lib/c-ares-1.33.1/docs/ares_inet_pton.3 +++ b/lib/c-ares-1.34.4/docs/ares_inet_pton.3 @@ -9,7 +9,7 @@ ares_inet_pton \- convert an IPv4 or IPv6 address from text to binary form .nf #include -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) diff --git a/lib/c-ares-1.33.1/docs/ares_init.3 b/lib/c-ares-1.34.4/docs/ares_init.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_init.3 rename to lib/c-ares-1.34.4/docs/ares_init.3 diff --git a/lib/c-ares-1.33.1/docs/ares_init_options.3 b/lib/c-ares-1.34.4/docs/ares_init_options.3 similarity index 97% rename from lib/c-ares-1.33.1/docs/ares_init_options.3 rename to lib/c-ares-1.34.4/docs/ares_init_options.3 index 694beb5ed28..9b3b4815355 100644 --- a/lib/c-ares-1.33.1/docs/ares_init_options.3 +++ b/lib/c-ares-1.34.4/docs/ares_init_options.3 @@ -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 diff --git a/lib/c-ares-1.33.1/docs/ares_library_cleanup.3 b/lib/c-ares-1.34.4/docs/ares_library_cleanup.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_library_cleanup.3 rename to lib/c-ares-1.34.4/docs/ares_library_cleanup.3 diff --git a/lib/c-ares-1.33.1/docs/ares_library_init.3 b/lib/c-ares-1.34.4/docs/ares_library_init.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_library_init.3 rename to lib/c-ares-1.34.4/docs/ares_library_init.3 diff --git a/lib/c-ares-1.33.1/docs/ares_library_init_android.3 b/lib/c-ares-1.34.4/docs/ares_library_init_android.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_library_init_android.3 rename to lib/c-ares-1.34.4/docs/ares_library_init_android.3 diff --git a/lib/c-ares-1.33.1/docs/ares_library_initialized.3 b/lib/c-ares-1.34.4/docs/ares_library_initialized.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_library_initialized.3 rename to lib/c-ares-1.34.4/docs/ares_library_initialized.3 diff --git a/lib/c-ares-1.33.1/docs/ares_mkquery.3 b/lib/c-ares-1.34.4/docs/ares_mkquery.3 similarity index 95% rename from lib/c-ares-1.33.1/docs/ares_mkquery.3 rename to lib/c-ares-1.34.4/docs/ares_mkquery.3 index 0e7b5edbb89..2f42d169210 100644 --- a/lib/c-ares-1.33.1/docs/ares_mkquery.3 +++ b/lib/c-ares-1.34.4/docs/ares_mkquery.3 @@ -14,7 +14,8 @@ int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP, int *\fIbuflen\fP) .fi .SH DESCRIPTION -Deprecated function. See \fIares_create_query(3)\fP instead! +This function is deprecated as of c-ares 1.10, please use +\fIares_dns_record_create(3)\fP instead. The .B ares_mkquery diff --git a/lib/c-ares-1.33.1/docs/ares_opt_param_t.3 b/lib/c-ares-1.34.4/docs/ares_opt_param_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_opt_param_t.3 rename to lib/c-ares-1.34.4/docs/ares_opt_param_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_a_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_a_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_a_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_a_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_aaaa_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_aaaa_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_aaaa_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_aaaa_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_caa_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_caa_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_caa_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_caa_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_mx_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_mx_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_mx_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_mx_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_naptr_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_naptr_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_naptr_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_naptr_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_ns_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_ns_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_ns_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_ns_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_ptr_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_ptr_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_ptr_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_ptr_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_soa_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_soa_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_soa_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_soa_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_srv_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_srv_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_srv_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_srv_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_txt_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_txt_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_txt_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_txt_reply.3 diff --git a/lib/c-ares-1.33.1/docs/ares_parse_uri_reply.3 b/lib/c-ares-1.34.4/docs/ares_parse_uri_reply.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_parse_uri_reply.3 rename to lib/c-ares-1.34.4/docs/ares_parse_uri_reply.3 diff --git a/lib/c-ares-1.34.4/docs/ares_process.3 b/lib/c-ares-1.34.4/docs/ares_process.3 new file mode 100644 index 00000000000..ce45a60d6c0 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_process.3 @@ -0,0 +1,109 @@ +.\" +.\" Copyright 1998 by the Massachusetts Institute of Technology. +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_PROCESS 3 "25 July 1998" +.SH NAME +ares_process_fds, ares_process_fd, ares_process \- Process events for name resolution +.SH SYNOPSIS +.nf +#include + +/*! 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) + +.fi +.SH DESCRIPTION +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_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_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. + +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. + +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. + +.SH SEE ALSO +.BR ares_fds (3), +.BR ares_timeout (3), +.BR ares_init_options (3) +with \fIARES_OPT_EVENT_THREAD\fP or \fIARES_OPT_SOCK_STATE_CB\fP diff --git a/lib/c-ares-1.34.4/docs/ares_process_fd.3 b/lib/c-ares-1.34.4/docs/ares_process_fd.3 new file mode 100644 index 00000000000..94e50f41a91 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_process_fd.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_process.3 diff --git a/lib/c-ares-1.34.4/docs/ares_process_fds.3 b/lib/c-ares-1.34.4/docs/ares_process_fds.3 new file mode 100644 index 00000000000..94e50f41a91 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_process_fds.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_process.3 diff --git a/lib/c-ares-1.34.4/docs/ares_process_pending_write.3 b/lib/c-ares-1.34.4/docs/ares_process_pending_write.3 new file mode 100644 index 00000000000..90843341950 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_process_pending_write.3 @@ -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 diff --git a/lib/c-ares-1.33.1/docs/ares_query.3 b/lib/c-ares-1.34.4/docs/ares_query.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_query.3 rename to lib/c-ares-1.34.4/docs/ares_query.3 diff --git a/lib/c-ares-1.33.1/docs/ares_query_dnsrec.3 b/lib/c-ares-1.34.4/docs/ares_query_dnsrec.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_query_dnsrec.3 rename to lib/c-ares-1.34.4/docs/ares_query_dnsrec.3 diff --git a/lib/c-ares-1.33.1/docs/ares_queue.3 b/lib/c-ares-1.34.4/docs/ares_queue.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_queue.3 rename to lib/c-ares-1.34.4/docs/ares_queue.3 diff --git a/lib/c-ares-1.33.1/docs/ares_queue_active_queries.3 b/lib/c-ares-1.34.4/docs/ares_queue_active_queries.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_queue_active_queries.3 rename to lib/c-ares-1.34.4/docs/ares_queue_active_queries.3 diff --git a/lib/c-ares-1.33.1/docs/ares_queue_wait_empty.3 b/lib/c-ares-1.34.4/docs/ares_queue_wait_empty.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_queue_wait_empty.3 rename to lib/c-ares-1.34.4/docs/ares_queue_wait_empty.3 diff --git a/lib/c-ares-1.33.1/docs/ares_reinit.3 b/lib/c-ares-1.34.4/docs/ares_reinit.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_reinit.3 rename to lib/c-ares-1.34.4/docs/ares_reinit.3 diff --git a/lib/c-ares-1.33.1/docs/ares_save_options.3 b/lib/c-ares-1.34.4/docs/ares_save_options.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_save_options.3 rename to lib/c-ares-1.34.4/docs/ares_save_options.3 diff --git a/lib/c-ares-1.33.1/docs/ares_search.3 b/lib/c-ares-1.34.4/docs/ares_search.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_search.3 rename to lib/c-ares-1.34.4/docs/ares_search.3 diff --git a/lib/c-ares-1.33.1/docs/ares_search_dnsrec.3 b/lib/c-ares-1.34.4/docs/ares_search_dnsrec.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_search_dnsrec.3 rename to lib/c-ares-1.34.4/docs/ares_search_dnsrec.3 diff --git a/lib/c-ares-1.33.1/docs/ares_send.3 b/lib/c-ares-1.34.4/docs/ares_send.3 similarity index 98% rename from lib/c-ares-1.33.1/docs/ares_send.3 rename to lib/c-ares-1.34.4/docs/ares_send.3 index f6ea9140e25..df3e3bbe413 100644 --- a/lib/c-ares-1.33.1/docs/ares_send.3 +++ b/lib/c-ares-1.34.4/docs/ares_send.3 @@ -113,6 +113,9 @@ is being destroyed; the query will not be completed. .B ARES_ENOSERVER The query will not be completed because no DNS servers were configured on the channel. +.TP 19 +.B ARES_EBADQUERY +Misformatted DNS query. .PP The callback argument diff --git a/lib/c-ares-1.33.1/docs/ares_send_dnsrec.3 b/lib/c-ares-1.34.4/docs/ares_send_dnsrec.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_send_dnsrec.3 rename to lib/c-ares-1.34.4/docs/ares_send_dnsrec.3 diff --git a/lib/c-ares-1.33.1/docs/ares_set_local_dev.3 b/lib/c-ares-1.34.4/docs/ares_set_local_dev.3 similarity index 63% rename from lib/c-ares-1.33.1/docs/ares_set_local_dev.3 rename to lib/c-ares-1.34.4/docs/ares_set_local_dev.3 index 2e2028f616a..621cf35184f 100644 --- a/lib/c-ares-1.33.1/docs/ares_set_local_dev.3 +++ b/lib/c-ares-1.34.4/docs/ares_set_local_dev.3 @@ -2,7 +2,7 @@ .\" Copyright 2010 by Ben Greear .\" 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 diff --git a/lib/c-ares-1.33.1/docs/ares_set_local_ip4.3 b/lib/c-ares-1.34.4/docs/ares_set_local_ip4.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_local_ip4.3 rename to lib/c-ares-1.34.4/docs/ares_set_local_ip4.3 diff --git a/lib/c-ares-1.33.1/docs/ares_set_local_ip6.3 b/lib/c-ares-1.34.4/docs/ares_set_local_ip6.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_local_ip6.3 rename to lib/c-ares-1.34.4/docs/ares_set_local_ip6.3 diff --git a/lib/c-ares-1.34.4/docs/ares_set_pending_write_cb.3 b/lib/c-ares-1.34.4/docs/ares_set_pending_write_cb.3 new file mode 100644 index 00000000000..3c7712a69d9 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_set_pending_write_cb.3 @@ -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 + +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) diff --git a/lib/c-ares-1.33.1/docs/ares_set_server_state_callback.3 b/lib/c-ares-1.34.4/docs/ares_set_server_state_callback.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_server_state_callback.3 rename to lib/c-ares-1.34.4/docs/ares_set_server_state_callback.3 diff --git a/lib/c-ares-1.33.1/docs/ares_set_servers.3 b/lib/c-ares-1.34.4/docs/ares_set_servers.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_servers.3 rename to lib/c-ares-1.34.4/docs/ares_set_servers.3 diff --git a/lib/c-ares-1.34.4/docs/ares_set_servers_csv.3 b/lib/c-ares-1.34.4/docs/ares_set_servers_csv.3 new file mode 100644 index 00000000000..f1435143f56 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_set_servers_csv.3 @@ -0,0 +1,163 @@ +.\" +.\" Copyright 2010 by Ben Greear +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_SET_SERVERS_CSV 3 "5 Dec 2023" +.SH NAME +ares_set_servers_csv, ares_set_servers_ports_csv, ares_get_servers_csv \- Set +or Get a list of DNS servers used for queries. +.SH SYNOPSIS +.nf +#include + +int ares_set_servers_csv(ares_channel_t *\fIchannel\fP, const char* \fIservers\fP) + +int ares_set_servers_ports_csv(ares_channel_t *\fIchannel\fP, const char* \fIservers\fP) + +char *ares_get_servers_csv(const ares_channel_t *\fIchannel\fP) +.fi +.SH DESCRIPTION +The \fBares_set_servers_csv\fP and \fBares_set_servers_ports_csv\fP functions set +the list of DNS servers that c-ares will query. As of v1.22.0 this function can +be called on an active channel with running queries, previously it would return +ARES_ENOTIMP. + +Though not recommended, passing NULL for servers will clear all configured +servers and make an inoperable channel, this may be advantageous for test +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. 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. + +The \fBport\fP is optional, and will default to 53 or the value specified in +\fBares_init_options(3)\fP. + +The \fBiface\fP is specific to IPv6 link-local servers (fe80::/10) and should +not otherwise be used. +.RE + +\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. + +.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 +.B ares_set_servers_ports_csv(3) +may return any of the following values: +.TP 15 +.B ARES_SUCCESS +The name servers configuration was successfully initialized. +.TP 15 +.B ARES_ENOMEM +The process's available memory was exhausted. +.TP 15 +.B ARES_ENODATA +The channel data identified by +.IR channel +was invalid. +.TP 15 +.B ARES_ENOTINITIALIZED +c-ares library initialization not yet performed. +.PP +.B ares_get_servers_csv(3) +returns a string representing the servers configured which must be freed with +\fBares_free_string(3)\fP. If it returns NULL, this is an out of memory condition. +.SH SEE ALSO +.BR ares_set_servers (3) +.SH AVAILABILITY +\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. diff --git a/lib/c-ares-1.33.1/docs/ares_set_servers_ports.3 b/lib/c-ares-1.34.4/docs/ares_set_servers_ports.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_servers_ports.3 rename to lib/c-ares-1.34.4/docs/ares_set_servers_ports.3 diff --git a/lib/c-ares-1.33.1/docs/ares_set_servers_ports_csv.3 b/lib/c-ares-1.34.4/docs/ares_set_servers_ports_csv.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_servers_ports_csv.3 rename to lib/c-ares-1.34.4/docs/ares_set_servers_ports_csv.3 diff --git a/lib/c-ares-1.33.1/docs/ares_set_socket_callback.3 b/lib/c-ares-1.34.4/docs/ares_set_socket_callback.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_socket_callback.3 rename to lib/c-ares-1.34.4/docs/ares_set_socket_callback.3 diff --git a/lib/c-ares-1.33.1/docs/ares_set_socket_configure_callback.3 b/lib/c-ares-1.34.4/docs/ares_set_socket_configure_callback.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_socket_configure_callback.3 rename to lib/c-ares-1.34.4/docs/ares_set_socket_configure_callback.3 diff --git a/lib/c-ares-1.34.4/docs/ares_set_socket_functions.3 b/lib/c-ares-1.34.4/docs/ares_set_socket_functions.3 new file mode 100644 index 00000000000..8a903dc6521 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_set_socket_functions.3 @@ -0,0 +1,334 @@ +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.TH ARES_SET_SOCKET_FUNCTIONS 3 "8 Oct 2024" +.SH NAME +ares_set_socket_functions, ares_set_socket_functions_ex \- Set socket io callbacks +.SH SYNOPSIS +.nf +#include + +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 *); + int (*\fIaconnect\fP)(ares_socket_t, const struct sockaddr *, ares_socklen_t, void *); + ares_ssize_t (*\fIarecvfrom\fP)(ares_socket_t, void *, size_t, int, + struct sockaddr *, ares_socklen_t *, void *); + ares_ssize_t (*\fIasendv\fP)(ares_socket_t, const struct iovec *, int, void *); +}; + +void ares_set_socket_functions(ares_channel_t *\fIchannel\fP, + const struct ares_socket_functions * \fIfunctions\fP, + void *\fIuser_data\fP); +.fi +.SH DESCRIPTION +.PP + +\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 +\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 +\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 \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 \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 +\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 +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 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 \fBwritev(2)\fP +.RE + +.PP +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 +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 recvfrom (2), +.BR sendto (2), +.BR bind (2), +.BR getsockname (2), +.BR setsockopt (2), +.BR writev (2) diff --git a/lib/c-ares-1.34.4/docs/ares_set_socket_functions_ex.3 b/lib/c-ares-1.34.4/docs/ares_set_socket_functions_ex.3 new file mode 100644 index 00000000000..a0f02456c32 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_set_socket_functions_ex.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2024 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_set_socket_functions.3 diff --git a/lib/c-ares-1.33.1/docs/ares_set_sortlist.3 b/lib/c-ares-1.34.4/docs/ares_set_sortlist.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_set_sortlist.3 rename to lib/c-ares-1.34.4/docs/ares_set_sortlist.3 diff --git a/lib/c-ares-1.33.1/docs/ares_strerror.3 b/lib/c-ares-1.34.4/docs/ares_strerror.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_strerror.3 rename to lib/c-ares-1.34.4/docs/ares_strerror.3 diff --git a/lib/c-ares-1.33.1/docs/ares_svcb_param_t.3 b/lib/c-ares-1.34.4/docs/ares_svcb_param_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_svcb_param_t.3 rename to lib/c-ares-1.34.4/docs/ares_svcb_param_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_threadsafety.3 b/lib/c-ares-1.34.4/docs/ares_threadsafety.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_threadsafety.3 rename to lib/c-ares-1.34.4/docs/ares_threadsafety.3 diff --git a/lib/c-ares-1.33.1/docs/ares_timeout.3 b/lib/c-ares-1.34.4/docs/ares_timeout.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_timeout.3 rename to lib/c-ares-1.34.4/docs/ares_timeout.3 diff --git a/lib/c-ares-1.33.1/docs/ares_tlsa_selector_t.3 b/lib/c-ares-1.34.4/docs/ares_tlsa_match_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_tlsa_selector_t.3 rename to lib/c-ares-1.34.4/docs/ares_tlsa_match_t.3 diff --git a/lib/c-ares-1.33.1/docs/ares_tlsa_usage_t.3 b/lib/c-ares-1.34.4/docs/ares_tlsa_selector_t.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_tlsa_usage_t.3 rename to lib/c-ares-1.34.4/docs/ares_tlsa_selector_t.3 diff --git a/lib/c-ares-1.34.4/docs/ares_tlsa_usage_t.3 b/lib/c-ares-1.34.4/docs/ares_tlsa_usage_t.3 new file mode 100644 index 00000000000..b93e4cd4e37 --- /dev/null +++ b/lib/c-ares-1.34.4/docs/ares_tlsa_usage_t.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/lib/c-ares-1.33.1/docs/ares_version.3 b/lib/c-ares-1.34.4/docs/ares_version.3 similarity index 100% rename from lib/c-ares-1.33.1/docs/ares_version.3 rename to lib/c-ares-1.34.4/docs/ares_version.3 diff --git a/lib/c-ares-1.33.1/include/CMakeLists.txt b/lib/c-ares-1.34.4/include/CMakeLists.txt similarity index 100% rename from lib/c-ares-1.33.1/include/CMakeLists.txt rename to lib/c-ares-1.34.4/include/CMakeLists.txt diff --git a/lib/c-ares-1.33.1/include/Makefile.am b/lib/c-ares-1.34.4/include/Makefile.am similarity index 100% rename from lib/c-ares-1.33.1/include/Makefile.am rename to lib/c-ares-1.34.4/include/Makefile.am diff --git a/lib/c-ares-1.33.1/include/Makefile.in b/lib/c-ares-1.34.4/include/Makefile.in similarity index 95% rename from lib/c-ares-1.33.1/include/Makefile.in rename to lib/c-ares-1.34.4/include/Makefile.in index 99936f86497..7dc40eb08fa 100644 --- a/lib/c-ares-1.33.1/include/Makefile.in +++ b/lib/c-ares-1.34.4/include/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2024 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -70,8 +70,6 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -am__rm_f = rm -f $(am__rm_f_notfound) -am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -92,7 +90,9 @@ build_triplet = @build@ host_triplet = @host@ subdir = include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ + $(top_srcdir)/m4/ares_check_uts_namespace.m4 \ + $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ @@ -102,8 +102,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_user_namespace.m4 \ - $(top_srcdir)/m4/ax_check_uts_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ @@ -164,9 +162,10 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ - { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(include_HEADERS) @@ -235,7 +234,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ @@ -302,10 +300,8 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ -am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ @@ -398,8 +394,8 @@ ares_build.h: stamp-h2 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h2 stamp-h2: $(srcdir)/ares_build.h.in $(top_builddir)/config.status - $(AM_V_at)rm -f stamp-h2 - $(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status include/ares_build.h + @rm -f stamp-h2 + cd $(top_builddir) && $(SHELL) ./config.status include/ares_build.h distclean-hdr: -rm -f ares_build.h stamp-h2 @@ -546,8 +542,8 @@ mostlyclean-generic: clean-generic: distclean-generic: - -$(am__rm_f) $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -640,10 +636,3 @@ uninstall-am: uninstall-includeHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - -# Tell GNU make to disable its built-in pattern rules. -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% diff --git a/lib/c-ares-1.33.1/include/ares.h b/lib/c-ares-1.34.4/include/ares.h similarity index 68% rename from lib/c-ares-1.33.1/include/ares.h rename to lib/c-ares-1.34.4/include/ares.h index 95fc2440a1f..7fe3ec78f4e 100644 --- a/lib/c-ares-1.33.1/include/ares.h +++ b/lib/c-ares-1.34.4/include/ares.h @@ -74,7 +74,7 @@ #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ - defined(__QNXNTO__) || defined(__MVS__) || defined(__HAIKU__) + defined(__QNX__) || defined(__MVS__) || defined(__HAIKU__) # include #endif @@ -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, diff --git a/lib/c-ares-1.33.1/include/ares_build.h b/lib/c-ares-1.34.4/include/ares_build.h similarity index 99% rename from lib/c-ares-1.33.1/include/ares_build.h rename to lib/c-ares-1.34.4/include/ares_build.h index 18a92606a81..aca66bebcd9 100644 --- a/lib/c-ares-1.33.1/include/ares_build.h +++ b/lib/c-ares-1.34.4/include/ares_build.h @@ -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 diff --git a/lib/c-ares-1.33.1/include/ares_build.h.cmake b/lib/c-ares-1.34.4/include/ares_build.h.cmake similarity index 100% rename from lib/c-ares-1.33.1/include/ares_build.h.cmake rename to lib/c-ares-1.34.4/include/ares_build.h.cmake diff --git a/lib/c-ares-1.33.1/include/ares_build.h.in b/lib/c-ares-1.34.4/include/ares_build.h.in similarity index 100% rename from lib/c-ares-1.33.1/include/ares_build.h.in rename to lib/c-ares-1.34.4/include/ares_build.h.in diff --git a/lib/c-ares-1.33.1/include/ares_dns.h b/lib/c-ares-1.34.4/include/ares_dns.h similarity index 100% rename from lib/c-ares-1.33.1/include/ares_dns.h rename to lib/c-ares-1.34.4/include/ares_dns.h diff --git a/lib/c-ares-1.33.1/include/ares_dns_record.h b/lib/c-ares-1.34.4/include/ares_dns_record.h similarity index 100% rename from lib/c-ares-1.33.1/include/ares_dns_record.h rename to lib/c-ares-1.34.4/include/ares_dns_record.h diff --git a/lib/c-ares-1.33.1/include/ares_nameser.h b/lib/c-ares-1.34.4/include/ares_nameser.h similarity index 100% rename from lib/c-ares-1.33.1/include/ares_nameser.h rename to lib/c-ares-1.34.4/include/ares_nameser.h diff --git a/lib/c-ares-1.33.1/include/ares_version.h b/lib/c-ares-1.34.4/include/ares_version.h similarity index 81% rename from lib/c-ares-1.33.1/include/ares_version.h rename to lib/c-ares-1.34.4/include/ares_version.h index c910d79209a..782046bd79d 100644 --- a/lib/c-ares-1.33.1/include/ares_version.h +++ b/lib/c-ares-1.34.4/include/ares_version.h @@ -31,14 +31,17 @@ #define ARES_COPYRIGHT "2004 - 2024 Daniel Stenberg, ." #define ARES_VERSION_MAJOR 1 -#define ARES_VERSION_MINOR 33 -#define ARES_VERSION_PATCH 1 +#define ARES_VERSION_MINOR 34 +#define ARES_VERSION_PATCH 4 +#define ARES_VERSION_STR "1.34.4" + +/* NOTE: We cannot make the version string a C preprocessor stringify operation + * due to assumptions made by integrators that aren't properly using + * pkgconf or cmake and are doing their own detection based on parsing + * this header */ + #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 #endif diff --git a/lib/c-ares-1.33.1/libcares.pc.cmake b/lib/c-ares-1.34.4/libcares.pc.cmake similarity index 100% rename from lib/c-ares-1.33.1/libcares.pc.cmake rename to lib/c-ares-1.34.4/libcares.pc.cmake diff --git a/lib/c-ares-1.33.1/libcares.pc.in b/lib/c-ares-1.34.4/libcares.pc.in similarity index 100% rename from lib/c-ares-1.33.1/libcares.pc.in rename to lib/c-ares-1.34.4/libcares.pc.in diff --git a/lib/c-ares-1.33.1/m4/ax_check_user_namespace.m4 b/lib/c-ares-1.34.4/m4/ares_check_user_namespace.m4 similarity index 82% rename from lib/c-ares-1.33.1/m4/ax_check_user_namespace.m4 rename to lib/c-ares-1.34.4/m4/ares_check_user_namespace.m4 index aca721626f2..a26b384fda5 100644 --- a/lib/c-ares-1.33.1/m4/ax_check_user_namespace.m4 +++ b/lib/c-ares-1.34.4/m4/ares_check_user_namespace.m4 @@ -2,7 +2,7 @@ # SYNOPSIS # -# AX_CHECK_USER_NAMESPACE +# ARES_CHECK_USER_NAMESPACE # # DESCRIPTION # @@ -12,9 +12,9 @@ # Copyright (C) The c-ares team # SPDX-License-Identifier: MIT -AC_DEFUN([AX_CHECK_USER_NAMESPACE],[dnl +AC_DEFUN([ARES_CHECK_USER_NAMESPACE],[dnl AC_CACHE_CHECK([whether user namespaces are supported], - ax_cv_user_namespace,[ + ares_cv_user_namespace,[ AC_LANG_PUSH([C]) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #define _GNU_SOURCE @@ -48,10 +48,10 @@ int main() { if (!WIFEXITED(status)) return 1; return WEXITSTATUS(status); } - ]])],[ax_cv_user_namespace=yes],[ax_cv_user_namespace=no],[ax_cv_user_namespace=no]) + ]])],[ares_cv_user_namespace=yes],[ares_cv_user_namespace=no],[ares_cv_user_namespace=no]) AC_LANG_POP([C]) ]) - if test "$ax_cv_user_namespace" = yes; then + if test "$ares_cv_user_namespace" = yes; then AC_DEFINE([HAVE_USER_NAMESPACE],[1],[Whether user namespaces are available]) fi -]) # AX_CHECK_USER_NAMESPACE +]) # ARES_CHECK_USER_NAMESPACE diff --git a/lib/c-ares-1.33.1/m4/ax_check_uts_namespace.m4 b/lib/c-ares-1.34.4/m4/ares_check_uts_namespace.m4 similarity index 87% rename from lib/c-ares-1.33.1/m4/ax_check_uts_namespace.m4 rename to lib/c-ares-1.34.4/m4/ares_check_uts_namespace.m4 index 5708acf1b9f..0aeefe4a9b7 100644 --- a/lib/c-ares-1.33.1/m4/ax_check_uts_namespace.m4 +++ b/lib/c-ares-1.34.4/m4/ares_check_uts_namespace.m4 @@ -2,7 +2,7 @@ # SYNOPSIS # -# AX_CHECK_UTS_NAMESPACE +# ARES_CHECK_UTS_NAMESPACE # # DESCRIPTION # @@ -14,9 +14,9 @@ # Copyright (C) The c-ares team # SPDX-License-Identifier: MIT -AC_DEFUN([AX_CHECK_UTS_NAMESPACE],[dnl +AC_DEFUN([ARES_CHECK_UTS_NAMESPACE],[dnl AC_CACHE_CHECK([whether UTS namespaces are supported], - ax_cv_uts_namespace,[ + ares_cv_uts_namespace,[ AC_LANG_PUSH([C]) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #define _GNU_SOURCE @@ -70,10 +70,10 @@ int main() { return WEXITSTATUS(status); } ]]) - ],[ax_cv_uts_namespace=yes],[ax_cv_uts_namespace=no],[ax_cv_uts_namespace=no]) + ],[ares_cv_uts_namespace=yes],[ares_cv_uts_namespace=no],[ares_cv_uts_namespace=no]) AC_LANG_POP([C]) ]) - if test "$ax_cv_uts_namespace" = yes; then + if test "$ares_cv_uts_namespace" = yes; then AC_DEFINE([HAVE_UTS_NAMESPACE],[1],[Whether UTS namespaces are available]) fi -]) # AX_CHECK_UTS_NAMESPACE +]) # ARES_CHECK_UTS_NAMESPACE diff --git a/lib/c-ares-1.33.1/m4/ax_ac_append_to_file.m4 b/lib/c-ares-1.34.4/m4/ax_ac_append_to_file.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_ac_append_to_file.m4 rename to lib/c-ares-1.34.4/m4/ax_ac_append_to_file.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_ac_print_to_file.m4 b/lib/c-ares-1.34.4/m4/ax_ac_print_to_file.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_ac_print_to_file.m4 rename to lib/c-ares-1.34.4/m4/ax_ac_print_to_file.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_add_am_macro_static.m4 b/lib/c-ares-1.34.4/m4/ax_add_am_macro_static.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_add_am_macro_static.m4 rename to lib/c-ares-1.34.4/m4/ax_add_am_macro_static.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_am_macros_static.m4 b/lib/c-ares-1.34.4/m4/ax_am_macros_static.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_am_macros_static.m4 rename to lib/c-ares-1.34.4/m4/ax_am_macros_static.m4 diff --git a/lib/c-ares-1.34.4/m4/ax_append_compile_flags.m4 b/lib/c-ares-1.34.4/m4/ax_append_compile_flags.m4 new file mode 100644 index 00000000000..9c856356c0c --- /dev/null +++ b/lib/c-ares-1.34.4/m4/ax_append_compile_flags.m4 @@ -0,0 +1,46 @@ +# ============================================================================ +# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the compiler works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. During the check the flag is always added to the +# current language's flags. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and +# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with +# AX_APPEND_LINK_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AC_DEFUN([AX_APPEND_COMPILE_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) +done +])dnl AX_APPEND_COMPILE_FLAGS diff --git a/lib/c-ares-1.34.4/m4/ax_append_flag.m4 b/lib/c-ares-1.34.4/m4/ax_append_flag.m4 new file mode 100644 index 00000000000..dd6d8b61406 --- /dev/null +++ b/lib/c-ares-1.34.4/m4/ax_append_flag.m4 @@ -0,0 +1,50 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AC_DEFUN([AX_APPEND_FLAG], +[dnl +AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) +AS_VAR_SET_IF(FLAGS,[ + AS_CASE([" AS_VAR_GET(FLAGS) "], + [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], + [ + AS_VAR_APPEND(FLAGS,[" $1"]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) + ], + [ + AS_VAR_SET(FLAGS,[$1]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff --git a/lib/c-ares-1.33.1/m4/ax_append_link_flags.m4 b/lib/c-ares-1.34.4/m4/ax_append_link_flags.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_append_link_flags.m4 rename to lib/c-ares-1.34.4/m4/ax_append_link_flags.m4 diff --git a/lib/c-ares-1.34.4/m4/ax_check_compile_flag.m4 b/lib/c-ares-1.34.4/m4/ax_check_compile_flag.m4 new file mode 100644 index 00000000000..54191c55353 --- /dev/null +++ b/lib/c-ares-1.34.4/m4/ax_check_compile_flag.m4 @@ -0,0 +1,63 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 11 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether the _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + if test x"m4_case(_AC_LANG, + [C], [$GCC], + [C++], [$GXX], + [Fortran], [$GFC], + [Fortran 77], [$G77], + [Objective C], [$GOBJC], + [Objective C++], [$GOBJCXX], + [no])" = xyes ; then + add_gnu_werror="-Werror" + fi + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1 $add_gnu_werror" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/lib/c-ares-1.33.1/m4/ax_check_gnu_make.m4 b/lib/c-ares-1.34.4/m4/ax_check_gnu_make.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_check_gnu_make.m4 rename to lib/c-ares-1.34.4/m4/ax_check_gnu_make.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_check_link_flag.m4 b/lib/c-ares-1.34.4/m4/ax_check_link_flag.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_check_link_flag.m4 rename to lib/c-ares-1.34.4/m4/ax_check_link_flag.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_code_coverage.m4 b/lib/c-ares-1.34.4/m4/ax_code_coverage.m4 similarity index 95% rename from lib/c-ares-1.33.1/m4/ax_code_coverage.m4 rename to lib/c-ares-1.34.4/m4/ax_code_coverage.m4 index ad4063305eb..216708a41f1 100644 --- a/lib/c-ares-1.33.1/m4/ax_code_coverage.m4 +++ b/lib/c-ares-1.34.4/m4/ax_code_coverage.m4 @@ -74,7 +74,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -#serial 34 +#serial 37 m4_define(_AX_CODE_COVERAGE_RULES,[ AX_ADD_AM_MACRO_STATIC([ @@ -144,7 +144,7 @@ code_coverage_v_lcov_cap_ = \$(code_coverage_v_lcov_cap_\$(AM_DEFAULT_VERBOSITY) code_coverage_v_lcov_cap_0 = @echo \" LCOV --capture\" \$(CODE_COVERAGE_OUTPUT_FILE); code_coverage_v_lcov_ign = \$(code_coverage_v_lcov_ign_\$(V)) code_coverage_v_lcov_ign_ = \$(code_coverage_v_lcov_ign_\$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_lcov_ign_0 = @echo \" LCOV --remove /tmp/*\" \$(CODE_COVERAGE_IGNORE_PATTERN); +code_coverage_v_lcov_ign_0 = @echo \" LCOV --remove\" \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \$(CODE_COVERAGE_IGNORE_PATTERN); code_coverage_v_genhtml = \$(code_coverage_v_genhtml_\$(V)) code_coverage_v_genhtml_ = \$(code_coverage_v_genhtml_\$(AM_DEFAULT_VERBOSITY)) code_coverage_v_genhtml_0 = @echo \" GEN \" \"\$(CODE_COVERAGE_OUTPUT_DIRECTORY)\"; @@ -163,7 +163,7 @@ check-code-coverage: # Capture code coverage data code-coverage-capture: code-coverage-capture-hook \$(code_coverage_v_lcov_cap)\$(LCOV) \$(code_coverage_quiet) \$(addprefix --directory ,\$(CODE_COVERAGE_DIRECTORY)) --capture --output-file \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" --test-name \"\$(call code_coverage_sanitize,\$(PACKAGE_NAME)-\$(PACKAGE_VERSION))\" --no-checksum --compat-libtool \$(CODE_COVERAGE_LCOV_SHOPTS) \$(CODE_COVERAGE_LCOV_OPTIONS) - \$(code_coverage_v_lcov_ign)\$(LCOV) \$(code_coverage_quiet) \$(addprefix --directory ,\$(CODE_COVERAGE_DIRECTORY)) --remove \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \"/tmp/*\" \$(CODE_COVERAGE_IGNORE_PATTERN) --output-file \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \$(CODE_COVERAGE_LCOV_SHOPTS) \$(CODE_COVERAGE_LCOV_RMOPTS) + \$(code_coverage_v_lcov_ign)\$(LCOV) \$(code_coverage_quiet) \$(addprefix --directory ,\$(CODE_COVERAGE_DIRECTORY)) --remove \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \$(CODE_COVERAGE_IGNORE_PATTERN) --output-file \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \$(CODE_COVERAGE_LCOV_SHOPTS) \$(CODE_COVERAGE_LCOV_RMOPTS) -@rm -f \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \$(code_coverage_v_genhtml)LANG=C \$(GENHTML) \$(code_coverage_quiet) \$(addprefix --prefix ,\$(CODE_COVERAGE_DIRECTORY)) --output-directory \"\$(CODE_COVERAGE_OUTPUT_DIRECTORY)\" --title \"\$(PACKAGE_NAME)-\$(PACKAGE_VERSION) Code Coverage\" --legend --show-details \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \$(CODE_COVERAGE_GENHTML_OPTIONS) @echo \"file://\$(abs_builddir)/\$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html\" @@ -206,14 +206,14 @@ code-coverage-capture-hook: ]) AC_DEFUN([_AX_CODE_COVERAGE_ENABLED],[ - AX_CHECK_GNU_MAKE([],AC_MSG_ERROR([not using GNU make that is needed for coverage])) + AX_CHECK_GNU_MAKE([],[AC_MSG_ERROR([not using GNU make that is needed for coverage])]) AC_REQUIRE([AX_ADD_AM_MACRO_STATIC]) # check for gcov AC_CHECK_TOOL([GCOV], [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], [:]) AS_IF([test "X$GCOV" = "X:"], - AC_MSG_ERROR([gcov is needed to do coverage])) + [AC_MSG_ERROR([gcov is needed to do coverage])]) AC_SUBST([GCOV]) dnl Check if gcc is being used @@ -232,12 +232,13 @@ AC_DEFUN([_AX_CODE_COVERAGE_ENABLED],[ AC_MSG_ERROR([Could not find genhtml from the lcov package]) ]) + AC_CHECK_LIB([gcov], [_gcov_init], [CODE_COVERAGE_LIBS="-lgcov"], [CODE_COVERAGE_LIBS=""]) + dnl Build the code coverage flags dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility CODE_COVERAGE_CPPFLAGS="-DNDEBUG" CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_LIBS="-lgcov" AC_SUBST([CODE_COVERAGE_CPPFLAGS]) AC_SUBST([CODE_COVERAGE_CFLAGS]) diff --git a/lib/c-ares-1.33.1/m4/ax_compiler_vendor.m4 b/lib/c-ares-1.34.4/m4/ax_compiler_vendor.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_compiler_vendor.m4 rename to lib/c-ares-1.34.4/m4/ax_compiler_vendor.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_cxx_compile_stdcxx.m4 b/lib/c-ares-1.34.4/m4/ax_cxx_compile_stdcxx.m4 similarity index 90% rename from lib/c-ares-1.33.1/m4/ax_cxx_compile_stdcxx.m4 rename to lib/c-ares-1.34.4/m4/ax_cxx_compile_stdcxx.m4 index 8edf5152ec7..fe6ae17e6c4 100644 --- a/lib/c-ares-1.33.1/m4/ax_cxx_compile_stdcxx.m4 +++ b/lib/c-ares-1.34.4/m4/ax_cxx_compile_stdcxx.m4 @@ -10,8 +10,8 @@ # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for -# the respective C++ standard version. +# CXXCPP to enable support. VERSION may be '11', '14', '17', '20', or +# '23' for the respective C++ standard version. # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. @@ -36,14 +36,15 @@ # Copyright (c) 2016, 2018 Krzesimir Nowak # Copyright (c) 2019 Enji Cooper # Copyright (c) 2020 Jason Merrill -# Copyright (c) 2021 Jörn Heusipp +# Copyright (c) 2021, 2024 Jörn Heusipp +# Copyright (c) 2015, 2022, 2023, 2024 Olly Betts # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 18 +#serial 25 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). @@ -53,6 +54,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], [$1], [20], [ax_cxx_compile_alternatives="20"], + [$1], [23], [ax_cxx_compile_alternatives="23"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], @@ -159,31 +161,41 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl dnl Test body for checking C++11 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + [_AX_CXX_COMPILE_STDCXX_testbody_new_in_11] ) dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + [_AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14] ) dnl Test body for checking C++17 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 + [_AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_17] ) dnl Test body for checking C++20 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 + [_AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_20] +) + +dnl Test body for checking C++23 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_23], + [_AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_23] ) @@ -201,7 +213,17 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ // MSVC always sets __cplusplus to 199711L in older versions; newer versions // only set it correctly if /Zc:__cplusplus is specified as well as a // /std:c++NN switch: +// // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +// +// The value __cplusplus ought to have is available in _MSVC_LANG since +// Visual Studio 2015 Update 3: +// +// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros +// +// This was also the first MSVC version to support C++14 so we can't use the +// value of either __cplusplus or _MSVC_LANG to quickly rule out MSVC having +// C++11 or C++14 support, but we can check _MSVC_LANG for C++17 and later. #elif __cplusplus < 201103L && !defined _MSC_VER #error "This is not a C++11 compiler" @@ -617,7 +639,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ #error "This is not a C++ compiler" -#elif __cplusplus < 201703L && !defined _MSC_VER +#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 201703L #error "This is not a C++17 compiler" @@ -983,7 +1005,7 @@ namespace cxx17 } // namespace cxx17 -#endif // __cplusplus < 201703L && !defined _MSC_VER +#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 201703L ]]) @@ -996,7 +1018,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ #error "This is not a C++ compiler" -#elif __cplusplus < 202002L && !defined _MSC_VER +#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202002L #error "This is not a C++20 compiler" @@ -1013,6 +1035,36 @@ namespace cxx20 } // namespace cxx20 -#endif // __cplusplus < 202002L && !defined _MSC_VER +#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202002L + +]]) + + +dnl Tests for new features in C++23 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_23], [[ + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202302L + +#error "This is not a C++23 compiler" + +#else + +#include + +namespace cxx23 +{ + +// As C++23 supports feature test macros in the standard, there is no +// immediate need to actually test for feature availability on the +// Autoconf side. + +} // namespace cxx23 + +#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202302L ]]) diff --git a/lib/c-ares-1.33.1/m4/ax_cxx_compile_stdcxx_14.m4 b/lib/c-ares-1.34.4/m4/ax_cxx_compile_stdcxx_14.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_cxx_compile_stdcxx_14.m4 rename to lib/c-ares-1.34.4/m4/ax_cxx_compile_stdcxx_14.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_file_escapes.m4 b/lib/c-ares-1.34.4/m4/ax_file_escapes.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_file_escapes.m4 rename to lib/c-ares-1.34.4/m4/ax_file_escapes.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_pthread.m4 b/lib/c-ares-1.34.4/m4/ax_pthread.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_pthread.m4 rename to lib/c-ares-1.34.4/m4/ax_pthread.m4 diff --git a/lib/c-ares-1.33.1/m4/ax_require_defined.m4 b/lib/c-ares-1.34.4/m4/ax_require_defined.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/ax_require_defined.m4 rename to lib/c-ares-1.34.4/m4/ax_require_defined.m4 diff --git a/lib/c-ares-1.33.1/m4/libtool.m4 b/lib/c-ares-1.34.4/m4/libtool.m4 old mode 100644 new mode 100755 similarity index 97% rename from lib/c-ares-1.33.1/m4/libtool.m4 rename to lib/c-ares-1.34.4/m4/libtool.m4 index 79a2451ef52..c4c02946dec --- a/lib/c-ares-1.33.1/m4/libtool.m4 +++ b/lib/c-ares-1.34.4/m4/libtool.m4 @@ -1,7 +1,6 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # -# Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software -# Foundation, Inc. +# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -32,7 +31,7 @@ m4_define([_LT_COPYING], [dnl # along with this program. If not, see . ]) -# serial 59 LT_INIT +# serial 58 LT_INIT # LT_PREREQ(VERSION) @@ -182,7 +181,6 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_DECL_FILECMD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl @@ -221,8 +219,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC and -# ICC, which need '.lib'). +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld @@ -730,7 +728,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. @@ -780,7 +777,7 @@ _LT_EOF # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - $SED '$q' "$ltmain" >> "$cfgfile" \ + sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || @@ -1044,8 +1041,8 @@ int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF @@ -1069,12 +1066,17 @@ _LT_EOF _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) - case $MACOSX_DEPLOYMENT_TARGET,$host in - 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' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[912]]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[[012]][[,.]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*|11.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac @@ -1123,12 +1125,12 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" - _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else @@ -1242,8 +1244,7 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], -[m4_require([_LT_DECL_SED])dnl -AC_MSG_CHECKING([for sysroot]) +[AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot @@ -1260,7 +1261,7 @@ case $with_sysroot in #( fi ;; #( /*) - lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( @@ -1290,7 +1291,7 @@ ia64-*-hpux*) # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; @@ -1307,7 +1308,7 @@ ia64-*-hpux*) echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; @@ -1319,7 +1320,7 @@ ia64-*-hpux*) ;; esac else - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; @@ -1341,7 +1342,7 @@ mips64*-*linux*) echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; @@ -1349,7 +1350,7 @@ mips64*-*linux*) emul="${emul}64" ;; esac - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; @@ -1357,7 +1358,7 @@ mips64*-*linux*) emul="${emul}ltsmip" ;; esac - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; @@ -1377,14 +1378,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - case `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; @@ -1452,7 +1453,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) @@ -1491,22 +1492,9 @@ need_locks=$enable_libtool_lock m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} +: ${AR_FLAGS=cr} _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 -# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS -# variable obsoleted/removed. - -test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} -lt_ar_flags=$AR_FLAGS -_LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)]) - -# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override -# by AR_FLAGS because that was never working and AR_FLAGS is about to die. -_LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}], - [Flags to create an archive]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no @@ -1725,7 +1713,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*) + bitrig* | darwin* | dragonfly* | freebsd* | 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` @@ -1768,7 +1756,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[[ ]]//'` + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi @@ -2218,35 +2206,26 @@ m4_defun([_LT_CMD_STRIPLIB], striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -z "$STRIP"; then - AC_MSG_RESULT([no]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) else - if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) - else - case $host_os in - darwin*) - # FIXME - insert some real tests, host_os isn't really good enough +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) - ;; - freebsd*) - if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) + else AC_MSG_RESULT([no]) - ;; - esac - fi + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) @@ -2569,7 +2548,7 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; @@ -2579,14 +2558,14 @@ m4_if([$1], [],[ ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; - *,cl* | *,icl*) - # Native MSVC or ICC + *,cl*) + # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -2605,7 +2584,7 @@ m4_if([$1], [],[ done IFS=$lt_save_ifs # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form @@ -2642,7 +2621,7 @@ m4_if([$1], [],[ ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -2675,7 +2654,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly* | midnightbsd*) +freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -2907,6 +2886,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -3474,7 +3465,7 @@ beos*) bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='$FILECMD -L' + lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; @@ -3508,14 +3499,14 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | dragonfly* | midnightbsd*) +freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac @@ -3529,7 +3520,7 @@ haiku*) ;; hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' @@ -3566,7 +3557,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else @@ -3576,7 +3567,7 @@ netbsd*) newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; @@ -3703,13 +3694,13 @@ else mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) - case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 @@ -3735,7 +3726,7 @@ else # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; @@ -3975,7 +3966,7 @@ esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" @@ -3993,20 +3984,20 @@ fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ @@ -4030,7 +4021,7 @@ for ac_symprfx in "" "_"; do if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++ or ICC, + # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ @@ -4048,9 +4039,9 @@ for ac_symprfx in "" "_"; do " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else - lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -4072,7 +4063,8 @@ _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -4337,7 +4329,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -4420,7 +4412,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' @@ -4444,7 +4436,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -4712,6 +4704,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + _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*) @@ -4756,7 +4754,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' @@ -4939,7 +4937,7 @@ m4_if([$1], [CXX], [ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) @@ -4947,7 +4945,7 @@ m4_if([$1], [CXX], [ ;; cygwin* | mingw* | cegcc*) case $cc_basename in - cl* | icl*) + cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) @@ -4956,6 +4954,9 @@ m4_if([$1], [CXX], [ ;; esac ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; @@ -5004,20 +5005,23 @@ dnl Note also adjust exclude_expsyms for C++ above. case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time + # FIXME: the MSVC++ 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. + # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) + # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes @@ -5064,7 +5068,7 @@ dnl Note also adjust exclude_expsyms for C++ above. _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no - case `$LD -v | $SED -e 's/([[^)]]\+)\s\+//' 2>&1` in + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... @@ -5176,7 +5180,6 @@ _LT_EOF 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(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' ;; interix[[3-9]]*) @@ -5191,7 +5194,7 @@ _LT_EOF # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) @@ -5234,7 +5237,7 @@ _LT_EOF _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes @@ -5246,7 +5249,7 @@ _LT_EOF if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi @@ -5262,7 +5265,7 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi @@ -5273,7 +5276,7 @@ _LT_EOF fi ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -5394,7 +5397,7 @@ _LT_EOF if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no @@ -5577,12 +5580,12 @@ _LT_EOF cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using - # Microsoft Visual C++ or Intel C++ Compiler. + # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl* | icl*) - # Native MSVC or ICC + cl*) + # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes @@ -5623,7 +5626,7 @@ _LT_EOF fi' ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. @@ -5671,7 +5674,7 @@ _LT_EOF ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes @@ -5794,6 +5797,7 @@ _LT_EOF if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi + _LT_TAGVAR(link_all_deplibs, $1)=no else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' @@ -5815,7 +5819,7 @@ _LT_EOF esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -5882,7 +5886,6 @@ _LT_EOF 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(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' ;; osf3*) @@ -6442,7 +6445,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 @@ -6653,8 +6656,8 @@ if test yes != "$_lt_caught_CXX_error"; then cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl* | ,icl* | no,icl*) - # Native MSVC or ICC + ,cl* | no,cl*) + # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' @@ -6752,7 +6755,6 @@ if test yes != "$_lt_caught_CXX_error"; then 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(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' ;; dgux*) @@ -6783,7 +6785,7 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes @@ -6818,7 +6820,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 +6885,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 @@ -6920,7 +6922,7 @@ if test yes != "$_lt_caught_CXX_error"; then # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in @@ -7060,13 +7062,13 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' @@ -7222,7 +7224,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 +7308,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 +7319,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' @@ -8212,14 +8214,6 @@ _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) -# _LT_DECL_FILECMD -# ---------------- -# 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], [:]) -_LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types]) -])# _LD_DECL_FILECMD - # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates diff --git a/lib/c-ares-1.33.1/m4/ltoptions.m4 b/lib/c-ares-1.34.4/m4/ltoptions.m4 old mode 100644 new mode 100755 similarity index 99% rename from lib/c-ares-1.33.1/m4/ltoptions.m4 rename to lib/c-ares-1.34.4/m4/ltoptions.m4 index b0b5e9c2126..94b08297666 --- a/lib/c-ares-1.33.1/m4/ltoptions.m4 +++ b/lib/c-ares-1.34.4/m4/ltoptions.m4 @@ -1,7 +1,7 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free -# Software Foundation, Inc. +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives diff --git a/lib/c-ares-1.33.1/m4/ltsugar.m4 b/lib/c-ares-1.34.4/m4/ltsugar.m4 old mode 100644 new mode 100755 similarity index 98% rename from lib/c-ares-1.33.1/m4/ltsugar.m4 rename to lib/c-ares-1.34.4/m4/ltsugar.m4 index 902508bd93a..48bc9344a4d --- a/lib/c-ares-1.33.1/m4/ltsugar.m4 +++ b/lib/c-ares-1.34.4/m4/ltsugar.m4 @@ -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-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # diff --git a/lib/c-ares-1.33.1/m4/ltversion.m4 b/lib/c-ares-1.34.4/m4/ltversion.m4 old mode 100644 new mode 100755 similarity index 66% rename from lib/c-ares-1.33.1/m4/ltversion.m4 rename to lib/c-ares-1.34.4/m4/ltversion.m4 index b155d0aceca..fa04b52a3bf --- a/lib/c-ares-1.33.1/m4/ltversion.m4 +++ b/lib/c-ares-1.34.4/m4/ltversion.m4 @@ -1,7 +1,6 @@ # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, -# Inc. +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives @@ -10,15 +9,15 @@ # @configure_input@ -# serial 4245 ltversion.m4 +# serial 4179 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.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.7' -macro_revision='2.4.7' +[macro_version='2.4.6' +macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/lib/c-ares-1.33.1/m4/lt~obsolete.m4 b/lib/c-ares-1.34.4/m4/lt~obsolete.m4 old mode 100644 new mode 100755 similarity index 98% rename from lib/c-ares-1.33.1/m4/lt~obsolete.m4 rename to lib/c-ares-1.34.4/m4/lt~obsolete.m4 index 0f7a8759da8..c6b26f88f6c --- a/lib/c-ares-1.33.1/m4/lt~obsolete.m4 +++ b/lib/c-ares-1.34.4/m4/lt~obsolete.m4 @@ -1,7 +1,7 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free -# Software Foundation, Inc. +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives diff --git a/lib/c-ares-1.33.1/m4/pkg.m4 b/lib/c-ares-1.34.4/m4/pkg.m4 similarity index 100% rename from lib/c-ares-1.33.1/m4/pkg.m4 rename to lib/c-ares-1.34.4/m4/pkg.m4 diff --git a/lib/c-ares-1.33.1/src/CMakeLists.txt b/lib/c-ares-1.34.4/src/CMakeLists.txt similarity index 100% rename from lib/c-ares-1.33.1/src/CMakeLists.txt rename to lib/c-ares-1.34.4/src/CMakeLists.txt diff --git a/lib/c-ares-1.33.1/src/Makefile.am b/lib/c-ares-1.34.4/src/Makefile.am similarity index 100% rename from lib/c-ares-1.33.1/src/Makefile.am rename to lib/c-ares-1.34.4/src/Makefile.am diff --git a/lib/c-ares-1.33.1/src/Makefile.in b/lib/c-ares-1.34.4/src/Makefile.in similarity index 96% rename from lib/c-ares-1.33.1/src/Makefile.in rename to lib/c-ares-1.34.4/src/Makefile.in index 3ad8a92a6a4..1f286880247 100644 --- a/lib/c-ares-1.33.1/src/Makefile.in +++ b/lib/c-ares-1.34.4/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2024 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -69,8 +69,6 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -am__rm_f = rm -f $(am__rm_f_notfound) -am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -91,7 +89,9 @@ build_triplet = @build@ host_triplet = @host@ subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ + $(top_srcdir)/m4/ares_check_uts_namespace.m4 \ + $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ @@ -101,8 +101,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_user_namespace.m4 \ - $(top_srcdir)/m4/ax_check_uts_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ @@ -247,7 +245,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ @@ -314,10 +311,8 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ -am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ @@ -591,8 +586,8 @@ mostlyclean-generic: clean-generic: distclean-generic: - -$(am__rm_f) $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -684,10 +679,3 @@ uninstall-am: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - -# Tell GNU make to disable its built-in pattern rules. -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% diff --git a/lib/c-ares-1.33.1/src/lib/CMakeLists.txt b/lib/c-ares-1.34.4/src/lib/CMakeLists.txt similarity index 87% rename from lib/c-ares-1.33.1/src/lib/CMakeLists.txt rename to lib/c-ares-1.34.4/src/lib/CMakeLists.txt index ef0acf371ff..9d4e10924d0 100644 --- a/lib/c-ares-1.33.1/src/lib/CMakeLists.txt +++ b/lib/c-ares-1.34.4/src/lib/CMakeLists.txt @@ -53,6 +53,7 @@ IF (CARES_SHARED) "$" "$" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/include" ) TARGET_COMPILE_DEFINITIONS (${PROJECT_NAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY) @@ -91,11 +92,23 @@ IF (CARES_STATIC) SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES EXPORT_NAME cares${STATIC_SUFFIX} - OUTPUT_NAME cares${STATIC_SUFFIX} COMPILE_PDB_NAME cares${STATIC_SUFFIX} C_STANDARD 90 ) + # On Windows, the output name should have a static suffix since otherwise + # we would have conflicting output names (libcares.lib) for the link + # library. + # However on Unix-like systems, we typically have something like + # libcares.so for shared libraries and libcares.a for static + # libraries, so these don't conflict. + # This behavior better emulates what happens with autotools builds + IF (WIN32) + SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES OUTPUT_NAME cares${STATIC_SUFFIX}) + ELSE () + SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES OUTPUT_NAME cares) + ENDIF() + IF (ANDROID) SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES C_STANDARD 99) ENDIF () @@ -110,6 +123,7 @@ IF (CARES_STATIC) "$" "$" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/include" ) TARGET_COMPILE_DEFINITIONS (${LIBNAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY) diff --git a/lib/c-ares-1.33.1/src/lib/Makefile.am b/lib/c-ares-1.34.4/src/lib/Makefile.am similarity index 95% rename from lib/c-ares-1.33.1/src/lib/Makefile.am rename to lib/c-ares-1.34.4/src/lib/Makefile.am index 44e04bd35cc..db4f2640f2b 100644 --- a/lib/c-ares-1.33.1/src/lib/Makefile.am +++ b/lib/c-ares-1.34.4/src/lib/Makefile.am @@ -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 diff --git a/lib/c-ares-1.33.1/src/lib/Makefile.in b/lib/c-ares-1.34.4/src/lib/Makefile.in similarity index 85% rename from lib/c-ares-1.33.1/src/lib/Makefile.in rename to lib/c-ares-1.34.4/src/lib/Makefile.in index 30d33843d5d..a45fc10b544 100644 --- a/lib/c-ares-1.33.1/src/lib/Makefile.in +++ b/lib/c-ares-1.34.4/src/lib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2024 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -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 Sat Dec 14 15:15:44 UTC 2024 # Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT @@ -76,8 +76,6 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -am__rm_f = rm -f $(am__rm_f_notfound) -am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -102,7 +100,9 @@ host_triplet = @host@ subdir = src/lib SUBDIRS = ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ + $(top_srcdir)/m4/ares_check_uts_namespace.m4 \ + $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ @@ -112,8 +112,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_user_namespace.m4 \ - $(top_srcdir)/m4/ax_check_uts_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ @@ -154,21 +152,19 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ - { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ } 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 +172,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 +226,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 +258,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 +275,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 +300,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 +340,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 +448,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@ @@ -487,7 +490,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ @@ -554,10 +556,8 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ -am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ @@ -629,7 +629,7 @@ libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY $(am__append_3) \ @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE); @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) -@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN); +@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_0 = @echo " LCOV --remove" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN); @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"; @@ -643,15 +643,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 +660,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 +685,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 +725,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 @@ -804,12 +814,12 @@ ares_config.h: stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/ares_config.h.in $(top_builddir)/config.status - $(AM_V_at)rm -f stamp-h1 - $(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status src/lib/ares_config.h + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/lib/ares_config.h $(srcdir)/ares_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - $(AM_V_GEN)($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - $(AM_V_at)rm -f stamp-h1 - $(AM_V_at)touch $@ + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ distclean-hdr: -rm -f ares_config.h stamp-h1 @@ -839,41 +849,47 @@ uninstall-libLTLIBRARIES: done clean-libLTLIBRARIES: - -$(am__rm_f) $(lib_LTLIBRARIES) + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ - echo rm -f $${locs}; \ - $(am__rm_f) $${locs} + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } dsa/$(am__dirstamp): @$(MKDIR_P) dsa - @: >>dsa/$(am__dirstamp) + @: > 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/$(DEPDIR)/$(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/$(DEPDIR)/$(am__dirstamp) +dsa/libcares_la-ares_htable_asvp.lo: dsa/$(am__dirstamp) \ dsa/$(DEPDIR)/$(am__dirstamp) -dsa/libcares_la-ares__htable.lo: dsa/$(am__dirstamp) \ +dsa/libcares_la-ares_htable_dict.lo: dsa/$(am__dirstamp) \ dsa/$(DEPDIR)/$(am__dirstamp) -dsa/libcares_la-ares__htable_asvp.lo: dsa/$(am__dirstamp) \ +dsa/libcares_la-ares_htable_strvp.lo: dsa/$(am__dirstamp) \ dsa/$(DEPDIR)/$(am__dirstamp) -dsa/libcares_la-ares__htable_strvp.lo: dsa/$(am__dirstamp) \ +dsa/libcares_la-ares_htable_szvp.lo: dsa/$(am__dirstamp) \ dsa/$(DEPDIR)/$(am__dirstamp) -dsa/libcares_la-ares__htable_szvp.lo: dsa/$(am__dirstamp) \ +dsa/libcares_la-ares_htable_vpstr.lo: dsa/$(am__dirstamp) \ dsa/$(DEPDIR)/$(am__dirstamp) -dsa/libcares_la-ares__htable_vpvp.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/libcares_la-ares_llist.lo: dsa/$(am__dirstamp) \ dsa/$(DEPDIR)/$(am__dirstamp) -dsa/libcares_la-ares__slist.lo: dsa/$(am__dirstamp) \ +dsa/libcares_la-ares_slist.lo: dsa/$(am__dirstamp) \ dsa/$(DEPDIR)/$(am__dirstamp) event/$(am__dirstamp): @$(MKDIR_P) event - @: >>event/$(am__dirstamp) + @: > event/$(am__dirstamp) event/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) event/$(DEPDIR) - @: >>event/$(DEPDIR)/$(am__dirstamp) + @: > event/$(DEPDIR)/$(am__dirstamp) event/libcares_la-ares_event_configchg.lo: event/$(am__dirstamp) \ event/$(DEPDIR)/$(am__dirstamp) event/libcares_la-ares_event_epoll.lo: event/$(am__dirstamp) \ @@ -892,10 +908,10 @@ event/libcares_la-ares_event_win32.lo: event/$(am__dirstamp) \ event/$(DEPDIR)/$(am__dirstamp) legacy/$(am__dirstamp): @$(MKDIR_P) legacy - @: >>legacy/$(am__dirstamp) + @: > legacy/$(am__dirstamp) legacy/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) legacy/$(DEPDIR) - @: >>legacy/$(DEPDIR)/$(am__dirstamp) + @: > legacy/$(DEPDIR)/$(am__dirstamp) legacy/libcares_la-ares_create_query.lo: legacy/$(am__dirstamp) \ legacy/$(DEPDIR)/$(am__dirstamp) legacy/libcares_la-ares_expand_name.lo: legacy/$(am__dirstamp) \ @@ -930,10 +946,10 @@ legacy/libcares_la-ares_parse_uri_reply.lo: legacy/$(am__dirstamp) \ legacy/$(DEPDIR)/$(am__dirstamp) record/$(am__dirstamp): @$(MKDIR_P) record - @: >>record/$(am__dirstamp) + @: > record/$(am__dirstamp) record/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) record/$(DEPDIR) - @: >>record/$(DEPDIR)/$(am__dirstamp) + @: > record/$(DEPDIR)/$(am__dirstamp) record/libcares_la-ares_dns_mapping.lo: record/$(am__dirstamp) \ record/$(DEPDIR)/$(am__dirstamp) record/libcares_la-ares_dns_multistring.lo: record/$(am__dirstamp) \ @@ -948,13 +964,11 @@ record/libcares_la-ares_dns_write.lo: record/$(am__dirstamp) \ record/$(DEPDIR)/$(am__dirstamp) str/$(am__dirstamp): @$(MKDIR_P) str - @: >>str/$(am__dirstamp) + @: > 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/$(DEPDIR)/$(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) @@ -962,20 +976,22 @@ str/libcares_la-ares_strsplit.lo: str/$(am__dirstamp) \ str/$(DEPDIR)/$(am__dirstamp) util/$(am__dirstamp): @$(MKDIR_P) util - @: >>util/$(am__dirstamp) + @: > 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/$(DEPDIR)/$(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 +1014,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 +1031,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 +1056,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,19 +1096,19 @@ 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) - @: >>$@ + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) @@ -1117,54 +1136,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@ -@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 - -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@ +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__close_sockets.lo `test -f 'ares__close_sockets.c' || echo '$(srcdir)/'`ares__close_sockets.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__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@ +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__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 +1164,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 +1255,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 +1290,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 +1332,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 +1430,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 +1710,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 +1731,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 +1766,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 @@ -1933,21 +1973,21 @@ mostlyclean-generic: clean-generic: distclean-generic: - -$(am__rm_f) $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) - -$(am__rm_f) $(DISTCLEANFILES) - -$(am__rm_f) dsa/$(DEPDIR)/$(am__dirstamp) - -$(am__rm_f) dsa/$(am__dirstamp) - -$(am__rm_f) event/$(DEPDIR)/$(am__dirstamp) - -$(am__rm_f) event/$(am__dirstamp) - -$(am__rm_f) legacy/$(DEPDIR)/$(am__dirstamp) - -$(am__rm_f) legacy/$(am__dirstamp) - -$(am__rm_f) record/$(DEPDIR)/$(am__dirstamp) - -$(am__rm_f) record/$(am__dirstamp) - -$(am__rm_f) str/$(DEPDIR)/$(am__dirstamp) - -$(am__rm_f) str/$(am__dirstamp) - -$(am__rm_f) util/$(DEPDIR)/$(am__dirstamp) - -$(am__rm_f) util/$(am__dirstamp) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f dsa/$(DEPDIR)/$(am__dirstamp) + -rm -f dsa/$(am__dirstamp) + -rm -f event/$(DEPDIR)/$(am__dirstamp) + -rm -f event/$(am__dirstamp) + -rm -f legacy/$(DEPDIR)/$(am__dirstamp) + -rm -f legacy/$(am__dirstamp) + -rm -f record/$(DEPDIR)/$(am__dirstamp) + -rm -f record/$(am__dirstamp) + -rm -f str/$(DEPDIR)/$(am__dirstamp) + -rm -f str/$(am__dirstamp) + -rm -f util/$(DEPDIR)/$(am__dirstamp) + -rm -f util/$(am__dirstamp) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -1958,15 +1998,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 +2015,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 +2040,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 +2080,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 +2134,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 +2151,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 +2176,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 +2216,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 @@ -2282,7 +2328,7 @@ uninstall-am: uninstall-libLTLIBRARIES # Capture code coverage data @CODE_COVERAGE_ENABLED_TRUE@code-coverage-capture: code-coverage-capture-hook @CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) -@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) +@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) @CODE_COVERAGE_ENABLED_TRUE@ -@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp" @CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) @CODE_COVERAGE_ENABLED_TRUE@ @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" @@ -2321,10 +2367,3 @@ code-coverage-capture-hook: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - -# Tell GNU make to disable its built-in pattern rules. -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% diff --git a/lib/c-ares-1.33.1/src/lib/Makefile.inc b/lib/c-ares-1.34.4/src/lib/Makefile.inc similarity index 64% rename from lib/c-ares-1.33.1/src/lib/Makefile.inc rename to lib/c-ares-1.34.4/src/lib/Makefile.inc index 8fa434c3e2c..10e4edf5c76 100644 --- a/lib/c-ares-1.33.1/src/lib/Makefile.inc +++ b/lib/c-ares-1.34.4/src/lib/Makefile.inc @@ -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 - diff --git a/lib/c-ares-1.33.1/src/lib/ares__addrinfo2hostent.c b/lib/c-ares-1.34.4/src/lib/ares_addrinfo2hostent.c similarity index 93% rename from lib/c-ares-1.33.1/src/lib/ares__addrinfo2hostent.c rename to lib/c-ares-1.34.4/src/lib/ares_addrinfo2hostent.c index f7b6d1edd25..2bbc791157b 100644 --- a/lib/c-ares-1.33.1/src/lib/ares__addrinfo2hostent.c +++ b/lib/c-ares-1.34.4/src/lib/ares_addrinfo2hostent.c @@ -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 @@ ares_status_t ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family, /* 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; diff --git a/lib/c-ares-1.33.1/src/lib/ares__addrinfo_localhost.c b/lib/c-ares-1.34.4/src/lib/ares_addrinfo_localhost.c similarity index 89% rename from lib/c-ares-1.33.1/src/lib/ares__addrinfo_localhost.c rename to lib/c-ares-1.34.4/src/lib/ares_addrinfo_localhost.c index e98dd4e277b..6f4f2a373b3 100644 --- a/lib/c-ares-1.33.1/src/lib/ares__addrinfo_localhost.c +++ b/lib/c-ares-1.34.4/src/lib/ares_addrinfo_localhost.c @@ -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 @@ static ares_status_t FreeMibTable(table); if (status != ARES_SUCCESS) { - ares__freeaddrinfo_nodes(*nodes); + ares_freeaddrinfo_nodes(*nodes); *nodes = NULL; } @@ -191,9 +191,9 @@ static ares_status_t #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; diff --git a/lib/c-ares-1.33.1/src/lib/ares_android.c b/lib/c-ares-1.34.4/src/lib/ares_android.c similarity index 99% rename from lib/c-ares-1.33.1/src/lib/ares_android.c rename to lib/c-ares-1.34.4/src/lib/ares_android.c index 06ab8940ad7..a8284c1e502 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_android.c +++ b/lib/c-ares-1.34.4/src/lib/ares_android.c @@ -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); } diff --git a/lib/c-ares-1.33.1/src/lib/ares_android.h b/lib/c-ares-1.34.4/src/lib/ares_android.h similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_android.h rename to lib/c-ares-1.34.4/src/lib/ares_android.h diff --git a/lib/c-ares-1.33.1/src/lib/ares_cancel.c b/lib/c-ares-1.34.4/src/lib/ares_cancel.c similarity index 81% rename from lib/c-ares-1.33.1/src/lib/ares_cancel.c rename to lib/c-ares-1.34.4/src/lib/ares_cancel.c index c29d8ef82f4..75600dea6bc 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_cancel.c +++ b/lib/c-ares-1.34.4/src/lib/ares_cancel.c @@ -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); } diff --git a/lib/c-ares-1.33.1/src/lib/ares__close_sockets.c b/lib/c-ares-1.34.4/src/lib/ares_close_sockets.c similarity index 59% rename from lib/c-ares-1.33.1/src/lib/ares__close_sockets.c rename to lib/c-ares-1.34.4/src/lib/ares_close_sockets.c index 71c7e64f08a..fd3bf3c4b1e 100644 --- a/lib/c-ares-1.33.1/src/lib/ares__close_sockets.c +++ b/lib/c-ares-1.34.4/src/lib/ares_close_sockets.c @@ -28,81 +28,82 @@ #include "ares_private.h" #include -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); + ares_conn_sock_state_cb_update(conn, ARES_CONN_STATE_NONE); - SOCK_STATE_CALLBACK(channel, conn->fd, 0, 0); - ares__close_socket(channel, conn->fd); + 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); } } } diff --git a/lib/c-ares-1.33.1/src/lib/ares_config.h.cmake b/lib/c-ares-1.34.4/src/lib/ares_config.h.cmake similarity index 98% rename from lib/c-ares-1.33.1/src/lib/ares_config.h.cmake rename to lib/c-ares-1.34.4/src/lib/ares_config.h.cmake index da738671971..51744fe1438 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_config.h.cmake +++ b/lib/c-ares-1.34.4/src/lib/ares_config.h.cmake @@ -82,6 +82,9 @@ /* Define to 1 if you have the 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 @@ -251,6 +257,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SIGNAL_H 1 +/* Define to 1 if you have the strnlen function. */ +#cmakedefine HAVE_STRNLEN 1 + /* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ #cmakedefine HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1 diff --git a/lib/c-ares-1.33.1/src/lib/ares_config.h.in b/lib/c-ares-1.34.4/src/lib/ares_config.h.in similarity index 92% rename from lib/c-ares-1.33.1/src/lib/ares_config.h.in rename to lib/c-ares-1.34.4/src/lib/ares_config.h.in index 3e75b4c2cd0..a62e1708935 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_config.h.in +++ b/lib/c-ares-1.34.4/src/lib/ares_config.h.in @@ -177,6 +177,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H +/* Define to 1 if you have `memmem` */ +#undef HAVE_MEMMEM + /* Define to 1 if you have the 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 @@ -303,25 +309,28 @@ /* Define to 1 if you have `strnicmp` */ #undef HAVE_STRNICMP -/* Define to 1 if the system has the type 'struct addrinfo'. */ +/* Define to 1 if you have `strnlen` */ +#undef HAVE_STRNLEN + +/* Define to 1 if the system has the type `struct addrinfo'. */ #undef HAVE_STRUCT_ADDRINFO -/* Define to 1 if 'ai_flags' is a member of 'struct addrinfo'. */ +/* Define to 1 if `ai_flags' is a member of `struct addrinfo'. */ #undef HAVE_STRUCT_ADDRINFO_AI_FLAGS -/* Define to 1 if the system has the type 'struct in6_addr'. */ +/* Define to 1 if the system has the type `struct in6_addr'. */ #undef HAVE_STRUCT_IN6_ADDR -/* Define to 1 if the system has the type 'struct sockaddr_in6'. */ +/* Define to 1 if the system has the type `struct sockaddr_in6'. */ #undef HAVE_STRUCT_SOCKADDR_IN6 -/* Define to 1 if 'sin6_scope_id' is a member of 'struct sockaddr_in6'. */ +/* Define to 1 if `sin6_scope_id' is a member of `struct sockaddr_in6'. */ #undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID -/* Define to 1 if the system has the type 'struct sockaddr_storage'. */ +/* Define to 1 if the system has the type `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE -/* Define to 1 if the system has the type 'struct timeval'. */ +/* Define to 1 if the system has the type `struct timeval'. */ #undef HAVE_STRUCT_TIMEVAL /* Define to 1 if you have the header file. */ @@ -351,6 +360,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSTEM_PROPERTIES_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H @@ -475,12 +487,12 @@ /* send() return value */ #undef SEND_TYPE_RETV -/* Define to 1 if all of the C89 standard headers exist (not just the ones +/* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS -/* Enable extensions on AIX, Interix, z/OS. */ +/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif @@ -541,15 +553,11 @@ #ifndef __STDC_WANT_IEC_60559_DFP_EXT__ # undef __STDC_WANT_IEC_60559_DFP_EXT__ #endif -/* Enable extensions specified by C23 Annex F. */ -#ifndef __STDC_WANT_IEC_60559_EXT__ -# undef __STDC_WANT_IEC_60559_EXT__ -#endif /* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ # undef __STDC_WANT_IEC_60559_FUNCS_EXT__ #endif -/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */ +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ # undef __STDC_WANT_IEC_60559_TYPES_EXT__ #endif @@ -578,14 +586,8 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* Define to 1 on platforms where this makes off_t a 64-bit type. */ +/* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES -/* Number of bits in time_t, on hosts where this is settable. */ -#undef _TIME_BITS - -/* Define to 1 on platforms where this makes time_t a 64-bit type. */ -#undef __MINGW_USE_VC2005_COMPAT - -/* Define as 'unsigned int' if doesn't define. */ +/* Define to `unsigned int' if does not define. */ #undef size_t diff --git a/lib/c-ares-1.34.4/src/lib/ares_conn.c b/lib/c-ares-1.34.4/src/lib/ares_conn.c new file mode 100644 index 00000000000..6b315b05486 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/ares_conn.c @@ -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); +} diff --git a/lib/c-ares-1.34.4/src/lib/ares_conn.h b/lib/c-ares-1.34.4/src/lib/ares_conn.h new file mode 100644 index 00000000000..16ecefdd19f --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/ares_conn.h @@ -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 diff --git a/lib/c-ares-1.33.1/src/lib/ares_cookie.c b/lib/c-ares-1.34.4/src/lib/ares_cookie.c similarity index 98% rename from lib/c-ares-1.33.1/src/lib/ares_cookie.c rename to lib/c-ares-1.34.4/src/lib/ares_cookie.c index bf9d1ba25da..f31c74e748d 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_cookie.c +++ b/lib/c-ares-1.34.4/src/lib/ares_cookie.c @@ -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; diff --git a/lib/c-ares-1.33.1/src/lib/ares_data.c b/lib/c-ares-1.34.4/src/lib/ares_data.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_data.c rename to lib/c-ares-1.34.4/src/lib/ares_data.c diff --git a/lib/c-ares-1.33.1/src/lib/ares_data.h b/lib/c-ares-1.34.4/src/lib/ares_data.h similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_data.h rename to lib/c-ares-1.34.4/src/lib/ares_data.h diff --git a/lib/c-ares-1.33.1/src/lib/ares_destroy.c b/lib/c-ares-1.34.4/src/lib/ares_destroy.c similarity index 68% rename from lib/c-ares-1.33.1/src/lib/ares_destroy.c rename to lib/c-ares-1.34.4/src/lib/ares_destroy.c index d75b5e227cc..1e5706e0e06 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_destroy.c +++ b/lib/c-ares-1.34.4/src/lib/ares_destroy.c @@ -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; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_free_hostent.c b/lib/c-ares-1.34.4/src/lib/ares_free_hostent.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_free_hostent.c rename to lib/c-ares-1.34.4/src/lib/ares_free_hostent.c diff --git a/lib/c-ares-1.33.1/src/lib/ares_free_string.c b/lib/c-ares-1.34.4/src/lib/ares_free_string.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_free_string.c rename to lib/c-ares-1.34.4/src/lib/ares_free_string.c diff --git a/lib/c-ares-1.33.1/src/lib/ares_freeaddrinfo.c b/lib/c-ares-1.34.4/src/lib/ares_freeaddrinfo.c similarity index 89% rename from lib/c-ares-1.33.1/src/lib/ares_freeaddrinfo.c rename to lib/c-ares-1.34.4/src/lib/ares_freeaddrinfo.c index 2a49f57531e..c996df9104a 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_freeaddrinfo.c +++ b/lib/c-ares-1.34.4/src/lib/ares_freeaddrinfo.c @@ -31,7 +31,7 @@ # include #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); diff --git a/lib/c-ares-1.33.1/src/lib/ares_getaddrinfo.c b/lib/c-ares-1.34.4/src/lib/ares_getaddrinfo.c similarity index 86% rename from lib/c-ares-1.33.1/src/lib/ares_getaddrinfo.c rename to lib/c-ares-1.34.4/src/lib/ares_getaddrinfo.c index 713acf744a0..32791dc37dc 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_getaddrinfo.c +++ b/lib/c-ares-1.34.4/src/lib/ares_getaddrinfo.c @@ -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 @@ static ares_status_t file_lookup(struct host_query *hquery) * 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; } @@ -484,6 +481,18 @@ static void terminate_retries(const struct host_query *hquery, query->no_retries = ARES_TRUE; } +static ares_bool_t ai_has_ipv4(struct ares_addrinfo *ai) +{ + struct ares_addrinfo_node *node; + + for (node = ai->nodes; node != NULL; node = node->ai_next) { + if (node->ai_family == AF_INET) { + return ARES_TRUE; + } + } + return ARES_FALSE; +} + static void host_callback(void *arg, ares_status_t status, size_t timeouts, const ares_dns_record_t *dnsrec) { @@ -497,9 +506,29 @@ 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) { + + /* We sent out ipv4 and ipv6 requests simultaneously. If we got a + * successful ipv4 response, we want to go ahead and tell the ipv6 request + * that if it fails or times out to not try again since we have the data + * we need. + * + * Our initial implementation of this would terminate retries if we got any + * successful response (ipv4 _or_ ipv6). But we did get some user-reported + * issues with this that had bad system configs and odd behavior: + * https://github.com/alpinelinux/docker-alpine/issues/366 + * + * Essentially the ipv6 query succeeded but the ipv4 query failed or timed + * out, and so we only returned the ipv6 address, but the host couldn't + * use ipv6. If we continued to allow ipv4 retries it would have found a + * server that worked and returned both address classes (this is clearly + * unexpected behavior). + * + * At some point down the road if ipv6 actually becomes required and + * reliable we can drop this ipv4 check. + */ + if (addinfostatus == ARES_SUCCESS && ai_has_ipv4(hquery->ai)) { terminate_retries(hquery, ares_dns_record_get_id(dnsrec)); } } @@ -528,10 +557,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 +595,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 +658,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 +687,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) diff --git a/lib/c-ares-1.33.1/src/lib/ares_getenv.c b/lib/c-ares-1.34.4/src/lib/ares_getenv.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_getenv.c rename to lib/c-ares-1.34.4/src/lib/ares_getenv.c diff --git a/lib/c-ares-1.33.1/src/lib/ares_getenv.h b/lib/c-ares-1.34.4/src/lib/ares_getenv.h similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_getenv.h rename to lib/c-ares-1.34.4/src/lib/ares_getenv.h diff --git a/lib/c-ares-1.33.1/src/lib/ares_gethostbyaddr.c b/lib/c-ares-1.34.4/src/lib/ares_gethostbyaddr.c similarity index 96% rename from lib/c-ares-1.33.1/src/lib/ares_gethostbyaddr.c rename to lib/c-ares-1.34.4/src/lib/ares_gethostbyaddr.c index 1db81ec2b48..a7acf3c45c9 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_gethostbyaddr.c +++ b/lib/c-ares-1.34.4/src/lib/ares_gethostbyaddr.c @@ -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 */ } diff --git a/lib/c-ares-1.33.1/src/lib/ares_gethostbyname.c b/lib/c-ares-1.34.4/src/lib/ares_gethostbyname.c similarity index 92% rename from lib/c-ares-1.33.1/src/lib/ares_gethostbyname.c rename to lib/c-ares-1.34.4/src/lib/ares_gethostbyname.c index 6db86e0eed1..56de729526a 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_gethostbyname.c +++ b/lib/c-ares-1.34.4/src/lib/ares_gethostbyname.c @@ -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 @@ static ares_status_t ares_gethostbyname_file_int(ares_channel_t *channel, * 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; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_getnameinfo.c b/lib/c-ares-1.34.4/src/lib/ares_getnameinfo.c similarity index 98% rename from lib/c-ares-1.33.1/src/lib/ares_getnameinfo.c rename to lib/c-ares-1.34.4/src/lib/ares_getnameinfo.c index 622c1adb1c7..01593545308 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_getnameinfo.c +++ b/lib/c-ares-1.34.4/src/lib/ares_getnameinfo.c @@ -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; diff --git a/lib/c-ares-1.33.1/src/lib/ares__hosts_file.c b/lib/c-ares-1.34.4/src/lib/ares_hosts_file.c similarity index 64% rename from lib/c-ares-1.33.1/src/lib/ares__hosts_file.c rename to lib/c-ares-1.34.4/src/lib/ares_hosts_file.c index ae9c071d7aa..0439b8e1d47 100644 --- a/lib/c-ares-1.33.1/src/lib/ares__hosts_file.c +++ b/lib/c-ares-1.34.4/src/lib/ares_hosts_file.c @@ -40,7 +40,6 @@ # include #endif #include -#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; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_inet_net_pton.h b/lib/c-ares-1.34.4/src/lib/ares_inet_net_pton.h similarity index 92% rename from lib/c-ares-1.33.1/src/lib/ares_inet_net_pton.h rename to lib/c-ares-1.34.4/src/lib/ares_inet_net_pton.h index 0a52855bd8c..e3ed83a3cb1 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_inet_net_pton.h +++ b/lib/c-ares-1.34.4/src/lib/ares_inet_net_pton.h @@ -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 */ diff --git a/lib/c-ares-1.33.1/src/lib/ares_init.c b/lib/c-ares-1.34.4/src/lib/ares_init.c similarity index 80% rename from lib/c-ares-1.33.1/src/lib/ares_init.c rename to lib/c-ares-1.34.4/src/lib/ares_init.c index 6dc5f4f9353..ae78262a112 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_init.c +++ b/lib/c-ares-1.34.4/src/lib/ares_init.c @@ -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; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_ipv6.h b/lib/c-ares-1.34.4/src/lib/ares_ipv6.h similarity index 99% rename from lib/c-ares-1.33.1/src/lib/ares_ipv6.h rename to lib/c-ares-1.34.4/src/lib/ares_ipv6.h index e7e0b6d3a5e..5da341b0106 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_ipv6.h +++ b/lib/c-ares-1.34.4/src/lib/ares_ipv6.h @@ -94,7 +94,7 @@ struct addrinfo { # ifdef IFNAMSIZ # define IF_NAMESIZE IFNAMSIZ # else -# define IF_NAMESIZE 256 +# define IF_NAMESIZE 32 # endif #endif diff --git a/lib/c-ares-1.33.1/src/lib/ares_library_init.c b/lib/c-ares-1.34.4/src/lib/ares_library_init.c similarity index 85% rename from lib/c-ares-1.33.1/src/lib/ares_library_init.c rename to lib/c-ares-1.34.4/src/lib/ares_library_init.c index 6c2f7c0f8ce..2b91692baec 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_library_init.c +++ b/lib/c-ares-1.34.4/src/lib/ares_library_init.c @@ -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) diff --git a/lib/c-ares-1.33.1/src/lib/ares_metrics.c b/lib/c-ares-1.34.4/src/lib/ares_metrics.c similarity index 99% rename from lib/c-ares-1.33.1/src/lib/ares_metrics.c rename to lib/c-ares-1.34.4/src/lib/ares_metrics.c index 0e22fc37e7c..13e34decc06 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_metrics.c +++ b/lib/c-ares-1.34.4/src/lib/ares_metrics.c @@ -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; diff --git a/lib/c-ares-1.33.1/src/lib/ares_options.c b/lib/c-ares-1.34.4/src/lib/ares_options.c similarity index 92% rename from lib/c-ares-1.33.1/src/lib/ares_options.c rename to lib/c-ares-1.34.4/src/lib/ares_options.c index 9aeb4bad3d7..3082f332457 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_options.c +++ b/lib/c-ares-1.34.4/src/lib/ares_options.c @@ -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 */ } diff --git a/lib/c-ares-1.33.1/src/lib/ares__parse_into_addrinfo.c b/lib/c-ares-1.34.4/src/lib/ares_parse_into_addrinfo.c similarity index 89% rename from lib/c-ares-1.33.1/src/lib/ares__parse_into_addrinfo.c rename to lib/c-ares-1.34.4/src/lib/ares_parse_into_addrinfo.c index 65c94c04014..2108f9b8615 100644 --- a/lib/c-ares-1.33.1/src/lib/ares__parse_into_addrinfo.c +++ b/lib/c-ares-1.34.4/src/lib/ares_parse_into_addrinfo.c @@ -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) { diff --git a/lib/c-ares-1.34.4/src/lib/ares_private.h b/lib/c-ares-1.34.4/src/lib/ares_private.h new file mode 100644 index 00000000000..e6d44e8b864 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/ares_private.h @@ -0,0 +1,635 @@ +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2010 Daniel Stenberg + * + * 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_PRIVATE_H +#define __ARES_PRIVATE_H + +/* ============================================================================ + * NOTE: All c-ares source files should include ares_private.h as the first + * header. + * ============================================================================ + */ + +#include "ares_setup.h" +#include "ares.h" + +#ifdef HAVE_NETINET_IN_H +# include +#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 +# define INADDR_NONE 0xffffffff +#endif + +/* By using a double cast, we can get rid of the bogus warning of + * warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *' + * increases required alignment from 1 to 4 [-Wcast-align] + */ +#define CARES_INADDR_CAST(type, var) ((type)((const void *)var)) + +#if defined(USE_WINSOCK) + +# define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" +# define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" +# define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" +# define WIN_NT_DNSCLIENT \ + "Software\\Policies\\Microsoft\\Windows NT\\DNSClient" +# define NAMESERVER "NameServer" +# define DHCPNAMESERVER "DhcpNameServer" +# define DATABASEPATH "DatabasePath" +# define WIN_PATH_HOSTS "\\hosts" +# define SEARCHLIST_KEY "SearchList" +# define PRIMARYDNSSUFFIX_KEY "PrimaryDNSSuffix" +# define INTERFACES_KEY "Interfaces" +# define DOMAIN_KEY "Domain" +# define DHCPDOMAIN_KEY "DhcpDomain" +# define PATH_RESOLV_CONF "" +#elif defined(WATT32) + +# define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf" +W32_FUNC const char *_w32_GetHostsFile(void); + +#elif defined(NETWARE) + +# define PATH_RESOLV_CONF "sys:/etc/resolv.cfg" +# define PATH_HOSTS "sys:/etc/hosts" + +#elif defined(__riscos__) + +# define PATH_RESOLV_CONF "" +# define PATH_HOSTS "InetDBase:Hosts" + +#elif defined(__HAIKU__) + +# define PATH_RESOLV_CONF "/system/settings/network/resolv.conf" +# define PATH_HOSTS "/system/settings/network/hosts" + +#else + +# define PATH_RESOLV_CONF "/etc/resolv.conf" +# ifdef ETC_INET +# define PATH_HOSTS "/etc/inet/hosts" +# else +# define PATH_HOSTS "/etc/hosts" +# endif + +#endif + +/********* EDNS defines section ******/ +#define EDNSPACKETSZ \ + 1232 /* Reasonable UDP payload size, as agreed by operators \ + https://www.dnsflagday.net/2020/#faq */ +#define MAXENDSSZ 4096 /* Maximum (local) limit for edns packet size */ +#define EDNSFIXEDSZ 11 /* Size of EDNS header */ + +/********* EDNS defines section ******/ + +/* Default values for server failover behavior. We retry failed servers with + * a 10% probability and a minimum delay of 5 seconds between retries. + */ +#define DEFAULT_SERVER_RETRY_CHANCE 10 +#define DEFAULT_SERVER_RETRY_DELAY 5000 + +struct ares_query; +typedef struct ares_query ares_query_t; + +/* State to represent a DNS query */ +struct ares_query { + /* Query ID from qbuf, for faster lookup, and current timeout */ + unsigned short qid; /* host byte order */ + ares_timeval_t ts; /*!< Timestamp query was sent */ + ares_timeval_t timeout; + ares_channel_t *channel; + + /* + * 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; + + /* connection handle query is associated with */ + ares_conn_t *conn; + + /* Query */ + ares_dns_record_t *query; + + ares_callback_dnsrec callback; + void *arg; + + /* Query status */ + size_t try_count; /* Number of times we tried this query already. */ + size_t cookie_try_count; /* Attempt count for cookie resends */ + ares_bool_t using_tcp; + ares_status_t error_status; + size_t timeouts; /* number of timeouts we saw for this request */ + ares_bool_t no_retries; /* do not perform any additional retries, this is + * set when a query is to be canceled */ +}; + +struct apattern { + struct ares_addr addr; + unsigned char mask; +}; + +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; + + /* 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]; + + /* Thread safety lock */ + ares_thread_mutex_t *lock; + + /* Conditional to wake waiters when queue is 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; + + /* random state to use when generating new ids and generating retry penalties + */ + ares_rand_state *rand_state; + + /* All active queries in a single list */ + ares_llist_t *all_queries; + /* Queries bucketed by qid, for quickly dispatching DNS responses: */ + ares_htable_szvp_t *queries_by_qid; + + /* Queries bucketed by timeout, for quickly handling timeouts: */ + 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_sock_state_cb sock_state_cb; + void *sock_state_cb_data; + + ares_sock_create_callback sock_create_cb; + void *sock_create_cb_data; + + ares_sock_config_callback sock_config_cb; + void *sock_config_cb_data; + + 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; + + /* Path for hosts file, configurable via ares_options */ + char *hosts_path; + + /* Maximum UDP queries per connection allowed */ + size_t udp_max_queries; + + /* Cache of local hosts file */ + ares_hosts_file_t *hf; + + /* Query Cache */ + ares_qcache_t *qcache; + + /* Fields controlling server failover behavior. + * The retry chance is the probability (1/N) by which we will retry a failed + * server instead of the best server when selecting a server to send queries + * to. + * The retry delay is the minimum time in milliseconds to wait between doing + * such retries (applied per-server). + */ + unsigned short server_retry_chance; + size_t server_retry_delay; + + /* Callback triggered when a server has a successful or failed response */ + ares_server_state_callback server_state_cb; + void *server_state_cb_data; + + /* TRUE if a reinit is pending. Reinit spawns a thread to read the system + * configuration and then apply the configuration since configuration + * reading may block. The thread handle is provided for waiting on thread + * exit. */ + ares_bool_t reinit_pending; + 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 + * system config changes might get triggered and we need a flag to make + * sure we don't take action. */ + ares_bool_t sys_up; +}; + +/* Does the domain end in ".onion" or ".onion."? Case-insensitive. */ +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_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); + +/*! Retrieve a list of names to use for searching. The first successful + * query in the list wins. This function also uses the HOSTSALIASES file + * as well as uses channel configuration to determine the search order. + * + * \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() + * 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); + +/*! Function to create callback arg for converting from ares_callback_dnsrec + * to ares_calback */ +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_free_query(ares_query_t *query); + +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, + const struct ares_options *options, + int optmask); +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; + struct apattern *sortlist; + size_t nsortlist; + char **domains; + size_t ndomains; + char *lookups; + size_t ndots; + size_t tries; + ares_bool_t rotate; + size_t timeout_ms; + 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_init_by_environment(ares_sysconfig_t *sysconfig); + + +typedef ares_status_t (*ares_sysconfig_line_cb_t)(const ares_channel_t *channel, + ares_sysconfig_t *sysconfig, + ares_buf_t *line); + +ares_status_t ares_sysconfig_parse_resolv_line(const ares_channel_t *channel, + ares_sysconfig_t *sysconfig, + ares_buf_t *line); + +ares_status_t ares_sysconfig_process_buf(const ares_channel_t *channel, + ares_sysconfig_t *sysconfig, + ares_buf_t *buf, + ares_sysconfig_line_cb_t cb); + +ares_status_t ares_init_sysconfig_files(const ares_channel_t *channel, + ares_sysconfig_t *sysconfig, + ares_bool_t process_resolvconf); +#ifdef __APPLE__ +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(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); + +/* 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_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); + +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); + +void ares_freeaddrinfo_cnames(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); + +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_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); + +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); + +/* Same as ares_query_dnsrec() except does not take a channel lock. Use this + * if a channel lock is already held */ +ares_status_t ares_query_nolock(ares_channel_t *channel, const char *name, + ares_dns_class_t dnsclass, + ares_dns_rec_type_t type, + ares_callback_dnsrec callback, void *arg, + unsigned short *qid); + +/*! 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); + +/* Same as ares_gethostbyaddr() except does not take a channel lock. Use this + * if a channel lock is already held */ +void ares_gethostbyaddr_nolock(ares_channel_t *channel, const void *addr, + int addrlen, int family, + ares_host_callback callback, void *arg); + +/*! Parse a compressed DNS name as defined in RFC1035 starting at the current + * 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. + * + * \param[in] buf Initialized buffer object + * \param[out] name Pointer passed by reference to be filled in with + * allocated string of the parsed name that must be + * ares_free()'d by the caller. + * \param[in] is_hostname if ARES_TRUE, will validate the character set for + * 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); + +/*! 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 + * each label being a maximum of 63 characters. If the validate_hostname + * flag is set, it will strictly validate the character set. + * + * \param[in,out] buf Initialized buffer object to write name to + * \param[in,out] list Pointer passed by reference to maintain a list of + * domain name to indexes used for name compression. + * Pass NULL (not by reference) if name compression isn't + * desired. Otherwise the list will be automatically + * created upon first entry. + * \param[in] validate_hostname Validate the hostname character set. + * \param[in] name Name to write out, it may have escape + * sequences. + * \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); + +/*! Check if the queue is empty, if so, wake any waiters. This is only + * effective if built with threading support. + * + * Must be holding a channel lock when calling this function. + * + * \param[in] channel Initialized ares channel object + */ +void ares_queue_notify_empty(ares_channel_t *channel); + +#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); + +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, + ares_dns_record_t *dnsrec); +ares_status_t ares_qcache_fetch(ares_channel_t *channel, + const ares_timeval_t *now, + const ares_dns_record_t *dnsrec, + const ares_dns_record_t **dnsrec_resp); + +void ares_metrics_record(const ares_query_t *query, ares_server_t *server, + ares_status_t status, const ares_dns_record_t *dnsrec); +size_t ares_metrics_server_timeout(const ares_server_t *server, + const ares_timeval_t *now); + +ares_status_t ares_cookie_apply(ares_dns_record_t *dnsrec, ares_conn_t *conn, + const ares_timeval_t *now); +ares_status_t ares_cookie_validate(ares_query_t *query, + const ares_dns_record_t *dnsresp, + 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); + +struct ares_event_thread; +typedef struct ares_event_thread ares_event_thread_t; + +void ares_event_thread_destroy(ares_channel_t *channel); +ares_status_t ares_event_thread_init(ares_channel_t *channel); + + +#ifdef _WIN32 +# define HOSTENT_ADDRTYPE_TYPE short +# define HOSTENT_LENGTH_TYPE short +#else +# define HOSTENT_ADDRTYPE_TYPE int +# define HOSTENT_LENGTH_TYPE int +#endif + +#endif /* __ARES_PRIVATE_H */ diff --git a/lib/c-ares-1.33.1/src/lib/ares_process.c b/lib/c-ares-1.34.4/src/lib/ares_process.c similarity index 50% rename from lib/c-ares-1.33.1/src/lib/ares_process.c rename to lib/c-ares-1.34.4/src/lib/ares_process.c index f05f67d8f2b..3d186ea9d58 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_process.c +++ b/lib/c-ares-1.34.4/src/lib/ares_process.c @@ -46,32 +46,30 @@ static void timeadd(ares_timeval_t *now, size_t millisecs); -static void write_tcp_data(ares_channel_t *channel, fd_set *write_fds, - ares_socket_t write_fd); -static void read_packets(ares_channel_t *channel, fd_set *read_fds, - ares_socket_t read_fd, const ares_timeval_t *now); -static void process_timeouts(ares_channel_t *channel, +static ares_status_t process_write(ares_channel_t *channel, + ares_socket_t write_fd); +static ares_status_t process_read(ares_channel_t *channel, + ares_socket_t read_fd, + const ares_timeval_t *now); +static ares_status_t process_timeouts(ares_channel_t *channel, const ares_timeval_t *now); static ares_status_t process_answer(ares_channel_t *channel, const unsigned char *abuf, size_t alen, - ares_conn_t *conn, ares_bool_t tcp, + ares_conn_t *conn, const ares_timeval_t *now); static void handle_conn_error(ares_conn_t *conn, ares_bool_t critical_failure, ares_status_t failure_status); - static ares_bool_t same_questions(const ares_query_t *query, const ares_dns_record_t *arec); -static ares_bool_t same_address(const struct sockaddr *sa, - const struct ares_addr *aa); static void end_query(ares_channel_t *channel, ares_server_t *server, ares_query_t *query, ares_status_t status, const ares_dns_record_t *dnsrec); -static void ares__query_disassociate_from_conn(ares_query_t *query) +static void ares_query_remove_from_conn(ares_query_t *query) { /* If its not part of a connection, it can't be tracked for timeouts either */ - ares__slist_node_destroy(query->node_queries_by_timeout); - ares__llist_node_destroy(query->node_queries_to_conn); + ares_slist_node_destroy(query->node_queries_by_timeout); + ares_llist_node_destroy(query->node_queries_to_conn); query->node_queries_by_timeout = NULL; query->node_queries_to_conn = NULL; query->conn = NULL; @@ -82,7 +80,7 @@ static void invoke_server_state_cb(const ares_server_t *server, ares_bool_t success, int flags) { const ares_channel_t *channel = server->channel; - ares__buf_t *buf; + ares_buf_t *buf; ares_status_t status; char *server_string; @@ -90,18 +88,18 @@ static void invoke_server_state_cb(const ares_server_t *server, return; } - buf = ares__buf_create(); + buf = ares_buf_create(); if (buf == NULL) { return; /* LCOV_EXCL_LINE: OutOfMemory */ } status = ares_get_server_addr(server, buf); if (status != ARES_SUCCESS) { - ares__buf_destroy(buf); /* LCOV_EXCL_LINE: OutOfMemory */ - return; /* LCOV_EXCL_LINE: OutOfMemory */ + ares_buf_destroy(buf); /* LCOV_EXCL_LINE: OutOfMemory */ + return; /* LCOV_EXCL_LINE: OutOfMemory */ } - server_string = ares__buf_finish_str(buf, NULL); + server_string = ares_buf_finish_str(buf, NULL); buf = NULL; if (server_string == NULL) { return; /* LCOV_EXCL_LINE: OutOfMemory */ @@ -115,19 +113,19 @@ static void invoke_server_state_cb(const ares_server_t *server, static void server_increment_failures(ares_server_t *server, ares_bool_t used_tcp) { - ares__slist_node_t *node; + ares_slist_node_t *node; const ares_channel_t *channel = server->channel; ares_timeval_t next_retry_time; - node = ares__slist_node_find(channel->servers, server); + node = ares_slist_node_find(channel->servers, server); if (node == NULL) { return; /* LCOV_EXCL_LINE: DefensiveCoding */ } server->consec_failures++; - ares__slist_node_reinsert(node); + ares_slist_node_reinsert(node); - ares__tvnow(&next_retry_time); + ares_tvnow(&next_retry_time); timeadd(&next_retry_time, channel->server_retry_delay); server->next_retry_time = next_retry_time; @@ -138,17 +136,17 @@ static void server_increment_failures(ares_server_t *server, static void server_set_good(ares_server_t *server, ares_bool_t used_tcp) { - ares__slist_node_t *node; + ares_slist_node_t *node; const ares_channel_t *channel = server->channel; - node = ares__slist_node_find(channel->servers, server); + node = ares_slist_node_find(channel->servers, server); if (node == NULL) { return; /* LCOV_EXCL_LINE: DefensiveCoding */ } if (server->consec_failures > 0) { server->consec_failures = 0; - ares__slist_node_reinsert(node); + ares_slist_node_reinsert(node); } server->next_retry_time.sec = 0; @@ -160,8 +158,8 @@ static void server_set_good(ares_server_t *server, ares_bool_t used_tcp) } /* 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_timedout(const ares_timeval_t *now, + const ares_timeval_t *check) { ares_int64_t secs = (now->sec - check->sec); @@ -190,380 +188,422 @@ static void timeadd(ares_timeval_t *now, size_t millisecs) } } -/* - * generic process function - */ -static void processfds(ares_channel_t *channel, fd_set *read_fds, - ares_socket_t read_fd, fd_set *write_fds, - ares_socket_t write_fd) +static ares_status_t ares_process_fds_nolock(ares_channel_t *channel, + const ares_fd_events_t *events, + size_t nevents, unsigned int flags) { ares_timeval_t now; + size_t i; + ares_status_t status = ARES_SUCCESS; - if (channel == NULL) { - return; /* LCOV_EXCL_LINE: DefensiveCoding */ + if (channel == NULL || (events == NULL && nevents != 0)) { + return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - ares__channel_lock(channel); + ares_tvnow(&now); - ares__tvnow(&now); - read_packets(channel, read_fds, read_fd, &now); - process_timeouts(channel, &now); - /* Write last as the other 2 operations might have triggered writes */ - write_tcp_data(channel, write_fds, write_fd); + /* Process write events */ + for (i = 0; i < nevents; i++) { + if (events[i].fd == ARES_SOCKET_BAD || + !(events[i].events & ARES_FD_EVENT_WRITE)) { + continue; + } + status = process_write(channel, events[i].fd); + /* We only care about ENOMEM, anything else is handled via connection + * retries, etc */ + if (status == ARES_ENOMEM) { + goto done; + } + } - /* See if any connections should be cleaned up */ - ares__check_cleanup_conns(channel); - ares__channel_unlock(channel); + /* Process read events */ + for (i = 0; i < nevents; i++) { + if (events[i].fd == ARES_SOCKET_BAD || + !(events[i].events & ARES_FD_EVENT_READ)) { + continue; + } + status = process_read(channel, events[i].fd, &now); + if (status == ARES_ENOMEM) { + goto done; + } + } + + if (!(flags & ARES_PROCESS_FLAG_SKIP_NON_FD)) { + ares_check_cleanup_conns(channel); + status = process_timeouts(channel, &now); + if (status == ARES_ENOMEM) { + goto done; + } + } + +done: + if (status == ARES_ENOMEM) { + return ARES_ENOMEM; + } + return ARES_SUCCESS; } -/* Something interesting happened on the wire, or there was a timeout. - * See what's up and respond accordingly. - */ -void ares_process(ares_channel_t *channel, fd_set *read_fds, fd_set *write_fds) +ares_status_t ares_process_fds(ares_channel_t *channel, + const ares_fd_events_t *events, size_t nevents, + unsigned int flags) { - processfds(channel, read_fds, ARES_SOCKET_BAD, write_fds, ARES_SOCKET_BAD); + ares_status_t status; + + if (channel == NULL) { + return ARES_EFORMERR; + } + + ares_channel_lock(channel); + status = ares_process_fds_nolock(channel, events, nevents, flags); + ares_channel_unlock(channel); + return status; } -/* Something interesting happened on the wire, or there was a timeout. - * See what's up and respond accordingly. - */ -void ares_process_fd(ares_channel_t *channel, - ares_socket_t read_fd, /* use ARES_SOCKET_BAD or valid - file descriptors */ - ares_socket_t write_fd) +void ares_process_fd(ares_channel_t *channel, ares_socket_t read_fd, + ares_socket_t write_fd) { - processfds(channel, NULL, read_fd, NULL, write_fd); + ares_fd_events_t events[2]; + size_t nevents = 0; + + memset(events, 0, sizeof(events)); + + if (read_fd != ARES_SOCKET_BAD) { + nevents++; + events[nevents - 1].fd = read_fd; + events[nevents - 1].events |= ARES_FD_EVENT_READ; + } + + if (write_fd != ARES_SOCKET_BAD) { + if (write_fd != read_fd) { + nevents++; + } + events[nevents - 1].fd = write_fd; + events[nevents - 1].events |= ARES_FD_EVENT_WRITE; + } + + ares_process_fds(channel, events, nevents, ARES_PROCESS_FLAG_NONE); } -/* If any TCP sockets select true for writing, write out queued data - * we have for them. - */ -static void write_tcp_data(ares_channel_t *channel, fd_set *write_fds, - ares_socket_t write_fd) +static ares_socket_t *channel_socket_list(const ares_channel_t *channel, + size_t *num) { - ares__slist_node_t *node; + ares_slist_node_t *snode; + ares_array_t *arr = ares_array_create(sizeof(ares_socket_t), NULL); - if (!write_fds && (write_fd == ARES_SOCKET_BAD)) { - /* no possible action */ - return; + *num = 0; + + if (arr == NULL) { + return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ } - for (node = ares__slist_node_first(channel->servers); node != NULL; - node = ares__slist_node_next(node)) { - ares_server_t *server = ares__slist_node_val(node); - const unsigned char *data; - size_t data_len; - ares_ssize_t count; + 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 *node; - /* Make sure server has data to send and is selected in write_fds or - write_fd. */ - if (ares__buf_len(server->tcp_send) == 0 || server->tcp_conn == NULL) { - continue; - } + for (node = ares_llist_node_first(server->connections); node != NULL; + node = ares_llist_node_next(node)) { + const ares_conn_t *conn = ares_llist_node_val(node); + ares_socket_t *sptr; + ares_status_t status; - if (write_fds) { - if (!FD_ISSET(server->tcp_conn->fd, write_fds)) { - continue; - } - } else { - if (server->tcp_conn->fd != write_fd) { + if (conn->fd == ARES_SOCKET_BAD) { continue; } - } - - if (write_fds) { - /* If there's an error and we close this socket, then open - * another with the same fd to talk to another server, then we - * don't want to think that it was the new socket that was - * ready. This is not disastrous, but is likely to result in - * extra system calls and confusion. */ - FD_CLR(server->tcp_conn->fd, write_fds); - } - data = ares__buf_peek(server->tcp_send, &data_len); - count = ares__conn_write(server->tcp_conn, data, data_len); - if (count <= 0) { - if (!ares__socket_try_again(SOCKERRNO)) { - handle_conn_error(server->tcp_conn, ARES_TRUE, ARES_ECONNREFUSED); + status = ares_array_insert_last((void **)&sptr, arr); + if (status != ARES_SUCCESS) { + ares_array_destroy(arr); /* LCOV_EXCL_LINE: OutOfMemory */ + return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ } - continue; - } - - /* Strip data written from the buffer */ - ares__buf_consume(server->tcp_send, (size_t)count); - - /* Notify state callback all data is written */ - if (ares__buf_len(server->tcp_send) == 0) { - SOCK_STATE_CALLBACK(channel, server->tcp_conn->fd, 1, 0); + *sptr = conn->fd; } } + + return ares_array_finish(arr, num); } -/* If any TCP socket selects true for reading, read some data, - * allocate a buffer if we finish reading the length word, and process - * a packet if we finish reading one. +/* Something interesting happened on the wire, or there was a timeout. + * See what's up and respond accordingly. */ -static void read_tcp_data(ares_channel_t *channel, ares_conn_t *conn, - const ares_timeval_t *now) +void ares_process(ares_channel_t *channel, fd_set *read_fds, fd_set *write_fds) { - ares_ssize_t count; - ares_server_t *server = conn->server; - - /* Fetch buffer to store data we are reading */ - size_t ptr_len = 65535; - unsigned char *ptr; - - ptr = ares__buf_append_start(server->tcp_parser, &ptr_len); - - if (ptr == NULL) { - handle_conn_error(conn, ARES_FALSE /* not critical to connection */, - ARES_SUCCESS); - return; /* bail out on malloc failure. TODO: make this - function return error codes */ - } + size_t i; + size_t num_sockets; + ares_socket_t *socketlist; + ares_fd_events_t *events = NULL; + size_t nevents = 0; - /* Read from socket */ - count = ares__socket_recv(channel, conn->fd, ptr, ptr_len); - if (count <= 0) { - ares__buf_append_finish(server->tcp_parser, 0); - if (!(count == -1 && ares__socket_try_again(SOCKERRNO))) { - handle_conn_error(conn, ARES_TRUE, ARES_ECONNREFUSED); - } + if (channel == NULL) { return; } - /* Record amount of data read */ - ares__buf_append_finish(server->tcp_parser, (size_t)count); + ares_channel_lock(channel); - /* Process all queued answers */ - while (1) { - unsigned short dns_len = 0; - const unsigned char *data = NULL; - size_t data_len = 0; - ares_status_t status; - - /* Tag so we can roll back */ - ares__buf_tag(server->tcp_parser); + /* There is no good way to iterate across an fd_set, instead we must pull a + * list of all known fds, and iterate across that checking against the fd_set. + */ + socketlist = channel_socket_list(channel, &num_sockets); - /* Read length indicator */ - if (ares__buf_fetch_be16(server->tcp_parser, &dns_len) != ARES_SUCCESS) { - ares__buf_tag_rollback(server->tcp_parser); - break; + /* Lets create an events array, maximum number is the number of sockets in + * the list, so we'll use that and just track entries with nevents */ + if (num_sockets) { + events = ares_malloc_zero(sizeof(*events) * num_sockets); + if (events == NULL) { + goto done; } + } - /* Not enough data for a full response yet */ - if (ares__buf_consume(server->tcp_parser, dns_len) != ARES_SUCCESS) { - ares__buf_tag_rollback(server->tcp_parser); - break; + for (i = 0; i < num_sockets; i++) { + ares_bool_t had_read = ARES_FALSE; + if (read_fds && FD_ISSET(socketlist[i], read_fds)) { + nevents++; + events[nevents - 1].fd = socketlist[i]; + events[nevents - 1].events |= ARES_FD_EVENT_READ; + had_read = ARES_TRUE; } - - /* Can't fail except for misuse */ - data = ares__buf_tag_fetch(server->tcp_parser, &data_len); - if (data == NULL || data_len < 2) { - ares__buf_tag_clear(server->tcp_parser); - break; + if (write_fds && FD_ISSET(socketlist[i], write_fds)) { + if (!had_read) { + nevents++; + } + events[nevents - 1].fd = socketlist[i]; + events[nevents - 1].events |= ARES_FD_EVENT_WRITE; } + } - /* Strip off 2 bytes length */ - data += 2; - data_len -= 2; +done: + ares_process_fds_nolock(channel, events, nevents, ARES_PROCESS_FLAG_NONE); + ares_free(events); + ares_free(socketlist); + ares_channel_unlock(channel); +} - /* We finished reading this answer; process it */ - status = process_answer(channel, data, data_len, conn, ARES_TRUE, now); - if (status != ARES_SUCCESS) { - handle_conn_error(conn, ARES_TRUE, status); - return; - } +static ares_status_t process_write(ares_channel_t *channel, + ares_socket_t write_fd) +{ + ares_conn_t *conn = ares_conn_from_fd(channel, write_fd); + ares_status_t status; - /* Since we processed the answer, clear the tag so space can be reclaimed */ - ares__buf_tag_clear(server->tcp_parser); + if (conn == NULL) { + return ARES_SUCCESS; + } + + /* Mark as connected if we got here and TFO Initial not set */ + if (!(conn->flags & ARES_CONN_FLAG_TFO_INITIAL)) { + conn->state_flags |= ARES_CONN_STATE_CONNECTED; + } + + status = ares_conn_flush(conn); + if (status != ARES_SUCCESS) { + handle_conn_error(conn, ARES_TRUE, status); } + return status; } -static ares_socket_t *channel_socket_list(const ares_channel_t *channel, - size_t *num) +void ares_process_pending_write(ares_channel_t *channel) { - ares__slist_node_t *snode; - ares__array_t *arr = ares__array_create(sizeof(ares_socket_t), NULL); + ares_slist_node_t *node; - *num = 0; + if (channel == NULL) { + return; + } - if (arr == NULL) { - return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ + ares_channel_lock(channel); + if (!channel->notify_pending_write) { + ares_channel_unlock(channel); + return; } - 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 *node; + /* Set as untriggerd before calling into ares_conn_flush(), this is + * because its possible ares_conn_flush() might cause additional data to + * be enqueued if there is some form of exception so it will need to recurse. + */ + channel->notify_pending_write = ARES_FALSE; - for (node = ares__llist_node_first(server->connections); node != NULL; - node = ares__llist_node_next(node)) { - const ares_conn_t *conn = ares__llist_node_val(node); - ares_socket_t *sptr; - ares_status_t status; + for (node = ares_slist_node_first(channel->servers); node != NULL; + node = ares_slist_node_next(node)) { + ares_server_t *server = ares_slist_node_val(node); + ares_conn_t *conn = server->tcp_conn; + ares_status_t status; - if (conn->fd == ARES_SOCKET_BAD) { - continue; - } + if (conn == NULL) { + continue; + } - status = ares__array_insert_last((void **)&sptr, arr); - if (status != ARES_SUCCESS) { - ares__array_destroy(arr); /* LCOV_EXCL_LINE: OutOfMemory */ - return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ - } - *sptr = conn->fd; + /* Enqueue any pending data if there is any */ + status = ares_conn_flush(conn); + if (status != ARES_SUCCESS) { + handle_conn_error(conn, ARES_TRUE, status); } } - return ares__array_finish(arr, num); + ares_channel_unlock(channel); } -/* If any UDP sockets select true for reading, process them. */ -static void read_udp_packets_fd(ares_channel_t *channel, ares_conn_t *conn, - const ares_timeval_t *now) +static ares_status_t read_conn_packets(ares_conn_t *conn) { - ares_ssize_t read_len; - unsigned char buf[MAXENDSSZ + 1]; + ares_bool_t read_again; + ares_conn_err_t err; + const ares_channel_t *channel = conn->server->channel; -#ifdef HAVE_RECVFROM - ares_socklen_t fromlen; - - union { - struct sockaddr sa; - struct sockaddr_in sa4; - struct sockaddr_in6 sa6; - } from; + do { + size_t count; + size_t len = 65535; + unsigned char *ptr; + size_t start_len = ares_buf_len(conn->in_buf); + + /* If UDP, lets write out a placeholder for the length indicator */ + if (!(conn->flags & ARES_CONN_FLAG_TCP) && + ares_buf_append_be16(conn->in_buf, 0) != ARES_SUCCESS) { + handle_conn_error(conn, ARES_FALSE /* not critical to connection */, + ARES_SUCCESS); + return ARES_ENOMEM; + } - memset(&from, 0, sizeof(from)); -#endif + /* Get a buffer of sufficient size */ + ptr = ares_buf_append_start(conn->in_buf, &len); - /* To reduce event loop overhead, read and process as many - * packets as we can. */ - do { - if (conn->fd == ARES_SOCKET_BAD) { - read_len = -1; - } else { - if (conn->server->addr.family == AF_INET) { - fromlen = sizeof(from.sa4); - } else { - fromlen = sizeof(from.sa6); - } - read_len = ares__socket_recvfrom(channel, conn->fd, (void *)buf, - sizeof(buf), 0, &from.sa, &fromlen); + if (ptr == NULL) { + handle_conn_error(conn, ARES_FALSE /* not critical to connection */, + ARES_SUCCESS); + return ARES_ENOMEM; } - if (read_len == 0) { - /* UDP is connectionless, so result code of 0 is a 0-length UDP - * packet, and not an indication the connection is closed like on - * tcp */ - continue; - } else if (read_len < 0) { - if (ares__socket_try_again(SOCKERRNO)) { - break; + /* Read from socket */ + err = ares_conn_read(conn, ptr, len, &count); + + if (err != ARES_CONN_ERR_SUCCESS) { + ares_buf_append_finish(conn->in_buf, 0); + if (!(conn->flags & ARES_CONN_FLAG_TCP)) { + ares_buf_set_length(conn->in_buf, start_len); } + break; + } - handle_conn_error(conn, ARES_TRUE, ARES_ECONNREFUSED); - return; -#ifdef HAVE_RECVFROM - } else if (!same_address(&from.sa, &conn->server->addr)) { - /* The address the response comes from does not match the address we - * sent the request to. Someone may be attempting to perform a cache - * poisoning attack. */ - continue; -#endif + /* Record amount of data read */ + ares_buf_append_finish(conn->in_buf, count); - } else { - process_answer(channel, buf, (size_t)read_len, conn, ARES_FALSE, now); + /* Only loop if sockets support non-blocking operation, and are using UDP + * or are using TCP and read the maximum buffer size */ + read_again = ARES_FALSE; + if (channel->sock_funcs.flags & ARES_SOCKFUNC_FLAG_NONBLOCKING && + (!(conn->flags & ARES_CONN_FLAG_TCP) || count == len)) { + read_again = ARES_TRUE; } + /* If UDP, overwrite length */ + if (!(conn->flags & ARES_CONN_FLAG_TCP)) { + len = ares_buf_len(conn->in_buf); + ares_buf_set_length(conn->in_buf, start_len); + ares_buf_append_be16(conn->in_buf, (unsigned short)count); + ares_buf_set_length(conn->in_buf, len); + } /* Try to read again only if *we* set up the socket, otherwise it may be * a blocking socket and would cause recvfrom to hang. */ - } while (read_len >= 0 && channel->sock_funcs == NULL); -} + } while (read_again); -static void read_packets(ares_channel_t *channel, fd_set *read_fds, - ares_socket_t read_fd, const ares_timeval_t *now) -{ - size_t i; - ares_socket_t *socketlist = NULL; - size_t num_sockets = 0; - ares_conn_t *conn = NULL; - ares__llist_node_t *node = NULL; - - if (!read_fds && (read_fd == ARES_SOCKET_BAD)) { - /* no possible action */ - return; + if (err != ARES_CONN_ERR_SUCCESS && err != ARES_CONN_ERR_WOULDBLOCK) { + handle_conn_error(conn, ARES_TRUE, ARES_ECONNREFUSED); + return ARES_ECONNREFUSED; } - /* Single socket specified */ - if (!read_fds) { - node = ares__htable_asvp_get_direct(channel->connnode_by_socket, read_fd); - if (node == NULL) { - return; - } + return ARES_SUCCESS; +} - conn = ares__llist_node_val(node); +static ares_status_t read_answers(ares_conn_t *conn, const ares_timeval_t *now) +{ + ares_status_t status; + ares_channel_t *channel = conn->server->channel; - if (conn->flags & ARES_CONN_FLAG_TCP) { - read_tcp_data(channel, conn, now); - } else { - read_udp_packets_fd(channel, conn, now); - } + /* Process all queued answers */ + while (1) { + unsigned short dns_len = 0; + const unsigned char *data = NULL; + size_t data_len = 0; - return; - } + /* Tag so we can roll back */ + ares_buf_tag(conn->in_buf); - /* There is no good way to iterate across an fd_set, instead we must pull a - * list of all known fds, and iterate across that checking against the fd_set. - */ - socketlist = channel_socket_list(channel, &num_sockets); + /* Read length indicator */ + status = ares_buf_fetch_be16(conn->in_buf, &dns_len); + if (status != ARES_SUCCESS) { + ares_buf_tag_rollback(conn->in_buf); + break; + } - for (i = 0; i < num_sockets; i++) { - if (!FD_ISSET(socketlist[i], read_fds)) { - continue; + /* Not enough data for a full response yet */ + status = ares_buf_consume(conn->in_buf, dns_len); + if (status != ARES_SUCCESS) { + ares_buf_tag_rollback(conn->in_buf); + break; } - /* If there's an error and we close this socket, then open - * another with the same fd to talk to another server, then we - * don't want to think that it was the new socket that was - * ready. This is not disastrous, but is likely to result in - * extra system calls and confusion. */ - FD_CLR(socketlist[i], read_fds); - - node = - ares__htable_asvp_get_direct(channel->connnode_by_socket, socketlist[i]); - if (node == NULL) { - return; + /* Can't fail except for misuse */ + data = ares_buf_tag_fetch(conn->in_buf, &data_len); + if (data == NULL || data_len < 2) { + ares_buf_tag_clear(conn->in_buf); + break; } - conn = ares__llist_node_val(node); + /* Strip off 2 bytes length */ + data += 2; + data_len -= 2; - if (conn->flags & ARES_CONN_FLAG_TCP) { - read_tcp_data(channel, conn, now); - } else { - read_udp_packets_fd(channel, conn, now); + /* We finished reading this answer; process it */ + status = process_answer(channel, data, data_len, conn, now); + if (status != ARES_SUCCESS) { + handle_conn_error(conn, ARES_TRUE, status); + return status; } + + /* Since we processed the answer, clear the tag so space can be reclaimed */ + ares_buf_tag_clear(conn->in_buf); } + return status; +} - ares_free(socketlist); +static ares_status_t process_read(ares_channel_t *channel, + ares_socket_t read_fd, + const ares_timeval_t *now) +{ + ares_conn_t *conn = ares_conn_from_fd(channel, read_fd); + ares_status_t status; + + if (conn == NULL) { + return ARES_SUCCESS; + } + + /* TODO: There might be a potential issue here where there was a read that + * read some data, then looped and read again and got a disconnect. + * Right now, that would cause a resend instead of processing the data + * we have. This is fairly unlikely to occur due to only looping if + * a full buffer of 65535 bytes was read. */ + status = read_conn_packets(conn); + + if (status != ARES_SUCCESS) { + return status; + } + + return read_answers(conn, now); } /* If any queries have timed out, note the timeout and move them on. */ -static void process_timeouts(ares_channel_t *channel, const ares_timeval_t *now) +static ares_status_t process_timeouts(ares_channel_t *channel, + const ares_timeval_t *now) { - ares__slist_node_t *node; + ares_slist_node_t *node; + ares_status_t status = ARES_SUCCESS; /* Just keep popping off the first as this list will re-sort as things come * and go. We don't want to try to rely on 'next' as some operation might * cause a cleanup of that pointer and would become invalid */ - while ((node = ares__slist_node_first(channel->queries_by_timeout)) != NULL) { - ares_query_t *query = ares__slist_node_val(node); + while ((node = ares_slist_node_first(channel->queries_by_timeout)) != NULL) { + ares_query_t *query = ares_slist_node_val(node); ares_conn_t *conn; /* Since this is sorted, as soon as we hit a query that isn't timed out, * break */ - if (!ares__timedout(now, &query->timeout)) { + if (!ares_timedout(now, &query->timeout)) { break; } @@ -571,8 +611,16 @@ static void process_timeouts(ares_channel_t *channel, const ares_timeval_t *now) conn = query->conn; server_increment_failures(conn->server, query->using_tcp); - ares__requeue_query(query, now, ARES_ETIMEOUT, ARES_TRUE, NULL); + status = ares_requeue_query(query, now, ARES_ETIMEOUT, ARES_TRUE, NULL); + if (status == ARES_ENOMEM) { + goto done; + } } +done: + if (status == ARES_ENOMEM) { + return ARES_ENOMEM; + } + return ARES_SUCCESS; } static ares_status_t rewrite_without_edns(ares_query_t *query) @@ -602,22 +650,72 @@ static ares_status_t rewrite_without_edns(ares_query_t *query) return status; } +static ares_bool_t issue_might_be_edns(const ares_dns_record_t *req, + const ares_dns_record_t *rsp) +{ + const ares_dns_rr_t *rr; + + /* If we use EDNS and server answers with FORMERR without an OPT RR, the + * protocol extension is not understood by the responder. We must retry the + * query without EDNS enabled. */ + if (ares_dns_record_get_rcode(rsp) != ARES_RCODE_FORMERR) { + return ARES_FALSE; + } + + rr = ares_dns_get_opt_rr_const(req); + if (rr == NULL) { + /* We didn't send EDNS */ + return ARES_FALSE; + } + + if (ares_dns_get_opt_rr_const(rsp) == NULL) { + /* Spec says EDNS won't be echo'd back on non-supporting servers, so + * retry without EDNS */ + return ARES_TRUE; + } + + /* As per issue #911 some non-compliant servers that do indeed support EDNS + * but don't support unrecognized option codes exist. At this point we + * expect them to have also returned an EDNS opt record, but we may remove + * that check in the future. Lets detect this situation if we're sending + * option codes */ + if (ares_dns_rr_get_opt_cnt(rr, ARES_RR_OPT_OPTIONS) == 0) { + /* We didn't send any option codes */ + return ARES_FALSE; + } + + if (ares_dns_get_opt_rr_const(rsp) != NULL) { + /* At this time we're requiring the server to respond with EDNS opt + * records since that's what has been observed in the field. We might + * find in the future we have to remove this, who knows. Lets go + * ahead and force a retry without EDNS*/ + return ARES_TRUE; + } + + return ARES_FALSE; +} + /* Handle an answer from a server. This must NEVER cleanup the * server connection! Return something other than ARES_SUCCESS to cause * the connection to be terminated after this call. */ static ares_status_t process_answer(ares_channel_t *channel, const unsigned char *abuf, size_t alen, - ares_conn_t *conn, ares_bool_t tcp, + ares_conn_t *conn, const ares_timeval_t *now) { ares_query_t *query; - /* Cache these as once ares__send_query() gets called, it may end up + /* Cache these as once ares_send_query() gets called, it may end up * invalidating the connection all-together */ ares_server_t *server = conn->server; ares_dns_record_t *rdnsrec = NULL; ares_status_t status; ares_bool_t is_cached = ARES_FALSE; + /* UDP can have 0-byte messages, drop them to the ground */ + if (alen == 0) { + return ARES_SUCCESS; + } + /* Parse the response */ status = ares_dns_parse(abuf, alen, 0, &rdnsrec); if (status != ARES_SUCCESS) { @@ -629,8 +727,8 @@ static ares_status_t process_answer(ares_channel_t *channel, /* Find the query corresponding to this packet. The queries are * hashed/bucketed by query id, so this lookup should be quick. */ - query = ares__htable_szvp_get_direct(channel->queries_by_qid, - ares_dns_record_get_id(rdnsrec)); + query = ares_htable_szvp_get_direct(channel->queries_by_qid, + ares_dns_record_get_id(rdnsrec)); if (!query) { /* We may have stopped listening for this query, that's ok */ status = ARES_SUCCESS; @@ -657,22 +755,21 @@ static ares_status_t process_answer(ares_channel_t *channel, * remove it from the connection's queue so we can possibly invalidate the * connection. Delay cleaning up the connection though as we may enqueue * something new. */ - ares__llist_node_destroy(query->node_queries_to_conn); + ares_llist_node_destroy(query->node_queries_to_conn); query->node_queries_to_conn = NULL; - /* If we use EDNS and server answers with FORMERR without an OPT RR, the - * protocol extension is not understood by the responder. We must retry the - * query without EDNS enabled. */ - if (ares_dns_record_get_rcode(rdnsrec) == ARES_RCODE_FORMERR && - ares_dns_get_opt_rr_const(query->query) != NULL && - ares_dns_get_opt_rr_const(rdnsrec) == NULL) { + /* There are old servers that don't understand EDNS at all, then some servers + * that have non-compliant implementations. Lets try to detect this sort + * of thing. */ + if (issue_might_be_edns(query->query, rdnsrec)) { status = rewrite_without_edns(query); if (status != ARES_SUCCESS) { end_query(channel, server, query, status, NULL); goto cleanup; } - ares__send_query(query, now); + /* Send to same server */ + ares_send_query(server, query, now); status = ARES_SUCCESS; goto cleanup; } @@ -681,10 +778,11 @@ static ares_status_t process_answer(ares_channel_t *channel, * don't accept the packet, and switch the query to TCP if we hadn't * done so already. */ - if (ares_dns_record_get_flags(rdnsrec) & ARES_FLAG_TC && !tcp && + if (ares_dns_record_get_flags(rdnsrec) & ARES_FLAG_TC && + !(conn->flags & ARES_CONN_FLAG_TCP) && !(channel->flags & ARES_FLAG_IGNTC)) { query->using_tcp = ARES_TRUE; - ares__send_query(query, now); + ares_send_query(NULL, query, now); status = ARES_SUCCESS; /* Switched to TCP is ok */ goto cleanup; } @@ -711,7 +809,7 @@ static ares_status_t process_answer(ares_channel_t *channel, } server_increment_failures(server, query->using_tcp); - ares__requeue_query(query, now, status, ARES_TRUE, rdnsrec); + ares_requeue_query(query, now, status, ARES_TRUE, rdnsrec); /* Should any of these cause a connection termination? * Maybe SERVER_FAILURE? */ @@ -753,19 +851,18 @@ static void handle_conn_error(ares_conn_t *conn, ares_bool_t critical_failure, } /* This will requeue any connections automatically */ - ares__close_connection(conn, failure_status); + ares_close_connection(conn, failure_status); } -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_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_channel_t *channel = query->channel; - size_t max_tries = ares__slist_len(channel->servers) * channel->tries; + ares_channel_t *channel = query->channel; + size_t max_tries = ares_slist_len(channel->servers) * channel->tries; - ares__query_disassociate_from_conn(query); + ares_query_remove_from_conn(query); if (status != ARES_SUCCESS) { query->error_status = status; @@ -776,7 +873,7 @@ ares_status_t ares__requeue_query(ares_query_t *query, } if (query->try_count < max_tries && !query->no_retries) { - return ares__send_query(query, now); + return ares_send_query(NULL, query, now); } /* If we are here, all attempts to perform query failed. */ @@ -788,32 +885,58 @@ ares_status_t ares__requeue_query(ares_query_t *query, return ARES_ETIMEOUT; } -/* Pick a random server from the list, we first get a random number in the - * range of the number of servers, then scan until we find that server in - * the list */ -static ares_server_t *ares__random_server(ares_channel_t *channel) +/*! Count the number of servers that share the same highest priority (lowest + * consecutive failures). Since they are sorted in priority order, we just + * stop when the consecutive failure count changes. Used for random selection + * of good servers. */ +static size_t count_highest_prio_servers(const ares_channel_t *channel) +{ + ares_slist_node_t *node; + size_t cnt = 0; + size_t last_consec_failures = SIZE_MAX; + + for (node = ares_slist_node_first(channel->servers); node != NULL; + node = ares_slist_node_next(node)) { + const ares_server_t *server = ares_slist_node_val(node); + + if (last_consec_failures != SIZE_MAX && + last_consec_failures < server->consec_failures) { + break; + } + + last_consec_failures = server->consec_failures; + cnt++; + } + + return cnt; +} + +/* Pick a random *best* server from the list, we first get a random number in + * the range of the number of *best* servers, then scan until we find that + * server in the list */ +static ares_server_t *ares_random_server(ares_channel_t *channel) { - unsigned char c; - size_t cnt; - size_t idx; - ares__slist_node_t *node; - size_t num_servers = ares__slist_len(channel->servers); + unsigned char c; + size_t cnt; + size_t idx; + ares_slist_node_t *node; + size_t num_servers = count_highest_prio_servers(channel); /* Silence coverity, not possible */ if (num_servers == 0) { return NULL; } - ares__rand_bytes(channel->rand_state, &c, 1); + ares_rand_bytes(channel->rand_state, &c, 1); cnt = c; idx = cnt % num_servers; cnt = 0; - for (node = ares__slist_node_first(channel->servers); node != NULL; - node = ares__slist_node_next(node)) { + for (node = ares_slist_node_first(channel->servers); node != NULL; + node = ares_slist_node_next(node)) { if (cnt == idx) { - return ares__slist_node_val(node); + return ares_slist_node_val(node); } cnt++; @@ -822,40 +945,32 @@ static ares_server_t *ares__random_server(ares_channel_t *channel) return NULL; } -/* Pick a server from the list with failover behavior. - * - * We default to using the first server in the sorted list of servers. That is - * the server with the lowest number of consecutive failures and then the - * highest priority server (by idx) if there is a draw. - * - * However, if a server temporarily goes down and hits some failures, then that - * server will never be retried until all other servers hit the same number of - * failures. This may prevent the server from being retried for a long time. - * - * To resolve this, with some probability we select a failed server to retry - * instead. - */ -static ares_server_t *ares__failover_server(ares_channel_t *channel) +static void server_probe_cb(void *arg, ares_status_t status, size_t timeouts, + const ares_dns_record_t *dnsrec) { - ares_server_t *first_server = ares__slist_first_val(channel->servers); - const ares_server_t *last_server = ares__slist_last_val(channel->servers); - unsigned short r; - - /* Defensive code against no servers being available on the channel. */ - if (first_server == NULL) { - return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */ - } - - /* If no servers have failures, then prefer the first server in the list. */ - if (last_server != NULL && last_server->consec_failures == 0) { - return first_server; - } + (void)arg; + (void)status; + (void)timeouts; + (void)dnsrec; + /* Nothing to do, the logic internally will handle success/fail of this */ +} - /* If we are not configured with a server retry chance then return the first - * server. - */ - if (channel->server_retry_chance == 0) { - return first_server; +/* Determine if we should probe a downed server */ +static void ares_probe_failed_server(ares_channel_t *channel, + const ares_server_t *server, + const ares_query_t *query) +{ + const ares_server_t *last_server = ares_slist_last_val(channel->servers); + unsigned short r; + ares_timeval_t now; + ares_slist_node_t *node; + ares_server_t *probe_server = NULL; + + /* If no servers have failures, or we're not configured with a server retry + * chance, then nothing to probe */ + if ((last_server != NULL && last_server->consec_failures == 0) || + channel->server_retry_chance == 0) { + return; } /* Generate a random value to decide whether to retry a failed server. The @@ -863,36 +978,49 @@ static ares_server_t *ares__failover_server(ares_channel_t *channel) * precision of 1/2^B where B is the number of bits in the random value. * We use an unsigned short for the random value for increased precision. */ - ares__rand_bytes(channel->rand_state, (unsigned char *)&r, sizeof(r)); - if (r % channel->server_retry_chance == 0) { - /* Select a suitable failed server to retry. */ - ares_timeval_t now; - ares__slist_node_t *node; - - ares__tvnow(&now); - for (node = ares__slist_node_first(channel->servers); node != NULL; - node = ares__slist_node_next(node)) { - ares_server_t *node_val = ares__slist_node_val(node); - if (node_val != NULL && node_val->consec_failures > 0 && - ares__timedout(&now, &node_val->next_retry_time)) { - return node_val; - } + ares_rand_bytes(channel->rand_state, (unsigned char *)&r, sizeof(r)); + if (r % channel->server_retry_chance != 0) { + return; + } + + /* Select the first server with failures to retry that has passed the retry + * timeout and doesn't already have a pending probe */ + ares_tvnow(&now); + for (node = ares_slist_node_first(channel->servers); node != NULL; + node = ares_slist_node_next(node)) { + ares_server_t *node_val = ares_slist_node_val(node); + if (node_val != NULL && node_val->consec_failures > 0 && + !node_val->probe_pending && + ares_timedout(&now, &node_val->next_retry_time)) { + probe_server = node_val; + break; } } - /* If we have not returned yet, then return the first server. */ - return first_server; + /* Either nothing to probe or the query was enqueud to the same server + * we were going to probe. Do nothing. */ + if (probe_server == NULL || server == probe_server) { + return; + } + + /* Enqueue an identical query onto the specified server without honoring + * the cache or allowing retries. We want to make sure it only attempts to + * use the server in question */ + probe_server->probe_pending = ARES_TRUE; + ares_send_nolock(channel, probe_server, + ARES_SEND_FLAG_NOCACHE | ARES_SEND_FLAG_NORETRY, + query->query, server_probe_cb, NULL, NULL); } -static size_t ares__calc_query_timeout(const ares_query_t *query, - const ares_server_t *server, - const ares_timeval_t *now) +static size_t ares_calc_query_timeout(const ares_query_t *query, + const ares_server_t *server, + const ares_timeval_t *now) { const ares_channel_t *channel = query->channel; size_t timeout = ares_metrics_server_timeout(server, now); size_t timeplus = timeout; size_t rounds; - size_t num_servers = ares__slist_len(channel->servers); + size_t num_servers = ares_slist_len(channel->servers); if (num_servers == 0) { return 0; /* LCOV_EXCL_LINE: DefensiveCoding */ @@ -922,7 +1050,7 @@ static size_t ares__calc_query_timeout(const ares_query_t *query, unsigned short r; float delta_multiplier; - ares__rand_bytes(channel->rand_state, (unsigned char *)&r, sizeof(r)); + ares_rand_bytes(channel->rand_state, (unsigned char *)&r, sizeof(r)); delta_multiplier = ((float)r / USHRT_MAX) * 0.5f; timeplus -= (size_t)((float)timeplus * delta_multiplier); } @@ -936,24 +1064,24 @@ static size_t ares__calc_query_timeout(const ares_query_t *query, return timeplus; } -static ares_conn_t *ares__fetch_connection(const ares_channel_t *channel, - ares_server_t *server, - const ares_query_t *query) +static ares_conn_t *ares_fetch_connection(const ares_channel_t *channel, + ares_server_t *server, + const ares_query_t *query) { - ares__llist_node_t *node; - ares_conn_t *conn; + ares_llist_node_t *node; + ares_conn_t *conn; if (query->using_tcp) { return server->tcp_conn; } /* Fetch existing UDP connection */ - node = ares__llist_node_first(server->connections); + node = ares_llist_node_first(server->connections); if (node == NULL) { return NULL; } - conn = ares__llist_node_val(node); + conn = ares_llist_node_val(node); /* Not UDP, skip */ if (conn->flags & ARES_CONN_FLAG_TCP) { return NULL; @@ -968,13 +1096,10 @@ static ares_conn_t *ares__fetch_connection(const ares_channel_t *channel, return conn; } -static ares_status_t ares__conn_query_write(ares_conn_t *conn, - ares_query_t *query, - const ares_timeval_t *now) +static ares_status_t ares_conn_query_write(ares_conn_t *conn, + ares_query_t *query, + const ares_timeval_t *now) { - unsigned char *qbuf = NULL; - size_t qbuf_len = 0; - ares_ssize_t len; ares_server_t *server = conn->server; ares_channel_t *channel = server->channel; ares_status_t status; @@ -984,81 +1109,57 @@ static ares_status_t ares__conn_query_write(ares_conn_t *conn, return status; } - if (conn->flags & ARES_CONN_FLAG_TCP) { - size_t prior_len = ares__buf_len(server->tcp_send); - - status = ares_dns_write_buf_tcp(query->query, server->tcp_send); - if (status != ARES_SUCCESS) { - return status; - } - - if (conn->flags & ARES_CONN_FLAG_TFO_INITIAL) { - /* When using TFO, we need to put it on the wire immediately. */ - size_t data_len; - const unsigned char *data = NULL; - - data = ares__buf_peek(server->tcp_send, &data_len); - len = ares__conn_write(conn, data, data_len); - if (len <= 0) { - if (ares__socket_try_again(SOCKERRNO)) { - /* This means we must not have qualified for TFO, keep the data - * buffered, wait on write signal. */ - return ARES_SUCCESS; - } - - /* TCP TFO might delay failure. Reflect that here */ - return ARES_ECONNREFUSED; - } - - /* Consume what was written */ - ares__buf_consume(server->tcp_send, (size_t)len); - return ARES_SUCCESS; - } - - if (prior_len == 0) { - SOCK_STATE_CALLBACK(channel, conn->fd, 1, 1); - } - - return ARES_SUCCESS; - } - - /* UDP Here */ - status = ares_dns_write(query->query, &qbuf, &qbuf_len); + /* We write using the TCP format even for UDP, we just strip the length + * before putting on the wire */ + status = ares_dns_write_buf_tcp(query->query, conn->out_buf); if (status != ARES_SUCCESS) { return status; } - len = ares__conn_write(conn, qbuf, qbuf_len); - ares_free(qbuf); + /* Not pending a TFO write and not connected, so we can't even try to + * write until we get a signal */ + if (conn->flags & ARES_CONN_FLAG_TCP && + !(conn->state_flags & ARES_CONN_STATE_CONNECTED) && + !(conn->flags & ARES_CONN_FLAG_TFO_INITIAL)) { + return ARES_SUCCESS; + } - if (len == -1) { - if (ares__socket_try_again(SOCKERRNO)) { - return ARES_ESERVFAIL; - } - /* UDP is connection-less, but we might receive an ICMP unreachable which - * means we can't talk to the remote host at all and that will be - * reflected here */ - return ARES_ECONNREFUSED; + /* Delay actual write if possible (TCP only, and only if callback + * configured) */ + if (channel->notify_pending_write_cb && !channel->notify_pending_write && + conn->flags & ARES_CONN_FLAG_TCP) { + channel->notify_pending_write = ARES_TRUE; + channel->notify_pending_write_cb(channel->notify_pending_write_cb_data); + return ARES_SUCCESS; } - return ARES_SUCCESS; + /* Unfortunately we need to write right away and can't aggregate multiple + * queries into a single write. */ + return ares_conn_flush(conn); } -ares_status_t ares__send_query(ares_query_t *query, const ares_timeval_t *now) +ares_status_t ares_send_query(ares_server_t *requested_server, + ares_query_t *query, const ares_timeval_t *now) { ares_channel_t *channel = query->channel; ares_server_t *server; ares_conn_t *conn; size_t timeplus; ares_status_t status; + ares_bool_t probe_downed_server = ARES_TRUE; + /* Choose the server to send the query to */ - if (channel->rotate) { - /* Pull random server */ - server = ares__random_server(channel); + if (requested_server != NULL) { + server = requested_server; } else { - /* Pull server with failover behavior */ - server = ares__failover_server(channel); + /* If rotate is turned on, do a random selection */ + if (channel->rotate) { + server = ares_random_server(channel); + } else { + /* First server in list */ + server = ares_slist_first_val(channel->servers); + } } if (server == NULL) { @@ -1066,9 +1167,16 @@ ares_status_t ares__send_query(ares_query_t *query, const ares_timeval_t *now) return ARES_ENOSERVER; } - conn = ares__fetch_connection(channel, server, query); + /* If a query is directed to a specific query, or the server chosen has + * failures, or the query is being retried, don't probe for downed servers */ + if (requested_server != NULL || server->consec_failures > 0 || + query->try_count != 0) { + probe_downed_server = ARES_FALSE; + } + + conn = ares_fetch_connection(channel, server, query); if (conn == NULL) { - status = ares__open_connection(&conn, channel, server, query->using_tcp); + status = ares_open_connection(&conn, channel, server, query->using_tcp); switch (status) { /* Good result, continue on */ case ARES_SUCCESS: @@ -1079,7 +1187,7 @@ ares_status_t ares__send_query(ares_query_t *query, const ares_timeval_t *now) case ARES_ECONNREFUSED: case ARES_EBADFAMILY: server_increment_failures(server, query->using_tcp); - return ares__requeue_query(query, now, status, ARES_TRUE, NULL); + return ares_requeue_query(query, now, status, ARES_TRUE, NULL); /* Anything else is not retryable, likely ENOMEM */ default: @@ -1089,7 +1197,7 @@ ares_status_t ares__send_query(ares_query_t *query, const ares_timeval_t *now) } /* Write the query */ - status = ares__conn_query_write(conn, query, now); + status = ares_conn_query_write(conn, query, now); switch (status) { /* Good result, continue on */ case ARES_SUCCESS: @@ -1105,30 +1213,28 @@ ares_status_t ares__send_query(ares_query_t *query, const ares_timeval_t *now) case ARES_ECONNREFUSED: case ARES_EBADFAMILY: handle_conn_error(conn, ARES_TRUE, status); - status = ares__requeue_query(query, now, status, ARES_TRUE, NULL); + status = ares_requeue_query(query, now, status, ARES_TRUE, NULL); if (status == ARES_ETIMEOUT) { status = ARES_ECONNREFUSED; } return status; - /* FIXME: Handle EAGAIN here since it likely can happen. Right now we - * just requeue to a different server/connection. */ default: server_increment_failures(server, query->using_tcp); - status = ares__requeue_query(query, now, status, ARES_TRUE, NULL); + status = ares_requeue_query(query, now, status, ARES_TRUE, NULL); return status; } - timeplus = ares__calc_query_timeout(query, server, now); + timeplus = ares_calc_query_timeout(query, server, now); /* Keep track of queries bucketed by timeout, so we can process * timeout events quickly. */ - ares__slist_node_destroy(query->node_queries_by_timeout); + ares_slist_node_destroy(query->node_queries_by_timeout); query->ts = *now; query->timeout = *now; timeadd(&query->timeout, timeplus); query->node_queries_by_timeout = - ares__slist_insert(channel->queries_by_timeout, query); + ares_slist_insert(channel->queries_by_timeout, query); if (!query->node_queries_by_timeout) { /* LCOV_EXCL_START: OutOfMemory */ end_query(channel, server, query, ARES_ENOMEM, NULL); @@ -1138,9 +1244,9 @@ ares_status_t ares__send_query(ares_query_t *query, const ares_timeval_t *now) /* Keep track of queries bucketed by connection, so we can process errors * quickly. */ - ares__llist_node_destroy(query->node_queries_to_conn); + ares_llist_node_destroy(query->node_queries_to_conn); query->node_queries_to_conn = - ares__llist_insert_last(conn->queries_to_conn, query); + ares_llist_insert_last(conn->queries_to_conn, query); if (query->node_queries_to_conn == NULL) { /* LCOV_EXCL_START: OutOfMemory */ @@ -1151,6 +1257,13 @@ ares_status_t ares__send_query(ares_query_t *query, const ares_timeval_t *now) query->conn = conn; conn->total_queries++; + + /* We just successfully enqueud a query, see if we should probe downed + * servers. */ + if (probe_downed_server) { + ares_probe_failed_server(channel, server, query); + } + return ARES_SUCCESS; } @@ -1197,12 +1310,12 @@ static ares_bool_t same_questions(const ares_query_t *query, * server to preserve the case of the name in the response packet. * https://datatracker.ietf.org/doc/html/draft-vixie-dnsext-dns0x20-00 */ - if (strcmp(qname, aname) != 0) { + if (!ares_streq(qname, aname)) { goto done; } } else { /* without DNS0x20 use case-insensitive matching */ - if (strcasecmp(qname, aname) != 0) { + if (!ares_strcaseeq(qname, aname)) { goto done; } } @@ -1214,42 +1327,12 @@ static ares_bool_t same_questions(const ares_query_t *query, return rv; } -static ares_bool_t same_address(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 */ -} - static void ares_detach_query(ares_query_t *query) { /* Remove the query from all the lists in which it is linked */ - ares__query_disassociate_from_conn(query); - ares__htable_szvp_remove(query->channel->queries_by_qid, query->qid); - ares__llist_node_destroy(query->node_all_queries); + ares_query_remove_from_conn(query); + ares_htable_szvp_remove(query->channel->queries_by_qid, query->qid); + ares_llist_node_destroy(query->node_all_queries); query->node_all_queries = NULL; } @@ -1257,11 +1340,17 @@ static void end_query(ares_channel_t *channel, ares_server_t *server, ares_query_t *query, ares_status_t status, const ares_dns_record_t *dnsrec) { + /* If we were probing for the server to come back online, lets mark it as + * no longer being probed */ + if (server != NULL) { + server->probe_pending = ARES_FALSE; + } + ares_metrics_record(query, server, status, dnsrec); /* Invoke the callback. */ query->callback(query->arg, status, query->timeouts, dnsrec); - ares__free_query(query); + ares_free_query(query); /* Check and notify if no other queries are enqueued on the channel. This * must come after the callback and freeing the query for 2 reasons. @@ -1271,7 +1360,7 @@ static void end_query(ares_channel_t *channel, ares_server_t *server, ares_queue_notify_empty(channel); } -void ares__free_query(ares_query_t *query) +void ares_free_query(ares_query_t *query) { ares_detach_query(query); /* Zero out some important stuff, to help catch bugs */ diff --git a/lib/c-ares-1.33.1/src/lib/ares_qcache.c b/lib/c-ares-1.34.4/src/lib/ares_qcache.c similarity index 70% rename from lib/c-ares-1.33.1/src/lib/ares_qcache.c rename to lib/c-ares-1.34.4/src/lib/ares_qcache.c index 9725212fded..97c0a9137da 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_qcache.c +++ b/lib/c-ares-1.34.4/src/lib/ares_qcache.c @@ -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 @@ ares_status_t ares__qcache_create(ares_rand_state *rand_state, 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); } diff --git a/lib/c-ares-1.33.1/src/lib/ares_query.c b/lib/c-ares-1.34.4/src/lib/ares_query.c similarity index 94% rename from lib/c-ares-1.33.1/src/lib/ares_query.c rename to lib/c-ares-1.34.4/src/lib/ares_query.c index 4d0861a5f52..ca3b6a9b732 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_query.c +++ b/lib/c-ares-1.34.4/src/lib/ares_query.c @@ -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); } diff --git a/lib/c-ares-1.33.1/src/lib/ares_search.c b/lib/c-ares-1.34.4/src/lib/ares_search.c similarity index 81% rename from lib/c-ares-1.33.1/src/lib/ares_search.c rename to lib/c-ares-1.34.4/src/lib/ares_search.c index 2d3c0fc5145..c605caf42cb 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_search.c +++ b/lib/c-ares-1.34.4/src/lib/ares_search.c @@ -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 @@ ares_status_t ares__search_name_list(const ares_channel_t *channel, *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 @@ static ares_status_t ares_search_int(ares_channel_t *channel, 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; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_send.c b/lib/c-ares-1.34.4/src/lib/ares_send.c similarity index 79% rename from lib/c-ares-1.33.1/src/lib/ares_send.c rename to lib/c-ares-1.34.4/src/lib/ares_send.c index 64ff7edd3ac..6efa9580b22 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_send.c +++ b/lib/c-ares-1.34.4/src/lib/ares_send.c @@ -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 @@ static ares_status_t ares_apply_dns0x20(ares_channel_t *channel, 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. */ @@ -150,6 +153,11 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, /* Duplicate Query */ status = ares_dns_record_duplicate_ex(&query->query, dnsrec); if (status != ARES_SUCCESS) { + /* Sometimes we might get a EBADRESP response from duplicate due to + * the way it works (write and parse), rewrite it to EBADQUERY. */ + if (status == ARES_EBADRESP) { + status = ARES_EBADQUERY; + } ares_free(query); callback(arg, status, 0, NULL); return status; @@ -162,7 +170,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 +183,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 +195,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 +207,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 +235,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 +267,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 +277,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 +290,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; } diff --git a/lib/c-ares-1.34.4/src/lib/ares_set_socket_functions.c b/lib/c-ares-1.34.4/src/lib/ares_set_socket_functions.c new file mode 100644 index 00000000000..7216ffa933f --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/ares_set_socket_functions.c @@ -0,0 +1,588 @@ +/* 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 +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETINET_TCP_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef NETWARE +# include +#endif + +#include +#include +#include + + +#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: + /* Count the number of characters before NULL terminator then + * validate those are all printable */ + if (!ares_str_isprint(val, ares_strnlen(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); +} diff --git a/lib/c-ares-1.33.1/src/lib/ares_setup.h b/lib/c-ares-1.34.4/src/lib/ares_setup.h similarity index 52% rename from lib/c-ares-1.33.1/src/lib/ares_setup.h rename to lib/c-ares-1.34.4/src/lib/ares_setup.h index b6ce077ff64..8890c3c338b 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_setup.h +++ b/lib/c-ares-1.34.4/src/lib/ares_setup.h @@ -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 */ diff --git a/lib/c-ares-1.34.4/src/lib/ares_socket.c b/lib/c-ares-1.34.4/src/lib/ares_socket.c new file mode 100644 index 00000000000..516852a84ab --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/ares_socket.c @@ -0,0 +1,425 @@ +/* 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 +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETINET_TCP_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef NETWARE +# include +#endif + +#include +#include +#include + +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, + (ares_socklen_t)ares_strlen(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; +} diff --git a/lib/c-ares-1.34.4/src/lib/ares_socket.h b/lib/c-ares-1.34.4/src/lib/ares_socket.h new file mode 100644 index 00000000000..24a99ab3316 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/ares_socket.h @@ -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 diff --git a/lib/c-ares-1.33.1/src/lib/ares__sortaddrinfo.c b/lib/c-ares-1.34.4/src/lib/ares_sortaddrinfo.c similarity index 94% rename from lib/c-ares-1.33.1/src/lib/ares__sortaddrinfo.c rename to lib/c-ares-1.34.4/src/lib/ares_sortaddrinfo.c index 1aab81ecf84..e6c21ea0ad7 100644 --- a/lib/c-ares-1.33.1/src/lib/ares__sortaddrinfo.c +++ b/lib/c-ares-1.34.4/src/lib/ares_sortaddrinfo.c @@ -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; diff --git a/lib/c-ares-1.33.1/src/lib/ares_strerror.c b/lib/c-ares-1.34.4/src/lib/ares_strerror.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_strerror.c rename to lib/c-ares-1.34.4/src/lib/ares_strerror.c diff --git a/lib/c-ares-1.33.1/src/lib/ares_sysconfig.c b/lib/c-ares-1.34.4/src/lib/ares_sysconfig.c similarity index 65% rename from lib/c-ares-1.33.1/src/lib/ares_sysconfig.c rename to lib/c-ares-1.34.4/src/lib/ares_sysconfig.c index 61e6a423a75..286db60328f 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_sysconfig.c +++ b/lib/c-ares-1.34.4/src/lib/ares_sysconfig.c @@ -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; } @@ -256,8 +260,98 @@ static ares_status_t ares__init_sysconfig_android(ares_sysconfig_t *sysconfig) } #endif +#if defined(__QNX__) +static ares_status_t + ares_init_sysconfig_qnx(const ares_channel_t *channel, + ares_sysconfig_t *sysconfig) +{ + /* QNX: + * 1. use confstr(_CS_RESOLVE, ...) as primary resolv.conf data, replacing + * "_" with " ". If that is empty, then do normal /etc/resolv.conf + * processing. + * 2. We want to process /etc/nsswitch.conf as normal. + * 3. if confstr(_CS_DOMAIN, ...) this is the domain name. Use this as + * preference over anything else found. + */ + ares_buf_t *buf = ares_buf_create(); + unsigned char *data = NULL; + size_t data_size = 0; + ares_bool_t process_resolvconf = ARES_TRUE; + ares_status_t status = ARES_SUCCESS; + + /* Prefer confstr(_CS_RESOLVE, ...) */ + buf = ares_buf_create(); + if (buf == NULL) { + status = ARES_ENOMEM; + goto done; + } + + data_size = 1024; + data = ares_buf_append_start(buf, &data_size); + if (data == NULL) { + status = ARES_ENOMEM; + goto done; + } + + data_size = confstr(_CS_RESOLVE, (char *)data, data_size); + if (data_size > 1) { + /* confstr returns byte for NULL terminator, strip */ + data_size--; + + ares_buf_append_finish(buf, data_size); + /* Its odd, this uses _ instead of " " between keywords, otherwise the + * format is the same as resolv.conf, replace. */ + ares_buf_replace(buf, (const unsigned char *)"_", 1, + (const unsigned char *)" ", 1); + + status = ares_sysconfig_process_buf(channel, sysconfig, buf, + ares_sysconfig_parse_resolv_line); + if (status != ARES_SUCCESS) { + /* ENOMEM is really the only error we'll get here */ + goto done; + } + + /* don't read resolv.conf if we processed *any* nameservers */ + if (ares_llist_len(sysconfig->sconfig) != 0) { + process_resolvconf = ARES_FALSE; + } + } + + /* Process files */ + status = ares_init_sysconfig_files(channel, sysconfig, process_resolvconf); + if (status != ARES_SUCCESS) { + goto done; + } + + /* Read confstr(_CS_DOMAIN, ...), but if we had a search path specified with + * more than one domain, lets prefer that instead. Its not exactly clear + * the best way to handle this. */ + if (sysconfig->ndomains <= 1) { + char domain[256]; + size_t domain_len; + + domain_len = confstr(_CS_DOMAIN, domain, sizeof(domain_len)); + if (domain_len != 0) { + ares_strsplit_free(sysconfig->domains, sysconfig->ndomains); + sysconfig->domains = ares_strsplit(domain, ", ", &sysconfig->ndomains); + if (sysconfig->domains == NULL) { + status = ARES_ENOMEM; + goto done; + } + } + } + +done: + ares_buf_destroy(buf); + + return status; +} +#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 +359,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 +389,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 +494,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 +502,8 @@ static ares_status_t ares__init_sysconfig_libresolv(ares_sysconfig_t *sysconfig) 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 +515,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 +525,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 +582,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 +591,23 @@ 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); +#elif defined(__QNX__) + status = ares_init_sysconfig_qnx(channel, &sysconfig); #else - status = ares__init_sysconfig_files(channel, &sysconfig); + status = ares_init_sysconfig_files(channel, &sysconfig, ARES_TRUE); #endif if (status != ARES_SUCCESS) { @@ -519,7 +615,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 +623,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; diff --git a/lib/c-ares-1.33.1/src/lib/ares_sysconfig_files.c b/lib/c-ares-1.34.4/src/lib/ares_sysconfig_files.c similarity index 60% rename from lib/c-ares-1.33.1/src/lib/ares_sysconfig_files.c rename to lib/c-ares-1.34.4/src/lib/ares_sysconfig_files.c index 7b8bdbe4187..a6c2a8e62bb 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_sysconfig_files.c +++ b/lib/c-ares-1.34.4/src/lib/ares_sysconfig_files.c @@ -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); - - status = ares__buf_split(buf, (const unsigned char *)separators, - separators_len, ARES_BUF_SPLIT_TRIM, 0, &lookups); + 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_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 (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; - } + for (i = 0; i < num; i++) { + const char *value = lookups[i]; + char ch; - 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 @@ static ares_status_t config_lookup(ares_sysconfig_t *sysconfig, 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) +ares_status_t ares_sysconfig_parse_resolv_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,88 @@ static ares_status_t parse_nsswitch_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_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); + +ares_status_t ares_sysconfig_process_buf(const ares_channel_t *channel, + ares_sysconfig_t *sysconfig, + ares_buf_t *buf, + ares_sysconfig_line_cb_t cb) +{ + ares_array_t *lines = NULL; + size_t num; + size_t i; + ares_status_t status; + + status = ares_buf_split(buf, (const unsigned char *)"\n", 1, + ARES_BUF_SPLIT_TRIM, 0, &lines); + if (status != ARES_SUCCESS) { + goto done; + } + + 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(channel, sysconfig, line); + if (status != ARES_SUCCESS) { + goto done; + } + } + +done: + ares_array_destroy(lines); + return status; +} /* Should only return: * ARES_ENOTFOUND - file not found @@ -724,79 +766,68 @@ 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, + ares_sysconfig_line_cb_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_buf_t *buf = 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; } - 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); - - status = cb(sysconfig, line); - if (status != ARES_SUCCESS) { - goto done; - } - } + status = ares_sysconfig_process_buf(channel, sysconfig, buf, cb); done: - ares__buf_destroy(buf); - ares__llist_destroy(lines); + ares_buf_destroy(buf); 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_bool_t process_resolvconf) { ares_status_t status = ARES_SUCCESS; /* Resolv.conf */ - status = process_config_lines((channel->resolvconf_path != NULL) - ? channel->resolvconf_path - : PATH_RESOLV_CONF, - sysconfig, parse_resolvconf_line); - if (status != ARES_SUCCESS && status != ARES_ENOTFOUND) { - goto done; + if (process_resolvconf) { + status = process_config_lines(channel, + (channel->resolvconf_path != NULL) + ? channel->resolvconf_path + : PATH_RESOLV_CONF, + sysconfig, ares_sysconfig_parse_resolv_line); + if (status != ARES_SUCCESS && status != ARES_ENOTFOUND) { + goto done; + } } /* 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; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_sysconfig_mac.c b/lib/c-ares-1.34.4/src/lib/ares_sysconfig_mac.c similarity index 90% rename from lib/c-ares-1.33.1/src/lib/ares_sysconfig_mac.c rename to lib/c-ares-1.34.4/src/lib/ares_sysconfig_mac.c index 38ac451ca5f..4d46ffd58df 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_sysconfig_mac.c +++ b/lib/c-ares-1.34.4/src/lib/ares_sysconfig_mac.c @@ -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) { diff --git a/lib/c-ares-1.33.1/src/lib/ares_sysconfig_win.c b/lib/c-ares-1.34.4/src/lib/ares_sysconfig_win.c similarity index 97% rename from lib/c-ares-1.33.1/src/lib/ares_sysconfig_win.c rename to lib/c-ares-1.34.4/src/lib/ares_sysconfig_win.c index ce2a261cec8..f6e07f92e47 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_sysconfig_win.c +++ b/lib/c-ares-1.34.4/src/lib/ares_sysconfig_win.c @@ -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; diff --git a/lib/c-ares-1.33.1/src/lib/ares_timeout.c b/lib/c-ares-1.34.4/src/lib/ares_timeout.c similarity index 86% rename from lib/c-ares-1.33.1/src/lib/ares_timeout.c rename to lib/c-ares-1.34.4/src/lib/ares_timeout.c index 5ed8b553a3c..0d2fdcff21f 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_timeout.c +++ b/lib/c-ares-1.34.4/src/lib/ares_timeout.c @@ -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; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_update_servers.c b/lib/c-ares-1.34.4/src/lib/ares_update_servers.c similarity index 60% rename from lib/c-ares-1.33.1/src/lib/ares_update_servers.c rename to lib/c-ares-1.34.4/src/lib/ares_update_servers.c index 639f79d8159..70a9381499f 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_update_servers.c +++ b/lib/c-ares-1.34.4/src/lib/ares_update_servers.c @@ -39,6 +39,9 @@ #ifdef HAVE_NET_IF_H # include #endif +#ifdef HAVE_STDINT_H +# include +#endif #if defined(USE_WINSOCK) # if defined(HAVE_IPHLPAPI_H) @@ -61,8 +64,8 @@ typedef struct { unsigned int ll_scope; } ares_sconfig_t; -static ares_bool_t ares__addr_match(const struct ares_addr *addr1, - const struct ares_addr *addr2) +static ares_bool_t ares_addr_match(const struct ares_addr *addr1, + const struct ares_addr *addr2) { if (addr1 == NULL && addr2 == NULL) { return ARES_TRUE; /* LCOV_EXCL_LINE: DefensiveCoding */ @@ -90,9 +93,9 @@ static ares_bool_t ares__addr_match(const struct ares_addr *addr1, return ARES_FALSE; } -ares_bool_t ares__subnet_match(const struct ares_addr *addr, - const struct ares_addr *subnet, - unsigned char netmask) +ares_bool_t ares_subnet_match(const struct ares_addr *addr, + const struct ares_addr *subnet, + unsigned char netmask) { const unsigned char *addr_ptr; const unsigned char *subnet_ptr; @@ -144,7 +147,7 @@ ares_bool_t ares__subnet_match(const struct ares_addr *addr, return ARES_TRUE; } -ares_bool_t ares__addr_is_linklocal(const struct ares_addr *addr) +ares_bool_t ares_addr_is_linklocal(const struct ares_addr *addr) { struct ares_addr subnet; const unsigned char subnetaddr[16] = { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, @@ -155,7 +158,7 @@ ares_bool_t ares__addr_is_linklocal(const struct ares_addr *addr) subnet.family = AF_INET6; memcpy(&subnet.addr.addr6, subnetaddr, 16); - return ares__subnet_match(addr, &subnet, 10); + return ares_subnet_match(addr, &subnet, 10); } static ares_bool_t ares_server_blacklisted(const struct ares_addr *addr) @@ -185,13 +188,60 @@ static ares_bool_t ares_server_blacklisted(const struct ares_addr *addr) struct ares_addr subnet; subnet.family = AF_INET6; memcpy(&subnet.addr.addr6, blacklist_v6[i].netbase, 16); - if (ares__subnet_match(addr, &subnet, blacklist_v6[i].netmask)) { + if (ares_subnet_match(addr, &subnet, blacklist_v6[i].netmask)) { return ARES_TRUE; } } return ARES_FALSE; } +static ares_status_t parse_nameserver_uri(ares_buf_t *buf, + ares_sconfig_t *sconfig) +{ + ares_uri_t *uri = NULL; + ares_status_t status = ARES_SUCCESS; + const char *port; + char *ll_scope; + char hoststr[256]; + size_t addrlen; + + status = ares_uri_parse_buf(&uri, buf); + if (status != ARES_SUCCESS) { + return status; + } + + if (!ares_streq("dns", ares_uri_get_scheme(uri))) { + status = ARES_EBADSTR; + goto done; + } + + ares_strcpy(hoststr, ares_uri_get_host(uri), sizeof(hoststr)); + ll_scope = strchr(hoststr, '%'); + if (ll_scope != NULL) { + *ll_scope = 0; + ll_scope++; + ares_strcpy(sconfig->ll_iface, ll_scope, sizeof(sconfig->ll_iface)); + } + + /* Convert ip address from string to network byte order */ + sconfig->addr.family = AF_UNSPEC; + if (ares_dns_pton(hoststr, &sconfig->addr, &addrlen) == NULL) { + status = ARES_EBADSTR; + goto done; + } + + sconfig->udp_port = ares_uri_get_port(uri); + sconfig->tcp_port = sconfig->udp_port; + port = ares_uri_get_query_key(uri, "tcpport"); + if (port != NULL) { + sconfig->tcp_port = (unsigned short)atoi(port); + } + +done: + ares_uri_destroy(uri); + return status; +} + /* Parse address and port in these formats, either ipv4 or ipv6 addresses * are allowed: * ipaddr @@ -211,7 +261,7 @@ static ares_bool_t ares_server_blacklisted(const struct ares_addr *addr) * Returns an error code on failure, else ARES_SUCCESS */ -static ares_status_t parse_nameserver(ares__buf_t *buf, ares_sconfig_t *sconfig) +static ares_status_t parse_nameserver(ares_buf_t *buf, ares_sconfig_t *sconfig) { ares_status_t status; char ipaddr[INET6_ADDRSTRLEN] = ""; @@ -220,57 +270,57 @@ static ares_status_t parse_nameserver(ares__buf_t *buf, ares_sconfig_t *sconfig) memset(sconfig, 0, sizeof(*sconfig)); /* Consume any leading whitespace */ - ares__buf_consume_whitespace(buf, ARES_TRUE); + ares_buf_consume_whitespace(buf, ARES_TRUE); /* pop off IP address. If it is in [ ] then it can be ipv4 or ipv6. If * not, ipv4 only */ - if (ares__buf_begins_with(buf, (const unsigned char *)"[", 1)) { + if (ares_buf_begins_with(buf, (const unsigned char *)"[", 1)) { /* Consume [ */ - ares__buf_consume(buf, 1); + ares_buf_consume(buf, 1); - ares__buf_tag(buf); + ares_buf_tag(buf); /* Consume until ] */ - if (ares__buf_consume_until_charset(buf, (const unsigned char *)"]", 1, - ARES_TRUE) == 0) { + if (ares_buf_consume_until_charset(buf, (const unsigned char *)"]", 1, + ARES_TRUE) == SIZE_MAX) { return ARES_EBADSTR; } - 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; } /* Skip over ] */ - ares__buf_consume(buf, 1); + ares_buf_consume(buf, 1); } else { size_t offset; /* Not in [ ], see if '.' is in first 4 characters, if it is, then its ipv4, * otherwise treat as ipv6 */ - ares__buf_tag(buf); + ares_buf_tag(buf); - offset = ares__buf_consume_until_charset(buf, (const unsigned char *)".", 1, - ARES_TRUE); - ares__buf_tag_rollback(buf); - ares__buf_tag(buf); + offset = ares_buf_consume_until_charset(buf, (const unsigned char *)".", 1, + ARES_TRUE); + ares_buf_tag_rollback(buf); + ares_buf_tag(buf); if (offset > 0 && offset < 4) { /* IPv4 */ - if (ares__buf_consume_charset(buf, (const unsigned char *)"0123456789.", - 11) == 0) { + if (ares_buf_consume_charset(buf, (const unsigned char *)"0123456789.", + 11) == 0) { return ARES_EBADSTR; } } else { /* IPv6 */ const unsigned char ipv6_charset[] = "ABCDEFabcdef0123456789.:"; - if (ares__buf_consume_charset(buf, ipv6_charset, - sizeof(ipv6_charset) - 1) == 0) { + if (ares_buf_consume_charset(buf, ipv6_charset, + sizeof(ipv6_charset) - 1) == 0) { return ARES_EBADSTR; } } - 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; } @@ -283,21 +333,21 @@ static ares_status_t parse_nameserver(ares__buf_t *buf, ares_sconfig_t *sconfig) } /* Pull off port */ - if (ares__buf_begins_with(buf, (const unsigned char *)":", 1)) { + if (ares_buf_begins_with(buf, (const unsigned char *)":", 1)) { char portstr[6]; /* Consume : */ - ares__buf_consume(buf, 1); + ares_buf_consume(buf, 1); - ares__buf_tag(buf); + ares_buf_tag(buf); /* Read numbers */ - if (ares__buf_consume_charset(buf, (const unsigned char *)"0123456789", - 10) == 0) { + if (ares_buf_consume_charset(buf, (const unsigned char *)"0123456789", + 10) == 0) { return ARES_EBADSTR; } - status = ares__buf_tag_fetch_string(buf, portstr, sizeof(portstr)); + status = ares_buf_tag_fetch_string(buf, portstr, sizeof(portstr)); if (status != ARES_SUCCESS) { return status; } @@ -307,22 +357,22 @@ static ares_status_t parse_nameserver(ares__buf_t *buf, ares_sconfig_t *sconfig) } /* Pull off interface modifier */ - if (ares__buf_begins_with(buf, (const unsigned char *)"%", 1)) { + if (ares_buf_begins_with(buf, (const unsigned char *)"%", 1)) { const unsigned char iface_charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789.-_\\:{}"; /* Consume % */ - ares__buf_consume(buf, 1); + ares_buf_consume(buf, 1); - ares__buf_tag(buf); + ares_buf_tag(buf); - if (ares__buf_consume_charset(buf, iface_charset, - sizeof(iface_charset) - 1) == 0) { + if (ares_buf_consume_charset(buf, iface_charset, + sizeof(iface_charset) - 1) == 0) { return ARES_EBADSTR; } - status = ares__buf_tag_fetch_string(buf, sconfig->ll_iface, - sizeof(sconfig->ll_iface)); + status = ares_buf_tag_fetch_string(buf, sconfig->ll_iface, + sizeof(sconfig->ll_iface)); if (status != ARES_SUCCESS) { return status; } @@ -330,24 +380,29 @@ static ares_status_t parse_nameserver(ares__buf_t *buf, ares_sconfig_t *sconfig) /* Consume any trailing whitespace so we can bail out if there is something * after we didn't read */ - ares__buf_consume_whitespace(buf, ARES_TRUE); + ares_buf_consume_whitespace(buf, ARES_TRUE); - if (ares__buf_len(buf) != 0) { + if (ares_buf_len(buf) != 0) { return ARES_EBADSTR; } return ARES_SUCCESS; } -static ares_status_t ares__sconfig_linklocal(ares_sconfig_t *s, - const char *ll_iface) +static ares_status_t ares_sconfig_linklocal(const ares_channel_t *channel, + ares_sconfig_t *s, + const char *ll_iface) { unsigned int ll_scope = 0; + if (ares_str_isnum(ll_iface)) { char ifname[IF_NAMESIZE] = ""; ll_scope = (unsigned int)atoi(ll_iface); - if (ares__if_indextoname(ll_scope, ifname, sizeof(ifname)) == NULL) { + if (channel->sock_funcs.aif_indextoname == NULL || + channel->sock_funcs.aif_indextoname(ll_scope, ifname, sizeof(ifname), + channel->sock_func_cb_data) == + NULL) { DEBUGF(fprintf(stderr, "Interface %s for ipv6 Link Local not found\n", ll_iface)); return ARES_ENOTFOUND; @@ -357,7 +412,10 @@ static ares_status_t ares__sconfig_linklocal(ares_sconfig_t *s, return ARES_SUCCESS; } - ll_scope = ares__if_nametoindex(ll_iface); + if (channel->sock_funcs.aif_nametoindex != NULL) { + ll_scope = + channel->sock_funcs.aif_nametoindex(ll_iface, channel->sock_func_cb_data); + } if (ll_scope == 0) { DEBUGF(fprintf(stderr, "Interface %s for ipv6 Link Local not found\n", ll_iface)); @@ -368,11 +426,11 @@ static ares_status_t ares__sconfig_linklocal(ares_sconfig_t *s, return ARES_SUCCESS; } -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(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_sconfig_t *s; ares_status_t status; @@ -392,7 +450,7 @@ ares_status_t ares__sconfig_append(ares__llist_t **sconfig, } if (*sconfig == NULL) { - *sconfig = ares__llist_create(ares_free); + *sconfig = ares_llist_create(ares_free); if (*sconfig == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ @@ -405,13 +463,13 @@ ares_status_t ares__sconfig_append(ares__llist_t **sconfig, /* Handle link-local enumeration. If an interface is specified on a * non-link-local address, we'll simply end up ignoring that */ - if (ares__addr_is_linklocal(&s->addr)) { + if (ares_addr_is_linklocal(&s->addr)) { if (ares_strlen(ll_iface) == 0) { /* Silently ignore this entry, we require an interface */ status = ARES_SUCCESS; goto fail; } - status = ares__sconfig_linklocal(s, ll_iface); + status = ares_sconfig_linklocal(channel, s, ll_iface); /* Silently ignore this entry, we can't validate the interface */ if (status != ARES_SUCCESS) { status = ARES_SUCCESS; @@ -419,7 +477,7 @@ ares_status_t ares__sconfig_append(ares__llist_t **sconfig, } } - if (ares__llist_insert_last(*sconfig, s) == NULL) { + if (ares_llist_insert_last(*sconfig, s) == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -448,36 +506,43 @@ ares_status_t ares__sconfig_append(ares__llist_t **sconfig, * * Returns an error code on failure, else ARES_SUCCESS. */ -ares_status_t ares__sconfig_append_fromstr(ares__llist_t **sconfig, - const char *str, - ares_bool_t ignore_invalid) +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 status = ARES_SUCCESS; - ares__buf_t *buf = NULL; - ares__llist_t *list = NULL; - ares__llist_node_t *node; + ares_status_t status = ARES_SUCCESS; + ares_buf_t *buf = NULL; + ares_array_t *list = NULL; + size_t num; + size_t i; /* On Windows, there may be more than one nameserver specified in the same * registry key, so we parse input as a space or comma separated list. */ - 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; } - 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, &list); 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(list); + for (i = 0; i < num; i++) { + ares_buf_t **bufptr = ares_array_at(list, i); + ares_buf_t *entry = *bufptr; ares_sconfig_t s; - status = parse_nameserver(entry, &s); + status = parse_nameserver_uri(entry, &s); + if (status != ARES_SUCCESS) { + status = parse_nameserver(entry, &s); + } + if (status != ARES_SUCCESS) { if (ignore_invalid) { continue; @@ -486,8 +551,8 @@ ares_status_t ares__sconfig_append_fromstr(ares__llist_t **sconfig, } } - status = ares__sconfig_append(sconfig, &s.addr, s.udp_port, s.tcp_port, - s.ll_iface); + status = ares_sconfig_append(channel, sconfig, &s.addr, s.udp_port, + s.tcp_port, s.ll_iface); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -496,14 +561,14 @@ ares_status_t ares__sconfig_append_fromstr(ares__llist_t **sconfig, status = ARES_SUCCESS; done: - ares__llist_destroy(list); - ares__buf_destroy(buf); + ares_array_destroy(list); + ares_buf_destroy(buf); return status; } -static unsigned short ares__sconfig_get_port(const ares_channel_t *channel, - const ares_sconfig_t *s, - ares_bool_t is_tcp) +static unsigned short ares_sconfig_get_port(const ares_channel_t *channel, + const ares_sconfig_t *s, + ares_bool_t is_tcp) { unsigned short port = is_tcp ? s->tcp_port : s->udp_port; @@ -518,24 +583,24 @@ static unsigned short ares__sconfig_get_port(const ares_channel_t *channel, return port; } -static ares__slist_node_t *ares__server_find(ares_channel_t *channel, - const ares_sconfig_t *s) +static ares_slist_node_t *ares_server_find(const ares_channel_t *channel, + const ares_sconfig_t *s) { - ares__slist_node_t *node; + ares_slist_node_t *node; - for (node = ares__slist_node_first(channel->servers); node != NULL; - node = ares__slist_node_next(node)) { - const ares_server_t *server = ares__slist_node_val(node); + for (node = ares_slist_node_first(channel->servers); node != NULL; + node = ares_slist_node_next(node)) { + const ares_server_t *server = ares_slist_node_val(node); - if (!ares__addr_match(&server->addr, &s->addr)) { + if (!ares_addr_match(&server->addr, &s->addr)) { continue; } - if (server->tcp_port != ares__sconfig_get_port(channel, s, ARES_TRUE)) { + if (server->tcp_port != ares_sconfig_get_port(channel, s, ARES_TRUE)) { continue; } - if (server->udp_port != ares__sconfig_get_port(channel, s, ARES_FALSE)) { + if (server->udp_port != ares_sconfig_get_port(channel, s, ARES_FALSE)) { continue; } @@ -544,28 +609,28 @@ static ares__slist_node_t *ares__server_find(ares_channel_t *channel, return NULL; } -static ares_bool_t ares__server_isdup(const ares_channel_t *channel, - ares__llist_node_t *s) +static ares_bool_t ares_server_isdup(const ares_channel_t *channel, + ares_llist_node_t *s) { /* Scan backwards to see if this is a duplicate */ - ares__llist_node_t *prev; - const ares_sconfig_t *server = ares__llist_node_val(s); + ares_llist_node_t *prev; + const ares_sconfig_t *server = ares_llist_node_val(s); - for (prev = ares__llist_node_prev(s); prev != NULL; - prev = ares__llist_node_prev(prev)) { - const ares_sconfig_t *p = ares__llist_node_val(prev); + for (prev = ares_llist_node_prev(s); prev != NULL; + prev = ares_llist_node_prev(prev)) { + const ares_sconfig_t *p = ares_llist_node_val(prev); - if (!ares__addr_match(&server->addr, &p->addr)) { + if (!ares_addr_match(&server->addr, &p->addr)) { continue; } - if (ares__sconfig_get_port(channel, server, ARES_TRUE) != - ares__sconfig_get_port(channel, p, ARES_TRUE)) { + if (ares_sconfig_get_port(channel, server, ARES_TRUE) != + ares_sconfig_get_port(channel, p, ARES_TRUE)) { continue; } - if (ares__sconfig_get_port(channel, server, ARES_FALSE) != - ares__sconfig_get_port(channel, p, ARES_FALSE)) { + if (ares_sconfig_get_port(channel, server, ARES_FALSE) != + ares_sconfig_get_port(channel, p, ARES_FALSE)) { continue; } @@ -575,9 +640,9 @@ static ares_bool_t ares__server_isdup(const ares_channel_t *channel, return ARES_FALSE; } -static ares_status_t ares__server_create(ares_channel_t *channel, - const ares_sconfig_t *sconfig, - size_t idx) +static ares_status_t ares_server_create(ares_channel_t *channel, + const ares_sconfig_t *sconfig, + size_t idx) { ares_status_t status; ares_server_t *server = ares_malloc_zero(sizeof(*server)); @@ -588,8 +653,8 @@ static ares_status_t ares__server_create(ares_channel_t *channel, server->idx = idx; server->channel = channel; - server->udp_port = ares__sconfig_get_port(channel, sconfig, ARES_FALSE); - server->tcp_port = ares__sconfig_get_port(channel, sconfig, ARES_TRUE); + server->udp_port = ares_sconfig_get_port(channel, sconfig, ARES_FALSE); + server->tcp_port = ares_sconfig_get_port(channel, sconfig, ARES_TRUE); server->addr.family = sconfig->addr.family; server->next_retry_time.sec = 0; server->next_retry_time.usec = 0; @@ -608,25 +673,13 @@ static ares_status_t ares__server_create(ares_channel_t *channel, server->ll_scope = sconfig->ll_scope; } - server->tcp_parser = ares__buf_create(); - if (server->tcp_parser == NULL) { - status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ - goto done; /* LCOV_EXCL_LINE: OutOfMemory */ - } - - server->tcp_send = ares__buf_create(); - if (server->tcp_send == NULL) { - status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ - goto done; /* LCOV_EXCL_LINE: OutOfMemory */ - } - - server->connections = ares__llist_create(NULL); + server->connections = ares_llist_create(NULL); if (server->connections == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } - if (ares__slist_insert(channel->servers, server) == NULL) { + if (ares_slist_insert(channel->servers, server) == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -635,31 +688,31 @@ static ares_status_t ares__server_create(ares_channel_t *channel, done: if (status != ARES_SUCCESS) { - ares__destroy_server(server); /* LCOV_EXCL_LINE: OutOfMemory */ + ares_destroy_server(server); /* LCOV_EXCL_LINE: OutOfMemory */ } return status; } -static ares_bool_t ares__server_in_newconfig(const ares_server_t *server, - ares__llist_t *srvlist) +static ares_bool_t ares_server_in_newconfig(const ares_server_t *server, + ares_llist_t *srvlist) { - ares__llist_node_t *node; + ares_llist_node_t *node; const ares_channel_t *channel = server->channel; - for (node = ares__llist_node_first(srvlist); node != NULL; - node = ares__llist_node_next(node)) { - const ares_sconfig_t *s = ares__llist_node_val(node); + for (node = ares_llist_node_first(srvlist); node != NULL; + node = ares_llist_node_next(node)) { + const ares_sconfig_t *s = ares_llist_node_val(node); - if (!ares__addr_match(&server->addr, &s->addr)) { + if (!ares_addr_match(&server->addr, &s->addr)) { continue; } - if (server->tcp_port != ares__sconfig_get_port(channel, s, ARES_TRUE)) { + if (server->tcp_port != ares_sconfig_get_port(channel, s, ARES_TRUE)) { continue; } - if (server->udp_port != ares__sconfig_get_port(channel, s, ARES_FALSE)) { + if (server->udp_port != ares_sconfig_get_port(channel, s, ARES_FALSE)) { continue; } @@ -669,19 +722,19 @@ static ares_bool_t ares__server_in_newconfig(const ares_server_t *server, return ARES_FALSE; } -static ares_bool_t ares__servers_remove_stale(ares_channel_t *channel, - ares__llist_t *srvlist) +static ares_bool_t ares_servers_remove_stale(ares_channel_t *channel, + ares_llist_t *srvlist) { - ares_bool_t stale_removed = ARES_FALSE; - ares__slist_node_t *snode = ares__slist_node_first(channel->servers); + ares_bool_t stale_removed = ARES_FALSE; + ares_slist_node_t *snode = ares_slist_node_first(channel->servers); while (snode != NULL) { - ares__slist_node_t *snext = ares__slist_node_next(snode); - const ares_server_t *server = ares__slist_node_val(snode); - if (!ares__server_in_newconfig(server, srvlist)) { + ares_slist_node_t *snext = ares_slist_node_next(snode); + const ares_server_t *server = ares_slist_node_val(snode); + if (!ares_server_in_newconfig(server, srvlist)) { /* This will clean up all server state via the destruction callback and * move any queries to new servers */ - ares__slist_node_destroy(snode); + ares_slist_node_destroy(snode); stale_removed = ARES_TRUE; } snode = snext; @@ -689,21 +742,21 @@ static ares_bool_t ares__servers_remove_stale(ares_channel_t *channel, return stale_removed; } -static void ares__servers_trim_single(ares_channel_t *channel) +static void ares_servers_trim_single(ares_channel_t *channel) { - while (ares__slist_len(channel->servers) > 1) { - ares__slist_node_destroy(ares__slist_node_last(channel->servers)); + while (ares_slist_len(channel->servers) > 1) { + ares_slist_node_destroy(ares_slist_node_last(channel->servers)); } } -ares_status_t ares__servers_update(ares_channel_t *channel, - ares__llist_t *server_list, - ares_bool_t user_specified) +ares_status_t ares_servers_update(ares_channel_t *channel, + ares_llist_t *server_list, + ares_bool_t user_specified) { - ares__llist_node_t *node; - size_t idx = 0; - ares_status_t status; - ares_bool_t list_changed = ARES_FALSE; + ares_llist_node_t *node; + size_t idx = 0; + ares_status_t status; + ares_bool_t list_changed = ARES_FALSE; if (channel == NULL) { return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ @@ -714,19 +767,19 @@ ares_status_t ares__servers_update(ares_channel_t *channel, */ /* Add new entries */ - for (node = ares__llist_node_first(server_list); node != NULL; - node = ares__llist_node_next(node)) { - const ares_sconfig_t *sconfig = ares__llist_node_val(node); - ares__slist_node_t *snode; + for (node = ares_llist_node_first(server_list); node != NULL; + node = ares_llist_node_next(node)) { + const ares_sconfig_t *sconfig = ares_llist_node_val(node); + ares_slist_node_t *snode; /* If a server has already appeared in the list of new servers, skip it. */ - if (ares__server_isdup(channel, node)) { + if (ares_server_isdup(channel, node)) { continue; } - snode = ares__server_find(channel, sconfig); + snode = ares_server_find(channel, sconfig); if (snode != NULL) { - ares_server_t *server = ares__slist_node_val(snode); + ares_server_t *server = ares_slist_node_val(snode); /* Copy over link-local settings. Its possible some of this data has * changed, maybe ... */ @@ -740,10 +793,10 @@ ares_status_t ares__servers_update(ares_channel_t *channel, server->idx = idx; /* Index changed, reinsert node, doesn't require any memory * allocations so can't fail. */ - ares__slist_node_reinsert(snode); + ares_slist_node_reinsert(snode); } } else { - status = ares__server_create(channel, sconfig, idx); + status = ares_server_create(channel, sconfig, idx); if (status != ARES_SUCCESS) { goto done; } @@ -755,13 +808,13 @@ ares_status_t ares__servers_update(ares_channel_t *channel, } /* Remove any servers that don't exist in the current configuration */ - if (ares__servers_remove_stale(channel, server_list)) { + if (ares_servers_remove_stale(channel, server_list)) { list_changed = ARES_TRUE; } /* Trim to one server if ARES_FLAG_PRIMARY is set. */ if (channel->flags & ARES_FLAG_PRIMARY) { - ares__servers_trim_single(channel); + ares_servers_trim_single(channel); } if (user_specified) { @@ -771,7 +824,7 @@ ares_status_t ares__servers_update(ares_channel_t *channel, /* Clear any cached query results only if the server list changed */ if (list_changed) { - ares__qcache_flush(channel->qcache); + ares_qcache_flush(channel->qcache); } status = ARES_SUCCESS; @@ -781,15 +834,15 @@ ares_status_t ares__servers_update(ares_channel_t *channel, } static ares_status_t - ares_addr_node_to_server_config_llist(const struct ares_addr_node *servers, - ares__llist_t **llist) + ares_addr_node_to_sconfig_llist(const struct ares_addr_node *servers, + ares_llist_t **llist) { const struct ares_addr_node *node; - ares__llist_t *s; + ares_llist_t *s; *llist = NULL; - s = ares__llist_create(ares_free); + s = ares_llist_create(ares_free); if (s == NULL) { goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -816,7 +869,7 @@ static ares_status_t sizeof(sconfig->addr.addr.addr6)); } - if (ares__llist_insert_last(s, sconfig) == NULL) { + if (ares_llist_insert_last(s, sconfig) == NULL) { ares_free(sconfig); /* LCOV_EXCL_LINE: OutOfMemory */ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -827,20 +880,21 @@ static ares_status_t /* LCOV_EXCL_START: OutOfMemory */ fail: - ares__llist_destroy(s); + ares_llist_destroy(s); return ARES_ENOMEM; /* LCOV_EXCL_STOP */ } -static ares_status_t ares_addr_port_node_to_server_config_llist( - const struct ares_addr_port_node *servers, ares__llist_t **llist) +static ares_status_t + ares_addrpnode_to_sconfig_llist(const struct ares_addr_port_node *servers, + ares_llist_t **llist) { const struct ares_addr_port_node *node; - ares__llist_t *s; + ares_llist_t *s; *llist = NULL; - s = ares__llist_create(ares_free); + s = ares_llist_create(ares_free); if (s == NULL) { goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -870,7 +924,7 @@ static ares_status_t ares_addr_port_node_to_server_config_llist( sconfig->tcp_port = (unsigned short)node->tcp_port; sconfig->udp_port = (unsigned short)node->udp_port; - if (ares__llist_insert_last(s, sconfig) == NULL) { + if (ares_llist_insert_last(s, sconfig) == NULL) { ares_free(sconfig); /* LCOV_EXCL_LINE: OutOfMemory */ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -881,21 +935,21 @@ static ares_status_t ares_addr_port_node_to_server_config_llist( /* LCOV_EXCL_START: OutOfMemory */ fail: - ares__llist_destroy(s); + ares_llist_destroy(s); return ARES_ENOMEM; /* LCOV_EXCL_STOP */ } -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_in_addr_to_sconfig_llist(const struct in_addr *servers, + size_t nservers, + ares_llist_t **llist) { - size_t i; - ares__llist_t *s; + size_t i; + ares_llist_t *s; *llist = NULL; - s = ares__llist_create(ares_free); + s = ares_llist_create(ares_free); if (s == NULL) { goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -912,7 +966,7 @@ ares_status_t ares_in_addr_to_server_config_llist(const struct in_addr *servers, memcpy(&sconfig->addr.addr.addr4, &servers[i], sizeof(sconfig->addr.addr.addr4)); - if (ares__llist_insert_last(s, sconfig) == NULL) { + if (ares_llist_insert_last(s, sconfig) == NULL) { goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } } @@ -922,21 +976,90 @@ ares_status_t ares_in_addr_to_server_config_llist(const struct in_addr *servers, /* LCOV_EXCL_START: OutOfMemory */ fail: - ares__llist_destroy(s); + ares_llist_destroy(s); return ARES_ENOMEM; /* LCOV_EXCL_STOP */ } +static ares_bool_t ares_server_use_uri(const ares_server_t *server) +{ + /* Currently only reason to use new format is if the ports for udp and tcp + * are different */ + if (server->tcp_port != server->udp_port) { + return ARES_TRUE; + } + return ARES_FALSE; +} + +static ares_status_t ares_get_server_addr_uri(const ares_server_t *server, + ares_buf_t *buf) +{ + ares_uri_t *uri = NULL; + ares_status_t status; + char addr[INET6_ADDRSTRLEN]; + + uri = ares_uri_create(); + if (uri == NULL) { + return ARES_ENOMEM; + } + + status = ares_uri_set_scheme(uri, "dns"); + if (status != ARES_SUCCESS) { + goto done; + } + + ares_inet_ntop(server->addr.family, &server->addr.addr, addr, sizeof(addr)); + + if (ares_strlen(server->ll_iface)) { + char addr_iface[256]; + + snprintf(addr_iface, sizeof(addr_iface), "%s%%%s", addr, server->ll_iface); + status = ares_uri_set_host(uri, addr_iface); + } else { + status = ares_uri_set_host(uri, addr); + } + + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_set_port(uri, server->udp_port); + if (status != ARES_SUCCESS) { + goto done; + } + + if (server->udp_port != server->tcp_port) { + char port[6]; + snprintf(port, sizeof(port), "%d", server->tcp_port); + status = ares_uri_set_query_key(uri, "tcpport", port); + if (status != ARES_SUCCESS) { + goto done; + } + } + + status = ares_uri_write_buf(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + +done: + ares_uri_destroy(uri); + return status; +} + /* Write out the details of a server to a buffer */ -ares_status_t ares_get_server_addr(const ares_server_t *server, - ares__buf_t *buf) +ares_status_t ares_get_server_addr(const ares_server_t *server, ares_buf_t *buf) { ares_status_t status; char addr[INET6_ADDRSTRLEN]; + if (ares_server_use_uri(server)) { + return ares_get_server_addr_uri(server, buf); + } + /* ipv4addr or [ipv6addr] */ if (server->addr.family == AF_INET6) { - status = ares__buf_append_byte(buf, '['); + status = ares_buf_append_byte(buf, '['); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -944,37 +1067,37 @@ ares_status_t ares_get_server_addr(const ares_server_t *server, ares_inet_ntop(server->addr.family, &server->addr.addr, addr, sizeof(addr)); - status = ares__buf_append_str(buf, addr); + status = ares_buf_append_str(buf, addr); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } if (server->addr.family == AF_INET6) { - status = ares__buf_append_byte(buf, ']'); + status = ares_buf_append_byte(buf, ']'); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } } /* :port */ - status = ares__buf_append_byte(buf, ':'); + status = ares_buf_append_byte(buf, ':'); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_append_num_dec(buf, server->udp_port, 0); + status = ares_buf_append_num_dec(buf, server->udp_port, 0); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* %iface */ if (ares_strlen(server->ll_iface)) { - status = ares__buf_append_byte(buf, '%'); + status = ares_buf_append_byte(buf, '%'); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_append_str(buf, server->ll_iface); + status = ares_buf_append_str(buf, server->ll_iface); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -990,17 +1113,17 @@ int ares_get_servers(const ares_channel_t *channel, struct ares_addr_node *srvr_last = NULL; struct ares_addr_node *srvr_curr; ares_status_t status = ARES_SUCCESS; - ares__slist_node_t *node; + ares_slist_node_t *node; if (channel == NULL) { return ARES_ENODATA; } - ares__channel_lock(channel); + ares_channel_lock(channel); - for (node = ares__slist_node_first(channel->servers); node != NULL; - node = ares__slist_node_next(node)) { - const ares_server_t *server = ares__slist_node_val(node); + for (node = ares_slist_node_first(channel->servers); node != NULL; + node = ares_slist_node_next(node)) { + const ares_server_t *server = ares_slist_node_val(node); /* Allocate storage for this server node appending it to the list */ srvr_curr = ares_malloc_data(ARES_DATATYPE_ADDR_NODE); @@ -1033,7 +1156,7 @@ int ares_get_servers(const ares_channel_t *channel, *servers = srvr_head; - ares__channel_unlock(channel); + ares_channel_unlock(channel); return (int)status; } @@ -1045,17 +1168,17 @@ int ares_get_servers_ports(const ares_channel_t *channel, struct ares_addr_port_node *srvr_last = NULL; struct ares_addr_port_node *srvr_curr; ares_status_t status = ARES_SUCCESS; - ares__slist_node_t *node; + ares_slist_node_t *node; if (channel == NULL) { return ARES_ENODATA; } - ares__channel_lock(channel); + ares_channel_lock(channel); - for (node = ares__slist_node_first(channel->servers); node != NULL; - node = ares__slist_node_next(node)) { - const ares_server_t *server = ares__slist_node_val(node); + for (node = ares_slist_node_first(channel->servers); node != NULL; + node = ares_slist_node_next(node)) { + const ares_server_t *server = ares_slist_node_val(node); /* Allocate storage for this server node appending it to the list */ srvr_curr = ares_malloc_data(ARES_DATATYPE_ADDR_PORT_NODE); @@ -1091,30 +1214,30 @@ int ares_get_servers_ports(const ares_channel_t *channel, *servers = srvr_head; - ares__channel_unlock(channel); + ares_channel_unlock(channel); return (int)status; } int ares_set_servers(ares_channel_t *channel, const struct ares_addr_node *servers) { - ares__llist_t *slist; - ares_status_t status; + ares_llist_t *slist; + ares_status_t status; if (channel == NULL) { return ARES_ENODATA; } - status = ares_addr_node_to_server_config_llist(servers, &slist); + status = ares_addr_node_to_sconfig_llist(servers, &slist); if (status != ARES_SUCCESS) { return (int)status; } - ares__channel_lock(channel); - status = ares__servers_update(channel, slist, ARES_TRUE); - ares__channel_unlock(channel); + ares_channel_lock(channel); + status = ares_servers_update(channel, slist, ARES_TRUE); + ares_channel_unlock(channel); - ares__llist_destroy(slist); + ares_llist_destroy(slist); return (int)status; } @@ -1122,23 +1245,23 @@ int ares_set_servers(ares_channel_t *channel, int ares_set_servers_ports(ares_channel_t *channel, const struct ares_addr_port_node *servers) { - ares__llist_t *slist; - ares_status_t status; + ares_llist_t *slist; + ares_status_t status; if (channel == NULL) { return ARES_ENODATA; } - status = ares_addr_port_node_to_server_config_llist(servers, &slist); + status = ares_addrpnode_to_sconfig_llist(servers, &slist); if (status != ARES_SUCCESS) { return (int)status; } - ares__channel_lock(channel); - status = ares__servers_update(channel, slist, ARES_TRUE); - ares__channel_unlock(channel); + ares_channel_lock(channel); + status = ares_servers_update(channel, slist, ARES_TRUE); + ares_channel_unlock(channel); - ares__llist_destroy(slist); + ares_llist_destroy(slist); return (int)status; } @@ -1147,8 +1270,8 @@ int ares_set_servers_ports(ares_channel_t *channel, /* IPv6 addresses with ports require square brackets [fe80::1]:53 */ static ares_status_t set_servers_csv(ares_channel_t *channel, const char *_csv) { - ares_status_t status; - ares__llist_t *slist = NULL; + ares_status_t status; + ares_llist_t *slist = NULL; if (channel == NULL) { return ARES_ENODATA; @@ -1156,23 +1279,23 @@ static ares_status_t set_servers_csv(ares_channel_t *channel, const char *_csv) if (ares_strlen(_csv) == 0) { /* blank all servers */ - ares__channel_lock(channel); - status = ares__servers_update(channel, NULL, ARES_TRUE); - ares__channel_unlock(channel); + ares_channel_lock(channel); + status = ares_servers_update(channel, NULL, ARES_TRUE); + ares_channel_unlock(channel); return status; } - status = ares__sconfig_append_fromstr(&slist, _csv, ARES_FALSE); + status = ares_sconfig_append_fromstr(channel, &slist, _csv, ARES_FALSE); if (status != ARES_SUCCESS) { - ares__llist_destroy(slist); + ares_llist_destroy(slist); return status; } - ares__channel_lock(channel); - status = ares__servers_update(channel, slist, ARES_TRUE); - ares__channel_unlock(channel); + ares_channel_lock(channel); + status = ares_servers_update(channel, slist, ARES_TRUE); + ares_channel_unlock(channel); - ares__llist_destroy(slist); + ares_llist_destroy(slist); return status; } @@ -1190,24 +1313,24 @@ int ares_set_servers_ports_csv(ares_channel_t *channel, const char *_csv) char *ares_get_servers_csv(const ares_channel_t *channel) { - ares__buf_t *buf = NULL; - char *out = NULL; - ares__slist_node_t *node; + ares_buf_t *buf = NULL; + char *out = NULL; + ares_slist_node_t *node; - ares__channel_lock(channel); + ares_channel_lock(channel); - buf = ares__buf_create(); + buf = ares_buf_create(); if (buf == NULL) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } - for (node = ares__slist_node_first(channel->servers); node != NULL; - node = ares__slist_node_next(node)) { + for (node = ares_slist_node_first(channel->servers); node != NULL; + node = ares_slist_node_next(node)) { ares_status_t status; - const ares_server_t *server = ares__slist_node_val(node); + const ares_server_t *server = ares_slist_node_val(node); - if (ares__buf_len(buf)) { - status = ares__buf_append_byte(buf, ','); + if (ares_buf_len(buf)) { + status = ares_buf_append_byte(buf, ','); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -1219,12 +1342,12 @@ char *ares_get_servers_csv(const ares_channel_t *channel) } } - out = ares__buf_finish_str(buf, NULL); + out = ares_buf_finish_str(buf, NULL); buf = NULL; done: - ares__channel_unlock(channel); - ares__buf_destroy(buf); + ares_channel_unlock(channel); + ares_buf_destroy(buf); return out; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_version.c b/lib/c-ares-1.34.4/src/lib/ares_version.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/ares_version.c rename to lib/c-ares-1.34.4/src/lib/ares_version.c diff --git a/lib/c-ares-1.33.1/src/lib/cares.rc b/lib/c-ares-1.34.4/src/lib/cares.rc similarity index 100% rename from lib/c-ares-1.33.1/src/lib/cares.rc rename to lib/c-ares-1.34.4/src/lib/cares.rc diff --git a/lib/c-ares-1.33.1/src/lib/config-dos.h b/lib/c-ares-1.34.4/src/lib/config-dos.h similarity index 99% rename from lib/c-ares-1.33.1/src/lib/config-dos.h rename to lib/c-ares-1.34.4/src/lib/config-dos.h index db758fcca66..afbcfb2858e 100644 --- a/lib/c-ares-1.33.1/src/lib/config-dos.h +++ b/lib/c-ares-1.34.4/src/lib/config-dos.h @@ -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 diff --git a/lib/c-ares-1.33.1/src/lib/config-win32.h b/lib/c-ares-1.34.4/src/lib/config-win32.h similarity index 99% rename from lib/c-ares-1.33.1/src/lib/config-win32.h rename to lib/c-ares-1.34.4/src/lib/config-win32.h index b9c4ec17336..be233a2f8b9 100644 --- a/lib/c-ares-1.33.1/src/lib/config-win32.h +++ b/lib/c-ares-1.34.4/src/lib/config-win32.h @@ -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 diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__array.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_array.c similarity index 60% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__array.c rename to lib/c-ares-1.34.4/src/lib/dsa/ares_array.c index 0c724248bf2..c421d5c5f67 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__array.c +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_array.c @@ -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)); +} + +ares_status_t ares_array_insert_first(void **elem_ptr, ares_array_t *arr) +{ + return ares_array_insert_at(elem_ptr, arr, 0); +} + +ares_status_t ares_array_insertdata_at(ares_array_t *arr, size_t idx, + const void *data_ptr) +{ + 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; +} + +ares_status_t ares_array_insertdata_last(ares_array_t *arr, + const void *data_ptr) { - return ares__array_insert_at(elem_ptr, arr, 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_insert_first(void **elem_ptr, ares__array_t *arr) +ares_status_t ares_array_insertdata_first(ares_array_t *arr, + const void *data_ptr) { - return ares__array_insert_at(elem_ptr, arr, 0); + 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) +void *ares_array_first(ares_array_t *arr) { - return ares__array_at(arr, 0); + return ares_array_at(arr, 0); } -void *ares__array_last(ares__array_t *arr) +void *ares_array_last(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(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); } diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable.c similarity index 64% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable.c rename to lib/c-ares-1.34.4/src/lib/dsa/ares_htable.c index 9049b3246b3..f76b67cae9a 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable.c +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable.c @@ -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 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable) 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); } diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable.h b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable.h similarity index 76% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable.h rename to lib/c-ares-1.34.4/src/lib/dsa/ares_htable.h index d09c865977c..5700286eb0f 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable.h +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable.h @@ -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); /*! @} */ diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_asvp.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_asvp.c similarity index 62% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable_asvp.c rename to lib/c-ares-1.34.4/src/lib/dsa/ares_htable_asvp.c index 4b9267ff6c1..32f4d2c9949 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_asvp.c +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_asvp.c @@ -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 @@ ares_bool_t ares__htable_asvp_insert(ares__htable_asvp_t *htable, 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); } diff --git a/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_dict.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_dict.c new file mode 100644 index 00000000000..93d7a20137c --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_dict.c @@ -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; +} diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_strvp.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_strvp.c similarity index 54% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable_strvp.c rename to lib/c-ares-1.34.4/src/lib/dsa/ares_htable_strvp.c index d73a1928a75..daca117e80f 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_strvp.c +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_strvp.c @@ -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 @@ ares_bool_t ares__htable_strvp_insert(ares__htable_strvp_t *htable, 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); +} + +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) +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); } diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_szvp.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_szvp.c similarity index 61% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable_szvp.c rename to lib/c-ares-1.34.4/src/lib/dsa/ares_htable_szvp.c index b3e88d8b9a4..fdaae0a571c 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_szvp.c +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_szvp.c @@ -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 @@ ares_bool_t ares__htable_szvp_insert(ares__htable_szvp_t *htable, size_t key, 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); } diff --git a/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_vpstr.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_vpstr.c new file mode 100644 index 00000000000..86c881f7686 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_vpstr.c @@ -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); +} diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_vpvp.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_vpvp.c similarity index 60% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable_vpvp.c rename to lib/c-ares-1.34.4/src/lib/dsa/ares_htable_vpvp.c index 9042c48dd7f..14fd6e9da09 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_vpvp.c +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_htable_vpvp.c @@ -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 @@ ares_bool_t ares__htable_vpvp_insert(ares__htable_vpvp_t *htable, void *key, 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); } diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__llist.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_llist.c similarity index 52% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__llist.c rename to lib/c-ares-1.34.4/src/lib/dsa/ares_llist.c index 96936c1abe7..6bd7de269a4 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__llist.c +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_llist.c @@ -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); } diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__slist.c b/lib/c-ares-1.34.4/src/lib/dsa/ares_slist.c similarity index 70% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__slist.c rename to lib/c-ares-1.34.4/src/lib/dsa/ares_slist.c index f0e3f8b14a9..7e68347994c 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__slist.c +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_slist.c @@ -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 @@ ares__slist_node_t *ares__slist_insert(ares__slist_t *list, void *val) /* 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); diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__slist.h b/lib/c-ares-1.34.4/src/lib/dsa/ares_slist.h similarity index 75% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__slist.h rename to lib/c-ares-1.34.4/src/lib/dsa/ares_slist.h index 26af88fa782..a89c2652f2d 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__slist.h +++ b/lib/c-ares-1.34.4/src/lib/dsa/ares_slist.h @@ -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); /*! @} */ diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event.h b/lib/c-ares-1.34.4/src/lib/event/ares_event.h similarity index 96% rename from lib/c-ares-1.33.1/src/lib/event/ares_event.h rename to lib/c-ares-1.34.4/src/lib/event/ares_event.h index 317731fc428..36cd10dcf89 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event.h +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event.h @@ -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 diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_configchg.c b/lib/c-ares-1.34.4/src/lib/event/ares_event_configchg.c similarity index 90% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_configchg.c rename to lib/c-ares-1.34.4/src/lib/event/ares_event_configchg.c index 10f0e21dde7..5ecc6888ab7 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event_configchg.c +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event_configchg.c @@ -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,30 +545,40 @@ 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]; + const char *configfiles[16]; ares_bool_t changed = ARES_FALSE; + size_t cnt = 0; + + memset(configfiles, 0, sizeof(configfiles)); - configfiles[0] = resolvconf_path; - configfiles[1] = "/etc/nsswitch.conf"; - configfiles[2] = "/etc/netsvc.conf"; - configfiles[3] = "/etc/svc.conf"; - configfiles[4] = NULL; + configfiles[cnt++] = resolvconf_path; + configfiles[cnt++] = "/etc/nsswitch.conf"; +#ifdef _AIX + configfiles[cnt++] = "/etc/netsvc.conf"; +#endif +#ifdef __osf /* Tru64 */ + configfiles[cnt++] = "/etc/svc.conf"; +#endif +#ifdef __QNX__ + configfiles[cnt++] = "/etc/net.cfg"; +#endif + configfiles[cnt++] = 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 +587,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 +599,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 +614,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 +633,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 +653,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 +676,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 +694,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); } diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_epoll.c b/lib/c-ares-1.34.4/src/lib/event/ares_event_epoll.c similarity index 97% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_epoll.c rename to lib/c-ares-1.34.4/src/lib/event/ares_event_epoll.c index 5eb25cccc9e..538c38b4f94 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event_epoll.c +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event_epoll.c @@ -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 */ } diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_kqueue.c b/lib/c-ares-1.34.4/src/lib/event/ares_event_kqueue.c similarity index 98% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_kqueue.c rename to lib/c-ares-1.34.4/src/lib/event/ares_event_kqueue.c index 1c35c14f165..dbbd0dbd9f7 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event_kqueue.c +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event_kqueue.c @@ -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; } diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_poll.c b/lib/c-ares-1.34.4/src/lib/event/ares_event_poll.c similarity index 94% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_poll.c rename to lib/c-ares-1.34.4/src/lib/event/ares_event_poll.c index 42ffd912e95..c6ab4b62072 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event_poll.c +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event_poll.c @@ -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 */ } diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_select.c b/lib/c-ares-1.34.4/src/lib/event/ares_event_select.c similarity index 95% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_select.c rename to lib/c-ares-1.34.4/src/lib/event/ares_event_select.c index e1266ea9905..4d7c085d872 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event_select.c +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event_select.c @@ -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 */ } diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_thread.c b/lib/c-ares-1.34.4/src/lib/event/ares_event_thread.c similarity index 78% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_thread.c rename to lib/c-ares-1.34.4/src/lib/event/ares_event_thread.c index 8b332e9b019..d59b7880a41 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event_thread.c +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event_thread.c @@ -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 @@ ares_status_t ares_event_update(ares_event_t **event, ares_event_thread_t *e, 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,31 @@ static void *ares_event_thread(void *arg) e->ev_sys->wait(e, timeout_ms); - /* Each iteration should do timeout processing */ - if (e->isup) { - ares_process_fd(e->channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD); + /* 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); } /* Relock before we loop again */ - ares__thread_mutex_lock(e->mutex); + ares_thread_mutex_lock(e->mutex); + + /* Each iteration should do timeout processing and any other cleanup + * that may not have been performed */ + if (e->isup) { + ares_thread_mutex_unlock(e->mutex); + ares_process_fds(e->channel, NULL, 0, ARES_PROCESS_FLAG_NONE); + 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 +377,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 +395,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 +410,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 +484,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 +516,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 +538,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; diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_wake_pipe.c b/lib/c-ares-1.34.4/src/lib/event/ares_event_wake_pipe.c similarity index 97% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_wake_pipe.c rename to lib/c-ares-1.34.4/src/lib/event/ares_event_wake_pipe.c index 282d013dc62..d3b166a3d6c 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event_wake_pipe.c +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event_wake_pipe.c @@ -92,9 +92,9 @@ static ares_pipeevent_t *ares_pipeevent_init(void) } # endif -# ifdef O_CLOEXEC - fcntl(p->filedes[0], F_SETFD, O_CLOEXEC); - fcntl(p->filedes[1], F_SETFD, O_CLOEXEC); +# ifdef FD_CLOEXEC + fcntl(p->filedes[0], F_SETFD, FD_CLOEXEC); + fcntl(p->filedes[1], F_SETFD, FD_CLOEXEC); # endif # endif diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_win32.c b/lib/c-ares-1.34.4/src/lib/event/ares_event_win32.c similarity index 94% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_win32.c rename to lib/c-ares-1.34.4/src/lib/event/ares_event_win32.c index 0b7e535bbbf..1531b6d81dd 100644 --- a/lib/c-ares-1.33.1/src/lib/event/ares_event_win32.c +++ b/lib/c-ares-1.34.4/src/lib/event/ares_event_win32.c @@ -204,14 +204,14 @@ typedef struct { NtCancelIoFileEx_t NtCancelIoFileEx; /* Implementation details */ - ares__slist_t *afd_handles; + ares_slist_t *afd_handles; HANDLE iocp_handle; /* IO_STATUS_BLOCK * -> ares_evsys_win32_eventdata_t * mapping. There is * no completion key passed to IOCP with this method so we have to look * up based on the lpOverlapped returned (which is mapped to IO_STATUS_BLOCK) */ - ares__htable_vpvp_t *sockets; + ares_htable_vpvp_t *sockets; /* Flag about whether or not we are shutting down */ ares_bool_t is_shutdown; @@ -226,24 +226,24 @@ typedef enum { typedef struct { /*! Pointer to parent event container */ - ares_event_t *event; + ares_event_t *event; /*! Socket passed in to monitor */ - SOCKET socket; + SOCKET socket; /*! Base socket derived from provided socket */ - SOCKET base_socket; + SOCKET base_socket; /*! Structure for submitting AFD POLL requests (Internals!) */ - AFD_POLL_INFO afd_poll_info; + AFD_POLL_INFO afd_poll_info; /*! Status of current polling operation */ - poll_status_t poll_status; + poll_status_t poll_status; /*! IO Status Block structure submitted with AFD POLL requests and returned * with IOCP results as lpOverlapped (even though its a different structure) */ - IO_STATUS_BLOCK iosb; + IO_STATUS_BLOCK iosb; /*! AFD handle node an outstanding poll request is associated with */ - ares__slist_node_t *afd_handle_node; + ares_slist_node_t *afd_handle_node; /* Lock is only for PostQueuedCompletionStatus() to prevent multiple * signals. Tracking via POLL_STATUS_PENDING/POLL_STATUS_NONE */ - ares__thread_mutex_t *lock; + ares_thread_mutex_t *lock; } ares_evsys_win32_eventdata_t; static size_t ares_evsys_win32_wait(ares_event_thread_t *e, @@ -256,12 +256,12 @@ static void ares_iocpevent_signal(const ares_event_t *event) ares_evsys_win32_eventdata_t *ed = event->data; ares_bool_t queue_event = ARES_FALSE; - ares__thread_mutex_lock(ed->lock); + ares_thread_mutex_lock(ed->lock); if (ed->poll_status != POLL_STATUS_PENDING) { ed->poll_status = POLL_STATUS_PENDING; queue_event = ARES_TRUE; } - ares__thread_mutex_unlock(ed->lock); + ares_thread_mutex_unlock(ed->lock); if (!queue_event) { return; @@ -277,9 +277,9 @@ static void ares_iocpevent_cb(ares_event_thread_t *e, ares_socket_t fd, (void)e; (void)fd; (void)flags; - ares__thread_mutex_lock(ed->lock); + ares_thread_mutex_lock(ed->lock); ed->poll_status = POLL_STATUS_NONE; - ares__thread_mutex_unlock(ed->lock); + ares_thread_mutex_unlock(ed->lock); } static ares_event_t *ares_iocpevent_create(ares_event_thread_t *e) @@ -314,8 +314,8 @@ static void ares_evsys_win32_destroy(ares_event_thread_t *e) ew->is_shutdown = ARES_TRUE; CARES_DEBUG_LOG(" ** waiting on %lu remaining sockets to be destroyed\n", - (unsigned long)ares__htable_vpvp_num_keys(ew->sockets)); - while (ares__htable_vpvp_num_keys(ew->sockets)) { + (unsigned long)ares_htable_vpvp_num_keys(ew->sockets)); + while (ares_htable_vpvp_num_keys(ew->sockets)) { ares_evsys_win32_wait(e, 0); } CARES_DEBUG_LOG(" ** all sockets cleaned up\n"); @@ -325,9 +325,9 @@ static void ares_evsys_win32_destroy(ares_event_thread_t *e) CloseHandle(ew->iocp_handle); } - ares__slist_destroy(ew->afd_handles); + ares_slist_destroy(ew->afd_handles); - ares__htable_vpvp_destroy(ew->sockets); + ares_htable_vpvp_destroy(ew->sockets); ares_free(ew); e->ev_sys_data = NULL; @@ -373,14 +373,14 @@ static void fill_object_attributes(OBJECT_ATTRIBUTES *attr, # define UNICODE_STRING_CONSTANT(s) \ { (sizeof(s) - 1) * sizeof(wchar_t), sizeof(s) * sizeof(wchar_t), L##s } -static ares__slist_node_t *ares_afd_handle_create(ares_evsys_win32_t *ew) +static ares_slist_node_t *ares_afd_handle_create(ares_evsys_win32_t *ew) { UNICODE_STRING afd_device_name = UNICODE_STRING_CONSTANT("\\Device\\Afd"); OBJECT_ATTRIBUTES afd_attributes; NTSTATUS status; IO_STATUS_BLOCK iosb; - ares_afd_handle_t *afd = ares_malloc_zero(sizeof(*afd)); - ares__slist_node_t *node = NULL; + ares_afd_handle_t *afd = ares_malloc_zero(sizeof(*afd)); + ares_slist_node_t *node = NULL; if (afd == NULL) { goto fail; } @@ -407,7 +407,7 @@ static ares__slist_node_t *ares_afd_handle_create(ares_evsys_win32_t *ew) goto fail; } - node = ares__slist_insert(ew->afd_handles, afd); + node = ares_slist_insert(ew->afd_handles, afd); if (node == NULL) { goto fail; } @@ -422,10 +422,10 @@ static ares__slist_node_t *ares_afd_handle_create(ares_evsys_win32_t *ew) /* Fetch the lowest poll count entry, but if it exceeds the limit, create a * new one and return that */ -static ares__slist_node_t *ares_afd_handle_fetch(ares_evsys_win32_t *ew) +static ares_slist_node_t *ares_afd_handle_fetch(ares_evsys_win32_t *ew) { - ares__slist_node_t *node = ares__slist_node_first(ew->afd_handles); - ares_afd_handle_t *afd = ares__slist_node_val(node); + ares_slist_node_t *node = ares_slist_node_first(ew->afd_handles); + ares_afd_handle_t *afd = ares_slist_node_val(node); if (afd != NULL && afd->poll_cnt < AFD_POLL_PER_HANDLE) { return node; @@ -488,7 +488,7 @@ static ares_bool_t ares_evsys_win32_init(ares_event_thread_t *e) goto fail; } - ew->afd_handles = ares__slist_create( + ew->afd_handles = ares_slist_create( e->channel->rand_state, ares_afd_handle_cmp, ares_afd_handle_destroy); if (ew->afd_handles == NULL) { goto fail; @@ -505,7 +505,7 @@ static ares_bool_t ares_evsys_win32_init(ares_event_thread_t *e) goto fail; } - ew->sockets = ares__htable_vpvp_create(NULL, NULL); + ew->sockets = ares_htable_vpvp_create(NULL, NULL); if (ew->sockets == NULL) { goto fail; } @@ -582,7 +582,7 @@ static ares_bool_t ares_evsys_win32_afd_enqueue(ares_event_t *event, return ARES_FALSE; } - afd = ares__slist_node_val(ed->afd_handle_node); + afd = ares_slist_node_val(ed->afd_handle_node); /* Enqueue AFD Poll */ ed->afd_poll_info.Exclusive = FALSE; @@ -621,7 +621,7 @@ static ares_bool_t ares_evsys_win32_afd_enqueue(ares_event_t *event, /* Record that we submitted a poll request to this handle and tell it to * re-sort the node since we changed its sort value */ afd->poll_cnt++; - ares__slist_node_reinsert(ed->afd_handle_node); + ares_slist_node_reinsert(ed->afd_handle_node); ed->poll_status = POLL_STATUS_PENDING; CARES_DEBUG_LOG("++ afd_enqueue ed=%p flags=%X\n", (void *)ed, @@ -643,7 +643,7 @@ static ares_bool_t ares_evsys_win32_afd_cancel(ares_evsys_win32_eventdata_t *ed) return ARES_FALSE; } - afd = ares__slist_node_val(ed->afd_handle_node); + afd = ares_slist_node_val(ed->afd_handle_node); /* Misuse */ if (afd == NULL) { @@ -685,10 +685,10 @@ static void ares_evsys_win32_eventdata_destroy(ares_evsys_win32_t *ew, (ed->socket == ARES_SOCKET_BAD) ? "data" : "socket"); /* These type of handles are deferred destroy. Update tracking. */ if (ed->socket != ARES_SOCKET_BAD) { - ares__htable_vpvp_remove(ew->sockets, &ed->iosb); + ares_htable_vpvp_remove(ew->sockets, &ed->iosb); } - ares__thread_mutex_destroy(ed->lock); + ares_thread_mutex_destroy(ed->lock); if (ed->event != NULL) { ed->event->data = NULL; @@ -718,7 +718,7 @@ static ares_bool_t ares_evsys_win32_event_add(ares_event_t *event) * the ares_evsys_win32_eventdata_t as the placeholder to use as the * IOCP Completion Key */ if (ed->socket == ARES_SOCKET_BAD) { - ed->lock = ares__thread_mutex_create(); + ed->lock = ares_thread_mutex_create(); if (ed->lock == NULL) { goto done; } @@ -731,7 +731,7 @@ static ares_bool_t ares_evsys_win32_event_add(ares_event_t *event) goto done; } - if (!ares__htable_vpvp_insert(ew->sockets, &ed->iosb, ed)) { + if (!ares_htable_vpvp_insert(ew->sockets, &ed->iosb, ed)) { goto done; } @@ -859,9 +859,9 @@ static ares_bool_t ares_evsys_win32_process_socket_event( /* Decrement poll count for AFD handle then resort, also disassociate * with socket */ - afd = ares__slist_node_val(ed->afd_handle_node); + afd = ares_slist_node_val(ed->afd_handle_node); afd->poll_cnt--; - ares__slist_node_reinsert(ed->afd_handle_node); + ares_slist_node_reinsert(ed->afd_handle_node); ed->afd_handle_node = NULL; /* Pending destroy, go ahead and kill it */ @@ -946,7 +946,7 @@ static size_t ares_evsys_win32_wait(ares_event_thread_t *e, ed = (ares_evsys_win32_eventdata_t *)entries[i].lpCompletionKey; rc = ares_evsys_win32_process_other_event(ew, ed, i); } else { - ed = ares__htable_vpvp_get_direct(ew->sockets, entries[i].lpOverlapped); + ed = ares_htable_vpvp_get_direct(ew->sockets, entries[i].lpOverlapped); rc = ares_evsys_win32_process_socket_event(ew, ed, i); } diff --git a/lib/c-ares-1.33.1/src/lib/event/ares_event_win32.h b/lib/c-ares-1.34.4/src/lib/event/ares_event_win32.h similarity index 100% rename from lib/c-ares-1.33.1/src/lib/event/ares_event_win32.h rename to lib/c-ares-1.34.4/src/lib/event/ares_event_win32.h diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__array.h b/lib/c-ares-1.34.4/src/lib/include/ares_array.h similarity index 61% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__array.h rename to lib/c-ares-1.34.4/src/lib/include/ares_array.h index 6fa1c0e15e9..f1a2e155f37 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__array.h +++ b/lib/c-ares-1.34.4/src/lib/include/ares_array.h @@ -26,7 +26,9 @@ #ifndef __ARES__ARRAY_H #define __ARES__ARRAY_H -/*! \addtogroup ares__array Array Data Structure +#include "ares.h" + +/*! \addtogroup ares_array Array Data Structure * * This is an array with helpers. It is meant to have as little overhead * as possible over direct array management by applications but to provide @@ -36,17 +38,17 @@ * @{ */ -struct ares__array; +struct ares_array; /*! Opaque data structure for array */ -typedef struct ares__array ares__array_t; +typedef struct ares_array ares_array_t; /*! Callback to free user-defined member data * * \param[in] data pointer to member of array to be destroyed. The pointer * itself must not be destroyed, just the data it contains. */ -typedef void (*ares__array_destructor_t)(void *data); +typedef void (*ares_array_destructor_t)(void *data); /*! Callback to compare two array elements used for sorting * @@ -54,7 +56,7 @@ typedef void (*ares__array_destructor_t)(void *data); * \param[in] data2 array member 2 * \return < 0 if data1 < data2, > 0 if data1 > data2, 0 if data1 == data2 */ -typedef int (*ares__array_cmp_t)(const void *data1, const void *data2); +typedef int (*ares_array_cmp_t)(const void *data1, const void *data2); /*! Create an array object * @@ -72,8 +74,8 @@ typedef int (*ares__array_cmp_t)(const void *data1, const void *data2); * * \return array object or NULL on out of memory */ -ares__array_t *ares__array_create(size_t member_size, - ares__array_destructor_t destruct); +CARES_EXTERN ares_array_t *ares_array_create(size_t member_size, + ares_array_destructor_t destruct); /*! Request the array be at least the requested size. Useful if the desired @@ -83,7 +85,7 @@ ares__array_t *ares__array_create(size_t member_size, * \param[in] size Minimum number of members * \return ARES_SUCCESS on success, ARES_EFORMERR on misuse, * ARES_ENOMEM on out of memory */ -ares_status_t ares__array_set_size(ares__array_t *arr, size_t size); +CARES_EXTERN ares_status_t ares_array_set_size(ares_array_t *arr, size_t size); /*! Sort the array using the given comparison function. This is not * persistent, any future elements inserted will not maintain this sort. @@ -92,14 +94,15 @@ ares_status_t ares__array_set_size(ares__array_t *arr, size_t size); * \param[in] cb Sort callback * \return ARES_SUCCESS on success */ -ares_status_t ares__array_sort(ares__array_t *arr, ares__array_cmp_t cmp); +CARES_EXTERN ares_status_t ares_array_sort(ares_array_t *arr, + ares_array_cmp_t cmp); /*! Destroy an array object. If a destructor is set, will be called on each * member of the array. * * \param[in] arr Initialized array object. */ -void ares__array_destroy(ares__array_t *arr); +CARES_EXTERN void ares_array_destroy(ares_array_t *arr); /*! Retrieve the array in the native format. This will also destroy the * container. It is the responsibility of the caller to free the returned @@ -109,14 +112,14 @@ void ares__array_destroy(ares__array_t *arr); * \param[out] num_members the number of members in the returned array * \return pointer to native array on success, NULL on failure. */ -void *ares__array_finish(ares__array_t *arr, size_t *num_members); +CARES_EXTERN void *ares_array_finish(ares_array_t *arr, size_t *num_members); /*! Retrieve the number of members in the array * * \param[in] arr Initialized array object. * \return numbrer of members */ -size_t ares__array_len(const ares__array_t *arr); +CARES_EXTERN size_t ares_array_len(const ares_array_t *arr); /*! Insert a new array member at the given index * @@ -127,8 +130,8 @@ size_t ares__array_len(const ares__array_t *arr); * \return ARES_SUCCESS on success, ARES_EFORMERR on bad index, * ARES_ENOMEM on out of memory. */ -ares_status_t ares__array_insert_at(void **elem_ptr, ares__array_t *arr, - size_t idx); +CARES_EXTERN ares_status_t ares_array_insert_at(void **elem_ptr, + ares_array_t *arr, size_t idx); /*! Insert a new array member at the end of the array * @@ -136,7 +139,8 @@ ares_status_t ares__array_insert_at(void **elem_ptr, ares__array_t *arr, * \param[in] arr Initialized array object. * \return ARES_SUCCESS on success, ARES_ENOMEM on out of memory. */ -ares_status_t ares__array_insert_last(void **elem_ptr, ares__array_t *arr); +CARES_EXTERN ares_status_t ares_array_insert_last(void **elem_ptr, + ares_array_t *arr); /*! Insert a new array member at the beginning of the array * @@ -144,39 +148,87 @@ ares_status_t ares__array_insert_last(void **elem_ptr, ares__array_t *arr); * \param[in] arr Initialized array object. * \return ARES_SUCCESS on success, ARES_ENOMEM on out of memory. */ -ares_status_t ares__array_insert_first(void **elem_ptr, ares__array_t *arr); +CARES_EXTERN ares_status_t ares_array_insert_first(void **elem_ptr, + ares_array_t *arr); + + +/*! Insert a new array member at the given index and copy the data pointed + * to by the data pointer into the array. This will copy member_size bytes + * from the provided pointer, this may not be safe for some data types + * that may have a smaller size than the provided member_size which includes + * padding as discussed in ares_array_create(). + * + * \param[in] arr Initialized array object. + * \param[in] idx Index in array to place new element, will shift any + * elements down that exist after this point. + * \param[in] data_ptr Pointer to data to copy into array. + * \return ARES_SUCCESS on success, ARES_EFORMERR on bad index or null data + * ptr, ARES_ENOMEM on out of memory. + */ +CARES_EXTERN ares_status_t ares_array_insertdata_at(ares_array_t *arr, + size_t idx, + const void *data_ptr); + +/*! Insert a new array member at the end of the array and copy the data pointed + * to by the data pointer into the array. This will copy member_size bytes + * from the provided pointer, this may not be safe for some data types + * that may have a smaller size than the provided member_size which includes + * padding as discussed in ares_array_create(). + * + * \param[in] arr Initialized array object. + * \param[in] data_ptr Pointer to data to copy into array. + * \return ARES_SUCCESS on success, ARES_EFORMERR on bad index or null data + * ptr, ARES_ENOMEM on out of memory. + */ +CARES_EXTERN ares_status_t ares_array_insertdata_last(ares_array_t *arr, + const void *data_ptr); + +/*! Insert a new array member at the beginning of the array and copy the data + * pointed to by the data pointer into the array. This will copy member_size + * bytes from the provided pointer, this may not be safe for some data types + * that may have a smaller size than the provided member_size which includes + * padding as discussed in ares_array_create(). + * + * \param[in] arr Initialized array object. + * \param[in] data_ptr Pointer to data to copy into array. + * \return ARES_SUCCESS on success, ARES_EFORMERR on bad index or null data + * ptr, ARES_ENOMEM on out of memory. + */ +CARES_EXTERN ares_status_t ares_array_insertdata_first(ares_array_t *arr, + const void *data_ptr); /*! Fetch a pointer to the given element in the array * \param[in] array Initialized array object * \param[in] idx Index to fetch * \return pointer on success, NULL on failure */ -void *ares__array_at(ares__array_t *arr, size_t idx); +CARES_EXTERN void *ares_array_at(ares_array_t *arr, size_t idx); /*! Fetch a pointer to the first element in the array * \param[in] array Initialized array object * \return pointer on success, NULL on failure */ -void *ares__array_first(ares__array_t *arr); +CARES_EXTERN void *ares_array_first(ares_array_t *arr); /*! Fetch a pointer to the last element in the array * \param[in] array Initialized array object * \return pointer on success, NULL on failure */ -void *ares__array_last(ares__array_t *arr); +CARES_EXTERN void *ares_array_last(ares_array_t *arr); /*! Fetch a constant pointer to the given element in the array * \param[in] array Initialized array object * \param[in] idx Index to fetch * \return pointer on success, NULL on failure */ -const void *ares__array_at_const(const ares__array_t *arr, size_t idx); +CARES_EXTERN const void *ares_array_at_const(const ares_array_t *arr, + size_t idx); /*! Fetch a constant pointer to the first element in the array * \param[in] array Initialized array object * \return pointer on success, NULL on failure */ -const void *ares__array_first_const(const ares__array_t *arr); +CARES_EXTERN const void *ares_array_first_const(const ares_array_t *arr); /*! Fetch a constant pointer to the last element in the array * \param[in] array Initialized array object * \return pointer on success, NULL on failure */ -const void *ares__array_last_const(const ares__array_t *arr); +CARES_EXTERN const void *ares_array_last_const(const ares_array_t *arr); /*! Claim the data from the specified array index, copying it to the buffer * provided by the caller. The index specified in the array will then be @@ -187,13 +239,13 @@ const void *ares__array_last_const(const ares__array_t *arr); * member needs destructor if not provided. * \param[in] dest_size Size of buffer provided, used as a sanity check. * Must match member_size provided to - * ares__array_create() if dest_size specified. + * ares_array_create() if dest_size specified. * \param[in] arr Initialized array object * \param[in] idx Index to claim * \return ARES_SUCCESS on success, ARES_EFORMERR on usage failure. */ -ares_status_t ares__array_claim_at(void *dest, size_t dest_size, - ares__array_t *arr, size_t idx); +CARES_EXTERN ares_status_t ares_array_claim_at(void *dest, size_t dest_size, + ares_array_t *arr, size_t idx); /*! Remove the member at the specified array index. The destructor will be * called. @@ -202,21 +254,22 @@ ares_status_t ares__array_claim_at(void *dest, size_t dest_size, * \param[in] idx Index to remove * \return ARES_SUCCESS if removed, ARES_EFORMERR on invalid use */ -ares_status_t ares__array_remove_at(ares__array_t *arr, size_t idx); +CARES_EXTERN ares_status_t ares_array_remove_at(ares_array_t *arr, size_t idx); /*! Remove the first member of the array. * * \param[in] arr Initialized array object * \return ARES_SUCCESS if removed, ARES_EFORMERR on invalid use */ -ares_status_t ares__array_remove_first(ares__array_t *arr); +CARES_EXTERN ares_status_t ares_array_remove_first(ares_array_t *arr); /*! Remove the last member of the array. * * \param[in] arr Initialized array object * \return ARES_SUCCESS if removed, ARES_EFORMERR on invalid use */ -ares_status_t ares__array_remove_last(ares__array_t *arr); +CARES_EXTERN ares_status_t ares_array_remove_last(ares_array_t *arr); + /*! @} */ diff --git a/lib/c-ares-1.33.1/src/lib/str/ares__buf.h b/lib/c-ares-1.34.4/src/lib/include/ares_buf.h similarity index 57% rename from lib/c-ares-1.33.1/src/lib/str/ares__buf.h rename to lib/c-ares-1.34.4/src/lib/include/ares_buf.h index cb887aa27ed..10d29eaf83b 100644 --- a/lib/c-ares-1.33.1/src/lib/str/ares__buf.h +++ b/lib/c-ares-1.34.4/src/lib/include/ares_buf.h @@ -26,7 +26,10 @@ #ifndef __ARES__BUF_H #define __ARES__BUF_H -/*! \addtogroup ares__buf Safe Data Builder and buffer +#include "ares.h" +#include "ares_array.h" + +/*! \addtogroup ares_buf Safe Data Builder and buffer * * This is a buffer building and parsing framework with a focus on security over * performance. All data to be read from the buffer will perform explicit length @@ -42,16 +45,16 @@ * * @{ */ -struct ares__buf; +struct ares_buf; /*! Opaque data type for generic hash table implementation */ -typedef struct ares__buf ares__buf_t; +typedef struct ares_buf ares_buf_t; /*! Create a new buffer object that dynamically allocates buffers for data. * * \return initialized buffer object or NULL if out of memory. */ -ares__buf_t *ares__buf_create(void); +CARES_EXTERN ares_buf_t *ares_buf_create(void); /*! Create a new buffer object that uses a user-provided data pointer. The * data provided will not be manipulated, and cannot be appended to. This @@ -62,14 +65,15 @@ ares__buf_t *ares__buf_create(void); * * \return initialized buffer object or NULL if out of memory or misuse. */ -ares__buf_t *ares__buf_create_const(const unsigned char *data, size_t data_len); +CARES_EXTERN ares_buf_t *ares_buf_create_const(const unsigned char *data, + size_t data_len); /*! Destroy an initialized buffer object. * * \param[in] buf Initialized buf object */ -void ares__buf_destroy(ares__buf_t *buf); +CARES_EXTERN void ares_buf_destroy(ares_buf_t *buf); /*! Append multiple bytes to a dynamic buffer object @@ -79,8 +83,9 @@ void ares__buf_destroy(ares__buf_t *buf); * \param[in] data_len Length of data to copy to buffer object. * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_append(ares__buf_t *buf, const unsigned char *data, - size_t data_len); +CARES_EXTERN ares_status_t ares_buf_append(ares_buf_t *buf, + const unsigned char *data, + size_t data_len); /*! Append a single byte to the dynamic buffer object * @@ -88,7 +93,8 @@ ares_status_t ares__buf_append(ares__buf_t *buf, const unsigned char *data, * \param[in] b Single byte to append to buffer object. * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_append_byte(ares__buf_t *buf, unsigned char b); +CARES_EXTERN ares_status_t ares_buf_append_byte(ares_buf_t *buf, + unsigned char b); /*! Append a null-terminated string to the dynamic buffer object * @@ -96,7 +102,8 @@ ares_status_t ares__buf_append_byte(ares__buf_t *buf, unsigned char b); * \param[in] str String to append to buffer object. * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_append_str(ares__buf_t *buf, const char *str); +CARES_EXTERN ares_status_t ares_buf_append_str(ares_buf_t *buf, + const char *str); /*! Append a 16bit Big Endian number to the buffer. * @@ -104,7 +111,8 @@ ares_status_t ares__buf_append_str(ares__buf_t *buf, const char *str); * \param[out] u16 16bit integer * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_append_be16(ares__buf_t *buf, unsigned short u16); +CARES_EXTERN ares_status_t ares_buf_append_be16(ares_buf_t *buf, + unsigned short u16); /*! Append a 32bit Big Endian number to the buffer. * @@ -112,7 +120,8 @@ ares_status_t ares__buf_append_be16(ares__buf_t *buf, unsigned short u16); * \param[out] u32 32bit integer * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_append_be32(ares__buf_t *buf, unsigned int u32); +CARES_EXTERN ares_status_t ares_buf_append_be32(ares_buf_t *buf, + unsigned int u32); /*! Append a number in ASCII decimal form. * @@ -121,8 +130,8 @@ ares_status_t ares__buf_append_be32(ares__buf_t *buf, unsigned int u32); * \param[in] len Length to output, use 0 for no padding * \return ARES_SUCCESS on success */ -ares_status_t ares__buf_append_num_dec(ares__buf_t *buf, size_t num, - size_t len); +CARES_EXTERN ares_status_t ares_buf_append_num_dec(ares_buf_t *buf, size_t num, + size_t len); /*! Append a number in ASCII hexadecimal form. * @@ -131,8 +140,8 @@ ares_status_t ares__buf_append_num_dec(ares__buf_t *buf, size_t num, * \param[in] len Length to output, use 0 for no padding * \return ARES_SUCCESS on success */ -ares_status_t ares__buf_append_num_hex(ares__buf_t *buf, size_t num, - size_t len); +CARES_EXTERN ares_status_t ares_buf_append_num_hex(ares_buf_t *buf, size_t num, + size_t len); /*! Sets the current buffer length. This *may* be used if there is a need to * override a prior position in the buffer, such as if there is a length @@ -147,13 +156,13 @@ ares_status_t ares__buf_append_num_hex(ares__buf_t *buf, size_t num, * \param[in] len Length to set * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_set_length(ares__buf_t *buf, size_t len); +CARES_EXTERN ares_status_t ares_buf_set_length(ares_buf_t *buf, size_t len); /*! Start a dynamic append operation that returns a buffer suitable for * writing. A desired minimum length is passed in, and the actual allocated * buffer size is returned which may be greater than the requested size. - * No operation other than ares__buf_append_finish() is allowed on the + * No operation other than ares_buf_append_finish() is allowed on the * buffer after this request. * * \param[in] buf Initialized buffer object @@ -161,17 +170,17 @@ ares_status_t ares__buf_set_length(ares__buf_t *buf, size_t len); * returned. * \return Pointer to writable buffer or NULL on failure (usage, out of mem) */ -unsigned char *ares__buf_append_start(ares__buf_t *buf, size_t *len); +CARES_EXTERN unsigned char *ares_buf_append_start(ares_buf_t *buf, size_t *len); /*! Finish a dynamic append operation. Called after - * ares__buf_append_start() once desired data is written. + * ares_buf_append_start() once desired data is written. * * \param[in] buf Initialized buffer object. * \param[in] len Length of data written. May be zero to terminate * operation. Must not be greater than returned from - * ares__buf_append_start(). + * ares_buf_append_start(). */ -void ares__buf_append_finish(ares__buf_t *buf, size_t len); +CARES_EXTERN void ares_buf_append_finish(ares_buf_t *buf, size_t len); /*! Write the data provided to the buffer in a hexdump format. * @@ -180,10 +189,11 @@ void ares__buf_append_finish(ares__buf_t *buf, size_t len); * \param[in] len Length of data to hexdump * \return ARES_SUCCESS on success. */ -ares_status_t ares__buf_hexdump(ares__buf_t *buf, const unsigned char *data, - size_t len); +CARES_EXTERN ares_status_t ares_buf_hexdump(ares_buf_t *buf, + const unsigned char *data, + size_t len); -/*! Clean up ares__buf_t and return allocated pointer to unprocessed data. It +/*! Clean up ares_buf_t and return allocated pointer to unprocessed data. It * is the responsibility of the caller to ares_free() the returned buffer. * The passed in buf parameter is invalidated by this call. * @@ -191,9 +201,9 @@ ares_status_t ares__buf_hexdump(ares__buf_t *buf, const unsigned char *data, * \param[out] len Length of data returned * \return pointer to unprocessed data (may be zero length) or NULL on error. */ -unsigned char *ares__buf_finish_bin(ares__buf_t *buf, size_t *len); +CARES_EXTERN unsigned char *ares_buf_finish_bin(ares_buf_t *buf, size_t *len); -/*! Clean up ares__buf_t and return allocated pointer to unprocessed data and +/*! Clean up ares_buf_t and return allocated pointer to unprocessed data and * return it as a string (null terminated). It is the responsibility of the * caller to ares_free() the returned buffer. The passed in buf parameter is * invalidated by this call. @@ -207,7 +217,27 @@ unsigned char *ares__buf_finish_bin(ares__buf_t *buf, size_t *len); * \param[out] len Optional. Length of data returned, or NULL if not needed. * \return pointer to unprocessed data or NULL on error. */ -char *ares__buf_finish_str(ares__buf_t *buf, size_t *len); +CARES_EXTERN char *ares_buf_finish_str(ares_buf_t *buf, size_t *len); + +/*! Replace the given search byte sequence with the replacement byte sequence. + * This is only valid for allocated buffers, not const buffers. Will replace + * all byte sequences starting at the current offset to the end of the buffer. + * + * \param[in] buf Initialized buffer object. Can not be a "const" buffer. + * \param[in] srch Search byte sequence, must not be NULL. + * \param[in] srch_size Size of byte sequence, must not be zero. + * \param[in] rplc Byte sequence to use as replacement. May be NULL if + * rplc_size is zero. + * \param[in] rplc_size Size of replacement byte sequence, may be 0. + * \return ARES_SUCCESS on success, otherwise on may return failure only on + * memory allocation failure or misuse. Will not return indication + * if any replacements occurred + */ +CARES_EXTERN ares_status_t ares_buf_replace(ares_buf_t *buf, + const unsigned char *srch, + size_t srch_size, + const unsigned char *rplc, + size_t rplc_size); /*! Tag a position to save in the buffer in case parsing needs to rollback, * such as if insufficient data is available, but more data may be added in @@ -216,14 +246,14 @@ char *ares__buf_finish_str(ares__buf_t *buf, size_t *len); * * \param[in] buf Initialized buffer object */ -void ares__buf_tag(ares__buf_t *buf); +CARES_EXTERN void ares_buf_tag(ares_buf_t *buf); /*! Rollback to a tagged position. Will automatically clear the tag. * * \param[in] buf Initialized buffer object * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_tag_rollback(ares__buf_t *buf); +CARES_EXTERN ares_status_t ares_buf_tag_rollback(ares_buf_t *buf); /*! Clear the tagged position without rolling back. You should do this any * time a tag is no longer needed as future append operations can reclaim @@ -232,25 +262,26 @@ ares_status_t ares__buf_tag_rollback(ares__buf_t *buf); * \param[in] buf Initialized buffer object * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_tag_clear(ares__buf_t *buf); +CARES_EXTERN ares_status_t ares_buf_tag_clear(ares_buf_t *buf); /*! Fetch the buffer and length of data starting from the tagged position up * to the _current_ position. It will not unset the tagged position. The - * data may be invalidated by any future ares__buf_*() calls. + * data may be invalidated by any future ares_buf_*() calls. * * \param[in] buf Initialized buffer object * \param[out] len Length between tag and current offset in buffer * \return NULL on failure (such as no tag), otherwise pointer to start of * buffer */ -const unsigned char *ares__buf_tag_fetch(const ares__buf_t *buf, size_t *len); +CARES_EXTERN const unsigned char *ares_buf_tag_fetch(const ares_buf_t *buf, + size_t *len); /*! Get the length of the current tag offset to the current position. * * \param[in] buf Initialized buffer object * \return length */ -size_t ares__buf_tag_length(const ares__buf_t *buf); +CARES_EXTERN size_t ares_buf_tag_length(const ares_buf_t *buf); /*! Fetch the bytes starting from the tagged position up to the _current_ * position using the provided buffer. It will not unset the tagged position. @@ -261,23 +292,50 @@ size_t ares__buf_tag_length(const ares__buf_t *buf); * buffer. * \return ARES_SUCCESS if fetched, ARES_EFORMERR if insufficient buffer size */ -ares_status_t ares__buf_tag_fetch_bytes(const ares__buf_t *buf, - unsigned char *bytes, size_t *len); +CARES_EXTERN ares_status_t ares_buf_tag_fetch_bytes(const ares_buf_t *buf, + unsigned char *bytes, + size_t *len); /*! Fetch the bytes starting from the tagged position up to the _current_ * position as a NULL-terminated string using the provided buffer. The data * is validated to be ASCII-printable data. It will not unset the tagged - * poition. + * position. * * \param[in] buf Initialized buffer object * \param[in,out] str Buffer to hold data - * \param[in] len On input, buffer size, on output, bytes place in - * buffer. + * \param[in] len buffer size * \return ARES_SUCCESS if fetched, ARES_EFORMERR if insufficient buffer size, * ARES_EBADSTR if not printable ASCII */ -ares_status_t ares__buf_tag_fetch_string(const ares__buf_t *buf, char *str, - size_t len); +CARES_EXTERN ares_status_t ares_buf_tag_fetch_string(const ares_buf_t *buf, + char *str, size_t len); + +/*! Fetch the bytes starting from the tagged position up to the _current_ + * position as a NULL-terminated string and placed into a newly allocated + * buffer. The data is validated to be ASCII-printable data. It will not + * unset the tagged position. + * + * \param[in] buf Initialized buffer object + * \param[out] str New buffer to hold output, free with ares_free() + * + * \return ARES_SUCCESS if fetched, ARES_EFORMERR if insufficient buffer size, + * ARES_EBADSTR if not printable ASCII + */ +CARES_EXTERN ares_status_t ares_buf_tag_fetch_strdup(const ares_buf_t *buf, + char **str); + +/*! Fetch the bytes starting from the tagged position up to the _current_ + * position as const buffer. Care must be taken to not append or destroy the + * passed in buffer until the newly fetched buffer is no longer needed since + * it points to memory inside the passed in buffer which could be invalidated. + * + * \param[in] buf Initialized buffer object + * \param[out] newbuf New const buffer object, must be destroyed when done. + + * \return ARES_SUCCESS if fetched + */ +CARES_EXTERN ares_status_t ares_buf_tag_fetch_constbuf(const ares_buf_t *buf, + ares_buf_t **newbuf); /*! Consume the given number of bytes without reading them. * @@ -285,7 +343,7 @@ ares_status_t ares__buf_tag_fetch_string(const ares__buf_t *buf, char *str, * \param[in] len Length to consume * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_consume(ares__buf_t *buf, size_t len); +CARES_EXTERN ares_status_t ares_buf_consume(ares_buf_t *buf, size_t len); /*! Fetch a 16bit Big Endian number from the buffer. * @@ -293,7 +351,8 @@ ares_status_t ares__buf_consume(ares__buf_t *buf, size_t len); * \param[out] u16 Buffer to hold 16bit integer * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_fetch_be16(ares__buf_t *buf, unsigned short *u16); +CARES_EXTERN ares_status_t ares_buf_fetch_be16(ares_buf_t *buf, + unsigned short *u16); /*! Fetch a 32bit Big Endian number from the buffer. * @@ -301,7 +360,8 @@ ares_status_t ares__buf_fetch_be16(ares__buf_t *buf, unsigned short *u16); * \param[out] u32 Buffer to hold 32bit integer * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_fetch_be32(ares__buf_t *buf, unsigned int *u32); +CARES_EXTERN ares_status_t ares_buf_fetch_be32(ares_buf_t *buf, + unsigned int *u32); /*! Fetch the requested number of bytes into the provided buffer @@ -311,8 +371,9 @@ ares_status_t ares__buf_fetch_be32(ares__buf_t *buf, unsigned int *u32); * \param[in] len Requested number of bytes (must be > 0) * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_fetch_bytes(ares__buf_t *buf, unsigned char *bytes, - size_t len); +CARES_EXTERN ares_status_t ares_buf_fetch_bytes(ares_buf_t *buf, + unsigned char *bytes, + size_t len); /*! Fetch the requested number of bytes and return a new buffer that must be @@ -326,9 +387,9 @@ ares_status_t ares__buf_fetch_bytes(ares__buf_t *buf, unsigned char *bytes, * \param[out] bytes Pointer passed by reference. Will be allocated. * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_fetch_bytes_dup(ares__buf_t *buf, size_t len, - ares_bool_t null_term, - unsigned char **bytes); +CARES_EXTERN ares_status_t ares_buf_fetch_bytes_dup(ares_buf_t *buf, size_t len, + ares_bool_t null_term, + unsigned char **bytes); /*! Fetch the requested number of bytes and place them into the provided * dest buffer object. @@ -338,19 +399,21 @@ ares_status_t ares__buf_fetch_bytes_dup(ares__buf_t *buf, size_t len, * \param[in] len Requested number of bytes (must be > 0) * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_fetch_bytes_into_buf(ares__buf_t *buf, - ares__buf_t *dest, size_t len); +CARES_EXTERN ares_status_t ares_buf_fetch_bytes_into_buf(ares_buf_t *buf, + ares_buf_t *dest, + size_t len); /*! Fetch the requested number of bytes and return a new buffer that must be * ares_free()'d by the caller. The returned buffer is a null terminated - * string. + * string. The data is validated to be ASCII-printable. * * \param[in] buf Initialized buffer object * \param[in] len Requested number of bytes (must be > 0) * \param[out] str Pointer passed by reference. Will be allocated. * \return ARES_SUCCESS or one of the c-ares error codes */ -ares_status_t ares__buf_fetch_str_dup(ares__buf_t *buf, size_t len, char **str); +CARES_EXTERN ares_status_t ares_buf_fetch_str_dup(ares_buf_t *buf, size_t len, + char **str); /*! Consume whitespace characters (0x09, 0x0B, 0x0C, 0x0D, 0x20, and optionally * 0x0A). @@ -360,8 +423,8 @@ ares_status_t ares__buf_fetch_str_dup(ares__buf_t *buf, size_t len, char **str); * ARES_FALSE otherwise. * \return number of whitespace characters consumed */ -size_t ares__buf_consume_whitespace(ares__buf_t *buf, - ares_bool_t include_linefeed); +CARES_EXTERN size_t ares_buf_consume_whitespace(ares_buf_t *buf, + ares_bool_t include_linefeed); /*! Consume any non-whitespace character (anything other than 0x09, 0x0B, 0x0C, @@ -370,7 +433,7 @@ size_t ares__buf_consume_whitespace(ares__buf_t *buf, * \param[in] buf Initialized buffer object * \return number of characters consumed */ -size_t ares__buf_consume_nonwhitespace(ares__buf_t *buf); +CARES_EXTERN size_t ares_buf_consume_nonwhitespace(ares_buf_t *buf); /*! Consume until a character in the character set provided is reached. Does @@ -382,14 +445,32 @@ size_t ares__buf_consume_nonwhitespace(ares__buf_t *buf); * \param[in] require_charset require we find a character from the charset. * if ARES_FALSE it will simply consume the * rest of the buffer. If ARES_TRUE will return - * 0 if not found. + * SIZE_MAX if not found. * \return number of characters consumed */ -size_t ares__buf_consume_until_charset(ares__buf_t *buf, - const unsigned char *charset, size_t len, - ares_bool_t require_charset); +CARES_EXTERN size_t ares_buf_consume_until_charset(ares_buf_t *buf, + const unsigned char *charset, + size_t len, + ares_bool_t require_charset); +/*! Consume until a sequence of bytes is encountered. Does not include the + * sequence of characters itself. + * + * \param[in] buf Initialized buffer object + * \param[in] seq sequence of bytes + * \param[in] len length of sequence + * \param[in] require_charset require we find the sequence. + * if ARES_FALSE it will simply consume the + * rest of the buffer. If ARES_TRUE will return + * SIZE_MAX if not found. + * \return number of characters consumed + */ +CARES_EXTERN size_t ares_buf_consume_until_seq(ares_buf_t *buf, + const unsigned char *seq, + size_t len, + ares_bool_t require_seq); + /*! Consume while the characters match the characters in the provided set. * * \param[in] buf Initialized buffer object @@ -397,8 +478,9 @@ size_t ares__buf_consume_until_charset(ares__buf_t *buf, * \param[in] len length of character set * \return number of characters consumed */ -size_t ares__buf_consume_charset(ares__buf_t *buf, const unsigned char *charset, - size_t len); +CARES_EXTERN size_t ares_buf_consume_charset(ares_buf_t *buf, + const unsigned char *charset, + size_t len); /*! Consume from the current position until the end of the line, and optionally @@ -409,7 +491,8 @@ size_t ares__buf_consume_charset(ares__buf_t *buf, const unsigned char *charset, * ARES_FALSE otherwise. * \return number of characters consumed */ -size_t ares__buf_consume_line(ares__buf_t *buf, ares_bool_t include_linefeed); +CARES_EXTERN size_t ares_buf_consume_line(ares_buf_t *buf, + ares_bool_t include_linefeed); typedef enum { /*! No flags */ @@ -419,9 +502,9 @@ typedef enum { * incompatible with ARES_BUF_SPLIT_LTRIM since the delimiter is always * the first character. */ - ARES_BUF_SPLIT_DONT_CONSUME_DELIMS = 1 << 0, + ARES_BUF_SPLIT_KEEP_DELIMS = 1 << 0, /*! Allow blank sections, by default blank sections are not emitted. If using - * ARES_BUF_SPLIT_DONT_CONSUME_DELIMS, the delimiter is not counted as part + * ARES_BUF_SPLIT_KEEP_DELIMS, the delimiter is not counted as part * of the section */ ARES_BUF_SPLIT_ALLOW_BLANK = 1 << 1, /*! Remove duplicate entries */ @@ -434,7 +517,7 @@ typedef enum { ARES_BUF_SPLIT_RTRIM = 1 << 5, /*! Trim leading and trailing whitespace from buffer */ ARES_BUF_SPLIT_TRIM = (ARES_BUF_SPLIT_LTRIM | ARES_BUF_SPLIT_RTRIM) -} ares__buf_split_t; +} ares_buf_split_t; /*! Split the provided buffer into multiple sub-buffers stored in the variable * pointed to by the linked list. The sub buffers are const buffers pointing @@ -450,17 +533,60 @@ typedef enum { * character in the value. A value of 1 would * have little usefulness and would effectively * ignore the delimiter itself. - * \param[out] list Result. Depending on flags, this may be a - * valid list with no elements. Use - * ares__llist_destroy() to free the memory which - * will also free the contained ares__buf_t - * objects. + * \param[out] arr Result. Depending on flags, this may be a + * valid array with no elements. Use + * ares_array_destroy() to free the memory which + * will also free the contained ares_buf_t * + * objects. Each buf object returned by + * ares_array_at() or similar is a pointer to + * an ares_buf_t * object, meaning you need to + * accept it as "ares_buf_t **" then dereference. * \return ARES_SUCCESS on success, or error like ARES_ENOMEM. */ -ares_status_t ares__buf_split(ares__buf_t *buf, const unsigned char *delims, - size_t delims_len, ares__buf_split_t flags, - size_t max_sections, ares__llist_t **list); +CARES_EXTERN ares_status_t ares_buf_split( + ares_buf_t *buf, const unsigned char *delims, size_t delims_len, + ares_buf_split_t flags, size_t max_sections, ares_array_t **arr); +/*! Split the provided buffer into an ares_array_t of C strings. + * + * \param[in] buf Initialized buffer object + * \param[in] delims Possible delimiters + * \param[in] delims_len Length of possible delimiters + * \param[in] flags One more more flags + * \param[in] max_sections Maximum number of sections. Use 0 for + * unlimited. Useful for splitting key/value + * pairs where the delimiter may be a valid + * character in the value. A value of 1 would + * have little usefulness and would effectively + * ignore the delimiter itself. + * \param[out] arr Array of strings. Free using + * ares_array_destroy(). + * \return ARES_SUCCESS on success, or error like ARES_ENOMEM. + */ +CARES_EXTERN ares_status_t ares_buf_split_str_array( + ares_buf_t *buf, const unsigned char *delims, size_t delims_len, + ares_buf_split_t flags, size_t max_sections, ares_array_t **arr); + +/*! Split the provided buffer into a C array of C strings. + * + * \param[in] buf Initialized buffer object + * \param[in] delims Possible delimiters + * \param[in] delims_len Length of possible delimiters + * \param[in] flags One more more flags + * \param[in] max_sections Maximum number of sections. Use 0 for + * unlimited. Useful for splitting key/value + * pairs where the delimiter may be a valid + * character in the value. A value of 1 would + * have little usefulness and would effectively + * ignore the delimiter itself. + * \param[out] strs Array of strings. Free using + * ares_free_array(strs, nstrs, ares_free) + * \param[out] nstrs Number of elements in the array. + * \return ARES_SUCCESS on success, or error like ARES_ENOMEM. + */ +CARES_EXTERN ares_status_t ares_buf_split_str( + ares_buf_t *buf, const unsigned char *delims, size_t delims_len, + ares_buf_split_t flags, size_t max_sections, char ***strs, size_t *nstrs); /*! Check the unprocessed buffer to see if it begins with the sequence of * characters provided. @@ -470,8 +596,9 @@ ares_status_t ares__buf_split(ares__buf_t *buf, const unsigned char *delims, * \param[in] data_len Length of data to compare. * \return ARES_TRUE on match, ARES_FALSE otherwise. */ -ares_bool_t ares__buf_begins_with(const ares__buf_t *buf, - const unsigned char *data, size_t data_len); +CARES_EXTERN ares_bool_t ares_buf_begins_with(const ares_buf_t *buf, + const unsigned char *data, + size_t data_len); /*! Size of unprocessed remaining data length @@ -479,18 +606,27 @@ ares_bool_t ares__buf_begins_with(const ares__buf_t *buf, * \param[in] buf Initialized buffer object * \return length remaining */ -size_t ares__buf_len(const ares__buf_t *buf); +CARES_EXTERN size_t ares_buf_len(const ares_buf_t *buf); /*! Retrieve a pointer to the currently unprocessed data. Generally this isn't * recommended to be used in practice. The returned pointer may be invalidated - * by any future ares__buf_*() calls. + * by any future ares_buf_*() calls. * * \param[in] buf Initialized buffer object * \param[out] len Length of available data * \return Pointer to buffer of unprocessed data */ -const unsigned char *ares__buf_peek(const ares__buf_t *buf, size_t *len); +CARES_EXTERN const unsigned char *ares_buf_peek(const ares_buf_t *buf, + size_t *len); +/*! Retrieve the next byte in the buffer without moving forward. + * + * \param[in] buf Initialized buffer object + * \param[out] b Single byte + * \return \return ARES_SUCCESS on success, or error + */ +CARES_EXTERN ares_status_t ares_buf_peek_byte(const ares_buf_t *buf, + unsigned char *b); /*! Wipe any processed data from the beginning of the buffer. This will * move any remaining data to the front of the internally allocated buffer. @@ -503,46 +639,46 @@ const unsigned char *ares__buf_peek(const ares__buf_t *buf, size_t *len); * * It may be useful to call in order to ensure the current message being * processed is in the beginning of the buffer if there is an intent to use - * ares__buf_set_position() and ares__buf_get_position() as may be necessary + * ares_buf_set_position() and ares_buf_get_position() as may be necessary * when processing DNS compressed names. * * If there is an active tag, it will NOT clear the tag, it will use the tag * as the start of the unprocessed data rather than the current offset. If - * a prior tag is no longer needed, may be wise to call ares__buf_tag_clear(). + * a prior tag is no longer needed, may be wise to call ares_buf_tag_clear(). * * \param[in] buf Initialized buffer object */ -void ares__buf_reclaim(ares__buf_t *buf); +CARES_EXTERN void ares_buf_reclaim(ares_buf_t *buf); /*! Set the current offset within the internal buffer. * - * Typically this should not be used, if possible, use the ares__buf_tag*() + * Typically this should not be used, if possible, use the ares_buf_tag*() * operations instead. * * One exception is DNS name compression which may backwards reference to * an index in the message. It may be necessary in such a case to call - * ares__buf_reclaim() if using a dynamic (non-const) buffer before processing + * ares_buf_reclaim() if using a dynamic (non-const) buffer before processing * such a message. * * \param[in] buf Initialized buffer object * \param[in] idx Index to set position * \return ARES_SUCCESS if valid index */ -ares_status_t ares__buf_set_position(ares__buf_t *buf, size_t idx); +CARES_EXTERN ares_status_t ares_buf_set_position(ares_buf_t *buf, size_t idx); /*! Get the current offset within the internal buffer. * - * Typically this should not be used, if possible, use the ares__buf_tag*() + * Typically this should not be used, if possible, use the ares_buf_tag*() * operations instead. * * This can be used to get the current position, useful for saving if a - * jump via ares__buf_set_position() is performed and need to restore the + * jump via ares_buf_set_position() is performed and need to restore the * current position for future operations. * * \param[in] buf Initialized buffer object * \return index of current position */ -size_t ares__buf_get_position(const ares__buf_t *buf); +CARES_EXTERN size_t ares_buf_get_position(const ares_buf_t *buf); /*! Parse a character-string as defined in RFC1035, as a null-terminated * string. @@ -556,29 +692,9 @@ size_t ares__buf_get_position(const ares__buf_t *buf); * ares_free()'d by the caller. * \return ARES_SUCCESS on success */ -ares_status_t ares__buf_parse_dns_str(ares__buf_t *buf, size_t remaining_len, - char **name); - -/*! Parse an array of character strings as defined in RFC1035, as binary, - * however, for convenience this does guarantee a NULL terminator (that is - * not included in the length for each value). - * - * \param[in] buf initialized buffer object - * \param[in] remaining_len maximum length that should be used for - * parsing the string, this is often less than - * the remaining buffer and is based on the RR - * record length. - * \param[out] strs Pointer passed by reference to be filled in - * with - * the array of values. - * \param[out] validate_printable Validate the strings contain only printable - * data. - * \return ARES_SUCCESS on success - */ -ares_status_t ares__buf_parse_dns_abinstr(ares__buf_t *buf, - size_t remaining_len, - ares__dns_multistring_t **strs, - ares_bool_t validate_printable); +CARES_EXTERN ares_status_t ares_buf_parse_dns_str(ares_buf_t *buf, + size_t remaining_len, + char **name); /*! Parse a character-string as defined in RFC1035, as binary, however for * convenience this does guarantee a NULL terminator (that is not included @@ -594,8 +710,10 @@ ares_status_t ares__buf_parse_dns_abinstr(ares__buf_t *buf, * \param[out] bin_len Length of returned string. * \return ARES_SUCCESS on success */ -ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len, - unsigned char **bin, size_t *bin_len); +CARES_EXTERN ares_status_t ares_buf_parse_dns_binstr(ares_buf_t *buf, + size_t remaining_len, + unsigned char **bin, + size_t *bin_len); /*! Load data from specified file path into provided buffer. The entire file * is loaded into memory. @@ -606,7 +724,8 @@ ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len, * \return ARES_ENOTFOUND if file not found, ARES_EFILE if issues reading * file, ARES_ENOMEM if out of memory, ARES_SUCCESS on success. */ -ares_status_t ares__buf_load_file(const char *filename, ares__buf_t *buf); +CARES_EXTERN ares_status_t ares_buf_load_file(const char *filename, + ares_buf_t *buf); /*! @} */ diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_asvp.h b/lib/c-ares-1.34.4/src/lib/include/ares_htable_asvp.h similarity index 72% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable_asvp.h rename to lib/c-ares-1.34.4/src/lib/include/ares_htable_asvp.h index 49a766d0230..89a99fc9eec 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_asvp.h +++ b/lib/c-ares-1.34.4/src/lib/include/ares_htable_asvp.h @@ -26,10 +26,10 @@ #ifndef __ARES__HTABLE_ASVP_H #define __ARES__HTABLE_ASVP_H -/*! \addtogroup ares__htable_asvp HashTable with ares_socket_t Key and +/*! \addtogroup ares_htable_asvp HashTable with ares_socket_t Key and * void pointer Value * - * This data structure wraps the base ares__htable data structure in order to + * This data structure wraps the base ares_htable data structure in order to * split the key and value data types as ares_socket_t and void pointer, * respectively. * @@ -41,23 +41,23 @@ * @{ */ -struct ares__htable_asvp; +struct ares_htable_asvp; /*! Opaque data type for ares_socket_t key, void pointer hash table * implementation */ -typedef struct ares__htable_asvp ares__htable_asvp_t; +typedef struct ares_htable_asvp ares_htable_asvp_t; /*! Callback to free value stored in hashtable * * \param[in] val user-supplied value */ -typedef void (*ares__htable_asvp_val_free_t)(void *val); +typedef void (*ares_htable_asvp_val_free_t)(void *val); /*! Destroy hashtable * * \param[in] htable Initialized hashtable */ -void ares__htable_asvp_destroy(ares__htable_asvp_t *htable); +CARES_EXTERN void ares_htable_asvp_destroy(ares_htable_asvp_t *htable); /*! Create size_t key, void pointer value hash table * @@ -65,8 +65,8 @@ void ares__htable_asvp_destroy(ares__htable_asvp_t *htable); * NULL it is expected the caller will clean up any user * supplied values. */ -ares__htable_asvp_t * - ares__htable_asvp_create(ares__htable_asvp_val_free_t val_free); +CARES_EXTERN ares_htable_asvp_t * + ares_htable_asvp_create(ares_htable_asvp_val_free_t val_free); /*! Retrieve an array of keys from the hashtable. * @@ -74,8 +74,8 @@ ares__htable_asvp_t * * \param[out] num Count of returned keys * \return Array of keys in the hashtable. Must be free'd with ares_free(). */ -ares_socket_t *ares__htable_asvp_keys(const ares__htable_asvp_t *htable, - size_t *num); +CARES_EXTERN ares_socket_t * + ares_htable_asvp_keys(const ares_htable_asvp_t *htable, size_t *num); /*! Insert key/value into hash table @@ -85,8 +85,8 @@ ares_socket_t *ares__htable_asvp_keys(const ares__htable_asvp_t *htable, * \param[in] val value to store (takes ownership). May be NULL. * \return ARES_TRUE on success, ARES_FALSE on out of memory or misuse */ -ares_bool_t ares__htable_asvp_insert(ares__htable_asvp_t *htable, - ares_socket_t key, void *val); +CARES_EXTERN ares_bool_t ares_htable_asvp_insert(ares_htable_asvp_t *htable, + ares_socket_t key, void *val); /*! Retrieve value from hashtable based on key * @@ -95,19 +95,19 @@ ares_bool_t ares__htable_asvp_insert(ares__htable_asvp_t *htable, * \param[out] val Optional. Pointer to store value. * \return ARES_TRUE on success, ARES_FALSE on failure */ -ares_bool_t ares__htable_asvp_get(const ares__htable_asvp_t *htable, - ares_socket_t key, void **val); +CARES_EXTERN ares_bool_t ares_htable_asvp_get(const ares_htable_asvp_t *htable, + ares_socket_t key, void **val); /*! Retrieve value from hashtable directly as return value. Caveat to this - * function over ares__htable_asvp_get() is that if a NULL value is stored + * function over ares_htable_asvp_get() is that if a NULL value is stored * you cannot determine if the key is not found or the value is NULL. * * \param[in] htable Initialized hash table * \param[in] key key to use to search * \return value associated with key in hashtable or NULL */ -void *ares__htable_asvp_get_direct(const ares__htable_asvp_t *htable, - ares_socket_t key); +CARES_EXTERN void *ares_htable_asvp_get_direct(const ares_htable_asvp_t *htable, + ares_socket_t key); /*! Remove a value from the hashtable by key * @@ -115,15 +115,15 @@ void *ares__htable_asvp_get_direct(const ares__htable_asvp_t *htable, * \param[in] key key to use to search * \return ARES_TRUE if found, ARES_FALSE if not found */ -ares_bool_t ares__htable_asvp_remove(ares__htable_asvp_t *htable, - ares_socket_t key); +CARES_EXTERN ares_bool_t ares_htable_asvp_remove(ares_htable_asvp_t *htable, + ares_socket_t key); /*! Retrieve the number of keys stored in the hash table * * \param[in] htable Initialized hash table * \return count */ -size_t ares__htable_asvp_num_keys(const ares__htable_asvp_t *htable); +CARES_EXTERN size_t ares_htable_asvp_num_keys(const ares_htable_asvp_t *htable); /*! @} */ diff --git a/lib/c-ares-1.34.4/src/lib/include/ares_htable_dict.h b/lib/c-ares-1.34.4/src/lib/include/ares_htable_dict.h new file mode 100644 index 00000000000..cb6f1f048ca --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/include/ares_htable_dict.h @@ -0,0 +1,123 @@ +/* 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__HTABLE_DICT_H +#define __ARES__HTABLE_DICT_H + +/*! \addtogroup ares_htable_dict HashTable with case-insensitive string Key and + * string value + * + * This data structure wraps the base ares_htable data structure in order to + * split the key and value data types as string and string, respectively. + * + * Average time complexity: + * - Insert: O(1) + * - Search: O(1) + * - Delete: O(1) + * + * @{ + */ + +struct ares_htable_dict; + +/*! Opaque data type for string key, string value hash table + * implementation */ +typedef struct ares_htable_dict ares_htable_dict_t; + +/*! Destroy hashtable + * + * \param[in] htable Initialized hashtable + */ +CARES_EXTERN void ares_htable_dict_destroy(ares_htable_dict_t *htable); + +/*! Create void pointer key, string value hash table + * + */ +CARES_EXTERN ares_htable_dict_t *ares_htable_dict_create(void); + +/*! Insert key/value into hash table + * + * \param[in] htable Initialized hash table + * \param[in] key key to associate with value + * \param[in] val value to store (duplicates). + * \return ARES_TRUE on success, ARES_FALSE on failure or out of memory + */ +CARES_EXTERN ares_bool_t ares_htable_dict_insert(ares_htable_dict_t *htable, + const char *key, + const char *val); + +/*! Retrieve value from hashtable based on key + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \param[out] val Optional. Pointer to store value. + * \return ARES_TRUE on success, ARES_FALSE on failure + */ +CARES_EXTERN ares_bool_t ares_htable_dict_get(const ares_htable_dict_t *htable, + const char *key, + const char **val); + +/*! Retrieve value from hashtable directly as return value. Caveat to this + * function over ares_htable_dict_get() is that if a NULL value is stored + * you cannot determine if the key is not found or the value is NULL. + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return value associated with key in hashtable or NULL + */ +CARES_EXTERN const char * + ares_htable_dict_get_direct(const ares_htable_dict_t *htable, + const char *key); + +/*! Remove a value from the hashtable by key + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return ARES_TRUE if found, ARES_FALSE if not + */ +CARES_EXTERN ares_bool_t ares_htable_dict_remove(ares_htable_dict_t *htable, + const char *key); + +/*! Retrieve the number of keys stored in the hash table + * + * \param[in] htable Initialized hash table + * \return count + */ +CARES_EXTERN size_t ares_htable_dict_num_keys(const ares_htable_dict_t *htable); + +/*! Retrieve an array of keys from the hashtable. + * + * \param[in] htable Initialized hashtable + * \param[out] num Count of returned keys + * \return Array of keys in the hashtable. Must be free'd with + * ares_free_array(strs, num, ares_free); + */ +CARES_EXTERN char **ares_htable_dict_keys(const ares_htable_dict_t *htable, + size_t *num); + + +/*! @} */ + +#endif /* __ARES__HTABLE_DICT_H */ diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_strvp.h b/lib/c-ares-1.34.4/src/lib/include/ares_htable_strvp.h similarity index 66% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable_strvp.h rename to lib/c-ares-1.34.4/src/lib/include/ares_htable_strvp.h index 878c71869a9..eaaf6d3be0d 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_strvp.h +++ b/lib/c-ares-1.34.4/src/lib/include/ares_htable_strvp.h @@ -26,10 +26,10 @@ #ifndef __ARES__HTABLE_STRVP_H #define __ARES__HTABLE_STRVP_H -/*! \addtogroup ares__htable_strvp HashTable with string Key and void pointer +/*! \addtogroup ares_htable_strvp HashTable with string Key and void pointer * Value * - * This data structure wraps the base ares__htable data structure in order to + * This data structure wraps the base ares_htable data structure in order to * split the key and value data types as string and void pointer, respectively. * * Average time complexity: @@ -40,22 +40,22 @@ * @{ */ -struct ares__htable_strvp; +struct ares_htable_strvp; /*! Opaque data type for size_t key, void pointer hash table implementation */ -typedef struct ares__htable_strvp ares__htable_strvp_t; +typedef struct ares_htable_strvp ares_htable_strvp_t; /*! Callback to free value stored in hashtable * * \param[in] val user-supplied value */ -typedef void (*ares__htable_strvp_val_free_t)(void *val); +typedef void (*ares_htable_strvp_val_free_t)(void *val); /*! Destroy hashtable * * \param[in] htable Initialized hashtable */ -void ares__htable_strvp_destroy(ares__htable_strvp_t *htable); +CARES_EXTERN void ares_htable_strvp_destroy(ares_htable_strvp_t *htable); /*! Create string, void pointer value hash table * @@ -63,8 +63,8 @@ void ares__htable_strvp_destroy(ares__htable_strvp_t *htable); * NULL it is expected the caller will clean up any user * supplied values. */ -ares__htable_strvp_t * - ares__htable_strvp_create(ares__htable_strvp_val_free_t val_free); +CARES_EXTERN ares_htable_strvp_t * + ares_htable_strvp_create(ares_htable_strvp_val_free_t val_free); /*! Insert key/value into hash table * @@ -73,8 +73,8 @@ ares__htable_strvp_t * * \param[in] val value to store (takes ownership). May be NULL. * \return ARES_TRUE on success, ARES_FALSE on failure or out of memory */ -ares_bool_t ares__htable_strvp_insert(ares__htable_strvp_t *htable, - const char *key, void *val); +CARES_EXTERN ares_bool_t ares_htable_strvp_insert(ares_htable_strvp_t *htable, + const char *key, void *val); /*! Retrieve value from hashtable based on key * @@ -83,19 +83,20 @@ ares_bool_t ares__htable_strvp_insert(ares__htable_strvp_t *htable, * \param[out] val Optional. Pointer to store value. * \return ARES_TRUE on success, ARES_FALSE on failure */ -ares_bool_t ares__htable_strvp_get(const ares__htable_strvp_t *htable, - const char *key, void **val); +CARES_EXTERN ares_bool_t ares_htable_strvp_get( + const ares_htable_strvp_t *htable, const char *key, void **val); /*! Retrieve value from hashtable directly as return value. Caveat to this - * function over ares__htable_strvp_get() is that if a NULL value is stored + * function over ares_htable_strvp_get() is that if a NULL value is stored * you cannot determine if the key is not found or the value is NULL. * * \param[in] htable Initialized hash table * \param[in] key key to use to search * \return value associated with key in hashtable or NULL */ -void *ares__htable_strvp_get_direct(const ares__htable_strvp_t *htable, - const char *key); +CARES_EXTERN void * + ares_htable_strvp_get_direct(const ares_htable_strvp_t *htable, + const char *key); /*! Remove a value from the hashtable by key * @@ -103,15 +104,26 @@ void *ares__htable_strvp_get_direct(const ares__htable_strvp_t *htable, * \param[in] key key to use to search * \return ARES_TRUE if found, ARES_FALSE if not */ -ares_bool_t ares__htable_strvp_remove(ares__htable_strvp_t *htable, - const char *key); +CARES_EXTERN ares_bool_t ares_htable_strvp_remove(ares_htable_strvp_t *htable, + const char *key); + +/*! Remove the value from the hashtable, and return the value instead of + * calling the val_free passed to ares_htable_strvp_create(). + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return value in hashtable or NULL on error + */ +CARES_EXTERN void *ares_htable_strvp_claim(ares_htable_strvp_t *htable, + const char *key); /*! Retrieve the number of keys stored in the hash table * * \param[in] htable Initialized hash table * \return count */ -size_t ares__htable_strvp_num_keys(const ares__htable_strvp_t *htable); +CARES_EXTERN size_t + ares_htable_strvp_num_keys(const ares_htable_strvp_t *htable); /*! @} */ diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_szvp.h b/lib/c-ares-1.34.4/src/lib/include/ares_htable_szvp.h similarity index 72% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable_szvp.h rename to lib/c-ares-1.34.4/src/lib/include/ares_htable_szvp.h index 62b1776be92..927b9a5ec9f 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_szvp.h +++ b/lib/c-ares-1.34.4/src/lib/include/ares_htable_szvp.h @@ -26,10 +26,10 @@ #ifndef __ARES__HTABLE_STVP_H #define __ARES__HTABLE_STVP_H -/*! \addtogroup ares__htable_szvp HashTable with size_t Key and void pointer +/*! \addtogroup ares_htable_szvp HashTable with size_t Key and void pointer * Value * - * This data structure wraps the base ares__htable data structure in order to + * This data structure wraps the base ares_htable data structure in order to * split the key and value data types as size_t and void pointer, respectively. * * Average time complexity: @@ -40,22 +40,22 @@ * @{ */ -struct ares__htable_szvp; +struct ares_htable_szvp; /*! Opaque data type for size_t key, void pointer hash table implementation */ -typedef struct ares__htable_szvp ares__htable_szvp_t; +typedef struct ares_htable_szvp ares_htable_szvp_t; /*! Callback to free value stored in hashtable * * \param[in] val user-supplied value */ -typedef void (*ares__htable_szvp_val_free_t)(void *val); +typedef void (*ares_htable_szvp_val_free_t)(void *val); /*! Destroy hashtable * * \param[in] htable Initialized hashtable */ -void ares__htable_szvp_destroy(ares__htable_szvp_t *htable); +CARES_EXTERN void ares_htable_szvp_destroy(ares_htable_szvp_t *htable); /*! Create size_t key, void pointer value hash table * @@ -63,8 +63,8 @@ void ares__htable_szvp_destroy(ares__htable_szvp_t *htable); * NULL it is expected the caller will clean up any user * supplied values. */ -ares__htable_szvp_t * - ares__htable_szvp_create(ares__htable_szvp_val_free_t val_free); +CARES_EXTERN ares_htable_szvp_t * + ares_htable_szvp_create(ares_htable_szvp_val_free_t val_free); /*! Insert key/value into hash table * @@ -73,8 +73,8 @@ ares__htable_szvp_t * * \param[in] val value to store (takes ownership). May be NULL. * \return ARES_TRUE on success, ARES_FALSE on failure or out of memory */ -ares_bool_t ares__htable_szvp_insert(ares__htable_szvp_t *htable, size_t key, - void *val); +CARES_EXTERN ares_bool_t ares_htable_szvp_insert(ares_htable_szvp_t *htable, + size_t key, void *val); /*! Retrieve value from hashtable based on key * @@ -83,19 +83,19 @@ ares_bool_t ares__htable_szvp_insert(ares__htable_szvp_t *htable, size_t key, * \param[out] val Optional. Pointer to store value. * \return ARES_TRUE on success, ARES_FALSE on failure */ -ares_bool_t ares__htable_szvp_get(const ares__htable_szvp_t *htable, size_t key, - void **val); +CARES_EXTERN ares_bool_t ares_htable_szvp_get(const ares_htable_szvp_t *htable, + size_t key, void **val); /*! Retrieve value from hashtable directly as return value. Caveat to this - * function over ares__htable_szvp_get() is that if a NULL value is stored + * function over ares_htable_szvp_get() is that if a NULL value is stored * you cannot determine if the key is not found or the value is NULL. * * \param[in] htable Initialized hash table * \param[in] key key to use to search * \return value associated with key in hashtable or NULL */ -void *ares__htable_szvp_get_direct(const ares__htable_szvp_t *htable, - size_t key); +CARES_EXTERN void *ares_htable_szvp_get_direct(const ares_htable_szvp_t *htable, + size_t key); /*! Remove a value from the hashtable by key * @@ -103,14 +103,15 @@ void *ares__htable_szvp_get_direct(const ares__htable_szvp_t *htable, * \param[in] key key to use to search * \return ARES_TRUE if found, ARES_FALSE if not */ -ares_bool_t ares__htable_szvp_remove(ares__htable_szvp_t *htable, size_t key); +CARES_EXTERN ares_bool_t ares_htable_szvp_remove(ares_htable_szvp_t *htable, + size_t key); /*! Retrieve the number of keys stored in the hash table * * \param[in] htable Initialized hash table * \return count */ -size_t ares__htable_szvp_num_keys(const ares__htable_szvp_t *htable); +CARES_EXTERN size_t ares_htable_szvp_num_keys(const ares_htable_szvp_t *htable); /*! @} */ diff --git a/lib/c-ares-1.34.4/src/lib/include/ares_htable_vpstr.h b/lib/c-ares-1.34.4/src/lib/include/ares_htable_vpstr.h new file mode 100644 index 00000000000..9f51b877452 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/include/ares_htable_vpstr.h @@ -0,0 +1,111 @@ +/* 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__HTABLE_VPSTR_H +#define __ARES__HTABLE_VPSTR_H + +/*! \addtogroup ares_htable_vpstr HashTable with void pointer Key and string + * value + * + * This data structure wraps the base ares_htable data structure in order to + * split the key and value data types as void pointer and string, respectively. + * + * Average time complexity: + * - Insert: O(1) + * - Search: O(1) + * - Delete: O(1) + * + * @{ + */ + +struct ares_htable_vpstr; + +/*! Opaque data type for void pointer key, string value hash table + * implementation */ +typedef struct ares_htable_vpstr ares_htable_vpstr_t; + +/*! Destroy hashtable + * + * \param[in] htable Initialized hashtable + */ +CARES_EXTERN void ares_htable_vpstr_destroy(ares_htable_vpstr_t *htable); + +/*! Create void pointer key, string value hash table + * + */ +CARES_EXTERN ares_htable_vpstr_t *ares_htable_vpstr_create(void); + +/*! Insert key/value into hash table + * + * \param[in] htable Initialized hash table + * \param[in] key key to associate with value + * \param[in] val value to store (duplicates). + * \return ARES_TRUE on success, ARES_FALSE on failure or out of memory + */ +CARES_EXTERN ares_bool_t ares_htable_vpstr_insert(ares_htable_vpstr_t *htable, + void *key, const char *val); + +/*! Retrieve value from hashtable based on key + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \param[out] val Optional. Pointer to store value. + * \return ARES_TRUE on success, ARES_FALSE on failure + */ +CARES_EXTERN ares_bool_t ares_htable_vpstr_get( + const ares_htable_vpstr_t *htable, const void *key, const char **val); + +/*! Retrieve value from hashtable directly as return value. Caveat to this + * function over ares_htable_vpstr_get() is that if a NULL value is stored + * you cannot determine if the key is not found or the value is NULL. + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return value associated with key in hashtable or NULL + */ +CARES_EXTERN const char * + ares_htable_vpstr_get_direct(const ares_htable_vpstr_t *htable, + const void *key); + +/*! Remove a value from the hashtable by key + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return ARES_TRUE if found, ARES_FALSE if not + */ +CARES_EXTERN ares_bool_t ares_htable_vpstr_remove(ares_htable_vpstr_t *htable, + const void *key); + +/*! Retrieve the number of keys stored in the hash table + * + * \param[in] htable Initialized hash table + * \return count + */ +CARES_EXTERN size_t + ares_htable_vpstr_num_keys(const ares_htable_vpstr_t *htable); + +/*! @} */ + +#endif /* __ARES__HTABLE_VPSTR_H */ diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_vpvp.h b/lib/c-ares-1.34.4/src/lib/include/ares_htable_vpvp.h similarity index 72% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__htable_vpvp.h rename to lib/c-ares-1.34.4/src/lib/include/ares_htable_vpvp.h index 1e0c750d862..1ebe6145765 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__htable_vpvp.h +++ b/lib/c-ares-1.34.4/src/lib/include/ares_htable_vpvp.h @@ -26,10 +26,10 @@ #ifndef __ARES__HTABLE_VPVP_H #define __ARES__HTABLE_VPVP_H -/*! \addtogroup ares__htable_vpvp HashTable with void pointer Key and void +/*! \addtogroup ares_htable_vpvp HashTable with void pointer Key and void * pointer Value * - * This data structure wraps the base ares__htable data structure in order to + * This data structure wraps the base ares_htable data structure in order to * split the key and value data types as size_t and void pointer, respectively. * * Average time complexity: @@ -40,28 +40,28 @@ * @{ */ -struct ares__htable_vpvp; +struct ares_htable_vpvp; /*! Opaque data type for size_t key, void pointer hash table implementation */ -typedef struct ares__htable_vpvp ares__htable_vpvp_t; +typedef struct ares_htable_vpvp ares_htable_vpvp_t; /*! Callback to free key stored in hashtable * * \param[in] key user-supplied key */ -typedef void (*ares__htable_vpvp_key_free_t)(void *key); +typedef void (*ares_htable_vpvp_key_free_t)(void *key); /*! Callback to free value stored in hashtable * * \param[in] val user-supplied value */ -typedef void (*ares__htable_vpvp_val_free_t)(void *val); +typedef void (*ares_htable_vpvp_val_free_t)(void *val); /*! Destroy hashtable * * \param[in] htable Initialized hashtable */ -void ares__htable_vpvp_destroy(ares__htable_vpvp_t *htable); +CARES_EXTERN void ares_htable_vpvp_destroy(ares_htable_vpvp_t *htable); /*! Create size_t key, void pointer value hash table * @@ -72,9 +72,9 @@ void ares__htable_vpvp_destroy(ares__htable_vpvp_t *htable); * NULL it is expected the caller will clean up any user * supplied values. */ -ares__htable_vpvp_t * - ares__htable_vpvp_create(ares__htable_vpvp_key_free_t key_free, - ares__htable_vpvp_val_free_t val_free); +CARES_EXTERN ares_htable_vpvp_t * + ares_htable_vpvp_create(ares_htable_vpvp_key_free_t key_free, + ares_htable_vpvp_val_free_t val_free); /*! Insert key/value into hash table * @@ -83,8 +83,8 @@ ares__htable_vpvp_t * * \param[in] val value to store (takes ownership). May be NULL. * \return ARES_TRUE on success, ARES_FALSE on failure or out of memory */ -ares_bool_t ares__htable_vpvp_insert(ares__htable_vpvp_t *htable, void *key, - void *val); +CARES_EXTERN ares_bool_t ares_htable_vpvp_insert(ares_htable_vpvp_t *htable, + void *key, void *val); /*! Retrieve value from hashtable based on key * @@ -93,19 +93,19 @@ ares_bool_t ares__htable_vpvp_insert(ares__htable_vpvp_t *htable, void *key, * \param[out] val Optional. Pointer to store value. * \return ARES_TRUE on success, ARES_FALSE on failure */ -ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable, - const void *key, void **val); +CARES_EXTERN ares_bool_t ares_htable_vpvp_get(const ares_htable_vpvp_t *htable, + const void *key, void **val); /*! Retrieve value from hashtable directly as return value. Caveat to this - * function over ares__htable_vpvp_get() is that if a NULL value is stored + * function over ares_htable_vpvp_get() is that if a NULL value is stored * you cannot determine if the key is not found or the value is NULL. * * \param[in] htable Initialized hash table * \param[in] key key to use to search * \return value associated with key in hashtable or NULL */ -void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable, - const void *key); +CARES_EXTERN void *ares_htable_vpvp_get_direct(const ares_htable_vpvp_t *htable, + const void *key); /*! Remove a value from the hashtable by key * @@ -113,15 +113,15 @@ void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable, * \param[in] key key to use to search * \return ARES_TRUE if found, ARES_FALSE if not */ -ares_bool_t ares__htable_vpvp_remove(ares__htable_vpvp_t *htable, - const void *key); +CARES_EXTERN ares_bool_t ares_htable_vpvp_remove(ares_htable_vpvp_t *htable, + const void *key); /*! Retrieve the number of keys stored in the hash table * * \param[in] htable Initialized hash table * \return count */ -size_t ares__htable_vpvp_num_keys(const ares__htable_vpvp_t *htable); +CARES_EXTERN size_t ares_htable_vpvp_num_keys(const ares_htable_vpvp_t *htable); /*! @} */ diff --git a/lib/c-ares-1.33.1/src/lib/dsa/ares__llist.h b/lib/c-ares-1.34.4/src/lib/include/ares_llist.h similarity index 68% rename from lib/c-ares-1.33.1/src/lib/dsa/ares__llist.h rename to lib/c-ares-1.34.4/src/lib/include/ares_llist.h index 213f54134bc..6aa0c783704 100644 --- a/lib/c-ares-1.33.1/src/lib/dsa/ares__llist.h +++ b/lib/c-ares-1.34.4/src/lib/include/ares_llist.h @@ -26,7 +26,7 @@ #ifndef __ARES__LLIST_H #define __ARES__LLIST_H -/*! \addtogroup ares__llist LinkedList Data Structure +/*! \addtogroup ares_llist LinkedList Data Structure * * This is a doubly-linked list data structure. * @@ -38,28 +38,28 @@ * @{ */ -struct ares__llist; +struct ares_llist; /*! Opaque data structure for linked list */ -typedef struct ares__llist ares__llist_t; +typedef struct ares_llist ares_llist_t; -struct ares__llist_node; +struct ares_llist_node; /*! Opaque data structure for a node in a linked list */ -typedef struct ares__llist_node ares__llist_node_t; +typedef struct ares_llist_node ares_llist_node_t; /*! Callback to free user-defined node data * * \param[in] data user supplied data */ -typedef void (*ares__llist_destructor_t)(void *data); +typedef void (*ares_llist_destructor_t)(void *data); /*! Create a linked list object * * \param[in] destruct Optional. Destructor to call on all removed nodes * \return linked list object or NULL on out of memory */ -ares__llist_t *ares__llist_create(ares__llist_destructor_t destruct); +CARES_EXTERN ares_llist_t *ares_llist_create(ares_llist_destructor_t destruct); /*! Replace destructor for linked list nodes. Typically this is used * when wanting to disable the destructor by using NULL. @@ -67,8 +67,9 @@ ares__llist_t *ares__llist_create(ares__llist_destructor_t destruct); * \param[in] list Initialized linked list object * \param[in] destruct replacement destructor, NULL is allowed */ -void ares__llist_replace_destructor(ares__llist_t *list, - ares__llist_destructor_t destruct); +CARES_EXTERN void + ares_llist_replace_destructor(ares_llist_t *list, + ares_llist_destructor_t destruct); /*! Insert value as the first node in the linked list * @@ -77,7 +78,8 @@ void ares__llist_replace_destructor(ares__llist_t *list * \return node object referencing place in list, or null if out of memory or * misuse */ -ares__llist_node_t *ares__llist_insert_first(ares__llist_t *list, void *val); +CARES_EXTERN ares_llist_node_t *ares_llist_insert_first(ares_llist_t *list, + void *val); /*! Insert value as the last node in the linked list * @@ -86,7 +88,8 @@ ares__llist_node_t *ares__llist_insert_first(ares__llist_t *list, void *val); * \return node object referencing place in list, or null if out of memory or * misuse */ -ares__llist_node_t *ares__llist_insert_last(ares__llist_t *list, void *val); +CARES_EXTERN ares_llist_node_t *ares_llist_insert_last(ares_llist_t *list, + void *val); /*! Insert value before specified node in the linked list * @@ -95,8 +98,8 @@ ares__llist_node_t *ares__llist_insert_last(ares__llist_t *list, void *val); * \return node object referencing place in list, or null if out of memory or * misuse */ -ares__llist_node_t *ares__llist_insert_before(ares__llist_node_t *node, - void *val); +CARES_EXTERN ares_llist_node_t * + ares_llist_insert_before(ares_llist_node_t *node, void *val); /*! Insert value after specified node in the linked list * @@ -105,22 +108,22 @@ ares__llist_node_t *ares__llist_insert_before(ares__llist_node_t *node, * \return node object referencing place in list, or null if out of memory or * misuse */ -ares__llist_node_t *ares__llist_insert_after(ares__llist_node_t *node, - void *val); +CARES_EXTERN ares_llist_node_t *ares_llist_insert_after(ares_llist_node_t *node, + void *val); /*! Obtain first node in list * * \param[in] list Initialized list object * \return first node in list or NULL if none */ -ares__llist_node_t *ares__llist_node_first(ares__llist_t *list); +CARES_EXTERN ares_llist_node_t *ares_llist_node_first(ares_llist_t *list); /*! Obtain last node in list * * \param[in] list Initialized list object * \return last node in list or NULL if none */ -ares__llist_node_t *ares__llist_node_last(ares__llist_t *list); +CARES_EXTERN ares_llist_node_t *ares_llist_node_last(ares_llist_t *list); /*! Obtain a node based on its index. This is an O(n) operation. * @@ -128,21 +131,22 @@ ares__llist_node_t *ares__llist_node_last(ares__llist_t *list); * \param[in] idx Index of node to retrieve * \return node at index or NULL if invalid index */ -ares__llist_node_t *ares__llist_node_idx(ares__llist_t *list, size_t idx); +CARES_EXTERN ares_llist_node_t *ares_llist_node_idx(ares_llist_t *list, + size_t idx); /*! Obtain next node in respect to specified node * * \param[in] node Node referenced * \return node or NULL if none */ -ares__llist_node_t *ares__llist_node_next(ares__llist_node_t *node); +CARES_EXTERN ares_llist_node_t *ares_llist_node_next(ares_llist_node_t *node); /*! Obtain previous node in respect to specified node * * \param[in] node Node referenced * \return node or NULL if none */ -ares__llist_node_t *ares__llist_node_prev(ares__llist_node_t *node); +CARES_EXTERN ares_llist_node_t *ares_llist_node_prev(ares_llist_node_t *node); /*! Obtain value from node @@ -150,41 +154,41 @@ ares__llist_node_t *ares__llist_node_prev(ares__llist_node_t *node); * \param[in] node Node referenced * \return user provided value from node */ -void *ares__llist_node_val(ares__llist_node_t *node); +CARES_EXTERN void *ares_llist_node_val(ares_llist_node_t *node); /*! Obtain the number of entries in the list * * \param[in] list Initialized list object * \return count */ -size_t ares__llist_len(const ares__llist_t *list); +CARES_EXTERN size_t ares_llist_len(const ares_llist_t *list); /*! Clear all entries in the list, but don't destroy the list object. * * \param[in] list Initialized list object */ -void ares__llist_clear(ares__llist_t *list); +CARES_EXTERN void ares_llist_clear(ares_llist_t *list); /*! Obtain list object from referenced node * * \param[in] node Node referenced * \return list object node belongs to */ -ares__llist_t *ares__llist_node_parent(ares__llist_node_t *node); +CARES_EXTERN ares_llist_t *ares_llist_node_parent(ares_llist_node_t *node); /*! Obtain the first user-supplied value in the list * * \param[in] list Initialized list object * \return first user supplied value or NULL if none */ -void *ares__llist_first_val(ares__llist_t *list); +CARES_EXTERN void *ares_llist_first_val(ares_llist_t *list); /*! Obtain the last user-supplied value in the list * * \param[in] list Initialized list object * \return last user supplied value or NULL if none */ -void *ares__llist_last_val(ares__llist_t *list); +CARES_EXTERN void *ares_llist_last_val(ares_llist_t *list); /*! Take ownership of user-supplied value in list without calling destructor. * Will unchain entry from list. @@ -192,26 +196,26 @@ void *ares__llist_last_val(ares__llist_t *list); * \param[in] node Node referenced * \return user supplied value */ -void *ares__llist_node_claim(ares__llist_node_t *node); +CARES_EXTERN void *ares_llist_node_claim(ares_llist_node_t *node); /*! Replace user-supplied value for node * * \param[in] node Node referenced * \param[in] val new user-supplied value */ -void ares__llist_node_replace(ares__llist_node_t *node, void *val); +CARES_EXTERN void ares_llist_node_replace(ares_llist_node_t *node, void *val); /*! Destroy the node, removing it from the list and calling destructor. * * \param[in] node Node referenced */ -void ares__llist_node_destroy(ares__llist_node_t *node); +CARES_EXTERN void ares_llist_node_destroy(ares_llist_node_t *node); /*! Destroy the list object and all nodes in the list. * * \param[in] list Initialized list object */ -void ares__llist_destroy(ares__llist_t *list); +CARES_EXTERN void ares_llist_destroy(ares_llist_t *list); /*! Detach node from the current list and re-attach it to the new list as the * last entry. @@ -219,8 +223,8 @@ void ares__llist_destroy(ares__llist_t *list); * \param[in] node node to move * \param[in] new_parent new list */ -void ares__llist_node_move_parent_last(ares__llist_node_t *node, - ares__llist_t *new_parent); +CARES_EXTERN void ares_llist_node_mvparent_last(ares_llist_node_t *node, + ares_llist_t *new_parent); /*! Detach node from the current list and re-attach it to the new list as the * first entry. @@ -228,8 +232,8 @@ void ares__llist_node_move_parent_last(ares__llist_node_t *node, * \param[in] node node to move * \param[in] new_parent new list */ -void ares__llist_node_move_parent_first(ares__llist_node_t *node, - ares__llist_t *new_parent); +CARES_EXTERN void ares_llist_node_mvparent_first(ares_llist_node_t *node, + ares_llist_t *new_parent); /*! @} */ #endif /* __ARES__LLIST_H */ diff --git a/lib/c-ares-1.33.1/src/lib/str/ares_strcasecmp.h b/lib/c-ares-1.34.4/src/lib/include/ares_mem.h similarity index 75% rename from lib/c-ares-1.33.1/src/lib/str/ares_strcasecmp.h rename to lib/c-ares-1.34.4/src/lib/include/ares_mem.h index a8097d2219e..371cd4266dc 100644 --- a/lib/c-ares-1.33.1/src/lib/str/ares_strcasecmp.h +++ b/lib/c-ares-1.34.4/src/lib/include/ares_mem.h @@ -1,6 +1,5 @@ /* MIT License * - * Copyright (c) 1998 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 @@ -24,15 +23,16 @@ * * SPDX-License-Identifier: MIT */ -#ifndef HEADER_CARES_STRCASECMP_H -#define HEADER_CARES_STRCASECMP_H -#ifndef HAVE_STRCASECMP -extern int ares_strcasecmp(const char *a, const char *b); -#endif +#ifndef __ARES_MEM_H +#define __ARES_MEM_H -#ifndef HAVE_STRNCASECMP -extern int ares_strncasecmp(const char *a, const char *b, size_t n); -#endif +/* Memory management functions */ +CARES_EXTERN void *ares_malloc(size_t size); +CARES_EXTERN void *ares_realloc(void *ptr, size_t size); +CARES_EXTERN void ares_free(void *ptr); +CARES_EXTERN void *ares_malloc_zero(size_t size); +CARES_EXTERN void *ares_realloc_zero(void *ptr, size_t orig_size, + size_t new_size); -#endif /* HEADER_CARES_STRCASECMP_H */ +#endif diff --git a/lib/c-ares-1.34.4/src/lib/include/ares_str.h b/lib/c-ares-1.34.4/src/lib/include/ares_str.h new file mode 100644 index 00000000000..4ee339510bf --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/include/ares_str.h @@ -0,0 +1,244 @@ +/* MIT License + * + * Copyright (c) 1998 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 + */ +#ifndef __ARES_STR_H +#define __ARES_STR_H + +CARES_EXTERN char *ares_strdup(const char *s1); + +/*! Scan up to maxlen bytes for the first NULL character and return + * its index, or maxlen if not found. The function only returns + * maxlen if the first maxlen bytes were not NULL characters; it + * makes no guarantee for what \c str[maxlen] (if defined) is, and + * does not access it. It is behaving like the POSIX \c strnlen() + * function, except that it returns 0 if the \p str pointer is \c + * NULL. + * + * \param[in] str The string to scan for the NULL character + * \param[in] maxlen The maximum number of bytes to scan + * \return Index of first NULL byte. Between 0 and maxlen (inclusive). + */ +CARES_EXTERN size_t ares_strnlen(const char *str, size_t maxlen); + +CARES_EXTERN size_t ares_strlen(const char *str); + +/*! Copy string from source to destination with destination buffer size + * provided. The destination is guaranteed to be null terminated, if the + * provided buffer isn't large enough, only those bytes from the source that + * will fit will be copied. + * + * \param[out] dest Destination buffer + * \param[in] src Source to copy + * \param[in] dest_size Size of destination buffer + * \return String length. Will be at most dest_size-1 + */ +CARES_EXTERN size_t ares_strcpy(char *dest, const char *src, size_t dest_size); + +CARES_EXTERN ares_bool_t ares_str_isnum(const char *str); +CARES_EXTERN ares_bool_t ares_str_isalnum(const char *str); + +CARES_EXTERN void ares_str_ltrim(char *str); +CARES_EXTERN void ares_str_rtrim(char *str); +CARES_EXTERN void ares_str_trim(char *str); +CARES_EXTERN void ares_str_lower(char *str); + +CARES_EXTERN unsigned char ares_tolower(unsigned char c); +CARES_EXTERN unsigned char *ares_memmem(const unsigned char *big, + size_t big_len, + const unsigned char *little, + size_t little_len); +CARES_EXTERN ares_bool_t ares_memeq(const unsigned char *ptr, + const unsigned char *val, size_t len); +CARES_EXTERN ares_bool_t ares_memeq_ci(const unsigned char *ptr, + const unsigned char *val, size_t len); +CARES_EXTERN ares_bool_t ares_is_hostname(const char *str); + +/*! Validate the string provided is printable. The length specified must be + * at least the size of the buffer provided. If a NULL-terminator is hit + * before the length provided is hit, this will not be considered a valid + * printable string. This does not validate that the string is actually + * NULL terminated. + * + * \param[in] str Buffer containing string to evaluate. + * \param[in] len Number of characters to evaluate within provided buffer. + * If 0, will return TRUE since it did not hit an exception. + * \return ARES_TRUE if the entire string is printable, ARES_FALSE if not. + */ +CARES_EXTERN ares_bool_t ares_str_isprint(const char *str, size_t len); + +/* We only care about ASCII rules */ +#define ares_isascii(x) (((unsigned char)x) <= 127) + +#define ares_isdigit(x) (((unsigned char)x) >= '0' && ((unsigned char)x) <= '9') + +#define ares_isxdigit(x) \ + (ares_isdigit(x) || \ + (((unsigned char)x) >= 'a' && ((unsigned char)x) <= 'f') || \ + (((unsigned char)x) >= 'A' && ((unsigned char)x) <= 'F')) + +#define ares_isupper(x) (((unsigned char)x) >= 'A' && ((unsigned char)x) <= 'Z') + +#define ares_islower(x) (((unsigned char)x) >= 'a' && ((unsigned char)x) <= 'z') + +#define ares_isalpha(x) (ares_islower(x) || ares_isupper(x)) + +#define ares_isspace(x) \ + (((unsigned char)(x)) == '\r' || ((unsigned char)(x)) == '\t' || \ + ((unsigned char)(x)) == ' ' || ((unsigned char)(x)) == '\v' || \ + ((unsigned char)(x)) == '\f' || ((unsigned char)(x)) == '\n') + +#define ares_isprint(x) \ + (((unsigned char)(x)) >= 0x20 && ((unsigned char)(x)) <= 0x7E) + +/* Character set allowed by hostnames. This is to include the normal + * domain name character set plus: + * - underscores which are used in SRV records. + * - Forward slashes such as are used for classless in-addr.arpa + * delegation (CNAMEs) + * - Asterisks may be used for wildcard domains in CNAMEs as seen in the + * real world. + * While RFC 2181 section 11 does state not to do validation, + * that applies to servers, not clients. Vulnerabilities have been + * reported when this validation is not performed. Security is more + * important than edge-case compatibility (which is probably invalid + * anyhow). + * [A-Za-z0-9-*._/] + */ +#define ares_is_hostnamech(x) \ + (ares_isalpha(x) || ares_isdigit(x) || ((unsigned char)(x)) == '-' || \ + ((unsigned char)(x)) == '.' || ((unsigned char)(x)) == '_' || \ + ((unsigned char)(x)) == '/' || ((unsigned char)(x)) == '*') + + +/*! Compare two strings (for sorting) + * + * Treats NULL and "" strings as equivalent + * + * \param[in] a First String + * \param[in] b Second String + * \return < 0 if First String less than Second String, + * 0 if First String equal to Second String, + * > 0 if First String greater than Second String + */ +CARES_EXTERN int ares_strcmp(const char *a, const char *b); + +/*! Compare two strings up to specified length (for sorting) + * + * Treats NULL and "" strings as equivalent + * + * \param[in] a First String + * \param[in] b Second String + * \param[in] n Length + * \return < 0 if First String less than Second String, + * 0 if First String equal to Second String, + * > 0 if First String greater than Second String + */ +CARES_EXTERN int ares_strncmp(const char *a, const char *b, size_t n); + + +/*! Compare two strings in a case-insensitive manner (for sorting) + * + * Treats NULL and "" strings as equivalent + * + * \param[in] a First String + * \param[in] b Second String + * \return < 0 if First String less than Second String, + * 0 if First String equal to Second String, + * > 0 if First String greater than Second String + */ +CARES_EXTERN int ares_strcasecmp(const char *a, const char *b); + +/*! Compare two strings in a case-insensitive manner up to specified length + * (for sorting) + * + * Treats NULL and "" strings as equivalent + * + * \param[in] a First String + * \param[in] b Second String + * \param[in] n Length + * \return < 0 if First String less than Second String, + * 0 if First String equal to Second String, + * > 0 if First String greater than Second String + */ +CARES_EXTERN int ares_strncasecmp(const char *a, const char *b, size_t n); + +/*! Compare two strings for equality + * + * Treats NULL and "" strings as equivalent + * + * \param[in] a First String + * \param[in] b Second String + * \return ARES_TRUE on match, or ARES_FALSE if no match + */ +CARES_EXTERN ares_bool_t ares_streq(const char *a, const char *b); + +/*! Compare two strings for equality up to specified length + * + * Treats NULL and "" strings as equivalent + * + * \param[in] a First String + * \param[in] b Second String + * \param[in] n Length + * \return ARES_TRUE on match, or ARES_FALSE if no match + */ +CARES_EXTERN ares_bool_t ares_streq_max(const char *a, const char *b, size_t n); + +/*! Compare two strings for equality in a case insensitive manner + * + * Treats NULL and "" strings as equivalent + * + * \param[in] a First String + * \param[in] b Second String + * \return ARES_TRUE on match, or ARES_FALSE if no match + */ +CARES_EXTERN ares_bool_t ares_strcaseeq(const char *a, const char *b); + +/*! Compare two strings for equality up to specified length in a case + * insensitive manner + * + * Treats NULL and "" strings as equivalent + * + * \param[in] a First String + * \param[in] b Second String + * \param[in] n Length + * \return ARES_TRUE on match, or ARES_FALSE if no match + */ +CARES_EXTERN ares_bool_t ares_strcaseeq_max(const char *a, const char *b, + size_t n); + +/*! Free a C array, each element in the array will be freed by the provided + * free function. Both NULL-terminated arrays and known length arrays are + * supported. + * + * \param[in] arr Array to be freed. + * \param[in] nmembers Number of members in the array, or SIZE_MAX for + * NULL-terminated arrays + * \param[in] freefunc Function to call on each array member (e.g. ares_free) + */ +CARES_EXTERN void ares_free_array(void *arr, size_t nmembers, + void (*freefunc)(void *)); + +#endif /* __ARES_STR_H */ diff --git a/lib/c-ares-1.33.1/src/lib/inet_net_pton.c b/lib/c-ares-1.34.4/src/lib/inet_net_pton.c similarity index 89% rename from lib/c-ares-1.33.1/src/lib/inet_net_pton.c rename to lib/c-ares-1.34.4/src/lib/inet_net_pton.c index 5356778c47b..e1f76ef834a 100644 --- a/lib/c-ares-1.33.1/src/lib/inet_net_pton.c +++ b/lib/c-ares-1.34.4/src/lib/inet_net_pton.c @@ -32,6 +32,20 @@ #include "ares_ipv6.h" #include "ares_inet_net_pton.h" +#ifdef USE_WINSOCK +# define SOCKERRNO ((int)WSAGetLastError()) +# define SET_SOCKERRNO(x) (WSASetLastError((int)(x))) +# undef EMSGSIZE +# define EMSGSIZE WSAEMSGSIZE +# undef ENOENT +# define ENOENT WSA_INVALID_PARAMETER +# undef EAFNOSUPPORT +# define EAFNOSUPPORT WSAEAFNOSUPPORT +#else +# define SOCKERRNO (errno) +# define SET_SOCKERRNO(x) (errno = (x)) +#endif + const struct ares_in6_addr ares_in6addr_any = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } }; @@ -69,17 +83,17 @@ static int ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, const unsigned char *odst = dst; ch = *src++; - if (ch == '0' && (src[0] == 'x' || src[0] == 'X') && ares__isascii(src[1]) && - ares__isxdigit(src[1])) { + if (ch == '0' && (src[0] == 'x' || src[0] == 'X') && ares_isascii(src[1]) && + ares_isxdigit(src[1])) { /* Hexadecimal: Eat nybble string. */ if (!size) { goto emsgsize; } dirty = 0; src++; /* skip x or X. */ - while ((ch = *src++) != '\0' && ares__isascii(ch) && ares__isxdigit(ch)) { - if (ares__isupper(ch)) { - ch = ares__tolower((unsigned char)ch); + while ((ch = *src++) != '\0' && ares_isascii(ch) && ares_isxdigit(ch)) { + if (ares_isupper(ch)) { + ch = ares_tolower((unsigned char)ch); } n = (int)(strchr(xdigits, ch) - xdigits); if (dirty == 0) { @@ -101,7 +115,7 @@ static int ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, } *dst++ = (unsigned char)(tmp << 4); } - } else if (ares__isascii(ch) && ares__isdigit(ch)) { + } else if (ares_isascii(ch) && ares_isdigit(ch)) { /* Decimal: eat dotted digit string. */ for (;;) { tmp = 0; @@ -112,7 +126,7 @@ static int ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, if (tmp > 255) { goto enoent; } - } while ((ch = *src++) != '\0' && ares__isascii(ch) && ares__isdigit(ch)); + } while ((ch = *src++) != '\0' && ares_isascii(ch) && ares_isdigit(ch)); if (!size--) { goto emsgsize; } @@ -124,7 +138,7 @@ static int ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, goto enoent; } ch = *src++; - if (!ares__isascii(ch) || !ares__isdigit(ch)) { + if (!ares_isascii(ch) || !ares_isdigit(ch)) { goto enoent; } } @@ -133,8 +147,7 @@ static int ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, } bits = -1; - if (ch == '/' && ares__isascii(src[0]) && ares__isdigit(src[0]) && - dst > odst) { + if (ch == '/' && ares_isascii(src[0]) && ares_isdigit(src[0]) && dst > odst) { /* CIDR width specifier. Nothing can follow it. */ ch = *src++; /* Skip over the /. */ bits = 0; @@ -145,7 +158,7 @@ static int ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, if (bits > 32) { goto enoent; } - } while ((ch = *src++) != '\0' && ares__isascii(ch) && ares__isdigit(ch)); + } while ((ch = *src++) != '\0' && ares_isascii(ch) && ares_isdigit(ch)); if (ch != '\0') { goto enoent; } @@ -195,11 +208,11 @@ static int ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, return bits; enoent: - SET_ERRNO(ENOENT); + SET_SOCKERRNO(ENOENT); return -1; emsgsize: - SET_ERRNO(EMSGSIZE); + SET_SOCKERRNO(EMSGSIZE); return -1; } @@ -343,7 +356,7 @@ static int ares_inet_pton6(const char *src, unsigned char *dst) return 1; enoent: - SET_ERRNO(ENOENT); + SET_SOCKERRNO(ENOENT); return -1; } @@ -358,7 +371,7 @@ static int ares_inet_net_pton_ipv6(const char *src, unsigned char *dst, char *sep; if (ares_strlen(src) >= sizeof buf) { - SET_ERRNO(EMSGSIZE); + SET_SOCKERRNO(EMSGSIZE); return -1; } ares_strcpy(buf, src, sizeof buf); @@ -377,14 +390,14 @@ static int ares_inet_net_pton_ipv6(const char *src, unsigned char *dst, bits = 128; } else { if (!getbits(sep, &bits)) { - SET_ERRNO(ENOENT); + SET_SOCKERRNO(ENOENT); return -1; } } bytes = (bits + 7) / 8; if (bytes > size) { - SET_ERRNO(EMSGSIZE); + SET_SOCKERRNO(EMSGSIZE); return -1; } memcpy(dst, &in6, bytes); @@ -401,13 +414,9 @@ static int ares_inet_net_pton_ipv6(const char *src, unsigned char *dst, * number of bits, either imputed classfully or specified with /CIDR, * or -1 if some failure occurred (check errno). ENOENT means it was * not a valid network specification. - * note: - * On Windows we store the error in the thread errno, not - * in the winsock error code. This is to avoid losing the - * actual last winsock error. So use macro ERRNO to fetch the - * errno this function sets when returning (-1), not SOCKERRNO. * author: * Paul Vixie (ISC), June 1996 + * */ int ares_inet_net_pton(int af, const char *src, void *dst, size_t size) { @@ -417,7 +426,6 @@ int ares_inet_net_pton(int af, const char *src, void *dst, size_t size) case AF_INET6: return ares_inet_net_pton_ipv6(src, dst, size); default: - SET_ERRNO(EAFNOSUPPORT); return -1; } } @@ -432,11 +440,11 @@ int ares_inet_pton(int af, const char *src, void *dst) } else if (af == AF_INET6) { size = sizeof(struct ares_in6_addr); } else { - SET_ERRNO(EAFNOSUPPORT); + SET_SOCKERRNO(EAFNOSUPPORT); return -1; } result = ares_inet_net_pton(af, src, dst, size); - if (result == -1 && ERRNO == ENOENT) { + if (result == -1 && SOCKERRNO == ENOENT) { return 0; } return (result > -1) ? 1 : -1; diff --git a/lib/c-ares-1.33.1/src/lib/inet_ntop.c b/lib/c-ares-1.34.4/src/lib/inet_ntop.c similarity index 91% rename from lib/c-ares-1.33.1/src/lib/inet_ntop.c rename to lib/c-ares-1.34.4/src/lib/inet_ntop.c index 6f96b92cccc..79b6c0fa939 100644 --- a/lib/c-ares-1.33.1/src/lib/inet_ntop.c +++ b/lib/c-ares-1.34.4/src/lib/inet_ntop.c @@ -29,6 +29,22 @@ #include "ares_nameser.h" #include "ares_ipv6.h" +#ifdef USE_WINSOCK +# define SOCKERRNO ((int)WSAGetLastError()) +# define SET_SOCKERRNO(x) (WSASetLastError((int)(x))) +# undef EMSGSIZE +# define EMSGSIZE WSAEMSGSIZE +# undef ENOENT +# define ENOENT WSA_INVALID_PARAMETER +# undef EAFNOSUPPORT +# define EAFNOSUPPORT WSAEAFNOSUPPORT +# undef ENOSPC +# define ENOSPC WSA_INVALID_PARAMETER +#else +# define SOCKERRNO (errno) +# define SET_SOCKERRNO(x) (errno = (x)) +#endif + /* * WARNING: Don't even consider trying to compile this on a system where * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. @@ -42,11 +58,6 @@ static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size); * convert a network format address to presentation format. * return: * pointer to presentation format address (`dst'), or NULL (see errno). - * note: - * On Windows we store the error in the thread errno, not - * in the winsock error code. This is to avoid losing the - * actual last winsock error. So use macro ERRNO to fetch the - * errno this function sets when returning NULL, not SOCKERRNO. * author: * Paul Vixie, 1996. */ @@ -61,7 +72,7 @@ const char *ares_inet_ntop(int af, const void *src, char *dst, default: break; } - SET_ERRNO(EAFNOSUPPORT); + SET_SOCKERRNO(EAFNOSUPPORT); return NULL; } @@ -82,13 +93,13 @@ static const char *inet_ntop4(const unsigned char *src, char *dst, size_t size) char tmp[sizeof("255.255.255.255")]; if (size < sizeof(tmp)) { - SET_ERRNO(ENOSPC); + SET_SOCKERRNO(ENOSPC); return NULL; } if ((size_t)snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]) >= size) { - SET_ERRNO(ENOSPC); + SET_SOCKERRNO(ENOSPC); return NULL; } ares_strcpy(dst, tmp, size); @@ -200,7 +211,7 @@ static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size) * Check for overflow, copy, and we're done. */ if ((size_t)(tp - tmp) > size) { - SET_ERRNO(ENOSPC); + SET_SOCKERRNO(ENOSPC); return NULL; } ares_strcpy(dst, tmp, size); diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_create_query.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_create_query.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_create_query.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_create_query.c diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_expand_name.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_expand_name.c similarity index 76% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_expand_name.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_expand_name.c index 63bd6451668..72668f4cb60 100644 --- a/lib/c-ares-1.33.1/src/lib/legacy/ares_expand_name.c +++ b/lib/c-ares-1.34.4/src/lib/legacy/ares_expand_name.c @@ -33,13 +33,13 @@ #include "ares_nameser.h" -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_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 status; - ares__buf_t *buf = NULL; + ares_buf_t *buf = NULL; size_t start_len; if (encoded == NULL || abuf == NULL || alen == 0 || enclen == NULL) { @@ -57,27 +57,27 @@ ares_status_t ares__expand_name_validated(const unsigned char *encoded, *s = NULL; } - buf = ares__buf_create_const(abuf, alen); + buf = ares_buf_create_const(abuf, alen); if (buf == NULL) { return ARES_ENOMEM; } - status = ares__buf_set_position(buf, (size_t)(encoded - abuf)); + status = ares_buf_set_position(buf, (size_t)(encoded - abuf)); if (status != ARES_SUCCESS) { goto done; } - start_len = ares__buf_len(buf); - status = ares__dns_name_parse(buf, s, is_hostname); + start_len = ares_buf_len(buf); + status = ares_dns_name_parse(buf, s, is_hostname); if (status != ARES_SUCCESS) { goto done; } - *enclen = start_len - ares__buf_len(buf); + *enclen = start_len - ares_buf_len(buf); done: - ares__buf_destroy(buf); + ares_buf_destroy(buf); return status; } @@ -92,8 +92,8 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, return ARES_EBADNAME; } - status = ares__expand_name_validated(encoded, abuf, (size_t)alen, s, - &enclen_temp, ARES_FALSE); + status = ares_expand_name_validated(encoded, abuf, (size_t)alen, s, + &enclen_temp, ARES_FALSE); *enclen = (long)enclen_temp; return (int)status; } diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_expand_string.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_expand_string.c similarity index 90% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_expand_string.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_expand_string.c index b3e99daa54b..e1deb1932f4 100644 --- a/lib/c-ares-1.33.1/src/lib/legacy/ares_expand_string.c +++ b/lib/c-ares-1.34.4/src/lib/legacy/ares_expand_string.c @@ -43,7 +43,7 @@ ares_status_t ares_expand_string_ex(const unsigned char *encoded, unsigned char **s, size_t *enclen) { ares_status_t status; - ares__buf_t *buf = NULL; + ares_buf_t *buf = NULL; size_t start_len; size_t len = 0; @@ -62,28 +62,28 @@ ares_status_t ares_expand_string_ex(const unsigned char *encoded, *s = NULL; } - buf = ares__buf_create_const(abuf, alen); + buf = ares_buf_create_const(abuf, alen); if (buf == NULL) { return ARES_ENOMEM; } - status = ares__buf_set_position(buf, (size_t)(encoded - abuf)); + status = ares_buf_set_position(buf, (size_t)(encoded - abuf)); if (status != ARES_SUCCESS) { goto done; } - start_len = ares__buf_len(buf); - status = ares__buf_parse_dns_binstr(buf, ares__buf_len(buf), s, &len); + start_len = ares_buf_len(buf); + status = ares_buf_parse_dns_binstr(buf, ares_buf_len(buf), s, &len); /* hrm, no way to pass back 'len' with the prototype */ if (status != ARES_SUCCESS) { goto done; } - *enclen = start_len - ares__buf_len(buf); + *enclen = start_len - ares_buf_len(buf); done: - ares__buf_destroy(buf); + ares_buf_destroy(buf); if (status == ARES_EBADNAME || status == ARES_EBADRESP) { status = ARES_EBADSTR; } diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_fds.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_fds.c similarity index 72% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_fds.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_fds.c index 3aedd2c90e2..112ebac60ad 100644 --- a/lib/c-ares-1.33.1/src/lib/legacy/ares_fds.c +++ b/lib/c-ares-1.34.4/src/lib/legacy/ares_fds.c @@ -29,28 +29,28 @@ int ares_fds(const ares_channel_t *channel, fd_set *read_fds, fd_set *write_fds) { - ares_socket_t nfds; - ares__slist_node_t *snode; + ares_socket_t nfds; + ares_slist_node_t *snode; /* Are there any active queries? */ - size_t active_queries; + size_t active_queries; if (channel == NULL || read_fds == NULL || write_fds == NULL) { return 0; } - ares__channel_lock(channel); + ares_channel_lock(channel); - active_queries = ares__llist_len(channel->all_queries); + active_queries = ares_llist_len(channel->all_queries); nfds = 0; - 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 *node; + 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 *node; - for (node = ares__llist_node_first(server->connections); node != NULL; - node = ares__llist_node_next(node)) { - const ares_conn_t *conn = ares__llist_node_val(node); + for (node = ares_llist_node_first(server->connections); node != NULL; + node = ares_llist_node_next(node)) { + const ares_conn_t *conn = ares_llist_node_val(node); if (!active_queries && !(conn->flags & ARES_CONN_FLAG_TCP)) { continue; @@ -68,13 +68,13 @@ int ares_fds(const ares_channel_t *channel, fd_set *read_fds, fd_set *write_fds) nfds = conn->fd + 1; } - /* TCP only wait on write if we have buffered data */ - if (conn->flags & ARES_CONN_FLAG_TCP && ares__buf_len(server->tcp_send)) { + /* TCP only wait on write if we have the flag set */ + if (conn->state_flags & ARES_CONN_STATE_WRITE) { FD_SET(conn->fd, write_fds); } } } - ares__channel_unlock(channel); + ares_channel_unlock(channel); return (int)nfds; } diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_getsock.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_getsock.c similarity index 73% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_getsock.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_getsock.c index 8c8476fa951..cec9258abb0 100644 --- a/lib/c-ares-1.33.1/src/lib/legacy/ares_getsock.c +++ b/lib/c-ares-1.34.4/src/lib/legacy/ares_getsock.c @@ -29,30 +29,30 @@ int ares_getsock(const ares_channel_t *channel, ares_socket_t *socks, int numsocks) /* size of the 'socks' array */ { - ares__slist_node_t *snode; - size_t sockindex = 0; - unsigned int bitmap = 0; - unsigned int setbits = 0xffffffff; + ares_slist_node_t *snode; + size_t sockindex = 0; + unsigned int bitmap = 0; + unsigned int setbits = 0xffffffff; /* Are there any active queries? */ - size_t active_queries; + size_t active_queries; if (channel == NULL || numsocks <= 0) { return 0; } - ares__channel_lock(channel); + ares_channel_lock(channel); - active_queries = ares__llist_len(channel->all_queries); + active_queries = ares_llist_len(channel->all_queries); - 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 *node; + 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 *node; - for (node = ares__llist_node_first(server->connections); node != NULL; - node = ares__llist_node_next(node)) { - const ares_conn_t *conn = ares__llist_node_val(node); + for (node = ares_llist_node_first(server->connections); node != NULL; + node = ares_llist_node_next(node)) { + const ares_conn_t *conn = ares_llist_node_val(node); if (sockindex >= (size_t)numsocks || sockindex >= ARES_GETSOCK_MAXNUM) { break; @@ -71,7 +71,7 @@ int ares_getsock(const ares_channel_t *channel, ares_socket_t *socks, bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); } - if (conn->flags & ARES_CONN_FLAG_TCP && ares__buf_len(server->tcp_send)) { + if (conn->state_flags & ARES_CONN_STATE_WRITE) { /* then the tcp socket is also writable! */ bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex); } @@ -80,6 +80,6 @@ int ares_getsock(const ares_channel_t *channel, ares_socket_t *socks, } } - ares__channel_unlock(channel); + ares_channel_unlock(channel); return (int)bitmap; } diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_a_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_a_reply.c similarity index 89% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_a_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_a_reply.c index 0981b90eeaf..870aaccf76c 100644 --- a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_a_reply.c +++ b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_a_reply.c @@ -71,13 +71,13 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, goto fail; } - status = ares__parse_into_addrinfo(dnsrec, 0, 0, &ai); + status = ares_parse_into_addrinfo(dnsrec, 0, 0, &ai); if (status != ARES_SUCCESS && status != ARES_ENODATA) { goto fail; } if (host != NULL) { - status = ares__addrinfo2hostent(&ai, AF_INET, host); + status = ares_addrinfo2hostent(&ai, AF_INET, host); if (status != ARES_SUCCESS && status != ARES_ENODATA) { goto fail; /* LCOV_EXCL_LINE: DefensiveCoding */ } @@ -85,15 +85,15 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, if (addrttls != NULL && req_naddrttls) { size_t temp_naddrttls = 0; - ares__addrinfo2addrttl(&ai, AF_INET, req_naddrttls, addrttls, NULL, - &temp_naddrttls); + ares_addrinfo2addrttl(&ai, AF_INET, req_naddrttls, addrttls, NULL, + &temp_naddrttls); *naddrttls = (int)temp_naddrttls; } fail: - 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(question_hostname); ares_dns_record_destroy(dnsrec); diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_aaaa_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_aaaa_reply.c similarity index 90% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_aaaa_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_aaaa_reply.c index 3f6932643b2..278642f0b3e 100644 --- a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_aaaa_reply.c +++ b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_aaaa_reply.c @@ -74,13 +74,13 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, goto fail; } - status = ares__parse_into_addrinfo(dnsrec, 0, 0, &ai); + status = ares_parse_into_addrinfo(dnsrec, 0, 0, &ai); if (status != ARES_SUCCESS && status != ARES_ENODATA) { goto fail; } if (host != NULL) { - status = ares__addrinfo2hostent(&ai, AF_INET6, host); + status = ares_addrinfo2hostent(&ai, AF_INET6, host); if (status != ARES_SUCCESS && status != ARES_ENODATA) { goto fail; /* LCOV_EXCL_LINE: DefensiveCoding */ } @@ -88,14 +88,14 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, if (addrttls != NULL && req_naddrttls) { size_t temp_naddrttls = 0; - ares__addrinfo2addrttl(&ai, AF_INET6, req_naddrttls, NULL, addrttls, - &temp_naddrttls); + ares_addrinfo2addrttl(&ai, AF_INET6, req_naddrttls, NULL, addrttls, + &temp_naddrttls); *naddrttls = (int)temp_naddrttls; } fail: - ares__freeaddrinfo_cnames(ai.cnames); - ares__freeaddrinfo_nodes(ai.nodes); + ares_freeaddrinfo_cnames(ai.cnames); + ares_freeaddrinfo_nodes(ai.nodes); ares_free(question_hostname); ares_free(ai.name); ares_dns_record_destroy(dnsrec); diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_caa_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_caa_reply.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_caa_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_caa_reply.c diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_mx_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_mx_reply.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_mx_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_mx_reply.c diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_naptr_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_naptr_reply.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_naptr_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_naptr_reply.c diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_ns_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_ns_reply.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_ns_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_ns_reply.c diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_ptr_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_ptr_reply.c similarity index 99% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_ptr_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_ptr_reply.c index 56a7b5f94eb..0e52f9db09b 100644 --- a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_ptr_reply.c +++ b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_ptr_reply.c @@ -135,7 +135,7 @@ ares_status_t ares_parse_ptr_reply_dnsrec(const ares_dns_record_t *dnsrec, * status = ARES_EBADRESP; * goto done; * } - * if (strcasecmp(ptrname, rname) != 0) { + * if (!ares_strcaseeq(ptrname, rname)) { * continue; * } */ diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_soa_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_soa_reply.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_soa_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_soa_reply.c diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_srv_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_srv_reply.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_srv_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_srv_reply.c diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_txt_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_txt_reply.c similarity index 91% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_txt_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_txt_reply.c index 71ee0841119..d276f6ab390 100644 --- a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_txt_reply.c +++ b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_txt_reply.c @@ -27,8 +27,8 @@ #include "ares_private.h" #include "ares_data.h" -static int ares__parse_txt_reply(const unsigned char *abuf, size_t alen, - ares_bool_t ex, void **txt_out) +static int ares_parse_txt_reply_int(const unsigned char *abuf, size_t alen, + ares_bool_t ex, void **txt_out) { ares_status_t status; struct ares_txt_ext *txt_head = NULL; @@ -129,8 +129,8 @@ int ares_parse_txt_reply(const unsigned char *abuf, int alen, if (alen < 0) { return ARES_EBADRESP; } - return ares__parse_txt_reply(abuf, (size_t)alen, ARES_FALSE, - (void **)txt_out); + return ares_parse_txt_reply_int(abuf, (size_t)alen, ARES_FALSE, + (void **)txt_out); } int ares_parse_txt_reply_ext(const unsigned char *abuf, int alen, @@ -139,5 +139,6 @@ int ares_parse_txt_reply_ext(const unsigned char *abuf, int alen, if (alen < 0) { return ARES_EBADRESP; } - return ares__parse_txt_reply(abuf, (size_t)alen, ARES_TRUE, (void **)txt_out); + return ares_parse_txt_reply_int(abuf, (size_t)alen, ARES_TRUE, + (void **)txt_out); } diff --git a/lib/c-ares-1.33.1/src/lib/legacy/ares_parse_uri_reply.c b/lib/c-ares-1.34.4/src/lib/legacy/ares_parse_uri_reply.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/legacy/ares_parse_uri_reply.c rename to lib/c-ares-1.34.4/src/lib/legacy/ares_parse_uri_reply.c diff --git a/lib/c-ares-1.33.1/src/lib/record/ares_dns_mapping.c b/lib/c-ares-1.34.4/src/lib/record/ares_dns_mapping.c similarity index 99% rename from lib/c-ares-1.33.1/src/lib/record/ares_dns_mapping.c rename to lib/c-ares-1.34.4/src/lib/record/ares_dns_mapping.c index 738d2f3795a..5a3ec28abf1 100644 --- a/lib/c-ares-1.33.1/src/lib/record/ares_dns_mapping.c +++ b/lib/c-ares-1.34.4/src/lib/record/ares_dns_mapping.c @@ -111,7 +111,7 @@ ares_bool_t ares_dns_rec_type_isvalid(ares_dns_rec_type_t type, return is_query ? ARES_TRUE : ARES_FALSE; } -ares_bool_t ares_dns_rec_type_allow_name_compression(ares_dns_rec_type_t type) +ares_bool_t ares_dns_rec_allow_name_comp(ares_dns_rec_type_t type) { /* Only record types defined in RFC1035 allow name compression within the * RDATA. Otherwise nameservers that don't understand an RR may not be @@ -681,7 +681,7 @@ ares_bool_t ares_dns_class_fromstr(ares_dns_class_t *qclass, const char *str) } for (i = 0; list[i].name != NULL; i++) { - if (strcasecmp(list[i].name, str) == 0) { + if (ares_strcaseeq(list[i].name, str)) { *qclass = list[i].qclass; return ARES_TRUE; } @@ -726,7 +726,7 @@ ares_bool_t ares_dns_rec_type_fromstr(ares_dns_rec_type_t *qtype, } for (i = 0; list[i].name != NULL; i++) { - if (strcasecmp(list[i].name, str) == 0) { + if (ares_strcaseeq(list[i].name, str)) { *qtype = list[i].type; return ARES_TRUE; } diff --git a/lib/c-ares-1.34.4/src/lib/record/ares_dns_multistring.c b/lib/c-ares-1.34.4/src/lib/record/ares_dns_multistring.c new file mode 100644 index 00000000000..44fcaccd65b --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/record/ares_dns_multistring.c @@ -0,0 +1,307 @@ +/* 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_dns_private.h" + +typedef struct { + unsigned char *data; + size_t len; +} multistring_data_t; + +struct ares_dns_multistring { + /*! whether or not cached concatenated string is valid */ + ares_bool_t cache_invalidated; + /*! combined/concatenated string cache */ + unsigned char *cache_str; + /*! length of combined/concatenated string */ + size_t cache_str_len; + /*! Data making up strings */ + ares_array_t *strs; /*!< multistring_data_t type */ +}; + +static void ares_dns_multistring_free_cb(void *arg) +{ + multistring_data_t *data = arg; + if (data == NULL) { + return; + } + ares_free(data->data); +} + +ares_dns_multistring_t *ares_dns_multistring_create(void) +{ + ares_dns_multistring_t *strs = ares_malloc_zero(sizeof(*strs)); + if (strs == NULL) { + return NULL; + } + + strs->strs = + ares_array_create(sizeof(multistring_data_t), ares_dns_multistring_free_cb); + if (strs->strs == NULL) { + ares_free(strs); + return NULL; + } + + return strs; +} + +void ares_dns_multistring_clear(ares_dns_multistring_t *strs) +{ + if (strs == NULL) { + return; + } + + while (ares_array_len(strs->strs)) { + ares_array_remove_last(strs->strs); + } +} + +void ares_dns_multistring_destroy(ares_dns_multistring_t *strs) +{ + if (strs == NULL) { + return; + } + ares_dns_multistring_clear(strs); + ares_array_destroy(strs->strs); + ares_free(strs->cache_str); + ares_free(strs); +} + +ares_status_t ares_dns_multistring_swap_own(ares_dns_multistring_t *strs, + size_t idx, unsigned char *str, + size_t len) +{ + multistring_data_t *data; + + if (strs == NULL || str == NULL || len == 0) { + return ARES_EFORMERR; + } + + strs->cache_invalidated = ARES_TRUE; + + data = ares_array_at(strs->strs, idx); + if (data == NULL) { + return ARES_EFORMERR; + } + + ares_free(data->data); + data->data = str; + data->len = len; + return ARES_SUCCESS; +} + +ares_status_t ares_dns_multistring_del(ares_dns_multistring_t *strs, size_t idx) +{ + if (strs == NULL) { + return ARES_EFORMERR; + } + + strs->cache_invalidated = ARES_TRUE; + + return ares_array_remove_at(strs->strs, idx); +} + +ares_status_t ares_dns_multistring_add_own(ares_dns_multistring_t *strs, + unsigned char *str, size_t len) +{ + multistring_data_t *data; + ares_status_t status; + + if (strs == NULL) { + return ARES_EFORMERR; + } + + strs->cache_invalidated = ARES_TRUE; + + /* NOTE: its ok to have an empty string added */ + if (str == NULL && len != 0) { + return ARES_EFORMERR; + } + + status = ares_array_insert_last((void **)&data, strs->strs); + if (status != ARES_SUCCESS) { + return status; + } + + /* Issue #921, ares_dns_multistring_get() doesn't have a way to indicate + * success or fail on a zero-length string which is actually valid. So we + * are going to allocate a 1-byte buffer to use as a placeholder in this + * case */ + if (str == NULL) { + str = ares_malloc_zero(1); + if (str == NULL) { + ares_array_remove_last(strs->strs); + return ARES_ENOMEM; + } + } + + data->data = str; + data->len = len; + + return ARES_SUCCESS; +} + +size_t ares_dns_multistring_cnt(const ares_dns_multistring_t *strs) +{ + if (strs == NULL) { + return 0; + } + return ares_array_len(strs->strs); +} + +const unsigned char * + ares_dns_multistring_get(const ares_dns_multistring_t *strs, size_t idx, + size_t *len) +{ + const multistring_data_t *data; + + if (strs == NULL || len == NULL) { + return NULL; + } + + data = ares_array_at_const(strs->strs, idx); + if (data == NULL) { + return NULL; + } + + *len = data->len; + return data->data; +} + +const unsigned char *ares_dns_multistring_combined(ares_dns_multistring_t *strs, + size_t *len) +{ + ares_buf_t *buf = NULL; + size_t i; + + if (strs == NULL || len == NULL) { + return NULL; + } + + *len = 0; + + /* Return cache if possible */ + if (!strs->cache_invalidated) { + *len = strs->cache_str_len; + return strs->cache_str; + } + + /* Clear cache */ + ares_free(strs->cache_str); + strs->cache_str = NULL; + strs->cache_str_len = 0; + + buf = ares_buf_create(); + + for (i = 0; i < ares_array_len(strs->strs); i++) { + const multistring_data_t *data = ares_array_at_const(strs->strs, i); + if (data == NULL || + ares_buf_append(buf, data->data, data->len) != ARES_SUCCESS) { + ares_buf_destroy(buf); + return NULL; + } + } + + strs->cache_str = + (unsigned char *)ares_buf_finish_str(buf, &strs->cache_str_len); + if (strs->cache_str != NULL) { + strs->cache_invalidated = ARES_FALSE; + } + *len = strs->cache_str_len; + return strs->cache_str; +} + +ares_status_t ares_dns_multistring_parse_buf(ares_buf_t *buf, + size_t remaining_len, + ares_dns_multistring_t **strs, + ares_bool_t validate_printable) +{ + unsigned char len; + ares_status_t status = ARES_EBADRESP; + size_t orig_len = ares_buf_len(buf); + + if (buf == NULL) { + return ARES_EFORMERR; + } + + if (remaining_len == 0) { + return ARES_EBADRESP; + } + + if (strs != NULL) { + *strs = ares_dns_multistring_create(); + if (*strs == NULL) { + return ARES_ENOMEM; + } + } + + while (orig_len - ares_buf_len(buf) < remaining_len) { + status = ares_buf_fetch_bytes(buf, &len, 1); + if (status != ARES_SUCCESS) { + break; /* LCOV_EXCL_LINE: DefensiveCoding */ + } + + + /* When used by the _str() parser, it really needs to be validated to + * be a valid printable ascii string. Do that here */ + if (len && validate_printable && ares_buf_len(buf) >= len) { + size_t mylen; + const char *data = (const char *)ares_buf_peek(buf, &mylen); + if (!ares_str_isprint(data, len)) { + status = ARES_EBADSTR; + break; + } + } + + if (strs != NULL) { + unsigned char *data = NULL; + if (len) { + status = ares_buf_fetch_bytes_dup(buf, len, ARES_TRUE, &data); + if (status != ARES_SUCCESS) { + break; + } + } + status = ares_dns_multistring_add_own(*strs, data, len); + if (status != ARES_SUCCESS) { + ares_free(data); + break; + } + } else { + status = ares_buf_consume(buf, len); + if (status != ARES_SUCCESS) { + break; + } + } + + } + + if (status != ARES_SUCCESS && strs != NULL) { + ares_dns_multistring_destroy(*strs); + *strs = NULL; + } + + return status; +} diff --git a/lib/c-ares-1.34.4/src/lib/record/ares_dns_multistring.h b/lib/c-ares-1.34.4/src/lib/record/ares_dns_multistring.h new file mode 100644 index 00000000000..70834491b52 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/record/ares_dns_multistring.h @@ -0,0 +1,72 @@ +/* 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_DNS_MULTISTRING_H +#define __ARES_DNS_MULTISTRING_H + +#include "ares_buf.h" + +struct ares_dns_multistring; +typedef struct ares_dns_multistring ares_dns_multistring_t; + +ares_dns_multistring_t *ares_dns_multistring_create(void); +void ares_dns_multistring_clear(ares_dns_multistring_t *strs); +void ares_dns_multistring_destroy(ares_dns_multistring_t *strs); +ares_status_t ares_dns_multistring_swap_own(ares_dns_multistring_t *strs, + size_t idx, unsigned char *str, + size_t len); +ares_status_t ares_dns_multistring_del(ares_dns_multistring_t *strs, + size_t idx); +ares_status_t ares_dns_multistring_add_own(ares_dns_multistring_t *strs, + unsigned char *str, size_t len); +size_t ares_dns_multistring_cnt(const ares_dns_multistring_t *strs); +const unsigned char * + ares_dns_multistring_get(const ares_dns_multistring_t *strs, size_t idx, + size_t *len); +const unsigned char *ares_dns_multistring_combined(ares_dns_multistring_t *strs, + size_t *len); + +/*! Parse an array of character strings as defined in RFC1035, as binary, + * however, for convenience this does guarantee a NULL terminator (that is + * not included in the length for each value). + * + * \param[in] buf initialized buffer object + * \param[in] remaining_len maximum length that should be used for + * parsing the string, this is often less than + * the remaining buffer and is based on the RR + * record length. + * \param[out] strs Pointer passed by reference to be filled in + * with + * the array of values. + * \param[out] validate_printable Validate the strings contain only printable + * data. + * \return ARES_SUCCESS on success + */ +ares_status_t ares_dns_multistring_parse_buf(ares_buf_t *buf, + size_t remaining_len, + ares_dns_multistring_t **strs, + ares_bool_t validate_printable); + +#endif diff --git a/lib/c-ares-1.33.1/src/lib/record/ares_dns_name.c b/lib/c-ares-1.34.4/src/lib/record/ares_dns_name.c similarity index 71% rename from lib/c-ares-1.33.1/src/lib/record/ares_dns_name.c rename to lib/c-ares-1.34.4/src/lib/record/ares_dns_name.c index a437553b0f2..a9b92e03ca9 100644 --- a/lib/c-ares-1.33.1/src/lib/record/ares_dns_name.c +++ b/lib/c-ares-1.34.4/src/lib/record/ares_dns_name.c @@ -31,7 +31,7 @@ typedef struct { size_t idx; } ares_nameoffset_t; -static void ares__nameoffset_free(void *arg) +static void ares_nameoffset_free(void *arg) { ares_nameoffset_t *off = arg; if (off == NULL) { @@ -41,8 +41,8 @@ static void ares__nameoffset_free(void *arg) ares_free(off); } -static ares_status_t ares__nameoffset_create(ares__llist_t **list, - const char *name, size_t idx) +static ares_status_t ares_nameoffset_create(ares_llist_t **list, + const char *name, size_t idx) { ares_status_t status; ares_nameoffset_t *off = NULL; @@ -53,7 +53,7 @@ static ares_status_t ares__nameoffset_create(ares__llist_t **list, } if (*list == NULL) { - *list = ares__llist_create(ares__nameoffset_free); + *list = ares_llist_create(ares_nameoffset_free); } if (*list == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ @@ -69,7 +69,7 @@ static ares_status_t ares__nameoffset_create(ares__llist_t **list, off->name_len = ares_strlen(off->name); off->idx = idx; - if (ares__llist_insert_last(*list, off) == NULL) { + if (ares_llist_insert_last(*list, off) == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -78,25 +78,25 @@ static ares_status_t ares__nameoffset_create(ares__llist_t **list, /* LCOV_EXCL_START: OutOfMemory */ fail: - ares__nameoffset_free(off); + ares_nameoffset_free(off); return status; /* LCOV_EXCL_STOP */ } -static const ares_nameoffset_t *ares__nameoffset_find(ares__llist_t *list, - const char *name) +static const ares_nameoffset_t *ares_nameoffset_find(ares_llist_t *list, + const char *name) { size_t name_len = ares_strlen(name); - ares__llist_node_t *node; + ares_llist_node_t *node; const ares_nameoffset_t *longest_match = NULL; if (list == NULL || name == NULL || name_len == 0) { return NULL; } - for (node = ares__llist_node_first(list); node != NULL; - node = ares__llist_node_next(node)) { - const ares_nameoffset_t *val = ares__llist_node_val(node); + for (node = ares_llist_node_first(list); node != NULL; + node = ares_llist_node_next(node)) { + const ares_nameoffset_t *val = ares_llist_node_val(node); size_t prefix_len; /* Can't be a match if the stored name is longer */ @@ -114,7 +114,7 @@ static const ares_nameoffset_t *ares__nameoffset_find(ares__llist_t *list, /* Due to DNS 0x20, lets not inadvertently mangle things, use case-sensitive * matching instead of case-insensitive. This may result in slightly * larger DNS queries overall. */ - if (strcmp(val->name, name + prefix_len) != 0) { + if (!ares_streq(val->name, name + prefix_len)) { continue; } @@ -133,38 +133,38 @@ static const ares_nameoffset_t *ares__nameoffset_find(ares__llist_t *list, static void ares_dns_labels_free_cb(void *arg) { - ares__buf_t **buf = arg; + ares_buf_t **buf = arg; if (buf == NULL) { return; } - ares__buf_destroy(*buf); + ares_buf_destroy(*buf); } -static ares__buf_t *ares_dns_labels_add(ares__array_t *labels) +static ares_buf_t *ares_dns_labels_add(ares_array_t *labels) { - ares__buf_t **buf; + ares_buf_t **buf; if (labels == NULL) { return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */ } - if (ares__array_insert_last((void **)&buf, labels) != ARES_SUCCESS) { + if (ares_array_insert_last((void **)&buf, labels) != ARES_SUCCESS) { return NULL; } - *buf = ares__buf_create(); + *buf = ares_buf_create(); if (*buf == NULL) { - ares__array_remove_last(labels); + ares_array_remove_last(labels); return NULL; } return *buf; } -static ares__buf_t *ares_dns_labels_get_last(ares__array_t *labels) +static ares_buf_t *ares_dns_labels_get_last(ares_array_t *labels) { - ares__buf_t **buf = ares__array_last(labels); + ares_buf_t **buf = ares_array_last(labels); if (buf == NULL) { return NULL; @@ -173,9 +173,9 @@ static ares__buf_t *ares_dns_labels_get_last(ares__array_t *labels) return *buf; } -static ares__buf_t *ares_dns_labels_get_at(ares__array_t *labels, size_t idx) +static ares_buf_t *ares_dns_labels_get_at(ares_array_t *labels, size_t idx) { - ares__buf_t **buf = ares__array_at(labels, idx); + ares_buf_t **buf = ares_array_at(labels, idx); if (buf == NULL) { return NULL; @@ -184,37 +184,37 @@ static ares__buf_t *ares_dns_labels_get_at(ares__array_t *labels, size_t idx) return *buf; } -static void ares_dns_name_labels_del_last(ares__array_t *labels) +static void ares_dns_name_labels_del_last(ares_array_t *labels) { - ares__array_remove_last(labels); + ares_array_remove_last(labels); } -static ares_status_t ares_parse_dns_name_escape(ares__buf_t *namebuf, - ares__buf_t *label, - ares_bool_t validate_hostname) +static ares_status_t ares_parse_dns_name_escape(ares_buf_t *namebuf, + ares_buf_t *label, + ares_bool_t validate_hostname) { ares_status_t status; unsigned char c; - status = ares__buf_fetch_bytes(namebuf, &c, 1); + status = ares_buf_fetch_bytes(namebuf, &c, 1); if (status != ARES_SUCCESS) { return ARES_EBADNAME; } /* If next character is a digit, read 2 more digits */ - if (ares__isdigit(c)) { + if (ares_isdigit(c)) { size_t i; unsigned int val = 0; val = c - '0'; for (i = 0; i < 2; i++) { - status = ares__buf_fetch_bytes(namebuf, &c, 1); + status = ares_buf_fetch_bytes(namebuf, &c, 1); if (status != ARES_SUCCESS) { return ARES_EBADNAME; } - if (!ares__isdigit(c)) { + if (!ares_isdigit(c)) { return ARES_EBADNAME; } val *= 10; @@ -226,28 +226,28 @@ static ares_status_t ares_parse_dns_name_escape(ares__buf_t *namebuf, return ARES_EBADNAME; } - if (validate_hostname && !ares__is_hostnamech((unsigned char)val)) { + if (validate_hostname && !ares_is_hostnamech((unsigned char)val)) { return ARES_EBADNAME; } - return ares__buf_append_byte(label, (unsigned char)val); + return ares_buf_append_byte(label, (unsigned char)val); } /* We can just output the character */ - if (validate_hostname && !ares__is_hostnamech(c)) { + if (validate_hostname && !ares_is_hostnamech(c)) { return ARES_EBADNAME; } - return ares__buf_append_byte(label, c); + return ares_buf_append_byte(label, c); } -static ares_status_t ares_split_dns_name(ares__array_t *labels, - ares_bool_t validate_hostname, - const char *name) +static ares_status_t ares_split_dns_name(ares_array_t *labels, + ares_bool_t validate_hostname, + const char *name) { ares_status_t status; - ares__buf_t *label = NULL; - ares__buf_t *namebuf = NULL; + ares_buf_t *label = NULL; + ares_buf_t *namebuf = NULL; size_t i; size_t total_len = 0; unsigned char c; @@ -257,7 +257,7 @@ static ares_status_t ares_split_dns_name(ares__array_t *labels, } /* Put name into a buffer for parsing */ - namebuf = ares__buf_create(); + namebuf = ares_buf_create(); if (namebuf == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ goto done; /* LCOV_EXCL_LINE: OutOfMemory */ @@ -265,7 +265,7 @@ static ares_status_t ares_split_dns_name(ares__array_t *labels, if (*name != '\0') { status = - ares__buf_append(namebuf, (const unsigned char *)name, ares_strlen(name)); + ares_buf_append(namebuf, (const unsigned char *)name, ares_strlen(name)); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -278,7 +278,7 @@ static ares_status_t ares_split_dns_name(ares__array_t *labels, goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } - while (ares__buf_fetch_bytes(namebuf, &c, 1) == ARES_SUCCESS) { + while (ares_buf_fetch_bytes(namebuf, &c, 1) == ARES_SUCCESS) { /* New label */ if (c == '.') { label = ares_dns_labels_add(labels); @@ -299,33 +299,33 @@ static ares_status_t ares_split_dns_name(ares__array_t *labels, } /* Output direct character */ - if (validate_hostname && !ares__is_hostnamech(c)) { + if (validate_hostname && !ares_is_hostnamech(c)) { status = ARES_EBADNAME; goto done; } - status = ares__buf_append_byte(label, c); + status = ares_buf_append_byte(label, c); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } } /* Remove trailing blank label */ - if (ares__buf_len(ares_dns_labels_get_last(labels)) == 0) { + if (ares_buf_len(ares_dns_labels_get_last(labels)) == 0) { ares_dns_name_labels_del_last(labels); } /* If someone passed in "." there could have been 2 blank labels, check for * that */ - if (ares__array_len(labels) == 1 && - ares__buf_len(ares_dns_labels_get_last(labels)) == 0) { + if (ares_array_len(labels) == 1 && + ares_buf_len(ares_dns_labels_get_last(labels)) == 0) { ares_dns_name_labels_del_last(labels); } /* Scan to make sure label lengths are valid */ - for (i = 0; i < ares__array_len(labels); i++) { - const ares__buf_t *buf = ares_dns_labels_get_at(labels, i); - size_t len = ares__buf_len(buf); + for (i = 0; i < ares_array_len(labels); i++) { + const ares_buf_t *buf = ares_dns_labels_get_at(labels, i); + size_t len = ares_buf_len(buf); /* No 0-length labels, and no labels over 63 bytes */ if (len == 0 || len > 63) { status = ARES_EBADNAME; @@ -335,8 +335,7 @@ static ares_status_t ares_split_dns_name(ares__array_t *labels, } /* Can't exceed maximum (unescaped) length */ - if (ares__array_len(labels) && - total_len + ares__array_len(labels) - 1 > 255) { + if (ares_array_len(labels) && total_len + ares_array_len(labels) - 1 > 255) { status = ARES_EBADNAME; goto done; } @@ -344,19 +343,19 @@ static ares_status_t ares_split_dns_name(ares__array_t *labels, status = ARES_SUCCESS; done: - ares__buf_destroy(namebuf); + ares_buf_destroy(namebuf); return status; } -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) { const ares_nameoffset_t *off = NULL; size_t name_len; size_t orig_name_len; - size_t pos = ares__buf_len(buf); - ares__array_t *labels = NULL; + size_t pos = ares_buf_len(buf); + ares_array_t *labels = NULL; char name_copy[512]; ares_status_t status; @@ -364,7 +363,7 @@ ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list, return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - labels = ares__array_create(sizeof(ares__buf_t *), ares_dns_labels_free_cb); + labels = ares_array_create(sizeof(ares_buf_t *), ares_dns_labels_free_cb); if (labels == NULL) { return ARES_ENOMEM; } @@ -376,7 +375,7 @@ ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list, /* Find longest match */ if (list != NULL) { - off = ares__nameoffset_find(*list, name_copy); + off = ares_nameoffset_find(*list, name_copy); if (off != NULL && off->name_len != name_len) { /* truncate */ name_len -= (off->name_len + 1); @@ -393,17 +392,17 @@ ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list, goto done; } - for (i = 0; i < ares__array_len(labels); i++) { + for (i = 0; i < ares_array_len(labels); i++) { size_t len = 0; - const ares__buf_t *lbuf = ares_dns_labels_get_at(labels, i); - const unsigned char *ptr = ares__buf_peek(lbuf, &len); + const ares_buf_t *lbuf = ares_dns_labels_get_at(labels, i); + const unsigned char *ptr = ares_buf_peek(lbuf, &len); - status = ares__buf_append_byte(buf, (unsigned char)(len & 0xFF)); + status = ares_buf_append_byte(buf, (unsigned char)(len & 0xFF)); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_append(buf, ptr, len); + status = ares_buf_append(buf, ptr, len); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -411,7 +410,7 @@ ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list, /* If we are NOT jumping to another label, output terminator */ if (off == NULL) { - status = ares__buf_append_byte(buf, 0); + status = ares_buf_append_byte(buf, 0); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -422,7 +421,7 @@ ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list, if (off != NULL) { unsigned short u16 = (unsigned short)0xC000 | (unsigned short)(off->idx & 0x3FFF); - status = ares__buf_append_be16(buf, u16); + status = ares_buf_append_be16(buf, u16); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -432,7 +431,7 @@ ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list, * a prior entry */ if (list != NULL && (off == NULL || off->name_len != orig_name_len) && name_len > 0) { - status = ares__nameoffset_create(list, name /* not truncated copy! */, pos); + status = ares_nameoffset_create(list, name /* not truncated copy! */, pos); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -441,7 +440,7 @@ ares_status_t ares__dns_name_write(ares__buf_t *buf, ares__llist_t **list, status = ARES_SUCCESS; done: - ares__array_destroy(labels); + ares_array_destroy(labels); return status; } @@ -465,12 +464,12 @@ static ares_bool_t is_reservedch(int ch) return ARES_FALSE; } -static ares_status_t ares__fetch_dnsname_into_buf(ares__buf_t *buf, - ares__buf_t *dest, size_t len, - ares_bool_t is_hostname) +static ares_status_t ares_fetch_dnsname_into_buf(ares_buf_t *buf, + ares_buf_t *dest, size_t len, + ares_bool_t is_hostname) { size_t remaining_len; - const unsigned char *ptr = ares__buf_peek(buf, &remaining_len); + const unsigned char *ptr = ares_buf_peek(buf, &remaining_len); ares_status_t status; size_t i; @@ -483,7 +482,7 @@ static ares_status_t ares__fetch_dnsname_into_buf(ares__buf_t *buf, /* Hostnames have a very specific allowed character set. Anything outside * of that (non-printable and reserved included) are disallowed */ - if (is_hostname && !ares__is_hostnamech(c)) { + if (is_hostname && !ares_is_hostnamech(c)) { status = ARES_EBADRESP; goto fail; } @@ -495,7 +494,7 @@ static ares_status_t ares__fetch_dnsname_into_buf(ares__buf_t *buf, } /* Non-printable characters need to be output as \DDD */ - if (!ares__isprint(c)) { + if (!ares_isprint(c)) { unsigned char escape[4]; escape[0] = '\\'; @@ -503,7 +502,7 @@ static ares_status_t ares__fetch_dnsname_into_buf(ares__buf_t *buf, escape[2] = '0' + ((c % 100) / 10); escape[3] = '0' + (c % 10); - status = ares__buf_append(dest, escape, sizeof(escape)); + status = ares_buf_append(dest, escape, sizeof(escape)); if (status != ARES_SUCCESS) { goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -513,39 +512,39 @@ static ares_status_t ares__fetch_dnsname_into_buf(ares__buf_t *buf, /* Reserved characters need to be escaped, otherwise normal */ if (is_reservedch(c)) { - status = ares__buf_append_byte(dest, '\\'); + status = ares_buf_append_byte(dest, '\\'); if (status != ARES_SUCCESS) { goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } } - status = ares__buf_append_byte(dest, c); + status = ares_buf_append_byte(dest, c); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } } - return ares__buf_consume(buf, len); + return ares_buf_consume(buf, len); fail: return status; } -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) { size_t save_offset = 0; unsigned char c; ares_status_t status; - ares__buf_t *namebuf = NULL; - size_t label_start = ares__buf_get_position(buf); + ares_buf_t *namebuf = NULL; + size_t label_start = ares_buf_get_position(buf); if (buf == NULL) { return ARES_EFORMERR; } if (name != NULL) { - namebuf = ares__buf_create(); + namebuf = ares_buf_create(); if (namebuf == NULL) { status = ARES_ENOMEM; goto fail; @@ -562,11 +561,11 @@ ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name, while (1) { /* Keep track of the minimum label starting position to prevent forward * jumping */ - if (label_start > ares__buf_get_position(buf)) { - label_start = ares__buf_get_position(buf); + if (label_start > ares_buf_get_position(buf)) { + label_start = ares_buf_get_position(buf); } - status = ares__buf_fetch_bytes(buf, &c, 1); + status = ares_buf_fetch_bytes(buf, &c, 1); if (status != ARES_SUCCESS) { goto fail; } @@ -590,7 +589,7 @@ ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name, size_t offset = (size_t)((c & 0x3F) << 8); /* Fetch second byte of the redirect length */ - status = ares__buf_fetch_bytes(buf, &c, 1); + status = ares_buf_fetch_bytes(buf, &c, 1); if (status != ARES_SUCCESS) { goto fail; } @@ -612,10 +611,10 @@ ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name, /* First time we make a jump, save the current position */ if (save_offset == 0) { - save_offset = ares__buf_get_position(buf); + save_offset = ares_buf_get_position(buf); } - status = ares__buf_set_position(buf, offset); + status = ares_buf_set_position(buf, offset); if (status != ARES_SUCCESS) { status = ARES_EBADNAME; goto fail; @@ -634,14 +633,14 @@ ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name, /* New label */ /* Labels are separated by periods */ - if (ares__buf_len(namebuf) != 0 && name != NULL) { - status = ares__buf_append_byte(namebuf, '.'); + if (ares_buf_len(namebuf) != 0 && name != NULL) { + status = ares_buf_append_byte(namebuf, '.'); if (status != ARES_SUCCESS) { goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ } } - status = ares__fetch_dnsname_into_buf(buf, namebuf, c, is_hostname); + status = ares_fetch_dnsname_into_buf(buf, namebuf, c, is_hostname); if (status != ARES_SUCCESS) { goto fail; } @@ -650,11 +649,11 @@ ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name, /* Restore offset read after first redirect/pointer as this is where the DNS * message continues */ if (save_offset) { - ares__buf_set_position(buf, save_offset); + ares_buf_set_position(buf, save_offset); } if (name != NULL) { - *name = ares__buf_finish_str(namebuf, NULL); + *name = ares_buf_finish_str(namebuf, NULL); if (*name == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ goto fail; /* LCOV_EXCL_LINE: OutOfMemory */ @@ -669,6 +668,6 @@ ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name, status = ARES_EBADNAME; } - ares__buf_destroy(namebuf); + ares_buf_destroy(namebuf); return status; } diff --git a/lib/c-ares-1.33.1/src/lib/record/ares_dns_parse.c b/lib/c-ares-1.34.4/src/lib/record/ares_dns_parse.c similarity index 85% rename from lib/c-ares-1.33.1/src/lib/record/ares_dns_parse.c rename to lib/c-ares-1.34.4/src/lib/record/ares_dns_parse.c index 57cb0f714e1..0c545d7aa18 100644 --- a/lib/c-ares-1.33.1/src/lib/record/ares_dns_parse.c +++ b/lib/c-ares-1.34.4/src/lib/record/ares_dns_parse.c @@ -29,17 +29,17 @@ # include #endif -static size_t ares_dns_rr_remaining_len(const ares__buf_t *buf, size_t orig_len, +static size_t ares_dns_rr_remaining_len(const ares_buf_t *buf, size_t orig_len, size_t rdlength) { - size_t used_len = orig_len - ares__buf_len(buf); + size_t used_len = orig_len - ares_buf_len(buf); if (used_len >= rdlength) { return 0; } return rdlength - used_len; } -static ares_status_t ares_dns_parse_and_set_dns_name(ares__buf_t *buf, +static ares_status_t ares_dns_parse_and_set_dns_name(ares_buf_t *buf, ares_bool_t is_hostname, ares_dns_rr_t *rr, ares_dns_rr_key_t key) @@ -47,7 +47,7 @@ static ares_status_t ares_dns_parse_and_set_dns_name(ares__buf_t *buf, ares_status_t status; char *name = NULL; - status = ares__dns_name_parse(buf, &name, is_hostname); + status = ares_dns_name_parse(buf, &name, is_hostname); if (status != ARES_SUCCESS) { return status; } @@ -60,7 +60,7 @@ static ares_status_t ares_dns_parse_and_set_dns_name(ares__buf_t *buf, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_and_set_dns_str(ares__buf_t *buf, +static ares_status_t ares_dns_parse_and_set_dns_str(ares_buf_t *buf, size_t max_len, ares_dns_rr_t *rr, ares_dns_rr_key_t key, @@ -69,7 +69,7 @@ static ares_status_t ares_dns_parse_and_set_dns_str(ares__buf_t *buf, ares_status_t status; char *str = NULL; - status = ares__buf_parse_dns_str(buf, max_len, &str); + status = ares_buf_parse_dns_str(buf, max_len, &str); if (status != ARES_SUCCESS) { return status; } @@ -88,34 +88,35 @@ static ares_status_t ares_dns_parse_and_set_dns_str(ares__buf_t *buf, } static ares_status_t - ares_dns_parse_and_set_dns_abin(ares__buf_t *buf, size_t max_len, + ares_dns_parse_and_set_dns_abin(ares_buf_t *buf, size_t max_len, ares_dns_rr_t *rr, ares_dns_rr_key_t key, ares_bool_t validate_printable) { - ares_status_t status; - ares__dns_multistring_t *strs = NULL; + ares_status_t status; + ares_dns_multistring_t *strs = NULL; - status = ares__buf_parse_dns_abinstr(buf, max_len, &strs, validate_printable); + status = + ares_dns_multistring_parse_buf(buf, max_len, &strs, validate_printable); if (status != ARES_SUCCESS) { return status; } status = ares_dns_rr_set_abin_own(rr, key, strs); if (status != ARES_SUCCESS) { - ares__dns_multistring_destroy(strs); + ares_dns_multistring_destroy(strs); return status; } return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_and_set_be32(ares__buf_t *buf, +static ares_status_t ares_dns_parse_and_set_be32(ares_buf_t *buf, ares_dns_rr_t *rr, ares_dns_rr_key_t key) { ares_status_t status; unsigned int u32; - status = ares__buf_fetch_be32(buf, &u32); + status = ares_buf_fetch_be32(buf, &u32); if (status != ARES_SUCCESS) { return status; } @@ -123,14 +124,14 @@ static ares_status_t ares_dns_parse_and_set_be32(ares__buf_t *buf, return ares_dns_rr_set_u32(rr, key, u32); } -static ares_status_t ares_dns_parse_and_set_be16(ares__buf_t *buf, +static ares_status_t ares_dns_parse_and_set_be16(ares_buf_t *buf, ares_dns_rr_t *rr, ares_dns_rr_key_t key) { ares_status_t status; unsigned short u16; - status = ares__buf_fetch_be16(buf, &u16); + status = ares_buf_fetch_be16(buf, &u16); if (status != ARES_SUCCESS) { return status; } @@ -138,14 +139,14 @@ static ares_status_t ares_dns_parse_and_set_be16(ares__buf_t *buf, return ares_dns_rr_set_u16(rr, key, u16); } -static ares_status_t ares_dns_parse_and_set_u8(ares__buf_t *buf, +static ares_status_t ares_dns_parse_and_set_u8(ares_buf_t *buf, ares_dns_rr_t *rr, ares_dns_rr_key_t key) { ares_status_t status; unsigned char u8; - status = ares__buf_fetch_bytes(buf, &u8, 1); + status = ares_buf_fetch_bytes(buf, &u8, 1); if (status != ARES_SUCCESS) { return status; } @@ -153,7 +154,7 @@ static ares_status_t ares_dns_parse_and_set_u8(ares__buf_t *buf, return ares_dns_rr_set_u8(rr, key, u8); } -static ares_status_t ares_dns_parse_rr_a(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_a(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { struct in_addr addr; @@ -161,7 +162,7 @@ static ares_status_t ares_dns_parse_rr_a(ares__buf_t *buf, ares_dns_rr_t *rr, (void)rdlength; /* Not needed */ - status = ares__buf_fetch_bytes(buf, (unsigned char *)&addr, sizeof(addr)); + status = ares_buf_fetch_bytes(buf, (unsigned char *)&addr, sizeof(addr)); if (status != ARES_SUCCESS) { return status; } @@ -169,7 +170,7 @@ static ares_status_t ares_dns_parse_rr_a(ares__buf_t *buf, ares_dns_rr_t *rr, return ares_dns_rr_set_addr(rr, ARES_RR_A_ADDR, &addr); } -static ares_status_t ares_dns_parse_rr_ns(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_ns(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { (void)rdlength; /* Not needed */ @@ -178,8 +179,8 @@ static ares_status_t ares_dns_parse_rr_ns(ares__buf_t *buf, ares_dns_rr_t *rr, ARES_RR_NS_NSDNAME); } -static ares_status_t ares_dns_parse_rr_cname(ares__buf_t *buf, - ares_dns_rr_t *rr, size_t rdlength) +static ares_status_t ares_dns_parse_rr_cname(ares_buf_t *buf, ares_dns_rr_t *rr, + size_t rdlength) { (void)rdlength; /* Not needed */ @@ -187,7 +188,7 @@ static ares_status_t ares_dns_parse_rr_cname(ares__buf_t *buf, ARES_RR_CNAME_CNAME); } -static ares_status_t ares_dns_parse_rr_soa(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_soa(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { ares_status_t status; @@ -236,7 +237,7 @@ static ares_status_t ares_dns_parse_rr_soa(ares__buf_t *buf, ares_dns_rr_t *rr, return ares_dns_parse_and_set_be32(buf, rr, ARES_RR_SOA_MINIMUM); } -static ares_status_t ares_dns_parse_rr_ptr(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_ptr(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { (void)rdlength; /* Not needed */ @@ -245,11 +246,11 @@ static ares_status_t ares_dns_parse_rr_ptr(ares__buf_t *buf, ares_dns_rr_t *rr, ARES_RR_PTR_DNAME); } -static ares_status_t ares_dns_parse_rr_hinfo(ares__buf_t *buf, - ares_dns_rr_t *rr, size_t rdlength) +static ares_status_t ares_dns_parse_rr_hinfo(ares_buf_t *buf, ares_dns_rr_t *rr, + size_t rdlength) { ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); (void)rdlength; /* Not needed */ @@ -269,7 +270,7 @@ static ares_status_t ares_dns_parse_rr_hinfo(ares__buf_t *buf, return status; } -static ares_status_t ares_dns_parse_rr_mx(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_mx(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { ares_status_t status; @@ -287,18 +288,18 @@ static ares_status_t ares_dns_parse_rr_mx(ares__buf_t *buf, ares_dns_rr_t *rr, ARES_RR_MX_EXCHANGE); } -static ares_status_t ares_dns_parse_rr_txt(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_txt(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { return ares_dns_parse_and_set_dns_abin(buf, rdlength, rr, ARES_RR_TXT_DATA, ARES_FALSE); } -static ares_status_t ares_dns_parse_rr_sig(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_sig(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); size_t len; unsigned char *data; @@ -348,7 +349,7 @@ static ares_status_t ares_dns_parse_rr_sig(ares__buf_t *buf, ares_dns_rr_t *rr, return ARES_EBADRESP; } - status = ares__buf_fetch_bytes_dup(buf, len, ARES_FALSE, &data); + status = ares_buf_fetch_bytes_dup(buf, len, ARES_FALSE, &data); if (status != ARES_SUCCESS) { return status; } @@ -362,7 +363,7 @@ static ares_status_t ares_dns_parse_rr_sig(ares__buf_t *buf, ares_dns_rr_t *rr, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_rr_aaaa(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_aaaa(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { struct ares_in6_addr addr; @@ -370,7 +371,7 @@ static ares_status_t ares_dns_parse_rr_aaaa(ares__buf_t *buf, ares_dns_rr_t *rr, (void)rdlength; /* Not needed */ - status = ares__buf_fetch_bytes(buf, (unsigned char *)&addr, sizeof(addr)); + status = ares_buf_fetch_bytes(buf, (unsigned char *)&addr, sizeof(addr)); if (status != ARES_SUCCESS) { return status; } @@ -378,7 +379,7 @@ static ares_status_t ares_dns_parse_rr_aaaa(ares__buf_t *buf, ares_dns_rr_t *rr, return ares_dns_rr_set_addr6(rr, ARES_RR_AAAA_ADDR, &addr); } -static ares_status_t ares_dns_parse_rr_srv(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_srv(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { ares_status_t status; @@ -408,11 +409,11 @@ static ares_status_t ares_dns_parse_rr_srv(ares__buf_t *buf, ares_dns_rr_t *rr, ARES_RR_SRV_TARGET); } -static ares_status_t ares_dns_parse_rr_naptr(ares__buf_t *buf, - ares_dns_rr_t *rr, size_t rdlength) +static ares_status_t ares_dns_parse_rr_naptr(ares_buf_t *buf, ares_dns_rr_t *rr, + size_t rdlength) { ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); /* ORDER */ status = ares_dns_parse_and_set_be16(buf, rr, ARES_RR_NAPTR_ORDER); @@ -455,13 +456,13 @@ static ares_status_t ares_dns_parse_rr_naptr(ares__buf_t *buf, ARES_RR_NAPTR_REPLACEMENT); } -static ares_status_t ares_dns_parse_rr_opt(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_opt(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength, unsigned short raw_class, unsigned int raw_ttl) { ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); unsigned short rcode_high; status = ares_dns_rr_set_u16(rr, ARES_RR_OPT_UDP_SIZE, raw_class); @@ -493,19 +494,19 @@ static ares_status_t ares_dns_parse_rr_opt(ares__buf_t *buf, ares_dns_rr_t *rr, unsigned char *val = NULL; /* Fetch be16 option */ - status = ares__buf_fetch_be16(buf, &opt); + status = ares_buf_fetch_be16(buf, &opt); if (status != ARES_SUCCESS) { return status; } /* Fetch be16 length */ - status = ares__buf_fetch_be16(buf, &len); + status = ares_buf_fetch_be16(buf, &len); if (status != ARES_SUCCESS) { return status; } if (len) { - status = ares__buf_fetch_bytes_dup(buf, len, ARES_TRUE, &val); + status = ares_buf_fetch_bytes_dup(buf, len, ARES_TRUE, &val); if (status != ARES_SUCCESS) { return status; } @@ -520,11 +521,11 @@ static ares_status_t ares_dns_parse_rr_opt(ares__buf_t *buf, ares_dns_rr_t *rr, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_rr_tlsa(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_tlsa(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); size_t len; unsigned char *data; @@ -548,7 +549,7 @@ static ares_status_t ares_dns_parse_rr_tlsa(ares__buf_t *buf, ares_dns_rr_t *rr, return ARES_EBADRESP; } - status = ares__buf_fetch_bytes_dup(buf, len, ARES_FALSE, &data); + status = ares_buf_fetch_bytes_dup(buf, len, ARES_FALSE, &data); if (status != ARES_SUCCESS) { return status; } @@ -562,11 +563,11 @@ static ares_status_t ares_dns_parse_rr_tlsa(ares__buf_t *buf, ares_dns_rr_t *rr, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_rr_svcb(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_svcb(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); status = ares_dns_parse_and_set_be16(buf, rr, ARES_RR_SVCB_PRIORITY); if (status != ARES_SUCCESS) { @@ -586,19 +587,19 @@ static ares_status_t ares_dns_parse_rr_svcb(ares__buf_t *buf, ares_dns_rr_t *rr, unsigned char *val = NULL; /* Fetch be16 option */ - status = ares__buf_fetch_be16(buf, &opt); + status = ares_buf_fetch_be16(buf, &opt); if (status != ARES_SUCCESS) { return status; } /* Fetch be16 length */ - status = ares__buf_fetch_be16(buf, &len); + status = ares_buf_fetch_be16(buf, &len); if (status != ARES_SUCCESS) { return status; } if (len) { - status = ares__buf_fetch_bytes_dup(buf, len, ARES_TRUE, &val); + status = ares_buf_fetch_bytes_dup(buf, len, ARES_TRUE, &val); if (status != ARES_SUCCESS) { return status; } @@ -613,11 +614,11 @@ static ares_status_t ares_dns_parse_rr_svcb(ares__buf_t *buf, ares_dns_rr_t *rr, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_rr_https(ares__buf_t *buf, - ares_dns_rr_t *rr, size_t rdlength) +static ares_status_t ares_dns_parse_rr_https(ares_buf_t *buf, ares_dns_rr_t *rr, + size_t rdlength) { ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); status = ares_dns_parse_and_set_be16(buf, rr, ARES_RR_HTTPS_PRIORITY); if (status != ARES_SUCCESS) { @@ -637,19 +638,19 @@ static ares_status_t ares_dns_parse_rr_https(ares__buf_t *buf, unsigned char *val = NULL; /* Fetch be16 option */ - status = ares__buf_fetch_be16(buf, &opt); + status = ares_buf_fetch_be16(buf, &opt); if (status != ARES_SUCCESS) { return status; } /* Fetch be16 length */ - status = ares__buf_fetch_be16(buf, &len); + status = ares_buf_fetch_be16(buf, &len); if (status != ARES_SUCCESS) { return status; } if (len) { - status = ares__buf_fetch_bytes_dup(buf, len, ARES_TRUE, &val); + status = ares_buf_fetch_bytes_dup(buf, len, ARES_TRUE, &val); if (status != ARES_SUCCESS) { return status; } @@ -664,12 +665,12 @@ static ares_status_t ares_dns_parse_rr_https(ares__buf_t *buf, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_rr_uri(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_uri(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { char *name = NULL; ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); size_t remaining_len; /* PRIORITY */ @@ -693,12 +694,12 @@ static ares_status_t ares_dns_parse_rr_uri(ares__buf_t *buf, ares_dns_rr_t *rr, } /* NOTE: Not in DNS string format */ - status = ares__buf_fetch_str_dup(buf, remaining_len, &name); + status = ares_buf_fetch_str_dup(buf, remaining_len, &name); if (status != ARES_SUCCESS) { return status; } - if (!ares__str_isprint(name, remaining_len)) { + if (!ares_str_isprint(name, remaining_len)) { ares_free(name); return ARES_EBADRESP; } @@ -713,13 +714,13 @@ static ares_status_t ares_dns_parse_rr_uri(ares__buf_t *buf, ares_dns_rr_t *rr, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_rr_caa(ares__buf_t *buf, ares_dns_rr_t *rr, +static ares_status_t ares_dns_parse_rr_caa(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength) { unsigned char *data = NULL; size_t data_len = 0; ares_status_t status; - size_t orig_len = ares__buf_len(buf); + size_t orig_len = ares_buf_len(buf); /* CRITICAL */ status = ares_dns_parse_and_set_u8(buf, rr, ARES_RR_CAA_CRITICAL); @@ -741,7 +742,7 @@ static ares_status_t ares_dns_parse_rr_caa(ares__buf_t *buf, ares_dns_rr_t *rr, status = ARES_EBADRESP; return status; } - status = ares__buf_fetch_bytes_dup(buf, data_len, ARES_TRUE, &data); + status = ares_buf_fetch_bytes_dup(buf, data_len, ARES_TRUE, &data); if (status != ARES_SUCCESS) { return status; } @@ -756,7 +757,7 @@ static ares_status_t ares_dns_parse_rr_caa(ares__buf_t *buf, ares_dns_rr_t *rr, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_rr_raw_rr(ares__buf_t *buf, +static ares_status_t ares_dns_parse_rr_raw_rr(ares_buf_t *buf, ares_dns_rr_t *rr, size_t rdlength, unsigned short raw_type) @@ -768,7 +769,7 @@ static ares_status_t ares_dns_parse_rr_raw_rr(ares__buf_t *buf, return ARES_SUCCESS; } - status = ares__buf_fetch_bytes_dup(buf, rdlength, ARES_FALSE, &bytes); + status = ares_buf_fetch_bytes_dup(buf, rdlength, ARES_FALSE, &bytes); if (status != ARES_SUCCESS) { return status; } @@ -789,7 +790,7 @@ static ares_status_t ares_dns_parse_rr_raw_rr(ares__buf_t *buf, return ARES_SUCCESS; } -static ares_status_t ares_dns_parse_header(ares__buf_t *buf, unsigned int flags, +static ares_status_t ares_dns_parse_header(ares_buf_t *buf, unsigned int flags, ares_dns_record_t **dnsrec, unsigned short *qdcount, unsigned short *ancount, @@ -833,13 +834,13 @@ static ares_status_t ares_dns_parse_header(ares__buf_t *buf, unsigned int flags, */ /* ID */ - status = ares__buf_fetch_be16(buf, &id); + status = ares_buf_fetch_be16(buf, &id); if (status != ARES_SUCCESS) { goto fail; } /* Flags */ - status = ares__buf_fetch_be16(buf, &u16); + status = ares_buf_fetch_be16(buf, &u16); if (status != ARES_SUCCESS) { goto fail; } @@ -888,25 +889,25 @@ static ares_status_t ares_dns_parse_header(ares__buf_t *buf, unsigned int flags, rcode = u16 & 0xf; /* QDCOUNT */ - status = ares__buf_fetch_be16(buf, qdcount); + status = ares_buf_fetch_be16(buf, qdcount); if (status != ARES_SUCCESS) { goto fail; } /* ANCOUNT */ - status = ares__buf_fetch_be16(buf, ancount); + status = ares_buf_fetch_be16(buf, ancount); if (status != ARES_SUCCESS) { goto fail; } /* NSCOUNT */ - status = ares__buf_fetch_be16(buf, nscount); + status = ares_buf_fetch_be16(buf, nscount); if (status != ARES_SUCCESS) { goto fail; } /* ARCOUNT */ - status = ares__buf_fetch_be16(buf, arcount); + status = ares_buf_fetch_be16(buf, arcount); if (status != ARES_SUCCESS) { goto fail; } @@ -957,7 +958,7 @@ static ares_status_t ares_dns_parse_header(ares__buf_t *buf, unsigned int flags, } static ares_status_t - ares_dns_parse_rr_data(ares__buf_t *buf, size_t rdlength, ares_dns_rr_t *rr, + ares_dns_parse_rr_data(ares_buf_t *buf, size_t rdlength, ares_dns_rr_t *rr, ares_dns_rec_type_t type, unsigned short raw_type, unsigned short raw_class, unsigned int raw_ttl) { @@ -1006,7 +1007,7 @@ static ares_status_t return ARES_EFORMERR; } -static ares_status_t ares_dns_parse_qd(ares__buf_t *buf, +static ares_status_t ares_dns_parse_qd(ares_buf_t *buf, ares_dns_record_t *dnsrec) { char *name = NULL; @@ -1031,20 +1032,20 @@ static ares_status_t ares_dns_parse_qd(ares__buf_t *buf, */ /* Name */ - status = ares__dns_name_parse(buf, &name, ARES_FALSE); + status = ares_dns_name_parse(buf, &name, ARES_FALSE); if (status != ARES_SUCCESS) { goto done; } /* Type */ - status = ares__buf_fetch_be16(buf, &u16); + status = ares_buf_fetch_be16(buf, &u16); if (status != ARES_SUCCESS) { goto done; } type = u16; /* Class */ - status = ares__buf_fetch_be16(buf, &u16); + status = ares_buf_fetch_be16(buf, &u16); if (status != ARES_SUCCESS) { goto done; } @@ -1061,7 +1062,7 @@ static ares_status_t ares_dns_parse_qd(ares__buf_t *buf, return status; } -static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, +static ares_status_t ares_dns_parse_rr(ares_buf_t *buf, unsigned int flags, ares_dns_section_t sect, ares_dns_record_t *dnsrec) { @@ -1102,13 +1103,13 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, */ /* Name */ - status = ares__dns_name_parse(buf, &name, ARES_FALSE); + status = ares_dns_name_parse(buf, &name, ARES_FALSE); if (status != ARES_SUCCESS) { goto done; } /* Type */ - status = ares__buf_fetch_be16(buf, &u16); + status = ares_buf_fetch_be16(buf, &u16); if (status != ARES_SUCCESS) { goto done; } @@ -1116,20 +1117,20 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, raw_type = u16; /* Only used for raw rr data */ /* Class */ - status = ares__buf_fetch_be16(buf, &u16); + status = ares_buf_fetch_be16(buf, &u16); if (status != ARES_SUCCESS) { goto done; } qclass = u16; /* TTL */ - status = ares__buf_fetch_be32(buf, &ttl); + status = ares_buf_fetch_be32(buf, &ttl); if (status != ARES_SUCCESS) { goto done; } /* Length */ - status = ares__buf_fetch_be16(buf, &u16); + status = ares_buf_fetch_be16(buf, &u16); if (status != ARES_SUCCESS) { goto done; } @@ -1139,7 +1140,7 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, type = ARES_REC_TYPE_RAW_RR; } - namecomp = ares_dns_rec_type_allow_name_compression(type); + namecomp = ares_dns_rec_allow_name_comp(type); if (sect == ARES_SECTION_ANSWER && (flags & (namecomp ? ARES_DNS_PARSE_AN_BASE_RAW : ARES_DNS_PARSE_AN_EXT_RAW))) { @@ -1157,7 +1158,7 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, } /* Pull into another buffer for safety */ - if (rdlength > ares__buf_len(buf)) { + if (rdlength > ares_buf_len(buf)) { status = ARES_EBADRESP; goto done; } @@ -1173,7 +1174,7 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, /* Record the current remaining length in the buffer so we can tell how * much was processed */ - remaining_len = ares__buf_len(buf); + remaining_len = ares_buf_len(buf); /* Fill in the data for the rr */ status = ares_dns_parse_rr_data(buf, rdlength, rr, type, raw_type, @@ -1183,7 +1184,7 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, } /* Determine how many bytes were processed */ - processed_len = remaining_len - ares__buf_len(buf); + processed_len = remaining_len - ares_buf_len(buf); /* If too many bytes were processed, error! */ if (processed_len > rdlength) { @@ -1194,7 +1195,7 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, /* If too few bytes were processed, consume the unprocessed data for this * record as the parser may not have wanted/needed to use it */ if (processed_len < rdlength) { - ares__buf_consume(buf, rdlength - processed_len); + ares_buf_consume(buf, rdlength - processed_len); } @@ -1203,7 +1204,7 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags, return status; } -static ares_status_t ares_dns_parse_buf(ares__buf_t *buf, unsigned int flags, +static ares_status_t ares_dns_parse_buf(ares_buf_t *buf, unsigned int flags, ares_dns_record_t **dnsrec) { ares_status_t status; @@ -1218,7 +1219,7 @@ static ares_status_t ares_dns_parse_buf(ares__buf_t *buf, unsigned int flags, } /* Maximum DNS packet size is 64k, even over TCP */ - if (ares__buf_len(buf) > 0xFFFF) { + if (ares_buf_len(buf) > 0xFFFF) { return ARES_EFORMERR; } @@ -1309,20 +1310,20 @@ static ares_status_t ares_dns_parse_buf(ares__buf_t *buf, unsigned int flags, ares_status_t ares_dns_parse(const unsigned char *buf, size_t buf_len, unsigned int flags, ares_dns_record_t **dnsrec) { - ares__buf_t *parser = NULL; + ares_buf_t *parser = NULL; ares_status_t status; if (buf == NULL || buf_len == 0 || dnsrec == NULL) { return ARES_EFORMERR; } - parser = ares__buf_create_const(buf, buf_len); + parser = ares_buf_create_const(buf, buf_len); if (parser == NULL) { return ARES_ENOMEM; } status = ares_dns_parse_buf(parser, flags, dnsrec); - ares__buf_destroy(parser); + ares_buf_destroy(parser); return status; } diff --git a/lib/c-ares-1.33.1/src/lib/record/ares_dns_private.h b/lib/c-ares-1.34.4/src/lib/record/ares_dns_private.h similarity index 71% rename from lib/c-ares-1.33.1/src/lib/record/ares_dns_private.h rename to lib/c-ares-1.34.4/src/lib/record/ares_dns_private.h index 5b86fed51f9..e8fd600d1d2 100644 --- a/lib/c-ares-1.33.1/src/lib/record/ares_dns_private.h +++ b/lib/c-ares-1.34.4/src/lib/record/ares_dns_private.h @@ -26,26 +26,26 @@ #ifndef __ARES_DNS_PRIVATE_H #define __ARES_DNS_PRIVATE_H -ares_status_t ares_dns_record_duplicate_ex(ares_dns_record_t **dest, - const ares_dns_record_t *src); -ares_bool_t ares_dns_rec_type_allow_name_compression(ares_dns_rec_type_t type); -ares_bool_t ares_dns_opcode_isvalid(ares_dns_opcode_t opcode); -ares_bool_t ares_dns_rcode_isvalid(ares_dns_rcode_t rcode); -ares_bool_t ares_dns_flags_arevalid(unsigned short flags); -ares_bool_t ares_dns_rec_type_isvalid(ares_dns_rec_type_t type, - ares_bool_t is_query); -ares_bool_t ares_dns_class_isvalid(ares_dns_class_t qclass, - ares_dns_rec_type_t type, - ares_bool_t is_query); -ares_bool_t ares_dns_section_isvalid(ares_dns_section_t sect); +ares_status_t ares_dns_record_duplicate_ex(ares_dns_record_t **dest, + const ares_dns_record_t *src); +ares_bool_t ares_dns_rec_allow_name_comp(ares_dns_rec_type_t type); +ares_bool_t ares_dns_opcode_isvalid(ares_dns_opcode_t opcode); +ares_bool_t ares_dns_rcode_isvalid(ares_dns_rcode_t rcode); +ares_bool_t ares_dns_flags_arevalid(unsigned short flags); +ares_bool_t ares_dns_rec_type_isvalid(ares_dns_rec_type_t type, + ares_bool_t is_query); +ares_bool_t ares_dns_class_isvalid(ares_dns_class_t qclass, + ares_dns_rec_type_t type, + ares_bool_t is_query); +ares_bool_t ares_dns_section_isvalid(ares_dns_section_t sect); ares_status_t ares_dns_rr_set_str_own(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, char *val); ares_status_t ares_dns_rr_set_bin_own(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, unsigned char *val, size_t len); -ares_status_t ares_dns_rr_set_abin_own(ares_dns_rr_t *dns_rr, - ares_dns_rr_key_t key, - ares__dns_multistring_t *strs); +ares_status_t ares_dns_rr_set_abin_own(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + ares_dns_multistring_t *strs); ares_status_t ares_dns_rr_set_opt_own(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, unsigned short opt, unsigned char *val, size_t val_len); @@ -53,16 +53,16 @@ ares_status_t ares_dns_record_rr_prealloc(ares_dns_record_t *dnsrec, ares_dns_section_t sect, size_t cnt); ares_dns_rr_t *ares_dns_get_opt_rr(ares_dns_record_t *rec); const ares_dns_rr_t *ares_dns_get_opt_rr_const(const ares_dns_record_t *rec); -void ares_dns_record_write_ttl_decrement(ares_dns_record_t *dnsrec, - unsigned int ttl_decrement); +void ares_dns_record_ttl_decrement(ares_dns_record_t *dnsrec, + unsigned int ttl_decrement); /* Same as ares_dns_write() but appends to an existing buffer object */ -ares_status_t ares_dns_write_buf(const ares_dns_record_t *dnsrec, - ares__buf_t *buf); +ares_status_t ares_dns_write_buf(const ares_dns_record_t *dnsrec, + ares_buf_t *buf); /* Same as ares_dns_write_buf(), but prepends a 16bit length */ -ares_status_t ares_dns_write_buf_tcp(const ares_dns_record_t *dnsrec, - ares__buf_t *buf); +ares_status_t ares_dns_write_buf_tcp(const ares_dns_record_t *dnsrec, + ares_buf_t *buf); /*! Create a DNS record object for a query. The arguments are the same as * those for ares_create_query(). @@ -99,15 +99,15 @@ struct ares_dns_qd { typedef struct { struct in_addr addr; -} ares__dns_a_t; +} ares_dns_a_t; typedef struct { char *nsdname; -} ares__dns_ns_t; +} ares_dns_ns_t; typedef struct { char *cname; -} ares__dns_cname_t; +} ares_dns_cname_t; typedef struct { char *mname; @@ -117,25 +117,25 @@ typedef struct { unsigned int retry; unsigned int expire; unsigned int minimum; -} ares__dns_soa_t; +} ares_dns_soa_t; typedef struct { char *dname; -} ares__dns_ptr_t; +} ares_dns_ptr_t; typedef struct { char *cpu; char *os; -} ares__dns_hinfo_t; +} ares_dns_hinfo_t; typedef struct { unsigned short preference; char *exchange; -} ares__dns_mx_t; +} ares_dns_mx_t; typedef struct { - ares__dns_multistring_t *strs; -} ares__dns_txt_t; + ares_dns_multistring_t *strs; +} ares_dns_txt_t; typedef struct { unsigned short type_covered; @@ -148,18 +148,18 @@ typedef struct { char *signers_name; unsigned char *signature; size_t signature_len; -} ares__dns_sig_t; +} ares_dns_sig_t; typedef struct { struct ares_in6_addr addr; -} ares__dns_aaaa_t; +} ares_dns_aaaa_t; typedef struct { unsigned short priority; unsigned short weight; unsigned short port; char *target; -} ares__dns_srv_t; +} ares_dns_srv_t; typedef struct { unsigned short order; @@ -168,21 +168,21 @@ typedef struct { char *services; char *regexp; char *replacement; -} ares__dns_naptr_t; +} ares_dns_naptr_t; typedef struct { unsigned short opt; unsigned char *val; size_t val_len; -} ares__dns_optval_t; +} ares_dns_optval_t; typedef struct { unsigned short udp_size; /*!< taken from class */ unsigned char version; /*!< taken from bits 8-16 of ttl */ unsigned short flags; /*!< Flags, remaining 16 bits, though only * 1 currently defined */ - ares__array_t *options; /*!< Type is ares__dns_optval_t */ -} ares__dns_opt_t; + ares_array_t *options; /*!< Type is ares_dns_optval_t */ +} ares_dns_opt_t; typedef struct { unsigned char cert_usage; @@ -190,26 +190,26 @@ typedef struct { unsigned char match; unsigned char *data; size_t data_len; -} ares__dns_tlsa_t; +} ares_dns_tlsa_t; typedef struct { unsigned short priority; char *target; - ares__array_t *params; /*!< Type is ares__dns_optval_t */ -} ares__dns_svcb_t; + ares_array_t *params; /*!< Type is ares_dns_optval_t */ +} ares_dns_svcb_t; typedef struct { unsigned short priority; unsigned short weight; char *target; -} ares__dns_uri_t; +} ares_dns_uri_t; typedef struct { unsigned char critical; char *tag; unsigned char *value; size_t value_len; -} ares__dns_caa_t; +} ares_dns_caa_t; /*! Raw, unparsed RR data */ typedef struct { @@ -217,7 +217,7 @@ typedef struct { * of those values since it wasn't parsed */ unsigned char *data; /*!< Raw RR data */ size_t length; /*!< Length of raw RR data */ -} ares__dns_raw_rr_t; +} ares_dns_raw_rr_t; /*! DNS RR data structure */ struct ares_dns_rr { @@ -228,25 +228,25 @@ struct ares_dns_rr { unsigned int ttl; union { - ares__dns_a_t a; - ares__dns_ns_t ns; - ares__dns_cname_t cname; - ares__dns_soa_t soa; - ares__dns_ptr_t ptr; - ares__dns_hinfo_t hinfo; - ares__dns_mx_t mx; - ares__dns_txt_t txt; - ares__dns_sig_t sig; - ares__dns_aaaa_t aaaa; - ares__dns_srv_t srv; - ares__dns_naptr_t naptr; - ares__dns_opt_t opt; - ares__dns_tlsa_t tlsa; - ares__dns_svcb_t svcb; - ares__dns_svcb_t https; /*!< https is a type of svcb, so this is right */ - ares__dns_uri_t uri; - ares__dns_caa_t caa; - ares__dns_raw_rr_t raw_rr; + ares_dns_a_t a; + ares_dns_ns_t ns; + ares_dns_cname_t cname; + ares_dns_soa_t soa; + ares_dns_ptr_t ptr; + ares_dns_hinfo_t hinfo; + ares_dns_mx_t mx; + ares_dns_txt_t txt; + ares_dns_sig_t sig; + ares_dns_aaaa_t aaaa; + ares_dns_srv_t srv; + ares_dns_naptr_t naptr; + ares_dns_opt_t opt; + ares_dns_tlsa_t tlsa; + ares_dns_svcb_t svcb; + ares_dns_svcb_t https; /*!< https is a type of svcb, so this is right */ + ares_dns_uri_t uri; + ares_dns_caa_t caa; + ares_dns_raw_rr_t raw_rr; } r; }; @@ -264,10 +264,10 @@ struct ares_dns_record { * the ttl of any resource records by * this amount. Used for cache */ - ares__array_t *qd; /*!< Type is ares_dns_qd_t */ - ares__array_t *an; /*!< Type is ares_dns_rr_t */ - ares__array_t *ns; /*!< Type is ares_dns_rr_t */ - ares__array_t *ar; /*!< Type is ares_dns_rr_t */ + ares_array_t *qd; /*!< Type is ares_dns_qd_t */ + ares_array_t *an; /*!< Type is ares_dns_rr_t */ + ares_array_t *ns; /*!< Type is ares_dns_rr_t */ + ares_array_t *ar; /*!< Type is ares_dns_rr_t */ }; #endif diff --git a/lib/c-ares-1.33.1/src/lib/record/ares_dns_record.c b/lib/c-ares-1.34.4/src/lib/record/ares_dns_record.c similarity index 88% rename from lib/c-ares-1.33.1/src/lib/record/ares_dns_record.c rename to lib/c-ares-1.34.4/src/lib/record/ares_dns_record.c index 14704949094..ec0dfbd13c4 100644 --- a/lib/c-ares-1.33.1/src/lib/record/ares_dns_record.c +++ b/lib/c-ares-1.34.4/src/lib/record/ares_dns_record.c @@ -29,7 +29,7 @@ # include #endif -static void ares__dns_rr_free(ares_dns_rr_t *rr); +static void ares_dns_rr_free(ares_dns_rr_t *rr); static void ares_dns_qd_free_cb(void *arg) { @@ -46,7 +46,7 @@ static void ares_dns_rr_free_cb(void *arg) if (rr == NULL) { return; } - ares__dns_rr_free(rr); + ares_dns_rr_free(rr); } ares_status_t ares_dns_record_create(ares_dns_record_t **dnsrec, @@ -74,14 +74,10 @@ ares_status_t ares_dns_record_create(ares_dns_record_t **dnsrec, (*dnsrec)->flags = flags; (*dnsrec)->opcode = opcode; (*dnsrec)->rcode = rcode; - (*dnsrec)->qd = - ares__array_create(sizeof(ares_dns_qd_t), ares_dns_qd_free_cb); - (*dnsrec)->an = - ares__array_create(sizeof(ares_dns_rr_t), ares_dns_rr_free_cb); - (*dnsrec)->ns = - ares__array_create(sizeof(ares_dns_rr_t), ares_dns_rr_free_cb); - (*dnsrec)->ar = - ares__array_create(sizeof(ares_dns_rr_t), ares_dns_rr_free_cb); + (*dnsrec)->qd = ares_array_create(sizeof(ares_dns_qd_t), ares_dns_qd_free_cb); + (*dnsrec)->an = ares_array_create(sizeof(ares_dns_rr_t), ares_dns_rr_free_cb); + (*dnsrec)->ns = ares_array_create(sizeof(ares_dns_rr_t), ares_dns_rr_free_cb); + (*dnsrec)->ar = ares_array_create(sizeof(ares_dns_rr_t), ares_dns_rr_free_cb); if ((*dnsrec)->qd == NULL || (*dnsrec)->an == NULL || (*dnsrec)->ns == NULL || (*dnsrec)->ar == NULL) { @@ -134,7 +130,7 @@ ares_dns_rcode_t ares_dns_record_get_rcode(const ares_dns_record_t *dnsrec) return dnsrec->rcode; } -static void ares__dns_rr_free(ares_dns_rr_t *rr) +static void ares_dns_rr_free(ares_dns_rr_t *rr) { ares_free(rr->name); @@ -172,7 +168,7 @@ static void ares__dns_rr_free(ares_dns_rr_t *rr) break; case ARES_REC_TYPE_TXT: - ares__dns_multistring_destroy(rr->r.txt.strs); + ares_dns_multistring_destroy(rr->r.txt.strs); break; case ARES_REC_TYPE_SIG: @@ -192,7 +188,7 @@ static void ares__dns_rr_free(ares_dns_rr_t *rr) break; case ARES_REC_TYPE_OPT: - ares__array_destroy(rr->r.opt.options); + ares_array_destroy(rr->r.opt.options); break; case ARES_REC_TYPE_TLSA: @@ -201,12 +197,12 @@ static void ares__dns_rr_free(ares_dns_rr_t *rr) case ARES_REC_TYPE_SVCB: ares_free(rr->r.svcb.target); - ares__array_destroy(rr->r.svcb.params); + ares_array_destroy(rr->r.svcb.params); break; case ARES_REC_TYPE_HTTPS: ares_free(rr->r.https.target); - ares__array_destroy(rr->r.https.params); + ares_array_destroy(rr->r.https.params); break; case ARES_REC_TYPE_URI: @@ -231,16 +227,16 @@ void ares_dns_record_destroy(ares_dns_record_t *dnsrec) } /* Free questions */ - ares__array_destroy(dnsrec->qd); + ares_array_destroy(dnsrec->qd); /* Free answers */ - ares__array_destroy(dnsrec->an); + ares_array_destroy(dnsrec->an); /* Free authority */ - ares__array_destroy(dnsrec->ns); + ares_array_destroy(dnsrec->ns); /* Free additional */ - ares__array_destroy(dnsrec->ar); + ares_array_destroy(dnsrec->ar); ares_free(dnsrec); } @@ -250,7 +246,7 @@ size_t ares_dns_record_query_cnt(const ares_dns_record_t *dnsrec) if (dnsrec == NULL) { return 0; } - return ares__array_len(dnsrec->qd); + return ares_array_len(dnsrec->qd); } ares_status_t ares_dns_record_query_add(ares_dns_record_t *dnsrec, @@ -268,15 +264,15 @@ ares_status_t ares_dns_record_query_add(ares_dns_record_t *dnsrec, return ARES_EFORMERR; } - idx = ares__array_len(dnsrec->qd); - status = ares__array_insert_last((void **)&qd, dnsrec->qd); + idx = ares_array_len(dnsrec->qd); + status = ares_array_insert_last((void **)&qd, dnsrec->qd); if (status != ARES_SUCCESS) { return status; } qd->name = ares_strdup(name); if (qd->name == NULL) { - ares__array_remove_at(dnsrec->qd, idx); + ares_array_remove_at(dnsrec->qd, idx); return ARES_ENOMEM; } qd->qtype = qtype; @@ -290,11 +286,11 @@ ares_status_t ares_dns_record_query_set_name(ares_dns_record_t *dnsrec, char *orig_name = NULL; ares_dns_qd_t *qd; - if (dnsrec == NULL || idx >= ares__array_len(dnsrec->qd) || name == NULL) { + if (dnsrec == NULL || idx >= ares_array_len(dnsrec->qd) || name == NULL) { return ARES_EFORMERR; } - qd = ares__array_at(dnsrec->qd, idx); + qd = ares_array_at(dnsrec->qd, idx); orig_name = qd->name; qd->name = ares_strdup(name); @@ -313,12 +309,12 @@ ares_status_t ares_dns_record_query_set_type(ares_dns_record_t *dnsrec, { ares_dns_qd_t *qd; - if (dnsrec == NULL || idx >= ares__array_len(dnsrec->qd) || + if (dnsrec == NULL || idx >= ares_array_len(dnsrec->qd) || !ares_dns_rec_type_isvalid(qtype, ARES_TRUE)) { return ARES_EFORMERR; } - qd = ares__array_at(dnsrec->qd, idx); + qd = ares_array_at(dnsrec->qd, idx); qd->qtype = qtype; return ARES_SUCCESS; @@ -330,11 +326,11 @@ ares_status_t ares_dns_record_query_get(const ares_dns_record_t *dnsrec, ares_dns_class_t *qclass) { const ares_dns_qd_t *qd; - if (dnsrec == NULL || idx >= ares__array_len(dnsrec->qd)) { + if (dnsrec == NULL || idx >= ares_array_len(dnsrec->qd)) { return ARES_EFORMERR; } - qd = ares__array_at(dnsrec->qd, idx); + qd = ares_array_at(dnsrec->qd, idx); if (name != NULL) { *name = qd->name; } @@ -359,11 +355,11 @@ size_t ares_dns_record_rr_cnt(const ares_dns_record_t *dnsrec, switch (sect) { case ARES_SECTION_ANSWER: - return ares__array_len(dnsrec->an); + return ares_array_len(dnsrec->an); case ARES_SECTION_AUTHORITY: - return ares__array_len(dnsrec->ns); + return ares_array_len(dnsrec->ns); case ARES_SECTION_ADDITIONAL: - return ares__array_len(dnsrec->ar); + return ares_array_len(dnsrec->ar); } return 0; /* LCOV_EXCL_LINE: DefensiveCoding */ @@ -372,7 +368,7 @@ size_t ares_dns_record_rr_cnt(const ares_dns_record_t *dnsrec, ares_status_t ares_dns_record_rr_prealloc(ares_dns_record_t *dnsrec, ares_dns_section_t sect, size_t cnt) { - ares__array_t *arr = NULL; + ares_array_t *arr = NULL; if (dnsrec == NULL || !ares_dns_section_isvalid(sect)) { return ARES_EFORMERR; @@ -390,11 +386,11 @@ ares_status_t ares_dns_record_rr_prealloc(ares_dns_record_t *dnsrec, break; } - if (cnt < ares__array_len(arr)) { + if (cnt < ares_array_len(arr)) { return ARES_EFORMERR; } - return ares__array_set_size(arr, cnt); + return ares_array_set_size(arr, cnt); } ares_status_t ares_dns_record_rr_add(ares_dns_rr_t **rr_out, @@ -404,7 +400,7 @@ ares_status_t ares_dns_record_rr_add(ares_dns_rr_t **rr_out, ares_dns_class_t rclass, unsigned int ttl) { ares_dns_rr_t *rr = NULL; - ares__array_t *arr = NULL; + ares_array_t *arr = NULL; ares_status_t status; size_t idx; @@ -429,15 +425,15 @@ ares_status_t ares_dns_record_rr_add(ares_dns_rr_t **rr_out, break; } - idx = ares__array_len(arr); - status = ares__array_insert_last((void **)&rr, arr); + idx = ares_array_len(arr); + status = ares_array_insert_last((void **)&rr, arr); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } rr->name = ares_strdup(name); if (rr->name == NULL) { - ares__array_remove_at(arr, idx); + ares_array_remove_at(arr, idx); return ARES_ENOMEM; } @@ -454,7 +450,7 @@ ares_status_t ares_dns_record_rr_add(ares_dns_rr_t **rr_out, ares_status_t ares_dns_record_rr_del(ares_dns_record_t *dnsrec, ares_dns_section_t sect, size_t idx) { - ares__array_t *arr = NULL; + ares_array_t *arr = NULL; if (dnsrec == NULL || !ares_dns_section_isvalid(sect)) { return ARES_EFORMERR; @@ -472,13 +468,13 @@ ares_status_t ares_dns_record_rr_del(ares_dns_record_t *dnsrec, break; } - return ares__array_remove_at(arr, idx); + return ares_array_remove_at(arr, idx); } ares_dns_rr_t *ares_dns_record_rr_get(ares_dns_record_t *dnsrec, ares_dns_section_t sect, size_t idx) { - ares__array_t *arr = NULL; + ares_array_t *arr = NULL; if (dnsrec == NULL || !ares_dns_section_isvalid(sect)) { return NULL; @@ -496,7 +492,7 @@ ares_dns_rr_t *ares_dns_record_rr_get(ares_dns_record_t *dnsrec, break; } - return ares__array_at(arr, idx); + return ares_array_at(arr, idx); } const ares_dns_rr_t * @@ -849,14 +845,14 @@ const unsigned char *ares_dns_rr_get_bin(const ares_dns_rr_t *dns_rr, /* Array of strings, return concatenated version */ if (ares_dns_rr_key_datatype(key) == ARES_DATATYPE_ABINP) { - ares__dns_multistring_t * const *strs = + ares_dns_multistring_t * const *strs = ares_dns_rr_data_ptr_const(dns_rr, key, NULL); if (strs == NULL) { return NULL; } - return ares__dns_multistring_get_combined(*strs, len); + return ares_dns_multistring_combined(*strs, len); } /* Not a multi-string, just straight binary data */ @@ -877,7 +873,7 @@ const unsigned char *ares_dns_rr_get_bin(const ares_dns_rr_t *dns_rr, size_t ares_dns_rr_get_abin_cnt(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key) { - ares__dns_multistring_t * const *strs; + ares_dns_multistring_t * const *strs; if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) { return 0; @@ -888,14 +884,14 @@ size_t ares_dns_rr_get_abin_cnt(const ares_dns_rr_t *dns_rr, return 0; } - return ares__dns_multistring_cnt(*strs); + return ares_dns_multistring_cnt(*strs); } const unsigned char *ares_dns_rr_get_abin(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, size_t idx, size_t *len) { - ares__dns_multistring_t * const *strs; + ares_dns_multistring_t * const *strs; if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) { return NULL; @@ -906,13 +902,13 @@ const unsigned char *ares_dns_rr_get_abin(const ares_dns_rr_t *dns_rr, return NULL; } - return ares__dns_multistring_get(*strs, idx, len); + return ares_dns_multistring_get(*strs, idx, len); } ares_status_t ares_dns_rr_del_abin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, size_t idx) { - ares__dns_multistring_t **strs; + ares_dns_multistring_t **strs; if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) { return ARES_EFORMERR; @@ -923,7 +919,7 @@ ares_status_t ares_dns_rr_del_abin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, return ARES_EFORMERR; } - return ares__dns_multistring_del(*strs, idx); + return ares_dns_multistring_del(*strs, idx); } ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, @@ -933,9 +929,9 @@ ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, ares_dns_datatype_t datatype = ares_dns_rr_key_datatype(key); ares_bool_t is_nullterm = (datatype == ARES_DATATYPE_ABINP) ? ARES_TRUE : ARES_FALSE; - size_t alloclen = is_nullterm ? len + 1 : len; - unsigned char *temp; - ares__dns_multistring_t **strs; + size_t alloclen = is_nullterm ? len + 1 : len; + unsigned char *temp; + ares_dns_multistring_t **strs; if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) { return ARES_EFORMERR; @@ -947,7 +943,7 @@ ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, } if (*strs == NULL) { - *strs = ares__dns_multistring_create(); + *strs = ares_dns_multistring_create(); if (*strs == NULL) { return ARES_ENOMEM; } @@ -965,7 +961,7 @@ ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, temp[len] = 0; } - status = ares__dns_multistring_add_own(*strs, temp, len); + status = ares_dns_multistring_add_own(*strs, temp, len); if (status != ARES_SUCCESS) { ares_free(temp); } @@ -994,7 +990,7 @@ const char *ares_dns_rr_get_str(const ares_dns_rr_t *dns_rr, size_t ares_dns_rr_get_opt_cnt(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key) { - ares__array_t * const *opts; + ares_array_t * const *opts; if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_OPT) { return 0; @@ -1005,15 +1001,15 @@ size_t ares_dns_rr_get_opt_cnt(const ares_dns_rr_t *dns_rr, return 0; } - return ares__array_len(*opts); + return ares_array_len(*opts); } unsigned short ares_dns_rr_get_opt(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, size_t idx, const unsigned char **val, size_t *val_len) { - ares__array_t * const *opts; - const ares__dns_optval_t *opt; + ares_array_t * const *opts; + const ares_dns_optval_t *opt; if (val) { *val = NULL; @@ -1031,7 +1027,7 @@ unsigned short ares_dns_rr_get_opt(const ares_dns_rr_t *dns_rr, return 65535; } - opt = ares__array_at(*opts, idx); + opt = ares_array_at(*opts, idx); if (opt == NULL) { return 65535; } @@ -1050,10 +1046,10 @@ ares_bool_t ares_dns_rr_get_opt_byid(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, unsigned short opt, const unsigned char **val, size_t *val_len) { - ares__array_t * const *opts; - size_t i; - size_t cnt; - const ares__dns_optval_t *optptr = NULL; + ares_array_t * const *opts; + size_t i; + size_t cnt; + const ares_dns_optval_t *optptr = NULL; if (val) { *val = NULL; @@ -1071,9 +1067,9 @@ ares_bool_t ares_dns_rr_get_opt_byid(const ares_dns_rr_t *dns_rr, return ARES_FALSE; } - cnt = ares__array_len(*opts); + cnt = ares_array_len(*opts); for (i = 0; i < cnt; i++) { - optptr = ares__array_at(*opts, i); + optptr = ares_array_at(*opts, i); if (optptr == NULL) { return ARES_FALSE; } @@ -1200,22 +1196,22 @@ ares_status_t ares_dns_rr_set_bin_own(ares_dns_rr_t *dns_rr, } if (ares_dns_rr_key_datatype(key) == ARES_DATATYPE_ABINP) { - ares__dns_multistring_t **strs = ares_dns_rr_data_ptr(dns_rr, key, NULL); + ares_dns_multistring_t **strs = ares_dns_rr_data_ptr(dns_rr, key, NULL); if (strs == NULL) { return ARES_EFORMERR; } if (*strs == NULL) { - *strs = ares__dns_multistring_create(); + *strs = ares_dns_multistring_create(); if (*strs == NULL) { return ARES_ENOMEM; } } /* Clear all existing entries as this is an override */ - ares__dns_multistring_clear(*strs); + ares_dns_multistring_clear(*strs); - return ares__dns_multistring_add_own(*strs, val, len); + return ares_dns_multistring_add_own(*strs, val, len); } bin = ares_dns_rr_data_ptr(dns_rr, key, &bin_len); @@ -1307,11 +1303,11 @@ ares_status_t ares_dns_rr_set_str(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, return status; } -ares_status_t ares_dns_rr_set_abin_own(ares_dns_rr_t *dns_rr, - ares_dns_rr_key_t key, - ares__dns_multistring_t *strs) +ares_status_t ares_dns_rr_set_abin_own(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + ares_dns_multistring_t *strs) { - ares__dns_multistring_t **strs_ptr; + ares_dns_multistring_t **strs_ptr; if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) { return ARES_EFORMERR; @@ -1323,16 +1319,16 @@ ares_status_t ares_dns_rr_set_abin_own(ares_dns_rr_t *dns_rr, } if (*strs_ptr != NULL) { - ares__dns_multistring_destroy(*strs_ptr); + ares_dns_multistring_destroy(*strs_ptr); } *strs_ptr = strs; return ARES_SUCCESS; } -static void ares__dns_opt_free_cb(void *arg) +static void ares_dns_opt_free_cb(void *arg) { - ares__dns_optval_t *opt = arg; + ares_dns_optval_t *opt = arg; if (opt == NULL) { return; } @@ -1343,11 +1339,11 @@ ares_status_t ares_dns_rr_set_opt_own(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, unsigned short opt, unsigned char *val, size_t val_len) { - ares__array_t **options; - ares__dns_optval_t *optptr = NULL; - size_t idx; - size_t cnt; - ares_status_t status; + ares_array_t **options; + ares_dns_optval_t *optptr = NULL; + size_t idx; + size_t cnt; + ares_status_t status; if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_OPT) { return ARES_EFORMERR; @@ -1360,15 +1356,15 @@ ares_status_t ares_dns_rr_set_opt_own(ares_dns_rr_t *dns_rr, if (*options == NULL) { *options = - ares__array_create(sizeof(ares__dns_optval_t), ares__dns_opt_free_cb); + ares_array_create(sizeof(ares_dns_optval_t), ares_dns_opt_free_cb); } if (*options == NULL) { return ARES_ENOMEM; } - cnt = ares__array_len(*options); + cnt = ares_array_len(*options); for (idx = 0; idx < cnt; idx++) { - optptr = ares__array_at(*options, idx); + optptr = ares_array_at(*options, idx); if (optptr == NULL) { return ARES_EFORMERR; } @@ -1382,7 +1378,7 @@ ares_status_t ares_dns_rr_set_opt_own(ares_dns_rr_t *dns_rr, goto done; } - status = ares__array_insert_last((void **)&optptr, *options); + status = ares_array_insert_last((void **)&optptr, *options); if (status != ARES_SUCCESS) { return status; } @@ -1424,10 +1420,10 @@ ares_status_t ares_dns_rr_del_opt_byid(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, unsigned short opt) { - ares__array_t **options; - const ares__dns_optval_t *optptr; - size_t idx; - size_t cnt; + ares_array_t **options; + const ares_dns_optval_t *optptr; + size_t idx; + size_t cnt; if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_OPT) { return ARES_EFORMERR; @@ -1443,14 +1439,14 @@ ares_status_t ares_dns_rr_del_opt_byid(ares_dns_rr_t *dns_rr, return ARES_SUCCESS; } - cnt = ares__array_len(*options); + cnt = ares_array_len(*options); for (idx = 0; idx < cnt; idx++) { - optptr = ares__array_at_const(*options, idx); + optptr = ares_array_at_const(*options, idx); if (optptr == NULL) { return ARES_ENOTFOUND; } if (optptr->opt == opt) { - return ares__array_remove_at(*options, idx); + return ares_array_remove_at(*options, idx); } } @@ -1459,7 +1455,7 @@ ares_status_t ares_dns_rr_del_opt_byid(ares_dns_rr_t *dns_rr, char *ares_dns_addr_to_ptr(const struct ares_addr *addr) { - ares__buf_t *buf = NULL; + ares_buf_t *buf = NULL; const unsigned char *ptr = NULL; size_t ptr_len = 0; size_t i; @@ -1470,7 +1466,7 @@ char *ares_dns_addr_to_ptr(const struct ares_addr *addr) goto fail; } - buf = ares__buf_create(); + buf = ares_buf_create(); if (buf == NULL) { goto fail; } @@ -1485,47 +1481,47 @@ char *ares_dns_addr_to_ptr(const struct ares_addr *addr) for (i = ptr_len; i > 0; i--) { if (addr->family == AF_INET) { - status = ares__buf_append_num_dec(buf, (size_t)ptr[i - 1], 0); + status = ares_buf_append_num_dec(buf, (size_t)ptr[i - 1], 0); } else { unsigned char c; c = ptr[i - 1] & 0xF; - status = ares__buf_append_byte(buf, hexbytes[c]); + status = ares_buf_append_byte(buf, hexbytes[c]); if (status != ARES_SUCCESS) { goto fail; } - status = ares__buf_append_byte(buf, '.'); + status = ares_buf_append_byte(buf, '.'); if (status != ARES_SUCCESS) { goto fail; } c = (ptr[i - 1] >> 4) & 0xF; - status = ares__buf_append_byte(buf, hexbytes[c]); + status = ares_buf_append_byte(buf, hexbytes[c]); } if (status != ARES_SUCCESS) { goto fail; } - status = ares__buf_append_byte(buf, '.'); + status = ares_buf_append_byte(buf, '.'); if (status != ARES_SUCCESS) { goto fail; } } if (addr->family == AF_INET) { - status = ares__buf_append(buf, (const unsigned char *)"in-addr.arpa", 12); + status = ares_buf_append(buf, (const unsigned char *)"in-addr.arpa", 12); } else { - status = ares__buf_append(buf, (const unsigned char *)"ip6.arpa", 8); + status = ares_buf_append(buf, (const unsigned char *)"ip6.arpa", 8); } if (status != ARES_SUCCESS) { goto fail; } - return ares__buf_finish_str(buf, NULL); + return ares_buf_finish_str(buf, NULL); fail: - ares__buf_destroy(buf); + ares_buf_destroy(buf); return NULL; } @@ -1575,7 +1571,7 @@ ares_status_t *dnsrec = NULL; /* 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 done; } diff --git a/lib/c-ares-1.33.1/src/lib/record/ares_dns_write.c b/lib/c-ares-1.34.4/src/lib/record/ares_dns_write.c similarity index 78% rename from lib/c-ares-1.33.1/src/lib/record/ares_dns_write.c rename to lib/c-ares-1.34.4/src/lib/record/ares_dns_write.c index 8a3addd9f01..549017ffbc1 100644 --- a/lib/c-ares-1.33.1/src/lib/record/ares_dns_write.c +++ b/lib/c-ares-1.34.4/src/lib/record/ares_dns_write.c @@ -31,7 +31,7 @@ static ares_status_t ares_dns_write_header(const ares_dns_record_t *dnsrec, - ares__buf_t *buf) + ares_buf_t *buf) { unsigned short u16; unsigned short opcode; @@ -40,7 +40,7 @@ static ares_status_t ares_dns_write_header(const ares_dns_record_t *dnsrec, ares_status_t status; /* ID */ - status = ares__buf_append_be16(buf, dnsrec->id); + status = ares_buf_append_be16(buf, dnsrec->id); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -99,35 +99,35 @@ static ares_status_t ares_dns_write_header(const ares_dns_record_t *dnsrec, } u16 |= rcode; - status = ares__buf_append_be16(buf, u16); + status = ares_buf_append_be16(buf, u16); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* QDCOUNT */ - status = ares__buf_append_be16( + status = ares_buf_append_be16( buf, (unsigned short)ares_dns_record_query_cnt(dnsrec)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* ANCOUNT */ - status = ares__buf_append_be16( + status = ares_buf_append_be16( buf, (unsigned short)ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ANSWER)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* NSCOUNT */ - status = ares__buf_append_be16(buf, (unsigned short)ares_dns_record_rr_cnt( - dnsrec, ARES_SECTION_AUTHORITY)); + status = ares_buf_append_be16(buf, (unsigned short)ares_dns_record_rr_cnt( + dnsrec, ARES_SECTION_AUTHORITY)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* ARCOUNT */ - status = ares__buf_append_be16(buf, (unsigned short)ares_dns_record_rr_cnt( - dnsrec, ARES_SECTION_ADDITIONAL)); + status = ares_buf_append_be16(buf, (unsigned short)ares_dns_record_rr_cnt( + dnsrec, ARES_SECTION_ADDITIONAL)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -136,8 +136,8 @@ static ares_status_t ares_dns_write_header(const ares_dns_record_t *dnsrec, } static ares_status_t ares_dns_write_questions(const ares_dns_record_t *dnsrec, - ares__llist_t **namelist, - ares__buf_t *buf) + ares_llist_t **namelist, + ares_buf_t *buf) { size_t i; @@ -153,19 +153,19 @@ static ares_status_t ares_dns_write_questions(const ares_dns_record_t *dnsrec, } /* Name */ - status = ares__dns_name_write(buf, namelist, ARES_TRUE, name); + status = ares_dns_name_write(buf, namelist, ARES_TRUE, name); if (status != ARES_SUCCESS) { return status; } /* Type */ - status = ares__buf_append_be16(buf, (unsigned short)qtype); + status = ares_buf_append_be16(buf, (unsigned short)qtype); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* Class */ - status = ares__buf_append_be16(buf, (unsigned short)qclass); + status = ares_buf_append_be16(buf, (unsigned short)qclass); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -174,9 +174,9 @@ static ares_status_t ares_dns_write_questions(const ares_dns_record_t *dnsrec, return ARES_SUCCESS; } -static ares_status_t ares_dns_write_rr_name(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_name(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist, + ares_llist_t **namelist, ares_bool_t validate_hostname, ares_dns_rr_key_t key) { @@ -187,10 +187,10 @@ static ares_status_t ares_dns_write_rr_name(ares__buf_t *buf, return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - return ares__dns_name_write(buf, namelist, validate_hostname, name); + return ares_dns_name_write(buf, namelist, validate_hostname, name); } -static ares_status_t ares_dns_write_rr_str(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_str(ares_buf_t *buf, const ares_dns_rr_t *rr, ares_dns_rr_key_t key) { @@ -209,7 +209,7 @@ static ares_status_t ares_dns_write_rr_str(ares__buf_t *buf, } /* Write 1 byte length */ - status = ares__buf_append_byte(buf, (unsigned char)(len & 0xFF)); + status = ares_buf_append_byte(buf, (unsigned char)(len & 0xFF)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -219,10 +219,10 @@ static ares_status_t ares_dns_write_rr_str(ares__buf_t *buf, } /* Write string */ - return ares__buf_append(buf, (const unsigned char *)str, len); + return ares_buf_append(buf, (const unsigned char *)str, len); } -static ares_status_t ares_dns_write_binstr(ares__buf_t *buf, +static ares_status_t ares_dns_write_binstr(ares_buf_t *buf, const unsigned char *bin, size_t bin_len) { @@ -240,14 +240,14 @@ static ares_status_t ares_dns_write_binstr(ares__buf_t *buf, } /* Length */ - status = ares__buf_append_byte(buf, (unsigned char)(len & 0xFF)); + status = ares_buf_append_byte(buf, (unsigned char)(len & 0xFF)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* String */ if (len) { - status = ares__buf_append(buf, ptr, len); + status = ares_buf_append(buf, ptr, len); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -260,7 +260,7 @@ static ares_status_t ares_dns_write_binstr(ares__buf_t *buf, return ARES_SUCCESS; } -static ares_status_t ares_dns_write_rr_abin(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_abin(ares_buf_t *buf, const ares_dns_rr_t *rr, ares_dns_rr_key_t key) { @@ -287,39 +287,39 @@ static ares_status_t ares_dns_write_rr_abin(ares__buf_t *buf, return status; } -static ares_status_t ares_dns_write_rr_be32(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_be32(ares_buf_t *buf, const ares_dns_rr_t *rr, ares_dns_rr_key_t key) { if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_U32) { return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - return ares__buf_append_be32(buf, ares_dns_rr_get_u32(rr, key)); + return ares_buf_append_be32(buf, ares_dns_rr_get_u32(rr, key)); } -static ares_status_t ares_dns_write_rr_be16(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_be16(ares_buf_t *buf, const ares_dns_rr_t *rr, ares_dns_rr_key_t key) { if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_U16) { return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - return ares__buf_append_be16(buf, ares_dns_rr_get_u16(rr, key)); + return ares_buf_append_be16(buf, ares_dns_rr_get_u16(rr, key)); } -static ares_status_t ares_dns_write_rr_u8(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_u8(ares_buf_t *buf, const ares_dns_rr_t *rr, ares_dns_rr_key_t key) { if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_U8) { return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - return ares__buf_append_byte(buf, ares_dns_rr_get_u8(rr, key)); + return ares_buf_append_byte(buf, ares_dns_rr_get_u8(rr, key)); } -static ares_status_t ares_dns_write_rr_a(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_a(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { const struct in_addr *addr; (void)namelist; @@ -329,28 +329,28 @@ static ares_status_t ares_dns_write_rr_a(ares__buf_t *buf, return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - return ares__buf_append(buf, (const unsigned char *)addr, sizeof(*addr)); + return ares_buf_append(buf, (const unsigned char *)addr, sizeof(*addr)); } -static ares_status_t ares_dns_write_rr_ns(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_ns(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { return ares_dns_write_rr_name(buf, rr, namelist, ARES_FALSE, ARES_RR_NS_NSDNAME); } -static ares_status_t ares_dns_write_rr_cname(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_cname(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { return ares_dns_write_rr_name(buf, rr, namelist, ARES_FALSE, ARES_RR_CNAME_CNAME); } -static ares_status_t ares_dns_write_rr_soa(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_soa(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; @@ -396,17 +396,17 @@ static ares_status_t ares_dns_write_rr_soa(ares__buf_t *buf, return ares_dns_write_rr_be32(buf, rr, ARES_RR_SOA_MINIMUM); } -static ares_status_t ares_dns_write_rr_ptr(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_ptr(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { return ares_dns_write_rr_name(buf, rr, namelist, ARES_FALSE, ARES_RR_PTR_DNAME); } -static ares_status_t ares_dns_write_rr_hinfo(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_hinfo(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; @@ -422,9 +422,9 @@ static ares_status_t ares_dns_write_rr_hinfo(ares__buf_t *buf, return ares_dns_write_rr_str(buf, rr, ARES_RR_HINFO_OS); } -static ares_status_t ares_dns_write_rr_mx(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_mx(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; @@ -439,17 +439,17 @@ static ares_status_t ares_dns_write_rr_mx(ares__buf_t *buf, ARES_RR_MX_EXCHANGE); } -static ares_status_t ares_dns_write_rr_txt(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_txt(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { (void)namelist; return ares_dns_write_rr_abin(buf, rr, ARES_RR_TXT_DATA); } -static ares_status_t ares_dns_write_rr_sig(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_sig(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; const unsigned char *data; @@ -512,12 +512,12 @@ static ares_status_t ares_dns_write_rr_sig(ares__buf_t *buf, return ARES_EFORMERR; } - return ares__buf_append(buf, data, len); + return ares_buf_append(buf, data, len); } -static ares_status_t ares_dns_write_rr_aaaa(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_aaaa(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { const struct ares_in6_addr *addr; (void)namelist; @@ -527,12 +527,12 @@ static ares_status_t ares_dns_write_rr_aaaa(ares__buf_t *buf, return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - return ares__buf_append(buf, (const unsigned char *)addr, sizeof(*addr)); + return ares_buf_append(buf, (const unsigned char *)addr, sizeof(*addr)); } -static ares_status_t ares_dns_write_rr_srv(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_srv(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; @@ -559,9 +559,9 @@ static ares_status_t ares_dns_write_rr_srv(ares__buf_t *buf, ARES_RR_SRV_TARGET); } -static ares_status_t ares_dns_write_rr_naptr(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_naptr(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; @@ -600,11 +600,11 @@ static ares_status_t ares_dns_write_rr_naptr(ares__buf_t *buf, ARES_RR_NAPTR_REPLACEMENT); } -static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_opt(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { - size_t len = ares__buf_len(buf); + size_t len = ares_buf_len(buf); ares_status_t status; unsigned int ttl = 0; size_t i; @@ -620,9 +620,9 @@ static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf, /* We need to go back and overwrite the class and ttl that were emitted as * the OPT record overloads them for its own use (yes, very strange!) */ - status = ares__buf_set_length(buf, len - 2 /* RDLENGTH */ - - 4 /* TTL */ - - 2 /* CLASS */); + status = ares_buf_set_length(buf, len - 2 /* RDLENGTH */ + - 4 /* TTL */ + - 2 /* CLASS */); if (status != ARES_SUCCESS) { return status; } @@ -638,13 +638,13 @@ static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf, ttl |= (unsigned int)ares_dns_rr_get_u8(rr, ARES_RR_OPT_VERSION) << 16; ttl |= (unsigned int)ares_dns_rr_get_u16(rr, ARES_RR_OPT_FLAGS); - status = ares__buf_append_be32(buf, ttl); + status = ares_buf_append_be32(buf, ttl); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* Now go back to real end */ - status = ares__buf_set_length(buf, len); + status = ares_buf_set_length(buf, len); if (status != ARES_SUCCESS) { return status; } @@ -658,20 +658,20 @@ static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf, opt = ares_dns_rr_get_opt(rr, ARES_RR_OPT_OPTIONS, i, &val, &val_len); /* BE16 option */ - status = ares__buf_append_be16(buf, opt); + status = ares_buf_append_be16(buf, opt); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* BE16 length */ - status = ares__buf_append_be16(buf, (unsigned short)(val_len & 0xFFFF)); + status = ares_buf_append_be16(buf, (unsigned short)(val_len & 0xFFFF)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* Value */ if (val && val_len) { - status = ares__buf_append(buf, val, val_len); + status = ares_buf_append(buf, val, val_len); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -681,9 +681,9 @@ static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf, return ARES_SUCCESS; } -static ares_status_t ares_dns_write_rr_tlsa(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_tlsa(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; const unsigned char *data; @@ -715,12 +715,12 @@ static ares_status_t ares_dns_write_rr_tlsa(ares__buf_t *buf, return ARES_EFORMERR; } - return ares__buf_append(buf, data, len); + return ares_buf_append(buf, data, len); } -static ares_status_t ares_dns_write_rr_svcb(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_svcb(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; size_t i; @@ -747,20 +747,20 @@ static ares_status_t ares_dns_write_rr_svcb(ares__buf_t *buf, opt = ares_dns_rr_get_opt(rr, ARES_RR_SVCB_PARAMS, i, &val, &val_len); /* BE16 option */ - status = ares__buf_append_be16(buf, opt); + status = ares_buf_append_be16(buf, opt); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* BE16 length */ - status = ares__buf_append_be16(buf, (unsigned short)(val_len & 0xFFFF)); + status = ares_buf_append_be16(buf, (unsigned short)(val_len & 0xFFFF)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* Value */ if (val && val_len) { - status = ares__buf_append(buf, val, val_len); + status = ares_buf_append(buf, val, val_len); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -769,9 +769,9 @@ static ares_status_t ares_dns_write_rr_svcb(ares__buf_t *buf, return ARES_SUCCESS; } -static ares_status_t ares_dns_write_rr_https(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_https(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; size_t i; @@ -798,20 +798,20 @@ static ares_status_t ares_dns_write_rr_https(ares__buf_t *buf, opt = ares_dns_rr_get_opt(rr, ARES_RR_HTTPS_PARAMS, i, &val, &val_len); /* BE16 option */ - status = ares__buf_append_be16(buf, opt); + status = ares_buf_append_be16(buf, opt); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* BE16 length */ - status = ares__buf_append_be16(buf, (unsigned short)(val_len & 0xFFFF)); + status = ares_buf_append_be16(buf, (unsigned short)(val_len & 0xFFFF)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* Value */ if (val && val_len) { - status = ares__buf_append(buf, val, val_len); + status = ares_buf_append(buf, val, val_len); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -820,9 +820,9 @@ static ares_status_t ares_dns_write_rr_https(ares__buf_t *buf, return ARES_SUCCESS; } -static ares_status_t ares_dns_write_rr_uri(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_uri(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { ares_status_t status; const char *target; @@ -848,13 +848,13 @@ static ares_status_t ares_dns_write_rr_uri(ares__buf_t *buf, return ARES_EFORMERR; } - return ares__buf_append(buf, (const unsigned char *)target, - ares_strlen(target)); + return ares_buf_append(buf, (const unsigned char *)target, + ares_strlen(target)); } -static ares_status_t ares_dns_write_rr_caa(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_caa(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { const unsigned char *data = NULL; size_t data_len = 0; @@ -880,14 +880,14 @@ static ares_status_t ares_dns_write_rr_caa(ares__buf_t *buf, return ARES_EFORMERR; } - return ares__buf_append(buf, data, data_len); + return ares_buf_append(buf, data, data_len); } -static ares_status_t ares_dns_write_rr_raw_rr(ares__buf_t *buf, +static ares_status_t ares_dns_write_rr_raw_rr(ares_buf_t *buf, const ares_dns_rr_t *rr, - ares__llist_t **namelist) + ares_llist_t **namelist) { - size_t len = ares__buf_len(buf); + size_t len = ares_buf_len(buf); ares_status_t status; const unsigned char *data = NULL; size_t data_len = 0; @@ -902,10 +902,10 @@ static ares_status_t ares_dns_write_rr_raw_rr(ares__buf_t *buf, /* We need to go back and overwrite the type that was emitted by the parent * function */ - status = ares__buf_set_length(buf, len - 2 /* RDLENGTH */ - - 4 /* TTL */ - - 2 /* CLASS */ - - 2 /* TYPE */); + status = ares_buf_set_length(buf, len - 2 /* RDLENGTH */ + - 4 /* TTL */ + - 2 /* CLASS */ + - 2 /* TYPE */); if (status != ARES_SUCCESS) { return status; } @@ -916,7 +916,7 @@ static ares_status_t ares_dns_write_rr_raw_rr(ares__buf_t *buf, } /* Now go back to real end */ - status = ares__buf_set_length(buf, len); + status = ares_buf_set_length(buf, len); if (status != ARES_SUCCESS) { return status; } @@ -931,13 +931,13 @@ static ares_status_t ares_dns_write_rr_raw_rr(ares__buf_t *buf, return ARES_SUCCESS; } - return ares__buf_append(buf, data, data_len); + return ares_buf_append(buf, data, data_len); } static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec, - ares__llist_t **namelist, + ares_llist_t **namelist, ares_dns_section_t section, - ares__buf_t *buf) + ares_buf_t *buf) { size_t i; @@ -945,7 +945,7 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec, const ares_dns_rr_t *rr; ares_dns_rec_type_t type; ares_bool_t allow_compress; - ares__llist_t **namelistptr = NULL; + ares_llist_t **namelistptr = NULL; size_t pos_len; ares_status_t status; size_t rdlength; @@ -958,27 +958,27 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec, } type = ares_dns_rr_get_type(rr); - allow_compress = ares_dns_rec_type_allow_name_compression(type); + allow_compress = ares_dns_rec_allow_name_comp(type); if (allow_compress) { namelistptr = namelist; } /* Name */ status = - ares__dns_name_write(buf, namelist, ARES_TRUE, ares_dns_rr_get_name(rr)); + ares_dns_name_write(buf, namelist, ARES_TRUE, ares_dns_rr_get_name(rr)); if (status != ARES_SUCCESS) { return status; } /* Type */ - status = ares__buf_append_be16(buf, (unsigned short)type); + status = ares_buf_append_be16(buf, (unsigned short)type); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* Class */ status = - ares__buf_append_be16(buf, (unsigned short)ares_dns_rr_get_class(rr)); + ares_buf_append_be16(buf, (unsigned short)ares_dns_rr_get_class(rr)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -990,14 +990,14 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec, } else { ttl -= rr->parent->ttl_decrement; } - status = ares__buf_append_be32(buf, ttl); + status = ares_buf_append_be32(buf, ttl); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* Length */ - pos_len = ares__buf_len(buf); /* Save to write real length later */ - status = ares__buf_append_be16(buf, 0); + pos_len = ares_buf_len(buf); /* Save to write real length later */ + status = ares_buf_append_be16(buf, 0); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -1072,20 +1072,20 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec, /* Back off write pointer, write real length, then go back to proper * position */ - end_length = ares__buf_len(buf); + end_length = ares_buf_len(buf); rdlength = end_length - pos_len - 2; - status = ares__buf_set_length(buf, pos_len); + status = ares_buf_set_length(buf, pos_len); if (status != ARES_SUCCESS) { return status; } - status = ares__buf_append_be16(buf, (unsigned short)(rdlength & 0xFFFF)); + status = ares_buf_append_be16(buf, (unsigned short)(rdlength & 0xFFFF)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_set_length(buf, end_length); + status = ares_buf_set_length(buf, end_length); if (status != ARES_SUCCESS) { return status; } @@ -1095,17 +1095,17 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec, } ares_status_t ares_dns_write_buf(const ares_dns_record_t *dnsrec, - ares__buf_t *buf) + ares_buf_t *buf) { - ares__llist_t *namelist = NULL; - size_t orig_len; - ares_status_t status; + ares_llist_t *namelist = NULL; + size_t orig_len; + ares_status_t status; if (dnsrec == NULL || buf == NULL) { return ARES_EFORMERR; } - orig_len = ares__buf_len(buf); + orig_len = ares_buf_len(buf); status = ares_dns_write_header(dnsrec, buf); if (status != ARES_SUCCESS) { @@ -1133,16 +1133,16 @@ ares_status_t ares_dns_write_buf(const ares_dns_record_t *dnsrec, } done: - ares__llist_destroy(namelist); + ares_llist_destroy(namelist); if (status != ARES_SUCCESS) { - ares__buf_set_length(buf, orig_len); + ares_buf_set_length(buf, orig_len); } return status; } ares_status_t ares_dns_write_buf_tcp(const ares_dns_record_t *dnsrec, - ares__buf_t *buf) + ares_buf_t *buf) { ares_status_t status; size_t orig_len; @@ -1153,10 +1153,10 @@ ares_status_t ares_dns_write_buf_tcp(const ares_dns_record_t *dnsrec, return ARES_EFORMERR; } - orig_len = ares__buf_len(buf); + orig_len = ares_buf_len(buf); /* Write placeholder for length */ - status = ares__buf_append_be16(buf, 0); + status = ares_buf_append_be16(buf, 0); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -1167,7 +1167,7 @@ ares_status_t ares_dns_write_buf_tcp(const ares_dns_record_t *dnsrec, goto done; /* LCOV_EXCL_LINE: OutOfMemory */ } - len = ares__buf_len(buf); + len = ares_buf_len(buf); msg_len = len - orig_len - 2; if (msg_len > 65535) { status = ARES_EBADQUERY; @@ -1176,16 +1176,16 @@ ares_status_t ares_dns_write_buf_tcp(const ares_dns_record_t *dnsrec, /* Now we need to overwrite the length, so we jump back to the original * message length, overwrite the section and jump back */ - ares__buf_set_length(buf, orig_len); - status = ares__buf_append_be16(buf, (unsigned short)(msg_len & 0xFFFF)); + ares_buf_set_length(buf, orig_len); + status = ares_buf_append_be16(buf, (unsigned short)(msg_len & 0xFFFF)); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: UntestablePath */ } - ares__buf_set_length(buf, len); + ares_buf_set_length(buf, len); done: if (status != ARES_SUCCESS) { - ares__buf_set_length(buf, orig_len); + ares_buf_set_length(buf, orig_len); } return status; } @@ -1193,7 +1193,7 @@ ares_status_t ares_dns_write_buf_tcp(const ares_dns_record_t *dnsrec, ares_status_t ares_dns_write(const ares_dns_record_t *dnsrec, unsigned char **buf, size_t *buf_len) { - ares__buf_t *b = NULL; + ares_buf_t *b = NULL; ares_status_t status; if (buf == NULL || buf_len == NULL || dnsrec == NULL) { @@ -1203,7 +1203,7 @@ ares_status_t ares_dns_write(const ares_dns_record_t *dnsrec, *buf = NULL; *buf_len = 0; - b = ares__buf_create(); + b = ares_buf_create(); if (b == NULL) { return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -1211,16 +1211,16 @@ ares_status_t ares_dns_write(const ares_dns_record_t *dnsrec, status = ares_dns_write_buf(dnsrec, b); if (status != ARES_SUCCESS) { - ares__buf_destroy(b); + ares_buf_destroy(b); return status; } - *buf = ares__buf_finish_bin(b, buf_len); + *buf = ares_buf_finish_bin(b, buf_len); return status; } -void ares_dns_record_write_ttl_decrement(ares_dns_record_t *dnsrec, - unsigned int ttl_decrement) +void ares_dns_record_ttl_decrement(ares_dns_record_t *dnsrec, + unsigned int ttl_decrement) { if (dnsrec == NULL) { return; diff --git a/lib/c-ares-1.33.1/src/lib/str/ares__buf.c b/lib/c-ares-1.34.4/src/lib/str/ares_buf.c similarity index 52% rename from lib/c-ares-1.33.1/src/lib/str/ares__buf.c rename to lib/c-ares-1.34.4/src/lib/str/ares_buf.c index bf6d4a0e1d3..63acc6cf771 100644 --- a/lib/c-ares-1.33.1/src/lib/str/ares__buf.c +++ b/lib/c-ares-1.34.4/src/lib/str/ares_buf.c @@ -24,13 +24,13 @@ * SPDX-License-Identifier: MIT */ #include "ares_private.h" -#include "ares__buf.h" +#include "ares_buf.h" #include #ifdef HAVE_STDINT_H # include #endif -struct ares__buf { +struct ares_buf { const unsigned char *data; /*!< pointer to start of data buffer */ size_t data_len; /*!< total size of data in buffer */ @@ -43,9 +43,9 @@ struct ares__buf { * SIZE_MAX if not set. */ }; -ares__buf_t *ares__buf_create(void) +ares_buf_t *ares_buf_create(void) { - ares__buf_t *buf = ares_malloc_zero(sizeof(*buf)); + ares_buf_t *buf = ares_malloc_zero(sizeof(*buf)); if (buf == NULL) { return NULL; } @@ -54,15 +54,15 @@ ares__buf_t *ares__buf_create(void) return buf; } -ares__buf_t *ares__buf_create_const(const unsigned char *data, size_t data_len) +ares_buf_t *ares_buf_create_const(const unsigned char *data, size_t data_len) { - ares__buf_t *buf; + ares_buf_t *buf; if (data == NULL || data_len == 0) { return NULL; } - buf = ares__buf_create(); + buf = ares_buf_create(); if (buf == NULL) { return NULL; } @@ -73,7 +73,7 @@ ares__buf_t *ares__buf_create_const(const unsigned char *data, size_t data_len) return buf; } -void ares__buf_destroy(ares__buf_t *buf) +void ares_buf_destroy(ares_buf_t *buf) { if (buf == NULL) { return; @@ -82,7 +82,7 @@ void ares__buf_destroy(ares__buf_t *buf) ares_free(buf); } -static ares_bool_t ares__buf_is_const(const ares__buf_t *buf) +static ares_bool_t ares_buf_is_const(const ares_buf_t *buf) { if (buf == NULL) { return ARES_FALSE; /* LCOV_EXCL_LINE: DefensiveCoding */ @@ -95,7 +95,7 @@ static ares_bool_t ares__buf_is_const(const ares__buf_t *buf) return ARES_FALSE; } -void ares__buf_reclaim(ares__buf_t *buf) +void ares_buf_reclaim(ares_buf_t *buf) { size_t prefix_size; size_t data_size; @@ -104,7 +104,7 @@ void ares__buf_reclaim(ares__buf_t *buf) return; } - if (ares__buf_is_const(buf)) { + if (ares_buf_is_const(buf)) { return; /* LCOV_EXCL_LINE: DefensiveCoding */ } @@ -135,8 +135,7 @@ void ares__buf_reclaim(ares__buf_t *buf) } } -static ares_status_t ares__buf_ensure_space(ares__buf_t *buf, - size_t needed_size) +static ares_status_t ares_buf_ensure_space(ares_buf_t *buf, size_t needed_size) { size_t remaining_size; size_t alloc_size; @@ -146,11 +145,11 @@ static ares_status_t ares__buf_ensure_space(ares__buf_t *buf, return ARES_EFORMERR; } - if (ares__buf_is_const(buf)) { + if (ares_buf_is_const(buf)) { return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - /* When calling ares__buf_finish_str() we end up adding a null terminator, + /* When calling ares_buf_finish_str() we end up adding a null terminator, * so we want to ensure the size is always sufficient for this as we don't * want an ARES_ENOMEM at that point */ needed_size++; @@ -162,7 +161,7 @@ static ares_status_t ares__buf_ensure_space(ares__buf_t *buf, } /* See if just moving consumed data frees up enough space */ - ares__buf_reclaim(buf); + ares_buf_reclaim(buf); remaining_size = buf->alloc_buf_len - buf->data_len; if (remaining_size >= needed_size) { @@ -194,9 +193,9 @@ static ares_status_t ares__buf_ensure_space(ares__buf_t *buf, return ARES_SUCCESS; } -ares_status_t ares__buf_set_length(ares__buf_t *buf, size_t len) +ares_status_t ares_buf_set_length(ares_buf_t *buf, size_t len) { - if (buf == NULL || ares__buf_is_const(buf)) { + if (buf == NULL || ares_buf_is_const(buf)) { return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } @@ -208,8 +207,8 @@ ares_status_t ares__buf_set_length(ares__buf_t *buf, size_t len) return ARES_SUCCESS; } -ares_status_t ares__buf_append(ares__buf_t *buf, const unsigned char *data, - size_t data_len) +ares_status_t ares_buf_append(ares_buf_t *buf, const unsigned char *data, + size_t data_len) { ares_status_t status; @@ -221,7 +220,7 @@ ares_status_t ares__buf_append(ares__buf_t *buf, const unsigned char *data, return ARES_SUCCESS; } - status = ares__buf_ensure_space(buf, data_len); + status = ares_buf_ensure_space(buf, data_len); if (status != ARES_SUCCESS) { return status; } @@ -231,21 +230,21 @@ ares_status_t ares__buf_append(ares__buf_t *buf, const unsigned char *data, return ARES_SUCCESS; } -ares_status_t ares__buf_append_byte(ares__buf_t *buf, unsigned char b) +ares_status_t ares_buf_append_byte(ares_buf_t *buf, unsigned char b) { - return ares__buf_append(buf, &b, 1); + return ares_buf_append(buf, &b, 1); } -ares_status_t ares__buf_append_be16(ares__buf_t *buf, unsigned short u16) +ares_status_t ares_buf_append_be16(ares_buf_t *buf, unsigned short u16) { ares_status_t status; - status = ares__buf_append_byte(buf, (unsigned char)((u16 >> 8) & 0xff)); + status = ares_buf_append_byte(buf, (unsigned char)((u16 >> 8) & 0xff)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_append_byte(buf, (unsigned char)(u16 & 0xff)); + status = ares_buf_append_byte(buf, (unsigned char)(u16 & 0xff)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -253,26 +252,26 @@ ares_status_t ares__buf_append_be16(ares__buf_t *buf, unsigned short u16) return ARES_SUCCESS; } -ares_status_t ares__buf_append_be32(ares__buf_t *buf, unsigned int u32) +ares_status_t ares_buf_append_be32(ares_buf_t *buf, unsigned int u32) { ares_status_t status; - status = ares__buf_append_byte(buf, ((unsigned char)(u32 >> 24) & 0xff)); + status = ares_buf_append_byte(buf, ((unsigned char)(u32 >> 24) & 0xff)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_append_byte(buf, ((unsigned char)(u32 >> 16) & 0xff)); + status = ares_buf_append_byte(buf, ((unsigned char)(u32 >> 16) & 0xff)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_append_byte(buf, ((unsigned char)(u32 >> 8) & 0xff)); + status = ares_buf_append_byte(buf, ((unsigned char)(u32 >> 8) & 0xff)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_append_byte(buf, ((unsigned char)u32 & 0xff)); + status = ares_buf_append_byte(buf, ((unsigned char)u32 & 0xff)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -280,7 +279,7 @@ ares_status_t ares__buf_append_be32(ares__buf_t *buf, unsigned int u32) return ARES_SUCCESS; } -unsigned char *ares__buf_append_start(ares__buf_t *buf, size_t *len) +unsigned char *ares_buf_append_start(ares_buf_t *buf, size_t *len) { ares_status_t status; @@ -288,17 +287,17 @@ unsigned char *ares__buf_append_start(ares__buf_t *buf, size_t *len) return NULL; } - status = ares__buf_ensure_space(buf, *len); + status = ares_buf_ensure_space(buf, *len); if (status != ARES_SUCCESS) { return NULL; } - /* -1 for possible null terminator for ares__buf_finish_str() */ + /* -1 for possible null terminator for ares_buf_finish_str() */ *len = buf->alloc_buf_len - buf->data_len - 1; return buf->alloc_buf + buf->data_len; } -void ares__buf_append_finish(ares__buf_t *buf, size_t len) +void ares_buf_append_finish(ares_buf_t *buf, size_t len) { if (buf == NULL) { return; @@ -307,18 +306,17 @@ void ares__buf_append_finish(ares__buf_t *buf, size_t len) buf->data_len += len; } -unsigned char *ares__buf_finish_bin(ares__buf_t *buf, size_t *len) +unsigned char *ares_buf_finish_bin(ares_buf_t *buf, size_t *len) { unsigned char *ptr = NULL; - if (buf == NULL || len == NULL || ares__buf_is_const(buf)) { + if (buf == NULL || len == NULL || ares_buf_is_const(buf)) { return NULL; } - ares__buf_reclaim(buf); + ares_buf_reclaim(buf); /* We don't want to return NULL except on failure, may be zero-length */ - if (buf->alloc_buf == NULL && - ares__buf_ensure_space(buf, 1) != ARES_SUCCESS) { + if (buf->alloc_buf == NULL && ares_buf_ensure_space(buf, 1) != ARES_SUCCESS) { return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ } ptr = buf->alloc_buf; @@ -327,12 +325,12 @@ unsigned char *ares__buf_finish_bin(ares__buf_t *buf, size_t *len) return ptr; } -char *ares__buf_finish_str(ares__buf_t *buf, size_t *len) +char *ares_buf_finish_str(ares_buf_t *buf, size_t *len) { char *ptr; size_t mylen; - ptr = (char *)ares__buf_finish_bin(buf, &mylen); + ptr = (char *)ares_buf_finish_bin(buf, &mylen); if (ptr == NULL) { return NULL; } @@ -341,14 +339,14 @@ char *ares__buf_finish_str(ares__buf_t *buf, size_t *len) *len = mylen; } - /* NOTE: ensured via ares__buf_ensure_space() that there is always at least + /* NOTE: ensured via ares_buf_ensure_space() that there is always at least * 1 extra byte available for this specific use-case */ ptr[mylen] = 0; return ptr; } -void ares__buf_tag(ares__buf_t *buf) +void ares_buf_tag(ares_buf_t *buf) { if (buf == NULL) { return; @@ -357,7 +355,7 @@ void ares__buf_tag(ares__buf_t *buf) buf->tag_offset = buf->offset; } -ares_status_t ares__buf_tag_rollback(ares__buf_t *buf) +ares_status_t ares_buf_tag_rollback(ares_buf_t *buf) { if (buf == NULL || buf->tag_offset == SIZE_MAX) { return ARES_EFORMERR; @@ -368,7 +366,7 @@ ares_status_t ares__buf_tag_rollback(ares__buf_t *buf) return ARES_SUCCESS; } -ares_status_t ares__buf_tag_clear(ares__buf_t *buf) +ares_status_t ares_buf_tag_clear(ares_buf_t *buf) { if (buf == NULL || buf->tag_offset == SIZE_MAX) { return ARES_EFORMERR; @@ -378,7 +376,7 @@ ares_status_t ares__buf_tag_clear(ares__buf_t *buf) return ARES_SUCCESS; } -const unsigned char *ares__buf_tag_fetch(const ares__buf_t *buf, size_t *len) +const unsigned char *ares_buf_tag_fetch(const ares_buf_t *buf, size_t *len) { if (buf == NULL || buf->tag_offset == SIZE_MAX || len == NULL) { return NULL; @@ -388,7 +386,7 @@ const unsigned char *ares__buf_tag_fetch(const ares__buf_t *buf, size_t *len) return buf->data + buf->tag_offset; } -size_t ares__buf_tag_length(const ares__buf_t *buf) +size_t ares_buf_tag_length(const ares_buf_t *buf) { if (buf == NULL || buf->tag_offset == SIZE_MAX) { return 0; @@ -396,11 +394,11 @@ size_t ares__buf_tag_length(const ares__buf_t *buf) return buf->offset - buf->tag_offset; } -ares_status_t ares__buf_tag_fetch_bytes(const ares__buf_t *buf, - unsigned char *bytes, size_t *len) +ares_status_t ares_buf_tag_fetch_bytes(const ares_buf_t *buf, + unsigned char *bytes, size_t *len) { size_t ptr_len = 0; - const unsigned char *ptr = ares__buf_tag_fetch(buf, &ptr_len); + const unsigned char *ptr = ares_buf_tag_fetch(buf, &ptr_len); if (ptr == NULL || bytes == NULL || len == NULL) { return ARES_EFORMERR; @@ -418,8 +416,25 @@ ares_status_t ares__buf_tag_fetch_bytes(const ares__buf_t *buf, return ARES_SUCCESS; } -ares_status_t ares__buf_tag_fetch_string(const ares__buf_t *buf, char *str, - size_t len) +ares_status_t ares_buf_tag_fetch_constbuf(const ares_buf_t *buf, + ares_buf_t **newbuf) +{ + size_t ptr_len = 0; + const unsigned char *ptr = ares_buf_tag_fetch(buf, &ptr_len); + + if (ptr == NULL || newbuf == NULL) { + return ARES_EFORMERR; + } + + *newbuf = ares_buf_create_const(ptr, ptr_len); + if (*newbuf == NULL) { + return ARES_ENOMEM; + } + return ARES_SUCCESS; +} + +ares_status_t ares_buf_tag_fetch_string(const ares_buf_t *buf, char *str, + size_t len) { size_t out_len; ares_status_t status; @@ -432,7 +447,7 @@ ares_status_t ares__buf_tag_fetch_string(const ares__buf_t *buf, char *str, /* Space for NULL terminator */ out_len = len - 1; - status = ares__buf_tag_fetch_bytes(buf, (unsigned char *)str, &out_len); + status = ares_buf_tag_fetch_bytes(buf, (unsigned char *)str, &out_len); if (status != ARES_SUCCESS) { return status; } @@ -442,7 +457,7 @@ ares_status_t ares__buf_tag_fetch_string(const ares__buf_t *buf, char *str, /* Validate string is printable */ for (i = 0; i < out_len; i++) { - if (!ares__isprint(str[i])) { + if (!ares_isprint(str[i])) { return ARES_EBADSTR; } } @@ -450,7 +465,32 @@ ares_status_t ares__buf_tag_fetch_string(const ares__buf_t *buf, char *str, return ARES_SUCCESS; } -static const unsigned char *ares__buf_fetch(const ares__buf_t *buf, size_t *len) +ares_status_t ares_buf_tag_fetch_strdup(const ares_buf_t *buf, char **str) +{ + size_t ptr_len = 0; + const unsigned char *ptr = ares_buf_tag_fetch(buf, &ptr_len); + + if (ptr == NULL || str == NULL) { + return ARES_EFORMERR; + } + + if (!ares_str_isprint((const char *)ptr, ptr_len)) { + return ARES_EBADSTR; + } + + *str = ares_malloc(ptr_len + 1); + if (*str == NULL) { + return ARES_ENOMEM; + } + + if (ptr_len > 0) { + memcpy(*str, ptr, ptr_len); + } + (*str)[ptr_len] = 0; + return ARES_SUCCESS; +} + +static const unsigned char *ares_buf_fetch(const ares_buf_t *buf, size_t *len) { if (len != NULL) { *len = 0; @@ -468,9 +508,9 @@ static const unsigned char *ares__buf_fetch(const ares__buf_t *buf, size_t *len) return buf->data + buf->offset; } -ares_status_t ares__buf_consume(ares__buf_t *buf, size_t len) +ares_status_t ares_buf_consume(ares_buf_t *buf, size_t len) { - size_t remaining_len = ares__buf_len(buf); + size_t remaining_len = ares_buf_len(buf); if (remaining_len < len) { return ARES_EBADRESP; @@ -480,10 +520,10 @@ ares_status_t ares__buf_consume(ares__buf_t *buf, size_t len) return ARES_SUCCESS; } -ares_status_t ares__buf_fetch_be16(ares__buf_t *buf, unsigned short *u16) +ares_status_t ares_buf_fetch_be16(ares_buf_t *buf, unsigned short *u16) { size_t remaining_len; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); unsigned int u32; if (buf == NULL || u16 == NULL || remaining_len < sizeof(*u16)) { @@ -495,13 +535,13 @@ ares_status_t ares__buf_fetch_be16(ares__buf_t *buf, unsigned short *u16) u32 = ((unsigned int)(ptr[0]) << 8 | (unsigned int)ptr[1]); *u16 = (unsigned short)(u32 & 0xFFFF); - return ares__buf_consume(buf, sizeof(*u16)); + return ares_buf_consume(buf, sizeof(*u16)); } -ares_status_t ares__buf_fetch_be32(ares__buf_t *buf, unsigned int *u32) +ares_status_t ares_buf_fetch_be32(ares_buf_t *buf, unsigned int *u32) { size_t remaining_len; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); if (buf == NULL || u32 == NULL || remaining_len < sizeof(*u32)) { return ARES_EBADRESP; @@ -510,29 +550,29 @@ ares_status_t ares__buf_fetch_be32(ares__buf_t *buf, unsigned int *u32) *u32 = ((unsigned int)(ptr[0]) << 24 | (unsigned int)(ptr[1]) << 16 | (unsigned int)(ptr[2]) << 8 | (unsigned int)(ptr[3])); - return ares__buf_consume(buf, sizeof(*u32)); + return ares_buf_consume(buf, sizeof(*u32)); } -ares_status_t ares__buf_fetch_bytes(ares__buf_t *buf, unsigned char *bytes, - size_t len) +ares_status_t ares_buf_fetch_bytes(ares_buf_t *buf, unsigned char *bytes, + size_t len) { size_t remaining_len; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); if (buf == NULL || bytes == NULL || len == 0 || remaining_len < len) { return ARES_EBADRESP; } memcpy(bytes, ptr, len); - return ares__buf_consume(buf, len); + return ares_buf_consume(buf, len); } -ares_status_t ares__buf_fetch_bytes_dup(ares__buf_t *buf, size_t len, - ares_bool_t null_term, - unsigned char **bytes) +ares_status_t ares_buf_fetch_bytes_dup(ares_buf_t *buf, size_t len, + ares_bool_t null_term, + unsigned char **bytes) { size_t remaining_len; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); if (buf == NULL || bytes == NULL || len == 0 || remaining_len < len) { return ARES_EBADRESP; @@ -547,18 +587,26 @@ ares_status_t ares__buf_fetch_bytes_dup(ares__buf_t *buf, size_t len, if (null_term) { (*bytes)[len] = 0; } - return ares__buf_consume(buf, len); + return ares_buf_consume(buf, len); } -ares_status_t ares__buf_fetch_str_dup(ares__buf_t *buf, size_t len, char **str) +ares_status_t ares_buf_fetch_str_dup(ares_buf_t *buf, size_t len, char **str) { size_t remaining_len; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + size_t i; + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); if (buf == NULL || str == NULL || len == 0 || remaining_len < len) { return ARES_EBADRESP; } + /* Validate string is printable */ + for (i = 0; i < len; i++) { + if (!ares_isprint(ptr[i])) { + return ARES_EBADSTR; + } + } + *str = ares_malloc(len + 1); if (*str == NULL) { return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ @@ -567,30 +615,30 @@ ares_status_t ares__buf_fetch_str_dup(ares__buf_t *buf, size_t len, char **str) memcpy(*str, ptr, len); (*str)[len] = 0; - return ares__buf_consume(buf, len); + return ares_buf_consume(buf, len); } -ares_status_t ares__buf_fetch_bytes_into_buf(ares__buf_t *buf, - ares__buf_t *dest, size_t len) +ares_status_t ares_buf_fetch_bytes_into_buf(ares_buf_t *buf, ares_buf_t *dest, + size_t len) { size_t remaining_len; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); ares_status_t status; if (buf == NULL || dest == NULL || len == 0 || remaining_len < len) { return ARES_EBADRESP; } - status = ares__buf_append(dest, ptr, len); + status = ares_buf_append(dest, ptr, len); if (status != ARES_SUCCESS) { return status; } - return ares__buf_consume(buf, len); + return ares_buf_consume(buf, len); } -static ares_bool_t ares__is_whitespace(unsigned char c, - ares_bool_t include_linefeed) +static ares_bool_t ares_is_whitespace(unsigned char c, + ares_bool_t include_linefeed) { switch (c) { case '\r': @@ -607,11 +655,11 @@ static ares_bool_t ares__is_whitespace(unsigned char c, return ARES_FALSE; } -size_t ares__buf_consume_whitespace(ares__buf_t *buf, - ares_bool_t include_linefeed) +size_t ares_buf_consume_whitespace(ares_buf_t *buf, + ares_bool_t include_linefeed) { size_t remaining_len = 0; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); size_t i; if (ptr == NULL) { @@ -619,21 +667,21 @@ size_t ares__buf_consume_whitespace(ares__buf_t *buf, } for (i = 0; i < remaining_len; i++) { - if (!ares__is_whitespace(ptr[i], include_linefeed)) { + if (!ares_is_whitespace(ptr[i], include_linefeed)) { break; } } if (i > 0) { - ares__buf_consume(buf, i); + ares_buf_consume(buf, i); } return i; } -size_t ares__buf_consume_nonwhitespace(ares__buf_t *buf) +size_t ares_buf_consume_nonwhitespace(ares_buf_t *buf) { size_t remaining_len = 0; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); size_t i; if (ptr == NULL) { @@ -641,21 +689,21 @@ size_t ares__buf_consume_nonwhitespace(ares__buf_t *buf) } for (i = 0; i < remaining_len; i++) { - if (ares__is_whitespace(ptr[i], ARES_TRUE)) { + if (ares_is_whitespace(ptr[i], ARES_TRUE)) { break; } } if (i > 0) { - ares__buf_consume(buf, i); + ares_buf_consume(buf, i); } return i; } -size_t ares__buf_consume_line(ares__buf_t *buf, ares_bool_t include_linefeed) +size_t ares_buf_consume_line(ares_buf_t *buf, ares_bool_t include_linefeed) { size_t remaining_len = 0; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); size_t i; if (ptr == NULL) { @@ -674,28 +722,40 @@ size_t ares__buf_consume_line(ares__buf_t *buf, ares_bool_t include_linefeed) } if (i > 0) { - ares__buf_consume(buf, i); + ares_buf_consume(buf, i); } return i; } -size_t ares__buf_consume_until_charset(ares__buf_t *buf, - const unsigned char *charset, size_t len, - ares_bool_t require_charset) +size_t ares_buf_consume_until_charset(ares_buf_t *buf, + const unsigned char *charset, size_t len, + ares_bool_t require_charset) { size_t remaining_len = 0; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); - size_t i; + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); + size_t pos; ares_bool_t found = ARES_FALSE; if (ptr == NULL || charset == NULL || len == 0) { return 0; } - for (i = 0; i < remaining_len; i++) { + /* Optimize for single character searches */ + if (len == 1) { + const unsigned char *p = memchr(ptr, charset[0], remaining_len); + if (p != NULL) { + found = ARES_TRUE; + pos = (size_t)(p - ptr); + } else { + pos = remaining_len; + } + goto done; + } + + for (pos = 0; pos < remaining_len; pos++) { size_t j; for (j = 0; j < len; j++) { - if (ptr[i] == charset[j]) { + if (ptr[pos] == charset[j]) { found = ARES_TRUE; goto done; } @@ -704,20 +764,50 @@ size_t ares__buf_consume_until_charset(ares__buf_t *buf, done: if (require_charset && !found) { + return SIZE_MAX; + } + + if (pos > 0) { + ares_buf_consume(buf, pos); + } + return pos; +} + +size_t ares_buf_consume_until_seq(ares_buf_t *buf, const unsigned char *seq, + size_t len, ares_bool_t require_seq) +{ + size_t remaining_len = 0; + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); + const unsigned char *p; + size_t consume_len = 0; + + if (ptr == NULL || seq == NULL || len == 0) { return 0; } - if (i > 0) { - ares__buf_consume(buf, i); + p = ares_memmem(ptr, remaining_len, seq, len); + if (require_seq && p == NULL) { + return SIZE_MAX; } - return i; + + if (p != NULL) { + consume_len = (size_t)(p - ptr); + } else { + consume_len = remaining_len; + } + + if (consume_len > 0) { + ares_buf_consume(buf, consume_len); + } + + return consume_len; } -size_t ares__buf_consume_charset(ares__buf_t *buf, const unsigned char *charset, - size_t len) +size_t ares_buf_consume_charset(ares_buf_t *buf, const unsigned char *charset, + size_t len) { size_t remaining_len = 0; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); size_t i; if (ptr == NULL || charset == NULL || len == 0) { @@ -738,28 +828,30 @@ size_t ares__buf_consume_charset(ares__buf_t *buf, const unsigned char *charset, } if (i > 0) { - ares__buf_consume(buf, i); + ares_buf_consume(buf, i); } return i; } -static void ares__buf_destroy_cb(void *arg) +static void ares_buf_destroy_cb(void *arg) { - ares__buf_destroy(arg); + ares_buf_t **buf = arg; + ares_buf_destroy(*buf); } -static ares_bool_t ares__buf_split_isduplicate(ares__llist_t *list, - const unsigned char *val, - size_t len, - ares__buf_split_t flags) +static ares_bool_t ares_buf_split_isduplicate(ares_array_t *arr, + const unsigned char *val, + size_t len, + ares_buf_split_t flags) { - ares__llist_node_t *node; + size_t i; + size_t num = ares_array_len(arr); - for (node = ares__llist_node_first(list); node != NULL; - node = ares__llist_node_next(node)) { - const ares__buf_t *buf = ares__llist_node_val(node); - size_t plen = 0; - const unsigned char *ptr = ares__buf_peek(buf, &plen); + for (i = 0; i < num; i++) { + ares_buf_t **bufptr = ares_array_at(arr, i); + const ares_buf_t *buf = *bufptr; + size_t plen = 0; + const unsigned char *ptr = ares_buf_peek(buf, &plen); /* Can't be duplicate if lengths mismatch */ if (plen != len) { @@ -767,61 +859,62 @@ static ares_bool_t ares__buf_split_isduplicate(ares__llist_t *list, } if (flags & ARES_BUF_SPLIT_CASE_INSENSITIVE) { - if (ares__memeq_ci(ptr, val, len)) { + if (ares_memeq_ci(ptr, val, len)) { return ARES_TRUE; } } else { - if (memcmp(ptr, val, len) == 0) { + if (ares_memeq(ptr, val, len)) { return ARES_TRUE; } } } + return ARES_FALSE; } -ares_status_t ares__buf_split(ares__buf_t *buf, const unsigned char *delims, - size_t delims_len, ares__buf_split_t flags, - size_t max_sections, ares__llist_t **list) +ares_status_t ares_buf_split(ares_buf_t *buf, const unsigned char *delims, + size_t delims_len, ares_buf_split_t flags, + size_t max_sections, ares_array_t **arr) { ares_status_t status = ARES_SUCCESS; ares_bool_t first = ARES_TRUE; - if (buf == NULL || delims == NULL || delims_len == 0 || list == NULL) { + if (buf == NULL || delims == NULL || delims_len == 0 || arr == NULL) { return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - *list = ares__llist_create(ares__buf_destroy_cb); - if (*list == NULL) { + *arr = ares_array_create(sizeof(ares_buf_t *), ares_buf_destroy_cb); + if (*arr == NULL) { status = ARES_ENOMEM; goto done; } - while (ares__buf_len(buf)) { + while (ares_buf_len(buf)) { size_t len = 0; const unsigned char *ptr; if (first) { /* No delimiter yet, just tag the start */ - ares__buf_tag(buf); + ares_buf_tag(buf); } else { - if (flags & ARES_BUF_SPLIT_DONT_CONSUME_DELIMS) { + if (flags & ARES_BUF_SPLIT_KEEP_DELIMS) { /* tag then eat delimiter so its first byte in buffer */ - ares__buf_tag(buf); - ares__buf_consume(buf, 1); + ares_buf_tag(buf); + ares_buf_consume(buf, 1); } else { /* throw away delimiter */ - ares__buf_consume(buf, 1); - ares__buf_tag(buf); + ares_buf_consume(buf, 1); + ares_buf_tag(buf); } } - if (max_sections && ares__llist_len(*list) >= max_sections - 1) { - ares__buf_consume(buf, ares__buf_len(buf)); + if (max_sections && ares_array_len(*arr) >= max_sections - 1) { + ares_buf_consume(buf, ares_buf_len(buf)); } else { - ares__buf_consume_until_charset(buf, delims, delims_len, ARES_FALSE); + ares_buf_consume_until_charset(buf, delims, delims_len, ARES_FALSE); } - ptr = ares__buf_tag_fetch(buf, &len); + ptr = ares_buf_tag_fetch(buf, &len); /* Shouldn't be possible */ if (ptr == NULL) { @@ -832,7 +925,7 @@ ares_status_t ares__buf_split(ares__buf_t *buf, const unsigned char *delims, if (flags & ARES_BUF_SPLIT_LTRIM) { size_t i; for (i = 0; i < len; i++) { - if (!ares__is_whitespace(ptr[i], ARES_TRUE)) { + if (!ares_is_whitespace(ptr[i], ARES_TRUE)) { break; } } @@ -841,22 +934,22 @@ ares_status_t ares__buf_split(ares__buf_t *buf, const unsigned char *delims, } if (flags & ARES_BUF_SPLIT_RTRIM) { - while (len > 0 && ares__is_whitespace(ptr[len - 1], ARES_TRUE)) { + while (len > 0 && ares_is_whitespace(ptr[len - 1], ARES_TRUE)) { len--; } } if (len != 0 || flags & ARES_BUF_SPLIT_ALLOW_BLANK) { - ares__buf_t *data; + ares_buf_t *data; if (!(flags & ARES_BUF_SPLIT_NO_DUPLICATES) || - !ares__buf_split_isduplicate(*list, ptr, len, flags)) { + !ares_buf_split_isduplicate(*arr, ptr, len, flags)) { /* Since we don't allow const buffers of 0 length, and user wants * 0-length buffers, swap what we do here */ if (len) { - data = ares__buf_create_const(ptr, len); + data = ares_buf_create_const(ptr, len); } else { - data = ares__buf_create(); + data = ares_buf_create(); } if (data == NULL) { @@ -864,9 +957,9 @@ ares_status_t ares__buf_split(ares__buf_t *buf, const unsigned char *delims, goto done; } - if (ares__llist_insert_last(*list, data) == NULL) { - ares__buf_destroy(data); - status = ARES_ENOMEM; + status = ares_array_insertdata_last(*arr, &data); + if (status != ARES_SUCCESS) { + ares_buf_destroy(data); goto done; } } @@ -877,18 +970,110 @@ ares_status_t ares__buf_split(ares__buf_t *buf, const unsigned char *delims, done: if (status != ARES_SUCCESS) { - ares__llist_destroy(*list); - *list = NULL; + ares_array_destroy(*arr); + *arr = NULL; } return status; } -ares_bool_t ares__buf_begins_with(const ares__buf_t *buf, - const unsigned char *data, size_t data_len) +static void ares_free_split_array(void *arg) +{ + void **ptr = arg; + ares_free(*ptr); +} + +ares_status_t ares_buf_split_str_array(ares_buf_t *buf, + const unsigned char *delims, + size_t delims_len, + ares_buf_split_t flags, + size_t max_sections, ares_array_t **arr) +{ + ares_status_t status; + ares_array_t *split = NULL; + size_t i; + size_t len; + + if (arr == NULL) { + return ARES_EFORMERR; + } + + *arr = NULL; + + status = ares_buf_split(buf, delims, delims_len, flags, max_sections, &split); + if (status != ARES_SUCCESS) { + goto done; + } + + *arr = ares_array_create(sizeof(char *), ares_free_split_array); + if (*arr == NULL) { + status = ARES_ENOMEM; + goto done; + } + + len = ares_array_len(split); + for (i = 0; i < len; i++) { + ares_buf_t **bufptr = ares_array_at(split, i); + ares_buf_t *lbuf = *bufptr; + char *str = NULL; + + status = ares_buf_fetch_str_dup(lbuf, ares_buf_len(lbuf), &str); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_array_insertdata_last(*arr, &str); + if (status != ARES_SUCCESS) { + ares_free(str); + goto done; + } + } + +done: + ares_array_destroy(split); + if (status != ARES_SUCCESS) { + ares_array_destroy(*arr); + *arr = NULL; + } + return status; +} + +ares_status_t ares_buf_split_str(ares_buf_t *buf, const unsigned char *delims, + size_t delims_len, ares_buf_split_t flags, + size_t max_sections, char ***strs, + size_t *nstrs) +{ + ares_status_t status; + ares_array_t *arr = NULL; + + if (strs == NULL || nstrs == NULL) { + return ARES_EFORMERR; + } + + *strs = NULL; + *nstrs = 0; + + status = ares_buf_split_str_array(buf, delims, delims_len, flags, + max_sections, &arr); + + if (status != ARES_SUCCESS) { + goto done; + } + +done: + if (status == ARES_SUCCESS) { + *strs = ares_array_finish(arr, nstrs); + } else { + ares_array_destroy(arr); + } + return status; +} + +ares_bool_t ares_buf_begins_with(const ares_buf_t *buf, + const unsigned char *data, size_t data_len) { size_t remaining_len = 0; - const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); if (ptr == NULL || data == NULL || data_len == 0) { return ARES_FALSE; @@ -905,7 +1090,7 @@ ares_bool_t ares__buf_begins_with(const ares__buf_t *buf, return ARES_TRUE; } -size_t ares__buf_len(const ares__buf_t *buf) +size_t ares_buf_len(const ares_buf_t *buf) { if (buf == NULL) { return 0; @@ -914,111 +1099,123 @@ size_t ares__buf_len(const ares__buf_t *buf) return buf->data_len - buf->offset; } -const unsigned char *ares__buf_peek(const ares__buf_t *buf, size_t *len) +const unsigned char *ares_buf_peek(const ares_buf_t *buf, size_t *len) { - return ares__buf_fetch(buf, len); + return ares_buf_fetch(buf, len); } -size_t ares__buf_get_position(const ares__buf_t *buf) +ares_status_t ares_buf_replace(ares_buf_t *buf, const unsigned char *srch, + size_t srch_size, const unsigned char *rplc, + size_t rplc_size) { - if (buf == NULL) { - return 0; - } - return buf->offset; -} + size_t processed_len = 0; + ares_status_t status; -ares_status_t ares__buf_set_position(ares__buf_t *buf, size_t idx) -{ - if (buf == NULL) { + if (buf->alloc_buf == NULL || srch == NULL || srch_size == 0 || + (rplc == NULL && rplc_size != 0)) { return ARES_EFORMERR; } - if (idx > buf->data_len) { - return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ + while (1) { + unsigned char *ptr = buf->alloc_buf + buf->offset + processed_len; + size_t remaining_len = buf->data_len - buf->offset - processed_len; + size_t found_offset = 0; + size_t move_data_len; + + /* Find pattern */ + ptr = ares_memmem(ptr, remaining_len, srch, srch_size); + if (ptr == NULL) { + break; + } + + /* Store the offset this was found because our actual pointer might be + * switched out from under us by the call to ensure_space() if the + * replacement pattern is larger than the search pattern */ + found_offset = (size_t)(ptr - (size_t)(buf->alloc_buf + buf->offset)); + if (rplc_size > srch_size) { + status = ares_buf_ensure_space(buf, rplc_size - srch_size); + if (status != ARES_SUCCESS) { + return status; + } + } + + /* Impossible, but silence clang */ + if (buf->alloc_buf == NULL) { + return ARES_ENOMEM; + } + + /* Recalculate actual pointer */ + ptr = buf->alloc_buf + buf->offset + found_offset; + + /* Move the data */ + move_data_len = buf->data_len - buf->offset - found_offset - srch_size; + memmove(ptr + rplc_size, + ptr + srch_size, + move_data_len); + + /* Copy in the replacement data */ + if (rplc != NULL && rplc_size > 0) { + memcpy(ptr, rplc, rplc_size); + } + + if (rplc_size > srch_size) { + buf->data_len += rplc_size - srch_size; + } else { + buf->data_len -= srch_size - rplc_size; + } + + processed_len = found_offset + rplc_size; } - buf->offset = idx; return ARES_SUCCESS; } -ares_status_t ares__buf_parse_dns_abinstr(ares__buf_t *buf, - size_t remaining_len, - ares__dns_multistring_t **strs, - ares_bool_t validate_printable) +ares_status_t ares_buf_peek_byte(const ares_buf_t *buf, unsigned char *b) { - unsigned char len; - ares_status_t status = ARES_EBADRESP; - size_t orig_len = ares__buf_len(buf); + size_t remaining_len = 0; + const unsigned char *ptr = ares_buf_fetch(buf, &remaining_len); - if (buf == NULL) { + if (buf == NULL || b == NULL) { return ARES_EFORMERR; } if (remaining_len == 0) { return ARES_EBADRESP; } + *b = ptr[0]; + return ARES_SUCCESS; +} - if (strs != NULL) { - *strs = ares__dns_multistring_create(); - if (*strs == NULL) { - return ARES_ENOMEM; - } +size_t ares_buf_get_position(const ares_buf_t *buf) +{ + if (buf == NULL) { + return 0; } + return buf->offset; +} - while (orig_len - ares__buf_len(buf) < remaining_len) { - status = ares__buf_fetch_bytes(buf, &len, 1); - if (status != ARES_SUCCESS) { - break; /* LCOV_EXCL_LINE: DefensiveCoding */ - } - - if (len) { - /* When used by the _str() parser, it really needs to be validated to - * be a valid printable ascii string. Do that here */ - if (validate_printable && ares__buf_len(buf) >= len) { - size_t mylen; - const char *data = (const char *)ares__buf_peek(buf, &mylen); - if (!ares__str_isprint(data, len)) { - status = ARES_EBADSTR; - break; - } - } - - if (strs != NULL) { - unsigned char *data = NULL; - status = ares__buf_fetch_bytes_dup(buf, len, ARES_TRUE, &data); - if (status != ARES_SUCCESS) { - break; - } - status = ares__dns_multistring_add_own(*strs, data, len); - if (status != ARES_SUCCESS) { - ares_free(data); - break; - } - } else { - status = ares__buf_consume(buf, len); - if (status != ARES_SUCCESS) { - break; - } - } - } +ares_status_t ares_buf_set_position(ares_buf_t *buf, size_t idx) +{ + if (buf == NULL) { + return ARES_EFORMERR; } - if (status != ARES_SUCCESS && strs != NULL) { - ares__dns_multistring_destroy(*strs); - *strs = NULL; + if (idx > buf->data_len) { + return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ } - return status; + buf->offset = idx; + return ARES_SUCCESS; } static ares_status_t - ares__buf_parse_dns_binstr_int(ares__buf_t *buf, size_t remaining_len, - unsigned char **bin, size_t *bin_len, - ares_bool_t validate_printable) + ares_buf_parse_dns_binstr_int(ares_buf_t *buf, size_t remaining_len, + unsigned char **bin, size_t *bin_len, + ares_bool_t validate_printable) { unsigned char len; ares_status_t status = ARES_EBADRESP; - ares__buf_t *binbuf = NULL; + ares_buf_t *binbuf = NULL; if (buf == NULL) { return ARES_EFORMERR; @@ -1028,12 +1225,12 @@ static ares_status_t return ARES_EBADRESP; } - binbuf = ares__buf_create(); + binbuf = ares_buf_create(); if (binbuf == NULL) { return ARES_ENOMEM; } - status = ares__buf_fetch_bytes(buf, &len, 1); + status = ares_buf_fetch_bytes(buf, &len, 1); if (status != ARES_SUCCESS) { goto done; /* LCOV_EXCL_LINE: DefensiveCoding */ } @@ -1048,32 +1245,32 @@ static ares_status_t if (len) { /* When used by the _str() parser, it really needs to be validated to * be a valid printable ascii string. Do that here */ - if (validate_printable && ares__buf_len(buf) >= len) { + if (validate_printable && ares_buf_len(buf) >= len) { size_t mylen; - const char *data = (const char *)ares__buf_peek(buf, &mylen); - if (!ares__str_isprint(data, len)) { + const char *data = (const char *)ares_buf_peek(buf, &mylen); + if (!ares_str_isprint(data, len)) { status = ARES_EBADSTR; goto done; } } if (bin != NULL) { - status = ares__buf_fetch_bytes_into_buf(buf, binbuf, len); + status = ares_buf_fetch_bytes_into_buf(buf, binbuf, len); } else { - status = ares__buf_consume(buf, len); + status = ares_buf_consume(buf, len); } } done: if (status != ARES_SUCCESS) { - ares__buf_destroy(binbuf); + ares_buf_destroy(binbuf); } else { if (bin != NULL) { size_t mylen = 0; - /* NOTE: we use ares__buf_finish_str() here as we guarantee NULL + /* NOTE: we use ares_buf_finish_str() here as we guarantee NULL * Termination even though we are technically returning binary data. */ - *bin = (unsigned char *)ares__buf_finish_str(binbuf, &mylen); + *bin = (unsigned char *)ares_buf_finish_str(binbuf, &mylen); *bin_len = mylen; } } @@ -1081,32 +1278,32 @@ static ares_status_t return status; } -ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len, - unsigned char **bin, size_t *bin_len) +ares_status_t ares_buf_parse_dns_binstr(ares_buf_t *buf, size_t remaining_len, + unsigned char **bin, size_t *bin_len) { - return ares__buf_parse_dns_binstr_int(buf, remaining_len, bin, bin_len, - ARES_FALSE); + return ares_buf_parse_dns_binstr_int(buf, remaining_len, bin, bin_len, + ARES_FALSE); } -ares_status_t ares__buf_parse_dns_str(ares__buf_t *buf, size_t remaining_len, - char **str) +ares_status_t ares_buf_parse_dns_str(ares_buf_t *buf, size_t remaining_len, + char **str) { size_t len; - return ares__buf_parse_dns_binstr_int(buf, remaining_len, - (unsigned char **)str, &len, ARES_TRUE); + return ares_buf_parse_dns_binstr_int(buf, remaining_len, + (unsigned char **)str, &len, ARES_TRUE); } -ares_status_t ares__buf_append_num_dec(ares__buf_t *buf, size_t num, size_t len) +ares_status_t ares_buf_append_num_dec(ares_buf_t *buf, size_t num, size_t len) { size_t i; size_t mod; if (len == 0) { - len = ares__count_digits(num); + len = ares_count_digits(num); } - mod = ares__pow(10, len); + mod = ares_pow(10, len); for (i = len; i > 0; i--) { size_t digit = (num % mod); @@ -1120,7 +1317,7 @@ ares_status_t ares__buf_append_num_dec(ares__buf_t *buf, size_t num, size_t len) } digit /= mod; - status = ares__buf_append_byte(buf, '0' + (unsigned char)(digit & 0xFF)); + status = ares_buf_append_byte(buf, '0' + (unsigned char)(digit & 0xFF)); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -1128,18 +1325,18 @@ ares_status_t ares__buf_append_num_dec(ares__buf_t *buf, size_t num, size_t len) return ARES_SUCCESS; } -ares_status_t ares__buf_append_num_hex(ares__buf_t *buf, size_t num, size_t len) +ares_status_t ares_buf_append_num_hex(ares_buf_t *buf, size_t num, size_t len) { size_t i; static const unsigned char hexbytes[] = "0123456789ABCDEF"; if (len == 0) { - len = ares__count_hexdigits(num); + len = ares_count_hexdigits(num); } for (i = len; i > 0; i--) { ares_status_t status; - status = ares__buf_append_byte(buf, hexbytes[(num >> ((i - 1) * 4)) & 0xF]); + status = ares_buf_append_byte(buf, hexbytes[(num >> ((i - 1) * 4)) & 0xF]); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -1147,48 +1344,48 @@ ares_status_t ares__buf_append_num_hex(ares__buf_t *buf, size_t num, size_t len) return ARES_SUCCESS; } -ares_status_t ares__buf_append_str(ares__buf_t *buf, const char *str) +ares_status_t ares_buf_append_str(ares_buf_t *buf, const char *str) { - return ares__buf_append(buf, (const unsigned char *)str, ares_strlen(str)); + return ares_buf_append(buf, (const unsigned char *)str, ares_strlen(str)); } -static ares_status_t ares__buf_hexdump_line(ares__buf_t *buf, size_t idx, - const unsigned char *data, - size_t len) +static ares_status_t ares_buf_hexdump_line(ares_buf_t *buf, size_t idx, + const unsigned char *data, + size_t len) { size_t i; ares_status_t status; /* Address */ - status = ares__buf_append_num_hex(buf, idx, 6); + status = ares_buf_append_num_hex(buf, idx, 6); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } /* | */ - status = ares__buf_append_str(buf, " | "); + status = ares_buf_append_str(buf, " | "); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } for (i = 0; i < 16; i++) { if (i >= len) { - status = ares__buf_append_str(buf, " "); + status = ares_buf_append_str(buf, " "); } else { - status = ares__buf_append_num_hex(buf, data[i], 2); + status = ares_buf_append_num_hex(buf, data[i], 2); } if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__buf_append_byte(buf, ' '); + status = ares_buf_append_byte(buf, ' '); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } } /* | */ - status = ares__buf_append_str(buf, " | "); + status = ares_buf_append_str(buf, " | "); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -1197,24 +1394,24 @@ static ares_status_t ares__buf_hexdump_line(ares__buf_t *buf, size_t idx, if (i >= len) { break; } - status = ares__buf_append_byte(buf, ares__isprint(data[i]) ? data[i] : '.'); + status = ares_buf_append_byte(buf, ares_isprint(data[i]) ? data[i] : '.'); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } } - return ares__buf_append_byte(buf, '\n'); + return ares_buf_append_byte(buf, '\n'); } -ares_status_t ares__buf_hexdump(ares__buf_t *buf, const unsigned char *data, - size_t len) +ares_status_t ares_buf_hexdump(ares_buf_t *buf, const unsigned char *data, + size_t len) { size_t i; /* Each line is 16 bytes */ for (i = 0; i < len; i += 16) { ares_status_t status; - status = ares__buf_hexdump_line(buf, i, data + i, len - i); + status = ares_buf_hexdump_line(buf, i, data + i, len - i); if (status != ARES_SUCCESS) { return status; /* LCOV_EXCL_LINE: OutOfMemory */ } @@ -1223,7 +1420,7 @@ ares_status_t ares__buf_hexdump(ares__buf_t *buf, const unsigned char *data, return ARES_SUCCESS; } -ares_status_t ares__buf_load_file(const char *filename, ares__buf_t *buf) +ares_status_t ares_buf_load_file(const char *filename, ares_buf_t *buf) { FILE *fp = NULL; unsigned char *ptr = NULL; @@ -1238,7 +1435,7 @@ ares_status_t ares__buf_load_file(const char *filename, ares__buf_t *buf) fp = fopen(filename, "rb"); if (fp == NULL) { - int error = ERRNO; + int error = errno; switch (error) { case ENOENT: case ESRCH: @@ -1278,7 +1475,7 @@ ares_status_t ares__buf_load_file(const char *filename, ares__buf_t *buf) /* Read entire data into buffer */ ptr_len = len; - ptr = ares__buf_append_start(buf, &ptr_len); + ptr = ares_buf_append_start(buf, &ptr_len); if (ptr == NULL) { status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ goto done; /* LCOV_EXCL_LINE: OutOfMemory */ @@ -1290,7 +1487,7 @@ ares_status_t ares__buf_load_file(const char *filename, ares__buf_t *buf) goto done; /* LCOV_EXCL_LINE: DefensiveCoding */ } - ares__buf_append_finish(buf, len); + ares_buf_append_finish(buf, len); status = ARES_SUCCESS; done: diff --git a/lib/c-ares-1.34.4/src/lib/str/ares_str.c b/lib/c-ares-1.34.4/src/lib/str/ares_str.c new file mode 100644 index 00000000000..0eda1ab9f15 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/str/ares_str.c @@ -0,0 +1,508 @@ +/* MIT License + * + * Copyright (c) 1998 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" +#include "ares_str.h" + +#ifdef HAVE_STDINT_H +# include +#endif + +size_t ares_strnlen(const char *str, size_t maxlen) { + const char *p = NULL; + if (str == NULL) { + return 0; + } +#ifdef HAVE_STRNLEN + (void)p; + return strnlen(str, maxlen); +#else + if ((p = memchr(str, 0, maxlen)) == NULL) { + return maxlen; + } else { + return (size_t)(p - str); + } +#endif /* HAVE_STRNLEN */ +} + +size_t ares_strlen(const char *str) +{ + if (str == NULL) { + return 0; + } + + return strlen(str); +} + +char *ares_strdup(const char *s1) +{ + size_t len; + char *out; + + if (s1 == NULL) { + return NULL; + } + + len = ares_strlen(s1); + + /* Don't see how this is possible */ + if (len == SIZE_MAX) { + return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */ + } + + out = ares_malloc(len + 1); + if (out == NULL) { + return NULL; + } + + if (len) { + memcpy(out, s1, len); + } + + out[len] = 0; + return out; +} + +size_t ares_strcpy(char *dest, const char *src, size_t dest_size) +{ + size_t len = 0; + + if (dest == NULL || dest_size == 0) { + return 0; /* LCOV_EXCL_LINE: DefensiveCoding */ + } + + len = ares_strlen(src); + + if (len >= dest_size) { + len = dest_size - 1; + } + + if (len) { + memcpy(dest, src, len); + } + + dest[len] = 0; + return len; +} + +ares_bool_t ares_str_isnum(const char *str) +{ + size_t i; + + if (str == NULL || *str == 0) { + return ARES_FALSE; + } + + for (i = 0; str[i] != 0; i++) { + if (!ares_isdigit(str[i])) { + return ARES_FALSE; + } + } + return ARES_TRUE; +} + +ares_bool_t ares_str_isalnum(const char *str) +{ + size_t i; + + if (str == NULL || *str == 0) { + return ARES_FALSE; + } + + for (i = 0; str[i] != 0; i++) { + if (!ares_isdigit(str[i]) && !ares_isalpha(str[i])) { + return ARES_FALSE; + } + } + return ARES_TRUE; +} + +void ares_str_rtrim(char *str) +{ + size_t len; + size_t i; + + if (str == NULL) { + return; /* LCOV_EXCL_LINE: DefensiveCoding */ + } + + len = ares_strlen(str); + for (i = len; i > 0; i--) { + if (!ares_isspace(str[i - 1])) { + break; + } + } + str[i] = 0; +} + +void ares_str_ltrim(char *str) +{ + size_t i; + size_t len; + + if (str == NULL) { + return; /* LCOV_EXCL_LINE: DefensiveCoding */ + } + + for (i = 0; str[i] != 0 && ares_isspace(str[i]); i++) { + /* Do nothing */ + } + + if (i == 0) { + return; + } + + len = ares_strlen(str); + if (i != len) { + memmove(str, str + i, len - i); + } + str[len - i] = 0; +} + +void ares_str_trim(char *str) +{ + ares_str_ltrim(str); + ares_str_rtrim(str); +} + +/* tolower() is locale-specific. Use a lookup table fast conversion that only + * operates on ASCII */ +static const unsigned char ares_tolower_lookup[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, + 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, + 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, + 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, + 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, + 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, + 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, + 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, + 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, + 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, + 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, + 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, + 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, + 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, + 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, + 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, + 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF +}; + +unsigned char ares_tolower(unsigned char c) +{ + return ares_tolower_lookup[c]; +} + +void ares_str_lower(char *str) +{ + size_t i; + + if (str == NULL) { + return; + } + + for (i = 0; str[i] != 0; i++) { + str[i] = (char)ares_tolower((unsigned char)str[i]); + } +} + +unsigned char *ares_memmem(const unsigned char *big, size_t big_len, + const unsigned char *little, size_t little_len) +{ + unsigned char *ptr; + + if (big == NULL || little == NULL || big_len == 0 || little_len == 0) { + return NULL; + } + +#ifdef HAVE_MEMMEM + ptr = memmem(big, big_len, little, little_len); + return ptr; +#else + while (1) { + ptr = memchr(big, little[0], big_len); + if (ptr == NULL) { + break; + } + + big_len -= (size_t)(ptr - big); + big = ptr; + if (big_len < little_len) { + break; + } + + if (memcmp(big, little, little_len) == 0) { + return ptr; + } + + big++; + big_len--; + } + + return NULL; +#endif +} + +ares_bool_t ares_memeq(const unsigned char *ptr, const unsigned char *val, + size_t len) +{ + return memcmp(ptr, val, len) == 0 ? ARES_TRUE : ARES_FALSE; +} + +ares_bool_t ares_memeq_ci(const unsigned char *ptr, const unsigned char *val, + size_t len) +{ + size_t i; + for (i = 0; i < len; i++) { + if (ares_tolower_lookup[ptr[i]] != ares_tolower_lookup[val[i]]) { + return ARES_FALSE; + } + } + return ARES_TRUE; +} + +ares_bool_t ares_is_hostname(const char *str) +{ + size_t i; + + if (str == NULL) { + return ARES_FALSE; /* LCOV_EXCL_LINE: DefensiveCoding */ + } + + for (i = 0; str[i] != 0; i++) { + if (!ares_is_hostnamech(str[i])) { + return ARES_FALSE; + } + } + return ARES_TRUE; +} + +ares_bool_t ares_str_isprint(const char *str, size_t len) +{ + size_t i; + + if (str == NULL && len != 0) { + return ARES_FALSE; + } + + for (i = 0; i < len; i++) { + if (!ares_isprint(str[i])) { + return ARES_FALSE; + } + } + return ARES_TRUE; +} + +int ares_strcmp(const char *a, const char *b) +{ + if (a == NULL && b == NULL) { + return 0; + } + + if (a != NULL && b == NULL) { + if (*a == 0) { + return 0; + } + return 1; + } + + if (a == NULL && b != NULL) { + if (*b == 0) { + return 0; + } + return -1; + } + + return strcmp(a, b); +} + +int ares_strncmp(const char *a, const char *b, size_t n) +{ + if (n == 0) { + return 0; + } + + if (a == NULL && b == NULL) { + return 0; + } + + if (a != NULL && b == NULL) { + if (*a == 0) { + return 0; + } + return 1; + } + + if (a == NULL && b != NULL) { + if (*b == 0) { + return 0; + } + return -1; + } + + return strncmp(a, b, n); +} + +int ares_strcasecmp(const char *a, const char *b) +{ + if (a == NULL && b == NULL) { + return 0; + } + + if (a != NULL && b == NULL) { + if (*a == 0) { + return 0; + } + return 1; + } + + if (a == NULL && b != NULL) { + if (*b == 0) { + return 0; + } + return -1; + } + +#if defined(HAVE_STRCASECMP) + return strcasecmp(a, b); +#elif defined(HAVE_STRCMPI) + return strcmpi(a, b); +#elif defined(HAVE_STRICMP) + return stricmp(a, b); +#else + { + size_t i; + + for (i = 0; i < (size_t)-1; i++) { + int c1 = ares_tolower(a[i]); + int c2 = ares_tolower(b[i]); + if (c1 != c2) { + return c1 - c2; + } + if (!c1) { + break; + } + } + } + return 0; +#endif +} + +int ares_strncasecmp(const char *a, const char *b, size_t n) +{ + if (n == 0) { + return 0; + } + + if (a == NULL && b == NULL) { + return 0; + } + + if (a != NULL && b == NULL) { + if (*a == 0) { + return 0; + } + return 1; + } + + if (a == NULL && b != NULL) { + if (*b == 0) { + return 0; + } + return -1; + } + +#if defined(HAVE_STRNCASECMP) + return strncasecmp(a, b, n); +#elif defined(HAVE_STRNCMPI) + return strncmpi(a, b, n); +#elif defined(HAVE_STRNICMP) + return strnicmp(a, b, n); +#else + { + size_t i; + + for (i = 0; i < n; i++) { + int c1 = ares_tolower(a[i]); + int c2 = ares_tolower(b[i]); + if (c1 != c2) { + return c1 - c2; + } + if (!c1) { + break; + } + } + } + return 0; +#endif +} + +ares_bool_t ares_strcaseeq(const char *a, const char *b) +{ + return ares_strcasecmp(a, b) == 0 ? ARES_TRUE : ARES_FALSE; +} + +ares_bool_t ares_strcaseeq_max(const char *a, const char *b, size_t n) +{ + return ares_strncasecmp(a, b, n) == 0 ? ARES_TRUE : ARES_FALSE; +} + +ares_bool_t ares_streq(const char *a, const char *b) +{ + return ares_strcmp(a, b) == 0 ? ARES_TRUE : ARES_FALSE; +} + +ares_bool_t ares_streq_max(const char *a, const char *b, size_t n) +{ + return ares_strncmp(a, b, n) == 0 ? ARES_TRUE : ARES_FALSE; +} + +void ares_free_array(void *arrp, size_t nmembers, void (*freefunc)(void *)) +{ + size_t i; + void **arr = arrp; + + if (arr == NULL) { + return; + } + + if (freefunc != NULL) { + if (nmembers == SIZE_MAX) { + for (i = 0; arr[i] != NULL; i++) { + freefunc(arr[i]); + } + } else { + for (i = 0; i < nmembers; i++) { + freefunc(arr[i]); + } + } + } + + ares_free(arr); +} diff --git a/lib/c-ares-1.33.1/src/lib/str/ares_strsplit.c b/lib/c-ares-1.34.4/src/lib/str/ares_strsplit.c similarity index 56% rename from lib/c-ares-1.33.1/src/lib/str/ares_strsplit.c rename to lib/c-ares-1.34.4/src/lib/str/ares_strsplit.c index dee307d7799..4431c5044d5 100644 --- a/lib/c-ares-1.33.1/src/lib/str/ares_strsplit.c +++ b/lib/c-ares-1.34.4/src/lib/str/ares_strsplit.c @@ -25,21 +25,12 @@ */ #include "ares_private.h" -void ares__strsplit_free(char **elms, size_t num_elm) +void ares_strsplit_free(char **elms, size_t num_elm) { - size_t i; - - if (elms == NULL) { - return; - } - - for (i = 0; i < num_elm; i++) { - ares_free(elms[i]); - } - ares_free(elms); + ares_free_array(elms, num_elm, ares_free); } -char **ares__strsplit_duplicate(char **elms, size_t num_elm) +char **ares_strsplit_duplicate(char **elms, size_t num_elm) { size_t i; char **out; @@ -56,23 +47,19 @@ char **ares__strsplit_duplicate(char **elms, size_t num_elm) for (i = 0; i < num_elm; i++) { out[i] = ares_strdup(elms[i]); if (out[i] == NULL) { - ares__strsplit_free(out, num_elm); /* LCOV_EXCL_LINE: OutOfMemory */ - return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ + ares_strsplit_free(out, num_elm); /* LCOV_EXCL_LINE: OutOfMemory */ + return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ } } return out; } -char **ares__strsplit(const char *in, const char *delms, size_t *num_elm) +char **ares_strsplit(const char *in, const char *delms, size_t *num_elm) { - ares_status_t status; - ares__buf_t *buf = NULL; - ares__llist_t *llist = NULL; - ares__llist_node_t *node; - char **out = NULL; - size_t cnt = 0; - size_t idx = 0; + ares_status_t status; + ares_buf_t *buf = NULL; + char **out = NULL; if (in == NULL || delms == NULL || num_elm == NULL) { return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */ @@ -80,52 +67,22 @@ char **ares__strsplit(const char *in, const char *delms, size_t *num_elm) *num_elm = 0; - buf = ares__buf_create_const((const unsigned char *)in, ares_strlen(in)); + buf = ares_buf_create_const((const unsigned char *)in, ares_strlen(in)); if (buf == NULL) { return NULL; } - status = ares__buf_split( + status = ares_buf_split_str( buf, (const unsigned char *)delms, ares_strlen(delms), - ARES_BUF_SPLIT_NO_DUPLICATES | ARES_BUF_SPLIT_CASE_INSENSITIVE, 0, &llist); + ARES_BUF_SPLIT_NO_DUPLICATES | ARES_BUF_SPLIT_CASE_INSENSITIVE, 0, &out, + num_elm); if (status != ARES_SUCCESS) { goto done; } - cnt = ares__llist_len(llist); - if (cnt == 0) { - status = ARES_EFORMERR; - goto done; - } - - - out = ares_malloc_zero(cnt * sizeof(*out)); - if (out == NULL) { - status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ - goto done; /* LCOV_EXCL_LINE: OutOfMemory */ - } - - for (node = ares__llist_node_first(llist); node != NULL; - node = ares__llist_node_next(node)) { - ares__buf_t *val = ares__llist_node_val(node); - char *temp = NULL; - - status = ares__buf_fetch_str_dup(val, ares__buf_len(val), &temp); - if (status != ARES_SUCCESS) { - goto done; - } - - out[idx++] = temp; - } - - *num_elm = cnt; - status = ARES_SUCCESS; - done: - ares__llist_destroy(llist); - ares__buf_destroy(buf); + ares_buf_destroy(buf); if (status != ARES_SUCCESS) { - ares__strsplit_free(out, cnt); out = NULL; } diff --git a/lib/c-ares-1.33.1/src/lib/str/ares_strsplit.h b/lib/c-ares-1.34.4/src/lib/str/ares_strsplit.h similarity index 88% rename from lib/c-ares-1.33.1/src/lib/str/ares_strsplit.h rename to lib/c-ares-1.34.4/src/lib/str/ares_strsplit.h index ee997804f01..0da090263af 100644 --- a/lib/c-ares-1.33.1/src/lib/str/ares_strsplit.h +++ b/lib/c-ares-1.34.4/src/lib/str/ares_strsplit.h @@ -40,12 +40,12 @@ * returns an allocated array of allocated string elements. * */ -char **ares__strsplit(const char *in, const char *delms, size_t *num_elm); +char **ares_strsplit(const char *in, const char *delms, size_t *num_elm); -/* Frees the result returned from ares__strsplit(). */ -void ares__strsplit_free(char **elms, size_t num_elm); +/* Frees the result returned from ares_strsplit(). */ +void ares_strsplit_free(char **elms, size_t num_elm); /* Duplicate the array */ -char **ares__strsplit_duplicate(char **elms, size_t num_elm); +char **ares_strsplit_duplicate(char **elms, size_t num_elm); #endif /* HEADER_CARES_STRSPLIT_H */ diff --git a/lib/c-ares-1.33.1/src/lib/thirdparty/apple/dnsinfo.h b/lib/c-ares-1.34.4/src/lib/thirdparty/apple/dnsinfo.h similarity index 100% rename from lib/c-ares-1.33.1/src/lib/thirdparty/apple/dnsinfo.h rename to lib/c-ares-1.34.4/src/lib/thirdparty/apple/dnsinfo.h diff --git a/lib/c-ares-1.33.1/src/lib/util/ares__iface_ips.c b/lib/c-ares-1.34.4/src/lib/util/ares_iface_ips.c similarity index 69% rename from lib/c-ares-1.33.1/src/lib/util/ares__iface_ips.c rename to lib/c-ares-1.34.4/src/lib/util/ares_iface_ips.c index 56dc2579041..46cb291e300 100644 --- a/lib/c-ares-1.33.1/src/lib/util/ares__iface_ips.c +++ b/lib/c-ares-1.34.4/src/lib/util/ares_iface_ips.c @@ -59,41 +59,40 @@ #endif -static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, - const char *name); +static ares_status_t ares_iface_ips_enumerate(ares_iface_ips_t *ips, + const char *name); typedef struct { - char *name; - struct ares_addr addr; - unsigned char netmask; - unsigned int ll_scope; - ares__iface_ip_flags_t flags; -} ares__iface_ip_t; - -struct ares__iface_ips { - ares__array_t *ips; /*!< Type is ares__iface_ip_t */ - ares__iface_ip_flags_t enum_flags; + char *name; + struct ares_addr addr; + unsigned char netmask; + unsigned int ll_scope; + ares_iface_ip_flags_t flags; +} ares_iface_ip_t; + +struct ares_iface_ips { + ares_array_t *ips; /*!< Type is ares_iface_ip_t */ + ares_iface_ip_flags_t enum_flags; }; -static void ares__iface_ip_free_cb(void *arg) +static void ares_iface_ip_free_cb(void *arg) { - ares__iface_ip_t *ip = arg; + ares_iface_ip_t *ip = arg; if (ip == NULL) { return; } ares_free(ip->name); } -static ares__iface_ips_t *ares__iface_ips_alloc(ares__iface_ip_flags_t flags) +static ares_iface_ips_t *ares_iface_ips_alloc(ares_iface_ip_flags_t flags) { - ares__iface_ips_t *ips = ares_malloc_zero(sizeof(*ips)); + ares_iface_ips_t *ips = ares_malloc_zero(sizeof(*ips)); if (ips == NULL) { return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ } ips->enum_flags = flags; - ips->ips = - ares__array_create(sizeof(ares__iface_ip_t), ares__iface_ip_free_cb); + ips->ips = ares_array_create(sizeof(ares_iface_ip_t), ares_iface_ip_free_cb); if (ips->ips == NULL) { ares_free(ips); /* LCOV_EXCL_LINE: OutOfMemory */ return NULL; /* LCOV_EXCL_LINE: OutOfMemory */ @@ -101,18 +100,18 @@ static ares__iface_ips_t *ares__iface_ips_alloc(ares__iface_ip_flags_t flags) return ips; } -void ares__iface_ips_destroy(ares__iface_ips_t *ips) +void ares_iface_ips_destroy(ares_iface_ips_t *ips) { if (ips == NULL) { return; } - ares__array_destroy(ips->ips); + ares_array_destroy(ips->ips); ares_free(ips); } -ares_status_t ares__iface_ips(ares__iface_ips_t **ips, - ares__iface_ip_flags_t flags, const char *name) +ares_status_t ares_iface_ips(ares_iface_ips_t **ips, + ares_iface_ip_flags_t flags, const char *name) { ares_status_t status; @@ -120,15 +119,15 @@ ares_status_t ares__iface_ips(ares__iface_ips_t **ips, return ARES_EFORMERR; } - *ips = ares__iface_ips_alloc(flags); + *ips = ares_iface_ips_alloc(flags); if (*ips == NULL) { return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ } - status = ares__iface_ips_enumerate(*ips, name); + status = ares_iface_ips_enumerate(*ips, name); if (status != ARES_SUCCESS) { /* LCOV_EXCL_START: UntestablePath */ - ares__iface_ips_destroy(*ips); + ares_iface_ips_destroy(*ips); *ips = NULL; return status; /* LCOV_EXCL_STOP */ @@ -138,12 +137,12 @@ ares_status_t ares__iface_ips(ares__iface_ips_t **ips, } static ares_status_t - ares__iface_ips_add(ares__iface_ips_t *ips, ares__iface_ip_flags_t flags, - const char *name, const struct ares_addr *addr, - unsigned char netmask, unsigned int ll_scope) + ares_iface_ips_add(ares_iface_ips_t *ips, ares_iface_ip_flags_t flags, + const char *name, const struct ares_addr *addr, + unsigned char netmask, unsigned int ll_scope) { - ares__iface_ip_t *ip; - ares_status_t status; + ares_iface_ip_t *ip; + ares_status_t status; if (ips == NULL || name == NULL || addr == NULL) { return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */ @@ -162,7 +161,7 @@ static ares_status_t } /* Check for link-local */ - if (ares__addr_is_linklocal(addr)) { + if (ares_addr_is_linklocal(addr)) { flags |= ARES_IFACE_IP_LINKLOCAL; } if (flags & ARES_IFACE_IP_LINKLOCAL && @@ -190,7 +189,7 @@ static ares_status_t } } - status = ares__array_insert_last((void **)&ip, ips->ips); + status = ares_array_insert_last((void **)&ip, ips->ips); if (status != ARES_SUCCESS) { return status; } @@ -203,30 +202,30 @@ static ares_status_t memcpy(&ip->addr, addr, sizeof(*addr)); ip->name = ares_strdup(name); if (ip->name == NULL) { - ares__array_remove_last(ips->ips); + ares_array_remove_last(ips->ips); return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */ } return ARES_SUCCESS; } -size_t ares__iface_ips_cnt(const ares__iface_ips_t *ips) +size_t ares_iface_ips_cnt(const ares_iface_ips_t *ips) { if (ips == NULL) { return 0; } - return ares__array_len(ips->ips); + return ares_array_len(ips->ips); } -const char *ares__iface_ips_get_name(const ares__iface_ips_t *ips, size_t idx) +const char *ares_iface_ips_get_name(const ares_iface_ips_t *ips, size_t idx) { - const ares__iface_ip_t *ip; + const ares_iface_ip_t *ip; if (ips == NULL) { return NULL; } - ip = ares__array_at_const(ips->ips, idx); + ip = ares_array_at_const(ips->ips, idx); if (ip == NULL) { return NULL; } @@ -234,16 +233,16 @@ const char *ares__iface_ips_get_name(const ares__iface_ips_t *ips, size_t idx) return ip->name; } -const struct ares_addr *ares__iface_ips_get_addr(const ares__iface_ips_t *ips, - size_t idx) +const struct ares_addr *ares_iface_ips_get_addr(const ares_iface_ips_t *ips, + size_t idx) { - const ares__iface_ip_t *ip; + const ares_iface_ip_t *ip; if (ips == NULL) { return NULL; } - ip = ares__array_at_const(ips->ips, idx); + ip = ares_array_at_const(ips->ips, idx); if (ip == NULL) { return NULL; } @@ -251,16 +250,16 @@ const struct ares_addr *ares__iface_ips_get_addr(const ares__iface_ips_t *ips, return &ip->addr; } -ares__iface_ip_flags_t ares__iface_ips_get_flags(const ares__iface_ips_t *ips, - size_t idx) +ares_iface_ip_flags_t ares_iface_ips_get_flags(const ares_iface_ips_t *ips, + size_t idx) { - const ares__iface_ip_t *ip; + const ares_iface_ip_t *ip; if (ips == NULL) { return 0; } - ip = ares__array_at_const(ips->ips, idx); + ip = ares_array_at_const(ips->ips, idx); if (ip == NULL) { return 0; } @@ -268,16 +267,16 @@ ares__iface_ip_flags_t ares__iface_ips_get_flags(const ares__iface_ips_t *ips, return ip->flags; } -unsigned char ares__iface_ips_get_netmask(const ares__iface_ips_t *ips, - size_t idx) +unsigned char ares_iface_ips_get_netmask(const ares_iface_ips_t *ips, + size_t idx) { - const ares__iface_ip_t *ip; + const ares_iface_ip_t *ip; if (ips == NULL) { return 0; } - ip = ares__array_at_const(ips->ips, idx); + ip = ares_array_at_const(ips->ips, idx); if (ip == NULL) { return 0; } @@ -285,16 +284,16 @@ unsigned char ares__iface_ips_get_netmask(const ares__iface_ips_t *ips, return ip->netmask; } -unsigned int ares__iface_ips_get_ll_scope(const ares__iface_ips_t *ips, - size_t idx) +unsigned int ares_iface_ips_get_ll_scope(const ares_iface_ips_t *ips, + size_t idx) { - const ares__iface_ip_t *ip; + const ares_iface_ip_t *ip; if (ips == NULL) { return 0; } - ip = ares__array_at_const(ips->ips, idx); + ip = ares_array_at_const(ips->ips, idx); if (ip == NULL) { return 0; } @@ -334,7 +333,7 @@ static ares_bool_t name_match(const char *name, const char *adapter_name, return ARES_TRUE; } - if (strcasecmp(name, adapter_name) == 0) { + if (ares_strcaseeq(name, adapter_name)) { return ARES_TRUE; } @@ -345,8 +344,8 @@ static ares_bool_t name_match(const char *name, const char *adapter_name, return ARES_FALSE; } -static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, - const char *name) +static ares_status_t ares_iface_ips_enumerate(ares_iface_ips_t *ips, + const char *name) { ULONG myflags = GAA_FLAG_INCLUDE_PREFIX /*|GAA_FLAG_INCLUDE_ALL_INTERFACES */; ULONG outBufLen = 0; @@ -377,7 +376,7 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, for (address = addresses; address != NULL; address = address->Next) { IP_ADAPTER_UNICAST_ADDRESS *ipaddr = NULL; - ares__iface_ip_flags_t addrflag = 0; + ares_iface_ip_flags_t addrflag = 0; char ifname[64] = ""; # if defined(HAVE_CONVERTINTERFACEINDEXTOLUID) && \ @@ -431,9 +430,9 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, continue; } - status = ares__iface_ips_add(ips, addrflag, ifname, &addr, - ipaddr->OnLinkPrefixLength /* netmask */, - address->Ipv6IfIndex /* ll_scope */); + status = ares_iface_ips_add(ips, addrflag, ifname, &addr, + ipaddr->OnLinkPrefixLength /* netmask */, + address->Ipv6IfIndex /* ll_scope */); if (status != ARES_SUCCESS) { goto done; @@ -454,13 +453,13 @@ static unsigned char count_addr_bits(const unsigned char *addr, size_t addr_len) unsigned char count = 0; for (i = 0; i < addr_len; i++) { - count += ares__count_bits_u8(addr[i]); + count += ares_count_bits_u8(addr[i]); } return count; } -static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, - const char *name) +static ares_status_t ares_iface_ips_enumerate(ares_iface_ips_t *ips, + const char *name) { struct ifaddrs *ifap = NULL; struct ifaddrs *ifa = NULL; @@ -472,10 +471,10 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, } for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { - ares__iface_ip_flags_t addrflag = 0; - struct ares_addr addr; - unsigned char netmask = 0; - unsigned int ll_scope = 0; + ares_iface_ip_flags_t addrflag = 0; + struct ares_addr addr; + unsigned char netmask = 0; + unsigned int ll_scope = 0; if (ifa->ifa_addr == NULL) { continue; @@ -515,12 +514,12 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, } /* Name mismatch */ - if (name != NULL && strcasecmp(ifa->ifa_name, name) != 0) { + if (name != NULL && !ares_strcaseeq(ifa->ifa_name, name)) { continue; } - status = ares__iface_ips_add(ips, addrflag, ifa->ifa_name, &addr, netmask, - ll_scope); + status = ares_iface_ips_add(ips, addrflag, ifa->ifa_name, &addr, netmask, + ll_scope); if (status != ARES_SUCCESS) { goto done; } @@ -533,8 +532,8 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, #else -static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, - const char *name) +static ares_status_t ares_iface_ips_enumerate(ares_iface_ips_t *ips, + const char *name) { (void)ips; (void)name; @@ -544,7 +543,7 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips, #endif -unsigned int ares__if_nametoindex(const char *name) +unsigned int ares_os_if_nametoindex(const char *name) { #ifdef HAVE_IF_NAMETOINDEX if (name == NULL) { @@ -552,36 +551,35 @@ unsigned int ares__if_nametoindex(const char *name) } return if_nametoindex(name); #else - ares_status_t status; - ares__iface_ips_t *ips = NULL; - size_t i; - unsigned int index = 0; + ares_status_t status; + ares_iface_ips_t *ips = NULL; + size_t i; + unsigned int index = 0; if (name == NULL) { return 0; } status = - ares__iface_ips(&ips, ARES_IFACE_IP_V6 | ARES_IFACE_IP_LINKLOCAL, name); + ares_iface_ips(&ips, ARES_IFACE_IP_V6 | ARES_IFACE_IP_LINKLOCAL, name); if (status != ARES_SUCCESS) { goto done; } - for (i = 0; i < ares__iface_ips_cnt(ips); i++) { - if (ares__iface_ips_get_flags(ips, i) & ARES_IFACE_IP_LINKLOCAL) { - index = ares__iface_ips_get_ll_scope(ips, i); + for (i = 0; i < ares_iface_ips_cnt(ips); i++) { + if (ares_iface_ips_get_flags(ips, i) & ARES_IFACE_IP_LINKLOCAL) { + index = ares_iface_ips_get_ll_scope(ips, i); goto done; } } done: - ares__iface_ips_destroy(ips); + ares_iface_ips_destroy(ips); return index; #endif } -const char *ares__if_indextoname(unsigned int index, char *name, - size_t name_len) +const char *ares_os_if_indextoname(unsigned int index, char *name, size_t name_len) { #ifdef HAVE_IF_INDEXTONAME if (name_len < IF_NAMESIZE) { @@ -589,10 +587,10 @@ const char *ares__if_indextoname(unsigned int index, char *name, } return if_indextoname(index, name); #else - ares_status_t status; - ares__iface_ips_t *ips = NULL; - size_t i; - const char *ptr = NULL; + ares_status_t status; + ares_iface_ips_t *ips = NULL; + size_t i; + const char *ptr = NULL; if (name == NULL || name_len < IF_NAMESIZE) { goto done; @@ -603,22 +601,22 @@ const char *ares__if_indextoname(unsigned int index, char *name, } status = - ares__iface_ips(&ips, ARES_IFACE_IP_V6 | ARES_IFACE_IP_LINKLOCAL, NULL); + ares_iface_ips(&ips, ARES_IFACE_IP_V6 | ARES_IFACE_IP_LINKLOCAL, NULL); if (status != ARES_SUCCESS) { goto done; } - for (i = 0; i < ares__iface_ips_cnt(ips); i++) { - if (ares__iface_ips_get_flags(ips, i) & ARES_IFACE_IP_LINKLOCAL && - ares__iface_ips_get_ll_scope(ips, i) == index) { - ares_strcpy(name, ares__iface_ips_get_name(ips, i), name_len); + for (i = 0; i < ares_iface_ips_cnt(ips); i++) { + if (ares_iface_ips_get_flags(ips, i) & ARES_IFACE_IP_LINKLOCAL && + ares_iface_ips_get_ll_scope(ips, i) == index) { + ares_strcpy(name, ares_iface_ips_get_name(ips, i), name_len); ptr = name; goto done; } } done: - ares__iface_ips_destroy(ips); + ares_iface_ips_destroy(ips); return ptr; #endif } diff --git a/lib/c-ares-1.33.1/src/lib/util/ares__iface_ips.h b/lib/c-ares-1.34.4/src/lib/util/ares_iface_ips.h similarity index 77% rename from lib/c-ares-1.33.1/src/lib/util/ares__iface_ips.h rename to lib/c-ares-1.34.4/src/lib/util/ares_iface_ips.h index 61ff736a796..f22e09046a0 100644 --- a/lib/c-ares-1.33.1/src/lib/util/ares__iface_ips.h +++ b/lib/c-ares-1.34.4/src/lib/util/ares_iface_ips.h @@ -42,18 +42,18 @@ typedef enum { /*! Default, enumerate all ips for online interfaces, including loopback */ ARES_IFACE_IP_DEFAULT = (ARES_IFACE_IP_V4 | ARES_IFACE_IP_V6 | ARES_IFACE_IP_LOOPBACK | ARES_IFACE_IP_LINKLOCAL) -} ares__iface_ip_flags_t; +} ares_iface_ip_flags_t; -struct ares__iface_ips; +struct ares_iface_ips; /*! Opaque pointer for holding enumerated interface ip addresses */ -typedef struct ares__iface_ips ares__iface_ips_t; +typedef struct ares_iface_ips ares_iface_ips_t; -/*! Destroy ip address enumeration created by ares__iface_ips(). +/*! Destroy ip address enumeration created by ares_iface_ips(). * * \param[in] ips Initialized IP address enumeration structure */ -void ares__iface_ips_destroy(ares__iface_ips_t *ips); +void ares_iface_ips_destroy(ares_iface_ips_t *ips); /*! Enumerate ip addresses on interfaces * @@ -63,15 +63,15 @@ void ares__iface_ips_destroy(ares__iface_ips_t *ips); * \return ARES_ENOMEM on out of memory, ARES_ENOTIMP if not supported on * the system, ARES_SUCCESS on success */ -ares_status_t ares__iface_ips(ares__iface_ips_t **ips, - ares__iface_ip_flags_t flags, const char *name); +ares_status_t ares_iface_ips(ares_iface_ips_t **ips, + ares_iface_ip_flags_t flags, const char *name); /*! Count of ips enumerated * * \param[in] ips Initialized IP address enumeration structure * \return count */ -size_t ares__iface_ips_cnt(const ares__iface_ips_t *ips); +size_t ares_iface_ips_cnt(const ares_iface_ips_t *ips); /*! Retrieve interface name * @@ -79,7 +79,7 @@ size_t ares__iface_ips_cnt(const ares__iface_ips_t *ips); * \param[in] idx Index of entry to pull * \return interface name */ -const char *ares__iface_ips_get_name(const ares__iface_ips_t *ips, size_t idx); +const char *ares_iface_ips_get_name(const ares_iface_ips_t *ips, size_t idx); /*! Retrieve interface address * @@ -87,8 +87,8 @@ const char *ares__iface_ips_get_name(const ares__iface_ips_t *ips, size_t idx); * \param[in] idx Index of entry to pull * \return interface address */ -const struct ares_addr *ares__iface_ips_get_addr(const ares__iface_ips_t *ips, - size_t idx); +const struct ares_addr *ares_iface_ips_get_addr(const ares_iface_ips_t *ips, + size_t idx); /*! Retrieve interface address flags * @@ -96,8 +96,8 @@ const struct ares_addr *ares__iface_ips_get_addr(const ares__iface_ips_t *ips, * \param[in] idx Index of entry to pull * \return interface address flags */ -ares__iface_ip_flags_t ares__iface_ips_get_flags(const ares__iface_ips_t *ips, - size_t idx); +ares_iface_ip_flags_t ares_iface_ips_get_flags(const ares_iface_ips_t *ips, + size_t idx); /*! Retrieve interface address netmask * @@ -105,8 +105,8 @@ ares__iface_ip_flags_t ares__iface_ips_get_flags(const ares__iface_ips_t *ips, * \param[in] idx Index of entry to pull * \return interface address netmask */ -unsigned char ares__iface_ips_get_netmask(const ares__iface_ips_t *ips, - size_t idx); +unsigned char ares_iface_ips_get_netmask(const ares_iface_ips_t *ips, + size_t idx); /*! Retrieve interface ipv6 link local scope * @@ -114,8 +114,8 @@ unsigned char ares__iface_ips_get_netmask(const ares__iface_ips_t *ips, * \param[in] idx Index of entry to pull * \return interface ipv6 link local scope */ -unsigned int ares__iface_ips_get_ll_scope(const ares__iface_ips_t *ips, - size_t idx); +unsigned int ares_iface_ips_get_ll_scope(const ares_iface_ips_t *ips, + size_t idx); /*! Retrieve the interface index (aka link local scope) from the interface @@ -124,7 +124,7 @@ unsigned int ares__iface_ips_get_ll_scope(const ares__iface_ips_t *ips, * \param[in] name Interface name * \return 0 on failure, index otherwise */ -unsigned int ares__if_nametoindex(const char *name); +unsigned int ares_os_if_nametoindex(const char *name); /*! Retrieves the interface name from the index (aka link local scope) * @@ -133,7 +133,7 @@ unsigned int ares__if_nametoindex(const char *name); * \param[in] name_len Length of provided buffer, must be at least IF_NAMESIZE * \return NULL on failure, or pointer to name on success */ -const char *ares__if_indextoname(unsigned int index, char *name, - size_t name_len); +const char *ares_os_if_indextoname(unsigned int index, char *name, + size_t name_len); #endif diff --git a/lib/c-ares-1.33.1/src/lib/util/ares_math.c b/lib/c-ares-1.34.4/src/lib/util/ares_math.c similarity index 86% rename from lib/c-ares-1.33.1/src/lib/util/ares_math.c rename to lib/c-ares-1.34.4/src/lib/util/ares_math.c index 45999bdeaba..1106bf6bf15 100644 --- a/lib/c-ares-1.33.1/src/lib/util/ares_math.c +++ b/lib/c-ares-1.34.4/src/lib/util/ares_math.c @@ -29,7 +29,7 @@ /* Uses public domain code snippets from * http://graphics.stanford.edu/~seander/bithacks.html */ -static unsigned int ares__round_up_pow2_u32(unsigned int n) +static unsigned int ares_round_up_pow2_u32(unsigned int n) { /* NOTE: if already a power of 2, will return itself, not the next */ n--; @@ -42,7 +42,7 @@ static unsigned int ares__round_up_pow2_u32(unsigned int n) return n; } -static ares_int64_t ares__round_up_pow2_u64(ares_int64_t n) +static ares_int64_t ares_round_up_pow2_u64(ares_int64_t n) { /* NOTE: if already a power of 2, will return itself, not the next */ n--; @@ -56,7 +56,7 @@ static ares_int64_t ares__round_up_pow2_u64(ares_int64_t n) return n; } -ares_bool_t ares__is_64bit(void) +ares_bool_t ares_is_64bit(void) { #ifdef _MSC_VER # pragma warning(push) @@ -70,16 +70,16 @@ ares_bool_t ares__is_64bit(void) #endif } -size_t ares__round_up_pow2(size_t n) +size_t ares_round_up_pow2(size_t n) { - if (ares__is_64bit()) { - return (size_t)ares__round_up_pow2_u64((ares_int64_t)n); + if (ares_is_64bit()) { + return (size_t)ares_round_up_pow2_u64((ares_int64_t)n); } - return (size_t)ares__round_up_pow2_u32((unsigned int)n); + return (size_t)ares_round_up_pow2_u32((unsigned int)n); } -size_t ares__log2(size_t n) +size_t ares_log2(size_t n) { static const unsigned char tab32[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, @@ -92,7 +92,7 @@ size_t ares__log2(size_t n) 56, 45, 25, 31, 35, 16, 9, 12, 44, 24, 15, 8, 23, 7, 6, 5 }; - if (!ares__is_64bit()) { + if (!ares_is_64bit()) { return tab32[(n * 0x077CB531) >> 27]; } @@ -100,7 +100,7 @@ size_t ares__log2(size_t n) } /* x^y */ -size_t ares__pow(size_t x, size_t y) +size_t ares_pow(size_t x, size_t y) { size_t res = 1; @@ -118,7 +118,7 @@ size_t ares__pow(size_t x, size_t y) return res; } -size_t ares__count_digits(size_t n) +size_t ares_count_digits(size_t n) { size_t digits; @@ -132,7 +132,7 @@ size_t ares__count_digits(size_t n) return digits; } -size_t ares__count_hexdigits(size_t n) +size_t ares_count_hexdigits(size_t n) { size_t digits; @@ -146,7 +146,7 @@ size_t ares__count_hexdigits(size_t n) return digits; } -unsigned char ares__count_bits_u8(unsigned char x) +unsigned char ares_count_bits_u8(unsigned char x) { /* Implementation obtained from: * http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetTable */ diff --git a/lib/c-ares-1.33.1/src/lib/str/ares_strcasecmp.c b/lib/c-ares-1.34.4/src/lib/util/ares_math.h similarity index 53% rename from lib/c-ares-1.33.1/src/lib/str/ares_strcasecmp.c rename to lib/c-ares-1.34.4/src/lib/util/ares_math.h index 76b835fd8e9..52fa1facf01 100644 --- a/lib/c-ares-1.33.1/src/lib/str/ares_strcasecmp.c +++ b/lib/c-ares-1.34.4/src/lib/util/ares_math.h @@ -1,7 +1,6 @@ /* MIT License * - * Copyright (c) 1998 Massachusetts Institute of Technology - * Copyright (c) The c-ares project and its contributors + * 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 @@ -24,56 +23,23 @@ * * SPDX-License-Identifier: MIT */ +#ifndef __ARES_MATH_H +#define __ARES_MATH_H -#include "ares_private.h" -#include "ares_strcasecmp.h" - -#ifndef HAVE_STRCASECMP -int ares_strcasecmp(const char *a, const char *b) -{ -# if defined(HAVE_STRCMPI) - return strcmpi(a, b); -# elif defined(HAVE_STRICMP) - return stricmp(a, b); -# else - size_t i; - - for (i = 0; i < (size_t)-1; i++) { - int c1 = ares__tolower(a[i]); - int c2 = ares__tolower(b[i]); - if (c1 != c2) { - return c1 - c2; - } - if (!c1) { - break; - } - } - return 0; -# endif -} +#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 -#ifndef HAVE_STRNCASECMP -int ares_strncasecmp(const char *a, const char *b, size_t n) -{ -# if defined(HAVE_STRNCMPI) - return strncmpi(a, b, n); -# elif defined(HAVE_STRNICMP) - return strnicmp(a, b, n); -# else - size_t i; +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); - for (i = 0; i < n; i++) { - int c1 = ares__tolower(a[i]); - int c2 = ares__tolower(b[i]); - if (c1 != c2) { - return c1 - c2; - } - if (!c1) { - break; - } - } - return 0; -# endif -} #endif diff --git a/lib/c-ares-1.33.1/src/lib/util/ares_rand.c b/lib/c-ares-1.34.4/src/lib/util/ares_rand.c similarity index 88% rename from lib/c-ares-1.33.1/src/lib/util/ares_rand.c rename to lib/c-ares-1.34.4/src/lib/util/ares_rand.c index c57bb706e68..408999951a7 100644 --- a/lib/c-ares-1.33.1/src/lib/util/ares_rand.c +++ b/lib/c-ares-1.34.4/src/lib/util/ares_rand.c @@ -55,7 +55,7 @@ typedef struct ares_rand_rc4 { static unsigned int ares_u32_from_ptr(void *addr) { /* LCOV_EXCL_START: FallbackCode */ - if (ares__is_64bit()) { + if (ares_is_64bit()) { return (unsigned int)((((ares_uint64_t)addr >> 32) & 0xFFFFFFFF) | ((ares_uint64_t)addr & 0xFFFFFFFF)); } @@ -77,9 +77,13 @@ static void ares_rc4_generate_key(ares_rand_rc4 *rc4_state, unsigned char *key, return; } +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* For fuzzing, random should be deterministic */ + srand(0); +#else /* Randomness is hard to come by. Maybe the system randomizes heap and stack * addresses. Maybe the current timestamp give us some randomness. Use - * rc4_state (heap), &i (stack), and ares__tvnow() + * rc4_state (heap), &i (stack), and ares_tvnow() */ data = ares_u32_from_ptr(rc4_state); memcpy(key + len, &data, sizeof(data)); @@ -89,13 +93,14 @@ static void ares_rc4_generate_key(ares_rand_rc4 *rc4_state, unsigned char *key, memcpy(key + len, &data, sizeof(data)); len += sizeof(data); - ares__tvnow(&tv); + ares_tvnow(&tv); data = (unsigned int)((tv.sec | tv.usec) & 0xFFFFFFFF); memcpy(key + len, &data, sizeof(data)); len += sizeof(data); srand(ares_u32_from_ptr(rc4_state) | ares_u32_from_ptr(&i) | (unsigned int)((tv.sec | tv.usec) & 0xFFFFFFFF)); +#endif for (i = len; i < key_len; i++) { key[i] = (unsigned char)(rand() % 256); /* LCOV_EXCL_LINE */ @@ -188,10 +193,15 @@ BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength); #endif -static ares_bool_t ares__init_rand_engine(ares_rand_state *state) +static ares_bool_t ares_init_rand_engine(ares_rand_state *state) { state->cache_remaining = 0; +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* For fuzzing, random should be deterministic */ + state->bad_backends |= ARES_RAND_OS | ARES_RAND_FILE; +#endif + #if defined(HAVE_ARC4RANDOM_BUF) || defined(HAVE_GETRANDOM) || defined(_WIN32) if (!(state->bad_backends & ARES_RAND_OS)) { state->type = ARES_RAND_OS; @@ -223,7 +233,7 @@ static ares_bool_t ares__init_rand_engine(ares_rand_state *state) return ARES_TRUE; /* LCOV_EXCL_LINE: UntestablePath */ } -ares_rand_state *ares__init_rand_state(void) +ares_rand_state *ares_init_rand_state(void) { ares_rand_state *state = NULL; @@ -232,7 +242,7 @@ ares_rand_state *ares__init_rand_state(void) return NULL; } - if (!ares__init_rand_engine(state)) { + if (!ares_init_rand_engine(state)) { ares_free(state); /* LCOV_EXCL_LINE: UntestablePath */ return NULL; /* LCOV_EXCL_LINE: UntestablePath */ } @@ -240,7 +250,7 @@ ares_rand_state *ares__init_rand_state(void) return state; } -static void ares__clear_rand_state(ares_rand_state *state) +static void ares_clear_rand_state(ares_rand_state *state) { if (!state) { return; /* LCOV_EXCL_LINE: DefensiveCoding */ @@ -259,26 +269,26 @@ static void ares__clear_rand_state(ares_rand_state *state) } } -static void ares__reinit_rand(ares_rand_state *state) +static void ares_reinit_rand(ares_rand_state *state) { /* LCOV_EXCL_START: UntestablePath */ - ares__clear_rand_state(state); - ares__init_rand_engine(state); + ares_clear_rand_state(state); + ares_init_rand_engine(state); /* LCOV_EXCL_STOP */ } -void ares__destroy_rand_state(ares_rand_state *state) +void ares_destroy_rand_state(ares_rand_state *state) { if (!state) { return; } - ares__clear_rand_state(state); + ares_clear_rand_state(state); ares_free(state); } -static void ares__rand_bytes_fetch(ares_rand_state *state, unsigned char *buf, - size_t len) +static void ares_rand_bytes_fetch(ares_rand_state *state, unsigned char *buf, + size_t len) { while (1) { size_t bytes_read = 0; @@ -344,17 +354,17 @@ static void ares__rand_bytes_fetch(ares_rand_state *state, unsigned char *buf, /* If we didn't return before we got here, that means we had a critical rand * failure and need to reinitialized */ - ares__reinit_rand(state); /* LCOV_EXCL_LINE: UntestablePath */ + ares_reinit_rand(state); /* LCOV_EXCL_LINE: UntestablePath */ } } -void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len) +void ares_rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len) { /* See if we need to refill the cache to serve the request, but if len is * excessive, we're not going to update our cache or serve from cache */ if (len > state->cache_remaining && len < sizeof(state->cache)) { size_t fetch_size = sizeof(state->cache) - state->cache_remaining; - ares__rand_bytes_fetch(state, state->cache, fetch_size); + ares_rand_bytes_fetch(state, state->cache, fetch_size); state->cache_remaining = sizeof(state->cache); } @@ -367,13 +377,13 @@ void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len) } /* Serve direct due to excess size of request */ - ares__rand_bytes_fetch(state, buf, len); + ares_rand_bytes_fetch(state, buf, len); } -unsigned short ares__generate_new_id(ares_rand_state *state) +unsigned short ares_generate_new_id(ares_rand_state *state) { unsigned short r = 0; - ares__rand_bytes(state, (unsigned char *)&r, sizeof(r)); + ares_rand_bytes(state, (unsigned char *)&r, sizeof(r)); return r; } diff --git a/lib/c-ares-1.33.1/src/lib/ares_platform.h b/lib/c-ares-1.34.4/src/lib/util/ares_rand.h similarity index 72% rename from lib/c-ares-1.33.1/src/lib/ares_platform.h rename to lib/c-ares-1.34.4/src/lib/util/ares_rand.h index 768eaddddd9..81c61bf4648 100644 --- a/lib/c-ares-1.33.1/src/lib/ares_platform.h +++ b/lib/c-ares-1.34.4/src/lib/util/ares_rand.h @@ -1,7 +1,6 @@ /* MIT License * - * Copyright (c) 1998 Massachusetts Institute of Technology - * Copyright (c) 2004 Daniel Stenberg + * 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 @@ -24,27 +23,14 @@ * * SPDX-License-Identifier: MIT */ -#ifndef HEADER_CARES_PLATFORM_H -#define HEADER_CARES_PLATFORM_H +#ifndef __ARES_RAND_H +#define __ARES_RAND_H -#if defined(_WIN32) && !defined(MSDOS) +struct ares_rand_state; +typedef struct ares_rand_state ares_rand_state; -typedef enum { - WIN_UNKNOWN, - WIN_3X, - WIN_9X, - WIN_NT, - WIN_CE -} win_platform; - -win_platform ares__getplatform(void); - -#endif - -#if defined(_WIN32_WCE) - -struct servent *getservbyport(int port, const char *proto); +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); #endif - -#endif /* HEADER_CARES_PLATFORM_H */ diff --git a/lib/c-ares-1.33.1/src/lib/util/ares__threads.c b/lib/c-ares-1.34.4/src/lib/util/ares_threads.c similarity index 64% rename from lib/c-ares-1.33.1/src/lib/util/ares__threads.c rename to lib/c-ares-1.34.4/src/lib/util/ares_threads.c index b47544451d9..ab0b51afb70 100644 --- a/lib/c-ares-1.33.1/src/lib/util/ares__threads.c +++ b/lib/c-ares-1.34.4/src/lib/util/ares_threads.c @@ -28,13 +28,13 @@ #ifdef CARES_THREADS # ifdef _WIN32 -struct ares__thread_mutex { +struct ares_thread_mutex { CRITICAL_SECTION mutex; }; -ares__thread_mutex_t *ares__thread_mutex_create(void) +ares_thread_mutex_t *ares_thread_mutex_create(void) { - ares__thread_mutex_t *mut = ares_malloc_zero(sizeof(*mut)); + ares_thread_mutex_t *mut = ares_malloc_zero(sizeof(*mut)); if (mut == NULL) { return NULL; } @@ -43,7 +43,7 @@ ares__thread_mutex_t *ares__thread_mutex_create(void) return mut; } -void ares__thread_mutex_destroy(ares__thread_mutex_t *mut) +void ares_thread_mutex_destroy(ares_thread_mutex_t *mut) { if (mut == NULL) { return; @@ -52,7 +52,7 @@ void ares__thread_mutex_destroy(ares__thread_mutex_t *mut) ares_free(mut); } -void ares__thread_mutex_lock(ares__thread_mutex_t *mut) +void ares_thread_mutex_lock(ares_thread_mutex_t *mut) { if (mut == NULL) { return; @@ -60,7 +60,7 @@ void ares__thread_mutex_lock(ares__thread_mutex_t *mut) EnterCriticalSection(&mut->mutex); } -void ares__thread_mutex_unlock(ares__thread_mutex_t *mut) +void ares_thread_mutex_unlock(ares_thread_mutex_t *mut) { if (mut == NULL) { return; @@ -68,13 +68,13 @@ void ares__thread_mutex_unlock(ares__thread_mutex_t *mut) LeaveCriticalSection(&mut->mutex); } -struct ares__thread_cond { +struct ares_thread_cond { CONDITION_VARIABLE cond; }; -ares__thread_cond_t *ares__thread_cond_create(void) +ares_thread_cond_t *ares_thread_cond_create(void) { - ares__thread_cond_t *cond = ares_malloc_zero(sizeof(*cond)); + ares_thread_cond_t *cond = ares_malloc_zero(sizeof(*cond)); if (cond == NULL) { return NULL; } @@ -82,7 +82,7 @@ ares__thread_cond_t *ares__thread_cond_create(void) return cond; } -void ares__thread_cond_destroy(ares__thread_cond_t *cond) +void ares_thread_cond_destroy(ares_thread_cond_t *cond) { if (cond == NULL) { return; @@ -90,7 +90,7 @@ void ares__thread_cond_destroy(ares__thread_cond_t *cond) ares_free(cond); } -void ares__thread_cond_signal(ares__thread_cond_t *cond) +void ares_thread_cond_signal(ares_thread_cond_t *cond) { if (cond == NULL) { return; @@ -98,7 +98,7 @@ void ares__thread_cond_signal(ares__thread_cond_t *cond) WakeConditionVariable(&cond->cond); } -void ares__thread_cond_broadcast(ares__thread_cond_t *cond) +void ares_thread_cond_broadcast(ares_thread_cond_t *cond) { if (cond == NULL) { return; @@ -106,8 +106,8 @@ void ares__thread_cond_broadcast(ares__thread_cond_t *cond) WakeAllConditionVariable(&cond->cond); } -ares_status_t ares__thread_cond_wait(ares__thread_cond_t *cond, - ares__thread_mutex_t *mut) +ares_status_t ares_thread_cond_wait(ares_thread_cond_t *cond, + ares_thread_mutex_t *mut) { if (cond == NULL || mut == NULL) { return ARES_EFORMERR; @@ -117,9 +117,9 @@ ares_status_t ares__thread_cond_wait(ares__thread_cond_t *cond, return ARES_SUCCESS; } -ares_status_t ares__thread_cond_timedwait(ares__thread_cond_t *cond, - ares__thread_mutex_t *mut, - unsigned long timeout_ms) +ares_status_t ares_thread_cond_timedwait(ares_thread_cond_t *cond, + ares_thread_mutex_t *mut, + unsigned long timeout_ms) { if (cond == NULL || mut == NULL) { return ARES_EFORMERR; @@ -132,7 +132,7 @@ ares_status_t ares__thread_cond_timedwait(ares__thread_cond_t *cond, return ARES_SUCCESS; } -struct ares__thread { +struct ares_thread { HANDLE thread; DWORD id; @@ -142,18 +142,18 @@ struct ares__thread { }; /* Wrap for pthread compatibility */ -static DWORD WINAPI ares__thread_func(LPVOID lpParameter) +static DWORD WINAPI ares_thread_func(LPVOID lpParameter) { - ares__thread_t *thread = lpParameter; + ares_thread_t *thread = lpParameter; thread->rv = thread->func(thread->arg); return 0; } -ares_status_t ares__thread_create(ares__thread_t **thread, - ares__thread_func_t func, void *arg) +ares_status_t ares_thread_create(ares_thread_t **thread, + ares_thread_func_t func, void *arg) { - ares__thread_t *thr = NULL; + ares_thread_t *thr = NULL; if (func == NULL || thread == NULL) { return ARES_EFORMERR; @@ -166,7 +166,7 @@ ares_status_t ares__thread_create(ares__thread_t **thread, thr->func = func; thr->arg = arg; - thr->thread = CreateThread(NULL, 0, ares__thread_func, thr, 0, &thr->id); + thr->thread = CreateThread(NULL, 0, ares_thread_func, thr, 0, &thr->id); if (thr->thread == NULL) { ares_free(thr); return ARES_ESERVFAIL; @@ -176,7 +176,7 @@ ares_status_t ares__thread_create(ares__thread_t **thread, return ARES_SUCCESS; } -ares_status_t ares__thread_join(ares__thread_t *thread, void **rv) +ares_status_t ares_thread_join(ares_thread_t *thread, void **rv) { ares_status_t status = ARES_SUCCESS; @@ -211,14 +211,14 @@ ares_status_t ares__thread_join(ares__thread_t *thread, void **rv) # include # endif -struct ares__thread_mutex { +struct ares_thread_mutex { pthread_mutex_t mutex; }; -ares__thread_mutex_t *ares__thread_mutex_create(void) +ares_thread_mutex_t *ares_thread_mutex_create(void) { - pthread_mutexattr_t attr; - ares__thread_mutex_t *mut = ares_malloc_zero(sizeof(*mut)); + pthread_mutexattr_t attr; + ares_thread_mutex_t *mut = ares_malloc_zero(sizeof(*mut)); if (mut == NULL) { return NULL; } @@ -247,7 +247,7 @@ ares__thread_mutex_t *ares__thread_mutex_create(void) /* LCOV_EXCL_STOP */ } -void ares__thread_mutex_destroy(ares__thread_mutex_t *mut) +void ares_thread_mutex_destroy(ares_thread_mutex_t *mut) { if (mut == NULL) { return; @@ -256,7 +256,7 @@ void ares__thread_mutex_destroy(ares__thread_mutex_t *mut) ares_free(mut); } -void ares__thread_mutex_lock(ares__thread_mutex_t *mut) +void ares_thread_mutex_lock(ares_thread_mutex_t *mut) { if (mut == NULL) { return; @@ -264,7 +264,7 @@ void ares__thread_mutex_lock(ares__thread_mutex_t *mut) pthread_mutex_lock(&mut->mutex); } -void ares__thread_mutex_unlock(ares__thread_mutex_t *mut) +void ares_thread_mutex_unlock(ares_thread_mutex_t *mut) { if (mut == NULL) { return; @@ -272,13 +272,13 @@ void ares__thread_mutex_unlock(ares__thread_mutex_t *mut) pthread_mutex_unlock(&mut->mutex); } -struct ares__thread_cond { +struct ares_thread_cond { pthread_cond_t cond; }; -ares__thread_cond_t *ares__thread_cond_create(void) +ares_thread_cond_t *ares_thread_cond_create(void) { - ares__thread_cond_t *cond = ares_malloc_zero(sizeof(*cond)); + ares_thread_cond_t *cond = ares_malloc_zero(sizeof(*cond)); if (cond == NULL) { return NULL; } @@ -286,7 +286,7 @@ ares__thread_cond_t *ares__thread_cond_create(void) return cond; } -void ares__thread_cond_destroy(ares__thread_cond_t *cond) +void ares_thread_cond_destroy(ares_thread_cond_t *cond) { if (cond == NULL) { return; @@ -295,7 +295,7 @@ void ares__thread_cond_destroy(ares__thread_cond_t *cond) ares_free(cond); } -void ares__thread_cond_signal(ares__thread_cond_t *cond) +void ares_thread_cond_signal(ares_thread_cond_t *cond) { if (cond == NULL) { return; @@ -303,7 +303,7 @@ void ares__thread_cond_signal(ares__thread_cond_t *cond) pthread_cond_signal(&cond->cond); } -void ares__thread_cond_broadcast(ares__thread_cond_t *cond) +void ares_thread_cond_broadcast(ares_thread_cond_t *cond) { if (cond == NULL) { return; @@ -311,8 +311,8 @@ void ares__thread_cond_broadcast(ares__thread_cond_t *cond) pthread_cond_broadcast(&cond->cond); } -ares_status_t ares__thread_cond_wait(ares__thread_cond_t *cond, - ares__thread_mutex_t *mut) +ares_status_t ares_thread_cond_wait(ares_thread_cond_t *cond, + ares_thread_mutex_t *mut) { if (cond == NULL || mut == NULL) { return ARES_EFORMERR; @@ -322,7 +322,7 @@ ares_status_t ares__thread_cond_wait(ares__thread_cond_t *cond, return ARES_SUCCESS; } -static void ares__timespec_timeout(struct timespec *ts, unsigned long add_ms) +static void ares_timespec_timeout(struct timespec *ts, unsigned long add_ms) { # if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_REALTIME) clock_gettime(CLOCK_REALTIME, ts); @@ -345,9 +345,9 @@ static void ares__timespec_timeout(struct timespec *ts, unsigned long add_ms) } } -ares_status_t ares__thread_cond_timedwait(ares__thread_cond_t *cond, - ares__thread_mutex_t *mut, - unsigned long timeout_ms) +ares_status_t ares_thread_cond_timedwait(ares_thread_cond_t *cond, + ares_thread_mutex_t *mut, + unsigned long timeout_ms) { struct timespec ts; @@ -355,7 +355,7 @@ ares_status_t ares__thread_cond_timedwait(ares__thread_cond_t *cond, return ARES_EFORMERR; } - ares__timespec_timeout(&ts, timeout_ms); + ares_timespec_timeout(&ts, timeout_ms); if (pthread_cond_timedwait(&cond->cond, &mut->mutex, &ts) != 0) { return ARES_ETIMEOUT; @@ -364,14 +364,14 @@ ares_status_t ares__thread_cond_timedwait(ares__thread_cond_t *cond, return ARES_SUCCESS; } -struct ares__thread { +struct ares_thread { pthread_t thread; }; -ares_status_t ares__thread_create(ares__thread_t **thread, - ares__thread_func_t func, void *arg) +ares_status_t ares_thread_create(ares_thread_t **thread, + ares_thread_func_t func, void *arg) { - ares__thread_t *thr = NULL; + ares_thread_t *thr = NULL; if (func == NULL || thread == NULL) { return ARES_EFORMERR; @@ -390,7 +390,7 @@ ares_status_t ares__thread_create(ares__thread_t **thread, return ARES_SUCCESS; } -ares_status_t ares__thread_join(ares__thread_t *thread, void **rv) +ares_status_t ares_thread_join(ares_thread_t *thread, void **rv) { void *ret = NULL; ares_status_t status = ARES_SUCCESS; @@ -420,57 +420,57 @@ ares_bool_t ares_threadsafety(void) #else /* !CARES_THREADS */ /* NoOp */ -ares__thread_mutex_t *ares__thread_mutex_create(void) +ares_thread_mutex_t *ares_thread_mutex_create(void) { return NULL; } -void ares__thread_mutex_destroy(ares__thread_mutex_t *mut) +void ares_thread_mutex_destroy(ares_thread_mutex_t *mut) { (void)mut; } -void ares__thread_mutex_lock(ares__thread_mutex_t *mut) +void ares_thread_mutex_lock(ares_thread_mutex_t *mut) { (void)mut; } -void ares__thread_mutex_unlock(ares__thread_mutex_t *mut) +void ares_thread_mutex_unlock(ares_thread_mutex_t *mut) { (void)mut; } -ares__thread_cond_t *ares__thread_cond_create(void) +ares_thread_cond_t *ares_thread_cond_create(void) { return NULL; } -void ares__thread_cond_destroy(ares__thread_cond_t *cond) +void ares_thread_cond_destroy(ares_thread_cond_t *cond) { (void)cond; } -void ares__thread_cond_signal(ares__thread_cond_t *cond) +void ares_thread_cond_signal(ares_thread_cond_t *cond) { (void)cond; } -void ares__thread_cond_broadcast(ares__thread_cond_t *cond) +void ares_thread_cond_broadcast(ares_thread_cond_t *cond) { (void)cond; } -ares_status_t ares__thread_cond_wait(ares__thread_cond_t *cond, - ares__thread_mutex_t *mut) +ares_status_t ares_thread_cond_wait(ares_thread_cond_t *cond, + ares_thread_mutex_t *mut) { (void)cond; (void)mut; return ARES_ENOTIMP; } -ares_status_t ares__thread_cond_timedwait(ares__thread_cond_t *cond, - ares__thread_mutex_t *mut, - unsigned long timeout_ms) +ares_status_t ares_thread_cond_timedwait(ares_thread_cond_t *cond, + ares_thread_mutex_t *mut, + unsigned long timeout_ms) { (void)cond; (void)mut; @@ -478,8 +478,8 @@ ares_status_t ares__thread_cond_timedwait(ares__thread_cond_t *cond, return ARES_ENOTIMP; } -ares_status_t ares__thread_create(ares__thread_t **thread, - ares__thread_func_t func, void *arg) +ares_status_t ares_thread_create(ares_thread_t **thread, + ares_thread_func_t func, void *arg) { (void)thread; (void)func; @@ -487,7 +487,7 @@ ares_status_t ares__thread_create(ares__thread_t **thread, return ARES_ENOTIMP; } -ares_status_t ares__thread_join(ares__thread_t *thread, void **rv) +ares_status_t ares_thread_join(ares_thread_t *thread, void **rv) { (void)thread; (void)rv; @@ -501,7 +501,7 @@ ares_bool_t ares_threadsafety(void) #endif -ares_status_t ares__channel_threading_init(ares_channel_t *channel) +ares_status_t ares_channel_threading_init(ares_channel_t *channel) { ares_status_t status = ARES_SUCCESS; @@ -510,13 +510,13 @@ ares_status_t ares__channel_threading_init(ares_channel_t *channel) return ARES_SUCCESS; } - channel->lock = ares__thread_mutex_create(); + channel->lock = ares_thread_mutex_create(); if (channel->lock == NULL) { status = ARES_ENOMEM; goto done; } - channel->cond_empty = ares__thread_cond_create(); + channel->cond_empty = ares_thread_cond_create(); if (channel->cond_empty == NULL) { status = ARES_ENOMEM; goto done; @@ -524,27 +524,27 @@ ares_status_t ares__channel_threading_init(ares_channel_t *channel) done: if (status != ARES_SUCCESS) { - ares__channel_threading_destroy(channel); + ares_channel_threading_destroy(channel); } return status; } -void ares__channel_threading_destroy(ares_channel_t *channel) +void ares_channel_threading_destroy(ares_channel_t *channel) { - ares__thread_mutex_destroy(channel->lock); + ares_thread_mutex_destroy(channel->lock); channel->lock = NULL; - ares__thread_cond_destroy(channel->cond_empty); + ares_thread_cond_destroy(channel->cond_empty); channel->cond_empty = NULL; } -void ares__channel_lock(const ares_channel_t *channel) +void ares_channel_lock(const ares_channel_t *channel) { - ares__thread_mutex_lock(channel->lock); + ares_thread_mutex_lock(channel->lock); } -void ares__channel_unlock(const ares_channel_t *channel) +void ares_channel_unlock(const ares_channel_t *channel) { - ares__thread_mutex_unlock(channel->lock); + ares_thread_mutex_unlock(channel->lock); } /* Must not be holding a channel lock already, public function only */ @@ -562,29 +562,29 @@ ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms) } if (timeout_ms >= 0) { - ares__tvnow(&tout); + ares_tvnow(&tout); tout.sec += (ares_int64_t)(timeout_ms / 1000); tout.usec += (unsigned int)(timeout_ms % 1000) * 1000; } - ares__thread_mutex_lock(channel->lock); - while (ares__llist_len(channel->all_queries)) { + ares_thread_mutex_lock(channel->lock); + while (ares_llist_len(channel->all_queries)) { if (timeout_ms < 0) { - ares__thread_cond_wait(channel->cond_empty, channel->lock); + ares_thread_cond_wait(channel->cond_empty, channel->lock); } else { ares_timeval_t tv_remaining; ares_timeval_t tv_now; unsigned long tms; - ares__tvnow(&tv_now); - ares__timeval_remaining(&tv_remaining, &tv_now, &tout); + ares_tvnow(&tv_now); + ares_timeval_remaining(&tv_remaining, &tv_now, &tout); tms = (unsigned long)((tv_remaining.sec * 1000) + (tv_remaining.usec / 1000)); if (tms == 0) { status = ARES_ETIMEOUT; } else { status = - ares__thread_cond_timedwait(channel->cond_empty, channel->lock, tms); + ares_thread_cond_timedwait(channel->cond_empty, channel->lock, tms); } /* If there was a timeout, don't loop. Otherwise, make sure this wasn't @@ -594,7 +594,7 @@ ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms) } } } - ares__thread_mutex_unlock(channel->lock); + ares_thread_mutex_unlock(channel->lock); return status; } @@ -605,10 +605,10 @@ void ares_queue_notify_empty(ares_channel_t *channel) } /* We are guaranteed to be holding a channel lock already */ - if (ares__llist_len(channel->all_queries)) { + if (ares_llist_len(channel->all_queries)) { return; } /* Notify all waiters of the conditional */ - ares__thread_cond_broadcast(channel->cond_empty); + ares_thread_cond_broadcast(channel->cond_empty); } diff --git a/lib/c-ares-1.34.4/src/lib/util/ares_threads.h b/lib/c-ares-1.34.4/src/lib/util/ares_threads.h new file mode 100644 index 00000000000..95c543e6e99 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/util/ares_threads.h @@ -0,0 +1,60 @@ +/* MIT License + * + * Copyright (c) 2023 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__THREADS_H +#define __ARES__THREADS_H + +struct ares_thread_mutex; +typedef struct ares_thread_mutex ares_thread_mutex_t; + +ares_thread_mutex_t *ares_thread_mutex_create(void); +void ares_thread_mutex_destroy(ares_thread_mutex_t *mut); +void ares_thread_mutex_lock(ares_thread_mutex_t *mut); +void ares_thread_mutex_unlock(ares_thread_mutex_t *mut); + + +struct ares_thread_cond; +typedef struct ares_thread_cond ares_thread_cond_t; + +ares_thread_cond_t *ares_thread_cond_create(void); +void ares_thread_cond_destroy(ares_thread_cond_t *cond); +void ares_thread_cond_signal(ares_thread_cond_t *cond); +void ares_thread_cond_broadcast(ares_thread_cond_t *cond); +ares_status_t ares_thread_cond_wait(ares_thread_cond_t *cond, + ares_thread_mutex_t *mut); +ares_status_t ares_thread_cond_timedwait(ares_thread_cond_t *cond, + ares_thread_mutex_t *mut, + unsigned long timeout_ms); + + +struct ares_thread; +typedef struct ares_thread ares_thread_t; + +typedef void *(*ares_thread_func_t)(void *arg); +ares_status_t ares_thread_create(ares_thread_t **thread, + ares_thread_func_t func, void *arg); +ares_status_t ares_thread_join(ares_thread_t *thread, void **rv); + +#endif diff --git a/lib/c-ares-1.34.4/src/lib/util/ares_time.h b/lib/c-ares-1.34.4/src/lib/util/ares_time.h new file mode 100644 index 00000000000..c6eaf973663 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/util/ares_time.h @@ -0,0 +1,48 @@ +/* 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_TIME_H +#define __ARES_TIME_H + +/*! 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; + +/* 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); + +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); + +#endif diff --git a/lib/c-ares-1.33.1/src/lib/util/ares__timeval.c b/lib/c-ares-1.34.4/src/lib/util/ares_timeval.c similarity index 96% rename from lib/c-ares-1.33.1/src/lib/util/ares__timeval.c rename to lib/c-ares-1.34.4/src/lib/util/ares_timeval.c index e3a989dca87..0b0845b6fb7 100644 --- a/lib/c-ares-1.33.1/src/lib/util/ares__timeval.c +++ b/lib/c-ares-1.34.4/src/lib/util/ares_timeval.c @@ -28,7 +28,7 @@ #if defined(_WIN32) && !defined(MSDOS) -void ares__tvnow(ares_timeval_t *now) +void ares_tvnow(ares_timeval_t *now) { /* QueryPerformanceCounters() has been around since Windows 2000, though * significant fixes were made in later versions. Documentation states @@ -52,7 +52,7 @@ void ares__tvnow(ares_timeval_t *now) #elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) -void ares__tvnow(ares_timeval_t *now) +void ares_tvnow(ares_timeval_t *now) { /* clock_gettime() is guaranteed to be increased monotonically when the * monotonic clock is queried. Time starting point is unspecified, it @@ -76,7 +76,7 @@ void ares__tvnow(ares_timeval_t *now) #elif defined(HAVE_GETTIMEOFDAY) -void ares__tvnow(ares_timeval_t *now) +void ares_tvnow(ares_timeval_t *now) { /* gettimeofday() is not granted to be increased monotonically, due to * clock drifting and external source time synchronization it can jump diff --git a/lib/c-ares-1.34.4/src/lib/util/ares_uri.c b/lib/c-ares-1.34.4/src/lib/util/ares_uri.c new file mode 100644 index 00000000000..d656f8347f5 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/util/ares_uri.c @@ -0,0 +1,1626 @@ +/* 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_uri.h" +#ifdef HAVE_STDINT_H +# include +#endif + +struct ares_uri { + char scheme[16]; + char *username; + char *password; + unsigned short port; + char host[256]; + char *path; + ares_htable_dict_t *query; + char *fragment; +}; + +/* RFC3986 character set notes: + * gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" + * reserved = gen-delims / sub-delims + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) + * authority = [ userinfo "@" ] host [ ":" port ] + * userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) + * NOTE: Use of the format "user:password" in the userinfo field is + * deprecated. Applications should not render as clear text any data + * after the first colon (":") character found within a userinfo + * subcomponent unless the data after the colon is the empty string + * (indicating no password). + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * query = *( pchar / "/" / "?" ) + * fragment = *( pchar / "/" / "?" ) + * + * NOTE: Due to ambiguity, "+" in a query must be percent-encoded, as old + * URLs used that for spaces. + */ + + +static ares_bool_t ares_uri_chis_subdelim(char x) +{ + switch (x) { + case '!': + return ARES_TRUE; + case '$': + return ARES_TRUE; + case '&': + return ARES_TRUE; + case '\'': + return ARES_TRUE; + case '(': + return ARES_TRUE; + case ')': + return ARES_TRUE; + case '*': + return ARES_TRUE; + case '+': + return ARES_TRUE; + case ',': + return ARES_TRUE; + case ';': + return ARES_TRUE; + case '=': + return ARES_TRUE; + default: + break; + } + return ARES_FALSE; +} + +/* These don't actually appear to be referenced in any logic */ +#if 0 +static ares_bool_t ares_uri_chis_gendelim(char x) +{ + switch (x) { + case ':': + return ARES_TRUE; + case '/': + return ARES_TRUE; + case '?': + return ARES_TRUE; + case '#': + return ARES_TRUE; + case '[': + return ARES_TRUE; + case ']': + return ARES_TRUE; + case '@': + return ARES_TRUE; + default: + break; + } + return ARES_FALSE; +} + + +static ares_bool_t ares_uri_chis_reserved(char x) +{ + return ares_uri_chis_gendelim(x) || ares_uri_chis_subdelim(x); +} +#endif + +static ares_bool_t ares_uri_chis_unreserved(char x) +{ + switch (x) { + case '-': + return ARES_TRUE; + case '.': + return ARES_TRUE; + case '_': + return ARES_TRUE; + case '~': + return ARES_TRUE; + default: + break; + } + return ares_isalpha(x) || ares_isdigit(x); +} + +static ares_bool_t ares_uri_chis_scheme(char x) +{ + switch (x) { + case '+': + return ARES_TRUE; + case '-': + return ARES_TRUE; + case '.': + return ARES_TRUE; + default: + break; + } + return ares_isalpha(x) || ares_isdigit(x); +} + +static ares_bool_t ares_uri_chis_authority(char x) +{ + /* This one here isn't well defined. We are going to include the valid + * characters of the subfields plus known delimiters */ + return ares_uri_chis_unreserved(x) || ares_uri_chis_subdelim(x) || x == '%' || + x == '[' || x == ']' || x == '@' || x == ':'; +} + +static ares_bool_t ares_uri_chis_userinfo(char x) +{ + /* NOTE: we don't include ':' here since we are using that as our + * username/password delimiter */ + return ares_uri_chis_unreserved(x) || ares_uri_chis_subdelim(x); +} + +static ares_bool_t ares_uri_chis_path(char x) +{ + switch (x) { + case ':': + return ARES_TRUE; + case '@': + return ARES_TRUE; + /* '/' isn't in the spec as a path character since its technically a + * delimiter but we're not splitting on '/' so we accept it as valid */ + case '/': + return ARES_TRUE; + default: + break; + } + return ares_uri_chis_unreserved(x) || ares_uri_chis_subdelim(x); +} + +static ares_bool_t ares_uri_chis_path_enc(char x) +{ + return ares_uri_chis_path(x) || x == '%'; +} + +static ares_bool_t ares_uri_chis_query(char x) +{ + switch (x) { + case '/': + return ARES_TRUE; + case '?': + return ARES_TRUE; + default: + break; + } + + /* Exclude & and = used as delimiters, they're valid characters in the + * set, just not for the individual pieces */ + return ares_uri_chis_path(x) && x != '&' && x != '='; +} + +static ares_bool_t ares_uri_chis_query_enc(char x) +{ + return ares_uri_chis_query(x) || x == '%'; +} + +static ares_bool_t ares_uri_chis_fragment(char x) +{ + switch (x) { + case '/': + return ARES_TRUE; + case '?': + return ARES_TRUE; + default: + break; + } + return ares_uri_chis_path(x); +} + +static ares_bool_t ares_uri_chis_fragment_enc(char x) +{ + return ares_uri_chis_fragment(x) || x == '%'; +} + +ares_uri_t *ares_uri_create(void) +{ + ares_uri_t *uri = ares_malloc_zero(sizeof(*uri)); + + if (uri == NULL) { + return NULL; + } + + uri->query = ares_htable_dict_create(); + if (uri->query == NULL) { + ares_free(uri); + return NULL; + } + + return uri; +} + +void ares_uri_destroy(ares_uri_t *uri) +{ + if (uri == NULL) { + return; + } + + ares_free(uri->username); + ares_free(uri->password); + ares_free(uri->path); + ares_free(uri->fragment); + ares_htable_dict_destroy(uri->query); + ares_free(uri); +} + +static ares_bool_t ares_uri_scheme_is_valid(const char *uri) +{ + size_t i; + + if (ares_strlen(uri) == 0) { + return ARES_FALSE; + } + + if (!ares_isalpha(*uri)) { + return ARES_FALSE; + } + + for (i = 0; uri[i] != 0; i++) { + if (!ares_uri_chis_scheme(uri[i])) { + return ARES_FALSE; + } + } + return ARES_TRUE; +} + +static ares_bool_t ares_uri_str_isvalid(const char *str, size_t max_len, + ares_bool_t (*ischr)(char)) +{ + size_t i; + + if (str == NULL) { + return ARES_FALSE; + } + + for (i = 0; i != max_len && str[i] != 0; i++) { + if (!ischr(str[i])) { + return ARES_FALSE; + } + } + return ARES_TRUE; +} + +ares_status_t ares_uri_set_scheme(ares_uri_t *uri, const char *scheme) +{ + if (uri == NULL) { + return ARES_EFORMERR; + } + + if (!ares_uri_scheme_is_valid(scheme)) { + return ARES_EBADSTR; + } + + ares_strcpy(uri->scheme, scheme, sizeof(uri->scheme)); + ares_str_lower(uri->scheme); + + return ARES_SUCCESS; +} + +const char *ares_uri_get_scheme(const ares_uri_t *uri) +{ + if (uri == NULL) { + return NULL; + } + + return uri->scheme; +} + +static ares_status_t ares_uri_set_username_own(ares_uri_t *uri, char *username) +{ + if (uri == NULL) { + return ARES_EFORMERR; + } + + if (username != NULL && (!ares_str_isprint(username, ares_strlen(username)) || + ares_strlen(username) == 0)) { + return ARES_EBADSTR; + } + + + ares_free(uri->username); + uri->username = username; + return ARES_SUCCESS; +} + +ares_status_t ares_uri_set_username(ares_uri_t *uri, const char *username) +{ + ares_status_t status; + char *temp = NULL; + + if (uri == NULL) { + return ARES_EFORMERR; + } + + if (username != NULL) { + temp = ares_strdup(username); + if (temp == NULL) { + return ARES_ENOMEM; + } + } + + status = ares_uri_set_username_own(uri, temp); + if (status != ARES_SUCCESS) { + ares_free(temp); + } + + return status; +} + +const char *ares_uri_get_username(const ares_uri_t *uri) +{ + if (uri == NULL) { + return NULL; + } + + return uri->username; +} + +static ares_status_t ares_uri_set_password_own(ares_uri_t *uri, char *password) +{ + if (uri == NULL) { + return ARES_EFORMERR; + } + + if (password != NULL && !ares_str_isprint(password, ares_strlen(password))) { + return ARES_EBADSTR; + } + + ares_free(uri->password); + uri->password = password; + return ARES_SUCCESS; +} + +ares_status_t ares_uri_set_password(ares_uri_t *uri, const char *password) +{ + ares_status_t status; + char *temp = NULL; + + if (uri == NULL) { + return ARES_EFORMERR; + } + + if (password != NULL) { + temp = ares_strdup(password); + if (temp == NULL) { + return ARES_ENOMEM; + } + } + + status = ares_uri_set_password_own(uri, temp); + if (status != ARES_SUCCESS) { + ares_free(temp); + } + + return status; +} + +const char *ares_uri_get_password(const ares_uri_t *uri) +{ + if (uri == NULL) { + return NULL; + } + + return uri->password; +} + +ares_status_t ares_uri_set_host(ares_uri_t *uri, const char *host) +{ + struct ares_addr addr; + size_t addrlen; + char hoststr[256]; + char *ll_scope; + + if (uri == NULL || ares_strlen(host) == 0 || + ares_strlen(host) >= sizeof(hoststr)) { + return ARES_EFORMERR; + } + + ares_strcpy(hoststr, host, sizeof(hoststr)); + + /* Look for '%' which could be a link-local scope for ipv6 addresses and + * parse it off */ + ll_scope = strchr(hoststr, '%'); + if (ll_scope != NULL) { + *ll_scope = 0; + ll_scope++; + if (!ares_str_isalnum(ll_scope)) { + return ARES_EBADNAME; + } + } + + /* If its an IP address, normalize it */ + memset(&addr, 0, sizeof(addr)); + addr.family = AF_UNSPEC; + if (ares_dns_pton(hoststr, &addr, &addrlen) != NULL) { + char ipaddr[INET6_ADDRSTRLEN]; + ares_inet_ntop(addr.family, &addr.addr, ipaddr, sizeof(ipaddr)); + /* Only IPv6 is allowed to have a scope */ + if (ll_scope != NULL && addr.family != AF_INET6) { + return ARES_EBADNAME; + } + + if (ll_scope != NULL) { + snprintf(uri->host, sizeof(uri->host), "%s%%%s", ipaddr, ll_scope); + } else { + ares_strcpy(uri->host, ipaddr, sizeof(uri->host)); + } + return ARES_SUCCESS; + } + + /* If its a hostname, make sure its a valid charset */ + if (!ares_is_hostname(host)) { + return ARES_EBADNAME; + } + + ares_strcpy(uri->host, host, sizeof(uri->host)); + return ARES_SUCCESS; +} + +const char *ares_uri_get_host(const ares_uri_t *uri) +{ + if (uri == NULL) { + return NULL; + } + + return uri->host; +} + +ares_status_t ares_uri_set_port(ares_uri_t *uri, unsigned short port) +{ + if (uri == NULL) { + return ARES_EFORMERR; + } + uri->port = port; + return ARES_SUCCESS; +} + +unsigned short ares_uri_get_port(const ares_uri_t *uri) +{ + if (uri == NULL) { + return 0; + } + return uri->port; +} + +/* URI spec says path normalization is a requirement */ +static char *ares_uri_path_normalize(const char *path) +{ + ares_status_t status; + ares_array_t *arr = NULL; + ares_buf_t *outpath = NULL; + ares_buf_t *inpath = NULL; + ares_ssize_t i; + size_t j; + size_t len; + + inpath = + ares_buf_create_const((const unsigned char *)path, ares_strlen(path)); + if (inpath == NULL) { + status = ARES_ENOMEM; + goto done; + } + + outpath = ares_buf_create(); + if (outpath == NULL) { + status = ARES_ENOMEM; + goto done; + } + + status = ares_buf_split_str_array(inpath, (const unsigned char *)"/", 1, + ARES_BUF_SPLIT_TRIM, 0, &arr); + if (status != ARES_SUCCESS) { + return NULL; + } + + for (i = 0; i < (ares_ssize_t)ares_array_len(arr); i++) { + const char **strptr = ares_array_at(arr, (size_t)i); + const char *str = *strptr; + + if (ares_streq(str, ".")) { + ares_array_remove_at(arr, (size_t)i); + i--; + } else if (ares_streq(str, "..")) { + if (i != 0) { + ares_array_remove_at(arr, (size_t)i - 1); + i--; + } + ares_array_remove_at(arr, (size_t)i); + i--; + } + } + + status = ares_buf_append_byte(outpath, '/'); + if (status != ARES_SUCCESS) { + goto done; + } + + len = ares_array_len(arr); + for (j = 0; j < len; j++) { + const char **strptr = ares_array_at(arr, j); + const char *str = *strptr; + status = ares_buf_append_str(outpath, str); + if (status != ARES_SUCCESS) { + goto done; + } + + /* Path separator, but on the last entry, we need to check if it was + * originally terminated or not because they have different meanings */ + if (j != len - 1 || path[ares_strlen(path) - 1] == '/') { + status = ares_buf_append_byte(outpath, '/'); + if (status != ARES_SUCCESS) { + goto done; + } + } + } + +done: + ares_array_destroy(arr); + ares_buf_destroy(inpath); + if (status != ARES_SUCCESS) { + ares_buf_destroy(outpath); + return NULL; + } + + return ares_buf_finish_str(outpath, NULL); +} + +ares_status_t ares_uri_set_path(ares_uri_t *uri, const char *path) +{ + char *temp = NULL; + + if (uri == NULL) { + return ARES_EFORMERR; + } + + if (path != NULL && !ares_str_isprint(path, ares_strlen(path))) { + return ARES_EBADSTR; + } + + if (path != NULL) { + temp = ares_uri_path_normalize(path); + if (temp == NULL) { + return ARES_ENOMEM; + } + } + + ares_free(uri->path); + uri->path = temp; + + return ARES_SUCCESS; +} + +const char *ares_uri_get_path(const ares_uri_t *uri) +{ + if (uri == NULL) { + return NULL; + } + + return uri->path; +} + +ares_status_t ares_uri_set_query_key(ares_uri_t *uri, const char *key, + const char *val) +{ + if (uri == NULL || key == NULL || *key == 0) { + return ARES_EFORMERR; + } + + if (!ares_str_isprint(key, ares_strlen(key)) || + (val != NULL && !ares_str_isprint(val, ares_strlen(val)))) { + return ARES_EBADSTR; + } + + if (!ares_htable_dict_insert(uri->query, key, val)) { + return ARES_ENOMEM; + } + return ARES_SUCCESS; +} + +ares_status_t ares_uri_del_query_key(ares_uri_t *uri, const char *key) +{ + if (uri == NULL || key == NULL || *key == 0 || + !ares_str_isprint(key, ares_strlen(key))) { + return ARES_EFORMERR; + } + + if (!ares_htable_dict_remove(uri->query, key)) { + return ARES_ENOTFOUND; + } + + return ARES_SUCCESS; +} + +const char *ares_uri_get_query_key(const ares_uri_t *uri, const char *key) +{ + if (uri == NULL || key == NULL || *key == 0 || + !ares_str_isprint(key, ares_strlen(key))) { + return NULL; + } + + return ares_htable_dict_get_direct(uri->query, key); +} + +char **ares_uri_get_query_keys(const ares_uri_t *uri, size_t *num) +{ + if (uri == NULL || num == NULL) { + return NULL; + } + + return ares_htable_dict_keys(uri->query, num); +} + +static ares_status_t ares_uri_set_fragment_own(ares_uri_t *uri, char *fragment) +{ + if (uri == NULL) { + return ARES_EFORMERR; + } + + if (fragment != NULL && !ares_str_isprint(fragment, ares_strlen(fragment))) { + return ARES_EBADSTR; + } + + ares_free(uri->fragment); + uri->fragment = fragment; + return ARES_SUCCESS; +} + +ares_status_t ares_uri_set_fragment(ares_uri_t *uri, const char *fragment) +{ + ares_status_t status; + char *temp = NULL; + + if (uri == NULL) { + return ARES_EFORMERR; + } + + if (fragment != NULL) { + temp = ares_strdup(fragment); + if (temp == NULL) { + return ARES_ENOMEM; + } + } + + status = ares_uri_set_fragment_own(uri, temp); + if (status != ARES_SUCCESS) { + ares_free(temp); + } + + return status; +} + +const char *ares_uri_get_fragment(const ares_uri_t *uri) +{ + if (uri == NULL) { + return NULL; + } + return uri->fragment; +} + +static ares_status_t ares_uri_encode_buf(ares_buf_t *buf, const char *str, + ares_bool_t (*ischr)(char)) +{ + size_t i; + + if (buf == NULL || str == NULL) { + return ARES_EFORMERR; + } + + for (i = 0; str[i] != 0; i++) { + if (ischr(str[i])) { + if (ares_buf_append_byte(buf, (unsigned char)str[i]) != ARES_SUCCESS) { + return ARES_ENOMEM; + } + } else { + if (ares_buf_append_byte(buf, '%') != ARES_SUCCESS) { + return ARES_ENOMEM; + } + if (ares_buf_append_num_hex(buf, (size_t)str[i], 2) != ARES_SUCCESS) { + return ARES_ENOMEM; + } + } + } + return ARES_SUCCESS; +} + +static ares_status_t ares_uri_write_scheme(const ares_uri_t *uri, + ares_buf_t *buf) +{ + ares_status_t status; + + status = ares_buf_append_str(buf, uri->scheme); + if (status != ARES_SUCCESS) { + return status; + } + + status = ares_buf_append_str(buf, "://"); + + return status; +} + +static ares_status_t ares_uri_write_authority(const ares_uri_t *uri, + ares_buf_t *buf) +{ + ares_status_t status; + ares_bool_t is_ipv6 = ARES_FALSE; + + if (ares_strlen(uri->username)) { + status = ares_uri_encode_buf(buf, uri->username, ares_uri_chis_userinfo); + if (status != ARES_SUCCESS) { + return status; + } + } + + if (ares_strlen(uri->password)) { + status = ares_buf_append_byte(buf, ':'); + if (status != ARES_SUCCESS) { + return status; + } + + status = ares_uri_encode_buf(buf, uri->password, ares_uri_chis_userinfo); + if (status != ARES_SUCCESS) { + return status; + } + } + + if (ares_strlen(uri->username) || ares_strlen(uri->password)) { + status = ares_buf_append_byte(buf, '@'); + if (status != ARES_SUCCESS) { + return status; + } + } + + /* We need to write ipv6 addresses with [ ] */ + if (strchr(uri->host, '%') != NULL) { + /* If we have a % in the name, it must be ipv6 link local scope, so we + * don't need to check anything else */ + is_ipv6 = ARES_TRUE; + } else { + /* Parse the host to see if it is an ipv6 address */ + struct ares_addr addr; + size_t addrlen; + memset(&addr, 0, sizeof(addr)); + addr.family = AF_INET6; + if (ares_dns_pton(uri->host, &addr, &addrlen) != NULL) { + is_ipv6 = ARES_TRUE; + } + } + + if (is_ipv6) { + status = ares_buf_append_byte(buf, '['); + if (status != ARES_SUCCESS) { + return status; + } + } + + status = ares_buf_append_str(buf, uri->host); + if (status != ARES_SUCCESS) { + return status; + } + + if (is_ipv6) { + status = ares_buf_append_byte(buf, ']'); + if (status != ARES_SUCCESS) { + return status; + } + } + + if (uri->port > 0) { + status = ares_buf_append_byte(buf, ':'); + if (status != ARES_SUCCESS) { + return status; + } + status = ares_buf_append_num_dec(buf, uri->port, 0); + if (status != ARES_SUCCESS) { + return status; + } + } + + return status; +} + +static ares_status_t ares_uri_write_path(const ares_uri_t *uri, ares_buf_t *buf) +{ + ares_status_t status; + + if (ares_strlen(uri->path) == 0) { + return ARES_SUCCESS; + } + + if (*uri->path != '/') { + status = ares_buf_append_byte(buf, '/'); + if (status != ARES_SUCCESS) { + return status; + } + } + + status = ares_uri_encode_buf(buf, uri->path, ares_uri_chis_path); + if (status != ARES_SUCCESS) { + return status; + } + + return ARES_SUCCESS; +} + +static ares_status_t ares_uri_write_query(const ares_uri_t *uri, + ares_buf_t *buf) +{ + ares_status_t status; + char **keys; + size_t num_keys = 0; + size_t i; + + if (ares_htable_dict_num_keys(uri->query) == 0) { + return ARES_SUCCESS; + } + + keys = ares_uri_get_query_keys(uri, &num_keys); + if (keys == NULL || num_keys == 0) { + return ARES_ENOMEM; + } + + status = ares_buf_append_byte(buf, '?'); + if (status != ARES_SUCCESS) { + goto done; + } + + for (i = 0; i < num_keys; i++) { + const char *val; + + if (i != 0) { + status = ares_buf_append_byte(buf, '&'); + if (status != ARES_SUCCESS) { + goto done; + } + } + + status = ares_uri_encode_buf(buf, keys[i], ares_uri_chis_query); + if (status != ARES_SUCCESS) { + goto done; + } + + val = ares_uri_get_query_key(uri, keys[i]); + if (val != NULL) { + status = ares_buf_append_byte(buf, '='); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_encode_buf(buf, val, ares_uri_chis_query); + if (status != ARES_SUCCESS) { + goto done; + } + } + } + +done: + ares_free_array(keys, num_keys, ares_free); + return status; +} + +static ares_status_t ares_uri_write_fragment(const ares_uri_t *uri, + ares_buf_t *buf) +{ + ares_status_t status; + + if (!ares_strlen(uri->fragment)) { + return ARES_SUCCESS; + } + + status = ares_buf_append_byte(buf, '#'); + if (status != ARES_SUCCESS) { + return status; + } + + status = ares_uri_encode_buf(buf, uri->fragment, ares_uri_chis_fragment); + if (status != ARES_SUCCESS) { + return status; + } + + return ARES_SUCCESS; +} + +ares_status_t ares_uri_write_buf(const ares_uri_t *uri, ares_buf_t *buf) +{ + ares_status_t status; + size_t orig_len; + + if (uri == NULL || buf == NULL) { + return ARES_EFORMERR; + } + + if (ares_strlen(uri->scheme) == 0 || ares_strlen(uri->host) == 0) { + return ARES_ENODATA; + } + + orig_len = ares_buf_len(buf); + + status = ares_uri_write_scheme(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_write_authority(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_write_path(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_write_query(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_write_fragment(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + +done: + if (status != ARES_SUCCESS) { + ares_buf_set_length(buf, orig_len); + } + return status; +} + +ares_status_t ares_uri_write(char **out, const ares_uri_t *uri) +{ + ares_buf_t *buf; + ares_status_t status; + + if (out == NULL || uri == NULL) { + return ARES_EFORMERR; + } + + *out = NULL; + + buf = ares_buf_create(); + if (buf == NULL) { + return ARES_ENOMEM; + } + + status = ares_uri_write_buf(uri, buf); + if (status != ARES_SUCCESS) { + ares_buf_destroy(buf); + return status; + } + + *out = ares_buf_finish_str(buf, NULL); + return ARES_SUCCESS; +} + +#define xdigit_val(x) \ + ((x >= '0' && x <= '9') \ + ? (x - '0') \ + : ((x >= 'A' && x <= 'F') ? (x - 'A' + 10) : (x - 'a' + 10))) + +static ares_status_t ares_uri_decode_inplace(char *str, ares_bool_t is_query, + ares_bool_t must_be_printable, + size_t *out_len) +{ + size_t i; + size_t len = 0; + + for (i = 0; str[i] != 0; i++) { + if (is_query && str[i] == '+') { + str[len++] = ' '; + continue; + } + + if (str[i] != '%') { + str[len++] = str[i]; + continue; + } + + if (!ares_isxdigit(str[i + 1]) || !ares_isxdigit(str[i + 2])) { + return ARES_EBADSTR; + } + + str[len] = (char)(xdigit_val(str[i + 1]) << 4 | xdigit_val(str[i + 2])); + + if (must_be_printable && !ares_isprint(str[len])) { + return ARES_EBADSTR; + } + + len++; + + i += 2; + } + + str[len] = 0; + + *out_len = len; + return ARES_SUCCESS; +} + +static ares_status_t ares_uri_parse_scheme(ares_uri_t *uri, ares_buf_t *buf) +{ + ares_status_t status; + size_t bytes; + char scheme[sizeof(uri->scheme)]; + + ares_buf_tag(buf); + + bytes = + ares_buf_consume_until_seq(buf, (const unsigned char *)"://", 3, ARES_TRUE); + if (bytes == SIZE_MAX || bytes > sizeof(uri->scheme)) { + return ARES_EBADSTR; + } + + status = ares_buf_tag_fetch_string(buf, scheme, sizeof(scheme)); + if (status != ARES_SUCCESS) { + return status; + } + + status = ares_uri_set_scheme(uri, scheme); + if (status != ARES_SUCCESS) { + return status; + } + + /* Consume :// */ + ares_buf_consume(buf, 3); + + return ARES_SUCCESS; +} + +static ares_status_t ares_uri_parse_userinfo(ares_uri_t *uri, ares_buf_t *buf) +{ + size_t userinfo_len; + size_t username_len; + ares_bool_t has_password = ARES_FALSE; + char *temp = NULL; + ares_status_t status; + size_t len; + + ares_buf_tag(buf); + + /* Search for @, if its not found, return */ + userinfo_len = ares_buf_consume_until_charset(buf, (const unsigned char *)"@", + 1, ARES_TRUE); + + if (userinfo_len == SIZE_MAX) { + return ARES_SUCCESS; + } + + /* Rollback since now we know there really is userinfo */ + ares_buf_tag_rollback(buf); + + /* Search for ':', if it isn't found or its past the '@' then we only have + * a username and no password */ + ares_buf_tag(buf); + username_len = ares_buf_consume_until_charset(buf, (const unsigned char *)":", + 1, ARES_TRUE); + if (username_len < userinfo_len) { + has_password = ARES_TRUE; + status = ares_buf_tag_fetch_strdup(buf, &temp); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_decode_inplace(temp, ARES_FALSE, ARES_TRUE, &len); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_set_username_own(uri, temp); + if (status != ARES_SUCCESS) { + goto done; + } + temp = NULL; + + /* Consume : */ + ares_buf_consume(buf, 1); + } + + ares_buf_tag(buf); + ares_buf_consume_until_charset(buf, (const unsigned char *)"@", 1, ARES_TRUE); + status = ares_buf_tag_fetch_strdup(buf, &temp); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_decode_inplace(temp, ARES_FALSE, ARES_TRUE, &len); + if (status != ARES_SUCCESS) { + goto done; + } + + if (has_password) { + status = ares_uri_set_password_own(uri, temp); + } else { + status = ares_uri_set_username_own(uri, temp); + } + if (status != ARES_SUCCESS) { + goto done; + } + temp = NULL; + + /* Consume @ */ + ares_buf_consume(buf, 1); + +done: + ares_free(temp); + return status; +} + +static ares_status_t ares_uri_parse_hostport(ares_uri_t *uri, ares_buf_t *buf) +{ + unsigned char b; + char host[256]; + char port[6]; + size_t len; + ares_status_t status; + + status = ares_buf_peek_byte(buf, &b); + if (status != ARES_SUCCESS) { + return status; + } + + /* Bracketed syntax for ipv6 addresses */ + if (b == '[') { + ares_buf_consume(buf, 1); + ares_buf_tag(buf); + len = ares_buf_consume_until_charset(buf, (const unsigned char *)"]", 1, + ARES_TRUE); + if (len == SIZE_MAX) { + return ARES_EBADSTR; + } + + status = ares_buf_tag_fetch_string(buf, host, sizeof(host)); + if (status != ARES_SUCCESS) { + return status; + } + /* Consume ']' */ + ares_buf_consume(buf, 1); + } else { + /* Either ipv4 or hostname */ + ares_buf_tag(buf); + ares_buf_consume_until_charset(buf, (const unsigned char *)":", 1, + ARES_FALSE); + + status = ares_buf_tag_fetch_string(buf, host, sizeof(host)); + if (status != ARES_SUCCESS) { + return status; + } + } + + status = ares_uri_set_host(uri, host); + if (status != ARES_SUCCESS) { + return status; + } + + /* No port if nothing left to consume */ + if (!ares_buf_len(buf)) { + return status; + } + + status = ares_buf_peek_byte(buf, &b); + if (status != ARES_SUCCESS) { + return status; + } + + /* Only valid extra character at this point is ':' */ + if (b != ':') { + return ARES_EBADSTR; + } + ares_buf_consume(buf, 1); + + len = ares_buf_len(buf); + if (len == 0 || len > sizeof(port) - 1) { + return ARES_EBADSTR; + } + + status = ares_buf_fetch_bytes(buf, (unsigned char *)port, len); + if (status != ARES_SUCCESS) { + return status; + } + port[len] = 0; + + if (!ares_str_isnum(port)) { + return ARES_EBADSTR; + } + + status = ares_uri_set_port(uri, (unsigned short)atoi(port)); + if (status != ARES_SUCCESS) { + return status; + } + + return ARES_SUCCESS; +} + +static ares_status_t ares_uri_parse_authority(ares_uri_t *uri, ares_buf_t *buf) +{ + ares_status_t status; + size_t bytes; + ares_buf_t *auth = NULL; + const unsigned char *ptr; + size_t ptr_len; + + ares_buf_tag(buf); + + bytes = ares_buf_consume_until_charset(buf, (const unsigned char *)"/?#", 3, + ARES_FALSE); + if (bytes == 0) { + return ARES_EBADSTR; + } + + status = ares_buf_tag_fetch_constbuf(buf, &auth); + if (status != ARES_SUCCESS) { + goto done; + } + + ptr = ares_buf_peek(auth, &ptr_len); + if (!ares_uri_str_isvalid((const char *)ptr, ptr_len, + ares_uri_chis_authority)) { + status = ARES_EBADSTR; + goto done; + } + + status = ares_uri_parse_userinfo(uri, auth); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_parse_hostport(uri, auth); + if (status != ARES_SUCCESS) { + goto done; + } + + /* NOTE: the /, ?, or # is still in the buffer at this point so it can + * be used to determine what parser should be called next */ + +done: + ares_buf_destroy(auth); + return status; +} + +static ares_status_t ares_uri_parse_path(ares_uri_t *uri, ares_buf_t *buf) +{ + unsigned char b; + char *path = NULL; + ares_status_t status; + size_t len; + + if (ares_buf_len(buf) == 0) { + return ARES_SUCCESS; + } + + status = ares_buf_peek_byte(buf, &b); + if (status != ARES_SUCCESS) { + return status; + } + + /* Not a path, must be one of the others */ + if (b != '/') { + return ARES_SUCCESS; + } + + ares_buf_tag(buf); + ares_buf_consume_until_charset(buf, (const unsigned char *)"?#", 2, + ARES_FALSE); + status = ares_buf_tag_fetch_strdup(buf, &path); + if (status != ARES_SUCCESS) { + goto done; + } + + if (!ares_uri_str_isvalid(path, SIZE_MAX, ares_uri_chis_path_enc)) { + status = ARES_EBADSTR; + goto done; + } + + status = ares_uri_decode_inplace(path, ARES_FALSE, ARES_TRUE, &len); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_set_path(uri, path); + if (status != ARES_SUCCESS) { + goto done; + } + +done: + ares_free(path); + return status; +} + +static ares_status_t ares_uri_parse_query_buf(ares_uri_t *uri, ares_buf_t *buf) +{ + ares_status_t status = ARES_SUCCESS; + char *key = NULL; + char *val = NULL; + + while (ares_buf_len(buf) > 0) { + unsigned char b = 0; + size_t len; + + ares_buf_tag(buf); + + /* Its valid to have only a key with no value, so we search for both + * delims */ + len = ares_buf_consume_until_charset(buf, (const unsigned char *)"&=", 2, + ARES_FALSE); + if (len == 0) { + /* If we're here, we have a zero length key which is invalid */ + status = ARES_EBADSTR; + goto done; + } + + if (ares_buf_len(buf) > 0) { + /* Determine if we stopped on & or = */ + status = ares_buf_peek_byte(buf, &b); + if (status != ARES_SUCCESS) { + goto done; + } + } + + status = ares_buf_tag_fetch_strdup(buf, &key); + if (status != ARES_SUCCESS) { + goto done; + } + + if (!ares_uri_str_isvalid(key, SIZE_MAX, ares_uri_chis_query_enc)) { + status = ARES_EBADSTR; + goto done; + } + + status = ares_uri_decode_inplace(key, ARES_TRUE, ARES_TRUE, &len); + if (status != ARES_SUCCESS) { + goto done; + } + + /* Fetch Value */ + if (b == '=') { + /* Skip delimiter */ + ares_buf_consume(buf, 1); + ares_buf_tag(buf); + len = ares_buf_consume_until_charset(buf, (const unsigned char *)"&", 1, + ARES_FALSE); + if (len > 0) { + status = ares_buf_tag_fetch_strdup(buf, &val); + if (status != ARES_SUCCESS) { + goto done; + } + + if (!ares_uri_str_isvalid(val, SIZE_MAX, ares_uri_chis_query_enc)) { + status = ARES_EBADSTR; + goto done; + } + + status = ares_uri_decode_inplace(val, ARES_TRUE, ARES_TRUE, &len); + if (status != ARES_SUCCESS) { + goto done; + } + } + } + + if (b != 0) { + /* Consume '&' */ + ares_buf_consume(buf, 1); + } + + status = ares_uri_set_query_key(uri, key, val); + if (status != ARES_SUCCESS) { + goto done; + } + + ares_free(key); + key = NULL; + ares_free(val); + val = NULL; + } + +done: + ares_free(key); + ares_free(val); + return status; +} + +static ares_status_t ares_uri_parse_query(ares_uri_t *uri, ares_buf_t *buf) +{ + unsigned char b; + ares_status_t status; + ares_buf_t *query = NULL; + size_t len; + + if (ares_buf_len(buf) == 0) { + return ARES_SUCCESS; + } + + status = ares_buf_peek_byte(buf, &b); + if (status != ARES_SUCCESS) { + return status; + } + + /* Not a query, must be one of the others */ + if (b != '?') { + return ARES_SUCCESS; + } + + /* Only possible terminator is fragment indicator of '#' */ + ares_buf_consume(buf, 1); + ares_buf_tag(buf); + len = ares_buf_consume_until_charset(buf, (const unsigned char *)"#", 1, + ARES_FALSE); + if (len == 0) { + /* No data, return */ + return ARES_SUCCESS; + } + + status = ares_buf_tag_fetch_constbuf(buf, &query); + if (status != ARES_SUCCESS) { + return status; + } + + status = ares_uri_parse_query_buf(uri, query); + ares_buf_destroy(query); + + return status; +} + +static ares_status_t ares_uri_parse_fragment(ares_uri_t *uri, ares_buf_t *buf) +{ + unsigned char b; + char *fragment = NULL; + ares_status_t status; + size_t len; + + if (ares_buf_len(buf) == 0) { + return ARES_SUCCESS; + } + + status = ares_buf_peek_byte(buf, &b); + if (status != ARES_SUCCESS) { + return status; + } + + /* Not a fragment, must be one of the others */ + if (b != '#') { + return ARES_SUCCESS; + } + + ares_buf_consume(buf, 1); + + if (ares_buf_len(buf) == 0) { + return ARES_SUCCESS; + } + + /* Rest of the buffer is the fragment */ + status = ares_buf_fetch_str_dup(buf, ares_buf_len(buf), &fragment); + if (status != ARES_SUCCESS) { + goto done; + } + + if (!ares_uri_str_isvalid(fragment, SIZE_MAX, ares_uri_chis_fragment_enc)) { + status = ARES_EBADSTR; + goto done; + } + + status = ares_uri_decode_inplace(fragment, ARES_FALSE, ARES_TRUE, &len); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_set_fragment_own(uri, fragment); + if (status != ARES_SUCCESS) { + goto done; + } + fragment = NULL; + +done: + ares_free(fragment); + return status; +} + +ares_status_t ares_uri_parse_buf(ares_uri_t **out, ares_buf_t *buf) +{ + ares_status_t status; + ares_uri_t *uri = NULL; + size_t orig_pos; + + if (out == NULL || buf == NULL) { + return ARES_EFORMERR; + } + + *out = NULL; + + orig_pos = ares_buf_get_position(buf); + + uri = ares_uri_create(); + if (uri == NULL) { + status = ARES_ENOMEM; + goto done; + } + + status = ares_uri_parse_scheme(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_parse_authority(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_parse_path(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_parse_query(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_parse_fragment(uri, buf); + if (status != ARES_SUCCESS) { + goto done; + } + +done: + if (status != ARES_SUCCESS) { + ares_buf_set_position(buf, orig_pos); + ares_uri_destroy(uri); + } else { + *out = uri; + } + return status; +} + +ares_status_t ares_uri_parse(ares_uri_t **out, const char *str) +{ + ares_status_t status; + ares_buf_t *buf = NULL; + + if (out == NULL || str == NULL) { + return ARES_EFORMERR; + } + + *out = NULL; + + buf = ares_buf_create(); + if (buf == NULL) { + status = ARES_ENOMEM; + goto done; + } + + status = ares_buf_append_str(buf, str); + if (status != ARES_SUCCESS) { + goto done; + } + + status = ares_uri_parse_buf(out, buf); + if (status != ARES_SUCCESS) { + goto done; + } + +done: + ares_buf_destroy(buf); + + return status; +} diff --git a/lib/c-ares-1.34.4/src/lib/util/ares_uri.h b/lib/c-ares-1.34.4/src/lib/util/ares_uri.h new file mode 100644 index 00000000000..6a703cba5b5 --- /dev/null +++ b/lib/c-ares-1.34.4/src/lib/util/ares_uri.h @@ -0,0 +1,252 @@ +/* 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_URI_H +#define __ARES_URI_H + +/*! \addtogroup ares_uri URI parser and writer implementation + * + * This is a fairly complete URI parser and writer implementation (RFC 3986) for + * schemes which use the :// syntax. Does not currently support URIs without an + * authority section, such as "mailto:person@example.com". + * + * Its implementation is overkill for our current needs to be able to express + * DNS server configuration, but there was really no reason not to support + * a greater subset of the specification. + * + * @{ + */ + + +struct ares_uri; + +/*! URI object */ +typedef struct ares_uri ares_uri_t; + +/*! Create a new URI object + * + * \return new ares_uri_t, must be freed with ares_uri_destroy() + */ +ares_uri_t *ares_uri_create(void); + +/*! Destroy an initialized URI object + * + * \param[in] uri Initialized URI object + */ +void ares_uri_destroy(ares_uri_t *uri); + +/*! Set the URI scheme. Automatically lower-cases the scheme provided. + * Only allows Alpha, Digit, +, -, and . characters. Maximum length is + * 15 characters. This is required to be set to write a URI. + * + * \param[in] uri Initialized URI object + * \param[in] scheme Scheme to set the object to use + * \return ARES_SUCCESS on success + */ +ares_status_t ares_uri_set_scheme(ares_uri_t *uri, const char *scheme); + +/*! Retrieve the currently configured URI scheme. + * + * \param[in] uri Initialized URI object + * \return string containing URI scheme + */ +const char *ares_uri_get_scheme(const ares_uri_t *uri); + +/*! Set the username in the URI object + * + * \param[in] uri Initialized URI object + * \param[in] username Username to set. May be NULL to unset existing username. + * \return ARES_SUCCESS on success + */ +ares_status_t ares_uri_set_username(ares_uri_t *uri, const char *username); + +/*! Retrieve the currently configured username. + * + * \param[in] uri Initialized URI object + * \return string containing username, maybe NULL if not set. + */ +const char *ares_uri_get_username(const ares_uri_t *uri); + +/*! Set the password in the URI object + * + * \param[in] uri Initialized URI object + * \param[in] password Password to set. May be NULL to unset existing password. + * \return ARES_SUCCESS on success + */ +ares_status_t ares_uri_set_password(ares_uri_t *uri, const char *password); + +/*! Retrieve the currently configured password. + * + * \param[in] uri Initialized URI object + * \return string containing password, maybe NULL if not set. + */ +const char *ares_uri_get_password(const ares_uri_t *uri); + +/*! Set the host or ip address in the URI object. This is required to be + * set to write a URI. The character set is strictly validated. + * + * \param[in] uri Initialized URI object + * \param[in] host IPv4, IPv6, or hostname to set. + * \return ARES_SUCCESS on success + */ +ares_status_t ares_uri_set_host(ares_uri_t *uri, const char *host); + +/*! Retrieve the currently configured host (or ip address). IPv6 addresses + * May include a link-local scope (e.g. fe80::b542:84df:1719:65e3%en0). + * + * \param[in] uri Initialized URI object + * \return string containing host, maybe NULL if not set. + */ +const char *ares_uri_get_host(const ares_uri_t *uri); + +/*! Set the port to use in the URI object. A port value of 0 will omit + * the port from the URI when written, thus using the scheme's default. + * + * \param[in] uri Initialized URI object + * \param[in] port Port to set. Use 0 to unset. + * \return ARES_SUCCESS on success + */ +ares_status_t ares_uri_set_port(ares_uri_t *uri, unsigned short port); + +/*! Retrieve the currently configured port + * + * \param[in] uri Initialized URI object + * \return port number, or 0 if not set. + */ +unsigned short ares_uri_get_port(const ares_uri_t *uri); + +/*! Set the path in the URI object. Unsupported characters will be URI-encoded + * when written. + * + * \param[in] uri Initialized URI object + * \param[in] path Path to set. May be NULL to unset existing path. + * \return ARES_SUCCESS on success + */ +ares_status_t ares_uri_set_path(ares_uri_t *uri, const char *path); + +/*! Retrieves the path in the URI object. If retrieved after parse, this + * value will be URI-decoded already. + * + * \param[in] uri Initialized URI object + * \return path string, or NULL if not set. + */ +const char *ares_uri_get_path(const ares_uri_t *uri); + +/*! Set a new query key/value pair. There is no set order for query keys + * when output in the URI, they will be emitted in a random order. Keys are + * case-insensitive. Query keys and values will be automatically URI-encoded + * when written. + * + * \param[in] uri Initialized URI object + * \param[in] key Query key to use, must be non-zero length. + * \param[in] val Query value to use, may be NULL. + * \return ARES_SUCCESS on success + */ +ares_status_t ares_uri_set_query_key(ares_uri_t *uri, const char *key, + const char *val); + +/*! Delete a specific query key. + * + * \param[in] uri Initialized URI object + * \param[in] key Key to delete. + * \return ARES_SUCCESS if deleted, ARES_ENOTFOUND if not found + */ +ares_status_t ares_uri_del_query_key(ares_uri_t *uri, const char *key); + +/*! Retrieve the value associted with a query key. Keys are case-insensitive. + * + * \param[in] uri Initialized URI object + * \param[in] key Key to retrieve. + * \return string representing value, may be NULL if either not found or + * NULL value set. There is currently no way to indicate the + * difference. + */ +const char *ares_uri_get_query_key(const ares_uri_t *uri, const char *key); + +/*! Retrieve a complete list of query keys. + * + * \param[in] uri Initialized URI object + * \param[out] num Number of keys. + * \return NULL on failure or no keys. Use + * ares_free_array(keys, num, ares_free) when done with array. + */ +char **ares_uri_get_query_keys(const ares_uri_t *uri, size_t *num); + +/*! Set the fragment in the URI object. Unsupported characters will be + * URI-encoded when written. + * + * \param[in] uri Initialized URI object + * \param[in] fragment Fragment to set. May be NULL to unset existing fragment. + * \return ARES_SUCCESS on success + */ +ares_status_t ares_uri_set_fragment(ares_uri_t *uri, const char *fragment); + +/*! Retrieves the fragment in the URI object. If retrieved after parse, this + * value will be URI-decoded already. + * + * \param[in] uri Initialized URI object + * \return fragment string, or NULL if not set. + */ +const char *ares_uri_get_fragment(const ares_uri_t *uri); + +/*! Parse the provided URI buffer into a new URI object. + * + * \param[out] out Returned new URI object. free with ares_uri_destroy(). + * \param[in] buf Buffer object containing the URI + * \return ARES_SUCCESS on successful parse. On failure the 'buf' object will + * be restored to its initial state in case another parser needs to + * be attempted. + */ +ares_status_t ares_uri_parse_buf(ares_uri_t **out, ares_buf_t *buf); + +/*! Parse the provided URI string into a new URI object. + * + * \param[out] out Returned new URI object. free with ares_uri_destroy(). + * \param[in] uri URI string to parse + * \return ARES_SUCCESS on successful parse + */ +ares_status_t ares_uri_parse(ares_uri_t **out, const char *uri); + +/*! Write URI object to a new string buffer. Requires at least the scheme + * and host to be set for this to succeed. + * + * \param[out] out Returned new URI string. Free with ares_free(). + * \param[in] uri Initialized URI object. + * \return ARES_SUCCESS on successful write. + */ +ares_status_t ares_uri_write(char **out, const ares_uri_t *uri); + +/*! Write URI object to an existing ares_buf_t object. Requires at least the + * scheme and host to be set for this to succeed. + * + * \param[in] uri Initialized URI object. + * \param[in,out] buf Destination buf object. + * \return ARES_SUCCESS on successful write. + */ +ares_status_t ares_uri_write_buf(const ares_uri_t *uri, ares_buf_t *buf); + +/*! @} */ + +#endif /* __ARES_URI_H */ diff --git a/lib/c-ares-1.33.1/src/lib/windows_port.c b/lib/c-ares-1.34.4/src/lib/windows_port.c similarity index 100% rename from lib/c-ares-1.33.1/src/lib/windows_port.c rename to lib/c-ares-1.34.4/src/lib/windows_port.c diff --git a/lib/c-ares-1.33.1/src/tools/CMakeLists.txt b/lib/c-ares-1.34.4/src/tools/CMakeLists.txt similarity index 77% rename from lib/c-ares-1.33.1/src/tools/CMakeLists.txt rename to lib/c-ares-1.34.4/src/tools/CMakeLists.txt index e23d0f23c78..c8c0041e54d 100644 --- a/lib/c-ares-1.33.1/src/tools/CMakeLists.txt +++ b/lib/c-ares-1.34.4/src/tools/CMakeLists.txt @@ -11,6 +11,7 @@ IF (CARES_BUILD_TOOLS) PUBLIC "$" "$" "$" + "$" "$" "$" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" @@ -25,13 +26,18 @@ IF (CARES_BUILD_TOOLS) TARGET_COMPILE_DEFINITIONS (ahost PRIVATE HAVE_CONFIG_H=1 CARES_NO_DEPRECATED) TARGET_LINK_LIBRARIES (ahost PRIVATE ${PROJECT_NAME}) + + # Avoid "fatal error C1041: cannot open program database" due to multiple + # targets trying to use the same PDB. /FS does NOT resolve this issue. + SET_TARGET_PROPERTIES(ahost PROPERTIES COMPILE_PDB_NAME ahost.pdb) + IF (CARES_INSTALL) INSTALL (TARGETS ahost COMPONENT Tools ${TARGETS_INST_DEST}) ENDIF () # Build adig - ADD_EXECUTABLE (adig adig.c ${SAMPLESOURCES}) + ADD_EXECUTABLE (adig adig.c) # Don't build adig and ahost in parallel. This is to prevent a Windows MSVC # build error due to them both using the same source files. ADD_DEPENDENCIES(adig ahost) @@ -39,6 +45,7 @@ IF (CARES_BUILD_TOOLS) PUBLIC "$" "$" "$" + "$" "$" "$" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" @@ -53,6 +60,11 @@ IF (CARES_BUILD_TOOLS) TARGET_COMPILE_DEFINITIONS (adig PRIVATE HAVE_CONFIG_H=1 CARES_NO_DEPRECATED) TARGET_LINK_LIBRARIES (adig PRIVATE ${PROJECT_NAME}) + + # Avoid "fatal error C1041: cannot open program database" due to multiple + # targets trying to use the same PDB. /FS does NOT resolve this issue. + SET_TARGET_PROPERTIES(adig PROPERTIES COMPILE_PDB_NAME adig.pdb) + IF (CARES_INSTALL) INSTALL (TARGETS adig COMPONENT Tools ${TARGETS_INST_DEST}) ENDIF () diff --git a/lib/c-ares-1.33.1/src/tools/Makefile.am b/lib/c-ares-1.34.4/src/tools/Makefile.am similarity index 94% rename from lib/c-ares-1.33.1/src/tools/Makefile.am rename to lib/c-ares-1.34.4/src/tools/Makefile.am index ba7a672f89f..439b40b192a 100644 --- a/lib/c-ares-1.33.1/src/tools/Makefile.am +++ b/lib/c-ares-1.34.4/src/tools/Makefile.am @@ -16,6 +16,7 @@ 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/include \ -DCARES_NO_DEPRECATED include Makefile.inc @@ -28,6 +29,6 @@ ahost_SOURCES = ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS) ahost_CFLAGS = $(AM_CFLAGS) ahost_CPPFLAGS = $(AM_CPPFLAGS) -adig_SOURCES = adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS) +adig_SOURCES = adig.c adig_CFLAGS = $(AM_CFLAGS) adig_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/lib/c-ares-1.33.1/src/tools/Makefile.in b/lib/c-ares-1.34.4/src/tools/Makefile.in similarity index 74% rename from lib/c-ares-1.33.1/src/tools/Makefile.in rename to lib/c-ares-1.34.4/src/tools/Makefile.in index e1b661ec1d7..19e99a25337 100644 --- a/lib/c-ares-1.33.1/src/tools/Makefile.in +++ b/lib/c-ares-1.34.4/src/tools/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2024 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -70,8 +70,6 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -am__rm_f = rm -f $(am__rm_f_notfound) -am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -93,7 +91,9 @@ host_triplet = @host@ noinst_PROGRAMS = $(am__EXEEXT_1) subdir = src/tools ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ + $(top_srcdir)/m4/ares_check_uts_namespace.m4 \ + $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ @@ -103,8 +103,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_user_namespace.m4 \ - $(top_srcdir)/m4/ax_check_uts_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ @@ -126,12 +124,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = ahost$(EXEEXT) adig$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) -am__dirstamp = $(am__leading_dot)dirstamp -am__objects_1 = adig-ares_getopt.$(OBJEXT) \ - ../lib/str/adig-ares_strcasecmp.$(OBJEXT) -am__objects_2 = -am_adig_OBJECTS = adig-adig.$(OBJEXT) $(am__objects_1) \ - $(am__objects_2) +am_adig_OBJECTS = adig-adig.$(OBJEXT) adig_OBJECTS = $(am_adig_OBJECTS) adig_LDADD = $(LDADD) am__DEPENDENCIES_1 = @@ -144,9 +137,9 @@ am__v_lt_1 = adig_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(adig_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am__objects_3 = ahost-ares_getopt.$(OBJEXT) \ - ../lib/str/ahost-ares_strcasecmp.$(OBJEXT) -am_ahost_OBJECTS = ahost-ahost.$(OBJEXT) $(am__objects_3) \ +am__objects_1 = ahost-ares_getopt.$(OBJEXT) +am__objects_2 = +am_ahost_OBJECTS = ahost-ahost.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) ahost_OBJECTS = $(am_ahost_OBJECTS) ahost_LDADD = $(LDADD) @@ -170,9 +163,7 @@ am__v_at_1 = DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Po \ - ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Po \ - ./$(DEPDIR)/adig-adig.Po ./$(DEPDIR)/adig-ares_getopt.Po \ +am__depfiles_remade = ./$(DEPDIR)/adig-adig.Po \ ./$(DEPDIR)/ahost-ahost.Po ./$(DEPDIR)/ahost-ares_getopt.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -230,7 +221,8 @@ 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 -DCARES_NO_DEPRECATED + -I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib/include \ + -DCARES_NO_DEPRECATED AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ @@ -272,7 +264,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ @@ -339,10 +330,8 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ -am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ @@ -396,12 +385,8 @@ EXTRA_DIST = CMakeLists.txt Makefile.inc # Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT -SAMPLESOURCES = ares_getopt.c \ - ../lib/str/ares_strcasecmp.c - -SAMPLEHEADERS = ares_getopt.h \ - ../lib/str/ares_strcasecmp.h - +SAMPLESOURCES = ares_getopt.c +SAMPLEHEADERS = ares_getopt.h # We're not interested in code coverage of the test apps themselves, but need # to link with gcov if building with code coverage enabled @@ -409,7 +394,7 @@ LDADD = $(top_builddir)/src/lib/libcares.la $(CODE_COVERAGE_LIBS) ahost_SOURCES = ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS) ahost_CFLAGS = $(AM_CFLAGS) ahost_CPPFLAGS = $(AM_CPPFLAGS) -adig_SOURCES = adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS) +adig_SOURCES = adig.c adig_CFLAGS = $(AM_CFLAGS) adig_CPPFLAGS = $(AM_CPPFLAGS) all: all-am @@ -448,23 +433,17 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): clean-noinstPROGRAMS: - $(am__rm_f) $(noinst_PROGRAMS) - test -z "$(EXEEXT)" || $(am__rm_f) $(noinst_PROGRAMS:$(EXEEXT)=) -../lib/str/$(am__dirstamp): - @$(MKDIR_P) ../lib/str - @: >>../lib/str/$(am__dirstamp) -../lib/str/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) ../lib/str/$(DEPDIR) - @: >>../lib/str/$(DEPDIR)/$(am__dirstamp) -../lib/str/adig-ares_strcasecmp.$(OBJEXT): ../lib/str/$(am__dirstamp) \ - ../lib/str/$(DEPDIR)/$(am__dirstamp) + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list adig$(EXEEXT): $(adig_OBJECTS) $(adig_DEPENDENCIES) $(EXTRA_adig_DEPENDENCIES) @rm -f adig$(EXEEXT) $(AM_V_CCLD)$(adig_LINK) $(adig_OBJECTS) $(adig_LDADD) $(LIBS) -../lib/str/ahost-ares_strcasecmp.$(OBJEXT): \ - ../lib/str/$(am__dirstamp) \ - ../lib/str/$(DEPDIR)/$(am__dirstamp) ahost$(EXEEXT): $(ahost_OBJECTS) $(ahost_DEPENDENCIES) $(EXTRA_ahost_DEPENDENCIES) @rm -f ahost$(EXEEXT) @@ -472,21 +451,17 @@ ahost$(EXEEXT): $(ahost_OBJECTS) $(ahost_DEPENDENCIES) $(EXTRA_ahost_DEPENDENCIE mostlyclean-compile: -rm -f *.$(OBJEXT) - -rm -f ../lib/str/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adig-adig.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adig-ares_getopt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ahost-ahost.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ahost-ares_getopt.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) - @: >>$@ + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) @@ -528,34 +503,6 @@ adig-adig.obj: adig.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -c -o adig-adig.obj `if test -f 'adig.c'; then $(CYGPATH_W) 'adig.c'; else $(CYGPATH_W) '$(srcdir)/adig.c'; fi` -adig-ares_getopt.o: ares_getopt.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -MT adig-ares_getopt.o -MD -MP -MF $(DEPDIR)/adig-ares_getopt.Tpo -c -o adig-ares_getopt.o `test -f 'ares_getopt.c' || echo '$(srcdir)/'`ares_getopt.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adig-ares_getopt.Tpo $(DEPDIR)/adig-ares_getopt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_getopt.c' object='adig-ares_getopt.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -c -o adig-ares_getopt.o `test -f 'ares_getopt.c' || echo '$(srcdir)/'`ares_getopt.c - -adig-ares_getopt.obj: ares_getopt.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -MT adig-ares_getopt.obj -MD -MP -MF $(DEPDIR)/adig-ares_getopt.Tpo -c -o adig-ares_getopt.obj `if test -f 'ares_getopt.c'; then $(CYGPATH_W) 'ares_getopt.c'; else $(CYGPATH_W) '$(srcdir)/ares_getopt.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adig-ares_getopt.Tpo $(DEPDIR)/adig-ares_getopt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_getopt.c' object='adig-ares_getopt.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -c -o adig-ares_getopt.obj `if test -f 'ares_getopt.c'; then $(CYGPATH_W) 'ares_getopt.c'; else $(CYGPATH_W) '$(srcdir)/ares_getopt.c'; fi` - -../lib/str/adig-ares_strcasecmp.o: ../lib/str/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -MT ../lib/str/adig-ares_strcasecmp.o -MD -MP -MF ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Tpo -c -o ../lib/str/adig-ares_strcasecmp.o `test -f '../lib/str/ares_strcasecmp.c' || echo '$(srcdir)/'`../lib/str/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Tpo ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../lib/str/ares_strcasecmp.c' object='../lib/str/adig-ares_strcasecmp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -c -o ../lib/str/adig-ares_strcasecmp.o `test -f '../lib/str/ares_strcasecmp.c' || echo '$(srcdir)/'`../lib/str/ares_strcasecmp.c - -../lib/str/adig-ares_strcasecmp.obj: ../lib/str/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -MT ../lib/str/adig-ares_strcasecmp.obj -MD -MP -MF ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Tpo -c -o ../lib/str/adig-ares_strcasecmp.obj `if test -f '../lib/str/ares_strcasecmp.c'; then $(CYGPATH_W) '../lib/str/ares_strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/../lib/str/ares_strcasecmp.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Tpo ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../lib/str/ares_strcasecmp.c' object='../lib/str/adig-ares_strcasecmp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -c -o ../lib/str/adig-ares_strcasecmp.obj `if test -f '../lib/str/ares_strcasecmp.c'; then $(CYGPATH_W) '../lib/str/ares_strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/../lib/str/ares_strcasecmp.c'; fi` - ahost-ahost.o: ahost.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ahost_CPPFLAGS) $(CPPFLAGS) $(ahost_CFLAGS) $(CFLAGS) -MT ahost-ahost.o -MD -MP -MF $(DEPDIR)/ahost-ahost.Tpo -c -o ahost-ahost.o `test -f 'ahost.c' || echo '$(srcdir)/'`ahost.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ahost-ahost.Tpo $(DEPDIR)/ahost-ahost.Po @@ -584,20 +531,6 @@ ahost-ares_getopt.obj: ares_getopt.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ahost_CPPFLAGS) $(CPPFLAGS) $(ahost_CFLAGS) $(CFLAGS) -c -o ahost-ares_getopt.obj `if test -f 'ares_getopt.c'; then $(CYGPATH_W) 'ares_getopt.c'; else $(CYGPATH_W) '$(srcdir)/ares_getopt.c'; fi` -../lib/str/ahost-ares_strcasecmp.o: ../lib/str/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ahost_CPPFLAGS) $(CPPFLAGS) $(ahost_CFLAGS) $(CFLAGS) -MT ../lib/str/ahost-ares_strcasecmp.o -MD -MP -MF ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Tpo -c -o ../lib/str/ahost-ares_strcasecmp.o `test -f '../lib/str/ares_strcasecmp.c' || echo '$(srcdir)/'`../lib/str/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Tpo ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../lib/str/ares_strcasecmp.c' object='../lib/str/ahost-ares_strcasecmp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ahost_CPPFLAGS) $(CPPFLAGS) $(ahost_CFLAGS) $(CFLAGS) -c -o ../lib/str/ahost-ares_strcasecmp.o `test -f '../lib/str/ares_strcasecmp.c' || echo '$(srcdir)/'`../lib/str/ares_strcasecmp.c - -../lib/str/ahost-ares_strcasecmp.obj: ../lib/str/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ahost_CPPFLAGS) $(CPPFLAGS) $(ahost_CFLAGS) $(CFLAGS) -MT ../lib/str/ahost-ares_strcasecmp.obj -MD -MP -MF ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Tpo -c -o ../lib/str/ahost-ares_strcasecmp.obj `if test -f '../lib/str/ares_strcasecmp.c'; then $(CYGPATH_W) '../lib/str/ares_strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/../lib/str/ares_strcasecmp.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Tpo ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../lib/str/ares_strcasecmp.c' object='../lib/str/ahost-ares_strcasecmp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ahost_CPPFLAGS) $(CPPFLAGS) $(ahost_CFLAGS) $(CFLAGS) -c -o ../lib/str/ahost-ares_strcasecmp.obj `if test -f '../lib/str/ares_strcasecmp.c'; then $(CYGPATH_W) '../lib/str/ares_strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/../lib/str/ares_strcasecmp.c'; fi` - mostlyclean-libtool: -rm -f *.lo @@ -716,10 +649,8 @@ mostlyclean-generic: clean-generic: distclean-generic: - -$(am__rm_f) $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) - -$(am__rm_f) ../lib/str/$(DEPDIR)/$(am__dirstamp) - -$(am__rm_f) ../lib/str/$(am__dirstamp) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -730,10 +661,7 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am - -rm -f ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Po - -rm -f ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Po - -rm -f ./$(DEPDIR)/adig-adig.Po - -rm -f ./$(DEPDIR)/adig-ares_getopt.Po + -rm -f ./$(DEPDIR)/adig-adig.Po -rm -f ./$(DEPDIR)/ahost-ahost.Po -rm -f ./$(DEPDIR)/ahost-ares_getopt.Po -rm -f Makefile @@ -781,10 +709,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ../lib/str/$(DEPDIR)/adig-ares_strcasecmp.Po - -rm -f ../lib/str/$(DEPDIR)/ahost-ares_strcasecmp.Po - -rm -f ./$(DEPDIR)/adig-adig.Po - -rm -f ./$(DEPDIR)/adig-ares_getopt.Po + -rm -f ./$(DEPDIR)/adig-adig.Po -rm -f ./$(DEPDIR)/ahost-ahost.Po -rm -f ./$(DEPDIR)/ahost-ares_getopt.Po -rm -f Makefile @@ -827,10 +752,3 @@ uninstall-am: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - -# Tell GNU make to disable its built-in pattern rules. -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% diff --git a/lib/c-ares-1.34.4/src/tools/Makefile.inc b/lib/c-ares-1.34.4/src/tools/Makefile.inc new file mode 100644 index 00000000000..088c7d4e062 --- /dev/null +++ b/lib/c-ares-1.34.4/src/tools/Makefile.inc @@ -0,0 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT +SAMPLESOURCES = ares_getopt.c + +SAMPLEHEADERS = ares_getopt.h diff --git a/lib/c-ares-1.34.4/src/tools/adig.c b/lib/c-ares-1.34.4/src/tools/adig.c new file mode 100644 index 00000000000..fce210a8053 --- /dev/null +++ b/lib/c-ares-1.34.4/src/tools/adig.c @@ -0,0 +1,1575 @@ +/* MIT License + * + * Copyright (c) 1998 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_setup.h" + +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif + +#include "ares_nameser.h" + +#ifdef HAVE_STRINGS_H +# include +#endif + +#include "ares.h" +#include "ares_array.h" +#include "ares_buf.h" +#include "ares_dns.h" +#include "ares_getopt.h" +#include "ares_mem.h" +#include "ares_str.h" + +#include "limits.h" + +#ifndef PATH_MAX +# define PATH_MAX 1024 +#endif + +typedef struct { + unsigned short port; + size_t tries; + size_t ndots; + ares_bool_t tcp; + ares_bool_t ignore_tc; + char *search; + ares_bool_t do_search; + ares_bool_t aa_flag; + ares_bool_t ad_flag; + ares_bool_t cd_flag; + ares_bool_t rd_flag; + /* ares_bool_t do_flag; */ + ares_bool_t edns; + size_t udp_size; + ares_bool_t primary; + ares_bool_t aliases; + ares_bool_t stayopen; + ares_bool_t dns0x20; + ares_bool_t display_class; + ares_bool_t display_ttl; + ares_bool_t display_command; + ares_bool_t display_stats; + ares_bool_t display_query; + ares_bool_t display_question; + ares_bool_t display_answer; + ares_bool_t display_authority; + ares_bool_t display_additional; + ares_bool_t display_comments; +} dns_options_t; + +typedef struct { + dns_options_t opts; + ares_bool_t is_help; + ares_bool_t no_rcfile; + struct ares_options options; + int optmask; + ares_dns_class_t qclass; + ares_dns_rec_type_t qtype; + char *name; + char *servers; + char error[256]; +} adig_config_t; + +static adig_config_t global_config; + + +static const char *helpstr[] = { + "usage: adig [@server] [-c class] [-p port#] [-q name] [-t type] [-x addr]", + " [name] [type] [class] [queryopt...]", + "", + "@server: server ip address. May specify multiple in comma delimited " + "format.", + " may be specified in URI format", + "name: name of the resource record that is to be looked up", + "type: what type of query is required. e.g. - A, AAAA, MX, TXT, etc. If", + " no specified, A will be used.", + "class: Sets the query class, defaults to IN. May also be HS or CH.", + "", + "FLAGS", + "-c class: Sets the query class, defaults to IN. May also be HS or CH.", + "-h: Prints this help.", + "-p port: Sends query to a port other than 53. Often recommended to set", + " the port using @server instead.", + "-q name: Specifies the domain name to query. Useful to distinguish name", + " from other arguments", + "-r: Skip adigrc processing", + "-s: Server (alias for @server syntax), compatibility with old cmdline", + "-t type: Indicates resource record type to query. Useful to distinguish", + " type from other arguments", + "-x addr: Simplified reverse lookups. Sets the type to PTR and forms a", + " valid in-arpa query string", + "", + "QUERY OPTIONS", + "+[no]aaonly: Sets the aa flag in the query. Default is off.", + "+[no]aaflag: Alias for +[no]aaonly", + "+[no]additional: Toggles printing the additional section. On by default.", + "+[no]adflag: Sets the ad (authentic data) bit in the query. Default is", + " off.", + "+[no]aliases: Whether or not to honor the HOSTALIASES file. Default is", + " on.", + "+[no]all: Toggles all of +[no]cmd, +[no]stats, +[no]question,", + " +[no]answer, +[no]authority, +[no]additional, " + "+[no]comments", + "+[no]answer: Toggles printing the answer. On by default.", + "+[no]authority: Toggles printing the authority. On by default.", + "+bufsize=#: UDP EDNS 0 packet size allowed. Defaults to 1232.", + "+[no]cdflag: Sets the CD (checking disabled) bit in the query. Default", + " is off.", + "+[no]class: Display the class when printing the record. On by " + "default.", + "+[no]cmd: Toggles printing the command requested. On by default.", + "+[no]comments: Toggles printing the comments. On by default", + "+[no]defname: Alias for +[no]search", + "+domain=somename: Sets the search list to a single domain.", + "+[no]dns0x20: Whether or not to use DNS 0x20 case randomization when", + " sending queries. Default is off.", + "+[no]edns[=#]: Enable or disable EDNS. Only allows a value of 0 if", + " specified. Default is to enable EDNS.", + "+[no]ignore: Ignore truncation on UDP, by default retried on TCP.", + "+[no]keepopen: Whether or not the server connection should be " + "persistent.", + " Default is off.", + "+ndots=#: Sets the number of dots that must appear before being", + " considered absolute. Defaults to 1.", + "+[no]primary: Whether or not to only use a single server if more than " + "one", + " server is available. Defaults to using all servers.", + "+[no]qr: Toggles printing the request query. Off by default.", + "+[no]question: Toggles printing the question. On by default.", + "+[no]recurse: Toggles the RD (Recursion Desired) bit. On by default.", + "+retry=#: Same as +tries but does not include the initial attempt.", + "+[no]search: To use or not use the search list. Search list is not " + "used", + " by default.", + "+[no]stats: Toggles printing the statistics. On by default.", + "+[no]tcp: Whether to use TCP when querying name servers. Default is", + " UDP.", + "+tries=#: Number of query tries. Defaults to 3.", + "+[no]ttlid: Display the TTL when printing the record. On by default.", + "+[no]vc: Alias for +[no]tcp", + "", + NULL +}; + +static void free_config(void) +{ + free(global_config.servers); + free(global_config.name); + free(global_config.opts.search); + memset(&global_config, 0, sizeof(global_config)); +} + +static void print_help(void) +{ + size_t i; + printf("adig version %s\n\n", ares_version(NULL)); + for (i = 0; helpstr[i] != NULL; i++) { + printf("%s\n", helpstr[i]); + } +} + +static void print_flags(ares_dns_flags_t flags) +{ + if (flags & ARES_FLAG_QR) { + printf(" qr"); + } + if (flags & ARES_FLAG_AA) { + printf(" aa"); + } + if (flags & ARES_FLAG_TC) { + printf(" tc"); + } + if (flags & ARES_FLAG_RD) { + printf(" rd"); + } + if (flags & ARES_FLAG_RA) { + printf(" ra"); + } + if (flags & ARES_FLAG_AD) { + printf(" ad"); + } + if (flags & ARES_FLAG_CD) { + printf(" cd"); + } +} + +static void print_header(const ares_dns_record_t *dnsrec) +{ + printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n", + ares_dns_opcode_tostr(ares_dns_record_get_opcode(dnsrec)), + ares_dns_rcode_tostr(ares_dns_record_get_rcode(dnsrec)), + ares_dns_record_get_id(dnsrec)); + printf(";; flags:"); + print_flags(ares_dns_record_get_flags(dnsrec)); + printf("; QUERY: %u, ANSWER: %u, AUTHORITY: %u, ADDITIONAL: %u\n\n", + (unsigned int)ares_dns_record_query_cnt(dnsrec), + (unsigned int)ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ANSWER), + (unsigned int)ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_AUTHORITY), + (unsigned int)ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ADDITIONAL)); +} + +static void print_question(const ares_dns_record_t *dnsrec) +{ + size_t i; + + if (global_config.opts.display_comments) { + printf(";; QUESTION SECTION:\n"); + } + + for (i = 0; i < ares_dns_record_query_cnt(dnsrec); i++) { + const char *name; + ares_dns_rec_type_t qtype; + ares_dns_class_t qclass; + size_t len; + if (ares_dns_record_query_get(dnsrec, i, &name, &qtype, &qclass) != + ARES_SUCCESS) { + return; + } + if (name == NULL) { + return; + } + len = strlen(name); + printf(";%s.\t", name); + if (len + 1 < 24) { + printf("\t"); + } + if (len + 1 < 16) { + printf("\t"); + } + + if (global_config.opts.display_class) { + printf("%s\t", ares_dns_class_tostr(qclass)); + } + + printf("%s\n", ares_dns_rec_type_tostr(qtype)); + } + + if (global_config.opts.display_comments) { + printf("\n"); + } +} + +static void print_opt_none(const unsigned char *val, size_t val_len) +{ + (void)val; + if (val_len != 0) { + printf("INVALID!"); + } +} + +static void print_opt_addr_list(const unsigned char *val, size_t val_len) +{ + size_t i; + if (val_len % 4 != 0) { + printf("INVALID!"); + return; + } + for (i = 0; i < val_len; i += 4) { + char buf[256] = ""; + ares_inet_ntop(AF_INET, val + i, buf, sizeof(buf)); + if (i != 0) { + printf(","); + } + printf("%s", buf); + } +} + +static void print_opt_addr6_list(const unsigned char *val, size_t val_len) +{ + size_t i; + if (val_len % 16 != 0) { + printf("INVALID!"); + return; + } + for (i = 0; i < val_len; i += 16) { + char buf[256] = ""; + + ares_inet_ntop(AF_INET6, val + i, buf, sizeof(buf)); + if (i != 0) { + printf(","); + } + printf("%s", buf); + } +} + +static void print_opt_u8_list(const unsigned char *val, size_t val_len) +{ + size_t i; + + for (i = 0; i < val_len; i++) { + if (i != 0) { + printf(","); + } + printf("%u", (unsigned int)val[i]); + } +} + +static void print_opt_u16_list(const unsigned char *val, size_t val_len) +{ + size_t i; + if (val_len < 2 || val_len % 2 != 0) { + printf("INVALID!"); + return; + } + for (i = 0; i < val_len; i += 2) { + unsigned short u16 = 0; + unsigned short c; + /* Jumping over backwards to try to avoid odd compiler warnings */ + c = (unsigned short)val[i]; + u16 |= (unsigned short)((c << 8) & 0xFFFF); + c = (unsigned short)val[i + 1]; + u16 |= c; + if (i != 0) { + printf(","); + } + printf("%u", (unsigned int)u16); + } +} + +static void print_opt_u32_list(const unsigned char *val, size_t val_len) +{ + size_t i; + if (val_len < 4 || val_len % 4 != 0) { + printf("INVALID!"); + return; + } + for (i = 0; i < val_len; i += 4) { + unsigned int u32 = 0; + + u32 |= (unsigned int)(val[i] << 24); + u32 |= (unsigned int)(val[i + 1] << 16); + u32 |= (unsigned int)(val[i + 2] << 8); + u32 |= (unsigned int)(val[i + 3]); + if (i != 0) { + printf(","); + } + printf("%u", u32); + } +} + +static void print_opt_str_list(const unsigned char *val, size_t val_len) +{ + size_t cnt = 0; + + printf("\""); + while (val_len) { + long read_len = 0; + unsigned char *str = NULL; + ares_status_t status; + + if (cnt) { + printf(","); + } + + status = (ares_status_t)ares_expand_string(val, val, (int)val_len, &str, + &read_len); + if (status != ARES_SUCCESS) { + printf("INVALID"); + break; + } + printf("%s", str); + ares_free_string(str); + val_len -= (size_t)read_len; + val += read_len; + cnt++; + } + printf("\""); +} + +static void print_opt_name(const unsigned char *val, size_t val_len) +{ + char *str = NULL; + long read_len = 0; + + if (ares_expand_name(val, val, (int)val_len, &str, &read_len) != + ARES_SUCCESS) { + printf("INVALID!"); + return; + } + + printf("%s.", str); + ares_free_string(str); +} + +static void print_opt_bin(const unsigned char *val, size_t val_len) +{ + size_t i; + + for (i = 0; i < val_len; i++) { + printf("%02x", (unsigned int)val[i]); + } +} + +static ares_bool_t adig_isprint(int ch) +{ + if (ch >= 0x20 && ch <= 0x7E) { + return ARES_TRUE; + } + return ARES_FALSE; +} + +static void print_opt_binp(const unsigned char *val, size_t val_len) +{ + size_t i; + printf("\""); + for (i = 0; i < val_len; i++) { + if (adig_isprint(val[i])) { + printf("%c", val[i]); + } else { + printf("\\%03d", val[i]); + } + } + printf("\""); +} + +static void print_opts(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + size_t i; + + for (i = 0; i < ares_dns_rr_get_opt_cnt(rr, key); i++) { + size_t val_len = 0; + const unsigned char *val = NULL; + unsigned short opt; + const char *name; + + if (i != 0) { + printf(" "); + } + + opt = ares_dns_rr_get_opt(rr, key, i, &val, &val_len); + name = ares_dns_opt_get_name(key, opt); + if (name == NULL) { + printf("key%u", (unsigned int)opt); + } else { + printf("%s", name); + } + if (val_len == 0) { + return; + } + + printf("="); + + switch (ares_dns_opt_get_datatype(key, opt)) { + case ARES_OPT_DATATYPE_NONE: + print_opt_none(val, val_len); + break; + case ARES_OPT_DATATYPE_U8_LIST: + print_opt_u8_list(val, val_len); + break; + case ARES_OPT_DATATYPE_INADDR4_LIST: + print_opt_addr_list(val, val_len); + break; + case ARES_OPT_DATATYPE_INADDR6_LIST: + print_opt_addr6_list(val, val_len); + break; + case ARES_OPT_DATATYPE_U16: + case ARES_OPT_DATATYPE_U16_LIST: + print_opt_u16_list(val, val_len); + break; + case ARES_OPT_DATATYPE_U32: + case ARES_OPT_DATATYPE_U32_LIST: + print_opt_u32_list(val, val_len); + break; + case ARES_OPT_DATATYPE_STR_LIST: + print_opt_str_list(val, val_len); + break; + case ARES_OPT_DATATYPE_BIN: + print_opt_bin(val, val_len); + break; + case ARES_OPT_DATATYPE_NAME: + print_opt_name(val, val_len); + break; + } + } +} + +static void print_addr(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + const struct in_addr *addr = ares_dns_rr_get_addr(rr, key); + char buf[256] = ""; + + ares_inet_ntop(AF_INET, addr, buf, sizeof(buf)); + printf("%s", buf); +} + +static void print_addr6(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + const struct ares_in6_addr *addr = ares_dns_rr_get_addr6(rr, key); + char buf[256] = ""; + + ares_inet_ntop(AF_INET6, addr, buf, sizeof(buf)); + printf("%s", buf); +} + +static void print_u8(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + unsigned char u8 = ares_dns_rr_get_u8(rr, key); + printf("%u", (unsigned int)u8); +} + +static void print_u16(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + unsigned short u16 = ares_dns_rr_get_u16(rr, key); + printf("%u", (unsigned int)u16); +} + +static void print_u32(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + unsigned int u32 = ares_dns_rr_get_u32(rr, key); + printf("%u", u32); +} + +static void print_name(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + const char *str = ares_dns_rr_get_str(rr, key); + printf("%s.", str); +} + +static void print_str(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + const char *str = ares_dns_rr_get_str(rr, key); + printf("\"%s\"", str); +} + +static void print_bin(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + size_t len = 0; + const unsigned char *binp = ares_dns_rr_get_bin(rr, key, &len); + print_opt_bin(binp, len); +} + +static void print_binp(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + size_t len; + const unsigned char *binp = ares_dns_rr_get_bin(rr, key, &len); + + print_opt_binp(binp, len); +} + +static void print_abinp(const ares_dns_rr_t *rr, ares_dns_rr_key_t key) +{ + size_t i; + size_t cnt = ares_dns_rr_get_abin_cnt(rr, key); + + for (i = 0; i < cnt; i++) { + size_t len; + const unsigned char *binp = ares_dns_rr_get_abin(rr, key, i, &len); + if (i != 0) { + printf(" "); + } + print_opt_binp(binp, len); + } +} + +static void print_rr(const ares_dns_rr_t *rr) +{ + const char *name = ares_dns_rr_get_name(rr); + size_t len = 0; + size_t keys_cnt = 0; + ares_dns_rec_type_t rtype = ares_dns_rr_get_type(rr); + const ares_dns_rr_key_t *keys = ares_dns_rr_get_keys(rtype, &keys_cnt); + size_t i; + + if (name == NULL) { + return; + } + + len = strlen(name); + + printf("%s.\t", name); + if (len < 24) { + printf("\t"); + } + + if (global_config.opts.display_ttl) { + printf("%u\t", ares_dns_rr_get_ttl(rr)); + } + + if (global_config.opts.display_class) { + printf("%s\t", ares_dns_class_tostr(ares_dns_rr_get_class(rr))); + } + + printf("%s\t", ares_dns_rec_type_tostr(rtype)); + + /* Output params here */ + for (i = 0; i < keys_cnt; i++) { + ares_dns_datatype_t datatype = ares_dns_rr_key_datatype(keys[i]); + if (i != 0) { + printf(" "); + } + + switch (datatype) { + case ARES_DATATYPE_INADDR: + print_addr(rr, keys[i]); + break; + case ARES_DATATYPE_INADDR6: + print_addr6(rr, keys[i]); + break; + case ARES_DATATYPE_U8: + print_u8(rr, keys[i]); + break; + case ARES_DATATYPE_U16: + print_u16(rr, keys[i]); + break; + case ARES_DATATYPE_U32: + print_u32(rr, keys[i]); + break; + case ARES_DATATYPE_NAME: + print_name(rr, keys[i]); + break; + case ARES_DATATYPE_STR: + print_str(rr, keys[i]); + break; + case ARES_DATATYPE_BIN: + print_bin(rr, keys[i]); + break; + case ARES_DATATYPE_BINP: + print_binp(rr, keys[i]); + break; + case ARES_DATATYPE_ABINP: + print_abinp(rr, keys[i]); + break; + case ARES_DATATYPE_OPT: + print_opts(rr, keys[i]); + break; + } + } + + printf("\n"); +} + +static const ares_dns_rr_t *has_opt(const ares_dns_record_t *dnsrec, + ares_dns_section_t section) +{ + size_t i; + for (i = 0; i < ares_dns_record_rr_cnt(dnsrec, section); i++) { + const ares_dns_rr_t *rr = ares_dns_record_rr_get_const(dnsrec, section, i); + if (ares_dns_rr_get_type(rr) == ARES_REC_TYPE_OPT) { + return rr; + } + } + return NULL; +} + +static void print_section(const ares_dns_record_t *dnsrec, + ares_dns_section_t section) +{ + size_t i; + + if (ares_dns_record_rr_cnt(dnsrec, section) == 0 || + (ares_dns_record_rr_cnt(dnsrec, section) == 1 && + has_opt(dnsrec, section) != NULL)) { + return; + } + + if (global_config.opts.display_comments) { + printf(";; %s SECTION:\n", ares_dns_section_tostr(section)); + } + for (i = 0; i < ares_dns_record_rr_cnt(dnsrec, section); i++) { + const ares_dns_rr_t *rr = ares_dns_record_rr_get_const(dnsrec, section, i); + if (ares_dns_rr_get_type(rr) == ARES_REC_TYPE_OPT) { + continue; + } + print_rr(rr); + } + if (global_config.opts.display_comments) { + printf("\n"); + } +} + +static void print_opt_psuedosection(const ares_dns_record_t *dnsrec) +{ + const ares_dns_rr_t *rr = has_opt(dnsrec, ARES_SECTION_ADDITIONAL); + const unsigned char *cookie = NULL; + size_t cookie_len = 0; + + if (rr == NULL) { + return; + } + + if (!ares_dns_rr_get_opt_byid(rr, ARES_RR_OPT_OPTIONS, ARES_OPT_PARAM_COOKIE, + &cookie, &cookie_len)) { + cookie = NULL; + } + + printf(";; OPT PSEUDOSECTION:\n"); + printf("; EDNS: version: %u, flags: %u; udp: %u\n", + (unsigned int)ares_dns_rr_get_u8(rr, ARES_RR_OPT_VERSION), + (unsigned int)ares_dns_rr_get_u16(rr, ARES_RR_OPT_FLAGS), + (unsigned int)ares_dns_rr_get_u16(rr, ARES_RR_OPT_UDP_SIZE)); + + if (cookie) { + printf("; COOKIE: "); + print_opt_bin(cookie, cookie_len); + printf(" (good)\n"); + } +} + +static void print_record(const ares_dns_record_t *dnsrec) +{ + if (global_config.opts.display_comments) { + print_header(dnsrec); + print_opt_psuedosection(dnsrec); + } + + if (global_config.opts.display_question) { + print_question(dnsrec); + } + + if (global_config.opts.display_answer) { + print_section(dnsrec, ARES_SECTION_ANSWER); + } + + if (global_config.opts.display_additional) { + print_section(dnsrec, ARES_SECTION_ADDITIONAL); + } + + if (global_config.opts.display_authority) { + print_section(dnsrec, ARES_SECTION_AUTHORITY); + } + + if (global_config.opts.display_stats) { + unsigned char *abuf = NULL; + size_t alen = 0; + ares_dns_write(dnsrec, &abuf, &alen); + printf(";; MSG SIZE rcvd: %d\n\n", (int)alen); + ares_free_string(abuf); + } +} + +static void callback(void *arg, ares_status_t status, size_t timeouts, + const ares_dns_record_t *dnsrec) +{ + (void)arg; + (void)timeouts; + + if (global_config.opts.display_comments) { + /* We got a "Server status" */ + if (status >= ARES_SUCCESS && status <= ARES_EREFUSED) { + printf(";; Got answer:"); + } else { + printf(";;"); + } + if (status != ARES_SUCCESS) { + printf(" %s", ares_strerror((int)status)); + } + printf("\n"); + } + + print_record(dnsrec); +} + +static ares_status_t enqueue_query(ares_channel_t *channel) +{ + ares_dns_record_t *dnsrec = NULL; + ares_dns_rr_t *rr = NULL; + ares_status_t status; + unsigned short flags = 0; + char *nametemp = NULL; + const char *name = global_config.name; + + if (global_config.opts.aa_flag) { + flags |= ARES_FLAG_AA; + } + + if (global_config.opts.ad_flag) { + flags |= ARES_FLAG_AD; + } + + if (global_config.opts.cd_flag) { + flags |= ARES_FLAG_CD; + } + + if (global_config.opts.rd_flag) { + flags |= ARES_FLAG_RD; + } + + status = ares_dns_record_create(&dnsrec, 0, flags, ARES_OPCODE_QUERY, + ARES_RCODE_NOERROR); + if (status != ARES_SUCCESS) { + goto done; + } + + /* If it is a PTR record, convert from ip address into in-arpa form + * automatically */ + if (global_config.qtype == ARES_REC_TYPE_PTR) { + struct ares_addr addr; + size_t len; + addr.family = AF_UNSPEC; + + if (ares_dns_pton(name, &addr, &len) != NULL) { + nametemp = ares_dns_addr_to_ptr(&addr); + name = nametemp; + } + } + + status = ares_dns_record_query_add(dnsrec, name, global_config.qtype, + global_config.qclass); + if (status != ARES_SUCCESS) { + goto done; + } + + if (global_config.opts.edns) { + status = ares_dns_record_rr_add(&rr, dnsrec, ARES_SECTION_ADDITIONAL, "", + ARES_REC_TYPE_OPT, ARES_CLASS_IN, 0); + if (status != ARES_SUCCESS) { + goto done; + } + ares_dns_rr_set_u16(rr, ARES_RR_OPT_UDP_SIZE, + (unsigned short)global_config.opts.udp_size); + ares_dns_rr_set_u8(rr, ARES_RR_OPT_VERSION, 0); + } + + if (global_config.opts.display_query) { + printf(";; Sending:\n"); + print_record(dnsrec); + } + + if (global_config.opts.do_search) { + status = ares_search_dnsrec(channel, dnsrec, callback, NULL); + } else { + status = ares_send_dnsrec(channel, dnsrec, callback, NULL, NULL); + } + +done: + ares_free_string(nametemp); + ares_dns_record_destroy(dnsrec); + return status; +} + +static int event_loop(ares_channel_t *channel) +{ + while (1) { + fd_set read_fds; + fd_set write_fds; + int nfds; + struct timeval tv; + struct timeval *tvp; + int count; + + FD_ZERO(&read_fds); + FD_ZERO(&write_fds); + memset(&tv, 0, sizeof(tv)); + + nfds = ares_fds(channel, &read_fds, &write_fds); + if (nfds == 0) { + break; + } + tvp = ares_timeout(channel, NULL, &tv); + if (tvp == NULL) { + break; + } + count = select(nfds, &read_fds, &write_fds, NULL, tvp); + if (count < 0) { +#ifdef USE_WINSOCK + int err = WSAGetLastError(); +#else + int err = errno; +#endif + if (err != EAGAIN && err != EINTR) { + fprintf(stderr, "select fail: %d", err); + return 1; + } + } + ares_process(channel, &read_fds, &write_fds); + } + return 0; +} + +typedef enum { + OPT_TYPE_BOOL, + OPT_TYPE_STRING, + OPT_TYPE_SIZE_T, + OPT_TYPE_U16, + OPT_TYPE_FUNC +} opt_type_t; + +/* Callback called with OPT_TYPE_FUNC when processing options. + * \param[in] prefix prefix character for option + * \param[in] name name for option + * \param[in] is_true ARES_TRUE unless option was prefixed with 'no' + * \param[in] value value for option + * \return ARES_TRUE on success, ARES_FALSE on failure. Should fill in + * global_config.error on error */ +typedef ares_bool_t (*dig_opt_cb_t)(char prefix, const char *name, + ares_bool_t is_true, const char *value); + +static ares_bool_t opt_class_cb(char prefix, const char *name, + ares_bool_t is_true, const char *value) +{ + (void)prefix; + (void)name; + (void)is_true; + + if (!ares_dns_class_fromstr(&global_config.qclass, value)) { + snprintf(global_config.error, sizeof(global_config.error), + "unrecognized class %s", value); + return ARES_FALSE; + } + + return ARES_TRUE; +} + +static ares_bool_t opt_type_cb(char prefix, const char *name, + ares_bool_t is_true, const char *value) +{ + (void)prefix; + (void)name; + (void)is_true; + + if (!ares_dns_rec_type_fromstr(&global_config.qtype, value)) { + snprintf(global_config.error, sizeof(global_config.error), + "unrecognized record type %s", value); + return ARES_FALSE; + } + return ARES_TRUE; +} + +static ares_bool_t opt_ptr_cb(char prefix, const char *name, + ares_bool_t is_true, const char *value) +{ + (void)prefix; + (void)name; + (void)is_true; + global_config.qtype = ARES_REC_TYPE_PTR; + ares_free(global_config.name); + global_config.name = strdup(value); + return ARES_TRUE; +} + +static ares_bool_t opt_all_cb(char prefix, const char *name, + ares_bool_t is_true, const char *value) +{ + (void)prefix; + (void)name; + (void)value; + + global_config.opts.display_command = is_true; + global_config.opts.display_stats = is_true; + global_config.opts.display_question = is_true; + global_config.opts.display_answer = is_true; + global_config.opts.display_authority = is_true; + global_config.opts.display_additional = is_true; + global_config.opts.display_comments = is_true; + return ARES_TRUE; +} + +static ares_bool_t opt_edns_cb(char prefix, const char *name, + ares_bool_t is_true, const char *value) +{ + (void)prefix; + (void)name; + + global_config.opts.edns = is_true; + if (is_true && value != NULL && atoi(value) > 0) { + snprintf(global_config.error, sizeof(global_config.error), + "edns 0 only supported"); + return ARES_FALSE; + } + return ARES_TRUE; +} + +static ares_bool_t opt_retry_cb(char prefix, const char *name, + ares_bool_t is_true, const char *value) +{ + (void)prefix; + (void)name; + (void)is_true; + + if (!ares_str_isnum(value)) { + snprintf(global_config.error, sizeof(global_config.error), + "value not numeric"); + return ARES_FALSE; + } + + global_config.opts.tries = strtoul(value, NULL, 10) + 1; + return ARES_TRUE; +} + +static ares_bool_t opt_dig_bare_cb(char prefix, const char *name, + ares_bool_t is_true, const char *value) +{ + (void)prefix; + (void)name; + (void)is_true; + + /* Handle @servers */ + if (*value == '@') { + free(global_config.servers); + global_config.servers = strdup(value + 1); + return ARES_TRUE; + } + + /* Make sure we don't pass options */ + if (*value == '-' || *value == '+') { + snprintf(global_config.error, sizeof(global_config.error), + "unrecognized argument %s", value); + return ARES_FALSE; + } + + /* See if it is a DNS class */ + if (ares_dns_class_fromstr(&global_config.qclass, value)) { + return ARES_TRUE; + } + + /* See if it is a DNS record type */ + if (ares_dns_rec_type_fromstr(&global_config.qtype, value)) { + return ARES_TRUE; + } + + /* See if it is a domain name */ + if (ares_is_hostname(value)) { + free(global_config.name); + global_config.name = strdup(value); + return ARES_TRUE; + } + + snprintf(global_config.error, sizeof(global_config.error), + "unrecognized argument %s", value); + return ARES_FALSE; +} + +static const struct { + /* Prefix for option. If 0 then this param is a non-option and type must be + * OPT_TYPE_FUNC where the entire value for the param will be passed */ + char prefix; + /* Name of option. If null, there is none and the value is expected to be + * immediately after the prefix character */ + const char *name; + /* Separator between key and value. If 0 then uses the next argument as the + * value, otherwise splits on the separator. BOOL types won't ever use a + * separator and is ignored.*/ + char separator; + /* Type of parameter passed in. If it is OPT_TYPE_FUNC, then it calls the + * dig_opt_cb_t callback */ + opt_type_t type; + /* Pointer to argument to fill in */ + void *opt; + /* Callback if OPT_TYPE_FUNC */ + dig_opt_cb_t cb; +} dig_options[] = { + /* -4 (ipv4 only) */ + /* -6 (ipv6 only) */ + /* { '-', "b", 0, OPT_TYPE_FUNC, NULL, opt_bind_address_cb }, + */ + { '-', "c", 0, OPT_TYPE_FUNC, NULL, opt_class_cb }, + /* -f file */ + { '-', "h", 0, OPT_TYPE_BOOL, &global_config.is_help, NULL }, + /* -k keyfile */ + /* -m (memory usage debugging) */ + { '-', "p", 0, OPT_TYPE_U16, &global_config.opts.port, NULL }, + { '-', "q", 0, OPT_TYPE_STRING, &global_config.name, NULL }, + { '-', "r", 0, OPT_TYPE_BOOL, &global_config.no_rcfile, NULL }, + { '-', "s", 0, OPT_TYPE_STRING, &global_config.servers, NULL }, + { '-', "t", 0, OPT_TYPE_FUNC, NULL, opt_type_cb }, + /* -u (print microseconds instead of milliseconds) */ + { '-', "x", 0, OPT_TYPE_FUNC, NULL, opt_ptr_cb }, + /* -y [hmac:]keynam:secret */ + { '+', "aaflag", 0, OPT_TYPE_BOOL, &global_config.opts.aa_flag, NULL }, + { '+', "aaonly", 0, OPT_TYPE_BOOL, &global_config.opts.aa_flag, NULL }, + { '+', "additional", 0, OPT_TYPE_BOOL, &global_config.opts.display_additional, + NULL }, + { '+', "adflag", 0, OPT_TYPE_BOOL, &global_config.opts.ad_flag, NULL }, + { '+', "aliases", 0, OPT_TYPE_BOOL, &global_config.opts.aliases, NULL }, + { '+', "all", '=', OPT_TYPE_FUNC, NULL, opt_all_cb }, + { '+', "answer", 0, OPT_TYPE_BOOL, &global_config.opts.display_answer, NULL }, + { '+', "authority", 0, OPT_TYPE_BOOL, &global_config.opts.display_authority, + NULL }, + { '+', "bufsize", '=', OPT_TYPE_SIZE_T, &global_config.opts.udp_size, NULL }, + { '+', "cdflag", 0, OPT_TYPE_BOOL, &global_config.opts.cd_flag, NULL }, + { '+', "class", 0, OPT_TYPE_BOOL, &global_config.opts.display_class, NULL }, + { '+', "cmd", 0, OPT_TYPE_BOOL, &global_config.opts.display_command, NULL }, + { '+', "comments", 0, OPT_TYPE_BOOL, &global_config.opts.display_comments, + NULL }, + { '+', "defname", 0, OPT_TYPE_BOOL, &global_config.opts.do_search, NULL }, + { '+', "dns0x20", 0, OPT_TYPE_BOOL, &global_config.opts.dns0x20, NULL }, + { '+', "domain", '=', OPT_TYPE_STRING, &global_config.opts.search, NULL }, + { '+', "edns", '=', OPT_TYPE_FUNC, NULL, opt_edns_cb }, + { '+', "keepopen", 0, OPT_TYPE_BOOL, &global_config.opts.stayopen, NULL }, + { '+', "ignore", 0, OPT_TYPE_BOOL, &global_config.opts.ignore_tc, NULL }, + { '+', "ndots", '=', OPT_TYPE_SIZE_T, &global_config.opts.ndots, NULL }, + { '+', "primary", 0, OPT_TYPE_BOOL, &global_config.opts.primary, NULL }, + { '+', "qr", 0, OPT_TYPE_BOOL, &global_config.opts.display_query, NULL }, + { '+', "question", 0, OPT_TYPE_BOOL, &global_config.opts.display_question, + NULL }, + { '+', "recurse", 0, OPT_TYPE_BOOL, &global_config.opts.rd_flag, NULL }, + { '+', "retry", '=', OPT_TYPE_FUNC, NULL, opt_retry_cb }, + { '+', "search", 0, OPT_TYPE_BOOL, &global_config.opts.do_search, NULL }, + { '+', "stats", 0, OPT_TYPE_BOOL, &global_config.opts.display_stats, NULL }, + { '+', "tcp", 0, OPT_TYPE_BOOL, &global_config.opts.tcp, NULL }, + { '+', "tries", '=', OPT_TYPE_SIZE_T, &global_config.opts.tries, NULL }, + { '+', "ttlid", 0, OPT_TYPE_BOOL, &global_config.opts.display_ttl, NULL }, + { '+', "vc", 0, OPT_TYPE_BOOL, &global_config.opts.tcp, NULL }, + { 0, NULL, 0, OPT_TYPE_FUNC, NULL, opt_dig_bare_cb }, + { 0, NULL, 0, 0, NULL, NULL } +}; + +static ares_bool_t read_cmdline(int argc, const char * const *argv, + int start_idx) +{ + int arg; + size_t opt; + + for (arg = start_idx; arg < argc; arg++) { + ares_bool_t option_handled = ARES_FALSE; + + for (opt = 0; !option_handled && + (dig_options[opt].opt != NULL || dig_options[opt].cb != NULL); + opt++) { + ares_bool_t is_true = ARES_TRUE; + const char *value = NULL; + const char *nameptr = NULL; + size_t namelen; + + /* Match prefix character */ + if (dig_options[opt].prefix != 0 && + dig_options[opt].prefix != *(argv[arg])) { + continue; + } + + nameptr = argv[arg]; + + /* skip prefix */ + if (dig_options[opt].prefix != 0) { + nameptr++; + } + + /* Negated option if it has a 'no' prefix */ + if (ares_streq_max(nameptr, "no", 2)) { + is_true = ARES_FALSE; + nameptr += 2; + } + + if (dig_options[opt].separator != 0) { + const char *ptr = strchr(nameptr, dig_options[opt].separator); + if (ptr == NULL) { + namelen = ares_strlen(nameptr); + } else { + namelen = (size_t)(ptr - nameptr); + value = ptr + 1; + } + } else { + namelen = ares_strlen(nameptr); + } + + /* Match name */ + if (dig_options[opt].name != NULL && + !ares_streq_max(nameptr, dig_options[opt].name, namelen)) { + continue; + } + + if (dig_options[opt].name == NULL) { + value = nameptr; + } + + /* We need another argument for the value */ + if (dig_options[opt].type != OPT_TYPE_BOOL && + dig_options[opt].prefix != 0 && dig_options[opt].separator == 0) { + if (arg == argc - 1) { + snprintf(global_config.error, sizeof(global_config.error), + "insufficient arguments for %c%s", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + arg++; + value = argv[arg]; + } + + switch (dig_options[opt].type) { + case OPT_TYPE_BOOL: + { + ares_bool_t *b = dig_options[opt].opt; + if (b == NULL) { + snprintf(global_config.error, sizeof(global_config.error), + "invalid use for %c%s", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + *b = is_true; + } + break; + case OPT_TYPE_STRING: + { + char **str = dig_options[opt].opt; + if (str == NULL) { + snprintf(global_config.error, sizeof(global_config.error), + "invalid use for %c%s", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + if (value == NULL) { + snprintf(global_config.error, sizeof(global_config.error), + "missing value for %c%s", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + if (*str != NULL) { + free(*str); + } + *str = strdup(value); + break; + } + case OPT_TYPE_SIZE_T: + { + size_t *s = dig_options[opt].opt; + if (s == NULL) { + snprintf(global_config.error, sizeof(global_config.error), + "invalid use for %c%s", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + if (value == NULL) { + snprintf(global_config.error, sizeof(global_config.error), + "missing value for %c%s", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + if (!ares_str_isnum(value)) { + snprintf(global_config.error, sizeof(global_config.error), + "%c%s is not a numeric value", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + *s = strtoul(value, NULL, 10); + break; + } + case OPT_TYPE_U16: + { + unsigned short *s = dig_options[opt].opt; + if (s == NULL) { + snprintf(global_config.error, sizeof(global_config.error), + "invalid use for %c%s", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + if (value == NULL) { + snprintf(global_config.error, sizeof(global_config.error), + "missing value for %c%s", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + if (!ares_str_isnum(value)) { + snprintf(global_config.error, sizeof(global_config.error), + "%c%s is not a numeric value", dig_options[opt].prefix, + dig_options[opt].name); + return ARES_FALSE; + } + *s = (unsigned short)strtoul(value, NULL, 10); + break; + } + case OPT_TYPE_FUNC: + if (dig_options[opt].cb == NULL) { + snprintf(global_config.error, sizeof(global_config.error), + "missing callback"); + return ARES_FALSE; + } + if (!dig_options[opt].cb(dig_options[opt].prefix, + dig_options[opt].name, is_true, value)) { + return ARES_FALSE; + } + break; + } + option_handled = ARES_TRUE; + } + + if (!option_handled) { + snprintf(global_config.error, sizeof(global_config.error), + "unrecognized option %s", argv[arg]); + return ARES_FALSE; + } + } + + return ARES_TRUE; +} + +static ares_bool_t read_rcfile(void) +{ + char configdir[PATH_MAX]; + unsigned int cdlen = 0; + +#if !defined(WIN32) +# if !defined(__APPLE__) + char *configdir_xdg; +# endif + char *homedir; +#endif + + char rcfile[PATH_MAX]; + unsigned int rclen; + + size_t rcargc; + char **rcargv; + ares_buf_t *rcbuf; + ares_status_t rcstatus; + +#if defined(WIN32) + cdlen = (unsigned int)snprintf(configdir, sizeof(configdir), "%s/%s", + getenv("APPDATA"), "c-ares"); + +#elif defined(__APPLE__) + homedir = getenv("HOME"); + if (homedir != NULL) { + cdlen = (unsigned int)snprintf(configdir, sizeof(configdir), "%s/%s/%s/%s", + homedir, "Library", "Application Support", + "c-ares"); + } + +#else + configdir_xdg = getenv("XDG_CONFIG_HOME"); + + if (configdir_xdg == NULL) { + homedir = getenv("HOME"); + if (homedir != NULL) { + cdlen = (unsigned int)snprintf(configdir, sizeof(configdir), "%s/%s", + homedir, ".config"); + } + } else { + cdlen = + (unsigned int)snprintf(configdir, sizeof(configdir), "%s", configdir_xdg); + } + +#endif + + DEBUGF(fprintf(stderr, "read_cmdline() configdir: %s\n", configdir)); + + if (cdlen == 0 || cdlen > sizeof(configdir)) { + DEBUGF( + fprintf(stderr, "read_cmdline() skipping rcfile parsing on directory\n")); + return ARES_TRUE; + } + + rclen = + (unsigned int)snprintf(rcfile, sizeof(rcfile), "%s/adigrc", configdir); + + if (rclen > sizeof(rcfile)) { + DEBUGF(fprintf(stderr, "read_cmdline() skipping rcfile parsing on file\n")); + return ARES_TRUE; + } + + rcbuf = ares_buf_create(); + if (ares_buf_load_file(rcfile, rcbuf) == ARES_SUCCESS) { + rcstatus = ares_buf_split_str(rcbuf, (const unsigned char *)"\n ", 2, + ARES_BUF_SPLIT_TRIM, 0, &rcargv, &rcargc); + + if (rcstatus == ARES_SUCCESS) { + read_cmdline((int)rcargc, (const char * const *)rcargv, 0); + + } else { + snprintf(global_config.error, sizeof(global_config.error), + "rcfile is invalid: %s", ares_strerror((int)rcstatus)); + } + + ares_free_array(rcargv, rcargc, ares_free); + + if (rcstatus != ARES_SUCCESS) { + ares_buf_destroy(rcbuf); + return ARES_FALSE; + } + + } else { + DEBUGF(fprintf(stderr, "read_cmdline() failed to load rcfile")); + } + ares_buf_destroy(rcbuf); + + return ARES_TRUE; +} + +static void config_defaults(void) +{ + memset(&global_config, 0, sizeof(global_config)); + + global_config.opts.tries = 3; + global_config.opts.ndots = 1; + global_config.opts.rd_flag = ARES_TRUE; + global_config.opts.edns = ARES_TRUE; + global_config.opts.udp_size = 1232; + global_config.opts.aliases = ARES_TRUE; + global_config.opts.display_class = ARES_TRUE; + global_config.opts.display_ttl = ARES_TRUE; + global_config.opts.display_command = ARES_TRUE; + global_config.opts.display_stats = ARES_TRUE; + global_config.opts.display_question = ARES_TRUE; + global_config.opts.display_answer = ARES_TRUE; + global_config.opts.display_authority = ARES_TRUE; + global_config.opts.display_additional = ARES_TRUE; + global_config.opts.display_comments = ARES_TRUE; + global_config.qclass = ARES_CLASS_IN; + global_config.qtype = ARES_REC_TYPE_A; +} + +static void config_opts(void) +{ + global_config.optmask = ARES_OPT_FLAGS; + if (global_config.opts.tcp) { + global_config.options.flags |= ARES_FLAG_USEVC; + } + if (global_config.opts.primary) { + global_config.options.flags |= ARES_FLAG_PRIMARY; + } + if (global_config.opts.edns) { + global_config.options.flags |= ARES_FLAG_EDNS; + } + if (global_config.opts.stayopen) { + global_config.options.flags |= ARES_FLAG_STAYOPEN; + } + if (global_config.opts.dns0x20) { + global_config.options.flags |= ARES_FLAG_DNS0x20; + } + if (!global_config.opts.aliases) { + global_config.options.flags |= ARES_FLAG_NOALIASES; + } + if (!global_config.opts.rd_flag) { + global_config.options.flags |= ARES_FLAG_NORECURSE; + } + if (!global_config.opts.do_search) { + global_config.options.flags |= ARES_FLAG_NOSEARCH; + } + if (global_config.opts.ignore_tc) { + global_config.options.flags |= ARES_FLAG_IGNTC; + } + if (global_config.opts.port) { + global_config.optmask |= ARES_OPT_UDP_PORT; + global_config.optmask |= ARES_OPT_TCP_PORT; + global_config.options.udp_port = global_config.opts.port; + global_config.options.tcp_port = global_config.opts.port; + } + + global_config.optmask |= ARES_OPT_TRIES; + global_config.options.tries = (int)global_config.opts.tries; + + global_config.optmask |= ARES_OPT_NDOTS; + global_config.options.ndots = (int)global_config.opts.ndots; + + global_config.optmask |= ARES_OPT_EDNSPSZ; + global_config.options.ednspsz = (int)global_config.opts.udp_size; + + if (global_config.opts.search != NULL) { + global_config.optmask |= ARES_OPT_DOMAINS; + global_config.options.domains = &global_config.opts.search; + global_config.options.ndomains = 1; + } +} + +int main(int argc, char **argv) +{ + ares_channel_t *channel = NULL; + ares_status_t status; + int rv = 0; + +#ifdef USE_WINSOCK + WORD wVersionRequested = MAKEWORD(USE_WINSOCK, USE_WINSOCK); + WSADATA wsaData; + WSAStartup(wVersionRequested, &wsaData); +#endif + + status = (ares_status_t)ares_library_init(ARES_LIB_INIT_ALL); + if (status != ARES_SUCCESS) { + fprintf(stderr, "ares_library_init: %s\n", ares_strerror((int)status)); + return 1; + } + + config_defaults(); + + if (!read_cmdline(argc, (const char * const *)argv, 1)) { + printf("\n** ERROR: %s\n\n", global_config.error); + print_help(); + rv = 1; + goto done; + } + + if (global_config.no_rcfile && !read_rcfile()) { + fprintf(stderr, "\n** ERROR: %s\n", global_config.error); + } + + if (global_config.is_help) { + print_help(); + goto done; + } + + if (global_config.name == NULL) { + printf("missing query name\n"); + print_help(); + rv = 1; + goto done; + } + + config_opts(); + + status = (ares_status_t)ares_init_options(&channel, &global_config.options, + global_config.optmask); + if (status != ARES_SUCCESS) { + fprintf(stderr, "ares_init_options: %s\n", ares_strerror((int)status)); + rv = 1; + goto done; + } + + if (global_config.servers) { + status = + (ares_status_t)ares_set_servers_ports_csv(channel, global_config.servers); + if (status != ARES_SUCCESS) { + fprintf(stderr, "ares_set_servers_ports_csv: %s: %s\n", + ares_strerror((int)status), global_config.servers); + rv = 1; + goto done; + } + } + + /* Debug */ + if (global_config.opts.display_command) { + printf("\n; <<>> c-ares DiG %s <<>>", ares_version(NULL)); + printf(" %s", global_config.name); + printf("\n"); + } + + /* Enqueue a query for each separate name */ + status = enqueue_query(channel); + if (status != ARES_SUCCESS) { + fprintf(stderr, "Failed to create query for %s: %s\n", global_config.name, + ares_strerror((int)status)); + rv = 1; + goto done; + } + + /* Process events */ + rv = event_loop(channel); + +done: + free_config(); + ares_destroy(channel); + ares_library_cleanup(); + +#ifdef USE_WINSOCK + WSACleanup(); +#endif + return rv; +} diff --git a/lib/c-ares-1.33.1/src/tools/ahost.c b/lib/c-ares-1.34.4/src/tools/ahost.c similarity index 94% rename from lib/c-ares-1.33.1/src/tools/ahost.c rename to lib/c-ares-1.34.4/src/tools/ahost.c index 73f29002a98..7d1d4a86dc7 100644 --- a/lib/c-ares-1.33.1/src/tools/ahost.c +++ b/lib/c-ares-1.34.4/src/tools/ahost.c @@ -42,20 +42,7 @@ #include "ares_getopt.h" #include "ares_ipv6.h" -#ifndef HAVE_STRDUP -# include "str/ares_str.h" -# define strdup(ptr) ares_strdup(ptr) -#endif - -#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 +#include "ares_str.h" static void callback(void *arg, int status, int timeouts, struct hostent *host); static void ai_callback(void *arg, int status, int timeouts, @@ -111,11 +98,11 @@ int main(int argc, char **argv) options.domains[options.ndomains - 1] = strdup(state.optarg); break; case 't': - if (!strcasecmp(state.optarg, "a")) { + if (ares_strcaseeq(state.optarg, "a")) { addr_family = AF_INET; - } else if (!strcasecmp(state.optarg, "aaaa")) { + } else if (ares_strcaseeq(state.optarg, "aaaa")) { addr_family = AF_INET6; - } else if (!strcasecmp(state.optarg, "u")) { + } else if (ares_strcaseeq(state.optarg, "u")) { addr_family = AF_UNSPEC; } else { usage(); diff --git a/lib/c-ares-1.33.1/src/tools/ares_getopt.c b/lib/c-ares-1.34.4/src/tools/ares_getopt.c similarity index 100% rename from lib/c-ares-1.33.1/src/tools/ares_getopt.c rename to lib/c-ares-1.34.4/src/tools/ares_getopt.c diff --git a/lib/c-ares-1.33.1/src/tools/ares_getopt.h b/lib/c-ares-1.34.4/src/tools/ares_getopt.h similarity index 100% rename from lib/c-ares-1.33.1/src/tools/ares_getopt.h rename to lib/c-ares-1.34.4/src/tools/ares_getopt.h diff --git a/lib/c-ares-1.33.1/test/CMakeLists.txt b/lib/c-ares-1.34.4/test/CMakeLists.txt similarity index 73% rename from lib/c-ares-1.33.1/test/CMakeLists.txt rename to lib/c-ares-1.34.4/test/CMakeLists.txt index 8bed6018442..13f637a83ac 100644 --- a/lib/c-ares-1.33.1/test/CMakeLists.txt +++ b/lib/c-ares-1.34.4/test/CMakeLists.txt @@ -26,6 +26,7 @@ target_include_directories(caresinternal "${PROJECT_BINARY_DIR}/src/lib" "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/src/lib" + "${PROJECT_SOURCE_DIR}/src/lib/include" "${PROJECT_SOURCE_DIR}/include" ) @@ -54,22 +55,40 @@ target_compile_definitions(arestest PRIVATE CARES_NO_DEPRECATED) IF (CARES_BUILD_CONTAINER_TESTS) target_compile_definitions(arestest PRIVATE HAVE_USER_NAMESPACE HAVE_UTS_NAMESPACE) ENDIF () +# Avoid "fatal error C1041: cannot open program database" due to multiple +# targets trying to use the same PDB. /FS does NOT resolve this issue. +set_target_properties(arestest PROPERTIES COMPILE_PDB_NAME arestest.pdb) add_executable(aresfuzz ${FUZZSOURCES}) target_compile_definitions(aresfuzz PRIVATE CARES_NO_DEPRECATED) target_link_libraries(aresfuzz PRIVATE caresinternal) +# Avoid "fatal error C1041: cannot open program database" due to multiple +# targets trying to use the same PDB. /FS does NOT resolve this issue. +set_target_properties(aresfuzz PROPERTIES COMPILE_PDB_NAME aresfuzz.pdb) add_executable(aresfuzzname ${FUZZNAMESOURCES}) target_compile_definitions(aresfuzzname PRIVATE CARES_NO_DEPRECATED) target_link_libraries(aresfuzzname PRIVATE caresinternal) +# Avoid "fatal error C1041: cannot open program database" due to multiple +# targets trying to use the same PDB. /FS does NOT resolve this issue. +set_target_properties(aresfuzzname PROPERTIES COMPILE_PDB_NAME aresfuzzname.pdb) add_executable(dnsdump ${DUMPSOURCES}) target_compile_definitions(dnsdump PRIVATE CARES_NO_DEPRECATED) target_link_libraries(dnsdump PRIVATE caresinternal) +# Avoid "fatal error C1041: cannot open program database" due to multiple +# targets trying to use the same PDB. /FS does NOT resolve this issue. +set_target_properties(dnsdump PROPERTIES COMPILE_PDB_NAME dnsdump.pdb) add_executable(ares_queryloop ${LOOPSOURCES}) target_compile_definitions(ares_queryloop PRIVATE CARES_NO_DEPRECATED) target_link_libraries(ares_queryloop PRIVATE caresinternal) +# Avoid "fatal error C1041: cannot open program database" due to multiple +# targets trying to use the same PDB. /FS does NOT resolve this issue. +set_target_properties(ares_queryloop PROPERTIES COMPILE_PDB_NAME ares_queryloop.pdb) + + + # register tests diff --git a/lib/c-ares-1.33.1/test/Makefile.am b/lib/c-ares-1.34.4/test/Makefile.am similarity index 80% rename from lib/c-ares-1.33.1/test/Makefile.am rename to lib/c-ares-1.34.4/test/Makefile.am index 01a8bc3086a..63d3ac807d6 100644 --- a/lib/c-ares-1.33.1/test/Makefile.am +++ b/lib/c-ares-1.34.4/test/Makefile.am @@ -2,12 +2,13 @@ # SPDX-License-Identifier: MIT AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 -AM_CPPFLAGS += -I$(top_builddir)/include \ - -I$(top_builddir)/src/lib \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/src/lib \ - -I$(top_srcdir)/test \ - -I$(top_builddir)/test \ +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/include \ + -I$(top_srcdir)/test \ + -I$(top_builddir)/test \ -I$(top_builddir) -DCARES_NO_DEPRECATED AM_CXXFLAGS := diff --git a/lib/c-ares-1.33.1/test/Makefile.in b/lib/c-ares-1.34.4/test/Makefile.in similarity index 97% rename from lib/c-ares-1.33.1/test/Makefile.in rename to lib/c-ares-1.34.4/test/Makefile.in index 9a7d9df432c..773b5189524 100644 --- a/lib/c-ares-1.33.1/test/Makefile.in +++ b/lib/c-ares-1.34.4/test/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2024 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -70,8 +70,6 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -am__rm_f = rm -f $(am__rm_f_notfound) -am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -95,7 +93,9 @@ noinst_PROGRAMS = arestest$(EXEEXT) aresfuzz$(EXEEXT) \ aresfuzzname$(EXEEXT) dnsdump$(EXEEXT) ares_queryloop$(EXEEXT) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ + $(top_srcdir)/m4/ares_check_uts_namespace.m4 \ + $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ @@ -105,8 +105,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_user_namespace.m4 \ - $(top_srcdir)/m4/ax_check_uts_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ @@ -335,9 +333,10 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ - { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* @@ -425,7 +424,6 @@ am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ - $$am__collect_skipped_logs \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the @@ -450,11 +448,6 @@ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ -if test -n '$(IGNORE_SKIPPED_LOGS)'; then \ - am__collect_skipped_logs='--collect-skipped-logs no'; \ -else \ - am__collect_skipped_logs=''; \ -fi; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ @@ -510,8 +503,9 @@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ $(PTHREAD_CFLAGS) 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)/test \ - -I$(top_builddir)/test -I$(top_builddir) -DCARES_NO_DEPRECATED + -I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib/include \ + -I$(top_srcdir)/test -I$(top_builddir)/test -I$(top_builddir) \ + -DCARES_NO_DEPRECATED AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ @@ -553,7 +547,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ @@ -620,10 +613,8 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ -am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ @@ -766,8 +757,13 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): clean-noinstPROGRAMS: - $(am__rm_f) $(noinst_PROGRAMS) - test -z "$(EXEEXT)" || $(am__rm_f) $(noinst_PROGRAMS:$(EXEEXT)=) + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list ares_queryloop$(EXEEXT): $(ares_queryloop_OBJECTS) $(ares_queryloop_DEPENDENCIES) $(EXTRA_ares_queryloop_DEPENDENCIES) @rm -f ares_queryloop$(EXEEXT) @@ -829,7 +825,7 @@ distclean-compile: $(am__depfiles_remade): @$(MKDIR_P) $(@D) - @: >>$@ + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) @@ -1302,6 +1298,7 @@ distclean-tags: am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: + $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ @@ -1377,37 +1374,10 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ - output_system_information () \ - { \ - echo; \ - { uname -a | $(AWK) '{ \ - printf "System information (uname -a):"; \ - for (i = 1; i < NF; ++i) \ - { \ - if (i != 2) \ - printf " %s", $$i; \ - } \ - printf "\n"; \ -}'; } 2>&1; \ - if test -r /etc/os-release; then \ - echo "Distribution information (/etc/os-release):"; \ - sed 8q /etc/os-release; \ - elif test -r /etc/issue; then \ - echo "Distribution information (/etc/issue):"; \ - cat /etc/issue; \ - fi; \ - }; \ - please_report () \ - { \ -echo "Some test(s) failed. Please report this to $(PACKAGE_BUGREPORT),"; \ -echo "together with the test-suite.log file (gzipped) and your system"; \ -echo "information. Thanks."; \ - }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ - output_system_information; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ @@ -1427,25 +1397,26 @@ echo "information. Thanks."; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG) for debugging.$${std}";\ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ - please_report | sed -e "s/^/$${col}/" -e s/'$$'/"$${std}"/; \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: - @$(am__rm_f) $(RECHECK_LOGS) - @$(am__rm_f) $(RECHECK_LOGS:.log=.trs) - @$(am__rm_f) $(TEST_SUITE_LOG) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all - @$(am__rm_f) $(TEST_SUITE_LOG) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ @@ -1541,15 +1512,15 @@ install-strip: "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: - -$(am__rm_f) $(TEST_LOGS) - -$(am__rm_f) $(TEST_LOGS:.log=.trs) - -$(am__rm_f) $(TEST_SUITE_LOG) + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: - -$(am__rm_f) $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -1560,7 +1531,7 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/ares-fuzz.Po + -rm -f ./$(DEPDIR)/ares-fuzz.Po -rm -f ./$(DEPDIR)/ares-test-fuzz-name.Po -rm -f ./$(DEPDIR)/ares-test-fuzz.Po -rm -f ./$(DEPDIR)/ares_queryloop.Po @@ -1636,7 +1607,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/ares-fuzz.Po + -rm -f ./$(DEPDIR)/ares-fuzz.Po -rm -f ./$(DEPDIR)/ares-test-fuzz-name.Po -rm -f ./$(DEPDIR)/ares-test-fuzz.Po -rm -f ./$(DEPDIR)/ares_queryloop.Po @@ -1710,10 +1681,3 @@ test: check # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - -# Tell GNU make to disable its built-in pattern rules. -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% diff --git a/lib/c-ares-1.33.1/test/Makefile.inc b/lib/c-ares-1.34.4/test/Makefile.inc similarity index 100% rename from lib/c-ares-1.33.1/test/Makefile.inc rename to lib/c-ares-1.34.4/test/Makefile.inc diff --git a/lib/c-ares-1.33.1/test/Makefile.m32 b/lib/c-ares-1.34.4/test/Makefile.m32 similarity index 95% rename from lib/c-ares-1.33.1/test/Makefile.m32 rename to lib/c-ares-1.34.4/test/Makefile.m32 index 326ac67f3a5..5227f98fbb4 100644 --- a/lib/c-ares-1.33.1/test/Makefile.m32 +++ b/lib/c-ares-1.34.4/test/Makefile.m32 @@ -19,7 +19,7 @@ ARES_SRC_DIR = .. # Where to find the built c-ares static library ARES_BLD_DIR = .. ARESLIB = $(ARES_BLD_DIR)/src/lib/libcares.a -CPPFLAGS = -I$(ARES_SRC_DIR)/include -I$(ARES_SRC_DIR)/src/lib -I$(GTEST_ROOT)/include -DCARES_STATICLIB -DCARES_NO_DEPRECATED +CPPFLAGS = -I$(ARES_SRC_DIR)/include -I$(ARES_SRC_DIR)/src/lib -I$(ARES_SRC_DIR)/src/lib/include -I$(GTEST_ROOT)/include -DCARES_STATICLIB -DCARES_NO_DEPRECATED CXXFLAGS = -Wall $(PTHREAD_CFLAGS) -std=gnu++14 LDFLAGS = LDLIBS = -lws2_32 -liphlpapi diff --git a/lib/c-ares-1.33.1/test/Makefile.msvc b/lib/c-ares-1.34.4/test/Makefile.msvc similarity index 89% rename from lib/c-ares-1.33.1/test/Makefile.msvc rename to lib/c-ares-1.34.4/test/Makefile.msvc index 9c81b6c17b1..e3b788f78e0 100644 --- a/lib/c-ares-1.33.1/test/Makefile.msvc +++ b/lib/c-ares-1.34.4/test/Makefile.msvc @@ -1,17 +1,25 @@ # Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT # -# Permission to use, copy, modify, and distribute this -# software and its documentation for any purpose and without -# fee is hereby granted, provided that the above copyright -# notice appear in all copies and that both that copyright -# notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in -# advertising or publicity pertaining to distribution of the -# software without specific, written prior permission. -# M.I.T. makes no representations about the suitability of -# this software for any purpose. It is provided "as is" -# without express or implied warranty. +# 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. + # ------------------------------------------------------------------------------ # @@ -150,7 +158,7 @@ EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib iphlpapi.lib CC_CMD_REL = cl.exe /nologo $(RTLIB) /DNDEBUG /O2 /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS CC_CMD_DBG = cl.exe /nologo $(RTLIBD) /D_DEBUG /Od /Zi /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /RTCsu -CC_CFLAGS = $(CFLAGS) /I. /I../src/lib /I../include /I $(GTEST_ROOT)/include /W3 /EHsc /FD +CC_CFLAGS = $(CFLAGS) /I. /I../src/lib /I../src/lib/include /I../include /I $(GTEST_ROOT)/include /W3 /EHsc /FD RC_CMD_REL = rc.exe /l 0x409 /d "NDEBUG" RC_CMD_DBG = rc.exe /l 0x409 /d "_DEBUG" diff --git a/lib/c-ares-1.33.1/test/README.md b/lib/c-ares-1.34.4/test/README.md similarity index 59% rename from lib/c-ares-1.33.1/test/README.md rename to lib/c-ares-1.34.4/test/README.md index 6a864767c39..a52bddf65e2 100644 --- a/lib/c-ares-1.33.1/test/README.md +++ b/lib/c-ares-1.34.4/test/README.md @@ -73,80 +73,3 @@ To generate code coverage information: - Generate code coverage output with `make code-coverage-capture` in the library directory (i.e. not in `test/`). - -Fuzzing -------- - -### libFuzzer - -To fuzz the packet parsing code with libFuzzer, follow the main -[libFuzzer instructions](http://llvm.org/docs/LibFuzzer.html): - - - Configure the c-ares library and test suite with a recent Clang and a sanitizer, for example: - - ```console - % export CFLAGS="-fsanitize=fuzzer-no-link,address" - % export CC=clang - % ./configure --disable-shared && make - ``` - - Link each of the fuzzer entrypoints in with `ares-fuzz.cc`: - - ``` - % clang -I.. -c ares-test-fuzz.c - % clang -I.. -c ares-test-fuzz-name.c - % clang++ -fsanitize=fuzzer,address ares-test-fuzz.o ../.libs/libcares.a -o ares-libfuzzer - % clang++ -fsanitize=fuzzer,address ares-test-fuzz-name.o ../.libs/libcares.a -o ares-libfuzzer-name - ``` - - Run the fuzzer using the starting corpus with: - - ```console - % ./ares-libfuzzer fuzzinput/ # OR - % ./ares-libfuzzer-name fuzznames/ - ``` - -### AFL - -To fuzz using AFL, follow the -[AFL quick start guide](http://lcamtuf.coredump.cx/afl/QuickStartGuide.txt): - - - Download and build AFL. - - Configure the c-ares library and test tool to use AFL's compiler wrappers: - - ```console - % export CC=$AFLDIR/afl-gcc - % ./configure --disable-shared && make - % cd test && ./configure && make aresfuzz aresfuzzname - ``` - - - Run the AFL fuzzer against the starting corpus: - - ```console - % mkdir fuzzoutput - % $AFLDIR/afl-fuzz -i fuzzinput -o fuzzoutput -- ./aresfuzz # OR - % $AFLDIR/afl-fuzz -i fuzznames -o fuzzoutput -- ./aresfuzzname - ``` - -### AFL Persistent Mode - -If a recent version of Clang is available, AFL can use its built-in compiler -instrumentation; this configuration also allows the use of a (much) faster -persistent mode, where multiple fuzz inputs are run for each process invocation. - - - Download and build a recent AFL, and run `make` in the `llvm_mode` - subdirectory to ensure that `afl-clang-fast` gets built. - - Configure the c-ares library and test tool to use AFL's clang wrappers that - use compiler instrumentation: - - ```console - % export CC=$AFLDIR/afl-clang-fast - % ./configure --disable-shared && make - % cd test && ./configure && make aresfuzz - ``` - - - Run the AFL fuzzer (in persistent mode) against the starting corpus: - - ```console - % mkdir fuzzoutput - % $AFLDIR/afl-fuzz -i fuzzinput -o fuzzoutput -- ./aresfuzz - ``` - diff --git a/lib/c-ares-1.33.1/test/ares-fuzz.c b/lib/c-ares-1.34.4/test/ares-fuzz.c similarity index 100% rename from lib/c-ares-1.33.1/test/ares-fuzz.c rename to lib/c-ares-1.34.4/test/ares-fuzz.c diff --git a/lib/c-ares-1.33.1/test/ares-test-ai.h b/lib/c-ares-1.34.4/test/ares-test-ai.h similarity index 91% rename from lib/c-ares-1.33.1/test/ares-test-ai.h rename to lib/c-ares-1.34.4/test/ares-test-ai.h index f127fae71ff..090c0888594 100644 --- a/lib/c-ares-1.33.1/test/ares-test-ai.h +++ b/lib/c-ares-1.34.4/test/ares-test-ai.h @@ -39,7 +39,8 @@ class MockChannelTestAI public ::testing::WithParamInterface> { public: MockChannelTestAI() - : MockChannelOptsTest(1, GetParam().first, GetParam().second, false, nullptr, 0) + : MockChannelOptsTest(1, GetParam().first, GetParam().second, false, + nullptr, 0) { } }; @@ -47,7 +48,8 @@ class MockChannelTestAI class MockUDPChannelTestAI : public MockChannelOptsTest, public ::testing::WithParamInterface { public: - MockUDPChannelTestAI() : MockChannelOptsTest(1, GetParam(), false, false, nullptr, 0) + MockUDPChannelTestAI() + : MockChannelOptsTest(1, GetParam(), false, false, nullptr, 0) { } }; @@ -55,7 +57,8 @@ class MockUDPChannelTestAI : public MockChannelOptsTest, class MockTCPChannelTestAI : public MockChannelOptsTest, public ::testing::WithParamInterface { public: - MockTCPChannelTestAI() : MockChannelOptsTest(1, GetParam(), true, false, nullptr, 0) + MockTCPChannelTestAI() + : MockChannelOptsTest(1, GetParam(), true, false, nullptr, 0) { } }; diff --git a/lib/c-ares-1.33.1/test/ares-test-fuzz-name.c b/lib/c-ares-1.34.4/test/ares-test-fuzz-name.c similarity index 72% rename from lib/c-ares-1.33.1/test/ares-test-fuzz-name.c rename to lib/c-ares-1.34.4/test/ares-test-fuzz-name.c index f32d347b752..fece38c903e 100644 --- a/lib/c-ares-1.33.1/test/ares-test-fuzz-name.c +++ b/lib/c-ares-1.34.4/test/ares-test-fuzz-name.c @@ -33,6 +33,11 @@ int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size); +/* Fuzzing on a query name isn't very useful as its already fuzzed as part + * of the normal fuzzing operations. So we'll disable this by default and + * instead use this same fuzzer to validate our URI scheme parsers accessed + * via ares_set_servers_csv() */ +#ifdef USE_LEGACY_FUZZERS /* Entrypoint for Clang's libfuzzer, exercising query creation. */ int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) { @@ -48,3 +53,27 @@ int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) free(name); return 0; } + +#else + +int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) +{ + ares_channel_t *channel = NULL; + char *csv; + + ares_library_init(ARES_LIB_INIT_ALL); + ares_init(&channel); + + /* Need to null-term data */ + csv = malloc(size + 1); + memcpy(csv, data, size); + csv[size] = '\0'; + ares_set_servers_csv(channel, csv); + free(csv); + + ares_destroy(channel); + ares_library_cleanup(); + + return 0; +} +#endif diff --git a/lib/c-ares-1.34.4/test/ares-test-fuzz.c b/lib/c-ares-1.34.4/test/ares-test-fuzz.c new file mode 100644 index 00000000000..6c5fc753069 --- /dev/null +++ b/lib/c-ares-1.34.4/test/ares-test-fuzz.c @@ -0,0 +1,316 @@ +/* MIT License + * + * 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 +#include +#include "ares.h" +#include "include/ares_buf.h" +#include "include/ares_mem.h" + +int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size); + +#ifdef USE_LEGACY_FUZZERS + +/* This implementation calls the legacy c-ares parsers, which historically + * all used different logic and parsing. As of c-ares 1.21.0 these are + * simply wrappers around a single parser, and simply convert the parsed + * DNS response into the data structures the legacy parsers used which is a + * small amount of code and not likely going to vary based on the input data. + * + * Instead, these days, it makes more sense to test the new parser directly + * instead of calling it 10 or 11 times with the same input data to speed up + * the number of iterations per second the fuzzer can perform. + * + * We are keeping this legacy fuzzer test for historic reasons or if someone + * finds them of use. + */ + +int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) +{ + /* Feed the data into each of the ares_parse_*_reply functions. */ + struct hostent *host = NULL; + struct ares_addrttl info[5]; + struct ares_addr6ttl info6[5]; + unsigned char addrv4[4] = { 0x10, 0x20, 0x30, 0x40 }; + struct ares_srv_reply *srv = NULL; + struct ares_mx_reply *mx = NULL; + struct ares_txt_reply *txt = NULL; + struct ares_soa_reply *soa = NULL; + struct ares_naptr_reply *naptr = NULL; + struct ares_caa_reply *caa = NULL; + struct ares_uri_reply *uri = NULL; + int count = 5; + ares_parse_a_reply(data, (int)size, &host, info, &count); + if (host) { + ares_free_hostent(host); + } + + host = NULL; + count = 5; + ares_parse_aaaa_reply(data, (int)size, &host, info6, &count); + if (host) { + ares_free_hostent(host); + } + + host = NULL; + ares_parse_ptr_reply(data, (int)size, addrv4, sizeof(addrv4), AF_INET, &host); + if (host) { + ares_free_hostent(host); + } + + host = NULL; + ares_parse_ns_reply(data, (int)size, &host); + if (host) { + ares_free_hostent(host); + } + + ares_parse_srv_reply(data, (int)size, &srv); + if (srv) { + ares_free_data(srv); + } + + ares_parse_mx_reply(data, (int)size, &mx); + if (mx) { + ares_free_data(mx); + } + + ares_parse_txt_reply(data, (int)size, &txt); + if (txt) { + ares_free_data(txt); + } + + ares_parse_soa_reply(data, (int)size, &soa); + if (soa) { + ares_free_data(soa); + } + + ares_parse_naptr_reply(data, (int)size, &naptr); + if (naptr) { + ares_free_data(naptr); + } + + ares_parse_caa_reply(data, (int)size, &caa); + if (caa) { + ares_free_data(caa); + } + + ares_parse_uri_reply(data, (int)size, &uri); + if (uri) { + ares_free_data(uri); + } + + return 0; +} + +#else + +int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) +{ + ares_dns_record_t *dnsrec = NULL; + char *printdata = NULL; + ares_buf_t *printmsg = NULL; + size_t i; + unsigned char *datadup = NULL; + size_t datadup_len = 0; + + /* There is never a reason to have a size > 65535, it is immediately + * rejected by the parser */ + if (size > 65535) { + return -1; + } + + if (ares_dns_parse(data, size, 0, &dnsrec) != ARES_SUCCESS) { + goto done; + } + + /* Lets test the message fetchers */ + printmsg = ares_buf_create(); + if (printmsg == NULL) { + goto done; + } + + ares_buf_append_str(printmsg, ";; ->>HEADER<<- opcode: "); + ares_buf_append_str( + printmsg, ares_dns_opcode_tostr(ares_dns_record_get_opcode(dnsrec))); + ares_buf_append_str(printmsg, ", status: "); + ares_buf_append_str(printmsg, + ares_dns_rcode_tostr(ares_dns_record_get_rcode(dnsrec))); + ares_buf_append_str(printmsg, ", id: "); + ares_buf_append_num_dec(printmsg, (size_t)ares_dns_record_get_id(dnsrec), 0); + ares_buf_append_str(printmsg, "\n;; flags: "); + ares_buf_append_num_hex(printmsg, (size_t)ares_dns_record_get_flags(dnsrec), + 0); + ares_buf_append_str(printmsg, "; QUERY: "); + ares_buf_append_num_dec(printmsg, ares_dns_record_query_cnt(dnsrec), 0); + ares_buf_append_str(printmsg, ", ANSWER: "); + ares_buf_append_num_dec( + printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ANSWER), 0); + ares_buf_append_str(printmsg, ", AUTHORITY: "); + ares_buf_append_num_dec( + printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_AUTHORITY), 0); + ares_buf_append_str(printmsg, ", ADDITIONAL: "); + ares_buf_append_num_dec( + printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ADDITIONAL), 0); + ares_buf_append_str(printmsg, "\n\n"); + ares_buf_append_str(printmsg, ";; QUESTION SECTION:\n"); + for (i = 0; i < ares_dns_record_query_cnt(dnsrec); i++) { + const char *name; + ares_dns_rec_type_t qtype; + ares_dns_class_t qclass; + + if (ares_dns_record_query_get(dnsrec, i, &name, &qtype, &qclass) != + ARES_SUCCESS) { + goto done; + } + + ares_buf_append_str(printmsg, ";"); + ares_buf_append_str(printmsg, name); + ares_buf_append_str(printmsg, ".\t\t\t"); + ares_buf_append_str(printmsg, ares_dns_class_tostr(qclass)); + ares_buf_append_str(printmsg, "\t"); + ares_buf_append_str(printmsg, ares_dns_rec_type_tostr(qtype)); + ares_buf_append_str(printmsg, "\n"); + } + ares_buf_append_str(printmsg, "\n"); + for (i = ARES_SECTION_ANSWER; i < ARES_SECTION_ADDITIONAL + 1; i++) { + size_t j; + + ares_buf_append_str(printmsg, ";; "); + ares_buf_append_str(printmsg, + ares_dns_section_tostr((ares_dns_section_t)i)); + ares_buf_append_str(printmsg, " SECTION:\n"); + for (j = 0; j < ares_dns_record_rr_cnt(dnsrec, (ares_dns_section_t)i); + j++) { + size_t keys_cnt = 0; + const ares_dns_rr_key_t *keys = NULL; + ares_dns_rr_t *rr = NULL; + size_t k; + + rr = ares_dns_record_rr_get(dnsrec, (ares_dns_section_t)i, j); + ares_buf_append_str(printmsg, ares_dns_rr_get_name(rr)); + ares_buf_append_str(printmsg, ".\t\t\t"); + ares_buf_append_str(printmsg, + ares_dns_class_tostr(ares_dns_rr_get_class(rr))); + ares_buf_append_str(printmsg, "\t"); + ares_buf_append_str(printmsg, + ares_dns_rec_type_tostr(ares_dns_rr_get_type(rr))); + ares_buf_append_str(printmsg, "\t"); + ares_buf_append_num_dec(printmsg, ares_dns_rr_get_ttl(rr), 0); + ares_buf_append_str(printmsg, "\t"); + + keys = ares_dns_rr_get_keys(ares_dns_rr_get_type(rr), &keys_cnt); + for (k = 0; k < keys_cnt; k++) { + char buf[256] = ""; + + ares_buf_append_str(printmsg, ares_dns_rr_key_tostr(keys[k])); + ares_buf_append_str(printmsg, "="); + switch (ares_dns_rr_key_datatype(keys[k])) { + case ARES_DATATYPE_INADDR: + ares_inet_ntop(AF_INET, ares_dns_rr_get_addr(rr, keys[k]), buf, + sizeof(buf)); + ares_buf_append_str(printmsg, buf); + break; + case ARES_DATATYPE_INADDR6: + ares_inet_ntop(AF_INET6, ares_dns_rr_get_addr6(rr, keys[k]), buf, + sizeof(buf)); + ares_buf_append_str(printmsg, buf); + break; + case ARES_DATATYPE_U8: + ares_buf_append_num_dec(printmsg, ares_dns_rr_get_u8(rr, keys[k]), + 0); + break; + case ARES_DATATYPE_U16: + ares_buf_append_num_dec(printmsg, ares_dns_rr_get_u16(rr, keys[k]), + 0); + break; + case ARES_DATATYPE_U32: + ares_buf_append_num_dec(printmsg, ares_dns_rr_get_u32(rr, keys[k]), + 0); + break; + case ARES_DATATYPE_NAME: + case ARES_DATATYPE_STR: + ares_buf_append_byte(printmsg, '"'); + ares_buf_append_str(printmsg, ares_dns_rr_get_str(rr, keys[k])); + ares_buf_append_byte(printmsg, '"'); + break; + case ARES_DATATYPE_BIN: + /* TODO */ + break; + case ARES_DATATYPE_BINP: + { + size_t templen; + ares_buf_append_byte(printmsg, '"'); + ares_buf_append_str(printmsg, (const char *)ares_dns_rr_get_bin( + rr, keys[k], &templen)); + ares_buf_append_byte(printmsg, '"'); + } + break; + case ARES_DATATYPE_ABINP: + { + size_t a; + for (a = 0; a < ares_dns_rr_get_abin_cnt(rr, keys[k]); a++) { + size_t templen; + + if (a != 0) { + ares_buf_append_byte(printmsg, ' '); + } + ares_buf_append_byte(printmsg, '"'); + ares_buf_append_str( + printmsg, + (const char *)ares_dns_rr_get_abin(rr, keys[k], a, &templen)); + ares_buf_append_byte(printmsg, '"'); + } + } + break; + case ARES_DATATYPE_OPT: + /* TODO */ + break; + } + ares_buf_append_str(printmsg, " "); + } + ares_buf_append_str(printmsg, "\n"); + } + } + ares_buf_append_str(printmsg, ";; SIZE: "); + ares_buf_append_num_dec(printmsg, size, 0); + ares_buf_append_str(printmsg, "\n\n"); + + printdata = ares_buf_finish_str(printmsg, NULL); + printmsg = NULL; + + /* Write it back out as a dns message to test writer */ + if (ares_dns_write(dnsrec, &datadup, &datadup_len) != ARES_SUCCESS) { + goto done; + } + +done: + ares_dns_record_destroy(dnsrec); + ares_buf_destroy(printmsg); + ares_free(printdata); + ares_free(datadup); + return 0; +} + +#endif diff --git a/lib/c-ares-1.33.1/test/ares-test-init.cc b/lib/c-ares-1.34.4/test/ares-test-init.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-init.cc rename to lib/c-ares-1.34.4/test/ares-test-init.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-internal.cc b/lib/c-ares-1.34.4/test/ares-test-internal.cc similarity index 60% rename from lib/c-ares-1.33.1/test/ares-test-internal.cc rename to lib/c-ares-1.34.4/test/ares-test-internal.cc index 7539d093b7d..3e3760bf135 100644 --- a/lib/c-ares-1.33.1/test/ares-test-internal.cc +++ b/lib/c-ares-1.34.4/test/ares-test-internal.cc @@ -46,7 +46,7 @@ extern "C" { #include "ares_inet_net_pton.h" #include "ares_data.h" #include "str/ares_strsplit.h" -#include "dsa/ares__htable.h" +#include "dsa/ares_htable.h" #ifdef HAVE_ARPA_INET_H #include @@ -63,6 +63,28 @@ namespace ares { namespace test { #ifndef CARES_SYMBOL_HIDING +TEST_F(LibraryTest, StringLength) { + const char data[] = "test\0test"; + size_t n = sizeof data; + for(size_t i = 0; i < n; ++i) { + EXPECT_EQ(ares_strlen(&data[i]), ares_strnlen(&data[i], n - i)); + } +} + +TEST_F(LibraryTest, StringLengthNullPointer) { + EXPECT_EQ(ares_strlen(NULL), 0); + EXPECT_EQ(ares_strnlen(NULL, 0), 0); + EXPECT_EQ(ares_strnlen(NULL, 1), 0); + EXPECT_EQ(ares_strnlen(NULL, 42), 0); +} + +TEST_F(LibraryTest, StringLengthWithoutNullTerminator) { + std::string data = "test"; + for(size_t i = 0; i < data.length(); ++i) { + EXPECT_EQ(ares_strnlen(data.c_str(), i), i); + } +} + void CheckPtoN4(int size, unsigned int value, const char *input) { struct in_addr a4; a4.s_addr = 0; @@ -71,9 +93,7 @@ void CheckPtoN4(int size, unsigned int value, const char *input) { << " for input " << input; EXPECT_EQ(expected, a4.s_addr) << " for input " << input; } -#endif -#ifndef CARES_SYMBOL_HIDING TEST_F(LibraryTest, Strsplit) { using std::vector; using std::string; @@ -98,7 +118,7 @@ TEST_F(LibraryTest, Strsplit) { }, }; for(size_t i = 0; i < data.inputs.size(); i++) { - char **out = ares__strsplit(data.inputs.at(i).c_str(), + char **out = ares_strsplit(data.inputs.at(i).c_str(), data.delimiters.at(i).c_str(), &n); if(data.expected.at(i).size() == 0) { EXPECT_EQ(out, nullptr); @@ -109,18 +129,14 @@ TEST_F(LibraryTest, Strsplit) { EXPECT_STREQ(out[j], data.expected.at(i).at(j).c_str()); } } - ares__strsplit_free(out, n); + ares_strsplit_free(out, n); } } -#endif -TEST_F(LibraryTest, InetPtoN) { +TEST_F(LibraryTest, InetNetPtoN) { + uint32_t expected; struct in_addr a4; struct in6_addr a6; - -#ifndef CARES_SYMBOL_HIDING - uint32_t expected; - CheckPtoN4(4 * 8, 0x01020304, "1.2.3.4"); CheckPtoN4(4 * 8, 0x81010101, "129.1.1.1"); CheckPtoN4(4 * 8, 0xC0010101, "192.1.1.1"); @@ -220,8 +236,239 @@ TEST_F(LibraryTest, InetPtoN) { EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x0xyz", &a4, 0)); EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "0x1122334", &a4, sizeof(a4) - 1)); EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "253", &a4, sizeof(a4) - 1)); -#endif +} + +TEST_F(LibraryTest, FreeLongChain) { + struct ares_addr_node *data = nullptr; + for (int ii = 0; ii < 100000; ii++) { + struct ares_addr_node *prev = (struct ares_addr_node*)ares_malloc_data(ARES_DATATYPE_ADDR_NODE); + prev->next = data; + data = prev; + } + + ares_free_data(data); +} + +TEST_F(LibraryTest, MallocDataFail) { + EXPECT_EQ(nullptr, ares_malloc_data((ares_datatype)99)); + SetAllocSizeFail(sizeof(struct ares_data)); + EXPECT_EQ(nullptr, ares_malloc_data(ARES_DATATYPE_MX_REPLY)); +} + +TEST(Misc, OnionDomain) { + EXPECT_EQ(0, ares_is_onion_domain("onion.no")); + EXPECT_EQ(0, ares_is_onion_domain(".onion.no")); + EXPECT_EQ(1, ares_is_onion_domain(".onion")); + EXPECT_EQ(1, ares_is_onion_domain(".onion.")); + EXPECT_EQ(1, ares_is_onion_domain("yes.onion")); + EXPECT_EQ(1, ares_is_onion_domain("yes.onion.")); + EXPECT_EQ(1, ares_is_onion_domain("YES.ONION")); + EXPECT_EQ(1, ares_is_onion_domain("YES.ONION.")); +} + +TEST_F(LibraryTest, CatDomain) { + char *s; + + ares_cat_domain("foo", "example.net", &s); + EXPECT_STREQ("foo.example.net", s); + ares_free(s); + + ares_cat_domain("foo", ".", &s); + EXPECT_STREQ("foo.", s); + ares_free(s); + + ares_cat_domain("foo", "example.net.", &s); + EXPECT_STREQ("foo.example.net.", s); + ares_free(s); +} + +TEST_F(LibraryTest, SlistMisuse) { + EXPECT_EQ(NULL, ares_slist_create(NULL, NULL, NULL)); + ares_slist_replace_destructor(NULL, NULL); + EXPECT_EQ(NULL, ares_slist_insert(NULL, NULL)); + EXPECT_EQ(NULL, ares_slist_node_find(NULL, NULL)); + EXPECT_EQ(NULL, ares_slist_node_first(NULL)); + EXPECT_EQ(NULL, ares_slist_node_last(NULL)); + EXPECT_EQ(NULL, ares_slist_node_next(NULL)); + EXPECT_EQ(NULL, ares_slist_node_prev(NULL)); + EXPECT_EQ(NULL, ares_slist_node_val(NULL)); + EXPECT_EQ((size_t)0, ares_slist_len(NULL)); + EXPECT_EQ(NULL, ares_slist_node_parent(NULL)); + EXPECT_EQ(NULL, ares_slist_first_val(NULL)); + EXPECT_EQ(NULL, ares_slist_last_val(NULL)); + EXPECT_EQ(NULL, ares_slist_node_claim(NULL)); +} + +TEST_F(LibraryTest, IfaceIPs) { + ares_status_t status; + ares_iface_ips_t *ips = NULL; + size_t i; + + status = ares_iface_ips(&ips, ARES_IFACE_IP_DEFAULT, NULL); + EXPECT_TRUE(status == ARES_SUCCESS || status == ARES_ENOTIMP); + + /* Not implemented, can't run tests */ + if (status == ARES_ENOTIMP) + return; + + EXPECT_NE(nullptr, ips); + for (i=0; inext = data; - data = prev; - } - - ares_free_data(data); -} - TEST(LibraryInit, StrdupFailures) { EXPECT_EQ(ARES_SUCCESS, ares_library_init(ARES_LIB_INIT_ALL)); char* copy = ares_strdup("string"); @@ -277,12 +512,6 @@ TEST_F(LibraryTest, StrdupFailures) { EXPECT_EQ(nullptr, copy); } -TEST_F(LibraryTest, MallocDataFail) { - EXPECT_EQ(nullptr, ares_malloc_data((ares_datatype)99)); - SetAllocSizeFail(sizeof(struct ares_data)); - EXPECT_EQ(nullptr, ares_malloc_data(ARES_DATATYPE_MX_REPLY)); -} - TEST_F(FileChannelTest, GetAddrInfoHostsPositive) { TempFile hostsfile("1.2.3.4 example.com \n" " 2.3.4.5\tgoogle.com www.google.com\twww2.google.com\n" @@ -291,7 +520,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsPositive) { "1.3.5.7 \n" "::1 ipv6.com"); EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; AddrInfoResult result = {}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; @@ -311,7 +540,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsSpaces) { "1.3.5.7 \n" "::1 ipv6.com"); EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; AddrInfoResult result = {}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; @@ -331,7 +560,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsByALias) { "1.3.5.7 \n" "::1 ipv6.com"); EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; AddrInfoResult result = {}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; @@ -351,7 +580,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsIPV6) { "1.3.5.7 \n" "::1 ipv6.com"); EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; AddrInfoResult result = {}; hints.ai_family = AF_INET6; hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; @@ -393,19 +622,6 @@ TEST_F(FileChannelTest, GetAddrInfoAllocFail) { } } -TEST(Misc, OnionDomain) { - EXPECT_EQ(0, ares__is_onion_domain("onion.no")); - EXPECT_EQ(0, ares__is_onion_domain(".onion.no")); - EXPECT_EQ(1, ares__is_onion_domain(".onion")); - EXPECT_EQ(1, ares__is_onion_domain(".onion.")); - EXPECT_EQ(1, ares__is_onion_domain("yes.onion")); - EXPECT_EQ(1, ares__is_onion_domain("yes.onion.")); - EXPECT_EQ(1, ares__is_onion_domain("YES.ONION")); - EXPECT_EQ(1, ares__is_onion_domain("YES.ONION.")); -} - -#endif - TEST_F(LibraryTest, DNSRecord) { ares_dns_record_t *dnsrec = NULL; ares_dns_rr_t *rr = NULL; @@ -677,13 +893,11 @@ TEST_F(LibraryTest, DNSRecord) { /* Write */ EXPECT_EQ(ARES_SUCCESS, ares_dns_write(dnsrec, &msg, &msglen)); -#ifndef CARES_SYMBOL_HIDING - ares__buf_t *hexdump = ares__buf_create(); - EXPECT_EQ(ARES_SUCCESS, ares__buf_hexdump(hexdump, msg, msglen)); - char *hexdata = ares__buf_finish_str(hexdump, NULL); + ares_buf_t *hexdump = ares_buf_create(); + EXPECT_EQ(ARES_SUCCESS, ares_buf_hexdump(hexdump, msg, msglen)); + char *hexdata = ares_buf_finish_str(hexdump, NULL); //printf("HEXDUMP\n%s", hexdata); ares_free(hexdata); -#endif ares_dns_record_destroy(dnsrec); dnsrec = NULL; @@ -699,125 +913,123 @@ TEST_F(LibraryTest, DNSRecord) { EXPECT_EQ(nscount, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_AUTHORITY)); EXPECT_EQ(arcount, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ADDITIONAL)); -#ifndef CARES_SYMBOL_HIDING /* Iterate and print */ - ares__buf_t *printmsg = ares__buf_create(); - ares__buf_append_str(printmsg, ";; ->>HEADER<<- opcode: "); - ares__buf_append_str(printmsg, ares_dns_opcode_tostr(ares_dns_record_get_opcode(dnsrec))); - ares__buf_append_str(printmsg, ", status: "); - ares__buf_append_str(printmsg, ares_dns_rcode_tostr(ares_dns_record_get_rcode(dnsrec))); - ares__buf_append_str(printmsg, ", id: "); - ares__buf_append_num_dec(printmsg, (size_t)ares_dns_record_get_id(dnsrec), 0); - ares__buf_append_str(printmsg, "\n;; flags: "); - ares__buf_append_num_hex(printmsg, (size_t)ares_dns_record_get_flags(dnsrec), 0); - ares__buf_append_str(printmsg, "; QUERY: "); - ares__buf_append_num_dec(printmsg, ares_dns_record_query_cnt(dnsrec), 0); - ares__buf_append_str(printmsg, ", ANSWER: "); - ares__buf_append_num_dec(printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ANSWER), 0); - ares__buf_append_str(printmsg, ", AUTHORITY: "); - ares__buf_append_num_dec(printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_AUTHORITY), 0); - ares__buf_append_str(printmsg, ", ADDITIONAL: "); - ares__buf_append_num_dec(printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ADDITIONAL), 0); - ares__buf_append_str(printmsg, "\n\n"); - ares__buf_append_str(printmsg, ";; QUESTION SECTION:\n"); + ares_buf_t *printmsg = ares_buf_create(); + ares_buf_append_str(printmsg, ";; ->>HEADER<<- opcode: "); + ares_buf_append_str(printmsg, ares_dns_opcode_tostr(ares_dns_record_get_opcode(dnsrec))); + ares_buf_append_str(printmsg, ", status: "); + ares_buf_append_str(printmsg, ares_dns_rcode_tostr(ares_dns_record_get_rcode(dnsrec))); + ares_buf_append_str(printmsg, ", id: "); + ares_buf_append_num_dec(printmsg, (size_t)ares_dns_record_get_id(dnsrec), 0); + ares_buf_append_str(printmsg, "\n;; flags: "); + ares_buf_append_num_hex(printmsg, (size_t)ares_dns_record_get_flags(dnsrec), 0); + ares_buf_append_str(printmsg, "; QUERY: "); + ares_buf_append_num_dec(printmsg, ares_dns_record_query_cnt(dnsrec), 0); + ares_buf_append_str(printmsg, ", ANSWER: "); + ares_buf_append_num_dec(printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ANSWER), 0); + ares_buf_append_str(printmsg, ", AUTHORITY: "); + ares_buf_append_num_dec(printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_AUTHORITY), 0); + ares_buf_append_str(printmsg, ", ADDITIONAL: "); + ares_buf_append_num_dec(printmsg, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ADDITIONAL), 0); + ares_buf_append_str(printmsg, "\n\n"); + ares_buf_append_str(printmsg, ";; QUESTION SECTION:\n"); for (size_t i = 0; i < ares_dns_record_query_cnt(dnsrec); i++) { const char *name; ares_dns_rec_type_t qtype; ares_dns_class_t qclass; ares_dns_record_query_get(dnsrec, i, &name, &qtype, &qclass); - ares__buf_append_str(printmsg, ";"); - ares__buf_append_str(printmsg, name); - ares__buf_append_str(printmsg, ".\t\t\t"); - ares__buf_append_str(printmsg, ares_dns_class_tostr(qclass)); - ares__buf_append_str(printmsg, "\t"); - ares__buf_append_str(printmsg, ares_dns_rec_type_tostr(qtype)); - ares__buf_append_str(printmsg, "\n"); + ares_buf_append_str(printmsg, ";"); + ares_buf_append_str(printmsg, name); + ares_buf_append_str(printmsg, ".\t\t\t"); + ares_buf_append_str(printmsg, ares_dns_class_tostr(qclass)); + ares_buf_append_str(printmsg, "\t"); + ares_buf_append_str(printmsg, ares_dns_rec_type_tostr(qtype)); + ares_buf_append_str(printmsg, "\n"); } - ares__buf_append_str(printmsg, "\n"); + ares_buf_append_str(printmsg, "\n"); for (size_t i = ARES_SECTION_ANSWER; i < ARES_SECTION_ADDITIONAL + 1; i++) { - ares__buf_append_str(printmsg, ";; "); - ares__buf_append_str(printmsg, ares_dns_section_tostr((ares_dns_section_t)i)); - ares__buf_append_str(printmsg, " SECTION:\n"); + ares_buf_append_str(printmsg, ";; "); + ares_buf_append_str(printmsg, ares_dns_section_tostr((ares_dns_section_t)i)); + ares_buf_append_str(printmsg, " SECTION:\n"); for (size_t j = 0; j < ares_dns_record_rr_cnt(dnsrec, (ares_dns_section_t)i); j++) { rr = ares_dns_record_rr_get(dnsrec, (ares_dns_section_t)i, j); - ares__buf_append_str(printmsg, ares_dns_rr_get_name(rr)); - ares__buf_append_str(printmsg, ".\t\t\t"); - ares__buf_append_str(printmsg, ares_dns_class_tostr(ares_dns_rr_get_class(rr))); - ares__buf_append_str(printmsg, "\t"); - ares__buf_append_str(printmsg, ares_dns_rec_type_tostr(ares_dns_rr_get_type(rr))); - ares__buf_append_str(printmsg, "\t"); - ares__buf_append_num_dec(printmsg, ares_dns_rr_get_ttl(rr), 0); - ares__buf_append_str(printmsg, "\t"); + ares_buf_append_str(printmsg, ares_dns_rr_get_name(rr)); + ares_buf_append_str(printmsg, ".\t\t\t"); + ares_buf_append_str(printmsg, ares_dns_class_tostr(ares_dns_rr_get_class(rr))); + ares_buf_append_str(printmsg, "\t"); + ares_buf_append_str(printmsg, ares_dns_rec_type_tostr(ares_dns_rr_get_type(rr))); + ares_buf_append_str(printmsg, "\t"); + ares_buf_append_num_dec(printmsg, ares_dns_rr_get_ttl(rr), 0); + ares_buf_append_str(printmsg, "\t"); size_t keys_cnt; const ares_dns_rr_key_t *keys = ares_dns_rr_get_keys(ares_dns_rr_get_type(rr), &keys_cnt); for (size_t k = 0; kid = id; - m->buf = ares__buf_create(); - ares__buf_append_be32(m->buf, id); + m->buf = ares_buf_create(); + ares_buf_append_be32(m->buf, id); } static void array_member_destroy(void *mb) { array_member_t *m = (array_member_t *)mb; - ares__buf_destroy(m->buf); + ares_buf_destroy(m->buf); } static int array_sort_cmp(const void *data1, const void *data2) @@ -1144,7 +1331,7 @@ static int array_sort_cmp(const void *data1, const void *data2) } TEST_F(LibraryTest, Array) { - ares__array_t *a = NULL; + ares_array_t *a = NULL; array_member_t *m = NULL; array_member_t mbuf; unsigned int cnt = 0; @@ -1152,28 +1339,34 @@ TEST_F(LibraryTest, Array) { void *ptr = NULL; size_t i; - a = ares__array_create(sizeof(array_member_t), array_member_destroy); + a = ares_array_create(sizeof(array_member_t), array_member_destroy); EXPECT_NE(nullptr, a); + /* Try to sort with no elements, should break out */ + EXPECT_EQ(ARES_SUCCESS, ares_array_sort(a, array_sort_cmp)); + /* Add 8 elements */ for ( ; cnt < 8 ; cnt++) { - EXPECT_EQ(ARES_SUCCESS, ares__array_insert_last(&ptr, a)); + EXPECT_EQ(ARES_SUCCESS, ares_array_insert_last(&ptr, a)); array_member_init(ptr, cnt+1); } + /* Insert at invalid index */ + EXPECT_NE(ARES_SUCCESS, ares_array_insert_at(&ptr, a, 12345678)); + /* Verify count */ - EXPECT_EQ(cnt, ares__array_len(a)); + EXPECT_EQ(cnt, ares_array_len(a)); /* Remove the first 2 elements */ - EXPECT_EQ(ARES_SUCCESS, ares__array_remove_first(a)); - EXPECT_EQ(ARES_SUCCESS, ares__array_remove_first(a)); + EXPECT_EQ(ARES_SUCCESS, ares_array_remove_first(a)); + EXPECT_EQ(ARES_SUCCESS, ares_array_remove_first(a)); removed += 2; /* Verify count */ - EXPECT_EQ(cnt-removed, ares__array_len(a)); + EXPECT_EQ(cnt-removed, ares_array_len(a)); /* Verify id of first element */ - m = (array_member_t *)ares__array_first(a); + m = (array_member_t *)ares_array_first(a); EXPECT_NE(nullptr, m); EXPECT_EQ(3, m->id); @@ -1181,128 +1374,174 @@ TEST_F(LibraryTest, Array) { /* Add 100 total elements, this should force a shift of memory at some * to make sure moves are working */ for ( ; cnt < 100 ; cnt++) { - EXPECT_EQ(ARES_SUCCESS, ares__array_insert_last(&ptr, a)); + EXPECT_EQ(ARES_SUCCESS, ares_array_insert_last(&ptr, a)); array_member_init(ptr, cnt+1); } /* Verify count */ - EXPECT_EQ(cnt-removed, ares__array_len(a)); + EXPECT_EQ(cnt-removed, ares_array_len(a)); /* Remove 2 from the end */ - EXPECT_EQ(ARES_SUCCESS, ares__array_remove_last(a)); - EXPECT_EQ(ARES_SUCCESS, ares__array_remove_last(a)); + EXPECT_EQ(ARES_SUCCESS, ares_array_remove_last(a)); + EXPECT_EQ(ARES_SUCCESS, ares_array_remove_last(a)); removed += 2; /* Verify count */ - EXPECT_EQ(cnt-removed, ares__array_len(a)); + EXPECT_EQ(cnt-removed, ares_array_len(a)); /* Verify expected id of last member */ - m = (array_member_t *)ares__array_last(a); + m = (array_member_t *)ares_array_last(a); EXPECT_NE(nullptr, m); EXPECT_EQ(cnt-2, m->id); /* Remove 3 middle members */ - EXPECT_EQ(ARES_SUCCESS, ares__array_remove_at(a, ares__array_len(a)/2)); - EXPECT_EQ(ARES_SUCCESS, ares__array_remove_at(a, ares__array_len(a)/2)); - EXPECT_EQ(ARES_SUCCESS, ares__array_remove_at(a, ares__array_len(a)/2)); + EXPECT_EQ(ARES_SUCCESS, ares_array_remove_at(a, ares_array_len(a)/2)); + EXPECT_EQ(ARES_SUCCESS, ares_array_remove_at(a, ares_array_len(a)/2)); + EXPECT_EQ(ARES_SUCCESS, ares_array_remove_at(a, ares_array_len(a)/2)); removed += 3; /* Verify count */ - EXPECT_EQ(cnt-removed, ares__array_len(a)); + EXPECT_EQ(cnt-removed, ares_array_len(a)); /* Claim a middle member then re-add it at the same position */ - i = ares__array_len(a) / 2; - EXPECT_EQ(ARES_SUCCESS, ares__array_claim_at(&mbuf, sizeof(mbuf), a, i)); - EXPECT_EQ(ARES_SUCCESS, ares__array_insert_at(&ptr, a, i)); + i = ares_array_len(a) / 2; + EXPECT_EQ(ARES_SUCCESS, ares_array_claim_at(&mbuf, sizeof(mbuf), a, i)); + EXPECT_EQ(ARES_SUCCESS, ares_array_insert_at(&ptr, a, i)); array_member_init(ptr, mbuf.id); array_member_destroy((void *)&mbuf); /* Verify count */ - EXPECT_EQ(cnt-removed, ares__array_len(a)); + EXPECT_EQ(cnt-removed, ares_array_len(a)); /* Iterate across the array, make sure each entry is greater than the last and * the data in the buffer matches the id in the array */ unsigned int last_id = 0; - for (i=0; iid, last_id); last_id = m->id; unsigned int bufval = 0; - ares__buf_tag(m->buf); - EXPECT_EQ(ARES_SUCCESS, ares__buf_fetch_be32(m->buf, &bufval)); - ares__buf_tag_rollback(m->buf); + ares_buf_tag(m->buf); + EXPECT_EQ(ARES_SUCCESS, ares_buf_fetch_be32(m->buf, &bufval)); + ares_buf_tag_rollback(m->buf); EXPECT_EQ(bufval, m->id); } /* add a new element in the middle to the beginning with a high id */ - EXPECT_EQ(ARES_SUCCESS, ares__array_insert_at(&ptr, a, ares__array_len(a)/2)); + EXPECT_EQ(ARES_SUCCESS, ares_array_insert_at(&ptr, a, ares_array_len(a)/2)); array_member_init(ptr, 100000); /* Sort the array */ - EXPECT_EQ(ARES_SUCCESS, ares__array_sort(a, array_sort_cmp)); + EXPECT_EQ(ARES_SUCCESS, ares_array_sort(a, array_sort_cmp)); /* Iterate across the array, make sure each entry is greater than the last and * the data in the buffer matches the id in the array */ last_id = 0; - for (i=0; iid, last_id); last_id = m->id; unsigned int bufval = 0; - ares__buf_tag(m->buf); - EXPECT_EQ(ARES_SUCCESS, ares__buf_fetch_be32(m->buf, &bufval)); - ares__buf_tag_rollback(m->buf); + ares_buf_tag(m->buf); + EXPECT_EQ(ARES_SUCCESS, ares_buf_fetch_be32(m->buf, &bufval)); + ares_buf_tag_rollback(m->buf); EXPECT_EQ(bufval, m->id); } - ares__array_destroy(a); + ares_array_destroy(a); } TEST_F(LibraryTest, HtableVpvp) { - ares__llist_t *l = NULL; - ares__htable_vpvp_t *h = NULL; - ares__llist_node_t *n = NULL; + ares_llist_t *l = NULL; + ares_htable_vpvp_t *h = NULL; + ares_llist_node_t *n = NULL; size_t i; #define VPVP_TABLE_SIZE 1000 - l = ares__llist_create(NULL); + l = ares_llist_create(NULL); EXPECT_NE((void *)NULL, l); - h = ares__htable_vpvp_create(NULL, ares_free); + h = ares_htable_vpvp_create(NULL, ares_free); EXPECT_NE((void *)NULL, h); for (i=0; is = (ares_socket_t)i+1; - EXPECT_NE((void *)NULL, ares__llist_insert_last(l, a)); - EXPECT_TRUE(ares__htable_asvp_insert(h, a->s, a)); + EXPECT_NE((void *)NULL, ares_llist_insert_last(l, a)); + EXPECT_TRUE(ares_htable_asvp_insert(h, a->s, a)); } - EXPECT_EQ(ASVP_TABLE_SIZE, ares__llist_len(l)); - EXPECT_EQ(ASVP_TABLE_SIZE, ares__htable_asvp_num_keys(h)); + EXPECT_EQ(ASVP_TABLE_SIZE, ares_llist_len(l)); + EXPECT_EQ(ASVP_TABLE_SIZE, ares_htable_asvp_num_keys(h)); - n = ares__llist_node_first(l); + n = ares_llist_node_first(l); EXPECT_NE((void *)NULL, n); while (n != NULL) { - ares__llist_node_t *next = ares__llist_node_next(n); - test_htable_asvp_t *a = (test_htable_asvp_t *)ares__llist_node_val(n); + ares_llist_node_t *next = ares_llist_node_next(n); + test_htable_asvp_t *a = (test_htable_asvp_t *)ares_llist_node_val(n); EXPECT_NE((void *)NULL, a); - EXPECT_EQ(a, ares__htable_asvp_get_direct(h, a->s)); - EXPECT_TRUE(ares__htable_asvp_get(h, a->s, NULL)); - EXPECT_TRUE(ares__htable_asvp_remove(h, a->s)); - ares__llist_node_destroy(n); + EXPECT_EQ(a, ares_htable_asvp_get_direct(h, a->s)); + EXPECT_TRUE(ares_htable_asvp_get(h, a->s, NULL)); + EXPECT_TRUE(ares_htable_asvp_remove(h, a->s)); + ares_llist_node_destroy(n); n = next; } - EXPECT_EQ(0, ares__llist_len(l)); - EXPECT_EQ(0, ares__htable_asvp_num_keys(h)); + EXPECT_EQ(0, ares_llist_len(l)); + EXPECT_EQ(0, ares_htable_asvp_num_keys(h)); - ares__llist_destroy(l); - ares__htable_asvp_destroy(h); + ares_llist_destroy(l); + ares_htable_asvp_destroy(h); } @@ -1360,160 +1599,187 @@ typedef struct { } test_htable_szvp_t; TEST_F(LibraryTest, HtableSzvp) { - ares__llist_t *l = NULL; - ares__htable_szvp_t *h = NULL; - ares__llist_node_t *n = NULL; + ares_llist_t *l = NULL; + ares_htable_szvp_t *h = NULL; + ares_llist_node_t *n = NULL; size_t i; #define SZVP_TABLE_SIZE 1000 - l = ares__llist_create(NULL); + l = ares_llist_create(NULL); EXPECT_NE((void *)NULL, l); - h = ares__htable_szvp_create(ares_free); + h = ares_htable_szvp_create(ares_free); EXPECT_NE((void *)NULL, h); for (i=0; is = i+1; - EXPECT_NE((void *)NULL, ares__llist_insert_last(l, s)); - EXPECT_TRUE(ares__htable_szvp_insert(h, s->s, s)); + EXPECT_NE((void *)NULL, ares_llist_insert_last(l, s)); + EXPECT_TRUE(ares_htable_szvp_insert(h, s->s, s)); } - EXPECT_EQ(SZVP_TABLE_SIZE, ares__llist_len(l)); - EXPECT_EQ(SZVP_TABLE_SIZE, ares__htable_szvp_num_keys(h)); + EXPECT_EQ(SZVP_TABLE_SIZE, ares_llist_len(l)); + EXPECT_EQ(SZVP_TABLE_SIZE, ares_htable_szvp_num_keys(h)); - n = ares__llist_node_first(l); + n = ares_llist_node_first(l); EXPECT_NE((void *)NULL, n); while (n != NULL) { - ares__llist_node_t *next = ares__llist_node_next(n); - test_htable_szvp_t *s = (test_htable_szvp_t *)ares__llist_node_val(n); + ares_llist_node_t *next = ares_llist_node_next(n); + test_htable_szvp_t *s = (test_htable_szvp_t *)ares_llist_node_val(n); EXPECT_NE((void *)NULL, s); - EXPECT_EQ(s, ares__htable_szvp_get_direct(h, s->s)); - EXPECT_TRUE(ares__htable_szvp_get(h, s->s, NULL)); - EXPECT_TRUE(ares__htable_szvp_remove(h, s->s)); - ares__llist_node_destroy(n); + EXPECT_EQ(s, ares_htable_szvp_get_direct(h, s->s)); + EXPECT_TRUE(ares_htable_szvp_get(h, s->s, NULL)); + EXPECT_TRUE(ares_htable_szvp_remove(h, s->s)); + ares_llist_node_destroy(n); n = next; } - EXPECT_EQ(0, ares__llist_len(l)); - EXPECT_EQ(0, ares__htable_szvp_num_keys(h)); + EXPECT_EQ(0, ares_llist_len(l)); + EXPECT_EQ(0, ares_htable_szvp_num_keys(h)); - ares__llist_destroy(l); - ares__htable_szvp_destroy(h); + ares_llist_destroy(l); + ares_htable_szvp_destroy(h); } +typedef struct { + char s[32]; +} test_htable_vpstr_t; + +TEST_F(LibraryTest, HtableVpstr) { + ares_llist_t *l = NULL; + ares_htable_vpstr_t *h = NULL; + ares_llist_node_t *n = NULL; + size_t i; + +#define VPSTR_TABLE_SIZE 1000 + + l = ares_llist_create(ares_free); + EXPECT_NE((void *)NULL, l); + + h = ares_htable_vpstr_create(); + EXPECT_NE((void *)NULL, h); + + for (i=0; is, sizeof(s->s), "%d", (int)i); + EXPECT_NE((void *)NULL, ares_llist_insert_last(l, s)); + EXPECT_TRUE(ares_htable_vpstr_insert(h, s, s->s)); + } + + EXPECT_EQ(VPSTR_TABLE_SIZE, ares_llist_len(l)); + EXPECT_EQ(VPSTR_TABLE_SIZE, ares_htable_vpstr_num_keys(h)); + + n = ares_llist_node_first(l); + EXPECT_NE((void *)NULL, n); + while (n != NULL) { + ares_llist_node_t *next = ares_llist_node_next(n); + test_htable_vpstr_t *s = (test_htable_vpstr_t *)ares_llist_node_val(n); + EXPECT_NE((void *)NULL, s); + EXPECT_STREQ(s->s, ares_htable_vpstr_get_direct(h, s)); + EXPECT_TRUE(ares_htable_vpstr_get(h, s, NULL)); + EXPECT_TRUE(ares_htable_vpstr_remove(h, s)); + ares_llist_node_destroy(n); + n = next; + } + + EXPECT_EQ(0, ares_llist_len(l)); + EXPECT_EQ(0, ares_htable_vpstr_num_keys(h)); + + ares_llist_destroy(l); + ares_htable_vpstr_destroy(h); +} + + typedef struct { char s[32]; } test_htable_strvp_t; TEST_F(LibraryTest, HtableStrvp) { - ares__llist_t *l = NULL; - ares__htable_strvp_t *h = NULL; - ares__llist_node_t *n = NULL; + ares_llist_t *l = NULL; + ares_htable_strvp_t *h = NULL; + ares_llist_node_t *n = NULL; size_t i; #define STRVP_TABLE_SIZE 1000 - l = ares__llist_create(NULL); + l = ares_llist_create(NULL); EXPECT_NE((void *)NULL, l); - h = ares__htable_strvp_create(ares_free); + h = ares_htable_strvp_create(ares_free); EXPECT_NE((void *)NULL, h); for (i=0; is, sizeof(s->s), "%d", (int)i); - EXPECT_NE((void *)NULL, ares__llist_insert_last(l, s)); - EXPECT_TRUE(ares__htable_strvp_insert(h, s->s, s)); + EXPECT_NE((void *)NULL, ares_llist_insert_last(l, s)); + EXPECT_TRUE(ares_htable_strvp_insert(h, s->s, s)); } - EXPECT_EQ(STRVP_TABLE_SIZE, ares__llist_len(l)); - EXPECT_EQ(STRVP_TABLE_SIZE, ares__htable_strvp_num_keys(h)); + EXPECT_EQ(STRVP_TABLE_SIZE, ares_llist_len(l)); + EXPECT_EQ(STRVP_TABLE_SIZE, ares_htable_strvp_num_keys(h)); - n = ares__llist_node_first(l); + n = ares_llist_node_first(l); EXPECT_NE((void *)NULL, n); while (n != NULL) { - ares__llist_node_t *next = ares__llist_node_next(n); - test_htable_strvp_t *s = (test_htable_strvp_t *)ares__llist_node_val(n); + ares_llist_node_t *next = ares_llist_node_next(n); + test_htable_strvp_t *s = (test_htable_strvp_t *)ares_llist_node_val(n); EXPECT_NE((void *)NULL, s); - EXPECT_EQ(s, ares__htable_strvp_get_direct(h, s->s)); - EXPECT_TRUE(ares__htable_strvp_get(h, s->s, NULL)); - EXPECT_TRUE(ares__htable_strvp_remove(h, s->s)); - ares__llist_node_destroy(n); + EXPECT_EQ(s, ares_htable_strvp_get_direct(h, s->s)); + EXPECT_TRUE(ares_htable_strvp_get(h, s->s, NULL)); + EXPECT_TRUE(ares_htable_strvp_remove(h, s->s)); + ares_llist_node_destroy(n); n = next; } - EXPECT_EQ(0, ares__llist_len(l)); - EXPECT_EQ(0, ares__htable_strvp_num_keys(h)); + EXPECT_EQ(0, ares_llist_len(l)); + EXPECT_EQ(0, ares_htable_strvp_num_keys(h)); - ares__llist_destroy(l); - ares__htable_strvp_destroy(h); + ares_llist_destroy(l); + ares_htable_strvp_destroy(h); } -TEST_F(LibraryTest, IfaceIPs) { - ares_status_t status; - ares__iface_ips_t *ips = NULL; - size_t i; +TEST_F(LibraryTest, HtableDict) { + ares_htable_dict_t *h = NULL; + size_t i; + char **keys; + size_t nkeys; - status = ares__iface_ips(&ips, ARES_IFACE_IP_DEFAULT, NULL); - EXPECT_TRUE(status == ARES_SUCCESS || status == ARES_ENOTIMP); +#define DICT_TABLE_SIZE 1000 - /* Not implemented, can't run tests */ - if (status == ARES_ENOTIMP) - return; - - EXPECT_NE(nullptr, ips); + h = ares_htable_dict_create(); + EXPECT_NE((void *)NULL, h); - for (i=0; iservers; + ares_slist_t *saved = channel_->servers; channel_->servers = NULL; struct ares_options opts; int optmask = 0; diff --git a/lib/c-ares-1.33.1/test/ares-test-live.cc b/lib/c-ares-1.34.4/test/ares-test-live.cc similarity index 99% rename from lib/c-ares-1.33.1/test/ares-test-live.cc rename to lib/c-ares-1.34.4/test/ares-test-live.cc index 256d48ff8e8..e23dadfe23a 100644 --- a/lib/c-ares-1.33.1/test/ares-test-live.cc +++ b/lib/c-ares-1.34.4/test/ares-test-live.cc @@ -74,7 +74,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") { } //VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoV4) { - //struct ares_addrinfo_hints hints = {}; + //struct ares_addrinfo_hints hints = {0, 0, 0, 0}; //hints.ai_family = AF_INET; //AddrInfoResult result; //ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -86,7 +86,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") { //} //VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoV6) { - //struct ares_addrinfo_hints hints = {}; + //struct ares_addrinfo_hints hints = {0, 0, 0, 0}; //hints.ai_family = AF_INET6; //AddrInfoResult result; //ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -98,7 +98,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") { //} //VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoUnspec) { - //struct ares_addrinfo_hints hints = {}; + //struct ares_addrinfo_hints hints = {0, 0, 0, 0}; //hints.ai_family = AF_UNSPEC; //AddrInfoResult result; //ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); diff --git a/lib/c-ares-1.33.1/test/ares-test-main.cc b/lib/c-ares-1.34.4/test/ares-test-main.cc similarity index 64% rename from lib/c-ares-1.33.1/test/ares-test-main.cc rename to lib/c-ares-1.34.4/test/ares-test-main.cc index f0dfeb5e368..d16f34b10f0 100644 --- a/lib/c-ares-1.33.1/test/ares-test-main.cc +++ b/lib/c-ares-1.34.4/test/ares-test-main.cc @@ -28,6 +28,39 @@ #include "ares-test.h" +#ifdef __APPLE__ +# include +# include +# include + +static void thread_set_realtime(pthread_t pthread) +{ + mach_timebase_info_data_t timebase_info; + const uint64_t NANOS_PER_MSEC = 1000000ULL; + double clock2abs; + int rv; + thread_time_constraint_policy_data_t policy; + + mach_timebase_info(&timebase_info); + clock2abs = ((double)timebase_info.denom / (double)timebase_info.numer) + * NANOS_PER_MSEC; + + policy.period = 0; + policy.computation = (uint32_t)(5 * clock2abs); // 5 ms of work + policy.constraint = (uint32_t)(10 * clock2abs); + policy.preemptible = FALSE; + + rv = thread_policy_set(pthread_mach_thread_np(pthread), + THREAD_TIME_CONSTRAINT_POLICY, + (thread_policy_t)&policy, + THREAD_TIME_CONSTRAINT_POLICY_COUNT); + if (rv != KERN_SUCCESS) { + mach_error("thread_policy_set:", rv); + exit(1); + } +} +#endif + int main(int argc, char* argv[]) { std::vector gtest_argv = {argv[0]}; for (int ii = 1; ii < argc; ii++) { @@ -62,6 +95,15 @@ int main(int argc, char* argv[]) { signal(SIGPIPE, SIG_IGN); #endif +#ifdef __APPLE__ + /* We need to increase the priority in order for some timing-sensitive tests + * to succeed reliably. On CI systems, the host can be overloaded and things + * like sleep timers can wait many multiples of the time specified otherwise. + * This is sort of a necessary hack for test reliability. Not something that + * would generally be used */ + thread_set_realtime(pthread_self()); +#endif + int rc = RUN_ALL_TESTS(); #ifdef WIN32 diff --git a/lib/c-ares-1.33.1/test/ares-test-misc.cc b/lib/c-ares-1.34.4/test/ares-test-misc.cc similarity index 99% rename from lib/c-ares-1.33.1/test/ares-test-misc.cc rename to lib/c-ares-1.34.4/test/ares-test-misc.cc index 5e912aa72c4..783f2c3e388 100644 --- a/lib/c-ares-1.33.1/test/ares-test-misc.cc +++ b/lib/c-ares-1.34.4/test/ares-test-misc.cc @@ -336,7 +336,7 @@ TEST_F(DefaultChannelTest, HostByNameFileOnionDomain) { TEST_F(DefaultChannelTest, GetAddrinfoOnionDomain) { AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_UNSPEC; ares_getaddrinfo(channel_, "dontleak.onion", NULL, &hints, AddrInfoCallback, &result); EXPECT_TRUE(result.done_); diff --git a/lib/c-ares-1.33.1/test/ares-test-mock-ai.cc b/lib/c-ares-1.34.4/test/ares-test-mock-ai.cc similarity index 89% rename from lib/c-ares-1.33.1/test/ares-test-mock-ai.cc rename to lib/c-ares-1.34.4/test/ares-test-mock-ai.cc index b4a4f9926fe..a36918cd64c 100644 --- a/lib/c-ares-1.33.1/test/ares-test-mock-ai.cc +++ b/lib/c-ares-1.34.4/test/ares-test-mock-ai.cc @@ -104,7 +104,7 @@ TEST_P(MockUDPChannelTestAI, GetAddrInfoParallelLookups) { ON_CALL(server_, OnRequest("www.example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp2)); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; AddrInfoResult result1; @@ -145,7 +145,7 @@ TEST_P(MockUDPChannelTestAI, TruncationRetry) { .WillOnce(SetReply(&server_, &rspok)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -162,7 +162,7 @@ TEST_P(MockTCPChannelTestAI, MalformedResponse) { .WillByDefault(SetReplyData(&server_, one)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -180,7 +180,7 @@ TEST_P(MockTCPChannelTestAI, FormErrResponse) { .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -198,7 +198,7 @@ TEST_P(MockTCPChannelTestAI, ServFailResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -216,7 +216,7 @@ TEST_P(MockTCPChannelTestAI, NotImplResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -234,7 +234,7 @@ TEST_P(MockTCPChannelTestAI, RefusedResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -252,7 +252,7 @@ TEST_P(MockTCPChannelTestAI, YXDomainResponse) { .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -295,7 +295,7 @@ TEST_P(MockExtraOptsTestAI, SimpleQuery) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -346,7 +346,7 @@ TEST_P(MockExtraOptsNDots5TestAI, SimpleQuery) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "dynamodb.us-east-1.amazonaws.com.", NULL, &hints, AddrInfoCallback, &result); @@ -392,7 +392,7 @@ TEST_P(MockExtraOptsNDots0TestAI, SimpleQuery) { .WillByDefault(SetReply(&server_, &rsp_ndots0_third)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "ndots0", NULL, &hints, AddrInfoCallback, &result); @@ -551,7 +551,7 @@ TEST_P(MockNoCheckRespChannelTestAI, ServFailResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -569,7 +569,7 @@ TEST_P(MockNoCheckRespChannelTestAI, NotImplResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -587,7 +587,7 @@ TEST_P(MockNoCheckRespChannelTestAI, RefusedResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -606,7 +606,7 @@ TEST_P(MockChannelTestAI, FamilyV6) { ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp6)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET6; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, @@ -633,7 +633,7 @@ TEST_P(MockChannelTestAI, PartialQueryCancel) { AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_UNSPEC; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, AddrInfoCallback, &result); @@ -653,7 +653,7 @@ TEST_P(MockChannelTestAI, FamilyV4) { ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, @@ -673,7 +673,7 @@ TEST_P(MockChannelTestAI, FamilyV4_MultipleAddresses) { ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, @@ -701,7 +701,7 @@ TEST_P(MockChannelTestAI, FamilyUnspecified) { ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_UNSPEC; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, @@ -731,7 +731,7 @@ TEST_P(MockEDNSChannelTestAI, RetryWithoutEDNS) { .WillOnce(SetReply(&server_, &rspok)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -760,7 +760,7 @@ TEST_P(MockChannelTestAI, SearchDomains) { .WillByDefault(SetReply(&server_, &yesthird)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www", NULL, &hints, AddrInfoCallback, &result); @@ -806,7 +806,7 @@ TEST_P(MockChannelTestAI, SearchDomainsServFailOnAAAA) { .WillByDefault(SetReply(&server_, &failthird4)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_UNSPEC; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www", NULL, &hints, AddrInfoCallback, &result); @@ -824,7 +824,7 @@ class MockMultiServerChannelTestAI : MockChannelOptsTest(3, GetParam().first, GetParam().second, false, opts, optmask) {} void CheckExample() { AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.example.com.", NULL, &hints, AddrInfoCallback, &result); @@ -841,6 +841,72 @@ class NoRotateMultiMockTestAI : public MockMultiServerChannelTestAI { NoRotateMultiMockTestAI() : MockMultiServerChannelTestAI(nullptr, ARES_OPT_NOROTATE) {} }; +/* We want to terminate retries of other address classes on getaddrinfo if one + * address class is returned already to return replies faster. + * UPDATE: actually we want to do this only if the address class we received + * was ipv4. We've seen issues if ipv6 was returned but the host was + * really only capable of ipv4. + */ +TEST_P(NoRotateMultiMockTestAI, v4Worksv6Timesout) { + std::vector nothing; + + DNSPacket rsp4; + rsp4.set_response().set_aa() + .add_question(new DNSQuestion("www.example.com", T_A)) + .add_answer(new DNSARR("www.example.com", 0x0100, {0x01, 0x02, 0x03, 0x04})); + + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[0].get(), &rsp4)); + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_AAAA)) + .WillOnce(SetReplyData(servers_[0].get(), nothing)); + + AddrInfoResult result; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; + hints.ai_family = AF_UNSPEC; + hints.ai_flags = ARES_AI_NOSORT; + ares_getaddrinfo(channel_, "www.example.com.", NULL, &hints, AddrInfoCallback, &result); + Process(); + EXPECT_TRUE(result.done_); + EXPECT_EQ(result.status_, ARES_SUCCESS); + EXPECT_THAT(result.ai_, IncludesNumAddresses(1)); + EXPECT_THAT(result.ai_, IncludesV4Address("1.2.3.4")); +} + +TEST_P(NoRotateMultiMockTestAI, v6Worksv4TimesoutFirst) { + std::vector nothing; + + DNSPacket rsp4; + rsp4.set_response().set_aa() + .add_question(new DNSQuestion("www.example.com", T_A)) + .add_answer(new DNSARR("www.example.com", 0x0100, {0x01, 0x02, 0x03, 0x04})); + + DNSPacket rsp6; + rsp6.set_response().set_aa() + .add_question(new DNSQuestion("www.example.com", T_AAAA)) + .add_answer(new DNSAaaaRR("www.example.com", 100, + {0x21, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03})); + + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) + .WillOnce(SetReplyData(servers_[0].get(), nothing)); + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_AAAA)) + .WillOnce(SetReply(servers_[0].get(), &rsp6)); + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[1].get(), &rsp4)); + + AddrInfoResult result; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; + hints.ai_family = AF_UNSPEC; + hints.ai_flags = ARES_AI_NOSORT; + ares_getaddrinfo(channel_, "www.example.com.", NULL, &hints, AddrInfoCallback, &result); + Process(); + EXPECT_TRUE(result.done_); + EXPECT_EQ(result.status_, ARES_SUCCESS); + EXPECT_THAT(result.ai_, IncludesNumAddresses(2)); + EXPECT_THAT(result.ai_, IncludesV4Address("1.2.3.4")); + EXPECT_THAT(result.ai_, IncludesV6Address("2121:0000:0000:0000:0000:0000:0000:0303")); + +} TEST_P(NoRotateMultiMockTestAI, ThirdServer) { struct ares_options opts; @@ -902,7 +968,7 @@ TEST_P(MockChannelTestAI, FamilyV4ServiceName) { ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com", "http", &hints, AddrInfoCallback, &result); diff --git a/lib/c-ares-1.33.1/test/ares-test-mock-et.cc b/lib/c-ares-1.34.4/test/ares-test-mock-et.cc similarity index 92% rename from lib/c-ares-1.33.1/test/ares-test-mock-et.cc rename to lib/c-ares-1.34.4/test/ares-test-mock-et.cc index 1ee15c43791..22f80e890ca 100644 --- a/lib/c-ares-1.33.1/test/ares-test-mock-et.cc +++ b/lib/c-ares-1.34.4/test/ares-test-mock-et.cc @@ -1274,6 +1274,7 @@ TEST_P(MockEventThreadTest, HostAliasUnreadable) { } #endif + class MockMultiServerEventThreadTest : public MockEventThreadOptsTest, public ::testing::WithParamInterface< std::tuple > { @@ -1416,19 +1417,31 @@ TEST_P(NoRotateMultiMockEventThreadTest, ServerNoResponseFailover) { EXPECT_EQ("{'www.example.com' aliases=[] addrs=[2.3.4.5]}", ss4.str()); } -#ifdef __APPLE__ -/* Apple's sleep is no where near accurate, especially on a heavily loaded - * system. Its possible we could set a realtime priority on a thread to - * help with this, but for now, just increase the delay */ -# define SERVER_FAILOVER_RETRY_DELAY 750 -#else +#if defined(_WIN32) # define SERVER_FAILOVER_RETRY_DELAY 500 +#else +# define SERVER_FAILOVER_RETRY_DELAY 330 #endif -class ServerFailoverOptsMockEventThreadTest : public MockMultiServerEventThreadTest { + + +class ServerFailoverOptsMockEventThreadTest + : public MockEventThreadOptsTest, + public ::testing::WithParamInterface > { public: ServerFailoverOptsMockEventThreadTest() - : MockMultiServerEventThreadTest(FillOptions(&opts_), - ARES_OPT_SERVER_FAILOVER | ARES_OPT_NOROTATE) {} + : MockEventThreadOptsTest(4, std::get<0>(GetParam()), std::get<1>(GetParam()), std::get<2>(GetParam()), + FillOptions(&opts_), + ARES_OPT_SERVER_FAILOVER | ARES_OPT_NOROTATE) {} + void CheckExample() { + HostResult result; + ares_gethostbyname(channel_, "www.example.com.", AF_INET, HostCallback, &result); + Process(); + EXPECT_TRUE(result.done_); + std::stringstream ss; + ss << result.host_; + EXPECT_EQ("{'www.example.com' aliases=[] addrs=[2.3.4.5]}", ss.str()); + } + static struct ares_options* FillOptions(struct ares_options *opts) { memset(opts, 0, sizeof(struct ares_options)); opts->server_failover_opts.retry_chance = 1; @@ -1454,15 +1467,15 @@ TEST_P(ServerFailoverOptsMockEventThreadTest, ServerFailoverOpts) { auto tv_now = std::chrono::high_resolution_clock::now(); unsigned int delay_ms; - // 1. If all servers are healthy, then the first server should be selected. + // At start all servers are healthy, first server should be selected if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: First server should be selected" << std::endl; EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &okrsp)); CheckExample(); - // 2. Failed servers should be retried after the retry delay. - // - // Fail server #0 but leave server #1 as healthy. + // Fail server #0 but leave server #1 as healthy. This results in server + // order: + // #1 (failures: 0), #2 (failures: 0), #3 (failures: 0), #0 (failures: 1) tv_now = std::chrono::high_resolution_clock::now(); if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Server0 will fail but leave Server1 as healthy" << std::endl; EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) @@ -1472,25 +1485,32 @@ TEST_P(ServerFailoverOptsMockEventThreadTest, ServerFailoverOpts) { CheckExample(); // Sleep for the retry delay (actually a little more than the retry delay to account - // for unreliable timing, e.g. NTP slew) and send in another query. Server #0 - // should be retried. + // for unreliable timing, e.g. NTP slew) and send in another query. The real + // query will be sent to Server #1 (which will succeed) and Server #0 will + // be probed and return a successful result. This leaves the server order + // of: + // #0 (failures: 0), #1 (failures: 0), #2 (failures: 0), #3 (failures: 0) tv_now = std::chrono::high_resolution_clock::now(); delay_ms = SERVER_FAILOVER_RETRY_DELAY + (SERVER_FAILOVER_RETRY_DELAY / 10); if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: sleep " << delay_ms << "ms" << std::endl; ares_sleep_time(delay_ms); tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Server0 should be past retry delay and should be tried again successfully" << std::endl; + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Server0 should be past retry delay and should be probed (successful), server 1 will respond successful for real query" << std::endl; EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &okrsp)); + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[1].get(), &okrsp)); CheckExample(); - // 3. If there are multiple failed servers, then the servers should be - // retried in sorted order. - // - // Fail all servers for the first round of tries. On the second round server - // #1 responds successfully. + + // Fail all servers for the first round of tries. On the second round, #0 + // responds successfully. This should leave server order of: + // #1 (failures: 0), #2 (failures: 1), #3 (failures: 1), #0 (failures: 2) + // NOTE: A single query being retried won't spawn probes to downed servers, + // only an initial query attempt is eligible to spawn probes. So + // no probes are sent for this test. tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: All 3 servers will fail on the first attempt. On second attempt, Server0 will fail, but Server1 will answer correctly." << std::endl; + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: All 4 servers will fail on the first attempt, server 0 will fail on second. Server 1 will succeed on second." << std::endl; EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); @@ -1499,51 +1519,69 @@ TEST_P(ServerFailoverOptsMockEventThreadTest, ServerFailoverOpts) { .WillOnce(SetReply(servers_[1].get(), &okrsp)); EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &servfailrsp)); + EXPECT_CALL(*servers_[3], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[3].get(), &servfailrsp)); CheckExample(); - // At this point the sorted servers look like [1] (f0) [2] (f1) [0] (f2). - // Sleep for the retry delay and send in another query. Server #2 should be - // retried first, and then server #0. + + // Sleep for the retry delay and send in another query. Server #1 is the + // highest priority server and will respond with success, however a probe + // will be sent for Server #2 which will succeed: + // #1 (failures: 0), #2 (failures: 0), #3 (failures: 1 - expired), #0 (failures: 2 - expired) tv_now = std::chrono::high_resolution_clock::now(); delay_ms = SERVER_FAILOVER_RETRY_DELAY + (SERVER_FAILOVER_RETRY_DELAY / 10); if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: sleep " << delay_ms << "ms" << std::endl; ares_sleep_time(delay_ms); tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Past retry delay, so will choose Server2 and Server0 that are down. Server2 will fail but Server0 will succeed." << std::endl; + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Past retry delay, will query Server 1 and probe Server 2, both will succeed." << std::endl; + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[1].get(), &okrsp)); + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[2].get(), &okrsp)); + CheckExample(); + + // Cause another server to fail so we have at least one non-expired failed + // server and one expired failed server. #1 is highest priority, which we + // will fail, #2 will succeed, and #3 will be probed and succeed: + // #2 (failures: 0), #3 (failures: 0), #1 (failures: 1 not expired), #0 (failures: 2 expired) + tv_now = std::chrono::high_resolution_clock::now(); + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Will query Server 1 and fail, Server 2 will answer successfully. Server 3 will be probed and succeed." << std::endl; + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[1].get(), &servfailrsp)); EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[2].get(), &servfailrsp)); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[0].get(), &okrsp)); + .WillOnce(SetReply(servers_[2].get(), &okrsp)); + EXPECT_CALL(*servers_[3], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[3].get(), &okrsp)); CheckExample(); - // Test might take a while to run and the sleep may not be accurate, so we - // want to track this interval otherwise we may not pass the last test case - // on slow systems. + // We need to make sure that if there is a failed server that is higher priority + // but not yet expired that it will probe the next failed server instead. + // In this case #2 is the server that the query will go to and succeed, and + // then a probe will be sent for #0 (since #1 is not expired) and succeed. We + // will sleep for 1/4 the retry duration before spawning the queries so we can + // then sleep for the rest for the follow-up test. This will leave the servers + // in this state: + // #0 (failures: 0), #2 (failures: 0), #3 (failures: 0), #1 (failures: 1 not expired) + tv_now = std::chrono::high_resolution_clock::now(); + + // We need to track retry delay time to know what is expired when. auto elapse_start = tv_now; - // 4. If there are multiple failed servers, then servers which have not yet - // met the retry delay should be skipped. - // - // The sorted servers currently look like [0] (f0) [1] (f0) [2] (f2) and - // server #2 has just been retried. - // Sleep for 1/2 the retry delay and trigger a failure on server #0. - tv_now = std::chrono::high_resolution_clock::now(); - delay_ms = (SERVER_FAILOVER_RETRY_DELAY/2); + delay_ms = (SERVER_FAILOVER_RETRY_DELAY/4); if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: sleep " << delay_ms << "ms" << std::endl; ares_sleep_time(delay_ms); tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Retry delay has not been hit yet. Server0 was last successful, so should be tried first (and will fail), Server1 is also healthy so will respond." << std::endl; + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Retry delay has not been hit yet. Server2 will be queried and succeed. Server 0 (not server 1 due to non-expired retry delay) will be probed and succeed." << std::endl; + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[2].get(), &okrsp)); EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[1].get(), &okrsp)); + .WillOnce(SetReply(servers_[0].get(), &okrsp)); CheckExample(); - // The sorted servers now look like [1] (f0) [0] (f1) [2] (f2). Server #0 - // has just failed whilst server #2 is somewhere in its retry delay. - // Sleep until we know server #2s retry delay has elapsed but Server #0 has - // not. + // Finally we sleep for the remainder of the retry delay, send another + // query, which should succeed on Server #0, and also probe Server #1 which + // will also succeed. tv_now = std::chrono::high_resolution_clock::now(); unsigned int elapsed_time = (unsigned int)std::chrono::duration_cast(tv_now - elapse_start).count(); @@ -1556,9 +1594,9 @@ TEST_P(ServerFailoverOptsMockEventThreadTest, ServerFailoverOpts) { ares_sleep_time(delay_ms); } tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Retry delay has expired on Server2 but not Server0, will try on Server2 and fail, then Server1 will answer" << std::endl; - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[2].get(), &servfailrsp)); + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Retry delay has expired on Server1, Server 0 will be queried and succeed, Server 1 will be probed and succeed." << std::endl; + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[0].get(), &okrsp)); EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), &okrsp)); CheckExample(); diff --git a/lib/c-ares-1.33.1/test/ares-test-mock.cc b/lib/c-ares-1.34.4/test/ares-test-mock.cc similarity index 92% rename from lib/c-ares-1.33.1/test/ares-test-mock.cc rename to lib/c-ares-1.34.4/test/ares-test-mock.cc index 46a5780ae40..d53d04d0760 100644 --- a/lib/c-ares-1.33.1/test/ares-test-mock.cc +++ b/lib/c-ares-1.34.4/test/ares-test-mock.cc @@ -790,6 +790,29 @@ TEST_P(MockEDNSChannelTest, RetryWithoutEDNS) { EXPECT_EQ("{'www.google.com' aliases=[] addrs=[1.2.3.4]}", ss.str()); } + +// Issue #911 +TEST_P(MockUDPChannelTest, RetryWithoutEDNSNonCompliant) { + DNSPacket rspfail; + rspfail.set_response().set_aa().set_rcode(FORMERR) + .add_question(new DNSQuestion("www.google.com", T_A)) + .add_additional(new DNSOptRR(0, 0, 0, 1280, { }, { }, false)); + DNSPacket rspok; + rspok.set_response() + .add_question(new DNSQuestion("www.google.com", T_A)) + .add_answer(new DNSARR("www.google.com", 100, {1, 2, 3, 4})); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) + .WillOnce(SetReply(&server_, &rspfail)) + .WillOnce(SetReply(&server_, &rspok)); + HostResult result; + ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); + Process(); + EXPECT_TRUE(result.done_); + std::stringstream ss; + ss << result.host_; + EXPECT_EQ("{'www.google.com' aliases=[] addrs=[1.2.3.4]}", ss.str()); +} + TEST_P(MockChannelTest, SearchDomains) { DNSPacket nofirst; nofirst.set_response().set_aa().set_rcode(NXDOMAIN) @@ -900,6 +923,46 @@ TEST_P(CacheQueriesTest, BlankName) { EXPECT_EQ(0, cacheresult.timeouts_); } +TEST_P(CacheQueriesTest, SearchDomainsCache) { + DNSPacket nofirst; + nofirst.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.first.com", T_A)) + .add_auth(new DNSSoaRR("first.com", 600, "ns1.first.com", "admin.first.com", 123456, 3600, 3600, 3600, 3600)); + EXPECT_CALL(server_, OnRequest("www.first.com", T_A)) + .WillOnce(SetReply(&server_, &nofirst)); + DNSPacket nosecond; + nosecond.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.second.org", T_A)) + .add_auth(new DNSSoaRR("second.org", 600, "ns1.second.org", "admin.second.org", 123456, 3600, 3600, 3600, 3600)); + EXPECT_CALL(server_, OnRequest("www.second.org", T_A)) + .WillOnce(SetReply(&server_, &nosecond)); + DNSPacket yesthird; + yesthird.set_response().set_aa() + .add_question(new DNSQuestion("www.third.gov", T_A)) + .add_answer(new DNSARR("www.third.gov", 0x0200, {2, 3, 4, 5})); + EXPECT_CALL(server_, OnRequest("www.third.gov", T_A)) + .WillOnce(SetReply(&server_, &yesthird)); + + // First pass through should send the queries. The EXPECT_CALL .WillOnce + // will make sure this only happens once (vs ON_CALL .WillByDefault) + HostResult result; + ares_gethostbyname(channel_, "www", AF_INET, HostCallback, &result); + Process(); + EXPECT_TRUE(result.done_); + std::stringstream ss; + ss << result.host_; + EXPECT_EQ("{'www.third.gov' aliases=[] addrs=[2.3.4.5]}", ss.str()); + + // This pass should be fully served by cache and yield the same result + HostResult cacheresult; + ares_gethostbyname(channel_, "www", AF_INET, HostCallback, &cacheresult); + Process(); + EXPECT_TRUE(cacheresult.done_); + std::stringstream sscache; + sscache << cacheresult.host_; + EXPECT_EQ("{'www.third.gov' aliases=[] addrs=[2.3.4.5]}", sscache.str()); +} + // Relies on retries so is UDP-only TEST_P(MockUDPChannelTest, SearchDomainsWithResentReply) { DNSPacket nofirst; @@ -2091,21 +2154,30 @@ TEST_P(NoRotateMultiMockTest, ServerNoResponseFailover) { EXPECT_EQ("{'www.example.com' aliases=[] addrs=[2.3.4.5]}", ss4.str()); } -#ifdef __APPLE__ -/* Apple's sleep is no where near accurate, especially on a heavily loaded - * system. Its possible we could set a realtime priority on a thread to - * help with this, but for now, just increase the delay */ -# define SERVER_FAILOVER_RETRY_DELAY 750 -#elif defined(_WIN32) +#if defined(_WIN32) # define SERVER_FAILOVER_RETRY_DELAY 500 #else -# define SERVER_FAILOVER_RETRY_DELAY 250 +# define SERVER_FAILOVER_RETRY_DELAY 330 #endif -class ServerFailoverOptsMultiMockTest : public MockMultiServerChannelTest { + +class ServerFailoverOptsMultiMockTest + : public MockChannelOptsTest, + public ::testing::WithParamInterface< std::pair > { public: ServerFailoverOptsMultiMockTest() - : MockMultiServerChannelTest(FillOptions(&opts_), - ARES_OPT_SERVER_FAILOVER | ARES_OPT_NOROTATE) {} + : MockChannelOptsTest(4, GetParam().first, GetParam().second, false, + FillOptions(&opts_), + ARES_OPT_SERVER_FAILOVER | ARES_OPT_NOROTATE) {} + void CheckExample() { + HostResult result; + ares_gethostbyname(channel_, "www.example.com.", AF_INET, HostCallback, &result); + Process(); + EXPECT_TRUE(result.done_); + std::stringstream ss; + ss << result.host_; + EXPECT_EQ("{'www.example.com' aliases=[] addrs=[2.3.4.5]}", ss.str()); + } + static struct ares_options* FillOptions(struct ares_options *opts) { memset(opts, 0, sizeof(struct ares_options)); opts->server_failover_opts.retry_chance = 1; @@ -2116,6 +2188,7 @@ class ServerFailoverOptsMultiMockTest : public MockMultiServerChannelTest { struct ares_options opts_; }; + // Test case to trigger server failover behavior. We use a retry chance of // 100% and a retry delay so that we can test behavior reliably. TEST_P(ServerFailoverOptsMultiMockTest, ServerFailoverOpts) { @@ -2131,15 +2204,15 @@ TEST_P(ServerFailoverOptsMultiMockTest, ServerFailoverOpts) { auto tv_now = std::chrono::high_resolution_clock::now(); unsigned int delay_ms; - // 1. If all servers are healthy, then the first server should be selected. + // At start all servers are healthy, first server should be selected if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: First server should be selected" << std::endl; EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &okrsp)); CheckExample(); - // 2. Failed servers should be retried after the retry delay. - // - // Fail server #0 but leave server #1 as healthy. + // Fail server #0 but leave server #1 as healthy. This results in server + // order: + // #1 (failures: 0), #2 (failures: 0), #3 (failures: 0), #0 (failures: 1) tv_now = std::chrono::high_resolution_clock::now(); if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Server0 will fail but leave Server1 as healthy" << std::endl; EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) @@ -2149,25 +2222,32 @@ TEST_P(ServerFailoverOptsMultiMockTest, ServerFailoverOpts) { CheckExample(); // Sleep for the retry delay (actually a little more than the retry delay to account - // for unreliable timing, e.g. NTP slew) and send in another query. Server #0 - // should be retried. + // for unreliable timing, e.g. NTP slew) and send in another query. The real + // query will be sent to Server #1 (which will succeed) and Server #0 will + // be probed and return a successful result. This leaves the server order + // of: + // #0 (failures: 0), #1 (failures: 0), #2 (failures: 0), #3 (failures: 0) tv_now = std::chrono::high_resolution_clock::now(); delay_ms = SERVER_FAILOVER_RETRY_DELAY + (SERVER_FAILOVER_RETRY_DELAY / 10); if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: sleep " << delay_ms << "ms" << std::endl; ares_sleep_time(delay_ms); tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Server0 should be past retry delay and should be tried again successfully" << std::endl; + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Server0 should be past retry delay and should be probed (successful), server 1 will respond successful for real query" << std::endl; EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &okrsp)); + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[1].get(), &okrsp)); CheckExample(); - // 3. If there are multiple failed servers, then the servers should be - // retried in sorted order. - // - // Fail all servers for the first round of tries. On the second round server - // #1 responds successfully. + + // Fail all servers for the first round of tries. On the second round, #0 + // responds successfully. This should leave server order of: + // #1 (failures: 0), #2 (failures: 1), #3 (failures: 1), #0 (failures: 2) + // NOTE: A single query being retried won't spawn probes to downed servers, + // only an initial query attempt is eligible to spawn probes. So + // no probes are sent for this test. tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: All 3 servers will fail on the first attempt. On second attempt, Server0 will fail, but Server1 will answer correctly." << std::endl; + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: All 4 servers will fail on the first attempt, server 0 will fail on second. Server 1 will succeed on second." << std::endl; EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); @@ -2176,51 +2256,69 @@ TEST_P(ServerFailoverOptsMultiMockTest, ServerFailoverOpts) { .WillOnce(SetReply(servers_[1].get(), &okrsp)); EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &servfailrsp)); + EXPECT_CALL(*servers_[3], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[3].get(), &servfailrsp)); CheckExample(); - // At this point the sorted servers look like [1] (f0) [2] (f1) [0] (f2). - // Sleep for the retry delay and send in another query. Server #2 should be - // retried first, and then server #0. + + // Sleep for the retry delay and send in another query. Server #1 is the + // highest priority server and will respond with success, however a probe + // will be sent for Server #2 which will succeed: + // #1 (failures: 0), #2 (failures: 0), #3 (failures: 1 - expired), #0 (failures: 2 - expired) tv_now = std::chrono::high_resolution_clock::now(); delay_ms = SERVER_FAILOVER_RETRY_DELAY + (SERVER_FAILOVER_RETRY_DELAY / 10); if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: sleep " << delay_ms << "ms" << std::endl; ares_sleep_time(delay_ms); tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Past retry delay, so will choose Server2 and Server0 that are down. Server2 will fail but Server0 will succeed." << std::endl; + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Past retry delay, will query Server 1 and probe Server 2, both will succeed." << std::endl; + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[1].get(), &okrsp)); + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[2].get(), &okrsp)); + CheckExample(); + + // Cause another server to fail so we have at least one non-expired failed + // server and one expired failed server. #1 is highest priority, which we + // will fail, #2 will succeed, and #3 will be probed and succeed: + // #2 (failures: 0), #3 (failures: 0), #1 (failures: 1 not expired), #0 (failures: 2 expired) + tv_now = std::chrono::high_resolution_clock::now(); + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Will query Server 1 and fail, Server 2 will answer successfully. Server 3 will be probed and succeed." << std::endl; + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[1].get(), &servfailrsp)); EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[2].get(), &servfailrsp)); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[0].get(), &okrsp)); + .WillOnce(SetReply(servers_[2].get(), &okrsp)); + EXPECT_CALL(*servers_[3], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[3].get(), &okrsp)); CheckExample(); - // Test might take a while to run and the sleep may not be accurate, so we - // want to track this interval otherwise we may not pass the last test case - // on slow systems. + // We need to make sure that if there is a failed server that is higher priority + // but not yet expired that it will probe the next failed server instead. + // In this case #2 is the server that the query will go to and succeed, and + // then a probe will be sent for #0 (since #1 is not expired) and succeed. We + // will sleep for 1/4 the retry duration before spawning the queries so we can + // then sleep for the rest for the follow-up test. This will leave the servers + // in this state: + // #0 (failures: 0), #2 (failures: 0), #3 (failures: 0), #1 (failures: 1 not expired) + tv_now = std::chrono::high_resolution_clock::now(); + + // We need to track retry delay time to know what is expired when. auto elapse_start = tv_now; - // 4. If there are multiple failed servers, then servers which have not yet - // met the retry delay should be skipped. - // - // The sorted servers currently look like [0] (f0) [1] (f0) [2] (f2) and - // server #2 has just been retried. - // Sleep for 1/2 the retry delay and trigger a failure on server #0. - tv_now = std::chrono::high_resolution_clock::now(); - delay_ms = (SERVER_FAILOVER_RETRY_DELAY/2); + delay_ms = (SERVER_FAILOVER_RETRY_DELAY/4); if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: sleep " << delay_ms << "ms" << std::endl; ares_sleep_time(delay_ms); tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Retry delay has not been hit yet. Server0 was last successful, so should be tried first (and will fail), Server1 is also healthy so will respond." << std::endl; + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Retry delay has not been hit yet. Server2 will be queried and succeed. Server 0 (not server 1 due to non-expired retry delay) will be probed and succeed." << std::endl; + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[2].get(), &okrsp)); EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[1].get(), &okrsp)); + .WillOnce(SetReply(servers_[0].get(), &okrsp)); CheckExample(); - // The sorted servers now look like [1] (f0) [0] (f1) [2] (f2). Server #0 - // has just failed whilst server #2 is somewhere in its retry delay. - // Sleep until we know server #2s retry delay has elapsed but Server #0 has - // not. + // Finally we sleep for the remainder of the retry delay, send another + // query, which should succeed on Server #0, and also probe Server #1 which + // will also succeed. tv_now = std::chrono::high_resolution_clock::now(); unsigned int elapsed_time = (unsigned int)std::chrono::duration_cast(tv_now - elapse_start).count(); @@ -2233,9 +2331,9 @@ TEST_P(ServerFailoverOptsMultiMockTest, ServerFailoverOpts) { ares_sleep_time(delay_ms); } tv_now = std::chrono::high_resolution_clock::now(); - if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Retry delay has expired on Server2 but not Server0, will try on Server2 and fail, then Server1 will answer" << std::endl; - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) - .WillOnce(SetReply(servers_[2].get(), &servfailrsp)); + if (verbose) std::cerr << std::chrono::duration_cast(tv_now - tv_begin).count() << "ms: Retry delay has expired on Server1, Server 0 will be queried and succeed, Server 1 will be probed and succeed." << std::endl; + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) + .WillOnce(SetReply(servers_[0].get(), &okrsp)); EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), &okrsp)); CheckExample(); diff --git a/lib/c-ares-1.33.1/test/ares-test-ns.cc b/lib/c-ares-1.34.4/test/ares-test-ns.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-ns.cc rename to lib/c-ares-1.34.4/test/ares-test-ns.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-a.cc b/lib/c-ares-1.34.4/test/ares-test-parse-a.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-a.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-a.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-aaaa.cc b/lib/c-ares-1.34.4/test/ares-test-parse-aaaa.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-aaaa.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-aaaa.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-caa.cc b/lib/c-ares-1.34.4/test/ares-test-parse-caa.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-caa.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-caa.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-mx.cc b/lib/c-ares-1.34.4/test/ares-test-parse-mx.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-mx.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-mx.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-naptr.cc b/lib/c-ares-1.34.4/test/ares-test-parse-naptr.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-naptr.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-naptr.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-ns.cc b/lib/c-ares-1.34.4/test/ares-test-parse-ns.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-ns.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-ns.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-ptr.cc b/lib/c-ares-1.34.4/test/ares-test-parse-ptr.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-ptr.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-ptr.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-soa-any.cc b/lib/c-ares-1.34.4/test/ares-test-parse-soa-any.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-soa-any.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-soa-any.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-soa.cc b/lib/c-ares-1.34.4/test/ares-test-parse-soa.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-soa.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-soa.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-srv.cc b/lib/c-ares-1.34.4/test/ares-test-parse-srv.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-srv.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-srv.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-txt.cc b/lib/c-ares-1.34.4/test/ares-test-parse-txt.cc similarity index 86% rename from lib/c-ares-1.33.1/test/ares-test-parse-txt.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-txt.cc index 173d0bded06..07b77adb991 100644 --- a/lib/c-ares-1.33.1/test/ares-test-parse-txt.cc +++ b/lib/c-ares-1.34.4/test/ares-test-parse-txt.cc @@ -38,7 +38,7 @@ TEST_F(LibraryTest, ParseTxtReplyOK) { std::string expected2a = "txt2a"; std::string expected2b("ABC\0ABC", 7); pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", T_MX)) + .add_question(new DNSQuestion("example.com", T_TXT)) .add_answer(new DNSTxtRR("example.com", 100, {expected1})) .add_answer(new DNSTxtRR("example.com", 100, {expected2a, expected2b})); std::vector data = pkt.data(); @@ -68,7 +68,7 @@ TEST_F(LibraryTest, ParseTxtExtReplyOK) { std::string expected2a = "txt2a"; std::string expected2b("ABC\0ABC", 7); pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", T_MX)) + .add_question(new DNSQuestion("example.com", T_TXT)) .add_answer(new DNSTxtRR("example.com", 100, {expected1})) .add_answer(new DNSTxtRR("example.com", 100, {expected2a, expected2b})); std::vector data = pkt.data(); @@ -95,6 +95,39 @@ TEST_F(LibraryTest, ParseTxtExtReplyOK) { ares_free_data(txt); } +TEST_F(LibraryTest, ParseTxtEmpty) { + DNSPacket pkt; + std::string expected1 = ""; + pkt.set_qid(0x1234).set_response().set_aa() + .add_question(new DNSQuestion("example.com", T_TXT)) + .add_answer(new DNSTxtRR("example.com", 100, {expected1})); + std::vector data = pkt.data(); + + ares_dns_record_t *dnsrec = NULL; + ares_dns_rr_t *rr = NULL; + EXPECT_EQ(ARES_SUCCESS, ares_dns_parse(data.data(), data.size(), 0, &dnsrec)); + EXPECT_EQ(1, ares_dns_record_rr_cnt(dnsrec, ARES_SECTION_ANSWER)); + rr = ares_dns_record_rr_get(dnsrec, ARES_SECTION_ANSWER, 0); + ASSERT_NE(nullptr, rr); + EXPECT_EQ(ARES_REC_TYPE_TXT, ares_dns_rr_get_type(rr)); + + size_t txtdata_len; + const unsigned char *txtdata; + + /* Using array methodology */ + EXPECT_EQ(1, ares_dns_rr_get_abin_cnt(rr, ARES_RR_TXT_DATA)); + txtdata = ares_dns_rr_get_abin(rr, ARES_RR_TXT_DATA, 0, &txtdata_len); + EXPECT_EQ(txtdata_len, 0); + EXPECT_NE(nullptr, txtdata); + + /* Using combined methodology */ + txtdata = ares_dns_rr_get_bin(rr, ARES_RR_TXT_DATA, &txtdata_len); + EXPECT_EQ(txtdata_len, 0); + EXPECT_NE(nullptr, txtdata); + + ares_dns_record_destroy(dnsrec); dnsrec = NULL; +} + TEST_F(LibraryTest, ParseTxtMalformedReply1) { std::vector data = { 0x12, 0x34, // qid @@ -213,7 +246,7 @@ TEST_F(LibraryTest, ParseTxtReplyErrors) { std::string expected2a = "txt2a"; std::string expected2b = "txt2b"; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", T_MX)) + .add_question(new DNSQuestion("example.com", T_TXT)) .add_answer(new DNSTxtRR("example.com", 100, {expected1})) .add_answer(new DNSTxtRR("example.com", 100, {expected1})) .add_answer(new DNSTxtRR("example.com", 100, {expected2a, expected2b})); @@ -227,7 +260,7 @@ TEST_F(LibraryTest, ParseTxtReplyErrors) { txt = nullptr; EXPECT_EQ(ARES_EBADRESP, ares_parse_txt_reply(data.data(), (int)data.size(), &txt)); EXPECT_EQ(nullptr, txt); - pkt.add_question(new DNSQuestion("example.com", T_MX)); + pkt.add_question(new DNSQuestion("example.com", T_TXT)); #ifdef DISABLED // Question != answer @@ -240,13 +273,13 @@ TEST_F(LibraryTest, ParseTxtReplyErrors) { #endif // Two questions. - pkt.add_question(new DNSQuestion("example.com", T_MX)); + pkt.add_question(new DNSQuestion("example.com", T_TXT)); data = pkt.data(); txt = nullptr; EXPECT_EQ(ARES_EBADRESP, ares_parse_txt_reply(data.data(), (int)data.size(), &txt)); EXPECT_EQ(nullptr, txt); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", T_MX)); + pkt.add_question(new DNSQuestion("example.com", T_TXT)); // No answer. pkt.answers_.clear(); @@ -274,7 +307,7 @@ TEST_F(LibraryTest, ParseTxtReplyAllocFail) { std::string expected2a = "txt2a"; std::string expected2b = "txt2b"; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", T_MX)) + .add_question(new DNSQuestion("example.com", T_TXT)) .add_answer(new DNSCnameRR("example.com", 300, "c.example.com")) .add_answer(new DNSTxtRR("c.example.com", 100, {expected1})) .add_answer(new DNSTxtRR("c.example.com", 100, {expected1})) diff --git a/lib/c-ares-1.33.1/test/ares-test-parse-uri.cc b/lib/c-ares-1.34.4/test/ares-test-parse-uri.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse-uri.cc rename to lib/c-ares-1.34.4/test/ares-test-parse-uri.cc diff --git a/lib/c-ares-1.33.1/test/ares-test-parse.cc b/lib/c-ares-1.34.4/test/ares-test-parse.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test-parse.cc rename to lib/c-ares-1.34.4/test/ares-test-parse.cc diff --git a/lib/c-ares-1.33.1/test/ares-test.cc b/lib/c-ares-1.34.4/test/ares-test.cc similarity index 100% rename from lib/c-ares-1.33.1/test/ares-test.cc rename to lib/c-ares-1.34.4/test/ares-test.cc diff --git a/lib/c-ares-1.33.1/test/ares-test.h b/lib/c-ares-1.34.4/test/ares-test.h similarity index 87% rename from lib/c-ares-1.33.1/test/ares-test.h rename to lib/c-ares-1.34.4/test/ares-test.h index 7342daaa189..612759212a1 100644 --- a/lib/c-ares-1.33.1/test/ares-test.h +++ b/lib/c-ares-1.34.4/test/ares-test.h @@ -51,6 +51,16 @@ #include #include +#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 + namespace ares { typedef unsigned char byte; @@ -311,8 +321,9 @@ class MockServer { // Test fixture that uses a mock DNS server. class MockChannelOptsTest : public LibraryTest { public: - MockChannelOptsTest(int count, int family, bool force_tcp, bool honor_sysconfig, - struct ares_options *givenopts, int optmask); + MockChannelOptsTest(int count, int family, bool force_tcp, + bool honor_sysconfig, struct ares_options *givenopts, + int optmask); ~MockChannelOptsTest(); // Process all pending work on ares-owned and mock-server-owned file @@ -341,7 +352,8 @@ class MockChannelTest public ::testing::WithParamInterface> { public: MockChannelTest() - : MockChannelOptsTest(1, GetParam().first, GetParam().second, false, nullptr, 0) + : MockChannelOptsTest(1, GetParam().first, GetParam().second, false, + nullptr, 0) { } }; @@ -349,7 +361,8 @@ class MockChannelTest class MockUDPChannelTest : public MockChannelOptsTest, public ::testing::WithParamInterface { public: - MockUDPChannelTest() : MockChannelOptsTest(1, GetParam(), false, false, nullptr, 0) + MockUDPChannelTest() + : MockChannelOptsTest(1, GetParam(), false, false, nullptr, 0) { } }; @@ -357,7 +370,8 @@ class MockUDPChannelTest : public MockChannelOptsTest, class MockTCPChannelTest : public MockChannelOptsTest, public ::testing::WithParamInterface { public: - MockTCPChannelTest() : MockChannelOptsTest(1, GetParam(), true, false, nullptr, 0) + MockTCPChannelTest() + : MockChannelOptsTest(1, GetParam(), true, false, nullptr, 0) { } }; @@ -764,49 +778,58 @@ int RunInContainer(ContainerFilesystem *fs, const std::string &hostname, } \ int ICLASS_NAME(casename, testname)::InnerTestBody() -#define CONTAINED_TEST_P(test_suite_name, test_name, hostname, domainname, files) \ - class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ - : public test_suite_name { \ - public: \ - GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ - int InnerTestBody(); \ - void TestBody() \ - { \ - ContainerFilesystem chroot(files, ".."); \ - VoidToIntFn fn = \ - [this](void) -> int { \ - ares_reinit(this->channel_); \ - ares_sleep_time(100); \ - return this->InnerTestBody(); \ - }; \ - EXPECT_EQ(0, RunInContainer(&chroot, hostname, domainname, fn)); \ - } \ - \ - private: \ - static int AddToRegistry() { \ - ::testing::UnitTest::GetInstance() \ - ->parameterized_test_registry() \ - .GetTestSuitePatternHolder( \ - GTEST_STRINGIFY_(test_suite_name), \ - ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ - ->AddTestPattern( \ - GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \ - new ::testing::internal::TestMetaFactory(), \ - ::testing::internal::CodeLocation(__FILE__, __LINE__)); \ - return 0; \ - } \ - static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \ - GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ - (const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \ - GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \ - const GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name) &) = delete; /* NOLINT */ \ - }; \ - int GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)::gtest_registering_dummy_ = \ - GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ - int GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::InnerTestBody() + +/* Derived from googletest/include/gtest/gtest-param-test.h, specifically the + * TEST_P() macro, and some fixes to try to be compatible with different + * versions. */ +# ifndef GTEST_ATTRIBUTE_UNUSED_ +# define GTEST_ATTRIBUTE_UNUSED_ +# endif +# ifndef GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED +# define GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED +# endif +# define CONTAINED_TEST_P(test_suite_name, test_name, hostname, domainname, \ + files) \ + class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ + : public test_suite_name { \ + public: \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() \ + { \ + } \ + int InnerTestBody(); \ + void TestBody() \ + { \ + ContainerFilesystem chroot(files, ".."); \ + VoidToIntFn fn = [this](void) -> int { \ + ares_reinit(this->channel_); \ + ares_sleep_time(100); \ + return this->InnerTestBody(); \ + }; \ + EXPECT_EQ(0, RunInContainer(&chroot, hostname, domainname, fn)); \ + } \ + \ + private: \ + static int AddToRegistry() \ + { \ + ::testing::UnitTest::GetInstance() \ + ->parameterized_test_registry() \ + .GetTestSuitePatternHolder( \ + GTEST_STRINGIFY_(test_suite_name), \ + ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ + ->AddTestPattern( \ + GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \ + new ::testing::internal::TestMetaFactory(), \ + ::testing::internal::CodeLocation(__FILE__, __LINE__)); \ + return 0; \ + } \ + GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static int \ + gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \ + }; \ + int GTEST_TEST_CLASS_NAME_(test_suite_name, \ + test_name)::gtest_registering_dummy_ = \ + GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ + int GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::InnerTestBody() #endif diff --git a/lib/c-ares-1.33.1/test/ares_queryloop.c b/lib/c-ares-1.34.4/test/ares_queryloop.c similarity index 100% rename from lib/c-ares-1.33.1/test/ares_queryloop.c rename to lib/c-ares-1.34.4/test/ares_queryloop.c diff --git a/lib/c-ares-1.33.1/test/dns-dump.cc b/lib/c-ares-1.34.4/test/dns-dump.cc similarity index 100% rename from lib/c-ares-1.33.1/test/dns-dump.cc rename to lib/c-ares-1.34.4/test/dns-dump.cc diff --git a/lib/c-ares-1.33.1/test/dns-proto-test.cc b/lib/c-ares-1.34.4/test/dns-proto-test.cc similarity index 100% rename from lib/c-ares-1.33.1/test/dns-proto-test.cc rename to lib/c-ares-1.34.4/test/dns-proto-test.cc diff --git a/lib/c-ares-1.33.1/test/dns-proto.cc b/lib/c-ares-1.34.4/test/dns-proto.cc similarity index 100% rename from lib/c-ares-1.33.1/test/dns-proto.cc rename to lib/c-ares-1.34.4/test/dns-proto.cc diff --git a/lib/c-ares-1.33.1/test/dns-proto.h b/lib/c-ares-1.34.4/test/dns-proto.h similarity index 100% rename from lib/c-ares-1.33.1/test/dns-proto.h rename to lib/c-ares-1.34.4/test/dns-proto.h diff --git a/lib/c-ares-1.33.1/test/fuzzcheck.sh b/lib/c-ares-1.34.4/test/fuzzcheck.sh similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzcheck.sh rename to lib/c-ares-1.34.4/test/fuzzcheck.sh diff --git a/lib/c-ares-1.33.1/test/fuzzinput/004a216d3cff18b0c5c6b68b807f1529 b/lib/c-ares-1.34.4/test/fuzzinput/004a216d3cff18b0c5c6b68b807f1529 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/004a216d3cff18b0c5c6b68b807f1529 rename to lib/c-ares-1.34.4/test/fuzzinput/004a216d3cff18b0c5c6b68b807f1529 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/00539467ca159b36aea95e61f9729115 b/lib/c-ares-1.34.4/test/fuzzinput/00539467ca159b36aea95e61f9729115 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/00539467ca159b36aea95e61f9729115 rename to lib/c-ares-1.34.4/test/fuzzinput/00539467ca159b36aea95e61f9729115 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/00e846db8f43f2f507cd1666ed5a753e b/lib/c-ares-1.34.4/test/fuzzinput/00e846db8f43f2f507cd1666ed5a753e similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/00e846db8f43f2f507cd1666ed5a753e rename to lib/c-ares-1.34.4/test/fuzzinput/00e846db8f43f2f507cd1666ed5a753e diff --git a/lib/c-ares-1.33.1/test/fuzzinput/0177b7566f08c013699eaea9a77abeb3 b/lib/c-ares-1.34.4/test/fuzzinput/0177b7566f08c013699eaea9a77abeb3 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/0177b7566f08c013699eaea9a77abeb3 rename to lib/c-ares-1.34.4/test/fuzzinput/0177b7566f08c013699eaea9a77abeb3 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/020a4fa317715bfdb236ed13751e6b65 b/lib/c-ares-1.34.4/test/fuzzinput/020a4fa317715bfdb236ed13751e6b65 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/020a4fa317715bfdb236ed13751e6b65 rename to lib/c-ares-1.34.4/test/fuzzinput/020a4fa317715bfdb236ed13751e6b65 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/0310f2e81bea31f4fe3f330872a877dd b/lib/c-ares-1.34.4/test/fuzzinput/0310f2e81bea31f4fe3f330872a877dd similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/0310f2e81bea31f4fe3f330872a877dd rename to lib/c-ares-1.34.4/test/fuzzinput/0310f2e81bea31f4fe3f330872a877dd diff --git a/lib/c-ares-1.33.1/test/fuzzinput/0449be67df1730b2d0887d412a9b7cc4 b/lib/c-ares-1.34.4/test/fuzzinput/0449be67df1730b2d0887d412a9b7cc4 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/0449be67df1730b2d0887d412a9b7cc4 rename to lib/c-ares-1.34.4/test/fuzzinput/0449be67df1730b2d0887d412a9b7cc4 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/0449dd14f7aa94bf0d716bfe09b287a8 b/lib/c-ares-1.34.4/test/fuzzinput/0449dd14f7aa94bf0d716bfe09b287a8 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/0449dd14f7aa94bf0d716bfe09b287a8 rename to lib/c-ares-1.34.4/test/fuzzinput/0449dd14f7aa94bf0d716bfe09b287a8 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/04c93cdf7208979aa4df80a3a0d5a2d8 b/lib/c-ares-1.34.4/test/fuzzinput/04c93cdf7208979aa4df80a3a0d5a2d8 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/04c93cdf7208979aa4df80a3a0d5a2d8 rename to lib/c-ares-1.34.4/test/fuzzinput/04c93cdf7208979aa4df80a3a0d5a2d8 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/0567e7171e08e75f3f91c4ca74c17adc b/lib/c-ares-1.34.4/test/fuzzinput/0567e7171e08e75f3f91c4ca74c17adc similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/0567e7171e08e75f3f91c4ca74c17adc rename to lib/c-ares-1.34.4/test/fuzzinput/0567e7171e08e75f3f91c4ca74c17adc diff --git a/lib/c-ares-1.33.1/test/fuzzinput/05ba948578a397e9cbc6a7b3e78622fa b/lib/c-ares-1.34.4/test/fuzzinput/05ba948578a397e9cbc6a7b3e78622fa similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/05ba948578a397e9cbc6a7b3e78622fa rename to lib/c-ares-1.34.4/test/fuzzinput/05ba948578a397e9cbc6a7b3e78622fa diff --git a/lib/c-ares-1.33.1/test/fuzzinput/060afe5ed25f3e2e86167e545f27edca b/lib/c-ares-1.34.4/test/fuzzinput/060afe5ed25f3e2e86167e545f27edca similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/060afe5ed25f3e2e86167e545f27edca rename to lib/c-ares-1.34.4/test/fuzzinput/060afe5ed25f3e2e86167e545f27edca diff --git a/lib/c-ares-1.33.1/test/fuzzinput/06d47d3681493f1b1d41236f460d896f b/lib/c-ares-1.34.4/test/fuzzinput/06d47d3681493f1b1d41236f460d896f similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/06d47d3681493f1b1d41236f460d896f rename to lib/c-ares-1.34.4/test/fuzzinput/06d47d3681493f1b1d41236f460d896f diff --git a/lib/c-ares-1.33.1/test/fuzzinput/0724a810b0e131c2fddb6de9003b9064 b/lib/c-ares-1.34.4/test/fuzzinput/0724a810b0e131c2fddb6de9003b9064 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/0724a810b0e131c2fddb6de9003b9064 rename to lib/c-ares-1.34.4/test/fuzzinput/0724a810b0e131c2fddb6de9003b9064 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/0b5279148826f5b962bcf1896bdb4ede b/lib/c-ares-1.34.4/test/fuzzinput/0b5279148826f5b962bcf1896bdb4ede similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/0b5279148826f5b962bcf1896bdb4ede rename to lib/c-ares-1.34.4/test/fuzzinput/0b5279148826f5b962bcf1896bdb4ede diff --git a/lib/c-ares-1.33.1/test/fuzzinput/114048c0f6b10bdc67ce9166405d195e b/lib/c-ares-1.34.4/test/fuzzinput/114048c0f6b10bdc67ce9166405d195e similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/114048c0f6b10bdc67ce9166405d195e rename to lib/c-ares-1.34.4/test/fuzzinput/114048c0f6b10bdc67ce9166405d195e diff --git a/lib/c-ares-1.33.1/test/fuzzinput/11b8464a0ef8735d202955c34c36b0c7 b/lib/c-ares-1.34.4/test/fuzzinput/11b8464a0ef8735d202955c34c36b0c7 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/11b8464a0ef8735d202955c34c36b0c7 rename to lib/c-ares-1.34.4/test/fuzzinput/11b8464a0ef8735d202955c34c36b0c7 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/11cb626f1668c7b41954ce7d768fe528 b/lib/c-ares-1.34.4/test/fuzzinput/11cb626f1668c7b41954ce7d768fe528 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/11cb626f1668c7b41954ce7d768fe528 rename to lib/c-ares-1.34.4/test/fuzzinput/11cb626f1668c7b41954ce7d768fe528 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/14b133bf18125b75a1976fa63a1df6b7 b/lib/c-ares-1.34.4/test/fuzzinput/14b133bf18125b75a1976fa63a1df6b7 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/14b133bf18125b75a1976fa63a1df6b7 rename to lib/c-ares-1.34.4/test/fuzzinput/14b133bf18125b75a1976fa63a1df6b7 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/153c6b3afa8faa03c8bc28f936a6d4cf b/lib/c-ares-1.34.4/test/fuzzinput/153c6b3afa8faa03c8bc28f936a6d4cf similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/153c6b3afa8faa03c8bc28f936a6d4cf rename to lib/c-ares-1.34.4/test/fuzzinput/153c6b3afa8faa03c8bc28f936a6d4cf diff --git a/lib/c-ares-1.33.1/test/fuzzinput/182cad2a342ed7317b7c21a5d17020d1 b/lib/c-ares-1.34.4/test/fuzzinput/182cad2a342ed7317b7c21a5d17020d1 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/182cad2a342ed7317b7c21a5d17020d1 rename to lib/c-ares-1.34.4/test/fuzzinput/182cad2a342ed7317b7c21a5d17020d1 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/1c61a61bb7057b52c5b15188345a5238 b/lib/c-ares-1.34.4/test/fuzzinput/1c61a61bb7057b52c5b15188345a5238 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/1c61a61bb7057b52c5b15188345a5238 rename to lib/c-ares-1.34.4/test/fuzzinput/1c61a61bb7057b52c5b15188345a5238 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/1dbe2cf62ed2e4fa1c3cb473f08710b5 b/lib/c-ares-1.34.4/test/fuzzinput/1dbe2cf62ed2e4fa1c3cb473f08710b5 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/1dbe2cf62ed2e4fa1c3cb473f08710b5 rename to lib/c-ares-1.34.4/test/fuzzinput/1dbe2cf62ed2e4fa1c3cb473f08710b5 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/21199be504fcfece5c7096ee0dbba507 b/lib/c-ares-1.34.4/test/fuzzinput/21199be504fcfece5c7096ee0dbba507 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/21199be504fcfece5c7096ee0dbba507 rename to lib/c-ares-1.34.4/test/fuzzinput/21199be504fcfece5c7096ee0dbba507 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/21891480074b5635dbbe7137bdcabccd b/lib/c-ares-1.34.4/test/fuzzinput/21891480074b5635dbbe7137bdcabccd similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/21891480074b5635dbbe7137bdcabccd rename to lib/c-ares-1.34.4/test/fuzzinput/21891480074b5635dbbe7137bdcabccd diff --git a/lib/c-ares-1.33.1/test/fuzzinput/233aea42e15aa73e131eefabf16088c9 b/lib/c-ares-1.34.4/test/fuzzinput/233aea42e15aa73e131eefabf16088c9 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/233aea42e15aa73e131eefabf16088c9 rename to lib/c-ares-1.34.4/test/fuzzinput/233aea42e15aa73e131eefabf16088c9 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/24660d4e7ac7aa21d600ea7a3d198bbb b/lib/c-ares-1.34.4/test/fuzzinput/24660d4e7ac7aa21d600ea7a3d198bbb similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/24660d4e7ac7aa21d600ea7a3d198bbb rename to lib/c-ares-1.34.4/test/fuzzinput/24660d4e7ac7aa21d600ea7a3d198bbb diff --git a/lib/c-ares-1.33.1/test/fuzzinput/25589deb55c08429345f289d1c9b0254 b/lib/c-ares-1.34.4/test/fuzzinput/25589deb55c08429345f289d1c9b0254 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/25589deb55c08429345f289d1c9b0254 rename to lib/c-ares-1.34.4/test/fuzzinput/25589deb55c08429345f289d1c9b0254 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/2573bd823e4da11f727a17f8e1f35c26 b/lib/c-ares-1.34.4/test/fuzzinput/2573bd823e4da11f727a17f8e1f35c26 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/2573bd823e4da11f727a17f8e1f35c26 rename to lib/c-ares-1.34.4/test/fuzzinput/2573bd823e4da11f727a17f8e1f35c26 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/276f12da56866273e76059ad0e7be97e b/lib/c-ares-1.34.4/test/fuzzinput/276f12da56866273e76059ad0e7be97e similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/276f12da56866273e76059ad0e7be97e rename to lib/c-ares-1.34.4/test/fuzzinput/276f12da56866273e76059ad0e7be97e diff --git a/lib/c-ares-1.33.1/test/fuzzinput/29198a2e380cb19babec9e02116d213e b/lib/c-ares-1.34.4/test/fuzzinput/29198a2e380cb19babec9e02116d213e similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/29198a2e380cb19babec9e02116d213e rename to lib/c-ares-1.34.4/test/fuzzinput/29198a2e380cb19babec9e02116d213e diff --git a/lib/c-ares-1.33.1/test/fuzzinput/2c94ba9434b1a1b9396fc5364f101363 b/lib/c-ares-1.34.4/test/fuzzinput/2c94ba9434b1a1b9396fc5364f101363 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/2c94ba9434b1a1b9396fc5364f101363 rename to lib/c-ares-1.34.4/test/fuzzinput/2c94ba9434b1a1b9396fc5364f101363 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/2d578c357dc2f5e02dc55cddb30641d1 b/lib/c-ares-1.34.4/test/fuzzinput/2d578c357dc2f5e02dc55cddb30641d1 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/2d578c357dc2f5e02dc55cddb30641d1 rename to lib/c-ares-1.34.4/test/fuzzinput/2d578c357dc2f5e02dc55cddb30641d1 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/2dff6cc5a223e67fde9e5e79af456992 b/lib/c-ares-1.34.4/test/fuzzinput/2dff6cc5a223e67fde9e5e79af456992 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/2dff6cc5a223e67fde9e5e79af456992 rename to lib/c-ares-1.34.4/test/fuzzinput/2dff6cc5a223e67fde9e5e79af456992 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/2f103b1f9477f2d8934bd84328d51c75 b/lib/c-ares-1.34.4/test/fuzzinput/2f103b1f9477f2d8934bd84328d51c75 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/2f103b1f9477f2d8934bd84328d51c75 rename to lib/c-ares-1.34.4/test/fuzzinput/2f103b1f9477f2d8934bd84328d51c75 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/31cd3a8413de13d9624adbb1613784bf b/lib/c-ares-1.34.4/test/fuzzinput/31cd3a8413de13d9624adbb1613784bf similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/31cd3a8413de13d9624adbb1613784bf rename to lib/c-ares-1.34.4/test/fuzzinput/31cd3a8413de13d9624adbb1613784bf diff --git a/lib/c-ares-1.33.1/test/fuzzinput/36415bdf1d180098fe6234b4186e69f3 b/lib/c-ares-1.34.4/test/fuzzinput/36415bdf1d180098fe6234b4186e69f3 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/36415bdf1d180098fe6234b4186e69f3 rename to lib/c-ares-1.34.4/test/fuzzinput/36415bdf1d180098fe6234b4186e69f3 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/3a04a80f0242e8dff0cd732e7c4767da b/lib/c-ares-1.34.4/test/fuzzinput/3a04a80f0242e8dff0cd732e7c4767da similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/3a04a80f0242e8dff0cd732e7c4767da rename to lib/c-ares-1.34.4/test/fuzzinput/3a04a80f0242e8dff0cd732e7c4767da diff --git a/lib/c-ares-1.33.1/test/fuzzinput/44d0f973b7b0fb3e4a07770c943dcd5a b/lib/c-ares-1.34.4/test/fuzzinput/44d0f973b7b0fb3e4a07770c943dcd5a similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/44d0f973b7b0fb3e4a07770c943dcd5a rename to lib/c-ares-1.34.4/test/fuzzinput/44d0f973b7b0fb3e4a07770c943dcd5a diff --git a/lib/c-ares-1.33.1/test/fuzzinput/50bc00daa0ddcd6cfb2b5d9f62c81f47 b/lib/c-ares-1.34.4/test/fuzzinput/50bc00daa0ddcd6cfb2b5d9f62c81f47 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/50bc00daa0ddcd6cfb2b5d9f62c81f47 rename to lib/c-ares-1.34.4/test/fuzzinput/50bc00daa0ddcd6cfb2b5d9f62c81f47 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/51ed2d1fb77b3078b54e94e85606b7df b/lib/c-ares-1.34.4/test/fuzzinput/51ed2d1fb77b3078b54e94e85606b7df similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/51ed2d1fb77b3078b54e94e85606b7df rename to lib/c-ares-1.34.4/test/fuzzinput/51ed2d1fb77b3078b54e94e85606b7df diff --git a/lib/c-ares-1.33.1/test/fuzzinput/5c5e0e899cf2e7d053a9e45fb76f6e5a b/lib/c-ares-1.34.4/test/fuzzinput/5c5e0e899cf2e7d053a9e45fb76f6e5a similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/5c5e0e899cf2e7d053a9e45fb76f6e5a rename to lib/c-ares-1.34.4/test/fuzzinput/5c5e0e899cf2e7d053a9e45fb76f6e5a diff --git a/lib/c-ares-1.33.1/test/fuzzinput/70152ed033f139443fbfb1b858bb3b1b b/lib/c-ares-1.34.4/test/fuzzinput/70152ed033f139443fbfb1b858bb3b1b similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/70152ed033f139443fbfb1b858bb3b1b rename to lib/c-ares-1.34.4/test/fuzzinput/70152ed033f139443fbfb1b858bb3b1b diff --git a/lib/c-ares-1.33.1/test/fuzzinput/7030ca2b24e5a7f9dd8f62096a48eb33 b/lib/c-ares-1.34.4/test/fuzzinput/7030ca2b24e5a7f9dd8f62096a48eb33 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/7030ca2b24e5a7f9dd8f62096a48eb33 rename to lib/c-ares-1.34.4/test/fuzzinput/7030ca2b24e5a7f9dd8f62096a48eb33 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/71eec1a0ef2d25bb9e2ef17f23be7e9e b/lib/c-ares-1.34.4/test/fuzzinput/71eec1a0ef2d25bb9e2ef17f23be7e9e similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/71eec1a0ef2d25bb9e2ef17f23be7e9e rename to lib/c-ares-1.34.4/test/fuzzinput/71eec1a0ef2d25bb9e2ef17f23be7e9e diff --git a/lib/c-ares-1.33.1/test/fuzzinput/7a6b0177210ea4ef40b254daf99393c5 b/lib/c-ares-1.34.4/test/fuzzinput/7a6b0177210ea4ef40b254daf99393c5 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/7a6b0177210ea4ef40b254daf99393c5 rename to lib/c-ares-1.34.4/test/fuzzinput/7a6b0177210ea4ef40b254daf99393c5 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/7f1567733711ffb61839621af0cbfa33 b/lib/c-ares-1.34.4/test/fuzzinput/7f1567733711ffb61839621af0cbfa33 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/7f1567733711ffb61839621af0cbfa33 rename to lib/c-ares-1.34.4/test/fuzzinput/7f1567733711ffb61839621af0cbfa33 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/850c6d57c5bb7be8205fc2438d14d7e5 b/lib/c-ares-1.34.4/test/fuzzinput/850c6d57c5bb7be8205fc2438d14d7e5 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/850c6d57c5bb7be8205fc2438d14d7e5 rename to lib/c-ares-1.34.4/test/fuzzinput/850c6d57c5bb7be8205fc2438d14d7e5 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/a5c8cd2784a5792b9e91c2d7895b3b34 b/lib/c-ares-1.34.4/test/fuzzinput/a5c8cd2784a5792b9e91c2d7895b3b34 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/a5c8cd2784a5792b9e91c2d7895b3b34 rename to lib/c-ares-1.34.4/test/fuzzinput/a5c8cd2784a5792b9e91c2d7895b3b34 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/a9135cdc7151d023300ff194bad90af9 b/lib/c-ares-1.34.4/test/fuzzinput/a9135cdc7151d023300ff194bad90af9 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/a9135cdc7151d023300ff194bad90af9 rename to lib/c-ares-1.34.4/test/fuzzinput/a9135cdc7151d023300ff194bad90af9 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/af2597e8ac7dec1e8b4a47518312912a b/lib/c-ares-1.34.4/test/fuzzinput/af2597e8ac7dec1e8b4a47518312912a similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/af2597e8ac7dec1e8b4a47518312912a rename to lib/c-ares-1.34.4/test/fuzzinput/af2597e8ac7dec1e8b4a47518312912a diff --git a/lib/c-ares-1.33.1/test/fuzzinput/answer_a b/lib/c-ares-1.34.4/test/fuzzinput/answer_a similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/answer_a rename to lib/c-ares-1.34.4/test/fuzzinput/answer_a diff --git a/lib/c-ares-1.33.1/test/fuzzinput/answer_aaaa b/lib/c-ares-1.34.4/test/fuzzinput/answer_aaaa similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/answer_aaaa rename to lib/c-ares-1.34.4/test/fuzzinput/answer_aaaa diff --git a/lib/c-ares-1.33.1/test/fuzzinput/b3f53ef826b831bb09dd25c7f5960249 b/lib/c-ares-1.34.4/test/fuzzinput/b3f53ef826b831bb09dd25c7f5960249 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/b3f53ef826b831bb09dd25c7f5960249 rename to lib/c-ares-1.34.4/test/fuzzinput/b3f53ef826b831bb09dd25c7f5960249 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/cda0f8751f5c4993974c2b549d29bcc8 b/lib/c-ares-1.34.4/test/fuzzinput/cda0f8751f5c4993974c2b549d29bcc8 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/cda0f8751f5c4993974c2b549d29bcc8 rename to lib/c-ares-1.34.4/test/fuzzinput/cda0f8751f5c4993974c2b549d29bcc8 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/ce6c26c0e469339873d0e7f616ab0945 b/lib/c-ares-1.34.4/test/fuzzinput/ce6c26c0e469339873d0e7f616ab0945 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/ce6c26c0e469339873d0e7f616ab0945 rename to lib/c-ares-1.34.4/test/fuzzinput/ce6c26c0e469339873d0e7f616ab0945 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5637790584012800 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5637790584012800 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5637790584012800 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5637790584012800 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5650695891451904 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5650695891451904 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5650695891451904 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5650695891451904 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5651369832218624 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5651369832218624 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5651369832218624 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5651369832218624 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5674462260756480 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5674462260756480 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5674462260756480 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5674462260756480 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5680630672654336 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5680630672654336 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5680630672654336 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5680630672654336 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5683497160671232 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5683497160671232 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5683497160671232 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5683497160671232 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5687310655422464 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5687310655422464 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5687310655422464 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5687310655422464 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5695341573177344 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5695341573177344 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5695341573177344 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5695341573177344 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5697835103682560 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5697835103682560 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5697835103682560 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5697835103682560 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5728518081609728 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5728518081609728 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5728518081609728 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5728518081609728 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5732960017317888 b/lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5732960017317888 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/clusterfuzz-5732960017317888 rename to lib/c-ares-1.34.4/test/fuzzinput/clusterfuzz-5732960017317888 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/e4dd7e7c2dd4ed7c2e17a6af5d04f9c9 b/lib/c-ares-1.34.4/test/fuzzinput/e4dd7e7c2dd4ed7c2e17a6af5d04f9c9 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/e4dd7e7c2dd4ed7c2e17a6af5d04f9c9 rename to lib/c-ares-1.34.4/test/fuzzinput/e4dd7e7c2dd4ed7c2e17a6af5d04f9c9 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/ed50ed8ee36230a5a69746ad830437e5 b/lib/c-ares-1.34.4/test/fuzzinput/ed50ed8ee36230a5a69746ad830437e5 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/ed50ed8ee36230a5a69746ad830437e5 rename to lib/c-ares-1.34.4/test/fuzzinput/ed50ed8ee36230a5a69746ad830437e5 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/f1b900d50806021953321c3b604ee497 b/lib/c-ares-1.34.4/test/fuzzinput/f1b900d50806021953321c3b604ee497 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/f1b900d50806021953321c3b604ee497 rename to lib/c-ares-1.34.4/test/fuzzinput/f1b900d50806021953321c3b604ee497 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/f6606f624be8c628328cea01d2cd07a9 b/lib/c-ares-1.34.4/test/fuzzinput/f6606f624be8c628328cea01d2cd07a9 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/f6606f624be8c628328cea01d2cd07a9 rename to lib/c-ares-1.34.4/test/fuzzinput/f6606f624be8c628328cea01d2cd07a9 diff --git a/lib/c-ares-1.33.1/test/fuzzinput/f89f6c8176b564a7dd646f14305573ce b/lib/c-ares-1.34.4/test/fuzzinput/f89f6c8176b564a7dd646f14305573ce similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/f89f6c8176b564a7dd646f14305573ce rename to lib/c-ares-1.34.4/test/fuzzinput/f89f6c8176b564a7dd646f14305573ce diff --git a/lib/c-ares-1.33.1/test/fuzzinput/f9ad508d2dbd08d3aaaabc7d1174677d b/lib/c-ares-1.34.4/test/fuzzinput/f9ad508d2dbd08d3aaaabc7d1174677d similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/f9ad508d2dbd08d3aaaabc7d1174677d rename to lib/c-ares-1.34.4/test/fuzzinput/f9ad508d2dbd08d3aaaabc7d1174677d diff --git a/lib/c-ares-1.33.1/test/fuzzinput/multi-indir b/lib/c-ares-1.34.4/test/fuzzinput/multi-indir similarity index 100% rename from lib/c-ares-1.33.1/test/fuzzinput/multi-indir rename to lib/c-ares-1.34.4/test/fuzzinput/multi-indir diff --git a/lib/c-ares-1.33.1/test/fuzznames/name01 b/lib/c-ares-1.34.4/test/fuzznames/name01 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name01 rename to lib/c-ares-1.34.4/test/fuzznames/name01 diff --git a/lib/c-ares-1.33.1/test/fuzznames/name02 b/lib/c-ares-1.34.4/test/fuzznames/name02 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name02 rename to lib/c-ares-1.34.4/test/fuzznames/name02 diff --git a/lib/c-ares-1.33.1/test/fuzznames/name03 b/lib/c-ares-1.34.4/test/fuzznames/name03 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name03 rename to lib/c-ares-1.34.4/test/fuzznames/name03 diff --git a/lib/c-ares-1.33.1/test/fuzznames/name04 b/lib/c-ares-1.34.4/test/fuzznames/name04 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name04 rename to lib/c-ares-1.34.4/test/fuzznames/name04 diff --git a/lib/c-ares-1.33.1/test/fuzznames/name05 b/lib/c-ares-1.34.4/test/fuzznames/name05 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name05 rename to lib/c-ares-1.34.4/test/fuzznames/name05 diff --git a/lib/c-ares-1.33.1/test/fuzznames/name06 b/lib/c-ares-1.34.4/test/fuzznames/name06 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name06 rename to lib/c-ares-1.34.4/test/fuzznames/name06 diff --git a/lib/c-ares-1.33.1/test/fuzznames/name07 b/lib/c-ares-1.34.4/test/fuzznames/name07 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name07 rename to lib/c-ares-1.34.4/test/fuzznames/name07 diff --git a/lib/c-ares-1.33.1/test/fuzznames/name08 b/lib/c-ares-1.34.4/test/fuzznames/name08 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name08 rename to lib/c-ares-1.34.4/test/fuzznames/name08 diff --git a/lib/c-ares-1.33.1/test/fuzznames/name09 b/lib/c-ares-1.34.4/test/fuzznames/name09 similarity index 100% rename from lib/c-ares-1.33.1/test/fuzznames/name09 rename to lib/c-ares-1.34.4/test/fuzznames/name09 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri1 b/lib/c-ares-1.34.4/test/fuzznames/uri1 new file mode 100644 index 00000000000..284d3f2c5ba --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri1 @@ -0,0 +1 @@ +https://www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri10 b/lib/c-ares-1.34.4/test/fuzznames/uri10 new file mode 100644 index 00000000000..340cdd42368 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri10 @@ -0,0 +1 @@ +https://www.example.com?key= diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri11 b/lib/c-ares-1.34.4/test/fuzznames/uri11 new file mode 100644 index 00000000000..effe2ae2a1f --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri11 @@ -0,0 +1 @@ +https://www.example.com#fragment diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri12 b/lib/c-ares-1.34.4/test/fuzznames/uri12 new file mode 100644 index 00000000000..f6eb3c23c53 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri12 @@ -0,0 +1 @@ +https://user:password@www.example.com/path diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri13 b/lib/c-ares-1.34.4/test/fuzznames/uri13 new file mode 100644 index 00000000000..16f1bba125f --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri13 @@ -0,0 +1 @@ +https://user:password@www.example.com/path#fragment diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri14 b/lib/c-ares-1.34.4/test/fuzznames/uri14 new file mode 100644 index 00000000000..4cecec278e3 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri14 @@ -0,0 +1 @@ +https://user:password@www.example.com/path?key=val diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri16 b/lib/c-ares-1.34.4/test/fuzznames/uri16 new file mode 100644 index 00000000000..3714271a806 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri16 @@ -0,0 +1 @@ +https://user:password@www.example.com/path?key=val#fragment diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri17 b/lib/c-ares-1.34.4/test/fuzznames/uri17 new file mode 100644 index 00000000000..f65556a1a2c --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri17 @@ -0,0 +1 @@ +HTTPS://www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri18 b/lib/c-ares-1.34.4/test/fuzznames/uri18 new file mode 100644 index 00000000000..d9698eb252e --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri18 @@ -0,0 +1 @@ +https://www.example.com?key=hello+world diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri19 b/lib/c-ares-1.34.4/test/fuzznames/uri19 new file mode 100644 index 00000000000..7cec26d9783 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri19 @@ -0,0 +1 @@ +https://www.example.com?key=val%26 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri2 b/lib/c-ares-1.34.4/test/fuzznames/uri2 new file mode 100644 index 00000000000..1c2a7f40b82 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri2 @@ -0,0 +1 @@ +https://www.example.com:8443 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri20 b/lib/c-ares-1.34.4/test/fuzznames/uri20 new file mode 100644 index 00000000000..4b2f9dc8647 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri20 @@ -0,0 +1 @@ +https://www.example.com?key%26=val diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri21 b/lib/c-ares-1.34.4/test/fuzznames/uri21 new file mode 100644 index 00000000000..4fd9c1bfa02 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri21 @@ -0,0 +1 @@ +https://www.example.com?key=Aa2-._~/?uri20\'\(\)\*,;:@ diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri22 b/lib/c-ares-1.34.4/test/fuzznames/uri22 new file mode 100644 index 00000000000..8e6b6b64565 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri22 @@ -0,0 +1 @@ +https://www.example.com?key1=val1&key2=val2&key3=val3&key4=val4 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri23 b/lib/c-ares-1.34.4/test/fuzznames/uri23 new file mode 100644 index 00000000000..5a08b8a1cb4 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri23 @@ -0,0 +1 @@ +https://www.example.com?key=%41%61%32%2D%2E%5f%7e%2F%3F%21%24%27%28%29%2a%2C%3b%3a%40 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri24 b/lib/c-ares-1.34.4/test/fuzznames/uri24 new file mode 100644 index 00000000000..11a74f65810 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri24 @@ -0,0 +1 @@ +dns+tls://192.168.1.1:53 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri25 b/lib/c-ares-1.34.4/test/fuzznames/uri25 new file mode 100644 index 00000000000..3d63a2f0977 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri25 @@ -0,0 +1 @@ +dns+tls://[fe80::1]:53 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri26 b/lib/c-ares-1.34.4/test/fuzznames/uri26 new file mode 100644 index 00000000000..8f3aa6dc590 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri26 @@ -0,0 +1 @@ +dns://[fe80::b542:84df:1719:65e3%en0] diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri27 b/lib/c-ares-1.34.4/test/fuzznames/uri27 new file mode 100644 index 00000000000..a53412dfa6a --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri27 @@ -0,0 +1 @@ +dns+tls://[fe80:00::00:1]:53 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri28 b/lib/c-ares-1.34.4/test/fuzznames/uri28 new file mode 100644 index 00000000000..63ef8ae4b12 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri28 @@ -0,0 +1 @@ +d.n+s-tls://www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri29 b/lib/c-ares-1.34.4/test/fuzznames/uri29 new file mode 100644 index 00000000000..947cf6ce285 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri29 @@ -0,0 +1 @@ +dns*tls://www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri3 b/lib/c-ares-1.34.4/test/fuzznames/uri3 new file mode 100644 index 00000000000..b9d2bd99ab6 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri3 @@ -0,0 +1 @@ +https://user:password@www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri30 b/lib/c-ares-1.34.4/test/fuzznames/uri30 new file mode 100644 index 00000000000..e77957591d2 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri30 @@ -0,0 +1 @@ +https://www.example.com?key=val%01 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri31 b/lib/c-ares-1.34.4/test/fuzznames/uri31 new file mode 100644 index 00000000000..5c429467c5a --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri31 @@ -0,0 +1 @@ +abcdef0123456789://www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri32 b/lib/c-ares-1.34.4/test/fuzznames/uri32 new file mode 100644 index 00000000000..396d471fd78 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri32 @@ -0,0 +1 @@ +www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri33 b/lib/c-ares-1.34.4/test/fuzznames/uri33 new file mode 100644 index 00000000000..2bc0ab4dd88 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri33 @@ -0,0 +1 @@ +https://www.example.com?key=val%0 diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri34 b/lib/c-ares-1.34.4/test/fuzznames/uri34 new file mode 100644 index 00000000000..835b0e2c58b --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri34 @@ -0,0 +1 @@ +https://www.example.com?key=val%AZ diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri35 b/lib/c-ares-1.34.4/test/fuzznames/uri35 new file mode 100644 index 00000000000..7d6a51058ad --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri35 @@ -0,0 +1 @@ +https://www.example.com?key=hello world diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri36 b/lib/c-ares-1.34.4/test/fuzznames/uri36 new file mode 100644 index 00000000000..4d71a97c969 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri36 @@ -0,0 +1 @@ +https://:password@www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri37 b/lib/c-ares-1.34.4/test/fuzznames/uri37 new file mode 100644 index 00000000000..dbe55b1290f --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri37 @@ -0,0 +1 @@ +dns+tls://[fe8G::1] diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri4 b/lib/c-ares-1.34.4/test/fuzznames/uri4 new file mode 100644 index 00000000000..314e6403cb7 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri4 @@ -0,0 +1 @@ +https://user%25:password@www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri5 b/lib/c-ares-1.34.4/test/fuzznames/uri5 new file mode 100644 index 00000000000..ab869ad5990 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri5 @@ -0,0 +1 @@ +https://user:password%25@www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri6 b/lib/c-ares-1.34.4/test/fuzznames/uri6 new file mode 100644 index 00000000000..8b5c863ce9f --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri6 @@ -0,0 +1 @@ +https://user@www.example.com diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri7 b/lib/c-ares-1.34.4/test/fuzznames/uri7 new file mode 100644 index 00000000000..69086d2bb15 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri7 @@ -0,0 +1 @@ +https://www.example.com/path diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri8 b/lib/c-ares-1.34.4/test/fuzznames/uri8 new file mode 100644 index 00000000000..c6ac4a1cbd6 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri8 @@ -0,0 +1 @@ +https://www.example.com?key=val diff --git a/lib/c-ares-1.34.4/test/fuzznames/uri9 b/lib/c-ares-1.34.4/test/fuzznames/uri9 new file mode 100644 index 00000000000..df9e3530437 --- /dev/null +++ b/lib/c-ares-1.34.4/test/fuzznames/uri9 @@ -0,0 +1 @@ +https://www.example.com?key diff --git a/lib/cprofiles/.github/actionlint-matcher.json b/lib/cprofiles/.github/actionlint-matcher.json new file mode 100644 index 00000000000..7b1ba251e61 --- /dev/null +++ b/lib/cprofiles/.github/actionlint-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "actionlint", + "pattern": [ + { + "regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$", + "file": 1, + "line": 2, + "column": 3, + "message": 4, + "code": 5 + } + ] + } + ] + } \ No newline at end of file diff --git a/lib/cprofiles/.github/dependabot.yml b/lib/cprofiles/.github/dependabot.yml new file mode 100644 index 00000000000..12f9b4a0ba2 --- /dev/null +++ b/lib/cprofiles/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" \ No newline at end of file diff --git a/lib/cprofiles/.github/workflows/build.yaml b/lib/cprofiles/.github/workflows/build.yaml new file mode 100644 index 00000000000..e2835adf286 --- /dev/null +++ b/lib/cprofiles/.github/workflows/build.yaml @@ -0,0 +1,163 @@ +name: Build PR(s) and master branch. +on: + push: + branches: + - master + pull_request: + branches: + - master + types: [opened, reopened, synchronize] +jobs: + build-windows: + name: Build sources on amd64 for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, windows-2019] + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Build on ${{ matrix.os }} with vs-2019 + run: | + .\scripts\win_build.bat + + - name: Run unit tests. + run: | + ctest --rerun-failed --output-on-failure -C Debug --test-dir .\tests\ + + build-centos: + name: CentOS 7 build to confirm no issues once used downstream + runs-on: ubuntu-latest + container: centos:7 + permissions: + contents: none + steps: + - name: Set up base image dependencies + run: | + sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo + sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo + yum -y update && \ + yum install -y ca-certificates cmake curl-devel gcc gcc-c++ git make wget && \ + yum install -y epel-release + yum install -y cmake3 + shell: bash + + - name: Clone repo without submodules (1.8.3 version of Git) + run: | + git clone https://github.com/fluent/cprofiles.git + shell: bash + + - name: Check out the branch (1.8.3 version of Git) + env: + BRANCH_NAME: ${{ github.head_ref }} + run: | + git checkout "$BRANCH_NAME" + shell: bash + working-directory: cprofiles + + - name: Fetch the appropriate sub modules + run: | + git submodule init + git submodule update + shell: bash + working-directory: cprofiles + + - name: Run compilation + run: | + cmake3 -DCPROF_DEV=on ../ + make + shell: bash + working-directory: cprofiles/build + + build-unix-arm64: + name: Build sources on arm64 for ${{ matrix.os }} - ${{ matrix.compiler }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + compiler: [ gcc, clang ] + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Build on ${{ matrix.os }} with ${{ matrix.compiler }} + uses: uraimo/run-on-arch-action@v2.8.1 + with: + arch: aarch64 + distro: ubuntu20.04 + run: | + apt-get update && \ + apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + file \ + make + export CC=${{ env.compiler }} + cd build + cmake -DCPROF_TESTS=On ../ + cmake --build . + CTEST_OUTPUT_ON_FAILURE=1 ctest + env: + CC: ${{ matrix.compiler }} + + build-unix-amd64: + name: Build sources on amd64 for ${{ matrix.os }} - ${{ matrix.compiler }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + compiler: [ gcc, clang ] + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Build on ${{ matrix.os }} with ${{ matrix.compiler }} + run: | + echo "CC = $CC, CXX = $CXX" + cmake -DCPROF_TESTS=On ../ + cmake --build . + CTEST_OUTPUT_ON_FAILURE=1 ctest + shell: bash + working-directory: build + env: + CC: ${{ matrix.compiler }} + + build-analysis-tests: + name: Build with various code analysis tools + strategy: + fail-fast: false + matrix: + preset: + - clang-sanitize-address + - clang-sanitize-memory + - clang-sanitize-undefined + - clang-sanitize-dataflow + - clang-sanitize-safe-stack + - valgrind + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: docker://lpenz/ghaction-cmake:0.19 + with: + preset: ${{ matrix.preset }} + # dependencies_debian: '' + cmakeflags: '-DCPROF_TESTS=On -DCPROF_DEV=on .' + build_command: make all diff --git a/lib/cprofiles/.github/workflows/lint.yaml b/lib/cprofiles/.github/workflows/lint.yaml new file mode 100644 index 00000000000..b9b8aaead39 --- /dev/null +++ b/lib/cprofiles/.github/workflows/lint.yaml @@ -0,0 +1,32 @@ +name: Lint PRs +on: + pull_request: + workflow_dispatch: + +jobs: + + shellcheck-pr: + runs-on: ubuntu-latest + name: PR - Shellcheck + steps: + - uses: actions/checkout@v4 + - uses: ludeeus/action-shellcheck@master + + actionlint-pr: + runs-on: ubuntu-latest + name: PR - Actionlint + steps: + - uses: actions/checkout@v4 + - run: | + echo "::add-matcher::.github/actionlint-matcher.json" + bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + ./actionlint -color -shellcheck= + shell: bash + + docslint-pr: + runs-on: ubuntu-latest + name: PR - Markdownlint + steps: + - uses: actions/checkout@v4 + - name: Run markdownlint + uses: actionshub/markdownlint@v3.1.4 diff --git a/lib/cprofiles/.gitignore b/lib/cprofiles/.gitignore new file mode 100644 index 00000000000..ddc90271d33 --- /dev/null +++ b/lib/cprofiles/.gitignore @@ -0,0 +1,3 @@ +*~ +.vscode/* +build/* \ No newline at end of file diff --git a/lib/cprofiles/.gitmodules b/lib/cprofiles/.gitmodules index 3ae54b77cc1..801a82450d2 100644 --- a/lib/cprofiles/.gitmodules +++ b/lib/cprofiles/.gitmodules @@ -4,3 +4,4 @@ [submodule "lib/fluent-otel-proto"] path = lib/fluent-otel-proto url = https://github.com/fluent/fluent-otel-proto + diff --git a/lib/cprofiles/CMakeLists.txt b/lib/cprofiles/CMakeLists.txt index 51e2db560ee..f1e73d46142 100644 --- a/lib/cprofiles/CMakeLists.txt +++ b/lib/cprofiles/CMakeLists.txt @@ -5,8 +5,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # CMetrics Version set(CPROF_VERSION_MAJOR 0) -set(CPROF_VERSION_MINOR 0) -set(CPROF_VERSION_PATCH 1) +set(CPROF_VERSION_MINOR 1) +set(CPROF_VERSION_PATCH 0) set(CPROF_VERSION_STR "${CPROF_VERSION_MAJOR}.${CPROF_VERSION_MINOR}.${CPROF_VERSION_PATCH}") # Include helpers @@ -56,14 +56,6 @@ endif() include(cmake/libraries.cmake) include(cmake/headers.cmake) -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH}) -find_package(Sanitizers) - -if(SANITIZE_ADDRESS) - CPROF_DEFINITION(CPROF_HAVE_SANITIZE_ADDRESS) -endif() - - # Include headers and dependency headers include_directories( src @@ -146,14 +138,16 @@ endif() # Configure header files configure_file( "${PROJECT_SOURCE_DIR}/include/cprofiles/cprof_info.h.in" - "${PROJECT_SOURCE_DIR}/include/cprofiles/cprof_info.h" + "${PROJECT_BINARY_DIR}/include/cprofiles/cprof_info.h" ) configure_file( "${PROJECT_SOURCE_DIR}/include/cprofiles/cprof_version.h.in" - "${PROJECT_SOURCE_DIR}/include/cprofiles/cprof_version.h" + "${PROJECT_BINARY_DIR}/include/cprofiles/cprof_version.h" ) +include_directories("${PROJECT_BINARY_DIR}/include/") + # Installation Directories # ======================== if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") @@ -223,7 +217,7 @@ endif() # fluent-otel-proto if (NOT CPROF_HAVE_FLUENT_OTEL_PROTO) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/${CPROF_PATH_LIB_FLUENT_OTEL_PROTO}/include) - CPROF_OPTION(FLUENT_PROTO_METRICS "on") + CPROF_OPTION(FLUENT_PROTO_PROFILES "on") CPROF_OPTION(FLUENT_PROTO_EXAMPLES "off") add_subdirectory(lib/fluent-otel-proto) CPROF_DEFINITION(CPROF_HAVE_FLUENT_OTEL_PROTO) @@ -353,7 +347,6 @@ if(CPROF_SYSTEM_MACOS) if (CPACK_GENERATOR MATCHES "productbuild") set(CPACK_SET_DESTDIR "ON") - configure_file(cpack/macos/welcome.txt.cmakein ${CMAKE_CURRENT_SOURCE_DIR}/welcome.txt) configure_file(LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt) find_program(CONVERTER textutil) if (NOT CONVERTER) @@ -363,7 +356,6 @@ if(CPROF_SYSTEM_MACOS) execute_process(COMMAND ${CONVERTER} -convert html "${CMAKE_CURRENT_SOURCE_DIR}/README.md" -output "${CMAKE_CURRENT_SOURCE_DIR}/README.html") endif() set(CPACK_PACKAGE_FILE_NAME "${CMETRICS_PKG}") - set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_CURRENT_SOURCE_DIR}/welcome.txt) set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt) set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.html) set(CPACK_PRODUCTBUILD_IDENTIFIER "com.calyptia.${CPACK_PACKAGE_NAME}") @@ -371,6 +363,6 @@ if(CPROF_SYSTEM_MACOS) endif() # Create tarball -# add_custom_target(tarball COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR}/create-submoduled-tarball.sh" "cprofiles-${CPROF_VERSION_STR}") +add_custom_target(cprofiles_tarball COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR}/create-submoduled-tarball.sh" "cprofiles-${CPROF_VERSION_STR}") include(CPack) diff --git a/lib/cprofiles/include/cprofiles/cprof_decode_msgpack.h b/lib/cprofiles/include/cprofiles/cprof_decode_msgpack.h new file mode 100644 index 00000000000..c5013937247 --- /dev/null +++ b/lib/cprofiles/include/cprofiles/cprof_decode_msgpack.h @@ -0,0 +1,43 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ======== + * Copyright 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CPROF_DECODE_MSGPACK_H +#define CPROF_DECODE_MSGPACK_H + +#include +#include + +#define CPROF_DECODE_MSGPACK_SUCCESS 0 +#define CPROF_DECODE_MSGPACK_ALLOCATION_ERROR 1 +#define CPROF_DECODE_MSGPACK_INSUFFICIENT_DATA 2 +#define CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR 3 + +struct crof_msgpack_decode_context { + struct cprof *inner_context; + mpack_reader_t reader; +}; + +int cprof_decode_msgpack_create(struct cprof **result_context, + unsigned char *in_buf, + size_t in_size, + size_t *offset); + +void cprof_decode_msgpack_destroy(struct cprof *context); + +#endif diff --git a/lib/cprofiles/include/cprofiles/cprof_info.h b/lib/cprofiles/include/cprofiles/cprof_encode_msgpack.h similarity index 51% rename from lib/cprofiles/include/cprofiles/cprof_info.h rename to lib/cprofiles/include/cprofiles/cprof_encode_msgpack.h index 10f06c905cd..b02c86477cf 100644 --- a/lib/cprofiles/include/cprofiles/cprof_info.h +++ b/lib/cprofiles/include/cprofiles/cprof_encode_msgpack.h @@ -2,7 +2,7 @@ /* CProfiles * ======== - * Copyright 2024 The CMetrics Authors + * Copyright 2024 The CProfiles Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,24 +17,26 @@ * limitations under the License. */ -#ifndef CPROF_INFO_H -#define CPROF_INFO_H +#ifndef CPROF_ENCODE_MSGPACK_H +#define CPROF_ENCODE_MSGPACK_H -#define CPROF_SOURCE_DIR "/src/fluent-bit" +#include +#include +#include -/* General flags set by /CMakeLists.txt */ -#ifndef CPROF_HAVE_TIMESPEC_GET -#define CPROF_HAVE_TIMESPEC_GET -#endif -#ifndef CPROF_HAVE_GMTIME_R -#define CPROF_HAVE_GMTIME_R -#endif -#ifndef CPROF_HAVE_CFL -#define CPROF_HAVE_CFL -#endif -#ifndef CPROF_HAVE_FLUENT_OTEL_PROTO -#define CPROF_HAVE_FLUENT_OTEL_PROTO -#endif +#define CPROF_ENCODE_MSGPACK_SUCCESS 0 +#define CPROF_ENCODE_MSGPACK_ALLOCATION_ERROR 1 +#define CPROF_ENCODE_MSGPACK_INVALID_ARGUMENT_ERROR 2 + +struct cprof_msgpack_encoding_context { + mpack_writer_t writer; + char *output_buffer; + size_t output_size; +}; + +int cprof_encode_msgpack_create(cfl_sds_t *result_buffer, + struct cprof *profile); +void cprof_encode_msgpack_destroy(cfl_sds_t instance); #endif diff --git a/lib/cprofiles/include/cprofiles/cprof_encode_opentelemetry.h b/lib/cprofiles/include/cprofiles/cprof_encode_opentelemetry.h new file mode 100644 index 00000000000..312a29fc2ea --- /dev/null +++ b/lib/cprofiles/include/cprofiles/cprof_encode_opentelemetry.h @@ -0,0 +1,46 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ======== + * Copyright 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CPROF_ENCODE_OPENTELEMETRY_H +#define CPROF_ENCODE_OPENTELEMETRY_H + +#include +#include +#include + +#define CPROF_ENCODE_OPENTELEMETRY_SUCCESS 0 +#define CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR 1 +#define CPROF_ENCODE_OPENTELEMETRY_INVALID_ARGUMENT_ERROR 2 +#define CPROF_ENCODE_OPENTELEMETRY_INTERNAL_ENCODER_ERROR 3 +#define CPROF_ENCODE_OPENTELEMETRY_UNIDENTIFIED_ERROR 99 + +struct cprof_opentelemetry_encoding_context { + struct cprof *inner_context; + Opentelemetry__Proto__Collector__Profiles__V1development__ExportProfilesServiceRequest \ + *export_service_request; + //char *output_buffer; + //size_t output_size; +}; + +int cprof_encode_opentelemetry_create(cfl_sds_t *result_buffer, + struct cprof *profile); + +void cprof_encode_opentelemetry_destroy(cfl_sds_t instance); + +#endif diff --git a/lib/cprofiles/include/cprofiles/cprof_mpack_utils.h b/lib/cprofiles/include/cprofiles/cprof_mpack_utils.h new file mode 100644 index 00000000000..220c1ce8fc1 --- /dev/null +++ b/lib/cprofiles/include/cprofiles/cprof_mpack_utils.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ======== + * Copyright 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CPROF_MPACK_UTILS_H +#define CPROF_MPACK_UTILS_H + +#include +#include +#include + +typedef int (*cprof_mpack_unpacker_entry_callback_fn_t)(mpack_reader_t *reader, + size_t index, + void *context); + +struct cprof_mpack_map_entry_callback_t { + const char *identifier; + cprof_mpack_unpacker_entry_callback_fn_t handler; +}; + +int cprof_mpack_consume_nil_tag(mpack_reader_t *reader); +int cprof_mpack_consume_double_tag(mpack_reader_t *reader, double *output_buffer); +int cprof_mpack_consume_int_tag(mpack_reader_t *reader, int64_t *output_buffer); +int cprof_mpack_consume_int32_tag(mpack_reader_t *reader, int32_t *output_buffer); +int cprof_mpack_consume_int64_tag(mpack_reader_t *reader, int64_t *output_buffer); +int cprof_mpack_consume_uint_tag(mpack_reader_t *reader, uint64_t *output_buffer); +int cprof_mpack_consume_uint32_tag(mpack_reader_t *reader, uint32_t *output_buffer); +int cprof_mpack_consume_uint64_tag(mpack_reader_t *reader, uint64_t *output_buffer); +int cprof_mpack_consume_string_tag(mpack_reader_t *reader, cfl_sds_t *output_buffer); +int cprof_mpack_consume_binary_tag(mpack_reader_t *reader, cfl_sds_t *output_buffer); +int cprof_mpack_consume_string_or_nil_tag(mpack_reader_t *reader, cfl_sds_t *output_buffer); +int cprof_mpack_consume_binary_or_nil_tag(mpack_reader_t *reader, cfl_sds_t *output_buffer); +int cprof_mpack_unpack_map(mpack_reader_t *reader, + struct cprof_mpack_map_entry_callback_t *callback_list, + void *context); +int cprof_mpack_unpack_array(mpack_reader_t *reader, + cprof_mpack_unpacker_entry_callback_fn_t entry_processor_callback, + void *context); +int cprof_mpack_peek_array_length(mpack_reader_t *reader); +mpack_type_t cprof_mpack_peek_type(mpack_reader_t *reader); + +#endif diff --git a/lib/cprofiles/include/cprofiles/cprof_mpack_utils_defs.h b/lib/cprofiles/include/cprofiles/cprof_mpack_utils_defs.h new file mode 100644 index 00000000000..b78d8d89c6e --- /dev/null +++ b/lib/cprofiles/include/cprofiles/cprof_mpack_utils_defs.h @@ -0,0 +1,40 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ======== + * Copyright 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CPROF_MPACK_UTILS_DEFS_H +#define CPROF_MPACK_UTILS_DEFS_H + +#define CPROF_MPACK_SUCCESS 0 +#define CPROF_MPACK_INSUFFICIENT_DATA 1 +#define CPROF_MPACK_INVALID_ARGUMENT_ERROR 2 +#define CPROF_MPACK_ALLOCATION_ERROR 3 +#define CPROF_MPACK_CORRUPT_INPUT_DATA_ERROR 4 +#define CPROF_MPACK_CONSUME_ERROR 5 +#define CPROF_MPACK_ENGINE_ERROR 6 +#define CPROF_MPACK_PENDING_MAP_ENTRIES 7 +#define CPROF_MPACK_PENDING_ARRAY_ENTRIES 8 +#define CPROF_MPACK_UNEXPECTED_KEY_ERROR 9 +#define CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR 10 +#define CPROF_MPACK_ERROR_CUTOFF 20 + +#define CPROF_MPACK_MAX_ARRAY_ENTRY_COUNT 65535 +#define CPROF_MPACK_MAX_MAP_ENTRY_COUNT 1024 +#define CPROF_MPACK_MAX_STRING_LENGTH 1024 + +#endif \ No newline at end of file diff --git a/lib/cprofiles/include/cprofiles/cprof_variant_utils.h b/lib/cprofiles/include/cprofiles/cprof_variant_utils.h new file mode 100644 index 00000000000..f26bc93148c --- /dev/null +++ b/lib/cprofiles/include/cprofiles/cprof_variant_utils.h @@ -0,0 +1,643 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ======== + * Copyright 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CPROF_VARIANT_UTILS_H +#define CPROF_VARIANT_UTILS_H + +#include + +#define CFL_VARIANT_UTILS_MAXIMUM_FIXED_ARRAY_SIZE 100 +#define CFL_VARIANT_UTILS_INITIAL_ARRAY_SIZE 100 +#define CFL_VARIANT_UTILS_SERIALIZED_ARRAY_SIZE_LIMIT 100000 + +/* These are the only functions meant for general use, + * the reason why the kvlist packing and unpacking + * functions are exposed is the internal and external + * metadata kvlists in the cmetrics context are not + * contained by a variant instance. + * + * Result : + * Upon success all of these return 0, otherwise they will + * raise the innermost error code which should be treated + * as an opaque value. + * + * Notes : + * When decoding -1 means the check after mpack_read_tag + * failed and -2 means the type was not the one expected + */ + +static inline int pack_cfl_variant(mpack_writer_t *writer, + struct cfl_variant *value); + +static inline int pack_cfl_variant_kvlist(mpack_writer_t *writer, + struct cfl_kvlist *kvlist); + +static inline int unpack_cfl_variant(mpack_reader_t *reader, + struct cfl_variant **value); + +static inline int unpack_cfl_kvlist(mpack_reader_t *reader, + struct cfl_kvlist **result_kvlist); + +/* Packers */ +static inline int pack_cfl_variant_string(mpack_writer_t *writer, + char *value) +{ + mpack_write_cstr(writer, value); + + return 0; +} + +static inline int pack_cfl_variant_binary(mpack_writer_t *writer, + char *value, + size_t length) +{ + mpack_write_bin(writer, value, length); + + return 0; +} + +static inline int pack_cfl_variant_boolean(mpack_writer_t *writer, + unsigned int value) +{ + mpack_write_bool(writer, value); + + return 0; +} + +static inline int pack_cfl_variant_int64(mpack_writer_t *writer, + int64_t value) +{ + mpack_write_int(writer, value); + + return 0; +} + +static inline int pack_cfl_variant_double(mpack_writer_t *writer, + double value) +{ + mpack_write_double(writer, value); + + return 0; +} + +static inline int pack_cfl_variant_array(mpack_writer_t *writer, + struct cfl_array *array) +{ + size_t entry_count; + struct cfl_variant *entry_value; + int result; + size_t index; + + entry_count = array->entry_count; + + mpack_start_array(writer, entry_count); + + for (index = 0 ; index < entry_count ; index++) { + entry_value = cfl_array_fetch_by_index(array, index); + + if (entry_value == NULL) { + return -1; + } + + result = pack_cfl_variant(writer, entry_value); + + if (result != 0) { + return result; + } + } + + mpack_finish_array(writer); + + return 0; +} + +static inline int pack_cfl_variant_kvlist(mpack_writer_t *writer, + struct cfl_kvlist *kvlist) { + size_t entry_count; + struct cfl_list *iterator; + struct cfl_kvpair *kvpair; + int result; + + entry_count = cfl_kvlist_count(kvlist); + + mpack_start_map(writer, entry_count); + + cfl_list_foreach(iterator, &kvlist->list) { + kvpair = cfl_list_entry(iterator, struct cfl_kvpair, _head); + + mpack_write_cstr(writer, kvpair->key); + + result = pack_cfl_variant(writer, kvpair->val); + + if (result != 0) { + return result; + } + } + + mpack_finish_map(writer); + + return 0; +} + +static inline int pack_cfl_variant(mpack_writer_t *writer, + struct cfl_variant *value) +{ + int result; + + if (value->type == CFL_VARIANT_STRING) { + result = pack_cfl_variant_string(writer, value->data.as_string); + } + else if (value->type == CFL_VARIANT_BOOL) { + result = pack_cfl_variant_boolean(writer, value->data.as_bool); + } + else if (value->type == CFL_VARIANT_INT) { + result = pack_cfl_variant_int64(writer, value->data.as_int64); + } + else if (value->type == CFL_VARIANT_DOUBLE) { + result = pack_cfl_variant_double(writer, value->data.as_double); + } + else if (value->type == CFL_VARIANT_ARRAY) { + result = pack_cfl_variant_array(writer, value->data.as_array); + } + else if (value->type == CFL_VARIANT_KVLIST) { + result = pack_cfl_variant_kvlist(writer, value->data.as_kvlist); + } + else if (value->type == CFL_VARIANT_BYTES) { + result = pack_cfl_variant_binary(writer, + value->data.as_bytes, + cfl_sds_len(value->data.as_bytes)); + } + else if (value->type == CFL_VARIANT_REFERENCE) { + result = pack_cfl_variant_string(writer, value->data.as_string); + } + else { + result = -1; + } + + return result; +} + +/* Unpackers */ + +static inline int unpack_cfl_variant_read_tag(mpack_reader_t *reader, + mpack_tag_t *tag, + mpack_type_t expected_type) +{ + *tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return -1; + } + + if (mpack_tag_type(tag) != expected_type) { + return -2; + } + + return 0; +} + +static inline int unpack_cfl_array(mpack_reader_t *reader, + struct cfl_array **result_array) +{ + struct cfl_array *internal_array; + size_t entry_count; + struct cfl_variant *entry_value; + int result; + size_t index; + mpack_tag_t tag; + + result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_array); + + if (result != 0) { + return result; + } + + entry_count = mpack_tag_array_count(&tag); + + if (entry_count >= CFL_VARIANT_UTILS_SERIALIZED_ARRAY_SIZE_LIMIT) { + return -2; + } + + if (entry_count >= CFL_VARIANT_UTILS_MAXIMUM_FIXED_ARRAY_SIZE) { + internal_array = cfl_array_create(CFL_VARIANT_UTILS_INITIAL_ARRAY_SIZE); + } + else { + internal_array = cfl_array_create(entry_count); + } + + if (internal_array == NULL) { + return -3; + } + + if (entry_count >= CFL_VARIANT_UTILS_MAXIMUM_FIXED_ARRAY_SIZE) { + cfl_array_resizable(internal_array, CFL_TRUE); + } + + for (index = 0 ; index < entry_count ; index++) { + result = unpack_cfl_variant(reader, &entry_value); + + if (result != 0) { + cfl_array_destroy(internal_array); + + return -4; + } + + result = cfl_array_append(internal_array, entry_value); + + if (result != 0) { + cfl_array_destroy(internal_array); + + return -5; + } + } + + mpack_done_array(reader); + + if (mpack_reader_error(reader) != mpack_ok) { + cfl_array_destroy(internal_array); + + return -6; + } + + *result_array = internal_array; + + return 0; +} + +static inline int unpack_cfl_kvlist(mpack_reader_t *reader, + struct cfl_kvlist **result_kvlist) +{ + struct cfl_kvlist *internal_kvlist; + char key_name[256]; + size_t entry_count; + size_t key_length; + struct cfl_variant *key_value; + mpack_tag_t key_tag; + int result; + size_t index; + mpack_tag_t tag; + + result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_map); + + if (result != 0) { + return result; + } + + entry_count = mpack_tag_map_count(&tag); + + internal_kvlist = cfl_kvlist_create(); + + if (internal_kvlist == NULL) { + return -3; + } + + result = 0; + key_value = NULL; + + for (index = 0 ; index < entry_count ; index++) { + result = unpack_cfl_variant_read_tag(reader, &key_tag, mpack_type_str); + + if (result != 0) { + result = -4; + + break; + } + + key_length = mpack_tag_str_length(&key_tag); + + if (key_length >= sizeof(key_name)) { + result = -5; + + break; + } + + mpack_read_cstr(reader, key_name, sizeof(key_name), key_length); + + key_name[key_length] = '\0'; + + mpack_done_str(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + result = -6; + + break; + } + + result = unpack_cfl_variant(reader, &key_value); + + if (result != 0) { + result = -7; + + break; + } + + result = cfl_kvlist_insert(internal_kvlist, key_name, key_value); + + if (result != 0) { + result = -8; + + break; + } + + key_value = NULL; + } + + mpack_done_map(reader); + + if (mpack_reader_error(reader) != mpack_ok) { + result = -9; + } + + if (result != 0) { + cfl_kvlist_destroy(internal_kvlist); + + if (key_value != NULL) { + cfl_variant_destroy(key_value); + } + } + else { + *result_kvlist = internal_kvlist; + } + + return result; +} + +static inline int unpack_cfl_variant_string(mpack_reader_t *reader, + struct cfl_variant **value) +{ + size_t value_length; + char *value_data; + int result; + mpack_tag_t tag; + + result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_str); + + if (result != 0) { + return result; + } + + value_length = mpack_tag_str_length(&tag); + + value_data = cfl_sds_create_size(value_length + 1); + + if (value_data == NULL) { + return -3; + } + + cfl_sds_set_len(value_data, value_length); + + mpack_read_cstr(reader, value_data, value_length + 1, value_length); + + mpack_done_str(reader); + + if (mpack_reader_error(reader) != mpack_ok) { + cfl_sds_destroy(value_data); + + return -4; + } + + *value = cfl_variant_create_from_reference(value_data); + + if (*value == NULL) { + return -5; + } + + (*value)->type = CFL_VARIANT_STRING; + + return 0; +} + +static inline int unpack_cfl_variant_binary(mpack_reader_t *reader, + struct cfl_variant **value) +{ + size_t value_length; + char *value_data; + int result; + mpack_tag_t tag; + + result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_bin); + + if (result != 0) { + return result; + } + + value_length = mpack_tag_bin_length(&tag); + + value_data = cfl_sds_create_size(value_length); + + if (value_data == NULL) { + return -3; + } + + cfl_sds_set_len(value_data, value_length); + + mpack_read_bytes(reader, value_data, value_length); + + mpack_done_bin(reader); + + if (mpack_reader_error(reader) != mpack_ok) { + cfl_sds_destroy(value_data); + + return -4; + } + + *value = cfl_variant_create_from_reference(value_data); + + if (*value == NULL) { + return -5; + } + + (*value)->type = CFL_VARIANT_BYTES; + + return 0; +} + +static inline int unpack_cfl_variant_boolean(mpack_reader_t *reader, + struct cfl_variant **value) +{ + int result; + mpack_tag_t tag; + + result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_bool); + + if (result != 0) { + return result; + } + + *value = cfl_variant_create_from_bool((unsigned int) mpack_tag_bool_value(&tag)); + + if (*value == NULL) { + return -3; + } + + return 0; +} + +static inline int unpack_cfl_variant_uint64(mpack_reader_t *reader, + struct cfl_variant **value) +{ + int result; + mpack_tag_t tag; + + result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_uint); + + if (result != 0) { + return result; + } + + *value = cfl_variant_create_from_int64((int64_t) mpack_tag_uint_value(&tag)); + + if (*value == NULL) { + return -3; + } + + return 0; +} + +static inline int unpack_cfl_variant_int64(mpack_reader_t *reader, + struct cfl_variant **value) +{ + int result; + mpack_tag_t tag; + + result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_int); + + if (result != 0) { + return result; + } + + *value = cfl_variant_create_from_int64((int64_t) mpack_tag_int_value(&tag)); + + if (*value == NULL) { + return -3; + } + + return 0; +} + +static inline int unpack_cfl_variant_double(mpack_reader_t *reader, + struct cfl_variant **value) +{ + int result; + mpack_tag_t tag; + + result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_double); + + if (result != 0) { + return result; + } + + *value = cfl_variant_create_from_double(mpack_tag_double_value(&tag)); + + if (*value == NULL) { + return -3; + } + + return 0; +} + +static inline int unpack_cfl_variant_array(mpack_reader_t *reader, + struct cfl_variant **value) +{ + struct cfl_array *unpacked_array; + int result; + + result = unpack_cfl_array(reader, &unpacked_array); + + if (result != 0) { + return result; + } + + *value = cfl_variant_create_from_array(unpacked_array); + + if (*value == NULL) { + return -3; + } + + return 0; +} + +static inline int unpack_cfl_variant_kvlist(mpack_reader_t *reader, + struct cfl_variant **value) +{ + struct cfl_kvlist *unpacked_kvlist; + int result; + + result = unpack_cfl_kvlist(reader, &unpacked_kvlist); + + if (result != 0) { + return result; + } + + *value = cfl_variant_create_from_kvlist(unpacked_kvlist); + + if (*value == NULL) { + return -3; + } + + return 0; +} + +static inline int unpack_cfl_variant(mpack_reader_t *reader, + struct cfl_variant **value) +{ + mpack_type_t value_type; + int result; + mpack_tag_t tag; + + tag = mpack_peek_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return -1; + } + + value_type = mpack_tag_type(&tag); + + if (value_type == mpack_type_str) { + result = unpack_cfl_variant_string(reader, value); + } + else if (value_type == mpack_type_bool) { + result = unpack_cfl_variant_boolean(reader, value); + } + else if (value_type == mpack_type_int) { + result = unpack_cfl_variant_int64(reader, value); + } + else if (value_type == mpack_type_uint) { + result = unpack_cfl_variant_uint64(reader, value); + } + else if (value_type == mpack_type_double) { + result = unpack_cfl_variant_double(reader, value); + } + else if (value_type == mpack_type_array) { + result = unpack_cfl_variant_array(reader, value); + } + else if (value_type == mpack_type_map) { + result = unpack_cfl_variant_kvlist(reader, value); + } + else if (value_type == mpack_type_bin) { + result = unpack_cfl_variant_binary(reader, value); + } + else { + result = -1; + } + + return result; +} + +#endif diff --git a/lib/cprofiles/include/cprofiles/cprof_version.h b/lib/cprofiles/include/cprofiles/cprof_version.h deleted file mode 100644 index d2f46894f46..00000000000 --- a/lib/cprofiles/include/cprofiles/cprof_version.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* Chunk I/O - * ========= - * Copyright 2018 Eduardo Silva - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef CPROF_VERSION_H -#define CPROF_VERSION_H - -/* Helpers to convert/format version string */ -#define STR_HELPER(s) #s -#define STR(s) STR_HELPER(s) - -/* Chunk I/O Version */ -#define CPROF_VERSION_MAJOR 0 -#define CPROF_VERSION_MINOR 0 -#define CPROF_VERSION_PATCH 1 -#define CPROF_VERSION (CPROF_VERSION_MAJOR * 10000 \ - CPROF_VERSION_MINOR * 100 \ - CPROF_VERSION_PATCH) -#define CPROF_VERSION_STR "0.0.1" - -#endif diff --git a/lib/cprofiles/lib/mpack/CMakeLists.txt b/lib/cprofiles/lib/mpack/CMakeLists.txt new file mode 100644 index 00000000000..bc6e731575f --- /dev/null +++ b/lib/cprofiles/lib/mpack/CMakeLists.txt @@ -0,0 +1,31 @@ +set(src + src/mpack/mpack.c + ) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") +add_definitions(-DMPACK_EXTENSIONS=1) +add_library(mpack-static STATIC ${src}) + +# Install Library +if(MSVC) + # Rename the output for Windows environment to avoid naming issues + set_target_properties(mpack-static PROPERTIES OUTPUT_NAME libmpack) +else() + set_target_properties(mpack-static PROPERTIES OUTPUT_NAME mpack) +endif(MSVC) + +# Installation Directories +# ======================== +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(MPACK_INSTALL_LIBDIR "lib") + set(MPACK_INSTALL_INCLUDEDIR "include") +else() + set(MPACK_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(MPACK_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include") +endif() + +install(TARGETS mpack-static + RUNTIME DESTINATION ${MPACK_INSTALL_BINDIR} + LIBRARY DESTINATION ${MPACK_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${MPACK_INSTALL_LIBDIR} + COMPONENT library) diff --git a/lib/cprofiles/lib/mpack/src/mpack/mpack.c b/lib/cprofiles/lib/mpack/src/mpack/mpack.c new file mode 100644 index 00000000000..337ab0955a6 --- /dev/null +++ b/lib/cprofiles/lib/mpack/src/mpack/mpack.c @@ -0,0 +1,6472 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2015-2018 Nicholas Fraser + * + * 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 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. + * + */ + +/* + * This is the MPack 1.0 amalgamation package. + * + * http://github.com/ludocode/mpack + */ + +#define MPACK_INTERNAL 1 +#define MPACK_EMIT_INLINE_DEFS 1 + +#include "mpack.h" + + +/* mpack/mpack-platform.c.c */ + + +// We define MPACK_EMIT_INLINE_DEFS and include mpack.h to emit +// standalone definitions of all (non-static) inline functions in MPack. + +#define MPACK_INTERNAL 1 +#define MPACK_EMIT_INLINE_DEFS 1 + +/* #include "mpack-platform.h" */ +/* #include "mpack.h" */ + + +#if MPACK_DEBUG && MPACK_STDIO +#include +#endif + + + +#if MPACK_DEBUG + +#if MPACK_STDIO +void mpack_assert_fail_format(const char* format, ...) { + char buffer[512]; + va_list args; + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + va_end(args); + buffer[sizeof(buffer) - 1] = 0; + mpack_assert_fail_wrapper(buffer); +} + +void mpack_break_hit_format(const char* format, ...) { + char buffer[512]; + va_list args; + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + va_end(args); + buffer[sizeof(buffer) - 1] = 0; + mpack_break_hit(buffer); +} +#endif + +#if !MPACK_CUSTOM_ASSERT +void mpack_assert_fail(const char* message) { + MPACK_UNUSED(message); + + #if MPACK_STDIO + fprintf(stderr, "%s\n", message); + #endif +} +#endif + +// We split the assert failure from the wrapper so that a +// custom assert function can return. +void mpack_assert_fail_wrapper(const char* message) { + + #ifdef MPACK_GCOV + // gcov marks even __builtin_unreachable() as an uncovered line. this + // silences it. + (mpack_assert_fail(message), __builtin_unreachable()); + + #else + mpack_assert_fail(message); + + // mpack_assert_fail() is not supposed to return. in case it does, we + // abort. + + #if !MPACK_NO_BUILTINS + #if defined(__GNUC__) || defined(__clang__) + __builtin_trap(); + #elif defined(WIN32) + __debugbreak(); + #endif + #endif + + #if (defined(__GNUC__) || defined(__clang__)) && !MPACK_NO_BUILTINS + __builtin_abort(); + #elif MPACK_STDLIB + abort(); + #endif + + MPACK_UNREACHABLE; + #endif +} + +#if !MPACK_CUSTOM_BREAK + +// If we have a custom assert handler, break wraps it by default. +// This allows users of MPack to only implement mpack_assert_fail() without +// having to worry about the difference between assert and break. +// +// MPACK_CUSTOM_BREAK is available to define a separate break handler +// (which is needed by the unit test suite), but this is not offered in +// mpack-config.h for simplicity. + +#if MPACK_CUSTOM_ASSERT +void mpack_break_hit(const char* message) { + mpack_assert_fail_wrapper(message); +} +#else +void mpack_break_hit(const char* message) { + MPACK_UNUSED(message); + + #if MPACK_STDIO + fprintf(stderr, "%s\n", message); + #endif + + #if defined(__GNUC__) || defined(__clang__) && !MPACK_NO_BUILTINS + __builtin_trap(); + #elif defined(WIN32) && !MPACK_NO_BUILTINS + __debugbreak(); + #elif MPACK_STDLIB + abort(); + #endif +} +#endif + +#endif + +#endif + + + +// The below are adapted from the C wikibook: +// https://en.wikibooks.org/wiki/C_Programming/Strings + +#ifndef mpack_memcmp +int mpack_memcmp(const void* s1, const void* s2, size_t n) { + const unsigned char *us1 = (const unsigned char *) s1; + const unsigned char *us2 = (const unsigned char *) s2; + while (n-- != 0) { + if (*us1 != *us2) + return (*us1 < *us2) ? -1 : +1; + us1++; + us2++; + } + return 0; +} +#endif + +#ifndef mpack_memcpy +void* mpack_memcpy(void* MPACK_RESTRICT s1, const void* MPACK_RESTRICT s2, size_t n) { + char* MPACK_RESTRICT dst = (char *)s1; + const char* MPACK_RESTRICT src = (const char *)s2; + while (n-- != 0) + *dst++ = *src++; + return s1; +} +#endif + +#ifndef mpack_memmove +void* mpack_memmove(void* s1, const void* s2, size_t n) { + char *p1 = (char *)s1; + const char *p2 = (const char *)s2; + if (p2 < p1 && p1 < p2 + n) { + p2 += n; + p1 += n; + while (n-- != 0) + *--p1 = *--p2; + } else + while (n-- != 0) + *p1++ = *p2++; + return s1; +} +#endif + +#ifndef mpack_memset +void* mpack_memset(void* s, int c, size_t n) { + unsigned char *us = (unsigned char *)s; + unsigned char uc = (unsigned char)c; + while (n-- != 0) + *us++ = uc; + return s; +} +#endif + +#ifndef mpack_strlen +size_t mpack_strlen(const char* s) { + const char* p = s; + while (*p != '\0') + p++; + return (size_t)(p - s); +} +#endif + + + +#if defined(MPACK_MALLOC) && !defined(MPACK_REALLOC) +void* mpack_realloc(void* old_ptr, size_t used_size, size_t new_size) { + if (new_size == 0) { + if (old_ptr) + MPACK_FREE(old_ptr); + return NULL; + } + + void* new_ptr = MPACK_MALLOC(new_size); + if (new_ptr == NULL) + return NULL; + + mpack_memcpy(new_ptr, old_ptr, used_size); + MPACK_FREE(old_ptr); + return new_ptr; +} +#endif + +/* mpack/mpack-common.c.c */ + +#define MPACK_INTERNAL 1 + +/* #include "mpack-common.h" */ + +#if MPACK_DEBUG && MPACK_STDIO +#include +#endif + +const char* mpack_error_to_string(mpack_error_t error) { + #if MPACK_STRINGS + switch (error) { + #define MPACK_ERROR_STRING_CASE(e) case e: return #e + MPACK_ERROR_STRING_CASE(mpack_ok); + MPACK_ERROR_STRING_CASE(mpack_error_io); + MPACK_ERROR_STRING_CASE(mpack_error_invalid); + MPACK_ERROR_STRING_CASE(mpack_error_unsupported); + MPACK_ERROR_STRING_CASE(mpack_error_type); + MPACK_ERROR_STRING_CASE(mpack_error_too_big); + MPACK_ERROR_STRING_CASE(mpack_error_memory); + MPACK_ERROR_STRING_CASE(mpack_error_bug); + MPACK_ERROR_STRING_CASE(mpack_error_data); + MPACK_ERROR_STRING_CASE(mpack_error_eof); + #undef MPACK_ERROR_STRING_CASE + } + mpack_assert(0, "unrecognized error %i", (int)error); + return "(unknown mpack_error_t)"; + #else + MPACK_UNUSED(error); + return ""; + #endif +} + +const char* mpack_type_to_string(mpack_type_t type) { + #if MPACK_STRINGS + switch (type) { + #define MPACK_TYPE_STRING_CASE(e) case e: return #e + MPACK_TYPE_STRING_CASE(mpack_type_missing); + MPACK_TYPE_STRING_CASE(mpack_type_nil); + MPACK_TYPE_STRING_CASE(mpack_type_bool); + MPACK_TYPE_STRING_CASE(mpack_type_float); + MPACK_TYPE_STRING_CASE(mpack_type_double); + MPACK_TYPE_STRING_CASE(mpack_type_int); + MPACK_TYPE_STRING_CASE(mpack_type_uint); + MPACK_TYPE_STRING_CASE(mpack_type_str); + MPACK_TYPE_STRING_CASE(mpack_type_bin); + MPACK_TYPE_STRING_CASE(mpack_type_array); + MPACK_TYPE_STRING_CASE(mpack_type_map); + #if MPACK_EXTENSIONS + MPACK_TYPE_STRING_CASE(mpack_type_ext); + #endif + #undef MPACK_TYPE_STRING_CASE + } + mpack_assert(0, "unrecognized type %i", (int)type); + return "(unknown mpack_type_t)"; + #else + MPACK_UNUSED(type); + return ""; + #endif +} + +int mpack_tag_cmp(mpack_tag_t left, mpack_tag_t right) { + + // positive numbers may be stored as int; convert to uint + if (left.type == mpack_type_int && left.v.i >= 0) { + left.type = mpack_type_uint; + left.v.u = (uint64_t)left.v.i; + } + if (right.type == mpack_type_int && right.v.i >= 0) { + right.type = mpack_type_uint; + right.v.u = (uint64_t)right.v.i; + } + + if (left.type != right.type) + return ((int)left.type < (int)right.type) ? -1 : 1; + + switch (left.type) { + case mpack_type_missing: // fallthrough + case mpack_type_nil: + return 0; + + case mpack_type_bool: + return (int)left.v.b - (int)right.v.b; + + case mpack_type_int: + if (left.v.i == right.v.i) + return 0; + return (left.v.i < right.v.i) ? -1 : 1; + + case mpack_type_uint: + if (left.v.u == right.v.u) + return 0; + return (left.v.u < right.v.u) ? -1 : 1; + + case mpack_type_array: + case mpack_type_map: + if (left.v.n == right.v.n) + return 0; + return (left.v.n < right.v.n) ? -1 : 1; + + case mpack_type_str: + case mpack_type_bin: + if (left.v.l == right.v.l) + return 0; + return (left.v.l < right.v.l) ? -1 : 1; + + #if MPACK_EXTENSIONS + case mpack_type_ext: + if (left.exttype == right.exttype) { + if (left.v.l == right.v.l) + return 0; + return (left.v.l < right.v.l) ? -1 : 1; + } + return (int)left.exttype - (int)right.exttype; + #endif + + // floats should not normally be compared for equality. we compare + // with memcmp() to silence compiler warnings, but this will return + // equal if both are NaNs with the same representation (though we may + // want this, for instance if you are for some bizarre reason using + // floats as map keys.) i'm not sure what the right thing to + // do is here. check for NaN first? always return false if the type + // is float? use operator== and pragmas to silence compiler warning? + // please send me your suggestions. + // note also that we don't convert floats to doubles, so when this is + // used for ordering purposes, all floats are ordered before all + // doubles. + case mpack_type_float: + return mpack_memcmp(&left.v.f, &right.v.f, sizeof(left.v.f)); + case mpack_type_double: + return mpack_memcmp(&left.v.d, &right.v.d, sizeof(left.v.d)); + } + + mpack_assert(0, "unrecognized type %i", (int)left.type); + return false; +} + +#if MPACK_DEBUG && MPACK_STDIO +static char mpack_hex_char(uint8_t hex_value) { + // Older compilers (e.g. GCC 4.4.7) promote the result of this ternary to + // int and warn under -Wconversion, so we have to cast it back to char. + return (char)((hex_value < 10) ? (char)('0' + hex_value) : (char)('a' + (hex_value - 10))); +} + +static void mpack_tag_debug_complete_bin_ext(mpack_tag_t tag, size_t string_length, char* buffer, size_t buffer_size, + const char* prefix, size_t prefix_size) +{ + // If at any point in this function we run out of space in the buffer, we + // bail out. The outer tag print wrapper will make sure we have a + // null-terminator. + + if (string_length == 0 || string_length >= buffer_size) + return; + buffer += string_length; + buffer_size -= string_length; + + size_t total = mpack_tag_bytes(&tag); + if (total == 0) { + strncpy(buffer, ">", buffer_size); + return; + } + + strncpy(buffer, ": ", buffer_size); + if (buffer_size < 2) + return; + buffer += 2; + buffer_size -= 2; + + size_t hex_bytes = 0; + for (size_t i = 0; i < MPACK_PRINT_BYTE_COUNT && i < prefix_size && buffer_size > 2; ++i) { + uint8_t byte = (uint8_t)prefix[i]; + buffer[0] = mpack_hex_char((uint8_t)(byte >> 4)); + buffer[1] = mpack_hex_char((uint8_t)(byte & 0xfu)); + buffer += 2; + buffer_size -= 2; + ++hex_bytes; + } + + if (buffer_size != 0) + mpack_snprintf(buffer, buffer_size, "%s>", (total > hex_bytes) ? "..." : ""); +} + +static void mpack_tag_debug_pseudo_json_bin(mpack_tag_t tag, char* buffer, size_t buffer_size, + const char* prefix, size_t prefix_size) +{ + mpack_assert(mpack_tag_type(&tag) == mpack_type_bin); + size_t length = (size_t)mpack_snprintf(buffer, buffer_size, ""); + return; + case mpack_type_nil: + mpack_snprintf(buffer, buffer_size, "null"); + return; + case mpack_type_bool: + mpack_snprintf(buffer, buffer_size, tag.v.b ? "true" : "false"); + return; + case mpack_type_int: + mpack_snprintf(buffer, buffer_size, "%" PRIi64, tag.v.i); + return; + case mpack_type_uint: + mpack_snprintf(buffer, buffer_size, "%" PRIu64, tag.v.u); + return; + case mpack_type_float: + mpack_snprintf(buffer, buffer_size, "%f", tag.v.f); + return; + case mpack_type_double: + mpack_snprintf(buffer, buffer_size, "%f", tag.v.d); + return; + + case mpack_type_str: + mpack_snprintf(buffer, buffer_size, "", tag.v.l); + return; + case mpack_type_bin: + mpack_tag_debug_pseudo_json_bin(tag, buffer, buffer_size, prefix, prefix_size); + return; + #if MPACK_EXTENSIONS + case mpack_type_ext: + mpack_tag_debug_pseudo_json_ext(tag, buffer, buffer_size, prefix, prefix_size); + return; + #endif + + case mpack_type_array: + mpack_snprintf(buffer, buffer_size, "", tag.v.n); + return; + case mpack_type_map: + mpack_snprintf(buffer, buffer_size, "", tag.v.n); + return; + } + + mpack_snprintf(buffer, buffer_size, ""); +} + +void mpack_tag_debug_pseudo_json(mpack_tag_t tag, char* buffer, size_t buffer_size, + const char* prefix, size_t prefix_size) +{ + mpack_assert(buffer_size > 0, "buffer size cannot be zero!"); + buffer[0] = 0; + + mpack_tag_debug_pseudo_json_impl(tag, buffer, buffer_size, prefix, prefix_size); + + // We always null-terminate the buffer manually just in case the snprintf() + // function doesn't null-terminate when the string doesn't fit. + buffer[buffer_size - 1] = 0; +} + +static void mpack_tag_debug_describe_impl(mpack_tag_t tag, char* buffer, size_t buffer_size) { + switch (tag.type) { + case mpack_type_missing: + mpack_snprintf(buffer, buffer_size, "missing"); + return; + case mpack_type_nil: + mpack_snprintf(buffer, buffer_size, "nil"); + return; + case mpack_type_bool: + mpack_snprintf(buffer, buffer_size, tag.v.b ? "true" : "false"); + return; + case mpack_type_int: + mpack_snprintf(buffer, buffer_size, "int %" PRIi64, tag.v.i); + return; + case mpack_type_uint: + mpack_snprintf(buffer, buffer_size, "uint %" PRIu64, tag.v.u); + return; + case mpack_type_float: + mpack_snprintf(buffer, buffer_size, "float %f", tag.v.f); + return; + case mpack_type_double: + mpack_snprintf(buffer, buffer_size, "double %f", tag.v.d); + return; + case mpack_type_str: + mpack_snprintf(buffer, buffer_size, "str of %u bytes", tag.v.l); + return; + case mpack_type_bin: + mpack_snprintf(buffer, buffer_size, "bin of %u bytes", tag.v.l); + return; + #if MPACK_EXTENSIONS + case mpack_type_ext: + mpack_snprintf(buffer, buffer_size, "ext of type %i, %u bytes", + mpack_tag_ext_exttype(&tag), mpack_tag_ext_length(&tag)); + return; + #endif + case mpack_type_array: + mpack_snprintf(buffer, buffer_size, "array of %u elements", tag.v.n); + return; + case mpack_type_map: + mpack_snprintf(buffer, buffer_size, "map of %u key-value pairs", tag.v.n); + return; + } + + mpack_snprintf(buffer, buffer_size, "unknown!"); +} + +void mpack_tag_debug_describe(mpack_tag_t tag, char* buffer, size_t buffer_size) { + mpack_assert(buffer_size > 0, "buffer size cannot be zero!"); + buffer[0] = 0; + + mpack_tag_debug_describe_impl(tag, buffer, buffer_size); + + // We always null-terminate the buffer manually just in case the snprintf() + // function doesn't null-terminate when the string doesn't fit. + buffer[buffer_size - 1] = 0; +} +#endif + + + +#if MPACK_READ_TRACKING || MPACK_WRITE_TRACKING + +#ifndef MPACK_TRACKING_INITIAL_CAPACITY +// seems like a reasonable number. we grow by doubling, and it only +// needs to be as long as the maximum depth of the message. +#define MPACK_TRACKING_INITIAL_CAPACITY 8 +#endif + +mpack_error_t mpack_track_init(mpack_track_t* track) { + track->count = 0; + track->capacity = MPACK_TRACKING_INITIAL_CAPACITY; + track->elements = (mpack_track_element_t*)MPACK_MALLOC(sizeof(mpack_track_element_t) * track->capacity); + if (track->elements == NULL) + return mpack_error_memory; + return mpack_ok; +} + +mpack_error_t mpack_track_grow(mpack_track_t* track) { + mpack_assert(track->elements, "null track elements!"); + mpack_assert(track->count == track->capacity, "incorrect growing?"); + + size_t new_capacity = track->capacity * 2; + + mpack_track_element_t* new_elements = (mpack_track_element_t*)mpack_realloc(track->elements, + sizeof(mpack_track_element_t) * track->count, sizeof(mpack_track_element_t) * new_capacity); + if (new_elements == NULL) + return mpack_error_memory; + + track->elements = new_elements; + track->capacity = new_capacity; + return mpack_ok; +} + +mpack_error_t mpack_track_push(mpack_track_t* track, mpack_type_t type, uint32_t count) { + mpack_assert(track->elements, "null track elements!"); + mpack_log("track pushing %s count %i\n", mpack_type_to_string(type), (int)count); + + // grow if needed + if (track->count == track->capacity) { + mpack_error_t error = mpack_track_grow(track); + if (error != mpack_ok) + return error; + } + + // insert new track + track->elements[track->count].type = type; + track->elements[track->count].left = count; + track->elements[track->count].key_needs_value = false; + ++track->count; + return mpack_ok; +} + +mpack_error_t mpack_track_pop(mpack_track_t* track, mpack_type_t type) { + mpack_assert(track->elements, "null track elements!"); + mpack_log("track popping %s\n", mpack_type_to_string(type)); + + if (track->count == 0) { + mpack_break("attempting to close a %s but nothing was opened!", mpack_type_to_string(type)); + return mpack_error_bug; + } + + mpack_track_element_t* element = &track->elements[track->count - 1]; + + if (element->type != type) { + mpack_break("attempting to close a %s but the open element is a %s!", + mpack_type_to_string(type), mpack_type_to_string(element->type)); + return mpack_error_bug; + } + + if (element->key_needs_value) { + mpack_assert(type == mpack_type_map, "key_needs_value can only be true for maps!"); + mpack_break("attempting to close a %s but an odd number of elements were written", + mpack_type_to_string(type)); + return mpack_error_bug; + } + + if (element->left != 0) { + mpack_break("attempting to close a %s but there are %i %s left", + mpack_type_to_string(type), element->left, + (type == mpack_type_map || type == mpack_type_array) ? "elements" : "bytes"); + return mpack_error_bug; + } + + --track->count; + return mpack_ok; +} + +mpack_error_t mpack_track_peek_element(mpack_track_t* track, bool read) { + MPACK_UNUSED(read); + mpack_assert(track->elements, "null track elements!"); + + // if there are no open elements, that's fine, we can read/write elements at will + if (track->count == 0) + return mpack_ok; + + mpack_track_element_t* element = &track->elements[track->count - 1]; + + if (element->type != mpack_type_map && element->type != mpack_type_array) { + mpack_break("elements cannot be %s within an %s", read ? "read" : "written", + mpack_type_to_string(element->type)); + return mpack_error_bug; + } + + if (element->left == 0 && !element->key_needs_value) { + mpack_break("too many elements %s for %s", read ? "read" : "written", + mpack_type_to_string(element->type)); + return mpack_error_bug; + } + + return mpack_ok; +} + +mpack_error_t mpack_track_element(mpack_track_t* track, bool read) { + mpack_error_t error = mpack_track_peek_element(track, read); + if (track->count == 0 || error != mpack_ok) + return error; + + mpack_track_element_t* element = &track->elements[track->count - 1]; + + if (element->type == mpack_type_map) { + if (!element->key_needs_value) { + element->key_needs_value = true; + return mpack_ok; // don't decrement + } + element->key_needs_value = false; + } + + --element->left; + return mpack_ok; +} + +mpack_error_t mpack_track_bytes(mpack_track_t* track, bool read, size_t count) { + MPACK_UNUSED(read); + mpack_assert(track->elements, "null track elements!"); + + if (count > UINT32_MAX) { + mpack_break("%s more bytes than could possibly fit in a str/bin/ext!", + read ? "reading" : "writing"); + return mpack_error_bug; + } + + if (track->count == 0) { + mpack_break("bytes cannot be %s with no open bin, str or ext", read ? "read" : "written"); + return mpack_error_bug; + } + + mpack_track_element_t* element = &track->elements[track->count - 1]; + + if (element->type == mpack_type_map || element->type == mpack_type_array) { + mpack_break("bytes cannot be %s within an %s", read ? "read" : "written", + mpack_type_to_string(element->type)); + return mpack_error_bug; + } + + if (element->left < count) { + mpack_break("too many bytes %s for %s", read ? "read" : "written", + mpack_type_to_string(element->type)); + return mpack_error_bug; + } + + element->left -= (uint32_t)count; + return mpack_ok; +} + +mpack_error_t mpack_track_str_bytes_all(mpack_track_t* track, bool read, size_t count) { + mpack_error_t error = mpack_track_bytes(track, read, count); + if (error != mpack_ok) + return error; + + mpack_track_element_t* element = &track->elements[track->count - 1]; + + if (element->type != mpack_type_str) { + mpack_break("the open type must be a string, not a %s", mpack_type_to_string(element->type)); + return mpack_error_bug; + } + + if (element->left != 0) { + mpack_break("not all bytes were read; the wrong byte count was requested for a string read."); + return mpack_error_bug; + } + + return mpack_ok; +} + +mpack_error_t mpack_track_check_empty(mpack_track_t* track) { + if (track->count != 0) { + mpack_break("unclosed %s", mpack_type_to_string(track->elements[0].type)); + return mpack_error_bug; + } + return mpack_ok; +} + +mpack_error_t mpack_track_destroy(mpack_track_t* track, bool cancel) { + mpack_error_t error = cancel ? mpack_ok : mpack_track_check_empty(track); + if (track->elements) { + MPACK_FREE(track->elements); + track->elements = NULL; + } + return error; +} +#endif + + + +static bool mpack_utf8_check_impl(const uint8_t* str, size_t count, bool allow_null) { + while (count > 0) { + uint8_t lead = str[0]; + + // NUL + if (!allow_null && lead == '\0') // we don't allow NUL bytes in MPack C-strings + return false; + + // ASCII + if (lead <= 0x7F) { + ++str; + --count; + + // 2-byte sequence + } else if ((lead & 0xE0) == 0xC0) { + if (count < 2) // truncated sequence + return false; + + uint8_t cont = str[1]; + if ((cont & 0xC0) != 0x80) // not a continuation byte + return false; + + str += 2; + count -= 2; + + uint32_t z = ((uint32_t)(lead & ~0xE0) << 6) | + (uint32_t)(cont & ~0xC0); + + if (z < 0x80) // overlong sequence + return false; + + // 3-byte sequence + } else if ((lead & 0xF0) == 0xE0) { + if (count < 3) // truncated sequence + return false; + + uint8_t cont1 = str[1]; + if ((cont1 & 0xC0) != 0x80) // not a continuation byte + return false; + uint8_t cont2 = str[2]; + if ((cont2 & 0xC0) != 0x80) // not a continuation byte + return false; + + str += 3; + count -= 3; + + uint32_t z = ((uint32_t)(lead & ~0xF0) << 12) | + ((uint32_t)(cont1 & ~0xC0) << 6) | + (uint32_t)(cont2 & ~0xC0); + + if (z < 0x800) // overlong sequence + return false; + if (z >= 0xD800 && z <= 0xDFFF) // surrogate + return false; + + // 4-byte sequence + } else if ((lead & 0xF8) == 0xF0) { + if (count < 4) // truncated sequence + return false; + + uint8_t cont1 = str[1]; + if ((cont1 & 0xC0) != 0x80) // not a continuation byte + return false; + uint8_t cont2 = str[2]; + if ((cont2 & 0xC0) != 0x80) // not a continuation byte + return false; + uint8_t cont3 = str[3]; + if ((cont3 & 0xC0) != 0x80) // not a continuation byte + return false; + + str += 4; + count -= 4; + + uint32_t z = ((uint32_t)(lead & ~0xF8) << 18) | + ((uint32_t)(cont1 & ~0xC0) << 12) | + ((uint32_t)(cont2 & ~0xC0) << 6) | + (uint32_t)(cont3 & ~0xC0); + + if (z < 0x10000) // overlong sequence + return false; + if (z > 0x10FFFF) // codepoint limit + return false; + + } else { + return false; // continuation byte without a lead, or lead for a 5-byte sequence or longer + } + } + return true; +} + +bool mpack_utf8_check(const char* str, size_t bytes) { + return mpack_utf8_check_impl((const uint8_t*)str, bytes, true); +} + +bool mpack_utf8_check_no_null(const char* str, size_t bytes) { + return mpack_utf8_check_impl((const uint8_t*)str, bytes, false); +} + +bool mpack_str_check_no_null(const char* str, size_t bytes) { + for (size_t i = 0; i < bytes; ++i) + if (str[i] == '\0') + return false; + return true; +} + +#if MPACK_DEBUG && MPACK_STDIO +void mpack_print_append(mpack_print_t* print, const char* data, size_t count) { + + // copy whatever fits into the buffer + size_t copy = print->size - print->count; + if (copy > count) + copy = count; + mpack_memcpy(print->buffer + print->count, data, copy); + print->count += copy; + data += copy; + count -= copy; + + // if we don't need to flush or can't flush there's nothing else to do + if (count == 0 || print->callback == NULL) + return; + + // flush the buffer + print->callback(print->context, print->buffer, print->count); + + if (count > print->size / 2) { + // flush the rest of the data + print->count = 0; + print->callback(print->context, data, count); + } else { + // copy the rest of the data into the buffer + mpack_memcpy(print->buffer, data, count); + print->count = count; + } + +} + +void mpack_print_flush(mpack_print_t* print) { + if (print->count > 0 && print->callback != NULL) { + print->callback(print->context, print->buffer, print->count); + print->count = 0; + } +} + +void mpack_print_file_callback(void* context, const char* data, size_t count) { + FILE* file = (FILE*)context; + fwrite(data, 1, count, file); +} +#endif + +/* mpack/mpack-writer.c.c */ + +#define MPACK_INTERNAL 1 + +/* #include "mpack-writer.h" */ + +#if MPACK_WRITER + +#if MPACK_WRITE_TRACKING +static void mpack_writer_flag_if_error(mpack_writer_t* writer, mpack_error_t error) { + if (error != mpack_ok) + mpack_writer_flag_error(writer, error); +} + +void mpack_writer_track_push(mpack_writer_t* writer, mpack_type_t type, uint32_t count) { + if (writer->error == mpack_ok) + mpack_writer_flag_if_error(writer, mpack_track_push(&writer->track, type, count)); +} + +void mpack_writer_track_pop(mpack_writer_t* writer, mpack_type_t type) { + if (writer->error == mpack_ok) + mpack_writer_flag_if_error(writer, mpack_track_pop(&writer->track, type)); +} + +void mpack_writer_track_element(mpack_writer_t* writer) { + if (writer->error == mpack_ok) + mpack_writer_flag_if_error(writer, mpack_track_element(&writer->track, false)); +} + +void mpack_writer_track_bytes(mpack_writer_t* writer, size_t count) { + if (writer->error == mpack_ok) + mpack_writer_flag_if_error(writer, mpack_track_bytes(&writer->track, false, count)); +} +#endif + +static void mpack_writer_clear(mpack_writer_t* writer) { + #if MPACK_COMPATIBILITY + writer->version = mpack_version_current; + #endif + writer->flush = NULL; + writer->error_fn = NULL; + writer->teardown = NULL; + writer->context = NULL; + + writer->buffer = NULL; + writer->current = NULL; + writer->end = NULL; + writer->error = mpack_ok; + + #if MPACK_WRITE_TRACKING + mpack_memset(&writer->track, 0, sizeof(writer->track)); + #endif +} + +void mpack_writer_init(mpack_writer_t* writer, char* buffer, size_t size) { + mpack_assert(buffer != NULL, "cannot initialize writer with empty buffer"); + mpack_writer_clear(writer); + writer->buffer = buffer; + writer->current = buffer; + writer->end = writer->buffer + size; + + #if MPACK_WRITE_TRACKING + mpack_writer_flag_if_error(writer, mpack_track_init(&writer->track)); + #endif + + mpack_log("===========================\n"); + mpack_log("initializing writer with buffer size %i\n", (int)size); +} + +void mpack_writer_init_error(mpack_writer_t* writer, mpack_error_t error) { + mpack_writer_clear(writer); + writer->error = error; + + mpack_log("===========================\n"); + mpack_log("initializing writer in error state %i\n", (int)error); +} + +void mpack_writer_set_flush(mpack_writer_t* writer, mpack_writer_flush_t flush) { + MPACK_STATIC_ASSERT(MPACK_WRITER_MINIMUM_BUFFER_SIZE >= MPACK_MAXIMUM_TAG_SIZE, + "minimum buffer size must fit any tag!"); + MPACK_STATIC_ASSERT(31 + MPACK_TAG_SIZE_FIXSTR >= MPACK_WRITER_MINIMUM_BUFFER_SIZE, + "minimum buffer size must fit the largest possible fixstr!"); + + if (mpack_writer_buffer_size(writer) < MPACK_WRITER_MINIMUM_BUFFER_SIZE) { + mpack_break("buffer size is %i, but minimum buffer size for flush is %i", + (int)mpack_writer_buffer_size(writer), MPACK_WRITER_MINIMUM_BUFFER_SIZE); + mpack_writer_flag_error(writer, mpack_error_bug); + return; + } + + writer->flush = flush; +} + +#ifdef MPACK_MALLOC +typedef struct mpack_growable_writer_t { + char** target_data; + size_t* target_size; +} mpack_growable_writer_t; + +static char* mpack_writer_get_reserved(mpack_writer_t* writer) { + // This is in a separate function in order to avoid false strict aliasing + // warnings. We aren't actually violating strict aliasing (the reserved + // space is only ever dereferenced as an mpack_growable_writer_t.) + return (char*)writer->reserved; +} + +static void mpack_growable_writer_flush(mpack_writer_t* writer, const char* data, size_t count) { + + // This is an intrusive flush function which modifies the writer's buffer + // in response to a flush instead of emptying it in order to add more + // capacity for data. This removes the need to copy data from a fixed buffer + // into a growable one, improving performance. + // + // There are three ways flush can be called: + // - flushing the buffer during writing (used is zero, count is all data, data is buffer) + // - flushing extra data during writing (used is all flushed data, count is extra data, data is not buffer) + // - flushing during teardown (used and count are both all flushed data, data is buffer) + // + // In the first two cases, we grow the buffer by at least double, enough + // to ensure that new data will fit. We ignore the teardown flush. + + if (data == writer->buffer) { + + // teardown, do nothing + if (mpack_writer_buffer_used(writer) == count) + return; + + // otherwise leave the data in the buffer and just grow + writer->current = writer->buffer + count; + count = 0; + } + + size_t used = mpack_writer_buffer_used(writer); + size_t size = mpack_writer_buffer_size(writer); + + mpack_log("flush size %i used %i data %p buffer %p\n", + (int)count, (int)used, data, writer->buffer); + + mpack_assert(data == writer->buffer || used + count > size, + "extra flush for %i but there is %i space left in the buffer! (%i/%i)", + (int)count, (int)mpack_writer_buffer_left(writer), (int)used, (int)size); + + // grow to fit the data + // TODO: this really needs to correctly test for overflow + size_t new_size = size * 2; + while (new_size < used + count) + new_size *= 2; + + mpack_log("flush growing buffer size from %i to %i\n", (int)size, (int)new_size); + + // grow the buffer + char* new_buffer = (char*)mpack_realloc(writer->buffer, used, new_size); + if (new_buffer == NULL) { + mpack_writer_flag_error(writer, mpack_error_memory); + return; + } + writer->current = new_buffer + used; + writer->buffer = new_buffer; + writer->end = writer->buffer + new_size; + + // append the extra data + if (count > 0) { + mpack_memcpy(writer->current, data, count); + writer->current += count; + } + + mpack_log("new buffer %p, used %i\n", new_buffer, (int)mpack_writer_buffer_used(writer)); +} + +static void mpack_growable_writer_teardown(mpack_writer_t* writer) { + mpack_growable_writer_t* growable_writer = (mpack_growable_writer_t*)mpack_writer_get_reserved(writer); + + if (mpack_writer_error(writer) == mpack_ok) { + + // shrink the buffer to an appropriate size if the data is + // much smaller than the buffer + if (mpack_writer_buffer_used(writer) < mpack_writer_buffer_size(writer) / 2) { + size_t used = mpack_writer_buffer_used(writer); + + // We always return a non-null pointer that must be freed, even if + // nothing was written. malloc() and realloc() do not necessarily + // do this so we enforce it ourselves. + size_t size = (used != 0) ? used : 1; + + char* buffer = (char*)mpack_realloc(writer->buffer, used, size); + if (!buffer) { + MPACK_FREE(writer->buffer); + mpack_writer_flag_error(writer, mpack_error_memory); + return; + } + writer->buffer = buffer; + writer->end = (writer->current = writer->buffer + used); + } + + *growable_writer->target_data = writer->buffer; + *growable_writer->target_size = mpack_writer_buffer_used(writer); + writer->buffer = NULL; + + } else if (writer->buffer) { + MPACK_FREE(writer->buffer); + writer->buffer = NULL; + } + + writer->context = NULL; +} + +void mpack_writer_init_growable(mpack_writer_t* writer, char** target_data, size_t* target_size) { + mpack_assert(target_data != NULL, "cannot initialize writer without a destination for the data"); + mpack_assert(target_size != NULL, "cannot initialize writer without a destination for the size"); + + *target_data = NULL; + *target_size = 0; + + MPACK_STATIC_ASSERT(sizeof(mpack_growable_writer_t) <= sizeof(writer->reserved), + "not enough reserved space for growable writer!"); + mpack_growable_writer_t* growable_writer = (mpack_growable_writer_t*)mpack_writer_get_reserved(writer); + + growable_writer->target_data = target_data; + growable_writer->target_size = target_size; + + size_t capacity = MPACK_BUFFER_SIZE; + char* buffer = (char*)MPACK_MALLOC(capacity); + if (buffer == NULL) { + mpack_writer_init_error(writer, mpack_error_memory); + return; + } + + mpack_writer_init(writer, buffer, capacity); + mpack_writer_set_flush(writer, mpack_growable_writer_flush); + mpack_writer_set_teardown(writer, mpack_growable_writer_teardown); +} +#endif + +#if MPACK_STDIO +static void mpack_file_writer_flush(mpack_writer_t* writer, const char* buffer, size_t count) { + FILE* file = (FILE*)writer->context; + size_t written = fwrite((const void*)buffer, 1, count, file); + if (written != count) + mpack_writer_flag_error(writer, mpack_error_io); +} + +static void mpack_file_writer_teardown(mpack_writer_t* writer) { + MPACK_FREE(writer->buffer); + writer->buffer = NULL; + writer->context = NULL; +} + +static void mpack_file_writer_teardown_close(mpack_writer_t* writer) { + FILE* file = (FILE*)writer->context; + + if (file) { + int ret = fclose(file); + if (ret != 0) + mpack_writer_flag_error(writer, mpack_error_io); + } + + mpack_file_writer_teardown(writer); +} + +void mpack_writer_init_stdfile(mpack_writer_t* writer, FILE* file, bool close_when_done) { + mpack_assert(file != NULL, "file is NULL"); + + size_t capacity = MPACK_BUFFER_SIZE; + char* buffer = (char*)MPACK_MALLOC(capacity); + if (buffer == NULL) { + mpack_writer_init_error(writer, mpack_error_memory); + if (close_when_done) { + fclose(file); + } + return; + } + + mpack_writer_init(writer, buffer, capacity); + mpack_writer_set_context(writer, file); + mpack_writer_set_flush(writer, mpack_file_writer_flush); + mpack_writer_set_teardown(writer, close_when_done ? + mpack_file_writer_teardown_close : + mpack_file_writer_teardown); +} + +void mpack_writer_init_filename(mpack_writer_t* writer, const char* filename) { + mpack_assert(filename != NULL, "filename is NULL"); + + FILE* file = fopen(filename, "wb"); + if (file == NULL) { + mpack_writer_init_error(writer, mpack_error_io); + return; + } + + mpack_writer_init_stdfile(writer, file, true); +} +#endif + +void mpack_writer_flag_error(mpack_writer_t* writer, mpack_error_t error) { + mpack_log("writer %p setting error %i: %s\n", (void*)writer, (int)error, mpack_error_to_string(error)); + + if (writer->error == mpack_ok) { + writer->error = error; + if (writer->error_fn) + writer->error_fn(writer, writer->error); + } +} + +MPACK_STATIC_INLINE void mpack_writer_flush_unchecked(mpack_writer_t* writer) { + // This is a bit ugly; we reset used before calling flush so that + // a flush function can distinguish between flushing the buffer + // versus flushing external data. see mpack_growable_writer_flush() + size_t used = mpack_writer_buffer_used(writer); + writer->current = writer->buffer; + writer->flush(writer, writer->buffer, used); +} + +void mpack_writer_flush_message(mpack_writer_t* writer) { + if (writer->error != mpack_ok) + return; + + #if MPACK_WRITE_TRACKING + mpack_writer_flag_if_error(writer, mpack_track_check_empty(&writer->track)); + if (writer->error != mpack_ok) + return; + #endif + + if (writer->flush == NULL) { + mpack_break("cannot call mpack_writer_flush_message() without a flush function!"); + mpack_writer_flag_error(writer, mpack_error_bug); + return; + } + + if (mpack_writer_buffer_used(writer) > 0) + mpack_writer_flush_unchecked(writer); +} + +// Ensures there are at least count bytes free in the buffer. This +// will flag an error if the flush function fails to make enough +// room in the buffer. +MPACK_NOINLINE static bool mpack_writer_ensure(mpack_writer_t* writer, size_t count) { + mpack_assert(count != 0, "cannot ensure zero bytes!"); + mpack_assert(count <= MPACK_WRITER_MINIMUM_BUFFER_SIZE, + "cannot ensure %i bytes, this is more than the minimum buffer size %i!", + (int)count, (int)MPACK_WRITER_MINIMUM_BUFFER_SIZE); + mpack_assert(count > mpack_writer_buffer_left(writer), + "request to ensure %i bytes but there are already %i left in the buffer!", + (int)count, (int)mpack_writer_buffer_left(writer)); + + mpack_log("ensuring %i bytes, %i left\n", (int)count, (int)mpack_writer_buffer_left(writer)); + + if (mpack_writer_error(writer) != mpack_ok) + return false; + + if (writer->flush == NULL) { + mpack_writer_flag_error(writer, mpack_error_too_big); + return false; + } + + mpack_writer_flush_unchecked(writer); + if (mpack_writer_error(writer) != mpack_ok) + return false; + + if (mpack_writer_buffer_left(writer) >= count) + return true; + + mpack_writer_flag_error(writer, mpack_error_io); + return false; +} + +// Writes encoded bytes to the buffer when we already know the data +// does not fit in the buffer (i.e. it straddles the edge of the +// buffer.) If there is a flush function, it is guaranteed to be +// called; otherwise mpack_error_too_big is raised. +MPACK_NOINLINE static void mpack_write_native_straddle(mpack_writer_t* writer, const char* p, size_t count) { + mpack_assert(count == 0 || p != NULL, "data pointer for %i bytes is NULL", (int)count); + + if (mpack_writer_error(writer) != mpack_ok) + return; + mpack_log("big write for %i bytes from %p, %i space left in buffer\n", + (int)count, p, (int)mpack_writer_buffer_left(writer)); + mpack_assert(count > mpack_writer_buffer_left(writer), + "big write requested for %i bytes, but there is %i available " + "space in buffer. should have called mpack_write_native() instead", + (int)count, (int)(mpack_writer_buffer_left(writer))); + + // we'll need a flush function + if (!writer->flush) { + mpack_writer_flag_error(writer, mpack_error_too_big); + return; + } + + // flush the buffer + mpack_writer_flush_unchecked(writer); + if (mpack_writer_error(writer) != mpack_ok) + return; + + // note that an intrusive flush function (such as mpack_growable_writer_flush()) + // may have changed size and/or reset used to a non-zero value. we treat both as + // though they may have changed, and there may still be data in the buffer. + + // flush the extra data directly if it doesn't fit in the buffer + if (count > mpack_writer_buffer_left(writer)) { + writer->flush(writer, p, count); + if (mpack_writer_error(writer) != mpack_ok) + return; + } else { + mpack_memcpy(writer->current, p, count); + writer->current += count; + } +} + +// Writes encoded bytes to the buffer, flushing if necessary. +MPACK_STATIC_INLINE void mpack_write_native(mpack_writer_t* writer, const char* p, size_t count) { + mpack_assert(count == 0 || p != NULL, "data pointer for %i bytes is NULL", (int)count); + + if (mpack_writer_buffer_left(writer) < count) { + mpack_write_native_straddle(writer, p, count); + } else { + mpack_memcpy(writer->current, p, count); + writer->current += count; + } +} + +mpack_error_t mpack_writer_destroy(mpack_writer_t* writer) { + + // clean up tracking, asserting if we're not already in an error state + #if MPACK_WRITE_TRACKING + mpack_track_destroy(&writer->track, writer->error != mpack_ok); + #endif + + // flush any outstanding data + if (mpack_writer_error(writer) == mpack_ok && mpack_writer_buffer_used(writer) != 0 && writer->flush != NULL) { + writer->flush(writer, writer->buffer, mpack_writer_buffer_used(writer)); + writer->flush = NULL; + } + + if (writer->teardown) { + writer->teardown(writer); + writer->teardown = NULL; + } + + return writer->error; +} + +void mpack_write_tag(mpack_writer_t* writer, mpack_tag_t value) { + switch (value.type) { + case mpack_type_missing: + mpack_break("cannot write a missing value!"); + mpack_writer_flag_error(writer, mpack_error_bug); + return; + + case mpack_type_nil: mpack_write_nil (writer); return; + case mpack_type_bool: mpack_write_bool (writer, value.v.b); return; + case mpack_type_float: mpack_write_float (writer, value.v.f); return; + case mpack_type_double: mpack_write_double(writer, value.v.d); return; + case mpack_type_int: mpack_write_int (writer, value.v.i); return; + case mpack_type_uint: mpack_write_uint (writer, value.v.u); return; + + case mpack_type_str: mpack_start_str(writer, value.v.l); return; + case mpack_type_bin: mpack_start_bin(writer, value.v.l); return; + + #if MPACK_EXTENSIONS + case mpack_type_ext: + mpack_start_ext(writer, mpack_tag_ext_exttype(&value), mpack_tag_ext_length(&value)); + return; + #endif + + case mpack_type_array: mpack_start_array(writer, value.v.n); return; + case mpack_type_map: mpack_start_map(writer, value.v.n); return; + } + + mpack_break("unrecognized type %i", (int)value.type); + mpack_writer_flag_error(writer, mpack_error_bug); +} + +MPACK_STATIC_INLINE void mpack_write_byte_element(mpack_writer_t* writer, char value) { + mpack_writer_track_element(writer); + if (MPACK_LIKELY(mpack_writer_buffer_left(writer) >= 1) || mpack_writer_ensure(writer, 1)) + *(writer->current++) = value; +} + +void mpack_write_nil(mpack_writer_t* writer) { + mpack_write_byte_element(writer, (char)0xc0); +} + +void mpack_write_bool(mpack_writer_t* writer, bool value) { + mpack_write_byte_element(writer, (char)(0xc2 | (value ? 1 : 0))); +} + +void mpack_write_true(mpack_writer_t* writer) { + mpack_write_byte_element(writer, (char)0xc3); +} + +void mpack_write_false(mpack_writer_t* writer) { + mpack_write_byte_element(writer, (char)0xc2); +} + +void mpack_write_object_bytes(mpack_writer_t* writer, const char* data, size_t bytes) { + mpack_writer_track_element(writer); + mpack_write_native(writer, data, bytes); +} + +/* + * Encode functions + */ + +MPACK_STATIC_INLINE void mpack_encode_fixuint(char* p, uint8_t value) { + mpack_assert(value <= 127); + mpack_store_u8(p, value); +} + +MPACK_STATIC_INLINE void mpack_encode_u8(char* p, uint8_t value) { + mpack_assert(value > 127); + mpack_store_u8(p, 0xcc); + mpack_store_u8(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_u16(char* p, uint16_t value) { + mpack_assert(value > UINT8_MAX); + mpack_store_u8(p, 0xcd); + mpack_store_u16(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_u32(char* p, uint32_t value) { + mpack_assert(value > UINT16_MAX); + mpack_store_u8(p, 0xce); + mpack_store_u32(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_u64(char* p, uint64_t value) { + mpack_assert(value > UINT32_MAX); + mpack_store_u8(p, 0xcf); + mpack_store_u64(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_fixint(char* p, int8_t value) { + // this can encode positive or negative fixints + mpack_assert(value >= -32); + mpack_store_i8(p, value); +} + +MPACK_STATIC_INLINE void mpack_encode_i8(char* p, int8_t value) { + mpack_assert(value < -32); + mpack_store_u8(p, 0xd0); + mpack_store_i8(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_i16(char* p, int16_t value) { + mpack_assert(value < INT8_MIN); + mpack_store_u8(p, 0xd1); + mpack_store_i16(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_i32(char* p, int32_t value) { + mpack_assert(value < INT16_MIN); + mpack_store_u8(p, 0xd2); + mpack_store_i32(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_i64(char* p, int64_t value) { + mpack_assert(value < INT32_MIN); + mpack_store_u8(p, 0xd3); + mpack_store_i64(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_float(char* p, float value) { + mpack_store_u8(p, 0xca); + mpack_store_float(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_double(char* p, double value) { + mpack_store_u8(p, 0xcb); + mpack_store_double(p + 1, value); +} + +MPACK_STATIC_INLINE void mpack_encode_fixarray(char* p, uint8_t count) { + mpack_assert(count <= 15); + mpack_store_u8(p, (uint8_t)(0x90 | count)); +} + +MPACK_STATIC_INLINE void mpack_encode_array16(char* p, uint16_t count) { + mpack_assert(count > 15); + mpack_store_u8(p, 0xdc); + mpack_store_u16(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_array32(char* p, uint32_t count) { + mpack_assert(count > UINT16_MAX); + mpack_store_u8(p, 0xdd); + mpack_store_u32(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_fixmap(char* p, uint8_t count) { + mpack_assert(count <= 15); + mpack_store_u8(p, (uint8_t)(0x80 | count)); +} + +MPACK_STATIC_INLINE void mpack_encode_map16(char* p, uint16_t count) { + mpack_assert(count > 15); + mpack_store_u8(p, 0xde); + mpack_store_u16(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_map32(char* p, uint32_t count) { + mpack_assert(count > UINT16_MAX); + mpack_store_u8(p, 0xdf); + mpack_store_u32(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_fixstr(char* p, uint8_t count) { + mpack_assert(count <= 31); + mpack_store_u8(p, (uint8_t)(0xa0 | count)); +} + +MPACK_STATIC_INLINE void mpack_encode_str8(char* p, uint8_t count) { + mpack_assert(count > 31); + mpack_store_u8(p, 0xd9); + mpack_store_u8(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_str16(char* p, uint16_t count) { + // we might be encoding a raw in compatibility mode, so we + // allow count to be in the range [32, UINT8_MAX]. + mpack_assert(count > 31); + mpack_store_u8(p, 0xda); + mpack_store_u16(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_str32(char* p, uint32_t count) { + mpack_assert(count > UINT16_MAX); + mpack_store_u8(p, 0xdb); + mpack_store_u32(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_bin8(char* p, uint8_t count) { + mpack_store_u8(p, 0xc4); + mpack_store_u8(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_bin16(char* p, uint16_t count) { + mpack_assert(count > UINT8_MAX); + mpack_store_u8(p, 0xc5); + mpack_store_u16(p + 1, count); +} + +MPACK_STATIC_INLINE void mpack_encode_bin32(char* p, uint32_t count) { + mpack_assert(count > UINT16_MAX); + mpack_store_u8(p, 0xc6); + mpack_store_u32(p + 1, count); +} + +#if MPACK_EXTENSIONS +MPACK_STATIC_INLINE void mpack_encode_fixext1(char* p, int8_t exttype) { + mpack_store_u8(p, 0xd4); + mpack_store_i8(p + 1, exttype); +} + +MPACK_STATIC_INLINE void mpack_encode_fixext2(char* p, int8_t exttype) { + mpack_store_u8(p, 0xd5); + mpack_store_i8(p + 1, exttype); +} + +MPACK_STATIC_INLINE void mpack_encode_fixext4(char* p, int8_t exttype) { + mpack_store_u8(p, 0xd6); + mpack_store_i8(p + 1, exttype); +} + +MPACK_STATIC_INLINE void mpack_encode_fixext8(char* p, int8_t exttype) { + mpack_store_u8(p, 0xd7); + mpack_store_i8(p + 1, exttype); +} + +MPACK_STATIC_INLINE void mpack_encode_fixext16(char* p, int8_t exttype) { + mpack_store_u8(p, 0xd8); + mpack_store_i8(p + 1, exttype); +} + +MPACK_STATIC_INLINE void mpack_encode_ext8(char* p, int8_t exttype, uint8_t count) { + mpack_assert(count != 1 && count != 2 && count != 4 && count != 8 && count != 16); + mpack_store_u8(p, 0xc7); + mpack_store_u8(p + 1, count); + mpack_store_i8(p + 2, exttype); +} + +MPACK_STATIC_INLINE void mpack_encode_ext16(char* p, int8_t exttype, uint16_t count) { + mpack_assert(count > UINT8_MAX); + mpack_store_u8(p, 0xc8); + mpack_store_u16(p + 1, count); + mpack_store_i8(p + 3, exttype); +} + +MPACK_STATIC_INLINE void mpack_encode_ext32(char* p, int8_t exttype, uint32_t count) { + mpack_assert(count > UINT16_MAX); + mpack_store_u8(p, 0xc9); + mpack_store_u32(p + 1, count); + mpack_store_i8(p + 5, exttype); +} + +MPACK_STATIC_INLINE void mpack_encode_timestamp_4(char* p, uint32_t seconds) { + mpack_encode_fixext4(p, MPACK_EXTTYPE_TIMESTAMP); + mpack_store_u32(p + MPACK_TAG_SIZE_FIXEXT4, seconds); +} + +MPACK_STATIC_INLINE void mpack_encode_timestamp_8(char* p, int64_t seconds, uint32_t nanoseconds) { + mpack_assert(nanoseconds <= MPACK_TIMESTAMP_NANOSECONDS_MAX); + mpack_encode_fixext8(p, MPACK_EXTTYPE_TIMESTAMP); + uint64_t encoded = ((uint64_t)nanoseconds << 34) | (uint64_t)seconds; + mpack_store_u64(p + MPACK_TAG_SIZE_FIXEXT8, encoded); +} + +MPACK_STATIC_INLINE void mpack_encode_timestamp_12(char* p, int64_t seconds, uint32_t nanoseconds) { + mpack_assert(nanoseconds <= MPACK_TIMESTAMP_NANOSECONDS_MAX); + mpack_encode_ext8(p, MPACK_EXTTYPE_TIMESTAMP, 12); + mpack_store_u32(p + MPACK_TAG_SIZE_EXT8, nanoseconds); + mpack_store_i64(p + MPACK_TAG_SIZE_EXT8 + 4, seconds); +} +#endif + + + +/* + * Write functions + */ + +// This is a macro wrapper to the encode functions to encode +// directly into the buffer. If mpack_writer_ensure() fails +// it will flag an error so we don't have to do anything. +#define MPACK_WRITE_ENCODED(encode_fn, size, ...) do { \ + if (MPACK_LIKELY(mpack_writer_buffer_left(writer) >= size) || mpack_writer_ensure(writer, size)) { \ + MPACK_EXPAND(encode_fn(writer->current, __VA_ARGS__)); \ + writer->current += size; \ + } \ +} while (0) + +void mpack_write_u8(mpack_writer_t* writer, uint8_t value) { + #if MPACK_OPTIMIZE_FOR_SIZE + mpack_write_u64(writer, value); + #else + mpack_writer_track_element(writer); + if (value <= 127) { + MPACK_WRITE_ENCODED(mpack_encode_fixuint, MPACK_TAG_SIZE_FIXUINT, value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_u8, MPACK_TAG_SIZE_U8, value); + } + #endif +} + +void mpack_write_u16(mpack_writer_t* writer, uint16_t value) { + #if MPACK_OPTIMIZE_FOR_SIZE + mpack_write_u64(writer, value); + #else + mpack_writer_track_element(writer); + if (value <= 127) { + MPACK_WRITE_ENCODED(mpack_encode_fixuint, MPACK_TAG_SIZE_FIXUINT, (uint8_t)value); + } else if (value <= UINT8_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u8, MPACK_TAG_SIZE_U8, (uint8_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_u16, MPACK_TAG_SIZE_U16, value); + } + #endif +} + +void mpack_write_u32(mpack_writer_t* writer, uint32_t value) { + #if MPACK_OPTIMIZE_FOR_SIZE + mpack_write_u64(writer, value); + #else + mpack_writer_track_element(writer); + if (value <= 127) { + MPACK_WRITE_ENCODED(mpack_encode_fixuint, MPACK_TAG_SIZE_FIXUINT, (uint8_t)value); + } else if (value <= UINT8_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u8, MPACK_TAG_SIZE_U8, (uint8_t)value); + } else if (value <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u16, MPACK_TAG_SIZE_U16, (uint16_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_u32, MPACK_TAG_SIZE_U32, value); + } + #endif +} + +void mpack_write_u64(mpack_writer_t* writer, uint64_t value) { + mpack_writer_track_element(writer); + + if (value <= 127) { + MPACK_WRITE_ENCODED(mpack_encode_fixuint, MPACK_TAG_SIZE_FIXUINT, (uint8_t)value); + } else if (value <= UINT8_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u8, MPACK_TAG_SIZE_U8, (uint8_t)value); + } else if (value <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u16, MPACK_TAG_SIZE_U16, (uint16_t)value); + } else if (value <= UINT32_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u32, MPACK_TAG_SIZE_U32, (uint32_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_u64, MPACK_TAG_SIZE_U64, value); + } +} + +void mpack_write_i8(mpack_writer_t* writer, int8_t value) { + #if MPACK_OPTIMIZE_FOR_SIZE + mpack_write_i64(writer, value); + #else + mpack_writer_track_element(writer); + if (value >= -32) { + // we encode positive and negative fixints together + MPACK_WRITE_ENCODED(mpack_encode_fixint, MPACK_TAG_SIZE_FIXINT, (int8_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_i8, MPACK_TAG_SIZE_I8, (int8_t)value); + } + #endif +} + +void mpack_write_i16(mpack_writer_t* writer, int16_t value) { + #if MPACK_OPTIMIZE_FOR_SIZE + mpack_write_i64(writer, value); + #else + mpack_writer_track_element(writer); + if (value >= -32) { + if (value <= 127) { + // we encode positive and negative fixints together + MPACK_WRITE_ENCODED(mpack_encode_fixint, MPACK_TAG_SIZE_FIXINT, (int8_t)value); + } else if (value <= UINT8_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u8, MPACK_TAG_SIZE_U8, (uint8_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_u16, MPACK_TAG_SIZE_U16, (uint16_t)value); + } + } else if (value >= INT8_MIN) { + MPACK_WRITE_ENCODED(mpack_encode_i8, MPACK_TAG_SIZE_I8, (int8_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_i16, MPACK_TAG_SIZE_I16, (int16_t)value); + } + #endif +} + +void mpack_write_i32(mpack_writer_t* writer, int32_t value) { + #if MPACK_OPTIMIZE_FOR_SIZE + mpack_write_i64(writer, value); + #else + mpack_writer_track_element(writer); + if (value >= -32) { + if (value <= 127) { + // we encode positive and negative fixints together + MPACK_WRITE_ENCODED(mpack_encode_fixint, MPACK_TAG_SIZE_FIXINT, (int8_t)value); + } else if (value <= UINT8_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u8, MPACK_TAG_SIZE_U8, (uint8_t)value); + } else if (value <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u16, MPACK_TAG_SIZE_U16, (uint16_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_u32, MPACK_TAG_SIZE_U32, (uint32_t)value); + } + } else if (value >= INT8_MIN) { + MPACK_WRITE_ENCODED(mpack_encode_i8, MPACK_TAG_SIZE_I8, (int8_t)value); + } else if (value >= INT16_MIN) { + MPACK_WRITE_ENCODED(mpack_encode_i16, MPACK_TAG_SIZE_I16, (int16_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_i32, MPACK_TAG_SIZE_I32, value); + } + #endif +} + +void mpack_write_i64(mpack_writer_t* writer, int64_t value) { + #if MPACK_OPTIMIZE_FOR_SIZE + if (value > 127) { + // for non-fix positive ints we call the u64 writer to save space + mpack_write_u64(writer, (uint64_t)value); + return; + } + #endif + + mpack_writer_track_element(writer); + if (value >= -32) { + #if MPACK_OPTIMIZE_FOR_SIZE + MPACK_WRITE_ENCODED(mpack_encode_fixint, MPACK_TAG_SIZE_FIXINT, (int8_t)value); + #else + if (value <= 127) { + MPACK_WRITE_ENCODED(mpack_encode_fixint, MPACK_TAG_SIZE_FIXINT, (int8_t)value); + } else if (value <= UINT8_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u8, MPACK_TAG_SIZE_U8, (uint8_t)value); + } else if (value <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u16, MPACK_TAG_SIZE_U16, (uint16_t)value); + } else if (value <= UINT32_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_u32, MPACK_TAG_SIZE_U32, (uint32_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_u64, MPACK_TAG_SIZE_U64, (uint64_t)value); + } + #endif + } else if (value >= INT8_MIN) { + MPACK_WRITE_ENCODED(mpack_encode_i8, MPACK_TAG_SIZE_I8, (int8_t)value); + } else if (value >= INT16_MIN) { + MPACK_WRITE_ENCODED(mpack_encode_i16, MPACK_TAG_SIZE_I16, (int16_t)value); + } else if (value >= INT32_MIN) { + MPACK_WRITE_ENCODED(mpack_encode_i32, MPACK_TAG_SIZE_I32, (int32_t)value); + } else { + MPACK_WRITE_ENCODED(mpack_encode_i64, MPACK_TAG_SIZE_I64, value); + } +} + +void mpack_write_float(mpack_writer_t* writer, float value) { + mpack_writer_track_element(writer); + MPACK_WRITE_ENCODED(mpack_encode_float, MPACK_TAG_SIZE_FLOAT, value); +} + +void mpack_write_double(mpack_writer_t* writer, double value) { + mpack_writer_track_element(writer); + MPACK_WRITE_ENCODED(mpack_encode_double, MPACK_TAG_SIZE_DOUBLE, value); +} + +#if MPACK_EXTENSIONS +void mpack_write_timestamp(mpack_writer_t* writer, int64_t seconds, uint32_t nanoseconds) { + #if MPACK_COMPATIBILITY + if (writer->version <= mpack_version_v4) { + mpack_break("Timestamps require spec version v5 or later. This writer is in v%i mode.", (int)writer->version); + mpack_writer_flag_error(writer, mpack_error_bug); + return; + } + #endif + + if (nanoseconds > MPACK_TIMESTAMP_NANOSECONDS_MAX) { + mpack_break("timestamp nanoseconds out of bounds: %u", nanoseconds); + mpack_writer_flag_error(writer, mpack_error_bug); + return; + } + + mpack_writer_track_element(writer); + + if (seconds < 0 || seconds >= (INT64_C(1) << 34)) { + MPACK_WRITE_ENCODED(mpack_encode_timestamp_12, MPACK_EXT_SIZE_TIMESTAMP12, seconds, nanoseconds); + } else if (seconds > UINT32_MAX || nanoseconds > 0) { + MPACK_WRITE_ENCODED(mpack_encode_timestamp_8, MPACK_EXT_SIZE_TIMESTAMP8, seconds, nanoseconds); + } else { + MPACK_WRITE_ENCODED(mpack_encode_timestamp_4, MPACK_EXT_SIZE_TIMESTAMP4, (uint32_t)seconds); + } +} +#endif + +void mpack_start_array(mpack_writer_t* writer, uint32_t count) { + mpack_writer_track_element(writer); + + if (count <= 15) { + MPACK_WRITE_ENCODED(mpack_encode_fixarray, MPACK_TAG_SIZE_FIXARRAY, (uint8_t)count); + } else if (count <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_array16, MPACK_TAG_SIZE_ARRAY16, (uint16_t)count); + } else { + MPACK_WRITE_ENCODED(mpack_encode_array32, MPACK_TAG_SIZE_ARRAY32, (uint32_t)count); + } + + mpack_writer_track_push(writer, mpack_type_array, count); +} + +void mpack_start_map(mpack_writer_t* writer, uint32_t count) { + mpack_writer_track_element(writer); + + if (count <= 15) { + MPACK_WRITE_ENCODED(mpack_encode_fixmap, MPACK_TAG_SIZE_FIXMAP, (uint8_t)count); + } else if (count <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_map16, MPACK_TAG_SIZE_MAP16, (uint16_t)count); + } else { + MPACK_WRITE_ENCODED(mpack_encode_map32, MPACK_TAG_SIZE_MAP32, (uint32_t)count); + } + + mpack_writer_track_push(writer, mpack_type_map, count); +} + +static void mpack_start_str_notrack(mpack_writer_t* writer, uint32_t count) { + if (count <= 31) { + MPACK_WRITE_ENCODED(mpack_encode_fixstr, MPACK_TAG_SIZE_FIXSTR, (uint8_t)count); + + // str8 is only supported in v5 or later. + } else if (count <= UINT8_MAX + #if MPACK_COMPATIBILITY + && writer->version >= mpack_version_v5 + #endif + ) { + MPACK_WRITE_ENCODED(mpack_encode_str8, MPACK_TAG_SIZE_STR8, (uint8_t)count); + + } else if (count <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_str16, MPACK_TAG_SIZE_STR16, (uint16_t)count); + } else { + MPACK_WRITE_ENCODED(mpack_encode_str32, MPACK_TAG_SIZE_STR32, (uint32_t)count); + } +} + +static void mpack_start_bin_notrack(mpack_writer_t* writer, uint32_t count) { + #if MPACK_COMPATIBILITY + // In the v4 spec, there was only the raw type for any kind of + // variable-length data. In v4 mode, we support the bin functions, + // but we produce an old-style raw. + if (writer->version <= mpack_version_v4) { + mpack_start_str_notrack(writer, count); + return; + } + #endif + + if (count <= UINT8_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_bin8, MPACK_TAG_SIZE_BIN8, (uint8_t)count); + } else if (count <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_bin16, MPACK_TAG_SIZE_BIN16, (uint16_t)count); + } else { + MPACK_WRITE_ENCODED(mpack_encode_bin32, MPACK_TAG_SIZE_BIN32, (uint32_t)count); + } +} + +void mpack_start_str(mpack_writer_t* writer, uint32_t count) { + mpack_writer_track_element(writer); + mpack_start_str_notrack(writer, count); + mpack_writer_track_push(writer, mpack_type_str, count); +} + +void mpack_start_bin(mpack_writer_t* writer, uint32_t count) { + mpack_writer_track_element(writer); + mpack_start_bin_notrack(writer, count); + mpack_writer_track_push(writer, mpack_type_bin, count); +} + +#if MPACK_EXTENSIONS +void mpack_start_ext(mpack_writer_t* writer, int8_t exttype, uint32_t count) { + #if MPACK_COMPATIBILITY + if (writer->version <= mpack_version_v4) { + mpack_break("Ext types require spec version v5 or later. This writer is in v%i mode.", (int)writer->version); + mpack_writer_flag_error(writer, mpack_error_bug); + return; + } + #endif + + mpack_writer_track_element(writer); + + if (count == 1) { + MPACK_WRITE_ENCODED(mpack_encode_fixext1, MPACK_TAG_SIZE_FIXEXT1, exttype); + } else if (count == 2) { + MPACK_WRITE_ENCODED(mpack_encode_fixext2, MPACK_TAG_SIZE_FIXEXT2, exttype); + } else if (count == 4) { + MPACK_WRITE_ENCODED(mpack_encode_fixext4, MPACK_TAG_SIZE_FIXEXT4, exttype); + } else if (count == 8) { + MPACK_WRITE_ENCODED(mpack_encode_fixext8, MPACK_TAG_SIZE_FIXEXT8, exttype); + } else if (count == 16) { + MPACK_WRITE_ENCODED(mpack_encode_fixext16, MPACK_TAG_SIZE_FIXEXT16, exttype); + } else if (count <= UINT8_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_ext8, MPACK_TAG_SIZE_EXT8, exttype, (uint8_t)count); + } else if (count <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_ext16, MPACK_TAG_SIZE_EXT16, exttype, (uint16_t)count); + } else { + MPACK_WRITE_ENCODED(mpack_encode_ext32, MPACK_TAG_SIZE_EXT32, exttype, (uint32_t)count); + } + + mpack_writer_track_push(writer, mpack_type_ext, count); +} +#endif + + + +/* + * Compound helpers and other functions + */ + +void mpack_write_str(mpack_writer_t* writer, const char* data, uint32_t count) { + mpack_assert(data != NULL, "data for string of length %i is NULL", (int)count); + + #if MPACK_OPTIMIZE_FOR_SIZE + mpack_writer_track_element(writer); + mpack_start_str_notrack(writer, count); + mpack_write_native(writer, data, count); + #else + + mpack_writer_track_element(writer); + + if (count <= 31) { + // The minimum buffer size when using a flush function is guaranteed to + // fit the largest possible fixstr. + size_t size = count + MPACK_TAG_SIZE_FIXSTR; + if (MPACK_LIKELY(mpack_writer_buffer_left(writer) >= size) || mpack_writer_ensure(writer, size)) { + char* MPACK_RESTRICT p = writer->current; + mpack_encode_fixstr(p, (uint8_t)count); + mpack_memcpy(p + MPACK_TAG_SIZE_FIXSTR, data, count); + writer->current += count + MPACK_TAG_SIZE_FIXSTR; + } + return; + } + + if (count <= UINT8_MAX + #if MPACK_COMPATIBILITY + && writer->version >= mpack_version_v5 + #endif + ) { + if (count + MPACK_TAG_SIZE_STR8 <= mpack_writer_buffer_left(writer)) { + char* MPACK_RESTRICT p = writer->current; + mpack_encode_str8(p, (uint8_t)count); + mpack_memcpy(p + MPACK_TAG_SIZE_STR8, data, count); + writer->current += count + MPACK_TAG_SIZE_STR8; + } else { + MPACK_WRITE_ENCODED(mpack_encode_str8, MPACK_TAG_SIZE_STR8, (uint8_t)count); + mpack_write_native(writer, data, count); + } + return; + } + + // str16 and str32 are likely to be a significant fraction of the buffer + // size, so we don't bother with a combined space check in order to + // minimize code size. + if (count <= UINT16_MAX) { + MPACK_WRITE_ENCODED(mpack_encode_str16, MPACK_TAG_SIZE_STR16, (uint16_t)count); + mpack_write_native(writer, data, count); + } else { + MPACK_WRITE_ENCODED(mpack_encode_str32, MPACK_TAG_SIZE_STR32, (uint32_t)count); + mpack_write_native(writer, data, count); + } + + #endif +} + +void mpack_write_bin(mpack_writer_t* writer, const char* data, uint32_t count) { + mpack_assert(data != NULL, "data pointer for bin of %i bytes is NULL", (int)count); + mpack_start_bin(writer, count); + mpack_write_bytes(writer, data, count); + mpack_finish_bin(writer); +} + +#if MPACK_EXTENSIONS +void mpack_write_ext(mpack_writer_t* writer, int8_t exttype, const char* data, uint32_t count) { + mpack_assert(data != NULL, "data pointer for ext of type %i and %i bytes is NULL", exttype, (int)count); + mpack_start_ext(writer, exttype, count); + mpack_write_bytes(writer, data, count); + mpack_finish_ext(writer); +} +#endif + +void mpack_write_bytes(mpack_writer_t* writer, const char* data, size_t count) { + mpack_assert(data != NULL, "data pointer for %i bytes is NULL", (int)count); + mpack_writer_track_bytes(writer, count); + mpack_write_native(writer, data, count); +} + +void mpack_write_cstr(mpack_writer_t* writer, const char* cstr) { + mpack_assert(cstr != NULL, "cstr pointer is NULL"); + size_t length = mpack_strlen(cstr); + if (length > UINT32_MAX) + mpack_writer_flag_error(writer, mpack_error_invalid); + mpack_write_str(writer, cstr, (uint32_t)length); +} + +void mpack_write_cstr_or_nil(mpack_writer_t* writer, const char* cstr) { + if (cstr) + mpack_write_cstr(writer, cstr); + else + mpack_write_nil(writer); +} + +void mpack_write_utf8(mpack_writer_t* writer, const char* str, uint32_t length) { + mpack_assert(str != NULL, "data for string of length %i is NULL", (int)length); + if (!mpack_utf8_check(str, length)) { + mpack_writer_flag_error(writer, mpack_error_invalid); + return; + } + mpack_write_str(writer, str, length); +} + +void mpack_write_utf8_cstr(mpack_writer_t* writer, const char* cstr) { + mpack_assert(cstr != NULL, "cstr pointer is NULL"); + size_t length = mpack_strlen(cstr); + if (length > UINT32_MAX) { + mpack_writer_flag_error(writer, mpack_error_invalid); + return; + } + mpack_write_utf8(writer, cstr, (uint32_t)length); +} + +void mpack_write_utf8_cstr_or_nil(mpack_writer_t* writer, const char* cstr) { + if (cstr) + mpack_write_utf8_cstr(writer, cstr); + else + mpack_write_nil(writer); +} + +#endif + + +/* mpack/mpack-reader.c.c */ + +#define MPACK_INTERNAL 1 + +/* #include "mpack-reader.h" */ + +#if MPACK_READER + +static void mpack_reader_skip_using_fill(mpack_reader_t* reader, size_t count); + +void mpack_reader_init(mpack_reader_t* reader, char* buffer, size_t size, size_t count) { + mpack_assert(buffer != NULL, "buffer is NULL"); + + mpack_memset(reader, 0, sizeof(*reader)); + reader->buffer = buffer; + reader->size = size; + reader->data = buffer; + reader->end = buffer + count; + + #if MPACK_READ_TRACKING + mpack_reader_flag_if_error(reader, mpack_track_init(&reader->track)); + #endif + + mpack_log("===========================\n"); + mpack_log("initializing reader with buffer size %i\n", (int)size); +} + +void mpack_reader_init_error(mpack_reader_t* reader, mpack_error_t error) { + mpack_memset(reader, 0, sizeof(*reader)); + reader->error = error; + + mpack_log("===========================\n"); + mpack_log("initializing reader error state %i\n", (int)error); +} + +void mpack_reader_init_data(mpack_reader_t* reader, const char* data, size_t count) { + mpack_assert(data != NULL, "data is NULL"); + + mpack_memset(reader, 0, sizeof(*reader)); + reader->data = data; + reader->end = data + count; + + #if MPACK_READ_TRACKING + mpack_reader_flag_if_error(reader, mpack_track_init(&reader->track)); + #endif + + mpack_log("===========================\n"); + mpack_log("initializing reader with data size %i\n", (int)count); +} + +void mpack_reader_set_fill(mpack_reader_t* reader, mpack_reader_fill_t fill) { + MPACK_STATIC_ASSERT(MPACK_READER_MINIMUM_BUFFER_SIZE >= MPACK_MAXIMUM_TAG_SIZE, + "minimum buffer size must fit any tag!"); + + if (reader->size == 0) { + mpack_break("cannot use fill function without a writeable buffer!"); + mpack_reader_flag_error(reader, mpack_error_bug); + return; + } + + if (reader->size < MPACK_READER_MINIMUM_BUFFER_SIZE) { + mpack_break("buffer size is %i, but minimum buffer size for fill is %i", + (int)reader->size, MPACK_READER_MINIMUM_BUFFER_SIZE); + mpack_reader_flag_error(reader, mpack_error_bug); + return; + } + + reader->fill = fill; +} + +void mpack_reader_set_skip(mpack_reader_t* reader, mpack_reader_skip_t skip) { + mpack_assert(reader->size != 0, "cannot use skip function without a writeable buffer!"); + reader->skip = skip; +} + +#if MPACK_STDIO +static size_t mpack_file_reader_fill(mpack_reader_t* reader, char* buffer, size_t count) { + if (feof((FILE *)reader->context)) { + mpack_reader_flag_error(reader, mpack_error_eof); + return 0; + } + return fread((void*)buffer, 1, count, (FILE*)reader->context); +} + +static void mpack_file_reader_skip(mpack_reader_t* reader, size_t count) { + if (mpack_reader_error(reader) != mpack_ok) + return; + FILE* file = (FILE*)reader->context; + + // We call ftell() to test whether the stream is seekable + // without causing a file error. + if (ftell(file) >= 0) { + mpack_log("seeking forward %i bytes\n", (int)count); + if (fseek(file, (long int)count, SEEK_CUR) == 0) + return; + mpack_log("fseek() didn't return zero!\n"); + if (ferror(file)) { + mpack_reader_flag_error(reader, mpack_error_io); + return; + } + } + + // If the stream is not seekable, fall back to the fill function. + mpack_reader_skip_using_fill(reader, count); +} + +static void mpack_file_reader_teardown(mpack_reader_t* reader) { + MPACK_FREE(reader->buffer); + reader->buffer = NULL; + reader->context = NULL; + reader->size = 0; + reader->fill = NULL; + reader->skip = NULL; + reader->teardown = NULL; +} + +static void mpack_file_reader_teardown_close(mpack_reader_t* reader) { + FILE* file = (FILE*)reader->context; + + if (file) { + int ret = fclose(file); + if (ret != 0) + mpack_reader_flag_error(reader, mpack_error_io); + } + + mpack_file_reader_teardown(reader); +} + +void mpack_reader_init_stdfile(mpack_reader_t* reader, FILE* file, bool close_when_done) { + mpack_assert(file != NULL, "file is NULL"); + + size_t capacity = MPACK_BUFFER_SIZE; + char* buffer = (char*)MPACK_MALLOC(capacity); + if (buffer == NULL) { + mpack_reader_init_error(reader, mpack_error_memory); + if (close_when_done) { + fclose(file); + } + return; + } + + mpack_reader_init(reader, buffer, capacity, 0); + mpack_reader_set_context(reader, file); + mpack_reader_set_fill(reader, mpack_file_reader_fill); + mpack_reader_set_skip(reader, mpack_file_reader_skip); + mpack_reader_set_teardown(reader, close_when_done ? + mpack_file_reader_teardown_close : + mpack_file_reader_teardown); +} + +void mpack_reader_init_filename(mpack_reader_t* reader, const char* filename) { + mpack_assert(filename != NULL, "filename is NULL"); + + FILE* file = fopen(filename, "rb"); + if (file == NULL) { + mpack_reader_init_error(reader, mpack_error_io); + return; + } + + mpack_reader_init_stdfile(reader, file, true); +} +#endif + +mpack_error_t mpack_reader_destroy(mpack_reader_t* reader) { + + // clean up tracking, asserting if we're not already in an error state + #if MPACK_READ_TRACKING + mpack_reader_flag_if_error(reader, mpack_track_destroy(&reader->track, mpack_reader_error(reader) != mpack_ok)); + #endif + + if (reader->teardown) + reader->teardown(reader); + reader->teardown = NULL; + + return reader->error; +} + +size_t mpack_reader_remaining(mpack_reader_t* reader, const char** data) { + if (mpack_reader_error(reader) != mpack_ok) + return 0; + + #if MPACK_READ_TRACKING + if (mpack_reader_flag_if_error(reader, mpack_track_check_empty(&reader->track)) != mpack_ok) + return 0; + #endif + + if (data) + *data = reader->data; + return (size_t)(reader->end - reader->data); +} + +void mpack_reader_flag_error(mpack_reader_t* reader, mpack_error_t error) { + mpack_log("reader %p setting error %i: %s\n", (void*)reader, (int)error, mpack_error_to_string(error)); + + if (reader->error == mpack_ok) { + reader->error = error; + reader->end = reader->data; + if (reader->error_fn) + reader->error_fn(reader, error); + } +} + +// Loops on the fill function, reading between the minimum and +// maximum number of bytes and flagging an error if it fails. +MPACK_NOINLINE static size_t mpack_fill_range(mpack_reader_t* reader, char* p, size_t min_bytes, size_t max_bytes) { + mpack_assert(reader->fill != NULL, "mpack_fill_range() called with no fill function?"); + mpack_assert(min_bytes > 0, "cannot fill zero bytes!"); + mpack_assert(max_bytes >= min_bytes, "min_bytes %i cannot be larger than max_bytes %i!", + (int)min_bytes, (int)max_bytes); + + size_t count = 0; + while (count < min_bytes) { + size_t read = reader->fill(reader, p + count, max_bytes - count); + + // Reader fill functions can flag an error or return 0 on failure. We + // also guard against functions that return -1 just in case. + if (mpack_reader_error(reader) != mpack_ok) + return 0; + if (read == 0 || read == ((size_t)(-1))) { + mpack_reader_flag_error(reader, mpack_error_io); + return 0; + } + + count += read; + } + return count; +} + +MPACK_NOINLINE bool mpack_reader_ensure_straddle(mpack_reader_t* reader, size_t count) { + mpack_assert(count != 0, "cannot ensure zero bytes!"); + mpack_assert(reader->error == mpack_ok, "reader cannot be in an error state!"); + + mpack_assert(count > (size_t)(reader->end - reader->data), + "straddling ensure requested for %i bytes, but there are %i bytes " + "left in buffer. call mpack_reader_ensure() instead", + (int)count, (int)(reader->end - reader->data)); + + // we'll need a fill function to get more data. if there's no + // fill function, the buffer should contain an entire MessagePack + // object, so we raise mpack_error_invalid instead of mpack_error_io + // on truncated data. + if (reader->fill == NULL) { + mpack_reader_flag_error(reader, mpack_error_invalid); + return false; + } + + // we need enough space in the buffer. if the buffer is not + // big enough, we return mpack_error_too_big (since this is + // for an in-place read larger than the buffer size.) + if (count > reader->size) { + mpack_reader_flag_error(reader, mpack_error_too_big); + return false; + } + + // move the existing data to the start of the buffer + size_t left = (size_t)(reader->end - reader->data); + mpack_memmove(reader->buffer, reader->data, left); + reader->end -= reader->data - reader->buffer; + reader->data = reader->buffer; + + // read at least the necessary number of bytes, accepting up to the + // buffer size + size_t read = mpack_fill_range(reader, reader->buffer + left, + count - left, reader->size - left); + if (mpack_reader_error(reader) != mpack_ok) + return false; + reader->end += read; + return true; +} + +// Reads count bytes into p. Used when there are not enough bytes +// left in the buffer to satisfy a read. +MPACK_NOINLINE void mpack_read_native_straddle(mpack_reader_t* reader, char* p, size_t count) { + mpack_assert(count == 0 || p != NULL, "data pointer for %i bytes is NULL", (int)count); + + if (mpack_reader_error(reader) != mpack_ok) { + mpack_memset(p, 0, count); + return; + } + + size_t left = (size_t)(reader->end - reader->data); + mpack_log("big read for %i bytes into %p, %i left in buffer, buffer size %i\n", + (int)count, p, (int)left, (int)reader->size); + + if (count <= left) { + mpack_assert(0, + "big read requested for %i bytes, but there are %i bytes " + "left in buffer. call mpack_read_native() instead", + (int)count, (int)left); + mpack_reader_flag_error(reader, mpack_error_bug); + mpack_memset(p, 0, count); + return; + } + + // we'll need a fill function to get more data. if there's no + // fill function, the buffer should contain an entire MessagePack + // object, so we raise mpack_error_invalid instead of mpack_error_io + // on truncated data. + if (reader->fill == NULL) { + mpack_reader_flag_error(reader, mpack_error_invalid); + mpack_memset(p, 0, count); + return; + } + + if (reader->size == 0) { + // somewhat debatable what error should be returned here. when + // initializing a reader with an in-memory buffer it's not + // necessarily a bug if the data is blank; it might just have + // been truncated to zero. for this reason we return the same + // error as if the data was truncated. + mpack_reader_flag_error(reader, mpack_error_io); + mpack_memset(p, 0, count); + return; + } + + // flush what's left of the buffer + if (left > 0) { + mpack_log("flushing %i bytes remaining in buffer\n", (int)left); + mpack_memcpy(p, reader->data, left); + count -= left; + p += left; + reader->data += left; + } + + // if the remaining data needed is some small fraction of the + // buffer size, we'll try to fill the buffer as much as possible + // and copy the needed data out. + if (count <= reader->size / MPACK_READER_SMALL_FRACTION_DENOMINATOR) { + size_t read = mpack_fill_range(reader, reader->buffer, count, reader->size); + if (mpack_reader_error(reader) != mpack_ok) + return; + mpack_memcpy(p, reader->buffer, count); + reader->data = reader->buffer + count; + reader->end = reader->buffer + read; + + // otherwise we read the remaining data directly into the target. + } else { + mpack_log("reading %i additional bytes\n", (int)count); + mpack_fill_range(reader, p, count, count); + } +} + +MPACK_NOINLINE static void mpack_skip_bytes_straddle(mpack_reader_t* reader, size_t count) { + + // we'll need at least a fill function to skip more data. if there's + // no fill function, the buffer should contain an entire MessagePack + // object, so we raise mpack_error_invalid instead of mpack_error_io + // on truncated data. (see mpack_read_native_straddle()) + if (reader->fill == NULL) { + mpack_log("reader has no fill function!\n"); + mpack_reader_flag_error(reader, mpack_error_invalid); + return; + } + + // discard whatever's left in the buffer + size_t left = (size_t)(reader->end - reader->data); + mpack_log("discarding %i bytes still in buffer\n", (int)left); + count -= left; + reader->data = reader->end; + + // use the skip function if we've got one, and if we're trying + // to skip a lot of data. if we only need to skip some tiny + // fraction of the buffer size, it's probably better to just + // fill the buffer and skip from it instead of trying to seek. + if (reader->skip && count > reader->size / 16) { + mpack_log("calling skip function for %i bytes\n", (int)count); + reader->skip(reader, count); + return; + } + + mpack_reader_skip_using_fill(reader, count); +} + +void mpack_skip_bytes(mpack_reader_t* reader, size_t count) { + if (mpack_reader_error(reader) != mpack_ok) + return; + mpack_log("skip requested for %i bytes\n", (int)count); + + mpack_reader_track_bytes(reader, count); + + // check if we have enough in the buffer already + size_t left = (size_t)(reader->end - reader->data); + if (left >= count) { + mpack_log("skipping %u bytes still in buffer\n", (uint32_t)count); + reader->data += count; + return; + } + + mpack_skip_bytes_straddle(reader, count); +} + +MPACK_NOINLINE static void mpack_reader_skip_using_fill(mpack_reader_t* reader, size_t count) { + mpack_assert(reader->fill != NULL, "missing fill function!"); + mpack_assert(reader->data == reader->end, "there are bytes left in the buffer!"); + mpack_assert(reader->error == mpack_ok, "should not have called this in an error state (%i)", reader->error); + mpack_log("skip using fill for %i bytes\n", (int)count); + + // fill and discard multiples of the buffer size + while (count > reader->size) { + mpack_log("filling and discarding buffer of %i bytes\n", (int)reader->size); + if (mpack_fill_range(reader, reader->buffer, reader->size, reader->size) < reader->size) { + mpack_reader_flag_error(reader, mpack_error_io); + return; + } + count -= reader->size; + } + + // fill the buffer as much as possible + reader->data = reader->buffer; + size_t read = mpack_fill_range(reader, reader->buffer, count, reader->size); + if (read < count) { + mpack_reader_flag_error(reader, mpack_error_io); + return; + } + reader->end = reader->data + read; + mpack_log("filled %i bytes into buffer; discarding %i bytes\n", (int)read, (int)count); + reader->data += count; +} + +void mpack_read_bytes(mpack_reader_t* reader, char* p, size_t count) { + mpack_assert(p != NULL, "destination for read of %i bytes is NULL", (int)count); + mpack_reader_track_bytes(reader, count); + mpack_read_native(reader, p, count); +} + +void mpack_read_utf8(mpack_reader_t* reader, char* p, size_t byte_count) { + mpack_assert(p != NULL, "destination for read of %i bytes is NULL", (int)byte_count); + mpack_reader_track_str_bytes_all(reader, byte_count); + mpack_read_native(reader, p, byte_count); + + if (mpack_reader_error(reader) == mpack_ok && !mpack_utf8_check(p, byte_count)) + mpack_reader_flag_error(reader, mpack_error_type); +} + +static void mpack_read_cstr_unchecked(mpack_reader_t* reader, char* buf, size_t buffer_size, size_t byte_count) { + mpack_assert(buf != NULL, "destination for read of %i bytes is NULL", (int)byte_count); + mpack_assert(buffer_size >= 1, "buffer size is zero; you must have room for at least a null-terminator"); + + if (mpack_reader_error(reader)) { + buf[0] = 0; + return; + } + + if (byte_count > buffer_size - 1) { + mpack_reader_flag_error(reader, mpack_error_too_big); + buf[0] = 0; + return; + } + + mpack_reader_track_str_bytes_all(reader, byte_count); + mpack_read_native(reader, buf, byte_count); + buf[byte_count] = 0; +} + +void mpack_read_cstr(mpack_reader_t* reader, char* buf, size_t buffer_size, size_t byte_count) { + mpack_read_cstr_unchecked(reader, buf, buffer_size, byte_count); + + // check for null bytes + if (mpack_reader_error(reader) == mpack_ok && !mpack_str_check_no_null(buf, byte_count)) { + buf[0] = 0; + mpack_reader_flag_error(reader, mpack_error_type); + } +} + +void mpack_read_utf8_cstr(mpack_reader_t* reader, char* buf, size_t buffer_size, size_t byte_count) { + mpack_read_cstr_unchecked(reader, buf, buffer_size, byte_count); + + // check encoding + if (mpack_reader_error(reader) == mpack_ok && !mpack_utf8_check_no_null(buf, byte_count)) { + buf[0] = 0; + mpack_reader_flag_error(reader, mpack_error_type); + } +} + +#ifdef MPACK_MALLOC +// Reads native bytes with error callback disabled. This allows MPack reader functions +// to hold an allocated buffer and read native data into it without leaking it in +// case of a non-local jump (longjmp, throw) out of an error handler. +static void mpack_read_native_noerrorfn(mpack_reader_t* reader, char* p, size_t count) { + mpack_assert(reader->error == mpack_ok, "cannot call if an error is already flagged!"); + mpack_reader_error_t error_fn = reader->error_fn; + reader->error_fn = NULL; + mpack_read_native(reader, p, count); + reader->error_fn = error_fn; +} + +char* mpack_read_bytes_alloc_impl(mpack_reader_t* reader, size_t count, bool null_terminated) { + + // track the bytes first in case it jumps + mpack_reader_track_bytes(reader, count); + if (mpack_reader_error(reader) != mpack_ok) + return NULL; + + // cannot allocate zero bytes. this is not an error. + if (count == 0 && null_terminated == false) + return NULL; + + // allocate data + char* data = (char*)MPACK_MALLOC(count + (null_terminated ? 1 : 0)); // TODO: can this overflow? + if (data == NULL) { + mpack_reader_flag_error(reader, mpack_error_memory); + return NULL; + } + + // read with error callback disabled so we don't leak our buffer + mpack_read_native_noerrorfn(reader, data, count); + + // report flagged errors + if (mpack_reader_error(reader) != mpack_ok) { + MPACK_FREE(data); + if (reader->error_fn) + reader->error_fn(reader, mpack_reader_error(reader)); + return NULL; + } + + if (null_terminated) + data[count] = '\0'; + return data; +} +#endif + +// read inplace without tracking (since there are different +// tracking modes for different inplace readers) +static const char* mpack_read_bytes_inplace_notrack(mpack_reader_t* reader, size_t count) { + if (mpack_reader_error(reader) != mpack_ok) + return NULL; + + // if we have enough bytes already in the buffer, we can return it directly. + if ((size_t)(reader->end - reader->data) >= count) { + const char* bytes = reader->data; + reader->data += count; + return bytes; + } + + if (!mpack_reader_ensure(reader, count)) + return NULL; + + const char* bytes = reader->data; + reader->data += count; + return bytes; +} + +const char* mpack_read_bytes_inplace(mpack_reader_t* reader, size_t count) { + mpack_reader_track_bytes(reader, count); + return mpack_read_bytes_inplace_notrack(reader, count); +} + +const char* mpack_read_utf8_inplace(mpack_reader_t* reader, size_t count) { + mpack_reader_track_str_bytes_all(reader, count); + const char* str = mpack_read_bytes_inplace_notrack(reader, count); + + if (mpack_reader_error(reader) == mpack_ok && !mpack_utf8_check(str, count)) { + mpack_reader_flag_error(reader, mpack_error_type); + return NULL; + } + + return str; +} + +static size_t mpack_parse_tag(mpack_reader_t* reader, mpack_tag_t* tag) { + mpack_assert(reader->error == mpack_ok, "reader cannot be in an error state!"); + + if (!mpack_reader_ensure(reader, 1)) + return 0; + uint8_t type = mpack_load_u8(reader->data); + + // unfortunately, by far the fastest way to parse a tag is to switch + // on the first byte, and to explicitly list every possible byte. so for + // infix types, the list of cases is quite large. + // + // in size-optimized builds, we switch on the top four bits first to + // handle most infix types with a smaller jump table to save space. + + #if MPACK_OPTIMIZE_FOR_SIZE + switch (type >> 4) { + + // positive fixnum + case 0x0: case 0x1: case 0x2: case 0x3: + case 0x4: case 0x5: case 0x6: case 0x7: + *tag = mpack_tag_make_uint(type); + return 1; + + // negative fixnum + case 0xe: case 0xf: + *tag = mpack_tag_make_int((int8_t)type); + return 1; + + // fixmap + case 0x8: + *tag = mpack_tag_make_map(type & ~0xf0u); + return 1; + + // fixarray + case 0x9: + *tag = mpack_tag_make_array(type & ~0xf0u); + return 1; + + // fixstr + case 0xa: case 0xb: + *tag = mpack_tag_make_str(type & ~0xe0u); + return 1; + + // not one of the common infix types + default: + break; + + } + #endif + + // handle individual type tags + switch (type) { + + #if !MPACK_OPTIMIZE_FOR_SIZE + // positive fixnum + case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f: + case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: + case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: + case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: + case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: + case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: + case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f: + case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: + case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: + case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: + case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f: + case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: + *tag = mpack_tag_make_uint(type); + return 1; + + // negative fixnum + case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7: + case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: + case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: + case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff: + *tag = mpack_tag_make_int((int8_t)type); + return 1; + + // fixmap + case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87: + case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f: + *tag = mpack_tag_make_map(type & ~0xf0u); + return 1; + + // fixarray + case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97: + case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f: + *tag = mpack_tag_make_array(type & ~0xf0u); + return 1; + + // fixstr + case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7: + case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf: + case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf: + *tag = mpack_tag_make_str(type & ~0xe0u); + return 1; + #endif + + // nil + case 0xc0: + *tag = mpack_tag_make_nil(); + return 1; + + // bool + case 0xc2: case 0xc3: + *tag = mpack_tag_make_bool((bool)(type & 1)); + return 1; + + // bin8 + case 0xc4: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_BIN8)) + return 0; + *tag = mpack_tag_make_bin(mpack_load_u8(reader->data + 1)); + return MPACK_TAG_SIZE_BIN8; + + // bin16 + case 0xc5: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_BIN16)) + return 0; + *tag = mpack_tag_make_bin(mpack_load_u16(reader->data + 1)); + return MPACK_TAG_SIZE_BIN16; + + // bin32 + case 0xc6: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_BIN32)) + return 0; + *tag = mpack_tag_make_bin(mpack_load_u32(reader->data + 1)); + return MPACK_TAG_SIZE_BIN32; + + #if MPACK_EXTENSIONS + // ext8 + case 0xc7: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_EXT8)) + return 0; + *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 2), mpack_load_u8(reader->data + 1)); + return MPACK_TAG_SIZE_EXT8; + + // ext16 + case 0xc8: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_EXT16)) + return 0; + *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 3), mpack_load_u16(reader->data + 1)); + return MPACK_TAG_SIZE_EXT16; + + // ext32 + case 0xc9: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_EXT32)) + return 0; + *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 5), mpack_load_u32(reader->data + 1)); + return MPACK_TAG_SIZE_EXT32; + #endif + + // float + case 0xca: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FLOAT)) + return 0; + *tag = mpack_tag_make_float(mpack_load_float(reader->data + 1)); + return MPACK_TAG_SIZE_FLOAT; + + // double + case 0xcb: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_DOUBLE)) + return 0; + *tag = mpack_tag_make_double(mpack_load_double(reader->data + 1)); + return MPACK_TAG_SIZE_DOUBLE; + + // uint8 + case 0xcc: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_U8)) + return 0; + *tag = mpack_tag_make_uint(mpack_load_u8(reader->data + 1)); + return MPACK_TAG_SIZE_U8; + + // uint16 + case 0xcd: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_U16)) + return 0; + *tag = mpack_tag_make_uint(mpack_load_u16(reader->data + 1)); + return MPACK_TAG_SIZE_U16; + + // uint32 + case 0xce: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_U32)) + return 0; + *tag = mpack_tag_make_uint(mpack_load_u32(reader->data + 1)); + return MPACK_TAG_SIZE_U32; + + // uint64 + case 0xcf: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_U64)) + return 0; + *tag = mpack_tag_make_uint(mpack_load_u64(reader->data + 1)); + return MPACK_TAG_SIZE_U64; + + // int8 + case 0xd0: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_I8)) + return 0; + *tag = mpack_tag_make_int(mpack_load_i8(reader->data + 1)); + return MPACK_TAG_SIZE_I8; + + // int16 + case 0xd1: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_I16)) + return 0; + *tag = mpack_tag_make_int(mpack_load_i16(reader->data + 1)); + return MPACK_TAG_SIZE_I16; + + // int32 + case 0xd2: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_I32)) + return 0; + *tag = mpack_tag_make_int(mpack_load_i32(reader->data + 1)); + return MPACK_TAG_SIZE_I32; + + // int64 + case 0xd3: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_I64)) + return 0; + *tag = mpack_tag_make_int(mpack_load_i64(reader->data + 1)); + return MPACK_TAG_SIZE_I64; + + #if MPACK_EXTENSIONS + // fixext1 + case 0xd4: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT1)) + return 0; + *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 1); + return MPACK_TAG_SIZE_FIXEXT1; + + // fixext2 + case 0xd5: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT2)) + return 0; + *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 2); + return MPACK_TAG_SIZE_FIXEXT2; + + // fixext4 + case 0xd6: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT4)) + return 0; + *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 4); + return 2; + + // fixext8 + case 0xd7: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT8)) + return 0; + *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 8); + return MPACK_TAG_SIZE_FIXEXT8; + + // fixext16 + case 0xd8: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT16)) + return 0; + *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 16); + return MPACK_TAG_SIZE_FIXEXT16; + #endif + + // str8 + case 0xd9: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_STR8)) + return 0; + *tag = mpack_tag_make_str(mpack_load_u8(reader->data + 1)); + return MPACK_TAG_SIZE_STR8; + + // str16 + case 0xda: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_STR16)) + return 0; + *tag = mpack_tag_make_str(mpack_load_u16(reader->data + 1)); + return MPACK_TAG_SIZE_STR16; + + // str32 + case 0xdb: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_STR32)) + return 0; + *tag = mpack_tag_make_str(mpack_load_u32(reader->data + 1)); + return MPACK_TAG_SIZE_STR32; + + // array16 + case 0xdc: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_ARRAY16)) + return 0; + *tag = mpack_tag_make_array(mpack_load_u16(reader->data + 1)); + return MPACK_TAG_SIZE_ARRAY16; + + // array32 + case 0xdd: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_ARRAY32)) + return 0; + *tag = mpack_tag_make_array(mpack_load_u32(reader->data + 1)); + return MPACK_TAG_SIZE_ARRAY32; + + // map16 + case 0xde: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_MAP16)) + return 0; + *tag = mpack_tag_make_map(mpack_load_u16(reader->data + 1)); + return MPACK_TAG_SIZE_MAP16; + + // map32 + case 0xdf: + if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_MAP32)) + return 0; + *tag = mpack_tag_make_map(mpack_load_u32(reader->data + 1)); + return MPACK_TAG_SIZE_MAP32; + + // reserved + case 0xc1: + mpack_reader_flag_error(reader, mpack_error_invalid); + return 0; + + #if !MPACK_EXTENSIONS + // ext + case 0xc7: // fallthrough + case 0xc8: // fallthrough + case 0xc9: // fallthrough + // fixext + case 0xd4: // fallthrough + case 0xd5: // fallthrough + case 0xd6: // fallthrough + case 0xd7: // fallthrough + case 0xd8: + mpack_reader_flag_error(reader, mpack_error_unsupported); + return 0; + #endif + + #if MPACK_OPTIMIZE_FOR_SIZE + // any other bytes should have been handled by the infix switch + default: + break; + #endif + } + + mpack_assert(0, "unreachable"); + return 0; +} + +mpack_tag_t mpack_read_tag(mpack_reader_t* reader) { + mpack_log("reading tag\n"); + + // make sure we can read a tag + if (mpack_reader_error(reader) != mpack_ok) + return mpack_tag_nil(); + if (mpack_reader_track_element(reader) != mpack_ok) + return mpack_tag_nil(); + + mpack_tag_t tag = MPACK_TAG_ZERO; + size_t count = mpack_parse_tag(reader, &tag); + if (count == 0) + return mpack_tag_nil(); + + #if MPACK_READ_TRACKING + mpack_error_t track_error = mpack_ok; + + switch (tag.type) { + case mpack_type_map: + case mpack_type_array: + track_error = mpack_track_push(&reader->track, tag.type, tag.v.n); + break; + #if MPACK_EXTENSIONS + case mpack_type_ext: + #endif + case mpack_type_str: + case mpack_type_bin: + track_error = mpack_track_push(&reader->track, tag.type, tag.v.l); + break; + default: + break; + } + + if (track_error != mpack_ok) { + mpack_reader_flag_error(reader, track_error); + return mpack_tag_nil(); + } + #endif + + reader->data += count; + return tag; +} + +mpack_tag_t mpack_peek_tag(mpack_reader_t* reader) { + mpack_log("peeking tag\n"); + + // make sure we can peek a tag + if (mpack_reader_error(reader) != mpack_ok) + return mpack_tag_nil(); + if (mpack_reader_track_peek_element(reader) != mpack_ok) + return mpack_tag_nil(); + + mpack_tag_t tag = MPACK_TAG_ZERO; + if (mpack_parse_tag(reader, &tag) == 0) + return mpack_tag_nil(); + return tag; +} + +void mpack_discard(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (mpack_reader_error(reader)) + return; + switch (var.type) { + case mpack_type_str: + mpack_skip_bytes(reader, var.v.l); + mpack_done_str(reader); + break; + case mpack_type_bin: + mpack_skip_bytes(reader, var.v.l); + mpack_done_bin(reader); + break; + #if MPACK_EXTENSIONS + case mpack_type_ext: + mpack_skip_bytes(reader, var.v.l); + mpack_done_ext(reader); + break; + #endif + case mpack_type_array: { + for (; var.v.n > 0; --var.v.n) { + mpack_discard(reader); + if (mpack_reader_error(reader)) + break; + } + mpack_done_array(reader); + break; + } + case mpack_type_map: { + for (; var.v.n > 0; --var.v.n) { + mpack_discard(reader); + mpack_discard(reader); + if (mpack_reader_error(reader)) + break; + } + mpack_done_map(reader); + break; + } + default: + break; + } +} + +#if MPACK_EXTENSIONS +mpack_timestamp_t mpack_read_timestamp(mpack_reader_t* reader, size_t size) { + mpack_timestamp_t timestamp = {0, 0}; + + if (size != 4 && size != 8 && size != 12) { + mpack_reader_flag_error(reader, mpack_error_invalid); + return timestamp; + } + + char buf[12]; + mpack_read_bytes(reader, buf, size); + mpack_done_ext(reader); + if (mpack_reader_error(reader) != mpack_ok) + return timestamp; + + switch (size) { + case 4: + timestamp.seconds = (int64_t)(uint64_t)mpack_load_u32(buf); + break; + + case 8: { + uint64_t packed = mpack_load_u64(buf); + timestamp.seconds = (int64_t)(packed & ((UINT64_C(1) << 34) - 1)); + timestamp.nanoseconds = (uint32_t)(packed >> 34); + break; + } + + case 12: + timestamp.nanoseconds = mpack_load_u32(buf); + timestamp.seconds = mpack_load_i64(buf + 4); + break; + + default: + mpack_assert(false, "unreachable"); + break; + } + + if (timestamp.nanoseconds > MPACK_TIMESTAMP_NANOSECONDS_MAX) { + mpack_reader_flag_error(reader, mpack_error_invalid); + mpack_timestamp_t zero = {0, 0}; + return zero; + } + + return timestamp; +} +#endif + +#if MPACK_READ_TRACKING +void mpack_done_type(mpack_reader_t* reader, mpack_type_t type) { + if (mpack_reader_error(reader) == mpack_ok) + mpack_reader_flag_if_error(reader, mpack_track_pop(&reader->track, type)); +} +#endif + +#if MPACK_DEBUG && MPACK_STDIO +static size_t mpack_print_read_prefix(mpack_reader_t* reader, size_t length, char* buffer, size_t buffer_size) { + if (length == 0) + return 0; + + size_t read = (length < buffer_size) ? length : buffer_size; + mpack_read_bytes(reader, buffer, read); + if (mpack_reader_error(reader) != mpack_ok) + return 0; + + mpack_skip_bytes(reader, length - read); + return read; +} + +static void mpack_print_element(mpack_reader_t* reader, mpack_print_t* print, size_t depth) { + mpack_tag_t val = mpack_read_tag(reader); + if (mpack_reader_error(reader) != mpack_ok) + return; + + // We read some bytes from bin and ext so we can print its prefix in hex. + char buffer[MPACK_PRINT_BYTE_COUNT]; + size_t count = 0; + + switch (val.type) { + case mpack_type_str: + mpack_print_append_cstr(print, "\""); + for (size_t i = 0; i < val.v.l; ++i) { + char c; + mpack_read_bytes(reader, &c, 1); + if (mpack_reader_error(reader) != mpack_ok) + return; + switch (c) { + case '\n': mpack_print_append_cstr(print, "\\n"); break; + case '\\': mpack_print_append_cstr(print, "\\\\"); break; + case '"': mpack_print_append_cstr(print, "\\\""); break; + default: mpack_print_append(print, &c, 1); break; + } + } + mpack_print_append_cstr(print, "\""); + mpack_done_str(reader); + return; + + case mpack_type_array: + mpack_print_append_cstr(print, "[\n"); + for (size_t i = 0; i < val.v.n; ++i) { + for (size_t j = 0; j < depth + 1; ++j) + mpack_print_append_cstr(print, " "); + mpack_print_element(reader, print, depth + 1); + if (mpack_reader_error(reader) != mpack_ok) + return; + if (i != val.v.n - 1) + mpack_print_append_cstr(print, ","); + mpack_print_append_cstr(print, "\n"); + } + for (size_t i = 0; i < depth; ++i) + mpack_print_append_cstr(print, " "); + mpack_print_append_cstr(print, "]"); + mpack_done_array(reader); + return; + + case mpack_type_map: + mpack_print_append_cstr(print, "{\n"); + for (size_t i = 0; i < val.v.n; ++i) { + for (size_t j = 0; j < depth + 1; ++j) + mpack_print_append_cstr(print, " "); + mpack_print_element(reader, print, depth + 1); + if (mpack_reader_error(reader) != mpack_ok) + return; + mpack_print_append_cstr(print, ": "); + mpack_print_element(reader, print, depth + 1); + if (mpack_reader_error(reader) != mpack_ok) + return; + if (i != val.v.n - 1) + mpack_print_append_cstr(print, ","); + mpack_print_append_cstr(print, "\n"); + } + for (size_t i = 0; i < depth; ++i) + mpack_print_append_cstr(print, " "); + mpack_print_append_cstr(print, "}"); + mpack_done_map(reader); + return; + + // The above cases return so as not to print a pseudo-json value. The + // below cases break and print pseudo-json. + + case mpack_type_bin: + count = mpack_print_read_prefix(reader, mpack_tag_bin_length(&val), buffer, sizeof(buffer)); + mpack_done_bin(reader); + break; + + #if MPACK_EXTENSIONS + case mpack_type_ext: + count = mpack_print_read_prefix(reader, mpack_tag_ext_length(&val), buffer, sizeof(buffer)); + mpack_done_ext(reader); + break; + #endif + + default: + break; + } + + char buf[256]; + mpack_tag_debug_pseudo_json(val, buf, sizeof(buf), buffer, count); + mpack_print_append_cstr(print, buf); +} + +static void mpack_print_and_destroy(mpack_reader_t* reader, mpack_print_t* print, size_t depth) { + for (size_t i = 0; i < depth; ++i) + mpack_print_append_cstr(print, " "); + mpack_print_element(reader, print, depth); + + size_t remaining = mpack_reader_remaining(reader, NULL); + + char buf[256]; + if (mpack_reader_destroy(reader) != mpack_ok) { + mpack_snprintf(buf, sizeof(buf), "\n", mpack_error_to_string(mpack_reader_error(reader))); + buf[sizeof(buf) - 1] = '\0'; + mpack_print_append_cstr(print, buf); + } else if (remaining > 0) { + mpack_snprintf(buf, sizeof(buf), "\n<%i extra bytes at end of message>", (int)remaining); + buf[sizeof(buf) - 1] = '\0'; + mpack_print_append_cstr(print, buf); + } +} + +static void mpack_print_data(const char* data, size_t len, mpack_print_t* print, size_t depth) { + mpack_reader_t reader; + mpack_reader_init_data(&reader, data, len); + mpack_print_and_destroy(&reader, print, depth); +} + +void mpack_print_data_to_buffer(const char* data, size_t data_size, char* buffer, size_t buffer_size) { + if (buffer_size == 0) { + mpack_assert(false, "buffer size is zero!"); + return; + } + + mpack_print_t print; + mpack_memset(&print, 0, sizeof(print)); + print.buffer = buffer; + print.size = buffer_size; + mpack_print_data(data, data_size, &print, 0); + mpack_print_append(&print, "", 1); // null-terminator + mpack_print_flush(&print); + + // we always make sure there's a null-terminator at the end of the buffer + // in case we ran out of space. + print.buffer[print.size - 1] = '\0'; +} + +void mpack_print_data_to_callback(const char* data, size_t size, mpack_print_callback_t callback, void* context) { + char buffer[1024]; + mpack_print_t print; + mpack_memset(&print, 0, sizeof(print)); + print.buffer = buffer; + print.size = sizeof(buffer); + print.callback = callback; + print.context = context; + mpack_print_data(data, size, &print, 0); + mpack_print_flush(&print); +} + +void mpack_print_data_to_file(const char* data, size_t len, FILE* file) { + mpack_assert(data != NULL, "data is NULL"); + mpack_assert(file != NULL, "file is NULL"); + + char buffer[1024]; + mpack_print_t print; + mpack_memset(&print, 0, sizeof(print)); + print.buffer = buffer; + print.size = sizeof(buffer); + print.callback = &mpack_print_file_callback; + print.context = file; + + mpack_print_data(data, len, &print, 2); + mpack_print_append_cstr(&print, "\n"); + mpack_print_flush(&print); +} + +void mpack_print_stdfile_to_callback(FILE* file, mpack_print_callback_t callback, void* context) { + char buffer[1024]; + mpack_print_t print; + mpack_memset(&print, 0, sizeof(print)); + print.buffer = buffer; + print.size = sizeof(buffer); + print.callback = callback; + print.context = context; + + mpack_reader_t reader; + mpack_reader_init_stdfile(&reader, file, false); + mpack_print_and_destroy(&reader, &print, 0); + mpack_print_flush(&print); +} +#endif + +#endif + +/* mpack/mpack-expect.c.c */ + +#define MPACK_INTERNAL 1 + +/* #include "mpack-expect.h" */ + +#if MPACK_EXPECT + + +// Helpers + +MPACK_STATIC_INLINE uint8_t mpack_expect_native_u8(mpack_reader_t* reader) { + if (mpack_reader_error(reader) != mpack_ok) + return 0; + uint8_t type; + if (!mpack_reader_ensure(reader, sizeof(type))) + return 0; + type = mpack_load_u8(reader->data); + reader->data += sizeof(type); + return type; +} + +#if !MPACK_OPTIMIZE_FOR_SIZE +MPACK_STATIC_INLINE uint16_t mpack_expect_native_u16(mpack_reader_t* reader) { + if (mpack_reader_error(reader) != mpack_ok) + return 0; + uint16_t type; + if (!mpack_reader_ensure(reader, sizeof(type))) + return 0; + type = mpack_load_u16(reader->data); + reader->data += sizeof(type); + return type; +} + +MPACK_STATIC_INLINE uint32_t mpack_expect_native_u32(mpack_reader_t* reader) { + if (mpack_reader_error(reader) != mpack_ok) + return 0; + uint32_t type; + if (!mpack_reader_ensure(reader, sizeof(type))) + return 0; + type = mpack_load_u32(reader->data); + reader->data += sizeof(type); + return type; +} +#endif + +MPACK_STATIC_INLINE uint8_t mpack_expect_type_byte(mpack_reader_t* reader) { + mpack_reader_track_element(reader); + return mpack_expect_native_u8(reader); +} + + +// Basic Number Functions + +uint8_t mpack_expect_u8(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) { + if (var.v.u <= UINT8_MAX) + return (uint8_t)var.v.u; + } else if (var.type == mpack_type_int) { + if (var.v.i >= 0 && var.v.i <= UINT8_MAX) + return (uint8_t)var.v.i; + } + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +uint16_t mpack_expect_u16(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) { + if (var.v.u <= UINT16_MAX) + return (uint16_t)var.v.u; + } else if (var.type == mpack_type_int) { + if (var.v.i >= 0 && var.v.i <= UINT16_MAX) + return (uint16_t)var.v.i; + } + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +uint32_t mpack_expect_u32(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) { + if (var.v.u <= UINT32_MAX) + return (uint32_t)var.v.u; + } else if (var.type == mpack_type_int) { + if (var.v.i >= 0 && var.v.i <= UINT32_MAX) + return (uint32_t)var.v.i; + } + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +uint64_t mpack_expect_u64(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) { + return var.v.u; + } else if (var.type == mpack_type_int) { + if (var.v.i >= 0) + return (uint64_t)var.v.i; + } + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +int8_t mpack_expect_i8(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) { + if (var.v.u <= INT8_MAX) + return (int8_t)var.v.u; + } else if (var.type == mpack_type_int) { + if (var.v.i >= INT8_MIN && var.v.i <= INT8_MAX) + return (int8_t)var.v.i; + } + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +int16_t mpack_expect_i16(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) { + if (var.v.u <= INT16_MAX) + return (int16_t)var.v.u; + } else if (var.type == mpack_type_int) { + if (var.v.i >= INT16_MIN && var.v.i <= INT16_MAX) + return (int16_t)var.v.i; + } + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +int32_t mpack_expect_i32(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) { + if (var.v.u <= INT32_MAX) + return (int32_t)var.v.u; + } else if (var.type == mpack_type_int) { + if (var.v.i >= INT32_MIN && var.v.i <= INT32_MAX) + return (int32_t)var.v.i; + } + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +int64_t mpack_expect_i64(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) { + if (var.v.u <= INT64_MAX) + return (int64_t)var.v.u; + } else if (var.type == mpack_type_int) { + return var.v.i; + } + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +float mpack_expect_float(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) + return (float)var.v.u; + else if (var.type == mpack_type_int) + return (float)var.v.i; + else if (var.type == mpack_type_float) + return var.v.f; + else if (var.type == mpack_type_double) + return (float)var.v.d; + mpack_reader_flag_error(reader, mpack_error_type); + return 0.0f; +} + +double mpack_expect_double(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_uint) + return (double)var.v.u; + else if (var.type == mpack_type_int) + return (double)var.v.i; + else if (var.type == mpack_type_float) + return (double)var.v.f; + else if (var.type == mpack_type_double) + return var.v.d; + mpack_reader_flag_error(reader, mpack_error_type); + return 0.0; +} + +float mpack_expect_float_strict(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_float) + return var.v.f; + mpack_reader_flag_error(reader, mpack_error_type); + return 0.0f; +} + +double mpack_expect_double_strict(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_float) + return (double)var.v.f; + else if (var.type == mpack_type_double) + return var.v.d; + mpack_reader_flag_error(reader, mpack_error_type); + return 0.0; +} + + +// Ranged Number Functions +// +// All ranged functions are identical other than the type, so we +// define their content with a macro. The prototypes are still written +// out in full to support ctags/IDE tools. + +#define MPACK_EXPECT_RANGE_IMPL(name, type_t) \ + \ + /* make sure the range is sensible */ \ + mpack_assert(min_value <= max_value, \ + "min_value %i must be less than or equal to max_value %i", \ + min_value, max_value); \ + \ + /* read the value */ \ + type_t val = mpack_expect_##name(reader); \ + if (mpack_reader_error(reader) != mpack_ok) \ + return min_value; \ + \ + /* make sure it fits */ \ + if (val < min_value || val > max_value) { \ + mpack_reader_flag_error(reader, mpack_error_type); \ + return min_value; \ + } \ + \ + return val; + +uint8_t mpack_expect_u8_range(mpack_reader_t* reader, uint8_t min_value, uint8_t max_value) {MPACK_EXPECT_RANGE_IMPL(u8, uint8_t)} +uint16_t mpack_expect_u16_range(mpack_reader_t* reader, uint16_t min_value, uint16_t max_value) {MPACK_EXPECT_RANGE_IMPL(u16, uint16_t)} +uint32_t mpack_expect_u32_range(mpack_reader_t* reader, uint32_t min_value, uint32_t max_value) {MPACK_EXPECT_RANGE_IMPL(u32, uint32_t)} +uint64_t mpack_expect_u64_range(mpack_reader_t* reader, uint64_t min_value, uint64_t max_value) {MPACK_EXPECT_RANGE_IMPL(u64, uint64_t)} + +int8_t mpack_expect_i8_range(mpack_reader_t* reader, int8_t min_value, int8_t max_value) {MPACK_EXPECT_RANGE_IMPL(i8, int8_t)} +int16_t mpack_expect_i16_range(mpack_reader_t* reader, int16_t min_value, int16_t max_value) {MPACK_EXPECT_RANGE_IMPL(i16, int16_t)} +int32_t mpack_expect_i32_range(mpack_reader_t* reader, int32_t min_value, int32_t max_value) {MPACK_EXPECT_RANGE_IMPL(i32, int32_t)} +int64_t mpack_expect_i64_range(mpack_reader_t* reader, int64_t min_value, int64_t max_value) {MPACK_EXPECT_RANGE_IMPL(i64, int64_t)} + +float mpack_expect_float_range(mpack_reader_t* reader, float min_value, float max_value) {MPACK_EXPECT_RANGE_IMPL(float, float)} +double mpack_expect_double_range(mpack_reader_t* reader, double min_value, double max_value) {MPACK_EXPECT_RANGE_IMPL(double, double)} + +uint32_t mpack_expect_map_range(mpack_reader_t* reader, uint32_t min_value, uint32_t max_value) {MPACK_EXPECT_RANGE_IMPL(map, uint32_t)} +uint32_t mpack_expect_array_range(mpack_reader_t* reader, uint32_t min_value, uint32_t max_value) {MPACK_EXPECT_RANGE_IMPL(array, uint32_t)} + + +// Matching Number Functions + +void mpack_expect_uint_match(mpack_reader_t* reader, uint64_t value) { + if (mpack_expect_u64(reader) != value) + mpack_reader_flag_error(reader, mpack_error_type); +} + +void mpack_expect_int_match(mpack_reader_t* reader, int64_t value) { + if (mpack_expect_i64(reader) != value) + mpack_reader_flag_error(reader, mpack_error_type); +} + + +// Other Basic Types + +void mpack_expect_nil(mpack_reader_t* reader) { + if (mpack_expect_type_byte(reader) != 0xc0) + mpack_reader_flag_error(reader, mpack_error_type); +} + +bool mpack_expect_bool(mpack_reader_t* reader) { + uint8_t type = mpack_expect_type_byte(reader); + if ((type & ~1) != 0xc2) + mpack_reader_flag_error(reader, mpack_error_type); + return (bool)(type & 1); +} + +void mpack_expect_true(mpack_reader_t* reader) { + if (mpack_expect_bool(reader) != true) + mpack_reader_flag_error(reader, mpack_error_type); +} + +void mpack_expect_false(mpack_reader_t* reader) { + if (mpack_expect_bool(reader) != false) + mpack_reader_flag_error(reader, mpack_error_type); +} + +#if MPACK_EXTENSIONS +mpack_timestamp_t mpack_expect_timestamp(mpack_reader_t* reader) { + mpack_timestamp_t zero = {0, 0}; + + mpack_tag_t tag = mpack_read_tag(reader); + if (tag.type != mpack_type_ext) { + mpack_reader_flag_error(reader, mpack_error_type); + return zero; + } + if (mpack_tag_ext_exttype(&tag) != MPACK_EXTTYPE_TIMESTAMP) { + mpack_reader_flag_error(reader, mpack_error_type); + return zero; + } + + return mpack_read_timestamp(reader, mpack_tag_ext_length(&tag)); +} + +int64_t mpack_expect_timestamp_truncate(mpack_reader_t* reader) { + return mpack_expect_timestamp(reader).seconds; +} +#endif + + +// Compound Types + +uint32_t mpack_expect_map(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_map) + return var.v.n; + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +void mpack_expect_map_match(mpack_reader_t* reader, uint32_t count) { + if (mpack_expect_map(reader) != count) + mpack_reader_flag_error(reader, mpack_error_type); +} + +bool mpack_expect_map_or_nil(mpack_reader_t* reader, uint32_t* count) { + mpack_assert(count != NULL, "count cannot be NULL"); + + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_nil) { + *count = 0; + return false; + } + if (var.type == mpack_type_map) { + *count = var.v.n; + return true; + } + mpack_reader_flag_error(reader, mpack_error_type); + *count = 0; + return false; +} + +bool mpack_expect_map_max_or_nil(mpack_reader_t* reader, uint32_t max_count, uint32_t* count) { + mpack_assert(count != NULL, "count cannot be NULL"); + + bool has_map = mpack_expect_map_or_nil(reader, count); + if (has_map && *count > max_count) { + *count = 0; + mpack_reader_flag_error(reader, mpack_error_type); + return false; + } + return has_map; +} + +uint32_t mpack_expect_array(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_array) + return var.v.n; + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +void mpack_expect_array_match(mpack_reader_t* reader, uint32_t count) { + if (mpack_expect_array(reader) != count) + mpack_reader_flag_error(reader, mpack_error_type); +} + +bool mpack_expect_array_or_nil(mpack_reader_t* reader, uint32_t* count) { + mpack_assert(count != NULL, "count cannot be NULL"); + + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_nil) { + *count = 0; + return false; + } + if (var.type == mpack_type_array) { + *count = var.v.n; + return true; + } + mpack_reader_flag_error(reader, mpack_error_type); + *count = 0; + return false; +} + +bool mpack_expect_array_max_or_nil(mpack_reader_t* reader, uint32_t max_count, uint32_t* count) { + mpack_assert(count != NULL, "count cannot be NULL"); + + bool has_array = mpack_expect_array_or_nil(reader, count); + if (has_array && *count > max_count) { + *count = 0; + mpack_reader_flag_error(reader, mpack_error_type); + return false; + } + return has_array; +} + +#ifdef MPACK_MALLOC +void* mpack_expect_array_alloc_impl(mpack_reader_t* reader, size_t element_size, uint32_t max_count, uint32_t* out_count, bool allow_nil) { + mpack_assert(out_count != NULL, "out_count cannot be NULL"); + *out_count = 0; + + uint32_t count; + bool has_array = true; + if (allow_nil) + has_array = mpack_expect_array_max_or_nil(reader, max_count, &count); + else + count = mpack_expect_array_max(reader, max_count); + if (mpack_reader_error(reader)) + return NULL; + + // size 0 is not an error; we return NULL for no elements. + if (count == 0) { + // we call mpack_done_array() automatically ONLY if we are using + // the _or_nil variant. this is the only way to allow nil and empty + // to work the same way. + if (allow_nil && has_array) + mpack_done_array(reader); + return NULL; + } + + void* p = MPACK_MALLOC(element_size * count); + if (p == NULL) { + mpack_reader_flag_error(reader, mpack_error_memory); + return NULL; + } + + *out_count = count; + return p; +} +#endif + + +// Str, Bin and Ext Functions + +uint32_t mpack_expect_str(mpack_reader_t* reader) { + #if MPACK_OPTIMIZE_FOR_SIZE + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_str) + return var.v.l; + mpack_reader_flag_error(reader, mpack_error_type); + return 0; + #else + uint8_t type = mpack_expect_type_byte(reader); + uint32_t count; + + if ((type >> 5) == 5) { + count = type & (uint8_t)~0xe0; + } else if (type == 0xd9) { + count = mpack_expect_native_u8(reader); + } else if (type == 0xda) { + count = mpack_expect_native_u16(reader); + } else if (type == 0xdb) { + count = mpack_expect_native_u32(reader); + } else { + mpack_reader_flag_error(reader, mpack_error_type); + return 0; + } + + #if MPACK_READ_TRACKING + mpack_reader_flag_if_error(reader, mpack_track_push(&reader->track, mpack_type_str, count)); + #endif + return count; + #endif +} + +size_t mpack_expect_str_buf(mpack_reader_t* reader, char* buf, size_t bufsize) { + mpack_assert(buf != NULL, "buf cannot be NULL"); + + size_t length = mpack_expect_str(reader); + if (mpack_reader_error(reader)) + return 0; + + if (length > bufsize) { + mpack_reader_flag_error(reader, mpack_error_too_big); + return 0; + } + + mpack_read_bytes(reader, buf, length); + if (mpack_reader_error(reader)) + return 0; + + mpack_done_str(reader); + return length; +} + +size_t mpack_expect_utf8(mpack_reader_t* reader, char* buf, size_t size) { + mpack_assert(buf != NULL, "buf cannot be NULL"); + + size_t length = mpack_expect_str_buf(reader, buf, size); + + if (!mpack_utf8_check(buf, length)) { + mpack_reader_flag_error(reader, mpack_error_type); + return 0; + } + + return length; +} + +uint32_t mpack_expect_bin(mpack_reader_t* reader) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_bin) + return var.v.l; + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +size_t mpack_expect_bin_buf(mpack_reader_t* reader, char* buf, size_t bufsize) { + mpack_assert(buf != NULL, "buf cannot be NULL"); + + size_t binsize = mpack_expect_bin(reader); + if (mpack_reader_error(reader)) + return 0; + if (binsize > bufsize) { + mpack_reader_flag_error(reader, mpack_error_too_big); + return 0; + } + mpack_read_bytes(reader, buf, binsize); + if (mpack_reader_error(reader)) + return 0; + mpack_done_bin(reader); + return binsize; +} + +void mpack_expect_bin_size_buf(mpack_reader_t* reader, char* buf, uint32_t size) { + mpack_assert(buf != NULL, "buf cannot be NULL"); + mpack_expect_bin_size(reader, size); + mpack_read_bytes(reader, buf, size); + mpack_done_bin(reader); +} + +#if MPACK_EXTENSIONS +uint32_t mpack_expect_ext(mpack_reader_t* reader, int8_t* type) { + mpack_tag_t var = mpack_read_tag(reader); + if (var.type == mpack_type_ext) { + *type = mpack_tag_ext_exttype(&var); + return mpack_tag_ext_length(&var); + } + *type = 0; + mpack_reader_flag_error(reader, mpack_error_type); + return 0; +} + +size_t mpack_expect_ext_buf(mpack_reader_t* reader, int8_t* type, char* buf, size_t bufsize) { + mpack_assert(buf != NULL, "buf cannot be NULL"); + + size_t extsize = mpack_expect_ext(reader, type); + if (mpack_reader_error(reader)) + return 0; + if (extsize > bufsize) { + *type = 0; + mpack_reader_flag_error(reader, mpack_error_too_big); + return 0; + } + mpack_read_bytes(reader, buf, extsize); + if (mpack_reader_error(reader)) { + *type = 0; + return 0; + } + mpack_done_ext(reader); + return extsize; +} +#endif + +void mpack_expect_cstr(mpack_reader_t* reader, char* buf, size_t bufsize) { + uint32_t length = mpack_expect_str(reader); + mpack_read_cstr(reader, buf, bufsize, length); + mpack_done_str(reader); +} + +void mpack_expect_utf8_cstr(mpack_reader_t* reader, char* buf, size_t bufsize) { + uint32_t length = mpack_expect_str(reader); + mpack_read_utf8_cstr(reader, buf, bufsize, length); + mpack_done_str(reader); +} + +#ifdef MPACK_MALLOC +static char* mpack_expect_cstr_alloc_unchecked(mpack_reader_t* reader, size_t maxsize, size_t* out_length) { + mpack_assert(out_length != NULL, "out_length cannot be NULL"); + *out_length = 0; + + // make sure argument makes sense + if (maxsize < 1) { + mpack_break("maxsize is zero; you must have room for at least a null-terminator"); + mpack_reader_flag_error(reader, mpack_error_bug); + return NULL; + } + + if (maxsize > UINT32_MAX) + maxsize = UINT32_MAX; + + size_t length = mpack_expect_str_max(reader, (uint32_t)maxsize - 1); + char* str = mpack_read_bytes_alloc_impl(reader, length, true); + mpack_done_str(reader); + + if (str) + *out_length = length; + return str; +} + +char* mpack_expect_cstr_alloc(mpack_reader_t* reader, size_t maxsize) { + size_t length; + char* str = mpack_expect_cstr_alloc_unchecked(reader, maxsize, &length); + + if (str && !mpack_str_check_no_null(str, length)) { + MPACK_FREE(str); + mpack_reader_flag_error(reader, mpack_error_type); + return NULL; + } + + return str; +} + +char* mpack_expect_utf8_cstr_alloc(mpack_reader_t* reader, size_t maxsize) { + size_t length; + char* str = mpack_expect_cstr_alloc_unchecked(reader, maxsize, &length); + + if (str && !mpack_utf8_check_no_null(str, length)) { + MPACK_FREE(str); + mpack_reader_flag_error(reader, mpack_error_type); + return NULL; + } + + return str; +} +#endif + +void mpack_expect_str_match(mpack_reader_t* reader, const char* str, size_t len) { + mpack_assert(str != NULL, "str cannot be NULL"); + + // expect a str the correct length + if (len > UINT32_MAX) + mpack_reader_flag_error(reader, mpack_error_type); + mpack_expect_str_length(reader, (uint32_t)len); + if (mpack_reader_error(reader)) + return; + mpack_reader_track_bytes(reader, (uint32_t)len); + + // check each byte one by one (matched strings are likely to be very small) + for (; len > 0; --len) { + if (mpack_expect_native_u8(reader) != *str++) { + mpack_reader_flag_error(reader, mpack_error_type); + return; + } + } + + mpack_done_str(reader); +} + +void mpack_expect_tag(mpack_reader_t* reader, mpack_tag_t expected) { + mpack_tag_t actual = mpack_read_tag(reader); + if (!mpack_tag_equal(actual, expected)) + mpack_reader_flag_error(reader, mpack_error_type); +} + +#ifdef MPACK_MALLOC +char* mpack_expect_bin_alloc(mpack_reader_t* reader, size_t maxsize, size_t* size) { + mpack_assert(size != NULL, "size cannot be NULL"); + *size = 0; + + if (maxsize > UINT32_MAX) + maxsize = UINT32_MAX; + + size_t length = mpack_expect_bin_max(reader, (uint32_t)maxsize); + if (mpack_reader_error(reader)) + return NULL; + + char* data = mpack_read_bytes_alloc(reader, length); + mpack_done_bin(reader); + + if (data) + *size = length; + return data; +} +#endif + +#if MPACK_EXTENSIONS && defined(MPACK_MALLOC) +char* mpack_expect_ext_alloc(mpack_reader_t* reader, int8_t* type, size_t maxsize, size_t* size) { + mpack_assert(size != NULL, "size cannot be NULL"); + *size = 0; + + if (maxsize > UINT32_MAX) + maxsize = UINT32_MAX; + + size_t length = mpack_expect_ext_max(reader, type, (uint32_t)maxsize); + if (mpack_reader_error(reader)) + return NULL; + + char* data = mpack_read_bytes_alloc(reader, length); + mpack_done_ext(reader); + + if (data) { + *size = length; + } else { + *type = 0; + } + return data; +} +#endif + +size_t mpack_expect_enum(mpack_reader_t* reader, const char* strings[], size_t count) { + + // read the string in-place + size_t keylen = mpack_expect_str(reader); + const char* key = mpack_read_bytes_inplace(reader, keylen); + mpack_done_str(reader); + if (mpack_reader_error(reader) != mpack_ok) + return count; + + // find what key it matches + for (size_t i = 0; i < count; ++i) { + const char* other = strings[i]; + size_t otherlen = mpack_strlen(other); + if (keylen == otherlen && mpack_memcmp(key, other, keylen) == 0) + return i; + } + + // no matches + mpack_reader_flag_error(reader, mpack_error_type); + return count; +} + +size_t mpack_expect_enum_optional(mpack_reader_t* reader, const char* strings[], size_t count) { + if (mpack_reader_error(reader) != mpack_ok) + return count; + + mpack_assert(count != 0, "count cannot be zero; no strings are valid!"); + mpack_assert(strings != NULL, "strings cannot be NULL"); + + // the key is only recognized if it is a string + if (mpack_peek_tag(reader).type != mpack_type_str) { + mpack_discard(reader); + return count; + } + + // read the string in-place + size_t keylen = mpack_expect_str(reader); + const char* key = mpack_read_bytes_inplace(reader, keylen); + mpack_done_str(reader); + if (mpack_reader_error(reader) != mpack_ok) + return count; + + // find what key it matches + for (size_t i = 0; i < count; ++i) { + const char* other = strings[i]; + size_t otherlen = mpack_strlen(other); + if (keylen == otherlen && mpack_memcmp(key, other, keylen) == 0) + return i; + } + + // no matches + return count; +} + +size_t mpack_expect_key_uint(mpack_reader_t* reader, bool found[], size_t count) { + if (mpack_reader_error(reader) != mpack_ok) + return count; + + if (count == 0) { + mpack_break("count cannot be zero; no keys are valid!"); + mpack_reader_flag_error(reader, mpack_error_bug); + return count; + } + mpack_assert(found != NULL, "found cannot be NULL"); + + // the key is only recognized if it is an unsigned int + if (mpack_peek_tag(reader).type != mpack_type_uint) { + mpack_discard(reader); + return count; + } + + // read the key + uint64_t value = mpack_expect_u64(reader); + if (mpack_reader_error(reader) != mpack_ok) + return count; + + // unrecognized keys are fine, we just return count + if (value >= count) + return count; + + // check if this key is a duplicate + if (found[value]) { + mpack_reader_flag_error(reader, mpack_error_invalid); + return count; + } + + found[value] = true; + return (size_t)value; +} + +size_t mpack_expect_key_cstr(mpack_reader_t* reader, const char* keys[], bool found[], size_t count) { + size_t i = mpack_expect_enum_optional(reader, keys, count); + + // unrecognized keys are fine, we just return count + if (i == count) + return count; + + // check if this key is a duplicate + mpack_assert(found != NULL, "found cannot be NULL"); + if (found[i]) { + mpack_reader_flag_error(reader, mpack_error_invalid); + return count; + } + + found[i] = true; + return i; +} + +#endif + + +/* mpack/mpack-node.c.c */ + +#define MPACK_INTERNAL 1 + +/* #include "mpack-node.h" */ + +#if MPACK_NODE + +MPACK_STATIC_INLINE const char* mpack_node_data_unchecked(mpack_node_t node) { + mpack_assert(mpack_node_error(node) == mpack_ok, "tree is in an error state!"); + + mpack_type_t type = node.data->type; + MPACK_UNUSED(type); + #if MPACK_EXTENSIONS + mpack_assert(type == mpack_type_str || type == mpack_type_bin || type == mpack_type_ext, + "node of type %i (%s) is not a data type!", type, mpack_type_to_string(type)); + #else + mpack_assert(type == mpack_type_str || type == mpack_type_bin, + "node of type %i (%s) is not a data type!", type, mpack_type_to_string(type)); + #endif + + return node.tree->data + node.data->value.offset; +} + +#if MPACK_EXTENSIONS +MPACK_STATIC_INLINE int8_t mpack_node_exttype_unchecked(mpack_node_t node) { + mpack_assert(mpack_node_error(node) == mpack_ok, "tree is in an error state!"); + + mpack_type_t type = node.data->type; + MPACK_UNUSED(type); + mpack_assert(type == mpack_type_ext, "node of type %i (%s) is not an ext type!", + type, mpack_type_to_string(type)); + + // the exttype of an ext node is stored in the byte preceding the data + return mpack_load_i8(mpack_node_data_unchecked(node) - 1); +} +#endif + + + +/* + * Tree Parsing + */ + +#ifdef MPACK_MALLOC + +// fix up the alloc size to make sure it exactly fits the +// maximum number of nodes it can contain (the allocator will +// waste it back anyway, but we round it down just in case) + +#define MPACK_NODES_PER_PAGE \ + ((MPACK_NODE_PAGE_SIZE - sizeof(mpack_tree_page_t)) / sizeof(mpack_node_data_t) + 1) + +#define MPACK_PAGE_ALLOC_SIZE \ + (sizeof(mpack_tree_page_t) + sizeof(mpack_node_data_t) * (MPACK_NODES_PER_PAGE - 1)) + +#endif + +#ifdef MPACK_MALLOC +/* + * Fills the tree until we have at least enough bytes for the current node. + */ +static bool mpack_tree_reserve_fill(mpack_tree_t* tree) { + mpack_assert(tree->parser.state == mpack_tree_parse_state_in_progress); + + size_t bytes = tree->parser.current_node_reserved; + mpack_assert(bytes > tree->parser.possible_nodes_left, + "there are already enough bytes! call mpack_tree_ensure() instead."); + mpack_log("filling to reserve %i bytes\n", (int)bytes); + + // if the necessary bytes would put us over the maximum tree + // size, fail right away. + // TODO: check for overflow? + if (tree->data_length + bytes > tree->max_size) { + mpack_tree_flag_error(tree, mpack_error_too_big); + return false; + } + + // we'll need a read function to fetch more data. if there's + // no read function, the data should contain an entire message + // (or messages), so we flag it as invalid. + if (tree->read_fn == NULL) { + mpack_log("tree has no read function!\n"); + mpack_tree_flag_error(tree, mpack_error_invalid); + return false; + } + + // expand the buffer if needed + if (tree->data_length + bytes > tree->buffer_capacity) { + + // TODO: check for overflow? + size_t new_capacity = (tree->buffer_capacity == 0) ? MPACK_BUFFER_SIZE : tree->buffer_capacity; + while (new_capacity < tree->data_length + bytes) + new_capacity *= 2; + if (new_capacity > tree->max_size) + new_capacity = tree->max_size; + + mpack_log("expanding buffer from %i to %i\n", (int)tree->buffer_capacity, (int)new_capacity); + + char* new_buffer; + if (tree->buffer == NULL) + new_buffer = (char*)MPACK_MALLOC(new_capacity); + else + new_buffer = (char*)mpack_realloc(tree->buffer, tree->data_length, new_capacity); + + if (new_buffer == NULL) { + mpack_tree_flag_error(tree, mpack_error_memory); + return false; + } + + tree->data = new_buffer; + tree->buffer = new_buffer; + tree->buffer_capacity = new_capacity; + } + + // request as much data as possible, looping until we have + // all the data we need + do { + size_t read = tree->read_fn(tree, tree->buffer + tree->data_length, tree->buffer_capacity - tree->data_length); + + // If the fill function encounters an error, it should flag an error on + // the tree. + if (mpack_tree_error(tree) != mpack_ok) + return false; + + // We guard against fill functions that return -1 just in case. + if (read == (size_t)(-1)) { + mpack_tree_flag_error(tree, mpack_error_io); + return false; + } + + // If the fill function returns 0, the data is not available yet. We + // return false to stop parsing the current node. + if (read == 0) { + mpack_log("not enough data.\n"); + return false; + } + + mpack_log("read %u more bytes\n", (uint32_t)read); + tree->data_length += read; + tree->parser.possible_nodes_left += read; + } while (tree->parser.possible_nodes_left < bytes); + + return true; +} +#endif + +/* + * Ensures there are enough additional bytes in the tree for the current node + * (including reserved bytes for the children of this node, and in addition to + * the reserved bytes for children of previous compound nodes), reading more + * data if needed. + * + * extra_bytes is the number of additional bytes to reserve for the current + * node beyond the type byte (since one byte is already reserved for each node + * by its parent array or map.) + * + * This may reallocate the tree, which means the tree->data pointer may change! + * + * Returns false if not enough bytes could be read. + */ +MPACK_STATIC_INLINE bool mpack_tree_reserve_bytes(mpack_tree_t* tree, size_t extra_bytes) { + mpack_assert(tree->parser.state == mpack_tree_parse_state_in_progress); + + // We guard against overflow here. A compound type could declare more than + // UINT32_MAX contents which overflows SIZE_MAX on 32-bit platforms. We + // flag mpack_error_invalid instead of mpack_error_too_big since it's far + // more likely that the message is corrupt than that the data is valid but + // not parseable on this architecture (see test_read_node_possible() in + // test-node.c .) + if ((uint64_t)tree->parser.current_node_reserved + (uint64_t)extra_bytes > SIZE_MAX) { + mpack_tree_flag_error(tree, mpack_error_invalid); + return false; + } + + tree->parser.current_node_reserved += extra_bytes; + + // Note that possible_nodes_left already accounts for reserved bytes for + // children of previous compound nodes. So even if there are hundreds of + // bytes left in the buffer, we might need to read anyway. + if (tree->parser.current_node_reserved <= tree->parser.possible_nodes_left) + return true; + + #ifdef MPACK_MALLOC + return mpack_tree_reserve_fill(tree); + #else + return false; + #endif +} + +MPACK_STATIC_INLINE size_t mpack_tree_parser_stack_capacity(mpack_tree_t* tree) { + #ifdef MPACK_MALLOC + return tree->parser.stack_capacity; + #else + return sizeof(tree->parser.stack) / sizeof(tree->parser.stack[0]); + #endif +} + +static bool mpack_tree_push_stack(mpack_tree_t* tree, mpack_node_data_t* first_child, size_t total) { + mpack_tree_parser_t* parser = &tree->parser; + mpack_assert(parser->state == mpack_tree_parse_state_in_progress); + + // No need to push empty containers + if (total == 0) + return true; + + // Make sure we have enough room in the stack + if (parser->level + 1 == mpack_tree_parser_stack_capacity(tree)) { + #ifdef MPACK_MALLOC + size_t new_capacity = parser->stack_capacity * 2; + mpack_log("growing parse stack to capacity %i\n", (int)new_capacity); + + // Replace the stack-allocated parsing stack + if (!parser->stack_owned) { + mpack_level_t* new_stack = (mpack_level_t*)MPACK_MALLOC(sizeof(mpack_level_t) * new_capacity); + if (!new_stack) { + mpack_tree_flag_error(tree, mpack_error_memory); + return false; + } + mpack_memcpy(new_stack, parser->stack, sizeof(mpack_level_t) * parser->stack_capacity); + parser->stack = new_stack; + parser->stack_owned = true; + + // Realloc the allocated parsing stack + } else { + mpack_level_t* new_stack = (mpack_level_t*)mpack_realloc(parser->stack, + sizeof(mpack_level_t) * parser->stack_capacity, sizeof(mpack_level_t) * new_capacity); + if (!new_stack) { + mpack_tree_flag_error(tree, mpack_error_memory); + return false; + } + parser->stack = new_stack; + } + parser->stack_capacity = new_capacity; + #else + mpack_tree_flag_error(tree, mpack_error_too_big); + return false; + #endif + } + + // Push the contents of this node onto the parsing stack + ++parser->level; + parser->stack[parser->level].child = first_child; + parser->stack[parser->level].left = total; + return true; +} + +static bool mpack_tree_parse_children(mpack_tree_t* tree, mpack_node_data_t* node) { + mpack_tree_parser_t* parser = &tree->parser; + mpack_assert(parser->state == mpack_tree_parse_state_in_progress); + + mpack_type_t type = node->type; + size_t total = node->len; + + // Calculate total elements to read + if (type == mpack_type_map) { + if ((uint64_t)total * 2 > SIZE_MAX) { + mpack_tree_flag_error(tree, mpack_error_too_big); + return false; + } + total *= 2; + } + + // Make sure we are under our total node limit (TODO can this overflow?) + tree->node_count += total; + if (tree->node_count > tree->max_nodes) { + mpack_tree_flag_error(tree, mpack_error_too_big); + return false; + } + + // Each node is at least one byte. Count these bytes now to make + // sure there is enough data left. + if (!mpack_tree_reserve_bytes(tree, total)) + return false; + + // If there are enough nodes left in the current page, no need to grow + if (total <= parser->nodes_left) { + node->value.children = parser->nodes; + parser->nodes += total; + parser->nodes_left -= total; + + } else { + + #ifdef MPACK_MALLOC + + // We can't grow if we're using a fixed pool (i.e. we didn't start with a page) + if (!tree->next) { + mpack_tree_flag_error(tree, mpack_error_too_big); + return false; + } + + // Otherwise we need to grow, and the node's children need to be contiguous. + // This is a heuristic to decide whether we should waste the remaining space + // in the current page and start a new one, or give the children their + // own page. With a fraction of 1/8, this causes at most 12% additional + // waste. Note that reducing this too much causes less cache coherence and + // more malloc() overhead due to smaller allocations, so there's a tradeoff + // here. This heuristic could use some improvement, especially with custom + // page sizes. + + mpack_tree_page_t* page; + + if (total > MPACK_NODES_PER_PAGE || parser->nodes_left > MPACK_NODES_PER_PAGE / 8) { + // TODO: this should check for overflow + page = (mpack_tree_page_t*)MPACK_MALLOC( + sizeof(mpack_tree_page_t) + sizeof(mpack_node_data_t) * (total - 1)); + if (page == NULL) { + mpack_tree_flag_error(tree, mpack_error_memory); + return false; + } + mpack_log("allocated seperate page %p for %i children, %i left in page of %i total\n", + (void*)page, (int)total, (int)parser->nodes_left, (int)MPACK_NODES_PER_PAGE); + + node->value.children = page->nodes; + + } else { + page = (mpack_tree_page_t*)MPACK_MALLOC(MPACK_PAGE_ALLOC_SIZE); + if (page == NULL) { + mpack_tree_flag_error(tree, mpack_error_memory); + return false; + } + mpack_log("allocated new page %p for %i children, wasting %i in page of %i total\n", + (void*)page, (int)total, (int)parser->nodes_left, (int)MPACK_NODES_PER_PAGE); + + node->value.children = page->nodes; + parser->nodes = page->nodes + total; + parser->nodes_left = MPACK_NODES_PER_PAGE - total; + } + + page->next = tree->next; + tree->next = page; + + #else + // We can't grow if we don't have an allocator + mpack_tree_flag_error(tree, mpack_error_too_big); + return false; + #endif + } + + return mpack_tree_push_stack(tree, node->value.children, total); +} + +static bool mpack_tree_parse_bytes(mpack_tree_t* tree, mpack_node_data_t* node) { + node->value.offset = tree->size + tree->parser.current_node_reserved + 1; + return mpack_tree_reserve_bytes(tree, node->len); +} + +#if MPACK_EXTENSIONS +static bool mpack_tree_parse_ext(mpack_tree_t* tree, mpack_node_data_t* node) { + // reserve space for exttype + tree->parser.current_node_reserved += sizeof(int8_t); + node->type = mpack_type_ext; + return mpack_tree_parse_bytes(tree, node); +} +#endif + +static bool mpack_tree_parse_node_contents(mpack_tree_t* tree, mpack_node_data_t* node) { + mpack_assert(tree->parser.state == mpack_tree_parse_state_in_progress); + mpack_assert(node != NULL, "null node?"); + + // read the type. we've already accounted for this byte in + // possible_nodes_left, so we already know it is in bounds, and we don't + // need to reserve it for this node. + mpack_assert(tree->data_length > tree->size); + uint8_t type = mpack_load_u8(tree->data + tree->size); + mpack_log("node type %x\n", type); + tree->parser.current_node_reserved = 0; + + // as with mpack_read_tag(), the fastest way to parse a node is to switch + // on the first byte, and to explicitly list every possible byte. we switch + // on the first four bits in size-optimized builds. + + #if MPACK_OPTIMIZE_FOR_SIZE + switch (type >> 4) { + + // positive fixnum + case 0x0: case 0x1: case 0x2: case 0x3: + case 0x4: case 0x5: case 0x6: case 0x7: + node->type = mpack_type_uint; + node->value.u = type; + return true; + + // negative fixnum + case 0xe: case 0xf: + node->type = mpack_type_int; + node->value.i = (int8_t)type; + return true; + + // fixmap + case 0x8: + node->type = mpack_type_map; + node->len = (uint32_t)(type & ~0xf0); + return mpack_tree_parse_children(tree, node); + + // fixarray + case 0x9: + node->type = mpack_type_array; + node->len = (uint32_t)(type & ~0xf0); + return mpack_tree_parse_children(tree, node); + + // fixstr + case 0xa: case 0xb: + node->type = mpack_type_str; + node->len = (uint32_t)(type & ~0xe0); + return mpack_tree_parse_bytes(tree, node); + + // not one of the common infix types + default: + break; + } + #endif + + switch (type) { + + #if !MPACK_OPTIMIZE_FOR_SIZE + // positive fixnum + case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f: + case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: + case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: + case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: + case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: + case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: + case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f: + case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: + case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: + case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: + case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f: + case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: + node->type = mpack_type_uint; + node->value.u = type; + return true; + + // negative fixnum + case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7: + case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: + case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: + case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff: + node->type = mpack_type_int; + node->value.i = (int8_t)type; + return true; + + // fixmap + case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87: + case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f: + node->type = mpack_type_map; + node->len = (uint32_t)(type & ~0xf0); + return mpack_tree_parse_children(tree, node); + + // fixarray + case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97: + case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f: + node->type = mpack_type_array; + node->len = (uint32_t)(type & ~0xf0); + return mpack_tree_parse_children(tree, node); + + // fixstr + case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7: + case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf: + case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf: + node->type = mpack_type_str; + node->len = (uint32_t)(type & ~0xe0); + return mpack_tree_parse_bytes(tree, node); + #endif + + // nil + case 0xc0: + node->type = mpack_type_nil; + return true; + + // bool + case 0xc2: case 0xc3: + node->type = mpack_type_bool; + node->value.b = type & 1; + return true; + + // bin8 + case 0xc4: + node->type = mpack_type_bin; + if (!mpack_tree_reserve_bytes(tree, sizeof(uint8_t))) + return false; + node->len = mpack_load_u8(tree->data + tree->size + 1); + return mpack_tree_parse_bytes(tree, node); + + // bin16 + case 0xc5: + node->type = mpack_type_bin; + if (!mpack_tree_reserve_bytes(tree, sizeof(uint16_t))) + return false; + node->len = mpack_load_u16(tree->data + tree->size + 1); + return mpack_tree_parse_bytes(tree, node); + + // bin32 + case 0xc6: + node->type = mpack_type_bin; + if (!mpack_tree_reserve_bytes(tree, sizeof(uint32_t))) + return false; + node->len = mpack_load_u32(tree->data + tree->size + 1); + return mpack_tree_parse_bytes(tree, node); + + #if MPACK_EXTENSIONS + // ext8 + case 0xc7: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint8_t))) + return false; + node->len = mpack_load_u8(tree->data + tree->size + 1); + return mpack_tree_parse_ext(tree, node); + + // ext16 + case 0xc8: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint16_t))) + return false; + node->len = mpack_load_u16(tree->data + tree->size + 1); + return mpack_tree_parse_ext(tree, node); + + // ext32 + case 0xc9: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint32_t))) + return false; + node->len = mpack_load_u32(tree->data + tree->size + 1); + return mpack_tree_parse_ext(tree, node); + #endif + + // float + case 0xca: + if (!mpack_tree_reserve_bytes(tree, sizeof(float))) + return false; + node->value.f = mpack_load_float(tree->data + tree->size + 1); + node->type = mpack_type_float; + return true; + + // double + case 0xcb: + if (!mpack_tree_reserve_bytes(tree, sizeof(double))) + return false; + node->value.d = mpack_load_double(tree->data + tree->size + 1); + node->type = mpack_type_double; + return true; + + // uint8 + case 0xcc: + node->type = mpack_type_uint; + if (!mpack_tree_reserve_bytes(tree, sizeof(uint8_t))) + return false; + node->value.u = mpack_load_u8(tree->data + tree->size + 1); + return true; + + // uint16 + case 0xcd: + node->type = mpack_type_uint; + if (!mpack_tree_reserve_bytes(tree, sizeof(uint16_t))) + return false; + node->value.u = mpack_load_u16(tree->data + tree->size + 1); + return true; + + // uint32 + case 0xce: + node->type = mpack_type_uint; + if (!mpack_tree_reserve_bytes(tree, sizeof(uint32_t))) + return false; + node->value.u = mpack_load_u32(tree->data + tree->size + 1); + return true; + + // uint64 + case 0xcf: + node->type = mpack_type_uint; + if (!mpack_tree_reserve_bytes(tree, sizeof(uint64_t))) + return false; + node->value.u = mpack_load_u64(tree->data + tree->size + 1); + return true; + + // int8 + case 0xd0: + node->type = mpack_type_int; + if (!mpack_tree_reserve_bytes(tree, sizeof(int8_t))) + return false; + node->value.i = mpack_load_i8(tree->data + tree->size + 1); + return true; + + // int16 + case 0xd1: + node->type = mpack_type_int; + if (!mpack_tree_reserve_bytes(tree, sizeof(int16_t))) + return false; + node->value.i = mpack_load_i16(tree->data + tree->size + 1); + return true; + + // int32 + case 0xd2: + node->type = mpack_type_int; + if (!mpack_tree_reserve_bytes(tree, sizeof(int32_t))) + return false; + node->value.i = mpack_load_i32(tree->data + tree->size + 1); + return true; + + // int64 + case 0xd3: + node->type = mpack_type_int; + if (!mpack_tree_reserve_bytes(tree, sizeof(int64_t))) + return false; + node->value.i = mpack_load_i64(tree->data + tree->size + 1); + return true; + + #if MPACK_EXTENSIONS + // fixext1 + case 0xd4: + node->len = 1; + return mpack_tree_parse_ext(tree, node); + + // fixext2 + case 0xd5: + node->len = 2; + return mpack_tree_parse_ext(tree, node); + + // fixext4 + case 0xd6: + node->len = 4; + return mpack_tree_parse_ext(tree, node); + + // fixext8 + case 0xd7: + node->len = 8; + return mpack_tree_parse_ext(tree, node); + + // fixext16 + case 0xd8: + node->len = 16; + return mpack_tree_parse_ext(tree, node); + #endif + + // str8 + case 0xd9: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint8_t))) + return false; + node->len = mpack_load_u8(tree->data + tree->size + 1); + node->type = mpack_type_str; + return mpack_tree_parse_bytes(tree, node); + + // str16 + case 0xda: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint16_t))) + return false; + node->len = mpack_load_u16(tree->data + tree->size + 1); + node->type = mpack_type_str; + return mpack_tree_parse_bytes(tree, node); + + // str32 + case 0xdb: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint32_t))) + return false; + node->len = mpack_load_u32(tree->data + tree->size + 1); + node->type = mpack_type_str; + return mpack_tree_parse_bytes(tree, node); + + // array16 + case 0xdc: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint16_t))) + return false; + node->len = mpack_load_u16(tree->data + tree->size + 1); + node->type = mpack_type_array; + return mpack_tree_parse_children(tree, node); + + // array32 + case 0xdd: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint32_t))) + return false; + node->len = mpack_load_u32(tree->data + tree->size + 1); + node->type = mpack_type_array; + return mpack_tree_parse_children(tree, node); + + // map16 + case 0xde: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint16_t))) + return false; + node->len = mpack_load_u16(tree->data + tree->size + 1); + node->type = mpack_type_map; + return mpack_tree_parse_children(tree, node); + + // map32 + case 0xdf: + if (!mpack_tree_reserve_bytes(tree, sizeof(uint32_t))) + return false; + node->len = mpack_load_u32(tree->data + tree->size + 1); + node->type = mpack_type_map; + return mpack_tree_parse_children(tree, node); + + // reserved + case 0xc1: + mpack_tree_flag_error(tree, mpack_error_invalid); + return false; + + #if !MPACK_EXTENSIONS + // ext + case 0xc7: // fallthrough + case 0xc8: // fallthrough + case 0xc9: // fallthrough + // fixext + case 0xd4: // fallthrough + case 0xd5: // fallthrough + case 0xd6: // fallthrough + case 0xd7: // fallthrough + case 0xd8: + mpack_tree_flag_error(tree, mpack_error_unsupported); + return false; + #endif + + #if MPACK_OPTIMIZE_FOR_SIZE + // any other bytes should have been handled by the infix switch + default: + break; + #endif + } + + mpack_assert(0, "unreachable"); + return false; +} + +static bool mpack_tree_parse_node(mpack_tree_t* tree, mpack_node_data_t* node) { + mpack_log("parsing a node at position %i in level %i\n", + (int)tree->size, (int)tree->parser.level); + + if (!mpack_tree_parse_node_contents(tree, node)) { + mpack_log("node parsing returned false\n"); + return false; + } + + tree->parser.possible_nodes_left -= tree->parser.current_node_reserved; + + // The reserve for the current node does not include the initial byte + // previously reserved as part of its parent. + size_t node_size = tree->parser.current_node_reserved + 1; + + // If the parsed type is a map or array, the reserve includes one byte for + // each child. We want to subtract these out of possible_nodes_left, but + // not out of the current size of the tree. + if (node->type == mpack_type_array) + node_size -= node->len; + else if (node->type == mpack_type_map) + node_size -= node->len * 2; + tree->size += node_size; + + mpack_log("parsed a node of type %s of %i bytes and " + "%i additional bytes reserved for children.\n", + mpack_type_to_string(node->type), (int)node_size, + (int)tree->parser.current_node_reserved + 1 - (int)node_size); + + return true; +} + +/* + * We read nodes in a loop instead of recursively for maximum performance. The + * stack holds the amount of children left to read in each level of the tree. + * Parsing can pause and resume when more data becomes available. + */ +static bool mpack_tree_continue_parsing(mpack_tree_t* tree) { + if (mpack_tree_error(tree) != mpack_ok) + return false; + + mpack_tree_parser_t* parser = &tree->parser; + mpack_assert(parser->state == mpack_tree_parse_state_in_progress); + mpack_log("parsing tree elements, %i bytes in buffer\n", (int)tree->data_length); + + // we loop parsing nodes until the parse stack is empty. we break + // by returning out of the function. + while (true) { + mpack_node_data_t* node = parser->stack[parser->level].child; + size_t level = parser->level; + if (!mpack_tree_parse_node(tree, node)) + return false; + --parser->stack[level].left; + ++parser->stack[level].child; + + mpack_assert(mpack_tree_error(tree) == mpack_ok, + "mpack_tree_parse_node() should have returned false due to error!"); + + // pop empty stack levels, exiting the outer loop when the stack is empty. + // (we could tail-optimize containers by pre-emptively popping empty + // stack levels before reading the new element, this way we wouldn't + // have to loop. but we eventually want to use the parse stack to give + // better error messages that contain the location of the error, so + // it needs to be complete.) + while (parser->stack[parser->level].left == 0) { + if (parser->level == 0) + return true; + --parser->level; + } + } +} + +static void mpack_tree_cleanup(mpack_tree_t* tree) { + MPACK_UNUSED(tree); + + #ifdef MPACK_MALLOC + if (tree->parser.stack_owned) { + MPACK_FREE(tree->parser.stack); + tree->parser.stack = NULL; + tree->parser.stack_owned = false; + } + + mpack_tree_page_t* page = tree->next; + while (page != NULL) { + mpack_tree_page_t* next = page->next; + mpack_log("freeing page %p\n", (void*)page); + MPACK_FREE(page); + page = next; + } + tree->next = NULL; + #endif +} + +static bool mpack_tree_parse_start(mpack_tree_t* tree) { + if (mpack_tree_error(tree) != mpack_ok) + return false; + + mpack_tree_parser_t* parser = &tree->parser; + mpack_assert(parser->state != mpack_tree_parse_state_in_progress, + "previous parsing was not finished!"); + + if (parser->state == mpack_tree_parse_state_parsed) + mpack_tree_cleanup(tree); + + mpack_log("starting parse\n"); + tree->parser.state = mpack_tree_parse_state_in_progress; + tree->parser.current_node_reserved = 0; + + // check if we previously parsed a tree + if (tree->size > 0) { + #ifdef MPACK_MALLOC + // if we're buffered, move the remaining data back to the + // start of the buffer + // TODO: This is not ideal performance-wise. We should only move data + // when we need to call the fill function. + // TODO: We could consider shrinking the buffer here, especially if we + // determine that the fill function is providing less than a quarter of + // the buffer size or if messages take up less than a quarter of the + // buffer size. Maybe this should be configurable. + if (tree->buffer != NULL) { + mpack_memmove(tree->buffer, tree->buffer + tree->size, tree->data_length - tree->size); + } + else + #endif + // otherwise advance past the parsed data + { + tree->data += tree->size; + } + tree->data_length -= tree->size; + tree->size = 0; + tree->node_count = 0; + } + + // make sure we have at least one byte available before allocating anything + parser->possible_nodes_left = tree->data_length; + if (!mpack_tree_reserve_bytes(tree, sizeof(uint8_t))) { + tree->parser.state = mpack_tree_parse_state_not_started; + return false; + } + mpack_log("parsing tree at %p starting with byte %x\n", tree->data, (uint8_t)tree->data[0]); + parser->possible_nodes_left -= 1; + tree->node_count = 1; + + #ifdef MPACK_MALLOC + parser->stack = parser->stack_local; + parser->stack_owned = false; + parser->stack_capacity = sizeof(parser->stack_local) / sizeof(*parser->stack_local); + + if (tree->pool == NULL) { + + // allocate first page + mpack_tree_page_t* page = (mpack_tree_page_t*)MPACK_MALLOC(MPACK_PAGE_ALLOC_SIZE); + mpack_log("allocated initial page %p of size %i count %i\n", + (void*)page, (int)MPACK_PAGE_ALLOC_SIZE, (int)MPACK_NODES_PER_PAGE); + if (page == NULL) { + tree->error = mpack_error_memory; + return false; + } + page->next = NULL; + tree->next = page; + + parser->nodes = page->nodes; + parser->nodes_left = MPACK_NODES_PER_PAGE; + } + else + #endif + { + // otherwise use the provided pool + mpack_assert(tree->pool != NULL, "no pool provided?"); + parser->nodes = tree->pool; + parser->nodes_left = tree->pool_count; + } + + tree->root = parser->nodes; + ++parser->nodes; + --parser->nodes_left; + + parser->level = 0; + parser->stack[0].child = tree->root; + parser->stack[0].left = 1; + + return true; +} + +void mpack_tree_parse(mpack_tree_t* tree) { + if (mpack_tree_error(tree) != mpack_ok) + return; + + if (tree->parser.state != mpack_tree_parse_state_in_progress) { + if (!mpack_tree_parse_start(tree)) { + mpack_tree_flag_error(tree, (tree->read_fn == NULL) ? + mpack_error_invalid : mpack_error_io); + return; + } + } + + if (!mpack_tree_continue_parsing(tree)) { + if (mpack_tree_error(tree) != mpack_ok) + return; + + // We're parsing synchronously on a blocking fill function. If we + // didn't completely finish parsing the tree, it's an error. + mpack_log("tree parsing incomplete. flagging error.\n"); + mpack_tree_flag_error(tree, (tree->read_fn == NULL) ? + mpack_error_invalid : mpack_error_io); + return; + } + + mpack_assert(mpack_tree_error(tree) == mpack_ok); + mpack_assert(tree->parser.level == 0); + tree->parser.state = mpack_tree_parse_state_parsed; + mpack_log("parsed tree of %i bytes, %i bytes left\n", (int)tree->size, (int)tree->parser.possible_nodes_left); + mpack_log("%i nodes in final page\n", (int)tree->parser.nodes_left); +} + +bool mpack_tree_try_parse(mpack_tree_t* tree) { + if (mpack_tree_error(tree) != mpack_ok) + return false; + + if (tree->parser.state != mpack_tree_parse_state_in_progress) + if (!mpack_tree_parse_start(tree)) + return false; + + if (!mpack_tree_continue_parsing(tree)) + return false; + + mpack_assert(mpack_tree_error(tree) == mpack_ok); + mpack_assert(tree->parser.level == 0); + tree->parser.state = mpack_tree_parse_state_parsed; + return true; +} + + + +/* + * Tree functions + */ + +mpack_node_t mpack_tree_root(mpack_tree_t* tree) { + if (mpack_tree_error(tree) != mpack_ok) + return mpack_tree_nil_node(tree); + + // We check that a tree was parsed successfully and assert if not. You must + // call mpack_tree_parse() (or mpack_tree_try_parse() with a success + // result) in order to access the root node. + if (tree->parser.state != mpack_tree_parse_state_parsed) { + mpack_break("Tree has not been parsed! " + "Did you call mpack_tree_parse() or mpack_tree_try_parse()?"); + mpack_tree_flag_error(tree, mpack_error_bug); + return mpack_tree_nil_node(tree); + } + + return mpack_node(tree, tree->root); +} + +static void mpack_tree_init_clear(mpack_tree_t* tree) { + mpack_memset(tree, 0, sizeof(*tree)); + tree->nil_node.type = mpack_type_nil; + tree->missing_node.type = mpack_type_missing; + tree->max_size = SIZE_MAX; + tree->max_nodes = SIZE_MAX; +} + +#ifdef MPACK_MALLOC +void mpack_tree_init_data(mpack_tree_t* tree, const char* data, size_t length) { + mpack_tree_init_clear(tree); + + MPACK_STATIC_ASSERT(MPACK_NODE_PAGE_SIZE >= sizeof(mpack_tree_page_t), + "MPACK_NODE_PAGE_SIZE is too small"); + + MPACK_STATIC_ASSERT(MPACK_PAGE_ALLOC_SIZE <= MPACK_NODE_PAGE_SIZE, + "incorrect page rounding?"); + + tree->data = data; + tree->data_length = length; + tree->pool = NULL; + tree->pool_count = 0; + tree->next = NULL; + + mpack_log("===========================\n"); + mpack_log("initializing tree with data of size %i\n", (int)length); +} +#endif + +void mpack_tree_init_pool(mpack_tree_t* tree, const char* data, size_t length, + mpack_node_data_t* node_pool, size_t node_pool_count) +{ + mpack_tree_init_clear(tree); + #ifdef MPACK_MALLOC + tree->next = NULL; + #endif + + if (node_pool_count == 0) { + mpack_break("initial page has no nodes!"); + mpack_tree_flag_error(tree, mpack_error_bug); + return; + } + + tree->data = data; + tree->data_length = length; + tree->pool = node_pool; + tree->pool_count = node_pool_count; + + mpack_log("===========================\n"); + mpack_log("initializing tree with data of size %i and pool of count %i\n", + (int)length, (int)node_pool_count); +} + +void mpack_tree_init_error(mpack_tree_t* tree, mpack_error_t error) { + mpack_tree_init_clear(tree); + tree->error = error; + + mpack_log("===========================\n"); + mpack_log("initializing tree error state %i\n", (int)error); +} + +#ifdef MPACK_MALLOC +void mpack_tree_init_stream(mpack_tree_t* tree, mpack_tree_read_t read_fn, void* context, + size_t max_message_size, size_t max_message_nodes) { + mpack_tree_init_clear(tree); + + tree->read_fn = read_fn; + tree->context = context; + + mpack_tree_set_limits(tree, max_message_size, max_message_nodes); + tree->max_size = max_message_size; + tree->max_nodes = max_message_nodes; + + mpack_log("===========================\n"); + mpack_log("initializing tree with stream, max size %i max nodes %i\n", + (int)max_message_size, (int)max_message_nodes); +} +#endif + +void mpack_tree_set_limits(mpack_tree_t* tree, size_t max_message_size, size_t max_message_nodes) { + mpack_assert(max_message_size > 0); + mpack_assert(max_message_nodes > 0); + tree->max_size = max_message_size; + tree->max_nodes = max_message_nodes; +} + +#if MPACK_STDIO +typedef struct mpack_file_tree_t { + char* data; + size_t size; + char buffer[MPACK_BUFFER_SIZE]; +} mpack_file_tree_t; + +static void mpack_file_tree_teardown(mpack_tree_t* tree) { + mpack_file_tree_t* file_tree = (mpack_file_tree_t*)tree->context; + MPACK_FREE(file_tree->data); + MPACK_FREE(file_tree); +} + +static bool mpack_file_tree_read(mpack_tree_t* tree, mpack_file_tree_t* file_tree, FILE* file, size_t max_bytes) { + + // get the file size + errno = 0; + int error = 0; + fseek(file, 0, SEEK_END); + error |= errno; + long size = ftell(file); + error |= errno; + fseek(file, 0, SEEK_SET); + error |= errno; + + // check for errors + if (error != 0 || size < 0) { + mpack_tree_init_error(tree, mpack_error_io); + return false; + } + if (size == 0) { + mpack_tree_init_error(tree, mpack_error_invalid); + return false; + } + + // make sure the size is less than max_bytes + // (this mess exists to safely convert between long and size_t regardless of their widths) + if (max_bytes != 0 && (((uint64_t)LONG_MAX > (uint64_t)SIZE_MAX && size > (long)SIZE_MAX) || (size_t)size > max_bytes)) { + mpack_tree_init_error(tree, mpack_error_too_big); + return false; + } + + // allocate data + file_tree->data = (char*)MPACK_MALLOC((size_t)size); + if (file_tree->data == NULL) { + mpack_tree_init_error(tree, mpack_error_memory); + return false; + } + + // read the file + long total = 0; + while (total < size) { + size_t read = fread(file_tree->data + total, 1, (size_t)(size - total), file); + if (read <= 0) { + mpack_tree_init_error(tree, mpack_error_io); + MPACK_FREE(file_tree->data); + return false; + } + total += (long)read; + } + + file_tree->size = (size_t)size; + return true; +} + +static bool mpack_tree_file_check_max_bytes(mpack_tree_t* tree, size_t max_bytes) { + + // the C STDIO family of file functions use long (e.g. ftell) + if (max_bytes > LONG_MAX) { + mpack_break("max_bytes of %" PRIu64 " is invalid, maximum is LONG_MAX", (uint64_t)max_bytes); + mpack_tree_init_error(tree, mpack_error_bug); + return false; + } + + return true; +} + +static void mpack_tree_init_stdfile_noclose(mpack_tree_t* tree, FILE* stdfile, size_t max_bytes) { + + // allocate file tree + mpack_file_tree_t* file_tree = (mpack_file_tree_t*) MPACK_MALLOC(sizeof(mpack_file_tree_t)); + if (file_tree == NULL) { + mpack_tree_init_error(tree, mpack_error_memory); + return; + } + + // read all data + if (!mpack_file_tree_read(tree, file_tree, stdfile, max_bytes)) { + MPACK_FREE(file_tree); + return; + } + + mpack_tree_init_data(tree, file_tree->data, file_tree->size); + mpack_tree_set_context(tree, file_tree); + mpack_tree_set_teardown(tree, mpack_file_tree_teardown); +} + +void mpack_tree_init_stdfile(mpack_tree_t* tree, FILE* stdfile, size_t max_bytes, bool close_when_done) { + if (!mpack_tree_file_check_max_bytes(tree, max_bytes)) + return; + + mpack_tree_init_stdfile_noclose(tree, stdfile, max_bytes); + + if (close_when_done) + fclose(stdfile); +} + +void mpack_tree_init_filename(mpack_tree_t* tree, const char* filename, size_t max_bytes) { + if (!mpack_tree_file_check_max_bytes(tree, max_bytes)) + return; + + // open the file + FILE* file = fopen(filename, "rb"); + if (!file) { + mpack_tree_init_error(tree, mpack_error_io); + return; + } + + mpack_tree_init_stdfile(tree, file, max_bytes, true); +} +#endif + +mpack_error_t mpack_tree_destroy(mpack_tree_t* tree) { + mpack_tree_cleanup(tree); + + #ifdef MPACK_MALLOC + if (tree->buffer) + MPACK_FREE(tree->buffer); + #endif + + if (tree->teardown) + tree->teardown(tree); + tree->teardown = NULL; + + return tree->error; +} + +void mpack_tree_flag_error(mpack_tree_t* tree, mpack_error_t error) { + if (tree->error == mpack_ok) { + mpack_log("tree %p setting error %i: %s\n", (void*)tree, (int)error, mpack_error_to_string(error)); + tree->error = error; + if (tree->error_fn) + tree->error_fn(tree, error); + } + +} + + + +/* + * Node misc functions + */ + +void mpack_node_flag_error(mpack_node_t node, mpack_error_t error) { + mpack_tree_flag_error(node.tree, error); +} + +mpack_tag_t mpack_node_tag(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return mpack_tag_nil(); + + mpack_tag_t tag = MPACK_TAG_ZERO; + + tag.type = node.data->type; + switch (node.data->type) { + case mpack_type_missing: + // If a node is missing, I don't know if it makes sense to ask for + // a tag for it. We'll return a missing tag to match the missing + // node I guess, but attempting to use the tag for anything (like + // writing it for example) will flag mpack_error_bug. + break; + case mpack_type_nil: break; + case mpack_type_bool: tag.v.b = node.data->value.b; break; + case mpack_type_float: tag.v.f = node.data->value.f; break; + case mpack_type_double: tag.v.d = node.data->value.d; break; + case mpack_type_int: tag.v.i = node.data->value.i; break; + case mpack_type_uint: tag.v.u = node.data->value.u; break; + + case mpack_type_str: tag.v.l = node.data->len; break; + case mpack_type_bin: tag.v.l = node.data->len; break; + + #if MPACK_EXTENSIONS + case mpack_type_ext: + tag.v.l = node.data->len; + tag.exttype = mpack_node_exttype_unchecked(node); + break; + #endif + + case mpack_type_array: tag.v.n = node.data->len; break; + case mpack_type_map: tag.v.n = node.data->len; break; + + default: + mpack_assert(0, "unrecognized type %i", (int)node.data->type); + break; + } + return tag; +} + +#if MPACK_DEBUG && MPACK_STDIO +static void mpack_node_print_element(mpack_node_t node, mpack_print_t* print, size_t depth) { + mpack_node_data_t* data = node.data; + switch (data->type) { + case mpack_type_str: + { + mpack_print_append_cstr(print, "\""); + const char* bytes = mpack_node_data_unchecked(node); + for (size_t i = 0; i < data->len; ++i) { + char c = bytes[i]; + switch (c) { + case '\n': mpack_print_append_cstr(print, "\\n"); break; + case '\\': mpack_print_append_cstr(print, "\\\\"); break; + case '"': mpack_print_append_cstr(print, "\\\""); break; + default: mpack_print_append(print, &c, 1); break; + } + } + mpack_print_append_cstr(print, "\""); + } + break; + + case mpack_type_array: + mpack_print_append_cstr(print, "[\n"); + for (size_t i = 0; i < data->len; ++i) { + for (size_t j = 0; j < depth + 1; ++j) + mpack_print_append_cstr(print, " "); + mpack_node_print_element(mpack_node_array_at(node, i), print, depth + 1); + if (i != data->len - 1) + mpack_print_append_cstr(print, ","); + mpack_print_append_cstr(print, "\n"); + } + for (size_t i = 0; i < depth; ++i) + mpack_print_append_cstr(print, " "); + mpack_print_append_cstr(print, "]"); + break; + + case mpack_type_map: + mpack_print_append_cstr(print, "{\n"); + for (size_t i = 0; i < data->len; ++i) { + for (size_t j = 0; j < depth + 1; ++j) + mpack_print_append_cstr(print, " "); + mpack_node_print_element(mpack_node_map_key_at(node, i), print, depth + 1); + mpack_print_append_cstr(print, ": "); + mpack_node_print_element(mpack_node_map_value_at(node, i), print, depth + 1); + if (i != data->len - 1) + mpack_print_append_cstr(print, ","); + mpack_print_append_cstr(print, "\n"); + } + for (size_t i = 0; i < depth; ++i) + mpack_print_append_cstr(print, " "); + mpack_print_append_cstr(print, "}"); + break; + + default: + { + const char* prefix = NULL; + size_t prefix_length = 0; + if (mpack_node_type(node) == mpack_type_bin + #if MPACK_EXTENSIONS + || mpack_node_type(node) == mpack_type_ext + #endif + ) { + prefix = mpack_node_data(node); + prefix_length = mpack_node_data_len(node); + } + + char buf[256]; + mpack_tag_t tag = mpack_node_tag(node); + mpack_tag_debug_pseudo_json(tag, buf, sizeof(buf), prefix, prefix_length); + mpack_print_append_cstr(print, buf); + } + break; + } +} + +void mpack_node_print_to_buffer(mpack_node_t node, char* buffer, size_t buffer_size) { + if (buffer_size == 0) { + mpack_assert(false, "buffer size is zero!"); + return; + } + + mpack_print_t print; + mpack_memset(&print, 0, sizeof(print)); + print.buffer = buffer; + print.size = buffer_size; + mpack_node_print_element(node, &print, 0); + mpack_print_append(&print, "", 1); // null-terminator + mpack_print_flush(&print); + + // we always make sure there's a null-terminator at the end of the buffer + // in case we ran out of space. + print.buffer[print.size - 1] = '\0'; +} + +void mpack_node_print_to_callback(mpack_node_t node, mpack_print_callback_t callback, void* context) { + char buffer[1024]; + mpack_print_t print; + mpack_memset(&print, 0, sizeof(print)); + print.buffer = buffer; + print.size = sizeof(buffer); + print.callback = callback; + print.context = context; + mpack_node_print_element(node, &print, 0); + mpack_print_flush(&print); +} + +void mpack_node_print_to_file(mpack_node_t node, FILE* file) { + mpack_assert(file != NULL, "file is NULL"); + + char buffer[1024]; + mpack_print_t print; + mpack_memset(&print, 0, sizeof(print)); + print.buffer = buffer; + print.size = sizeof(buffer); + print.callback = &mpack_print_file_callback; + print.context = file; + + size_t depth = 2; + for (size_t i = 0; i < depth; ++i) + mpack_print_append_cstr(&print, " "); + mpack_node_print_element(node, &print, depth); + mpack_print_append_cstr(&print, "\n"); + mpack_print_flush(&print); +} +#endif + + + +/* + * Node Value Functions + */ + +#if MPACK_EXTENSIONS +mpack_timestamp_t mpack_node_timestamp(mpack_node_t node) { + mpack_timestamp_t timestamp = {0, 0}; + + // we'll let mpack_node_exttype() do most checks + if (mpack_node_exttype(node) != MPACK_EXTTYPE_TIMESTAMP) { + mpack_log("exttype %i\n", mpack_node_exttype(node)); + mpack_node_flag_error(node, mpack_error_type); + return timestamp; + } + + const char* p = mpack_node_data_unchecked(node); + + switch (node.data->len) { + case 4: + timestamp.nanoseconds = 0; + timestamp.seconds = mpack_load_u32(p); + break; + + case 8: { + uint64_t value = mpack_load_u64(p); + timestamp.nanoseconds = (uint32_t)(value >> 34); + timestamp.seconds = value & ((UINT64_C(1) << 34) - 1); + break; + } + + case 12: + timestamp.nanoseconds = mpack_load_u32(p); + timestamp.seconds = mpack_load_i64(p + 4); + break; + + default: + mpack_tree_flag_error(node.tree, mpack_error_invalid); + return timestamp; + } + + if (timestamp.nanoseconds > MPACK_TIMESTAMP_NANOSECONDS_MAX) { + mpack_tree_flag_error(node.tree, mpack_error_invalid); + mpack_timestamp_t zero = {0, 0}; + return zero; + } + + return timestamp; +} + +int64_t mpack_node_timestamp_seconds(mpack_node_t node) { + return mpack_node_timestamp(node).seconds; +} + +uint32_t mpack_node_timestamp_nanoseconds(mpack_node_t node) { + return mpack_node_timestamp(node).nanoseconds; +} +#endif + + + +/* + * Node Data Functions + */ + +void mpack_node_check_utf8(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return; + mpack_node_data_t* data = node.data; + if (data->type != mpack_type_str || !mpack_utf8_check(mpack_node_data_unchecked(node), data->len)) + mpack_node_flag_error(node, mpack_error_type); +} + +void mpack_node_check_utf8_cstr(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return; + mpack_node_data_t* data = node.data; + if (data->type != mpack_type_str || !mpack_utf8_check_no_null(mpack_node_data_unchecked(node), data->len)) + mpack_node_flag_error(node, mpack_error_type); +} + +size_t mpack_node_copy_data(mpack_node_t node, char* buffer, size_t bufsize) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + mpack_assert(bufsize == 0 || buffer != NULL, "buffer is NULL for maximum of %i bytes", (int)bufsize); + + mpack_type_t type = node.data->type; + if (type != mpack_type_str && type != mpack_type_bin + #if MPACK_EXTENSIONS + && type != mpack_type_ext + #endif + ) { + mpack_node_flag_error(node, mpack_error_type); + return 0; + } + + if (node.data->len > bufsize) { + mpack_node_flag_error(node, mpack_error_too_big); + return 0; + } + + mpack_memcpy(buffer, mpack_node_data_unchecked(node), node.data->len); + return (size_t)node.data->len; +} + +size_t mpack_node_copy_utf8(mpack_node_t node, char* buffer, size_t bufsize) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + mpack_assert(bufsize == 0 || buffer != NULL, "buffer is NULL for maximum of %i bytes", (int)bufsize); + + mpack_type_t type = node.data->type; + if (type != mpack_type_str) { + mpack_node_flag_error(node, mpack_error_type); + return 0; + } + + if (node.data->len > bufsize) { + mpack_node_flag_error(node, mpack_error_too_big); + return 0; + } + + if (!mpack_utf8_check(mpack_node_data_unchecked(node), node.data->len)) { + mpack_node_flag_error(node, mpack_error_type); + return 0; + } + + mpack_memcpy(buffer, mpack_node_data_unchecked(node), node.data->len); + return (size_t)node.data->len; +} + +void mpack_node_copy_cstr(mpack_node_t node, char* buffer, size_t bufsize) { + + // we can't break here because the error isn't recoverable; we + // have to add a null-terminator. + mpack_assert(buffer != NULL, "buffer is NULL"); + mpack_assert(bufsize >= 1, "buffer size is zero; you must have room for at least a null-terminator"); + + if (mpack_node_error(node) != mpack_ok) { + buffer[0] = '\0'; + return; + } + + if (node.data->type != mpack_type_str) { + buffer[0] = '\0'; + mpack_node_flag_error(node, mpack_error_type); + return; + } + + if (node.data->len > bufsize - 1) { + buffer[0] = '\0'; + mpack_node_flag_error(node, mpack_error_too_big); + return; + } + + if (!mpack_str_check_no_null(mpack_node_data_unchecked(node), node.data->len)) { + buffer[0] = '\0'; + mpack_node_flag_error(node, mpack_error_type); + return; + } + + mpack_memcpy(buffer, mpack_node_data_unchecked(node), node.data->len); + buffer[node.data->len] = '\0'; +} + +void mpack_node_copy_utf8_cstr(mpack_node_t node, char* buffer, size_t bufsize) { + + // we can't break here because the error isn't recoverable; we + // have to add a null-terminator. + mpack_assert(buffer != NULL, "buffer is NULL"); + mpack_assert(bufsize >= 1, "buffer size is zero; you must have room for at least a null-terminator"); + + if (mpack_node_error(node) != mpack_ok) { + buffer[0] = '\0'; + return; + } + + if (node.data->type != mpack_type_str) { + buffer[0] = '\0'; + mpack_node_flag_error(node, mpack_error_type); + return; + } + + if (node.data->len > bufsize - 1) { + buffer[0] = '\0'; + mpack_node_flag_error(node, mpack_error_too_big); + return; + } + + if (!mpack_utf8_check_no_null(mpack_node_data_unchecked(node), node.data->len)) { + buffer[0] = '\0'; + mpack_node_flag_error(node, mpack_error_type); + return; + } + + mpack_memcpy(buffer, mpack_node_data_unchecked(node), node.data->len); + buffer[node.data->len] = '\0'; +} + +#ifdef MPACK_MALLOC +char* mpack_node_data_alloc(mpack_node_t node, size_t maxlen) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + // make sure this is a valid data type + mpack_type_t type = node.data->type; + if (type != mpack_type_str && type != mpack_type_bin + #if MPACK_EXTENSIONS + && type != mpack_type_ext + #endif + ) { + mpack_node_flag_error(node, mpack_error_type); + return NULL; + } + + if (node.data->len > maxlen) { + mpack_node_flag_error(node, mpack_error_too_big); + return NULL; + } + + char* ret = (char*) MPACK_MALLOC((size_t)node.data->len); + if (ret == NULL) { + mpack_node_flag_error(node, mpack_error_memory); + return NULL; + } + + mpack_memcpy(ret, mpack_node_data_unchecked(node), node.data->len); + return ret; +} + +char* mpack_node_cstr_alloc(mpack_node_t node, size_t maxlen) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + // make sure maxlen makes sense + if (maxlen < 1) { + mpack_break("maxlen is zero; you must have room for at least a null-terminator"); + mpack_node_flag_error(node, mpack_error_bug); + return NULL; + } + + if (node.data->type != mpack_type_str) { + mpack_node_flag_error(node, mpack_error_type); + return NULL; + } + + if (node.data->len > maxlen - 1) { + mpack_node_flag_error(node, mpack_error_too_big); + return NULL; + } + + if (!mpack_str_check_no_null(mpack_node_data_unchecked(node), node.data->len)) { + mpack_node_flag_error(node, mpack_error_type); + return NULL; + } + + char* ret = (char*) MPACK_MALLOC((size_t)(node.data->len + 1)); + if (ret == NULL) { + mpack_node_flag_error(node, mpack_error_memory); + return NULL; + } + + mpack_memcpy(ret, mpack_node_data_unchecked(node), node.data->len); + ret[node.data->len] = '\0'; + return ret; +} + +char* mpack_node_utf8_cstr_alloc(mpack_node_t node, size_t maxlen) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + // make sure maxlen makes sense + if (maxlen < 1) { + mpack_break("maxlen is zero; you must have room for at least a null-terminator"); + mpack_node_flag_error(node, mpack_error_bug); + return NULL; + } + + if (node.data->type != mpack_type_str) { + mpack_node_flag_error(node, mpack_error_type); + return NULL; + } + + if (node.data->len > maxlen - 1) { + mpack_node_flag_error(node, mpack_error_too_big); + return NULL; + } + + if (!mpack_utf8_check_no_null(mpack_node_data_unchecked(node), node.data->len)) { + mpack_node_flag_error(node, mpack_error_type); + return NULL; + } + + char* ret = (char*) MPACK_MALLOC((size_t)(node.data->len + 1)); + if (ret == NULL) { + mpack_node_flag_error(node, mpack_error_memory); + return NULL; + } + + mpack_memcpy(ret, mpack_node_data_unchecked(node), node.data->len); + ret[node.data->len] = '\0'; + return ret; +} +#endif + + +/* + * Compound Node Functions + */ + +static mpack_node_data_t* mpack_node_map_int_impl(mpack_node_t node, int64_t num) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + if (node.data->type != mpack_type_map) { + mpack_node_flag_error(node, mpack_error_type); + return NULL; + } + + mpack_node_data_t* found = NULL; + + for (size_t i = 0; i < node.data->len; ++i) { + mpack_node_data_t* key = mpack_node_child(node, i * 2); + + if ((key->type == mpack_type_int && key->value.i == num) || + (key->type == mpack_type_uint && num >= 0 && key->value.u == (uint64_t)num)) + { + if (found) { + mpack_node_flag_error(node, mpack_error_data); + return NULL; + } + found = mpack_node_child(node, i * 2 + 1); + } + } + + if (found) + return found; + + return NULL; +} + +static mpack_node_data_t* mpack_node_map_uint_impl(mpack_node_t node, uint64_t num) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + if (node.data->type != mpack_type_map) { + mpack_node_flag_error(node, mpack_error_type); + return NULL; + } + + mpack_node_data_t* found = NULL; + + for (size_t i = 0; i < node.data->len; ++i) { + mpack_node_data_t* key = mpack_node_child(node, i * 2); + + if ((key->type == mpack_type_uint && key->value.u == num) || + (key->type == mpack_type_int && key->value.i >= 0 && (uint64_t)key->value.i == num)) + { + if (found) { + mpack_node_flag_error(node, mpack_error_data); + return NULL; + } + found = mpack_node_child(node, i * 2 + 1); + } + } + + if (found) + return found; + + return NULL; +} + +static mpack_node_data_t* mpack_node_map_str_impl(mpack_node_t node, const char* str, size_t length) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + mpack_assert(length == 0 || str != NULL, "str of length %i is NULL", (int)length); + + if (node.data->type != mpack_type_map) { + mpack_node_flag_error(node, mpack_error_type); + return NULL; + } + + mpack_tree_t* tree = node.tree; + mpack_node_data_t* found = NULL; + + for (size_t i = 0; i < node.data->len; ++i) { + mpack_node_data_t* key = mpack_node_child(node, i * 2); + + if (key->type == mpack_type_str && key->len == length && + mpack_memcmp(str, mpack_node_data_unchecked(mpack_node(tree, key)), length) == 0) { + if (found) { + mpack_node_flag_error(node, mpack_error_data); + return NULL; + } + found = mpack_node_child(node, i * 2 + 1); + } + } + + if (found) + return found; + + return NULL; +} + +static mpack_node_t mpack_node_wrap_lookup(mpack_tree_t* tree, mpack_node_data_t* data) { + if (!data) { + if (tree->error == mpack_ok) + mpack_tree_flag_error(tree, mpack_error_data); + return mpack_tree_nil_node(tree); + } + return mpack_node(tree, data); +} + +static mpack_node_t mpack_node_wrap_lookup_optional(mpack_tree_t* tree, mpack_node_data_t* data) { + if (!data) { + if (tree->error == mpack_ok) + return mpack_tree_missing_node(tree); + return mpack_tree_nil_node(tree); + } + return mpack_node(tree, data); +} + +mpack_node_t mpack_node_map_int(mpack_node_t node, int64_t num) { + return mpack_node_wrap_lookup(node.tree, mpack_node_map_int_impl(node, num)); +} + +mpack_node_t mpack_node_map_int_optional(mpack_node_t node, int64_t num) { + return mpack_node_wrap_lookup_optional(node.tree, mpack_node_map_int_impl(node, num)); +} + +mpack_node_t mpack_node_map_uint(mpack_node_t node, uint64_t num) { + return mpack_node_wrap_lookup(node.tree, mpack_node_map_uint_impl(node, num)); +} + +mpack_node_t mpack_node_map_uint_optional(mpack_node_t node, uint64_t num) { + return mpack_node_wrap_lookup_optional(node.tree, mpack_node_map_uint_impl(node, num)); +} + +mpack_node_t mpack_node_map_str(mpack_node_t node, const char* str, size_t length) { + return mpack_node_wrap_lookup(node.tree, mpack_node_map_str_impl(node, str, length)); +} + +mpack_node_t mpack_node_map_str_optional(mpack_node_t node, const char* str, size_t length) { + return mpack_node_wrap_lookup_optional(node.tree, mpack_node_map_str_impl(node, str, length)); +} + +mpack_node_t mpack_node_map_cstr(mpack_node_t node, const char* cstr) { + mpack_assert(cstr != NULL, "cstr is NULL"); + return mpack_node_map_str(node, cstr, mpack_strlen(cstr)); +} + +mpack_node_t mpack_node_map_cstr_optional(mpack_node_t node, const char* cstr) { + mpack_assert(cstr != NULL, "cstr is NULL"); + return mpack_node_map_str_optional(node, cstr, mpack_strlen(cstr)); +} + +bool mpack_node_map_contains_int(mpack_node_t node, int64_t num) { + return mpack_node_map_int_impl(node, num) != NULL; +} + +bool mpack_node_map_contains_uint(mpack_node_t node, uint64_t num) { + return mpack_node_map_uint_impl(node, num) != NULL; +} + +bool mpack_node_map_contains_str(mpack_node_t node, const char* str, size_t length) { + return mpack_node_map_str_impl(node, str, length) != NULL; +} + +bool mpack_node_map_contains_cstr(mpack_node_t node, const char* cstr) { + mpack_assert(cstr != NULL, "cstr is NULL"); + return mpack_node_map_contains_str(node, cstr, mpack_strlen(cstr)); +} + +size_t mpack_node_enum_optional(mpack_node_t node, const char* strings[], size_t count) { + if (mpack_node_error(node) != mpack_ok) + return count; + + // the value is only recognized if it is a string + if (mpack_node_type(node) != mpack_type_str) + return count; + + // fetch the string + const char* key = mpack_node_str(node); + size_t keylen = mpack_node_strlen(node); + mpack_assert(mpack_node_error(node) == mpack_ok, "these should not fail"); + + // find what key it matches + for (size_t i = 0; i < count; ++i) { + const char* other = strings[i]; + size_t otherlen = mpack_strlen(other); + if (keylen == otherlen && mpack_memcmp(key, other, keylen) == 0) + return i; + } + + // no matches + return count; +} + +size_t mpack_node_enum(mpack_node_t node, const char* strings[], size_t count) { + size_t value = mpack_node_enum_optional(node, strings, count); + if (value == count) + mpack_node_flag_error(node, mpack_error_type); + return value; +} + +mpack_type_t mpack_node_type(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return mpack_type_nil; + return node.data->type; +} + +bool mpack_node_is_nil(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) { + // All nodes are treated as nil nodes when we are in error. + return true; + } + return node.data->type == mpack_type_nil; +} + +bool mpack_node_is_missing(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) { + // errors still return nil nodes, not missing nodes. + return false; + } + return node.data->type == mpack_type_missing; +} + +void mpack_node_nil(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return; + if (node.data->type != mpack_type_nil) + mpack_node_flag_error(node, mpack_error_type); +} + +void mpack_node_missing(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return; + if (node.data->type != mpack_type_missing) + mpack_node_flag_error(node, mpack_error_type); +} + +bool mpack_node_bool(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return false; + + if (node.data->type == mpack_type_bool) + return node.data->value.b; + + mpack_node_flag_error(node, mpack_error_type); + return false; +} + +void mpack_node_true(mpack_node_t node) { + if (mpack_node_bool(node) != true) + mpack_node_flag_error(node, mpack_error_type); +} + +void mpack_node_false(mpack_node_t node) { + if (mpack_node_bool(node) != false) + mpack_node_flag_error(node, mpack_error_type); +} + +uint8_t mpack_node_u8(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_uint) { + if (node.data->value.u <= UINT8_MAX) + return (uint8_t)node.data->value.u; + } else if (node.data->type == mpack_type_int) { + if (node.data->value.i >= 0 && node.data->value.i <= UINT8_MAX) + return (uint8_t)node.data->value.i; + } + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +int8_t mpack_node_i8(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_uint) { + if (node.data->value.u <= INT8_MAX) + return (int8_t)node.data->value.u; + } else if (node.data->type == mpack_type_int) { + if (node.data->value.i >= INT8_MIN && node.data->value.i <= INT8_MAX) + return (int8_t)node.data->value.i; + } + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +uint16_t mpack_node_u16(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_uint) { + if (node.data->value.u <= UINT16_MAX) + return (uint16_t)node.data->value.u; + } else if (node.data->type == mpack_type_int) { + if (node.data->value.i >= 0 && node.data->value.i <= UINT16_MAX) + return (uint16_t)node.data->value.i; + } + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +int16_t mpack_node_i16(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_uint) { + if (node.data->value.u <= INT16_MAX) + return (int16_t)node.data->value.u; + } else if (node.data->type == mpack_type_int) { + if (node.data->value.i >= INT16_MIN && node.data->value.i <= INT16_MAX) + return (int16_t)node.data->value.i; + } + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +uint32_t mpack_node_u32(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_uint) { + if (node.data->value.u <= UINT32_MAX) + return (uint32_t)node.data->value.u; + } else if (node.data->type == mpack_type_int) { + if (node.data->value.i >= 0 && node.data->value.i <= UINT32_MAX) + return (uint32_t)node.data->value.i; + } + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +int32_t mpack_node_i32(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_uint) { + if (node.data->value.u <= INT32_MAX) + return (int32_t)node.data->value.u; + } else if (node.data->type == mpack_type_int) { + if (node.data->value.i >= INT32_MIN && node.data->value.i <= INT32_MAX) + return (int32_t)node.data->value.i; + } + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +uint64_t mpack_node_u64(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_uint) { + return node.data->value.u; + } else if (node.data->type == mpack_type_int) { + if (node.data->value.i >= 0) + return (uint64_t)node.data->value.i; + } + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +int64_t mpack_node_i64(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_uint) { + if (node.data->value.u <= (uint64_t)INT64_MAX) + return (int64_t)node.data->value.u; + } else if (node.data->type == mpack_type_int) { + return node.data->value.i; + } + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +unsigned int mpack_node_uint(mpack_node_t node) { + + // This should be true at compile-time, so this just wraps the 32-bit function. + if (sizeof(unsigned int) == 4) + return (unsigned int)mpack_node_u32(node); + + // Otherwise we use u64 and check the range. + uint64_t val = mpack_node_u64(node); + if (val <= UINT_MAX) + return (unsigned int)val; + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +int mpack_node_int(mpack_node_t node) { + + // This should be true at compile-time, so this just wraps the 32-bit function. + if (sizeof(int) == 4) + return (int)mpack_node_i32(node); + + // Otherwise we use i64 and check the range. + int64_t val = mpack_node_i64(node); + if (val >= INT_MIN && val <= INT_MAX) + return (int)val; + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +float mpack_node_float(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0.0f; + + if (node.data->type == mpack_type_uint) + return (float)node.data->value.u; + else if (node.data->type == mpack_type_int) + return (float)node.data->value.i; + else if (node.data->type == mpack_type_float) + return node.data->value.f; + else if (node.data->type == mpack_type_double) + return (float)node.data->value.d; + + mpack_node_flag_error(node, mpack_error_type); + return 0.0f; +} + +double mpack_node_double(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0.0; + + if (node.data->type == mpack_type_uint) + return (double)node.data->value.u; + else if (node.data->type == mpack_type_int) + return (double)node.data->value.i; + else if (node.data->type == mpack_type_float) + return (double)node.data->value.f; + else if (node.data->type == mpack_type_double) + return node.data->value.d; + + mpack_node_flag_error(node, mpack_error_type); + return 0.0; +} + +float mpack_node_float_strict(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0.0f; + + if (node.data->type == mpack_type_float) + return node.data->value.f; + + mpack_node_flag_error(node, mpack_error_type); + return 0.0f; +} + +double mpack_node_double_strict(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0.0; + + if (node.data->type == mpack_type_float) + return (double)node.data->value.f; + else if (node.data->type == mpack_type_double) + return node.data->value.d; + + mpack_node_flag_error(node, mpack_error_type); + return 0.0; +} + +#if MPACK_EXTENSIONS +int8_t mpack_node_exttype(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_ext) + return mpack_node_exttype_unchecked(node); + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} +#endif + +uint32_t mpack_node_data_len(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + mpack_type_t type = node.data->type; + if (type == mpack_type_str || type == mpack_type_bin + #if MPACK_EXTENSIONS + || type == mpack_type_ext + #endif + ) + return (uint32_t)node.data->len; + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +size_t mpack_node_strlen(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_str) + return (size_t)node.data->len; + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +const char* mpack_node_str(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + mpack_type_t type = node.data->type; + if (type == mpack_type_str) + return mpack_node_data_unchecked(node); + + mpack_node_flag_error(node, mpack_error_type); + return NULL; +} + +const char* mpack_node_data(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + mpack_type_t type = node.data->type; + if (type == mpack_type_str || type == mpack_type_bin + #if MPACK_EXTENSIONS + || type == mpack_type_ext + #endif + ) + return mpack_node_data_unchecked(node); + + mpack_node_flag_error(node, mpack_error_type); + return NULL; +} + +const char* mpack_node_bin_data(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return NULL; + + if (node.data->type == mpack_type_bin) + return mpack_node_data_unchecked(node); + + mpack_node_flag_error(node, mpack_error_type); + return NULL; +} + +size_t mpack_node_bin_size(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type == mpack_type_bin) + return (size_t)node.data->len; + + mpack_node_flag_error(node, mpack_error_type); + return 0; +} + +size_t mpack_node_array_length(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type != mpack_type_array) { + mpack_node_flag_error(node, mpack_error_type); + return 0; + } + + return (size_t)node.data->len; +} + +mpack_node_t mpack_node_array_at(mpack_node_t node, size_t index) { + if (mpack_node_error(node) != mpack_ok) + return mpack_tree_nil_node(node.tree); + + if (node.data->type != mpack_type_array) { + mpack_node_flag_error(node, mpack_error_type); + return mpack_tree_nil_node(node.tree); + } + + if (index >= node.data->len) { + mpack_node_flag_error(node, mpack_error_data); + return mpack_tree_nil_node(node.tree); + } + + return mpack_node(node.tree, mpack_node_child(node, index)); +} + +size_t mpack_node_map_count(mpack_node_t node) { + if (mpack_node_error(node) != mpack_ok) + return 0; + + if (node.data->type != mpack_type_map) { + mpack_node_flag_error(node, mpack_error_type); + return 0; + } + + return node.data->len; +} + +// internal node map lookup +static mpack_node_t mpack_node_map_at(mpack_node_t node, size_t index, size_t offset) { + if (mpack_node_error(node) != mpack_ok) + return mpack_tree_nil_node(node.tree); + + if (node.data->type != mpack_type_map) { + mpack_node_flag_error(node, mpack_error_type); + return mpack_tree_nil_node(node.tree); + } + + if (index >= node.data->len) { + mpack_node_flag_error(node, mpack_error_data); + return mpack_tree_nil_node(node.tree); + } + + return mpack_node(node.tree, mpack_node_child(node, index * 2 + offset)); +} + +mpack_node_t mpack_node_map_key_at(mpack_node_t node, size_t index) { + return mpack_node_map_at(node, index, 0); +} + +mpack_node_t mpack_node_map_value_at(mpack_node_t node, size_t index) { + return mpack_node_map_at(node, index, 1); +} + +#endif diff --git a/lib/cprofiles/lib/mpack/src/mpack/mpack.h b/lib/cprofiles/lib/mpack/src/mpack/mpack.h new file mode 100644 index 00000000000..7c0b3f17e38 --- /dev/null +++ b/lib/cprofiles/lib/mpack/src/mpack/mpack.h @@ -0,0 +1,7203 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2015-2018 Nicholas Fraser + * + * 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 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. + * + */ + +/* + * This is the MPack 1.0 amalgamation package. + * + * http://github.com/ludocode/mpack + */ + +#ifndef MPACK_H +#define MPACK_H 1 + +#define MPACK_AMALGAMATED 1 + +#if defined(MPACK_HAS_CONFIG) && MPACK_HAS_CONFIG +#include "mpack-config.h" +#endif + + +/* mpack/mpack-defaults.h.h */ + + +/** + * @name Features + * @{ + */ + +/** + * @def MPACK_READER + * + * Enables compilation of the base Tag Reader. + */ +#ifndef MPACK_READER +#define MPACK_READER 1 +#endif + +/** + * @def MPACK_EXPECT + * + * Enables compilation of the static Expect API. + */ +#ifndef MPACK_EXPECT +#define MPACK_EXPECT 1 +#endif + +/** + * @def MPACK_NODE + * + * Enables compilation of the dynamic Node API. + */ +#ifndef MPACK_NODE +#define MPACK_NODE 1 +#endif + +/** + * @def MPACK_WRITER + * + * Enables compilation of the Writer. + */ +#ifndef MPACK_WRITER +#define MPACK_WRITER 1 +#endif + +/** + * @def MPACK_COMPATIBILITY + * + * Enables compatibility features for reading and writing older + * versions of MessagePack. + * + * This is disabled by default. When disabled, the behaviour is equivalent to + * using the default version, @ref mpack_version_current. + * + * Enable this if you need to interoperate with applications or data that do + * not support the new (v5) MessagePack spec. See the section on v4 + * compatibility in @ref docs/protocol.md for more information. + */ +#ifndef MPACK_COMPATIBILITY +#define MPACK_COMPATIBILITY 0 +#endif + +/** + * @def MPACK_EXTENSIONS + * + * Enables the use of extension types. + * + * This is disabled by default. Define it to 1 to enable it. If disabled, + * functions to read and write extensions will not exist, and any occurrence of + * extension types in parsed messages will flag @ref mpack_error_invalid. + * + * MPack discourages the use of extension types. See the section on extension + * types in @ref docs/protocol.md for more information. + */ +#ifndef MPACK_EXTENSIONS +#define MPACK_EXTENSIONS 0 +#endif + + +/** + * @} + */ + + +/** + * @name Dependencies + * @{ + */ + +/** + * @def MPACK_HAS_CONFIG + * + * Enables the use of an @c mpack-config.h configuration file for MPack. + * This file must be in the same folder as @c mpack.h, or it must be + * available from your project's include paths. + */ +// This goes in your project settings. + +/** + * @def MPACK_STDLIB + * + * Enables the use of C stdlib. This allows the library to use malloc + * for debugging and in allocation helpers. + */ +#ifndef MPACK_STDLIB +#define MPACK_STDLIB 1 +#endif + +/** + * @def MPACK_STDIO + * + * Enables the use of C stdio. This adds helpers for easily + * reading/writing C files and makes debugging easier. + */ +#ifndef MPACK_STDIO +#define MPACK_STDIO 1 +#endif + +/** + * @} + */ + + +/** + * @name System Functions + * @{ + */ + +/** + * @def MPACK_MALLOC + * + * Defines the memory allocation function used by MPack. This is used by + * helpers for automatically allocating data the correct size, and for + * debugging functions. If this macro is undefined, the allocation helpers + * will not be compiled. + * + * The default is @c malloc() if @ref MPACK_STDLIB is enabled. + */ +/** + * @def MPACK_FREE + * + * Defines the memory free function used by MPack. This is used by helpers + * for automatically allocating data the correct size. If this macro is + * undefined, the allocation helpers will not be compiled. + * + * The default is @c free() if @ref MPACK_MALLOC has not been customized and + * @ref MPACK_STDLIB is enabled. + */ +/** + * @def MPACK_REALLOC + * + * Defines the realloc function used by MPack. It is used by growable + * buffers to resize more efficiently. + * + * The default is @c realloc() if @ref MPACK_MALLOC has not been customized and + * @ref MPACK_STDLIB is enabled. + * + * This is optional, even when @ref MPACK_MALLOC is used. If @ref MPACK_MALLOC is + * set and @ref MPACK_REALLOC is not, @ref MPACK_MALLOC is used with a simple copy + * to grow buffers. + */ +#if defined(MPACK_STDLIB) && MPACK_STDLIB && !defined(MPACK_MALLOC) +#define MPACK_MALLOC malloc +#define MPACK_REALLOC realloc +#define MPACK_FREE free +#endif + +/** + * @} + */ + + +/** + * @name Debugging Options + */ + +/** + * @def MPACK_DEBUG + * + * Enables debug features. You may want to wrap this around your + * own debug preprocs. By default, this is enabled if @c DEBUG or @c _DEBUG + * are defined. (@c NDEBUG is not used since it is allowed to have + * different values in different translation units.) + */ +#if !defined(MPACK_DEBUG) && (defined(DEBUG) || defined(_DEBUG)) +#define MPACK_DEBUG 1 +#endif + +/** + * @def MPACK_STRINGS + * + * Enables descriptive error and type strings. + * + * This can be turned off (by defining it to 0) to maximize space savings + * on embedded devices. If this is disabled, string functions such as + * mpack_error_to_string() and mpack_type_to_string() return an empty string. + */ +#ifndef MPACK_STRINGS +#define MPACK_STRINGS 1 +#endif + +/** + * Set this to 1 to implement a custom @ref mpack_assert_fail() function. + * See the documentation on @ref mpack_assert_fail() for details. + * + * Asserts are only used when @ref MPACK_DEBUG is enabled, and can be + * triggered by bugs in MPack or bugs due to incorrect usage of MPack. + */ +#ifndef MPACK_CUSTOM_ASSERT +#define MPACK_CUSTOM_ASSERT 0 +#endif + +/** + * @def MPACK_READ_TRACKING + * + * Enables compound type size tracking for readers. This ensures that the + * correct number of elements or bytes are read from a compound type. + * + * This is enabled by default in debug builds (provided a @c malloc() is + * available.) + */ +#if !defined(MPACK_READ_TRACKING) && \ + defined(MPACK_DEBUG) && MPACK_DEBUG && \ + defined(MPACK_READER) && MPACK_READER && \ + defined(MPACK_MALLOC) +#define MPACK_READ_TRACKING 1 +#endif + +/** + * @def MPACK_WRITE_TRACKING + * + * Enables compound type size tracking for writers. This ensures that the + * correct number of elements or bytes are written in a compound type. + * + * Note that without write tracking enabled, it is possible for buggy code + * to emit invalid MessagePack without flagging an error by writing the wrong + * number of elements or bytes in a compound type. With tracking enabled, + * MPack will catch such errors and break on the offending line of code. + * + * This is enabled by default in debug builds (provided a @c malloc() is + * available.) + */ +#if !defined(MPACK_WRITE_TRACKING) && \ + defined(MPACK_DEBUG) && MPACK_DEBUG && \ + defined(MPACK_WRITER) && MPACK_WRITER && \ + defined(MPACK_MALLOC) +#define MPACK_WRITE_TRACKING 1 +#endif + +/** + * @} + */ + + +/** + * @name Miscellaneous Options + * @{ + */ + +/** + * Whether to optimize for size or speed. + * + * Optimizing for size simplifies some parsing and encoding algorithms + * at the expense of speed, and saves a few kilobytes of space in the + * resulting executable. + * + * This automatically detects -Os with GCC/Clang. Unfortunately there + * doesn't seem to be a macro defined for /Os under MSVC. + */ +#ifndef MPACK_OPTIMIZE_FOR_SIZE +#ifdef __OPTIMIZE_SIZE__ +#define MPACK_OPTIMIZE_FOR_SIZE 1 +#else +#define MPACK_OPTIMIZE_FOR_SIZE 0 +#endif +#endif + +/** + * Stack space in bytes to use when initializing a reader or writer + * with a stack-allocated buffer. + */ +#ifndef MPACK_STACK_SIZE +#define MPACK_STACK_SIZE 4096 +#endif + +/** + * Buffer size to use for allocated buffers (such as for a file writer.) + * + * Starting with a single page and growing as needed seems to + * provide the best performance with minimal memory waste. + * Increasing this does not improve performance even when writing + * huge messages. + */ +#ifndef MPACK_BUFFER_SIZE +#define MPACK_BUFFER_SIZE 4096 +#endif + +/** + * Minimum size of an allocated node page in bytes. + * + * The children for a given compound element must be contiguous, so + * larger pages than this may be allocated as needed. (Safety checks + * exist to prevent malicious data from causing too large allocations.) + * + * See @ref mpack_node_data_t for the size of nodes. + * + * Using as many nodes fit in one memory page seems to provide the + * best performance, and has very little waste when parsing small + * messages. + */ +#ifndef MPACK_NODE_PAGE_SIZE +#define MPACK_NODE_PAGE_SIZE 4096 +#endif + +/** + * The initial depth for the node parser. When MPACK_MALLOC is available, + * the node parser has no practical depth limit, and it is not recursive + * so there is no risk of overflowing the call stack. + */ +#ifndef MPACK_NODE_INITIAL_DEPTH +#define MPACK_NODE_INITIAL_DEPTH 8 +#endif + +/** + * The maximum depth for the node parser if @ref MPACK_MALLOC is not available. + */ +#ifndef MPACK_NODE_MAX_DEPTH_WITHOUT_MALLOC +#define MPACK_NODE_MAX_DEPTH_WITHOUT_MALLOC 32 +#endif + +/** + * @} + */ + + +/** + * @} + */ + + +/* mpack/mpack-platform.h.h */ + +/** + * @file + * + * Abstracts all platform-specific code from MPack. This contains + * implementations of standard C functions when libc is not available, + * as well as wrappers to library functions. + */ + +#ifndef MPACK_PLATFORM_H +#define MPACK_PLATFORM_H 1 + + + +/* Pre-include checks */ + +#if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(__cplusplus) +#error "In Visual Studio 2012 and earlier, MPack must be compiled as C++. Enable the /Tp compiler flag." +#endif + +#if defined(WIN32) && defined(MPACK_INTERNAL) && MPACK_INTERNAL +#define _CRT_SECURE_NO_WARNINGS 1 +#endif + + + +/* Doxygen preprocs */ +#if defined(MPACK_DOXYGEN) && MPACK_DOXYGEN +#define MPACK_HAS_CONFIG 0 +// We give these their default values of 0 here even though they are defined to +// 1 in the doxyfile. Doxygen will show this as the value in the docs, even +// though it ignores it when parsing the rest of the source. This is what we +// want, since we want the documentation to show these defaults but still +// generate documentation for the functions they add when they're on. +#define MPACK_COMPATIBILITY 0 +#define MPACK_EXTENSIONS 0 +#endif + + + +/* Include the custom config file if enabled */ + +#if defined(MPACK_HAS_CONFIG) && MPACK_HAS_CONFIG +/* #include "mpack-config.h" */ +#endif + +/* + * Now that the optional config is included, we define the defaults + * for any of the configuration options and other switches that aren't + * yet defined. + */ +#if defined(MPACK_DOXYGEN) && MPACK_DOXYGEN +/* #include "mpack-defaults-doxygen.h" */ +#else +/* #include "mpack-defaults.h" */ +#endif + +/* + * All remaining configuration options that have not yet been set must + * be defined here in order to support -Wundef. + */ +#ifndef MPACK_DEBUG +#define MPACK_DEBUG 0 +#endif +#ifndef MPACK_CUSTOM_BREAK +#define MPACK_CUSTOM_BREAK 0 +#endif +#ifndef MPACK_READ_TRACKING +#define MPACK_READ_TRACKING 0 +#endif +#ifndef MPACK_WRITE_TRACKING +#define MPACK_WRITE_TRACKING 0 +#endif +#ifndef MPACK_EMIT_INLINE_DEFS +#define MPACK_EMIT_INLINE_DEFS 0 +#endif +#ifndef MPACK_AMALGAMATED +#define MPACK_AMALGAMATED 0 +#endif +#ifndef MPACK_RELEASE_VERSION +#define MPACK_RELEASE_VERSION 0 +#endif +#ifndef MPACK_INTERNAL +#define MPACK_INTERNAL 0 +#endif +#ifndef MPACK_NO_BUILTINS +#define MPACK_NO_BUILTINS 0 +#endif + + + +/* System headers (based on configuration) */ + +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS 1 +#endif +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS 1 +#endif + +#include +#include +#include +#include +#include + +#if MPACK_STDLIB +#include +#include +#endif + +#if MPACK_STDIO +#include +#include +#endif + + + +/* + * Header configuration + */ + +#ifdef __cplusplus + #define MPACK_EXTERN_C_START extern "C" { + #define MPACK_EXTERN_C_END } +#else + #define MPACK_EXTERN_C_START /* nothing */ + #define MPACK_EXTERN_C_END /* nothing */ +#endif + +/* We can't push/pop diagnostics before GCC 4.6, so if you're on a really old + * compiler, MPack does not support the below warning flags. You will have to + * manually disable them to use MPack. */ + +/* GCC versions before 5.1 warn about defining a C99 non-static inline function + * before declaring it (see issue #20). Diagnostic push is not supported before + * GCC 4.6. */ +#if defined(__GNUC__) && !defined(__clang__) + #if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ == 5 && __GNUC_MINOR__ < 1) + #ifdef __cplusplus + #define MPACK_DECLARED_INLINE_WARNING_START \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") + #else + #define MPACK_DECLARED_INLINE_WARNING_START \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") + #endif + #define MPACK_DECLARED_INLINE_WARNING_END \ + _Pragma ("GCC diagnostic pop") + #endif +#endif +#ifndef MPACK_DECLARED_INLINE_WARNING_START + #define MPACK_DECLARED_INLINE_WARNING_START /* nothing */ + #define MPACK_DECLARED_INLINE_WARNING_END /* nothing */ +#endif + +/* GCC versions before 4.8 warn about shadowing a function with a variable that + * isn't a function or function pointer (like "index"). Diagnostic push is not + * supported before GCC 4.6. */ +#if defined(__GNUC__) && !defined(__clang__) + #if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && __GNUC_MINOR__ < 8 + #define MPACK_WSHADOW_WARNING_START \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wshadow\"") + #define MPACK_WSHADOW_WARNING_END \ + _Pragma ("GCC diagnostic pop") + #endif +#endif +#ifndef MPACK_WSHADOW_WARNING_START + #define MPACK_WSHADOW_WARNING_START /* nothing */ + #define MPACK_WSHADOW_WARNING_END /* nothing */ +#endif + +#define MPACK_HEADER_START \ + MPACK_WSHADOW_WARNING_START \ + MPACK_DECLARED_INLINE_WARNING_START + +#define MPACK_HEADER_END \ + MPACK_DECLARED_INLINE_WARNING_END \ + MPACK_WSHADOW_WARNING_END + +MPACK_HEADER_START +MPACK_EXTERN_C_START + + + +/* Miscellaneous helper macros */ + +#define MPACK_UNUSED(var) ((void)(var)) + +#define MPACK_STRINGIFY_IMPL(arg) #arg +#define MPACK_STRINGIFY(arg) MPACK_STRINGIFY_IMPL(arg) + +// This is a workaround for MSVC's incorrect expansion of __VA_ARGS__. It +// treats __VA_ARGS__ as a single preprocessor token when passed in the +// argument list of another macro unless we use an outer wrapper to expand it +// lexically first. (For safety/consistency we use this in all variadic macros +// that don't ignore the variadic arguments regardless of whether __VA_ARGS__ +// is passed to another macro.) +// https://stackoverflow.com/a/32400131 +#define MPACK_EXPAND(x) x + +// Extracts the first argument of a variadic macro list, where there might only +// be one argument. +#define MPACK_EXTRACT_ARG0_IMPL(first, ...) first +#define MPACK_EXTRACT_ARG0(...) MPACK_EXPAND(MPACK_EXTRACT_ARG0_IMPL( __VA_ARGS__ , ignored)) + +// Stringifies the first argument of a variadic macro list, where there might +// only be one argument. +#define MPACK_STRINGIFY_ARG0_impl(first, ...) #first +#define MPACK_STRINGIFY_ARG0(...) MPACK_EXPAND(MPACK_STRINGIFY_ARG0_impl( __VA_ARGS__ , ignored)) + + + +/* + * Definition of inline macros. + * + * MPack does not use static inline in header files; only one non-inline definition + * of each function should exist in the final build. This can reduce the binary size + * in cases where the compiler cannot or chooses not to inline a function. + * The addresses of functions should also compare equal across translation units + * regardless of whether they are declared inline. + * + * The above requirements mean that the declaration and definition of non-trivial + * inline functions must be separated so that the definitions will only + * appear when necessary. In addition, three different linkage models need + * to be supported: + * + * - The C99 model, where a standalone function is emitted only if there is any + * `extern inline` or non-`inline` declaration (including the definition itself) + * + * - The GNU model, where an `inline` definition emits a standalone function and an + * `extern inline` definition does not, regardless of other declarations + * + * - The C++ model, where `inline` emits a standalone function with special + * (COMDAT) linkage + * + * The macros below wrap up everything above. All inline functions defined in header + * files have a single non-inline definition emitted in the compilation of + * mpack-platform.c. All inline declarations and definitions use the same MPACK_INLINE + * specification to simplify the rules on when standalone functions are emitted. + * Inline functions in source files are defined MPACK_STATIC_INLINE. + * + * Additional reading: + * http://www.greenend.org.uk/rjk/tech/inline.html + */ + +#if defined(__cplusplus) + // C++ rules + // The linker will need COMDAT support to link C++ object files, + // so we don't need to worry about emitting definitions from C++ + // translation units. If mpack-platform.c (or the amalgamation) + // is compiled as C, its definition will be used, otherwise a + // C++ definition will be used, and no other C files will emit + // a definition. + #define MPACK_INLINE inline + +#elif defined(_MSC_VER) + // MSVC 2013 always uses COMDAT linkage, but it doesn't treat 'inline' as a + // keyword in C99 mode. (This appears to be fixed in a later version of + // MSVC but we don't bother detecting it.) + #define MPACK_INLINE __inline + #define MPACK_STATIC_INLINE static __inline + +#elif defined(__GNUC__) && (defined(__GNUC_GNU_INLINE__) || \ + (!defined(__GNUC_STDC_INLINE__) && !defined(__GNUC_GNU_INLINE__))) + // GNU rules + #if MPACK_EMIT_INLINE_DEFS + #define MPACK_INLINE inline + #else + #define MPACK_INLINE extern inline + #endif + +#elif defined(__TINYC__) + // tcc ignores the inline keyword, so we have to use static inline. We + // issue a warning to make sure you are aware. You can define the below + // macro to disable the warning. Hopefully this will be fixed soon: + // https://lists.nongnu.org/archive/html/tinycc-devel/2019-06/msg00000.html + #ifndef MPACK_DISABLE_TINYC_INLINE_WARNING + #warning "Single-definition inline is not supported by tcc. All inlines will be static. Define MPACK_DISABLE_TINYC_INLINE_WARNING to disable this warning." + #endif + #define MPACK_INLINE static inline + +#else + // C99 rules + #if MPACK_EMIT_INLINE_DEFS + #define MPACK_INLINE extern inline + #else + #define MPACK_INLINE inline + #endif +#endif + +#ifndef MPACK_STATIC_INLINE +#define MPACK_STATIC_INLINE static inline +#endif + +#ifdef MPACK_OPTIMIZE_FOR_SPEED + #error "You should define MPACK_OPTIMIZE_FOR_SIZE, not MPACK_OPTIMIZE_FOR_SPEED." +#endif + + + +/* + * Prevent inlining + * + * When a function is only used once, it is almost always inlined + * automatically. This can cause poor instruction cache usage because a + * function that should rarely be called (such as buffer exhaustion handling) + * will get inlined into the middle of a hot code path. + */ + +#if !MPACK_NO_BUILTINS + #if defined(_MSC_VER) + #define MPACK_NOINLINE __declspec(noinline) + #elif defined(__GNUC__) || defined(__clang__) + #define MPACK_NOINLINE __attribute__((noinline)) + #endif +#endif +#ifndef MPACK_NOINLINE + #define MPACK_NOINLINE /* nothing */ +#endif + + + +/* Some compiler-specific keywords and builtins */ + +#if !MPACK_NO_BUILTINS + #if defined(__GNUC__) || defined(__clang__) + #define MPACK_UNREACHABLE __builtin_unreachable() + #define MPACK_NORETURN(fn) fn __attribute__((noreturn)) + #define MPACK_RESTRICT __restrict__ + #elif defined(_MSC_VER) + #define MPACK_UNREACHABLE __assume(0) + #define MPACK_NORETURN(fn) __declspec(noreturn) fn + #define MPACK_RESTRICT __restrict + #endif +#endif + +#ifndef MPACK_RESTRICT +#ifdef __cplusplus +#define MPACK_RESTRICT /* nothing, unavailable in C++ */ +#else +#define MPACK_RESTRICT restrict /* required in C99 */ +#endif +#endif + +#ifndef MPACK_UNREACHABLE +#define MPACK_UNREACHABLE ((void)0) +#endif +#ifndef MPACK_NORETURN +#define MPACK_NORETURN(fn) fn +#endif + + + +/* + * Likely/unlikely + * + * These should only really be used when a branch is taken (or not taken) less + * than 1/1000th of the time. Buffer flush checks when writing very small + * elements are a good example. + */ + +#if !MPACK_NO_BUILTINS + #if defined(__GNUC__) || defined(__clang__) + #ifndef MPACK_LIKELY + #define MPACK_LIKELY(x) __builtin_expect((x),1) + #endif + #ifndef MPACK_UNLIKELY + #define MPACK_UNLIKELY(x) __builtin_expect((x),0) + #endif + #endif +#endif + +#ifndef MPACK_LIKELY + #define MPACK_LIKELY(x) (x) +#endif +#ifndef MPACK_UNLIKELY + #define MPACK_UNLIKELY(x) (x) +#endif + + + +/* Static assert */ + +#ifndef MPACK_STATIC_ASSERT + #if defined(__cplusplus) + #if __cplusplus >= 201103L + #define MPACK_STATIC_ASSERT static_assert + #endif + #elif defined(__STDC_VERSION__) + #if __STDC_VERSION__ >= 201112L + #define MPACK_STATIC_ASSERT _Static_assert + #endif + #endif +#endif + +#if !MPACK_NO_BUILTINS + #ifndef MPACK_STATIC_ASSERT + #if defined(__has_feature) + #if __has_feature(cxx_static_assert) + #define MPACK_STATIC_ASSERT static_assert + #elif __has_feature(c_static_assert) + #define MPACK_STATIC_ASSERT _Static_assert + #endif + #endif + #endif + + #ifndef MPACK_STATIC_ASSERT + #if defined(__GNUC__) + /* Diagnostic push is not supported before GCC 4.6. */ + #if defined(__clang__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) + #ifndef __cplusplus + #if defined(__clang__) || __GNUC__ >= 5 + #define MPACK_IGNORE_PEDANTIC "GCC diagnostic ignored \"-Wpedantic\"" + #else + #define MPACK_IGNORE_PEDANTIC "GCC diagnostic ignored \"-pedantic\"" + #endif + #define MPACK_STATIC_ASSERT(expr, str) do { \ + _Pragma ("GCC diagnostic push") \ + _Pragma (MPACK_IGNORE_PEDANTIC) \ + _Pragma ("GCC diagnostic ignored \"-Wc++-compat\"") \ + _Static_assert(expr, str); \ + _Pragma ("GCC diagnostic pop") \ + } while (0) + #endif + #endif + #endif + #endif + + #ifndef MPACK_STATIC_ASSERT + #ifdef _MSC_VER + #if _MSC_VER >= 1600 + #define MPACK_STATIC_ASSERT static_assert + #endif + #endif + #endif +#endif + +#ifndef MPACK_STATIC_ASSERT + #define MPACK_STATIC_ASSERT(expr, str) (MPACK_UNUSED(sizeof(char[1 - 2*!(expr)]))) +#endif + + + +/* _Generic */ + +#ifndef MPACK_HAS_GENERIC + #if defined(__clang__) && defined(__has_feature) + // With Clang we can test for _Generic support directly + // and ignore C/C++ version + #if __has_feature(c_generic_selections) + #define MPACK_HAS_GENERIC 1 + #else + #define MPACK_HAS_GENERIC 0 + #endif + #endif +#endif + +#ifndef MPACK_HAS_GENERIC + #if defined(__STDC_VERSION__) + #if __STDC_VERSION__ >= 201112L + #if defined(__GNUC__) && !defined(__clang__) + // GCC does not have full C11 support in GCC 4.7 and 4.8 + #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) + #define MPACK_HAS_GENERIC 1 + #endif + #else + // We hope other compilers aren't lying about C11/_Generic support + #define MPACK_HAS_GENERIC 1 + #endif + #endif + #endif +#endif + +#ifndef MPACK_HAS_GENERIC + #define MPACK_HAS_GENERIC 0 +#endif + + + +/* + * Finite Math + * + * -ffinite-math-only, included in -ffast-math, breaks functions that + * that check for non-finite real values such as isnan() and isinf(). + * + * We should use this to trap errors when reading data that contains + * non-finite reals. This isn't currently implemented. + */ + +#ifndef MPACK_FINITE_MATH +#if defined(__FINITE_MATH_ONLY__) && __FINITE_MATH_ONLY__ +#define MPACK_FINITE_MATH 1 +#endif +#endif + +#ifndef MPACK_FINITE_MATH +#define MPACK_FINITE_MATH 0 +#endif + + + +/* + * Endianness checks + * + * These define MPACK_NHSWAP*() which swap network<->host byte + * order when needed. + * + * We leave them undefined if we can't determine the endianness + * at compile-time, in which case we fall back to bit-shifts. + * + * See the notes in mpack-common.h. + */ + +#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) + #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + #define MPACK_NHSWAP16(x) (x) + #define MPACK_NHSWAP32(x) (x) + #define MPACK_NHSWAP64(x) (x) + #elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + + #if !MPACK_NO_BUILTINS + #if defined(__clang__) + #ifdef __has_builtin + // Unlike the GCC builtins, the bswap builtins in Clang + // significantly improve ARM performance. + #if __has_builtin(__builtin_bswap16) + #define MPACK_NHSWAP16(x) __builtin_bswap16(x) + #endif + #if __has_builtin(__builtin_bswap32) + #define MPACK_NHSWAP32(x) __builtin_bswap32(x) + #endif + #if __has_builtin(__builtin_bswap64) + #define MPACK_NHSWAP64(x) __builtin_bswap64(x) + #endif + #endif + + #elif defined(__GNUC__) + + // The GCC bswap builtins are apparently poorly optimized on older + // versions of GCC, so we set a minimum version here just in case. + // http://hardwarebug.org/2010/01/14/beware-the-builtins/ + + #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + #define MPACK_NHSWAP64(x) __builtin_bswap64(x) + #endif + + // __builtin_bswap16() was not implemented on all platforms + // until GCC 4.8.0: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 + // + // The 16- and 32-bit versions in GCC significantly reduce performance + // on ARM with little effect on code size so we don't use them. + + #endif + #endif + #endif + +#elif defined(_MSC_VER) && defined(_WIN32) && !MPACK_NO_BUILTINS + + // On Windows, we assume x86 and x86_64 are always little-endian. + // We make no assumptions about ARM even though all current + // Windows Phone devices are little-endian in case Microsoft's + // compiler is ever used with a big-endian ARM device. + + #if defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) + #define MPACK_NHSWAP16(x) _byteswap_ushort(x) + #define MPACK_NHSWAP32(x) _byteswap_ulong(x) + #define MPACK_NHSWAP64(x) _byteswap_uint64(x) + #endif + +#endif + +#if defined(__FLOAT_WORD_ORDER__) && defined(__BYTE_ORDER__) + + // We check where possible that the float byte order matches the + // integer byte order. This is extremely unlikely to fail, but + // we check anyway just in case. + // + // (The static assert is placed in float/double encoders instead + // of here because our static assert fallback doesn't work at + // file scope) + + #define MPACK_CHECK_FLOAT_ORDER() \ + MPACK_STATIC_ASSERT(__FLOAT_WORD_ORDER__ == __BYTE_ORDER__, \ + "float byte order does not match int byte order! float/double " \ + "encoding is not properly implemented on this platform.") + +#endif + +#ifndef MPACK_CHECK_FLOAT_ORDER + #define MPACK_CHECK_FLOAT_ORDER() /* nothing */ +#endif + + +/* + * Here we define mpack_assert() and mpack_break(). They both work like a normal + * assertion function in debug mode, causing a trap or abort. However, on some platforms + * you can safely resume execution from mpack_break(), whereas mpack_assert() is + * always fatal. + * + * In release mode, mpack_assert() is converted to an assurance to the compiler + * that the expression cannot be false (via e.g. __assume() or __builtin_unreachable()) + * to improve optimization where supported. There is thus no point in "safely" handling + * the case of this being false. Writing mpack_assert(0) rarely makes sense (except + * possibly as a default handler in a switch) since the compiler will throw away any + * code after it. If at any time an mpack_assert() is not true, the behaviour is + * undefined. This also means the expression is evaluated even in release. + * + * mpack_break() on the other hand is compiled to nothing in release. It is + * used in situations where we want to highlight a programming error as early as + * possible (in the debugger), but we still handle the situation safely if it + * happens in release to avoid producing incorrect results (such as in + * MPACK_WRITE_TRACKING.) It does not take an expression to test because it + * belongs in a safe-handling block after its failing condition has been tested. + * + * If stdio is available, we can add a format string describing the error, and + * on some compilers we can declare it noreturn to get correct results from static + * analysis tools. Note that the format string and arguments are not evaluated unless + * the assertion is hit. + * + * Note that any arguments to mpack_assert() beyond the first are only evaluated + * if the expression is false (and are never evaluated in release.) + * + * mpack_assert_fail() and mpack_break_hit() are defined separately + * because assert is noreturn and break isn't. This distinction is very + * important for static analysis tools to give correct results. + */ + +#if MPACK_DEBUG + + /** + * @addtogroup config + * @{ + */ + /** + * @name Debug Functions + */ + /** + * Implement this and define @ref MPACK_CUSTOM_ASSERT to use a custom + * assertion function. + * + * This function should not return. If it does, MPack will @c abort(). + * + * If you use C++, make sure you include @c mpack.h where you define + * this to get the correct linkage (or define it extern "C".) + * + * Asserts are only used when @ref MPACK_DEBUG is enabled, and can be + * triggered by bugs in MPack or bugs due to incorrect usage of MPack. + */ + void mpack_assert_fail(const char* message); + /** + * @} + */ + /** + * @} + */ + + MPACK_NORETURN(void mpack_assert_fail_wrapper(const char* message)); + #if MPACK_STDIO + MPACK_NORETURN(void mpack_assert_fail_format(const char* format, ...)); + #define mpack_assert_fail_at(line, file, exprstr, format, ...) \ + MPACK_EXPAND(mpack_assert_fail_format("mpack assertion failed at " file ":" #line "\n%s\n" format, exprstr, __VA_ARGS__)) + #else + #define mpack_assert_fail_at(line, file, exprstr, format, ...) \ + mpack_assert_fail_wrapper("mpack assertion failed at " file ":" #line "\n" exprstr "\n") + #endif + + #define mpack_assert_fail_pos(line, file, exprstr, expr, ...) \ + MPACK_EXPAND(mpack_assert_fail_at(line, file, exprstr, __VA_ARGS__)) + + // This contains a workaround to the pedantic C99 requirement of having at + // least one argument to a variadic macro. The first argument is the + // boolean expression, the optional second argument (if provided) must be a + // literal format string, and any additional arguments are the format + // argument list. + // + // Unfortunately this means macros are expanded in the expression before it + // gets stringified. I haven't found a workaround to this. + // + // This adds two unused arguments to the format argument list when a + // format string is provided, so this would complicate the use of + // -Wformat and __attribute__((format)) on mpack_assert_fail_format() if we + // ever bothered to implement it. + #define mpack_assert(...) \ + MPACK_EXPAND(((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \ + mpack_assert_fail_pos(__LINE__, __FILE__, MPACK_STRINGIFY_ARG0(__VA_ARGS__) , __VA_ARGS__ , "", NULL) : \ + (void)0)) + + void mpack_break_hit(const char* message); + #if MPACK_STDIO + void mpack_break_hit_format(const char* format, ...); + #define mpack_break_hit_at(line, file, ...) \ + MPACK_EXPAND(mpack_break_hit_format("mpack breakpoint hit at " file ":" #line "\n" __VA_ARGS__)) + #else + #define mpack_break_hit_at(line, file, ...) \ + mpack_break_hit("mpack breakpoint hit at " file ":" #line ) + #endif + #define mpack_break_hit_pos(line, file, ...) MPACK_EXPAND(mpack_break_hit_at(line, file, __VA_ARGS__)) + #define mpack_break(...) MPACK_EXPAND(mpack_break_hit_pos(__LINE__, __FILE__, __VA_ARGS__)) +#else + #define mpack_assert(...) \ + (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \ + (MPACK_UNREACHABLE, (void)0) : \ + (void)0)) + #define mpack_break(...) ((void)0) +#endif + + + +/* Wrap some needed libc functions */ + +#if MPACK_STDLIB + #define mpack_memcmp memcmp + #define mpack_memcpy memcpy + #define mpack_memmove memmove + #define mpack_memset memset + #ifndef mpack_strlen + #define mpack_strlen strlen + #endif + + #if defined(MPACK_UNIT_TESTS) && MPACK_INTERNAL && defined(__GNUC__) + // make sure we don't use the stdlib directly during development + #undef memcmp + #undef memcpy + #undef memmove + #undef memset + #undef strlen + #undef malloc + #undef free + #pragma GCC poison memcmp + #pragma GCC poison memcpy + #pragma GCC poison memmove + #pragma GCC poison memset + #pragma GCC poison strlen + #pragma GCC poison malloc + #pragma GCC poison free + #endif + +#elif defined(__GNUC__) && !MPACK_NO_BUILTINS + // there's not always a builtin memmove for GCC, + // and we don't have a way to test for it + #define mpack_memcmp __builtin_memcmp + #define mpack_memcpy __builtin_memcpy + #define mpack_memset __builtin_memset + #define mpack_strlen __builtin_strlen + +#elif defined(__clang__) && defined(__has_builtin) && !MPACK_NO_BUILTINS + #if __has_builtin(__builtin_memcmp) + #define mpack_memcmp __builtin_memcmp + #endif + #if __has_builtin(__builtin_memcpy) + #define mpack_memcpy __builtin_memcpy + #endif + #if __has_builtin(__builtin_memmove) + #define mpack_memmove __builtin_memmove + #endif + #if __has_builtin(__builtin_memset) + #define mpack_memset __builtin_memset + #endif + #if __has_builtin(__builtin_strlen) + #define mpack_strlen __builtin_strlen + #endif +#endif + +#ifndef mpack_memcmp +int mpack_memcmp(const void* s1, const void* s2, size_t n); +#endif +#ifndef mpack_memcpy +void* mpack_memcpy(void* MPACK_RESTRICT s1, const void* MPACK_RESTRICT s2, size_t n); +#endif +#ifndef mpack_memmove +void* mpack_memmove(void* s1, const void* s2, size_t n); +#endif +#ifndef mpack_memset +void* mpack_memset(void* s, int c, size_t n); +#endif +#ifndef mpack_strlen +size_t mpack_strlen(const char* s); +#endif + +#if MPACK_STDIO + #if defined(WIN32) + #define mpack_snprintf _snprintf + #else + #define mpack_snprintf snprintf + #endif +#endif + + + +/* Debug logging */ +#if 0 + #include + #define mpack_log(...) (MPACK_EXPAND(printf(__VA_ARGS__)), fflush(stdout)) +#else + #define mpack_log(...) ((void)0) +#endif + + + +/* Make sure our configuration makes sense */ +#if defined(MPACK_MALLOC) && !defined(MPACK_FREE) + #error "MPACK_MALLOC requires MPACK_FREE." +#endif +#if !defined(MPACK_MALLOC) && defined(MPACK_FREE) + #error "MPACK_FREE requires MPACK_MALLOC." +#endif +#if MPACK_READ_TRACKING && !defined(MPACK_READER) + #error "MPACK_READ_TRACKING requires MPACK_READER." +#endif +#if MPACK_WRITE_TRACKING && !defined(MPACK_WRITER) + #error "MPACK_WRITE_TRACKING requires MPACK_WRITER." +#endif +#ifndef MPACK_MALLOC + #if MPACK_STDIO + #error "MPACK_STDIO requires preprocessor definitions for MPACK_MALLOC and MPACK_FREE." + #endif + #if MPACK_READ_TRACKING + #error "MPACK_READ_TRACKING requires preprocessor definitions for MPACK_MALLOC and MPACK_FREE." + #endif + #if MPACK_WRITE_TRACKING + #error "MPACK_WRITE_TRACKING requires preprocessor definitions for MPACK_MALLOC and MPACK_FREE." + #endif +#endif + + + +/* Implement realloc if unavailable */ +#ifdef MPACK_MALLOC + #ifdef MPACK_REALLOC + MPACK_INLINE void* mpack_realloc(void* old_ptr, size_t used_size, size_t new_size) { + MPACK_UNUSED(used_size); + return MPACK_REALLOC(old_ptr, new_size); + } + #else + void* mpack_realloc(void* old_ptr, size_t used_size, size_t new_size); + #endif +#endif + + + +/** + * @} + */ + +MPACK_EXTERN_C_END +MPACK_HEADER_END + +#endif + + +/* mpack/mpack-common.h.h */ + +/** + * @file + * + * Defines types and functions shared by the MPack reader and writer. + */ + +#ifndef MPACK_COMMON_H +#define MPACK_COMMON_H 1 + +/* #include "mpack-platform.h" */ + +#ifndef MPACK_PRINT_BYTE_COUNT +#define MPACK_PRINT_BYTE_COUNT 12 +#endif + +MPACK_HEADER_START +MPACK_EXTERN_C_START + + + +/** + * @defgroup common Tags and Common Elements + * + * Contains types, constants and functions shared by both the encoding + * and decoding portions of MPack. + * + * @{ + */ + +/* Version information */ + +#define MPACK_VERSION_MAJOR 1 /**< The major version number of MPack. */ +#define MPACK_VERSION_MINOR 0 /**< The minor version number of MPack. */ +#define MPACK_VERSION_PATCH 0 /**< The patch version number of MPack. */ + +/** A number containing the version number of MPack for comparison purposes. */ +#define MPACK_VERSION ((MPACK_VERSION_MAJOR * 10000) + \ + (MPACK_VERSION_MINOR * 100) + MPACK_VERSION_PATCH) + +/** A macro to test for a minimum version of MPack. */ +#define MPACK_VERSION_AT_LEAST(major, minor, patch) \ + (MPACK_VERSION >= (((major) * 10000) + ((minor) * 100) + (patch))) + +/** @cond */ +#if (MPACK_VERSION_PATCH > 0) +#define MPACK_VERSION_STRING_BASE \ + MPACK_STRINGIFY(MPACK_VERSION_MAJOR) "." \ + MPACK_STRINGIFY(MPACK_VERSION_MINOR) "." \ + MPACK_STRINGIFY(MPACK_VERSION_PATCH) +#else +#define MPACK_VERSION_STRING_BASE \ + MPACK_STRINGIFY(MPACK_VERSION_MAJOR) "." \ + MPACK_STRINGIFY(MPACK_VERSION_MINOR) +#endif +/** @endcond */ + +/** + * @def MPACK_VERSION_STRING + * @hideinitializer + * + * A string containing the MPack version. + */ +#if MPACK_RELEASE_VERSION +#define MPACK_VERSION_STRING MPACK_VERSION_STRING_BASE +#else +#define MPACK_VERSION_STRING MPACK_VERSION_STRING_BASE "dev" +#endif + +/** + * @def MPACK_LIBRARY_STRING + * @hideinitializer + * + * A string describing MPack, containing the library name, version and debug mode. + */ +#if MPACK_DEBUG +#define MPACK_LIBRARY_STRING "MPack " MPACK_VERSION_STRING "-debug" +#else +#define MPACK_LIBRARY_STRING "MPack " MPACK_VERSION_STRING +#endif + +/** @cond */ +/** + * @def MPACK_MAXIMUM_TAG_SIZE + * + * The maximum encoded size of a tag in bytes. + */ +#define MPACK_MAXIMUM_TAG_SIZE 9 +/** @endcond */ + +#if MPACK_EXTENSIONS +/** + * @def MPACK_TIMESTAMP_NANOSECONDS_MAX + * + * The maximum value of nanoseconds for a timestamp. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +#define MPACK_TIMESTAMP_NANOSECONDS_MAX 999999999 +#endif + + + +#if MPACK_COMPATIBILITY +/** + * Versions of the MessagePack format. + * + * A reader, writer, or tree can be configured to serialize in an older + * version of the MessagePack spec. This is necessary to interface with + * older MessagePack libraries that do not support new MessagePack features. + * + * @note This requires @ref MPACK_COMPATIBILITY. + */ +typedef enum mpack_version_t { + + /** + * Version 1.0/v4, supporting only the @c raw type without @c str8. + */ + mpack_version_v4 = 4, + + /** + * Version 2.0/v5, supporting the @c str8, @c bin and @c ext types. + */ + mpack_version_v5 = 5, + + /** + * The most recent supported version of MessagePack. This is the default. + */ + mpack_version_current = mpack_version_v5, + +} mpack_version_t; +#endif + +/** + * Error states for MPack objects. + * + * When a reader, writer, or tree is in an error state, all subsequent calls + * are ignored and their return values are nil/zero. You should check whether + * the source is in an error state before using such values. + */ +typedef enum mpack_error_t { + mpack_ok = 0, /**< No error. */ + mpack_error_io = 2, /**< The reader or writer failed to fill or flush, or some other file or socket error occurred. */ + mpack_error_invalid, /**< The data read is not valid MessagePack. */ + mpack_error_unsupported, /**< The data read is not supported by this configuration of MPack. (See @ref MPACK_EXTENSIONS.) */ + mpack_error_type, /**< The type or value range did not match what was expected by the caller. */ + mpack_error_too_big, /**< A read or write was bigger than the maximum size allowed for that operation. */ + mpack_error_memory, /**< An allocation failure occurred. */ + mpack_error_bug, /**< The MPack API was used incorrectly. (This will always assert in debug mode.) */ + mpack_error_data, /**< The contained data is not valid. */ + mpack_error_eof, /**< The reader failed to read because of file or socket EOF */ +} mpack_error_t; + +/** + * Converts an MPack error to a string. This function returns an empty + * string when MPACK_DEBUG is not set. + */ +const char* mpack_error_to_string(mpack_error_t error); + +/** + * Defines the type of a MessagePack tag. + * + * Note that extension types, both user defined and built-in, are represented + * in tags as @ref mpack_type_ext. The value for an extension type is stored + * separately. + */ +typedef enum mpack_type_t { + mpack_type_missing = 0, /**< Special type indicating a missing optional value. */ + mpack_type_nil, /**< A null value. */ + mpack_type_bool, /**< A boolean (true or false.) */ + mpack_type_int, /**< A 64-bit signed integer. */ + mpack_type_uint, /**< A 64-bit unsigned integer. */ + mpack_type_float, /**< A 32-bit IEEE 754 floating point number. */ + mpack_type_double, /**< A 64-bit IEEE 754 floating point number. */ + mpack_type_str, /**< A string. */ + mpack_type_bin, /**< A chunk of binary data. */ + mpack_type_array, /**< An array of MessagePack objects. */ + mpack_type_map, /**< An ordered map of key/value pairs of MessagePack objects. */ + + #if MPACK_EXTENSIONS + /** + * A typed MessagePack extension object containing a chunk of binary data. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ + mpack_type_ext, + #endif +} mpack_type_t; + +/** + * Converts an MPack type to a string. This function returns an empty + * string when MPACK_DEBUG is not set. + */ +const char* mpack_type_to_string(mpack_type_t type); + +#if MPACK_EXTENSIONS +/** + * A timestamp. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +typedef struct mpack_timestamp_t { + int64_t seconds; /*< The number of seconds (signed) since 1970-01-01T00:00:00Z. */ + uint32_t nanoseconds; /*< The number of additional nanoseconds, between 0 and 999,999,999. */ +} mpack_timestamp_t; +#endif + +/** + * An MPack tag is a MessagePack object header. It is a variant type + * representing any kind of object, and includes the length of compound types + * (e.g. map, array, string) or the value of non-compound types (e.g. boolean, + * integer, float.) + * + * If the type is compound (str, bin, ext, array or map), the contained + * elements or bytes are stored separately. + * + * This structure is opaque; its fields should not be accessed outside + * of MPack. + */ +typedef struct mpack_tag_t mpack_tag_t; + +/* Hide internals from documentation */ +/** @cond */ +struct mpack_tag_t { + mpack_type_t type; /*< The type of value. */ + + #if MPACK_EXTENSIONS + int8_t exttype; /*< The extension type if the type is @ref mpack_type_ext. */ + #endif + + /* The value for non-compound types. */ + union { + uint64_t u; /*< The value if the type is unsigned int. */ + int64_t i; /*< The value if the type is signed int. */ + double d; /*< The value if the type is double. */ + float f; /*< The value if the type is float. */ + bool b; /*< The value if the type is bool. */ + + /* The number of bytes if the type is str, bin or ext. */ + uint32_t l; + + /* The element count if the type is an array, or the number of + key/value pairs if the type is map. */ + uint32_t n; + } v; +}; +/** @endcond */ + +/** + * @name Tag Generators + * @{ + */ + +/** + * @def MPACK_TAG_ZERO + * + * An @ref mpack_tag_t initializer that zeroes the given tag. + * + * @warning This does not make the tag nil! The tag's type is invalid when + * initialized this way. Use @ref mpack_tag_make_nil() to generate a nil tag. + */ +#if MPACK_EXTENSIONS +#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}} +#else +#define MPACK_TAG_ZERO {(mpack_type_t)0, {0}} +#endif + +/** Generates a nil tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_nil(void) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_nil; + return ret; +} + +/** Generates a bool tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_bool(bool value) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_bool; + ret.v.b = value; + return ret; +} + +/** Generates a bool tag with value true. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_true(void) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_bool; + ret.v.b = true; + return ret; +} + +/** Generates a bool tag with value false. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_false(void) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_bool; + ret.v.b = false; + return ret; +} + +/** Generates a signed int tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_int(int64_t value) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_int; + ret.v.i = value; + return ret; +} + +/** Generates an unsigned int tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_uint(uint64_t value) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_uint; + ret.v.u = value; + return ret; +} + +/** Generates a float tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_float(float value) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_float; + ret.v.f = value; + return ret; +} + +/** Generates a double tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_double(double value) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_double; + ret.v.d = value; + return ret; +} + +/** Generates an array tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_array(uint32_t count) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_array; + ret.v.n = count; + return ret; +} + +/** Generates a map tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_map(uint32_t count) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_map; + ret.v.n = count; + return ret; +} + +/** Generates a str tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_str(uint32_t length) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_str; + ret.v.l = length; + return ret; +} + +/** Generates a bin tag. */ +MPACK_INLINE mpack_tag_t mpack_tag_make_bin(uint32_t length) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_bin; + ret.v.l = length; + return ret; +} + +#if MPACK_EXTENSIONS +/** + * Generates an ext tag. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +MPACK_INLINE mpack_tag_t mpack_tag_make_ext(int8_t exttype, uint32_t length) { + mpack_tag_t ret = MPACK_TAG_ZERO; + ret.type = mpack_type_ext; + ret.exttype = exttype; + ret.v.l = length; + return ret; +} +#endif + +/** + * @} + */ + +/** + * @name Tag Querying Functions + * @{ + */ + +/** + * Gets the type of a tag. + */ +MPACK_INLINE mpack_type_t mpack_tag_type(mpack_tag_t* tag) { + return tag->type; +} + +/** + * Gets the boolean value of a bool-type tag. The tag must be of type @ref + * mpack_type_bool. + * + * This asserts that the type in the tag is @ref mpack_type_bool. (No check is + * performed if MPACK_DEBUG is not set.) + */ +MPACK_INLINE bool mpack_tag_bool_value(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_bool, "tag is not a bool!"); + return tag->v.b; +} + +/** + * Gets the signed integer value of an int-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_int. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @warning This does not convert between signed and unsigned tags! A positive + * integer may be stored in a tag as either @ref mpack_type_int or @ref + * mpack_type_uint. You must check the type first; this can only be used if the + * type is @ref mpack_type_int. + * + * @see mpack_type_int + */ +MPACK_INLINE int64_t mpack_tag_int_value(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_int, "tag is not an int!"); + return tag->v.i; +} + +/** + * Gets the unsigned integer value of a uint-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_uint. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @warning This does not convert between signed and unsigned tags! A positive + * integer may be stored in a tag as either @ref mpack_type_int or @ref + * mpack_type_uint. You must check the type first; this can only be used if the + * type is @ref mpack_type_uint. + * + * @see mpack_type_uint + */ +MPACK_INLINE uint64_t mpack_tag_uint_value(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_uint, "tag is not a uint!"); + return tag->v.u; +} + +/** + * Gets the float value of a float-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_float. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @warning This does not convert between float and double tags! This can only + * be used if the type is @ref mpack_type_float. + * + * @see mpack_type_float + */ +MPACK_INLINE float mpack_tag_float_value(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_float, "tag is not a float!"); + return tag->v.f; +} + +/** + * Gets the double value of a double-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_double. (No check + * is performed if MPACK_DEBUG is not set.) + * + * @warning This does not convert between float and double tags! This can only + * be used if the type is @ref mpack_type_double. + * + * @see mpack_type_double + */ +MPACK_INLINE double mpack_tag_double_value(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_double, "tag is not a double!"); + return tag->v.d; +} + +/** + * Gets the number of elements in an array tag. + * + * This asserts that the type in the tag is @ref mpack_type_array. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @see mpack_type_array + */ +MPACK_INLINE uint32_t mpack_tag_array_count(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_array, "tag is not an array!"); + return tag->v.n; +} + +/** + * Gets the number of key-value pairs in a map tag. + * + * This asserts that the type in the tag is @ref mpack_type_map. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @see mpack_type_map + */ +MPACK_INLINE uint32_t mpack_tag_map_count(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_map, "tag is not a map!"); + return tag->v.n; +} + +/** + * Gets the length in bytes of a str-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_str. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @see mpack_type_str + */ +MPACK_INLINE uint32_t mpack_tag_str_length(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_str, "tag is not a str!"); + return tag->v.l; +} + +/** + * Gets the length in bytes of a bin-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_bin. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @see mpack_type_bin + */ +MPACK_INLINE uint32_t mpack_tag_bin_length(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_bin, "tag is not a bin!"); + return tag->v.l; +} + +#if MPACK_EXTENSIONS +/** + * Gets the length in bytes of an ext-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_ext. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @see mpack_type_ext + */ +MPACK_INLINE uint32_t mpack_tag_ext_length(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_ext, "tag is not an ext!"); + return tag->v.l; +} + +/** + * Gets the extension type (exttype) of an ext-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_ext. (No check is + * performed if MPACK_DEBUG is not set.) + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @see mpack_type_ext + */ +MPACK_INLINE int8_t mpack_tag_ext_exttype(mpack_tag_t* tag) { + mpack_assert(tag->type == mpack_type_ext, "tag is not an ext!"); + return tag->exttype; +} +#endif + +/** + * Gets the length in bytes of a str-, bin- or ext-type tag. + * + * This asserts that the type in the tag is @ref mpack_type_str, @ref + * mpack_type_bin or @ref mpack_type_ext. (No check is performed if MPACK_DEBUG + * is not set.) + * + * @see mpack_type_str + * @see mpack_type_bin + * @see mpack_type_ext + */ +MPACK_INLINE uint32_t mpack_tag_bytes(mpack_tag_t* tag) { + #if MPACK_EXTENSIONS + mpack_assert(tag->type == mpack_type_str || tag->type == mpack_type_bin + || tag->type == mpack_type_ext, "tag is not a str, bin or ext!"); + #else + mpack_assert(tag->type == mpack_type_str || tag->type == mpack_type_bin, + "tag is not a str or bin!"); + #endif + return tag->v.l; +} + +/** + * @} + */ + +/** + * @name Other tag functions + * @{ + */ + +#if MPACK_EXTENSIONS +/** + * The extension type for a timestamp. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +#define MPACK_EXTTYPE_TIMESTAMP ((int8_t)(-1)) +#endif + +/** + * Compares two tags with an arbitrary fixed ordering. Returns 0 if the tags are + * equal, a negative integer if left comes before right, or a positive integer + * otherwise. + * + * \warning The ordering is not guaranteed to be preserved across MPack versions; do + * not rely on it in persistent data. + * + * \warning Floating point numbers are compared bit-for-bit, not using the language's + * operator==. This means that NaNs with matching representation will compare equal. + * This behaviour is up for debate; see comments in the definition of mpack_tag_cmp(). + * + * See mpack_tag_equal() for more information on when tags are considered equal. + */ +int mpack_tag_cmp(mpack_tag_t left, mpack_tag_t right); + +/** + * Compares two tags for equality. Tags are considered equal if the types are compatible + * and the values (for non-compound types) are equal. + * + * The field width of variable-width fields is ignored (and in fact is not stored + * in a tag), and positive numbers in signed integers are considered equal to their + * unsigned counterparts. So for example the value 1 stored as a positive fixint + * is equal to the value 1 stored in a 64-bit unsigned integer field. + * + * The "extension type" of an extension object is considered part of the value + * and must match exactly. + * + * \warning Floating point numbers are compared bit-for-bit, not using the language's + * operator==. This means that NaNs with matching representation will compare equal. + * This behaviour is up for debate; see comments in the definition of mpack_tag_cmp(). + */ +MPACK_INLINE bool mpack_tag_equal(mpack_tag_t left, mpack_tag_t right) { + return mpack_tag_cmp(left, right) == 0; +} + +#if MPACK_DEBUG && MPACK_STDIO +/** + * Generates a json-like debug description of the given tag into the given buffer. + * + * This is only available in debug mode, and only if stdio is available (since + * it uses snprintf().) It's strictly for debugging purposes. + * + * The prefix is used to print the first few hexadecimal bytes of a bin or ext + * type. Pass NULL if not a bin or ext. + */ +void mpack_tag_debug_pseudo_json(mpack_tag_t tag, char* buffer, size_t buffer_size, + const char* prefix, size_t prefix_size); + +/** + * Generates a debug string description of the given tag into the given buffer. + * + * This is only available in debug mode, and only if stdio is available (since + * it uses snprintf().) It's strictly for debugging purposes. + */ +void mpack_tag_debug_describe(mpack_tag_t tag, char* buffer, size_t buffer_size); + +/** @cond */ + +/* + * A callback function for printing pseudo-JSON for debugging purposes. + * + * @see mpack_node_print_callback + */ +typedef void (*mpack_print_callback_t)(void* context, const char* data, size_t count); + +// helpers for printing debug output +// i feel a bit like i'm re-implementing a buffered writer again... +typedef struct mpack_print_t { + char* buffer; + size_t size; + size_t count; + mpack_print_callback_t callback; + void* context; +} mpack_print_t; + +void mpack_print_append(mpack_print_t* print, const char* data, size_t count); + +MPACK_INLINE void mpack_print_append_cstr(mpack_print_t* print, const char* cstr) { + mpack_print_append(print, cstr, mpack_strlen(cstr)); +} + +void mpack_print_flush(mpack_print_t* print); + +void mpack_print_file_callback(void* context, const char* data, size_t count); + +/** @endcond */ + +#endif + +/** + * @} + */ + +/** + * @name Deprecated Tag Generators + * @{ + */ + +/* + * "make" has been added to their names to disambiguate them from the + * value-fetching functions (e.g. mpack_tag_make_bool() vs + * mpack_tag_bool_value().) + * + * The length and count for all compound types was the wrong sign (int32_t + * instead of uint32_t.) These preserve the old behaviour; the new "make" + * functions have the correct sign. + */ + +/** \deprecated Renamed to mpack_tag_make_nil(). */ +MPACK_INLINE mpack_tag_t mpack_tag_nil(void) { + return mpack_tag_make_nil(); +} + +/** \deprecated Renamed to mpack_tag_make_bool(). */ +MPACK_INLINE mpack_tag_t mpack_tag_bool(bool value) { + return mpack_tag_make_bool(value); +} + +/** \deprecated Renamed to mpack_tag_make_true(). */ +MPACK_INLINE mpack_tag_t mpack_tag_true(void) { + return mpack_tag_make_true(); +} + +/** \deprecated Renamed to mpack_tag_make_false(). */ +MPACK_INLINE mpack_tag_t mpack_tag_false(void) { + return mpack_tag_make_false(); +} + +/** \deprecated Renamed to mpack_tag_make_int(). */ +MPACK_INLINE mpack_tag_t mpack_tag_int(int64_t value) { + return mpack_tag_make_int(value); +} + +/** \deprecated Renamed to mpack_tag_make_uint(). */ +MPACK_INLINE mpack_tag_t mpack_tag_uint(uint64_t value) { + return mpack_tag_make_uint(value); +} + +/** \deprecated Renamed to mpack_tag_make_float(). */ +MPACK_INLINE mpack_tag_t mpack_tag_float(float value) { + return mpack_tag_make_float(value); +} + +/** \deprecated Renamed to mpack_tag_make_double(). */ +MPACK_INLINE mpack_tag_t mpack_tag_double(double value) { + return mpack_tag_make_double(value); +} + +/** \deprecated Renamed to mpack_tag_make_array(). */ +MPACK_INLINE mpack_tag_t mpack_tag_array(int32_t count) { + return mpack_tag_make_array((uint32_t)count); +} + +/** \deprecated Renamed to mpack_tag_make_map(). */ +MPACK_INLINE mpack_tag_t mpack_tag_map(int32_t count) { + return mpack_tag_make_map((uint32_t)count); +} + +/** \deprecated Renamed to mpack_tag_make_str(). */ +MPACK_INLINE mpack_tag_t mpack_tag_str(int32_t length) { + return mpack_tag_make_str((uint32_t)length); +} + +/** \deprecated Renamed to mpack_tag_make_bin(). */ +MPACK_INLINE mpack_tag_t mpack_tag_bin(int32_t length) { + return mpack_tag_make_bin((uint32_t)length); +} + +#if MPACK_EXTENSIONS +/** \deprecated Renamed to mpack_tag_make_ext(). */ +MPACK_INLINE mpack_tag_t mpack_tag_ext(int8_t exttype, int32_t length) { + return mpack_tag_make_ext(exttype, (uint32_t)length); +} +#endif + +/** + * @} + */ + +/** @cond */ + +/* + * Helpers to perform unaligned network-endian loads and stores + * at arbitrary addresses. Byte-swapping builtins are used if they + * are available and if they improve performance. + * + * These will remain available in the public API so feel free to + * use them for other purposes, but they are undocumented. + */ + +MPACK_INLINE uint8_t mpack_load_u8(const char* p) { + return (uint8_t)p[0]; +} + +MPACK_INLINE uint16_t mpack_load_u16(const char* p) { + #ifdef MPACK_NHSWAP16 + uint16_t val; + mpack_memcpy(&val, p, sizeof(val)); + return MPACK_NHSWAP16(val); + #else + return (uint16_t)((((uint16_t)(uint8_t)p[0]) << 8) | + ((uint16_t)(uint8_t)p[1])); + #endif +} + +MPACK_INLINE uint32_t mpack_load_u32(const char* p) { + #ifdef MPACK_NHSWAP32 + uint32_t val; + mpack_memcpy(&val, p, sizeof(val)); + return MPACK_NHSWAP32(val); + #else + return (((uint32_t)(uint8_t)p[0]) << 24) | + (((uint32_t)(uint8_t)p[1]) << 16) | + (((uint32_t)(uint8_t)p[2]) << 8) | + ((uint32_t)(uint8_t)p[3]); + #endif +} + +MPACK_INLINE uint64_t mpack_load_u64(const char* p) { + #ifdef MPACK_NHSWAP64 + uint64_t val; + mpack_memcpy(&val, p, sizeof(val)); + return MPACK_NHSWAP64(val); + #else + return (((uint64_t)(uint8_t)p[0]) << 56) | + (((uint64_t)(uint8_t)p[1]) << 48) | + (((uint64_t)(uint8_t)p[2]) << 40) | + (((uint64_t)(uint8_t)p[3]) << 32) | + (((uint64_t)(uint8_t)p[4]) << 24) | + (((uint64_t)(uint8_t)p[5]) << 16) | + (((uint64_t)(uint8_t)p[6]) << 8) | + ((uint64_t)(uint8_t)p[7]); + #endif +} + +MPACK_INLINE void mpack_store_u8(char* p, uint8_t val) { + uint8_t* u = (uint8_t*)p; + u[0] = val; +} + +MPACK_INLINE void mpack_store_u16(char* p, uint16_t val) { + #ifdef MPACK_NHSWAP16 + val = MPACK_NHSWAP16(val); + mpack_memcpy(p, &val, sizeof(val)); + #else + uint8_t* u = (uint8_t*)p; + u[0] = (uint8_t)((val >> 8) & 0xFF); + u[1] = (uint8_t)( val & 0xFF); + #endif +} + +MPACK_INLINE void mpack_store_u32(char* p, uint32_t val) { + #ifdef MPACK_NHSWAP32 + val = MPACK_NHSWAP32(val); + mpack_memcpy(p, &val, sizeof(val)); + #else + uint8_t* u = (uint8_t*)p; + u[0] = (uint8_t)((val >> 24) & 0xFF); + u[1] = (uint8_t)((val >> 16) & 0xFF); + u[2] = (uint8_t)((val >> 8) & 0xFF); + u[3] = (uint8_t)( val & 0xFF); + #endif +} + +MPACK_INLINE void mpack_store_u64(char* p, uint64_t val) { + #ifdef MPACK_NHSWAP64 + val = MPACK_NHSWAP64(val); + mpack_memcpy(p, &val, sizeof(val)); + #else + uint8_t* u = (uint8_t*)p; + u[0] = (uint8_t)((val >> 56) & 0xFF); + u[1] = (uint8_t)((val >> 48) & 0xFF); + u[2] = (uint8_t)((val >> 40) & 0xFF); + u[3] = (uint8_t)((val >> 32) & 0xFF); + u[4] = (uint8_t)((val >> 24) & 0xFF); + u[5] = (uint8_t)((val >> 16) & 0xFF); + u[6] = (uint8_t)((val >> 8) & 0xFF); + u[7] = (uint8_t)( val & 0xFF); + #endif +} + +MPACK_INLINE int8_t mpack_load_i8 (const char* p) {return (int8_t) mpack_load_u8 (p);} +MPACK_INLINE int16_t mpack_load_i16(const char* p) {return (int16_t)mpack_load_u16(p);} +MPACK_INLINE int32_t mpack_load_i32(const char* p) {return (int32_t)mpack_load_u32(p);} +MPACK_INLINE int64_t mpack_load_i64(const char* p) {return (int64_t)mpack_load_u64(p);} +MPACK_INLINE void mpack_store_i8 (char* p, int8_t val) {mpack_store_u8 (p, (uint8_t) val);} +MPACK_INLINE void mpack_store_i16(char* p, int16_t val) {mpack_store_u16(p, (uint16_t)val);} +MPACK_INLINE void mpack_store_i32(char* p, int32_t val) {mpack_store_u32(p, (uint32_t)val);} +MPACK_INLINE void mpack_store_i64(char* p, int64_t val) {mpack_store_u64(p, (uint64_t)val);} + +MPACK_INLINE float mpack_load_float(const char* p) { + MPACK_CHECK_FLOAT_ORDER(); + MPACK_STATIC_ASSERT(sizeof(float) == sizeof(uint32_t), "float is wrong size??"); + union { + float f; + uint32_t u; + } v; + v.u = mpack_load_u32(p); + return v.f; +} + +MPACK_INLINE double mpack_load_double(const char* p) { + MPACK_CHECK_FLOAT_ORDER(); + MPACK_STATIC_ASSERT(sizeof(double) == sizeof(uint64_t), "double is wrong size??"); + union { + double d; + uint64_t u; + } v; + v.u = mpack_load_u64(p); + return v.d; +} + +MPACK_INLINE void mpack_store_float(char* p, float value) { + MPACK_CHECK_FLOAT_ORDER(); + union { + float f; + uint32_t u; + } v; + v.f = value; + mpack_store_u32(p, v.u); +} + +MPACK_INLINE void mpack_store_double(char* p, double value) { + MPACK_CHECK_FLOAT_ORDER(); + union { + double d; + uint64_t u; + } v; + v.d = value; + mpack_store_u64(p, v.u); +} + +/** @endcond */ + + + +/** @cond */ + +// Sizes in bytes for the various possible tags +#define MPACK_TAG_SIZE_FIXUINT 1 +#define MPACK_TAG_SIZE_U8 2 +#define MPACK_TAG_SIZE_U16 3 +#define MPACK_TAG_SIZE_U32 5 +#define MPACK_TAG_SIZE_U64 9 +#define MPACK_TAG_SIZE_FIXINT 1 +#define MPACK_TAG_SIZE_I8 2 +#define MPACK_TAG_SIZE_I16 3 +#define MPACK_TAG_SIZE_I32 5 +#define MPACK_TAG_SIZE_I64 9 +#define MPACK_TAG_SIZE_FLOAT 5 +#define MPACK_TAG_SIZE_DOUBLE 9 +#define MPACK_TAG_SIZE_FIXARRAY 1 +#define MPACK_TAG_SIZE_ARRAY16 3 +#define MPACK_TAG_SIZE_ARRAY32 5 +#define MPACK_TAG_SIZE_FIXMAP 1 +#define MPACK_TAG_SIZE_MAP16 3 +#define MPACK_TAG_SIZE_MAP32 5 +#define MPACK_TAG_SIZE_FIXSTR 1 +#define MPACK_TAG_SIZE_STR8 2 +#define MPACK_TAG_SIZE_STR16 3 +#define MPACK_TAG_SIZE_STR32 5 +#define MPACK_TAG_SIZE_BIN8 2 +#define MPACK_TAG_SIZE_BIN16 3 +#define MPACK_TAG_SIZE_BIN32 5 +#define MPACK_TAG_SIZE_FIXEXT1 2 +#define MPACK_TAG_SIZE_FIXEXT2 2 +#define MPACK_TAG_SIZE_FIXEXT4 2 +#define MPACK_TAG_SIZE_FIXEXT8 2 +#define MPACK_TAG_SIZE_FIXEXT16 2 +#define MPACK_TAG_SIZE_EXT8 3 +#define MPACK_TAG_SIZE_EXT16 4 +#define MPACK_TAG_SIZE_EXT32 6 + +// size in bytes for complete ext types +#define MPACK_EXT_SIZE_TIMESTAMP4 (MPACK_TAG_SIZE_FIXEXT4 + 4) +#define MPACK_EXT_SIZE_TIMESTAMP8 (MPACK_TAG_SIZE_FIXEXT8 + 8) +#define MPACK_EXT_SIZE_TIMESTAMP12 (MPACK_TAG_SIZE_EXT8 + 12) + +/** @endcond */ + + + +#if MPACK_READ_TRACKING || MPACK_WRITE_TRACKING +/* Tracks the write state of compound elements (maps, arrays, */ +/* strings, binary blobs and extension types) */ +/** @cond */ + +typedef struct mpack_track_element_t { + mpack_type_t type; + uint32_t left; + + // indicates that a value still needs to be read/written for an already + // read/written key. left is not decremented until both key and value are + // read/written. + bool key_needs_value; +} mpack_track_element_t; + +typedef struct mpack_track_t { + size_t count; + size_t capacity; + mpack_track_element_t* elements; +} mpack_track_t; + +#if MPACK_INTERNAL +mpack_error_t mpack_track_init(mpack_track_t* track); +mpack_error_t mpack_track_grow(mpack_track_t* track); +mpack_error_t mpack_track_push(mpack_track_t* track, mpack_type_t type, uint32_t count); +mpack_error_t mpack_track_pop(mpack_track_t* track, mpack_type_t type); +mpack_error_t mpack_track_element(mpack_track_t* track, bool read); +mpack_error_t mpack_track_peek_element(mpack_track_t* track, bool read); +mpack_error_t mpack_track_bytes(mpack_track_t* track, bool read, size_t count); +mpack_error_t mpack_track_str_bytes_all(mpack_track_t* track, bool read, size_t count); +mpack_error_t mpack_track_check_empty(mpack_track_t* track); +mpack_error_t mpack_track_destroy(mpack_track_t* track, bool cancel); +#endif + +/** @endcond */ +#endif + + + +#if MPACK_INTERNAL +/** @cond */ + + + +/* Miscellaneous string functions */ + +/** + * Returns true if the given UTF-8 string is valid. + */ +bool mpack_utf8_check(const char* str, size_t bytes); + +/** + * Returns true if the given UTF-8 string is valid and contains no null characters. + */ +bool mpack_utf8_check_no_null(const char* str, size_t bytes); + +/** + * Returns true if the given string has no null bytes. + */ +bool mpack_str_check_no_null(const char* str, size_t bytes); + + + +/** @endcond */ +#endif + + + +/** + * @} + */ + +/** + * @} + */ + +MPACK_EXTERN_C_END +MPACK_HEADER_END + +#endif + + +/* mpack/mpack-writer.h.h */ + +/** + * @file + * + * Declares the MPack Writer. + */ + +#ifndef MPACK_WRITER_H +#define MPACK_WRITER_H 1 + +/* #include "mpack-common.h" */ + +#if MPACK_WRITER + +MPACK_HEADER_START +MPACK_EXTERN_C_START + +#if MPACK_WRITE_TRACKING +struct mpack_track_t; +#endif + +/** + * @defgroup writer Write API + * + * The MPack Write API encodes structured data of a fixed (hardcoded) schema to MessagePack. + * + * @{ + */ + +/** + * @def MPACK_WRITER_MINIMUM_BUFFER_SIZE + * + * The minimum buffer size for a writer with a flush function. + */ +#define MPACK_WRITER_MINIMUM_BUFFER_SIZE 32 + +/** + * A buffered MessagePack encoder. + * + * The encoder wraps an existing buffer and, optionally, a flush function. + * This allows efficiently encoding to an in-memory buffer or to a stream. + * + * All write operations are synchronous; they will block until the + * data is fully written, or an error occurs. + */ +typedef struct mpack_writer_t mpack_writer_t; + +/** + * The MPack writer's flush function to flush the buffer to the output stream. + * It should flag an appropriate error on the writer if flushing fails (usually + * mpack_error_io or mpack_error_memory.) + * + * The specified context for callbacks is at writer->context. + */ +typedef void (*mpack_writer_flush_t)(mpack_writer_t* writer, const char* buffer, size_t count); + +/** + * An error handler function to be called when an error is flagged on + * the writer. + * + * The error handler will only be called once on the first error flagged; + * any subsequent writes and errors are ignored, and the writer is + * permanently in that error state. + * + * MPack is safe against non-local jumps out of error handler callbacks. + * This means you are allowed to longjmp or throw an exception (in C++, + * Objective-C, or with SEH) out of this callback. + * + * Bear in mind when using longjmp that local non-volatile variables that + * have changed are undefined when setjmp() returns, so you can't put the + * writer on the stack in the same activation frame as the setjmp without + * declaring it volatile. + * + * You must still eventually destroy the writer. It is not destroyed + * automatically when an error is flagged. It is safe to destroy the + * writer within this error callback, but you will either need to perform + * a non-local jump, or store something in your context to identify + * that the writer is destroyed since any future accesses to it cause + * undefined behavior. + */ +typedef void (*mpack_writer_error_t)(mpack_writer_t* writer, mpack_error_t error); + +/** + * A teardown function to be called when the writer is destroyed. + */ +typedef void (*mpack_writer_teardown_t)(mpack_writer_t* writer); + +/* Hide internals from documentation */ +/** @cond */ + +struct mpack_writer_t { + #if MPACK_COMPATIBILITY + mpack_version_t version; /* Version of the MessagePack spec to write */ + #endif + mpack_writer_flush_t flush; /* Function to write bytes to the output stream */ + mpack_writer_error_t error_fn; /* Function to call on error */ + mpack_writer_teardown_t teardown; /* Function to teardown the context on destroy */ + void* context; /* Context for writer callbacks */ + + char* buffer; /* Byte buffer */ + char* current; /* Current position within the buffer */ + char* end; /* The end of the buffer */ + mpack_error_t error; /* Error state */ + + #if MPACK_WRITE_TRACKING + mpack_track_t track; /* Stack of map/array/str/bin/ext writes */ + #endif + + #ifdef MPACK_MALLOC + /* Reserved. You can use this space to allocate a custom + * context in order to reduce heap allocations. */ + void* reserved[2]; + #endif +}; + +#if MPACK_WRITE_TRACKING +void mpack_writer_track_push(mpack_writer_t* writer, mpack_type_t type, uint32_t count); +void mpack_writer_track_pop(mpack_writer_t* writer, mpack_type_t type); +void mpack_writer_track_element(mpack_writer_t* writer); +void mpack_writer_track_bytes(mpack_writer_t* writer, size_t count); +#else +MPACK_INLINE void mpack_writer_track_push(mpack_writer_t* writer, mpack_type_t type, uint32_t count) { + MPACK_UNUSED(writer); + MPACK_UNUSED(type); + MPACK_UNUSED(count); +} +MPACK_INLINE void mpack_writer_track_pop(mpack_writer_t* writer, mpack_type_t type) { + MPACK_UNUSED(writer); + MPACK_UNUSED(type); +} +MPACK_INLINE void mpack_writer_track_element(mpack_writer_t* writer) { + MPACK_UNUSED(writer); +} +MPACK_INLINE void mpack_writer_track_bytes(mpack_writer_t* writer, size_t count) { + MPACK_UNUSED(writer); + MPACK_UNUSED(count); +} +#endif + +/** @endcond */ + +/** + * @name Lifecycle Functions + * @{ + */ + +/** + * Initializes an MPack writer with the given buffer. The writer + * does not assume ownership of the buffer. + * + * Trying to write past the end of the buffer will result in mpack_error_too_big + * unless a flush function is set with mpack_writer_set_flush(). To use the data + * without flushing, call mpack_writer_buffer_used() to determine the number of + * bytes written. + * + * @param writer The MPack writer. + * @param buffer The buffer into which to write MessagePack data. + * @param size The size of the buffer. + */ +void mpack_writer_init(mpack_writer_t* writer, char* buffer, size_t size); + +#ifdef MPACK_MALLOC +/** + * Initializes an MPack writer using a growable buffer. + * + * The data is placed in the given data pointer if and when the writer + * is destroyed without error. The data pointer is NULL during writing, + * and will remain NULL if an error occurs. + * + * The allocated data must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * + * @throws mpack_error_memory if the buffer fails to grow when + * flushing. + * + * @param writer The MPack writer. + * @param data Where to place the allocated data. + * @param size Where to write the size of the data. + */ +void mpack_writer_init_growable(mpack_writer_t* writer, char** data, size_t* size); +#endif + +/** + * Initializes an MPack writer directly into an error state. Use this if you + * are writing a wrapper to mpack_writer_init() which can fail its setup. + */ +void mpack_writer_init_error(mpack_writer_t* writer, mpack_error_t error); + +#if MPACK_STDIO +/** + * Initializes an MPack writer that writes to a file. + * + * @throws mpack_error_memory if allocation fails + * @throws mpack_error_io if the file cannot be opened + */ +void mpack_writer_init_filename(mpack_writer_t* writer, const char* filename); + +/** + * Deprecated. + * + * \deprecated Renamed to mpack_writer_init_filename(). + */ +MPACK_INLINE void mpack_writer_init_file(mpack_writer_t* writer, const char* filename) { + mpack_writer_init_filename(writer, filename); +} + +/** + * Initializes an MPack writer that writes to a libc FILE. This can be used to + * write to stdout or stderr, or to a file opened separately. + * + * @param writer The MPack writer. + * @param stdfile The FILE. + * @param close_when_done If true, fclose() will be called on the FILE when it + * is no longer needed. If false, the file will not be flushed or + * closed when writing is done. + * + * @note The writer is buffered. If you want to write other data to the FILE in + * between messages, you must flush it first. + * + * @see mpack_writer_flush_message + */ +void mpack_writer_init_stdfile(mpack_writer_t* writer, FILE* stdfile, bool close_when_done); +#endif + +/** @cond */ + +#define mpack_writer_init_stack_line_ex(line, writer) \ + char mpack_buf_##line[MPACK_STACK_SIZE]; \ + mpack_writer_init(writer, mpack_buf_##line, sizeof(mpack_buf_##line)) + +#define mpack_writer_init_stack_line(line, writer) \ + mpack_writer_init_stack_line_ex(line, writer) + +/* + * Initializes an MPack writer using stack space as a buffer. A flush function + * should be added to the writer to flush the buffer. + * + * This is currently undocumented since it's not entirely useful on its own. + */ + +#define mpack_writer_init_stack(writer) \ + mpack_writer_init_stack_line(__LINE__, (writer)) + +/** @endcond */ + +/** + * Cleans up the MPack writer, flushing and closing the underlying stream, + * if any. Returns the final error state of the writer. + * + * No flushing is performed if the writer is in an error state. The attached + * teardown function is called whether or not the writer is in an error state. + * + * This will assert in tracking mode if the writer is not in an error + * state and has any unclosed compound types. If you want to cancel + * writing in the middle of a document, you need to flag an error on + * the writer before destroying it (such as mpack_error_data). + * + * Note that a writer may raise an error and call your error handler during + * the final flush. It is safe to longjmp or throw out of this error handler, + * but if you do, the writer will not be destroyed, and the teardown function + * will not be called. You can still get the writer's error state, and you + * must call @ref mpack_writer_destroy() again. (The second call is guaranteed + * not to call your error handler again since the writer is already in an error + * state.) + * + * @see mpack_writer_set_error_handler + * @see mpack_writer_set_flush + * @see mpack_writer_set_teardown + * @see mpack_writer_flag_error + * @see mpack_error_data + */ +mpack_error_t mpack_writer_destroy(mpack_writer_t* writer); + +/** + * @} + */ + +/** + * @name Configuration + * @{ + */ + +#if MPACK_COMPATIBILITY +/** + * Sets the version of the MessagePack spec that will be generated. + * + * This can be used to interface with older libraries that do not support + * the newest MessagePack features (such as the @c str8 type.) + * + * @note This requires @ref MPACK_COMPATIBILITY. + */ +MPACK_INLINE void mpack_writer_set_version(mpack_writer_t* writer, mpack_version_t version) { + writer->version = version; +} +#endif + +/** + * Sets the custom pointer to pass to the writer callbacks, such as flush + * or teardown. + * + * @param writer The MPack writer. + * @param context User data to pass to the writer callbacks. + * + * @see mpack_writer_context() + */ +MPACK_INLINE void mpack_writer_set_context(mpack_writer_t* writer, void* context) { + writer->context = context; +} + +/** + * Returns the custom context for writer callbacks. + * + * @see mpack_writer_set_context + * @see mpack_writer_set_flush + */ +MPACK_INLINE void* mpack_writer_context(mpack_writer_t* writer) { + return writer->context; +} + +/** + * Sets the flush function to write out the data when the buffer is full. + * + * If no flush function is used, trying to write past the end of the + * buffer will result in mpack_error_too_big. + * + * This should normally be used with mpack_writer_set_context() to register + * a custom pointer to pass to the flush function. + * + * @param writer The MPack writer. + * @param flush The function to write out data from the buffer. + * + * @see mpack_writer_context() + */ +void mpack_writer_set_flush(mpack_writer_t* writer, mpack_writer_flush_t flush); + +/** + * Sets the error function to call when an error is flagged on the writer. + * + * This should normally be used with mpack_writer_set_context() to register + * a custom pointer to pass to the error function. + * + * See the definition of mpack_writer_error_t for more information about + * what you can do from an error callback. + * + * @see mpack_writer_error_t + * @param writer The MPack writer. + * @param error_fn The function to call when an error is flagged on the writer. + */ +MPACK_INLINE void mpack_writer_set_error_handler(mpack_writer_t* writer, mpack_writer_error_t error_fn) { + writer->error_fn = error_fn; +} + +/** + * Sets the teardown function to call when the writer is destroyed. + * + * This should normally be used with mpack_writer_set_context() to register + * a custom pointer to pass to the teardown function. + * + * @param writer The MPack writer. + * @param teardown The function to call when the writer is destroyed. + */ +MPACK_INLINE void mpack_writer_set_teardown(mpack_writer_t* writer, mpack_writer_teardown_t teardown) { + writer->teardown = teardown; +} + +/** + * @} + */ + +/** + * @name Core Writer Functions + * @{ + */ + +/** + * Flushes any buffered data to the underlying stream. + * + * If write tracking is enabled, this will break and flag @ref + * mpack_error_bug if the writer has any open compound types, ensuring + * that no compound types are still open. This prevents a "missing + * finish" bug from causing a never-ending message. + * + * If the writer is connected to a socket and you are keeping it open, + * you will want to call this after writing a message (or set of + * messages) so that the data is actually sent. + * + * It is not necessary to call this if you are not keeping the writer + * open afterwards. You can just call `mpack_writer_destroy()`, and it + * will flush before cleaning up. + * + * This will assert if no flush function is assigned to the writer. + */ +void mpack_writer_flush_message(mpack_writer_t* writer); + +/** + * Returns the number of bytes currently stored in the buffer. This + * may be less than the total number of bytes written if bytes have + * been flushed to an underlying stream. + */ +MPACK_INLINE size_t mpack_writer_buffer_used(mpack_writer_t* writer) { + return (size_t)(writer->current - writer->buffer); +} + +/** + * Returns the amount of space left in the buffer. This may be reset + * after a write if bytes are flushed to an underlying stream. + */ +MPACK_INLINE size_t mpack_writer_buffer_left(mpack_writer_t* writer) { + return (size_t)(writer->end - writer->current); +} + +/** + * Returns the (current) size of the buffer. This may change after a write if + * the flush callback changes the buffer. + */ +MPACK_INLINE size_t mpack_writer_buffer_size(mpack_writer_t* writer) { + return (size_t)(writer->end - writer->buffer); +} + +/** + * Places the writer in the given error state, calling the error callback if one + * is set. + * + * This allows you to externally flag errors, for example if you are validating + * data as you write it, or if you want to cancel writing in the middle of a + * document. (The writer will assert if you try to destroy it without error and + * with unclosed compound types. In this case you should flag mpack_error_data + * before destroying it.) + * + * If the writer is already in an error state, this call is ignored and no + * error callback is called. + * + * @see mpack_writer_destroy + * @see mpack_error_data + */ +void mpack_writer_flag_error(mpack_writer_t* writer, mpack_error_t error); + +/** + * Queries the error state of the MPack writer. + * + * If a writer is in an error state, you should discard all data since the + * last time the error flag was checked. The error flag cannot be cleared. + */ +MPACK_INLINE mpack_error_t mpack_writer_error(mpack_writer_t* writer) { + return writer->error; +} + +/** + * Writes a MessagePack object header (an MPack Tag.) + * + * If the value is a map, array, string, binary or extension type, the + * containing elements or bytes must be written separately and the + * appropriate finish function must be called (as though one of the + * mpack_start_*() functions was called.) + * + * @see mpack_write_bytes() + * @see mpack_finish_map() + * @see mpack_finish_array() + * @see mpack_finish_str() + * @see mpack_finish_bin() + * @see mpack_finish_ext() + * @see mpack_finish_type() + */ +void mpack_write_tag(mpack_writer_t* writer, mpack_tag_t tag); + +/** + * @} + */ + +/** + * @name Integers + * @{ + */ + +/** Writes an 8-bit integer in the most efficient packing available. */ +void mpack_write_i8(mpack_writer_t* writer, int8_t value); + +/** Writes a 16-bit integer in the most efficient packing available. */ +void mpack_write_i16(mpack_writer_t* writer, int16_t value); + +/** Writes a 32-bit integer in the most efficient packing available. */ +void mpack_write_i32(mpack_writer_t* writer, int32_t value); + +/** Writes a 64-bit integer in the most efficient packing available. */ +void mpack_write_i64(mpack_writer_t* writer, int64_t value); + +/** Writes an integer in the most efficient packing available. */ +MPACK_INLINE void mpack_write_int(mpack_writer_t* writer, int64_t value) { + mpack_write_i64(writer, value); +} + +/** Writes an 8-bit unsigned integer in the most efficient packing available. */ +void mpack_write_u8(mpack_writer_t* writer, uint8_t value); + +/** Writes an 16-bit unsigned integer in the most efficient packing available. */ +void mpack_write_u16(mpack_writer_t* writer, uint16_t value); + +/** Writes an 32-bit unsigned integer in the most efficient packing available. */ +void mpack_write_u32(mpack_writer_t* writer, uint32_t value); + +/** Writes an 64-bit unsigned integer in the most efficient packing available. */ +void mpack_write_u64(mpack_writer_t* writer, uint64_t value); + +/** Writes an unsigned integer in the most efficient packing available. */ +MPACK_INLINE void mpack_write_uint(mpack_writer_t* writer, uint64_t value) { + mpack_write_u64(writer, value); +} + +/** + * @} + */ + +/** + * @name Other Basic Types + * @{ + */ + +/** Writes a float. */ +void mpack_write_float(mpack_writer_t* writer, float value); + +/** Writes a double. */ +void mpack_write_double(mpack_writer_t* writer, double value); + +/** Writes a boolean. */ +void mpack_write_bool(mpack_writer_t* writer, bool value); + +/** Writes a boolean with value true. */ +void mpack_write_true(mpack_writer_t* writer); + +/** Writes a boolean with value false. */ +void mpack_write_false(mpack_writer_t* writer); + +/** Writes a nil. */ +void mpack_write_nil(mpack_writer_t* writer); + +/** Write a pre-encoded messagepack object */ +void mpack_write_object_bytes(mpack_writer_t* writer, const char* data, size_t bytes); + +#if MPACK_EXTENSIONS +/** + * Writes a timestamp. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @param writer The writer + * @param seconds The (signed) number of seconds since 1970-01-01T00:00:00Z. + * @param nanoseconds The additional number of nanoseconds from 0 to 999,999,999 inclusive. + */ +void mpack_write_timestamp(mpack_writer_t* writer, int64_t seconds, uint32_t nanoseconds); + +/** + * Writes a timestamp with the given number of seconds (and zero nanoseconds). + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @param writer The writer + * @param seconds The (signed) number of seconds since 1970-01-01T00:00:00Z. + */ +MPACK_INLINE void mpack_write_timestamp_seconds(mpack_writer_t* writer, int64_t seconds) { + mpack_write_timestamp(writer, seconds, 0); +} + +/** + * Writes a timestamp. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +MPACK_INLINE void mpack_write_timestamp_struct(mpack_writer_t* writer, mpack_timestamp_t timestamp) { + mpack_write_timestamp(writer, timestamp.seconds, timestamp.nanoseconds); +} +#endif + +/** + * @} + */ + +/** + * @name Map and Array Functions + * @{ + */ + +/** + * Opens an array. + * + * `count` elements must follow, and mpack_finish_array() must be called + * when done. + * + * @see mpack_finish_array() + */ +void mpack_start_array(mpack_writer_t* writer, uint32_t count); + +/** + * Opens a map. + * + * `count * 2` elements must follow, and mpack_finish_map() must be called + * when done. + * + * Remember that while map elements in MessagePack are implicitly ordered, + * they are not ordered in JSON. If you need elements to be read back + * in the order they are written, consider use an array instead. + * + * @see mpack_finish_map() + */ +void mpack_start_map(mpack_writer_t* writer, uint32_t count); + +/** + * Finishes writing an array. + * + * This should be called only after a corresponding call to mpack_start_array() + * and after the array contents are written. + * + * This will track writes to ensure that the correct number of elements are written. + * + * @see mpack_start_array() + */ +MPACK_INLINE void mpack_finish_array(mpack_writer_t* writer) { + mpack_writer_track_pop(writer, mpack_type_array); +} + +/** + * Finishes writing a map. + * + * This should be called only after a corresponding call to mpack_start_map() + * and after the map contents are written. + * + * This will track writes to ensure that the correct number of elements are written. + * + * @see mpack_start_map() + */ +MPACK_INLINE void mpack_finish_map(mpack_writer_t* writer) { + mpack_writer_track_pop(writer, mpack_type_map); +} + +/** + * @} + */ + +/** + * @name Data Helpers + * @{ + */ + +/** + * Writes a string. + * + * To stream a string in chunks, use mpack_start_str() instead. + * + * MPack does not care about the underlying encoding, but UTF-8 is highly + * recommended, especially for compatibility with JSON. You should consider + * calling mpack_write_utf8() instead, especially if you will be reading + * it back as UTF-8. + * + * You should not call mpack_finish_str() after calling this; this + * performs both start and finish. + */ +void mpack_write_str(mpack_writer_t* writer, const char* str, uint32_t length); + +/** + * Writes a string, ensuring that it is valid UTF-8. + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed. + * + * You should not call mpack_finish_str() after calling this; this + * performs both start and finish. + * + * @throws mpack_error_invalid if the string is not valid UTF-8 + */ +void mpack_write_utf8(mpack_writer_t* writer, const char* str, uint32_t length); + +/** + * Writes a null-terminated string. (The null-terminator is not written.) + * + * MPack does not care about the underlying encoding, but UTF-8 is highly + * recommended, especially for compatibility with JSON. You should consider + * calling mpack_write_utf8_cstr() instead, especially if you will be reading + * it back as UTF-8. + * + * You should not call mpack_finish_str() after calling this; this + * performs both start and finish. + */ +void mpack_write_cstr(mpack_writer_t* writer, const char* cstr); + +/** + * Writes a null-terminated string, or a nil node if the given cstr pointer + * is NULL. (The null-terminator is not written.) + * + * MPack does not care about the underlying encoding, but UTF-8 is highly + * recommended, especially for compatibility with JSON. You should consider + * calling mpack_write_utf8_cstr_or_nil() instead, especially if you will + * be reading it back as UTF-8. + * + * You should not call mpack_finish_str() after calling this; this + * performs both start and finish. + */ +void mpack_write_cstr_or_nil(mpack_writer_t* writer, const char* cstr); + +/** + * Writes a null-terminated string, ensuring that it is valid UTF-8. (The + * null-terminator is not written.) + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed. + * + * You should not call mpack_finish_str() after calling this; this + * performs both start and finish. + * + * @throws mpack_error_invalid if the string is not valid UTF-8 + */ +void mpack_write_utf8_cstr(mpack_writer_t* writer, const char* cstr); + +/** + * Writes a null-terminated string ensuring that it is valid UTF-8, or + * writes nil if the given cstr pointer is NULL. (The null-terminator + * is not written.) + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed. + * + * You should not call mpack_finish_str() after calling this; this + * performs both start and finish. + * + * @throws mpack_error_invalid if the string is not valid UTF-8 + */ +void mpack_write_utf8_cstr_or_nil(mpack_writer_t* writer, const char* cstr); + +/** + * Writes a binary blob. + * + * To stream a binary blob in chunks, use mpack_start_bin() instead. + * + * You should not call mpack_finish_bin() after calling this; this + * performs both start and finish. + */ +void mpack_write_bin(mpack_writer_t* writer, const char* data, uint32_t count); + +#if MPACK_EXTENSIONS +/** + * Writes an extension type. + * + * To stream an extension blob in chunks, use mpack_start_ext() instead. + * + * Extension types [0, 127] are available for application-specific types. Extension + * types [-128, -1] are reserved for future extensions of MessagePack. + * + * You should not call mpack_finish_ext() after calling this; this + * performs both start and finish. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +void mpack_write_ext(mpack_writer_t* writer, int8_t exttype, const char* data, uint32_t count); +#endif + +/** + * @} + */ + +/** + * @name Chunked Data Functions + * @{ + */ + +/** + * Opens a string. `count` bytes should be written with calls to + * mpack_write_bytes(), and mpack_finish_str() should be called + * when done. + * + * To write an entire string at once, use mpack_write_str() or + * mpack_write_cstr() instead. + * + * MPack does not care about the underlying encoding, but UTF-8 is highly + * recommended, especially for compatibility with JSON. + */ +void mpack_start_str(mpack_writer_t* writer, uint32_t count); + +/** + * Opens a binary blob. `count` bytes should be written with calls to + * mpack_write_bytes(), and mpack_finish_bin() should be called + * when done. + */ +void mpack_start_bin(mpack_writer_t* writer, uint32_t count); + +#if MPACK_EXTENSIONS +/** + * Opens an extension type. `count` bytes should be written with calls + * to mpack_write_bytes(), and mpack_finish_ext() should be called + * when done. + * + * Extension types [0, 127] are available for application-specific types. Extension + * types [-128, -1] are reserved for future extensions of MessagePack. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +void mpack_start_ext(mpack_writer_t* writer, int8_t exttype, uint32_t count); +#endif + +/** + * Writes a portion of bytes for a string, binary blob or extension type which + * was opened by mpack_write_tag() or one of the mpack_start_*() functions. + * + * This can be called multiple times to write the data in chunks, as long as + * the total amount of bytes written matches the count given when the compound + * type was started. + * + * The corresponding mpack_finish_*() function must be called when done. + * + * To write an entire string, binary blob or extension type at + * once, use one of the mpack_write_*() functions instead. + * + * @see mpack_write_tag() + * @see mpack_start_str() + * @see mpack_start_bin() + * @see mpack_start_ext() + * @see mpack_finish_str() + * @see mpack_finish_bin() + * @see mpack_finish_ext() + * @see mpack_finish_type() + */ +void mpack_write_bytes(mpack_writer_t* writer, const char* data, size_t count); + +/** + * Finishes writing a string. + * + * This should be called only after a corresponding call to mpack_start_str() + * and after the string bytes are written with mpack_write_bytes(). + * + * This will track writes to ensure that the correct number of elements are written. + * + * @see mpack_start_str() + * @see mpack_write_bytes() + */ +MPACK_INLINE void mpack_finish_str(mpack_writer_t* writer) { + mpack_writer_track_pop(writer, mpack_type_str); +} + +/** + * Finishes writing a binary blob. + * + * This should be called only after a corresponding call to mpack_start_bin() + * and after the binary bytes are written with mpack_write_bytes(). + * + * This will track writes to ensure that the correct number of bytes are written. + * + * @see mpack_start_bin() + * @see mpack_write_bytes() + */ +MPACK_INLINE void mpack_finish_bin(mpack_writer_t* writer) { + mpack_writer_track_pop(writer, mpack_type_bin); +} + +#if MPACK_EXTENSIONS +/** + * Finishes writing an extended type binary data blob. + * + * This should be called only after a corresponding call to mpack_start_bin() + * and after the binary bytes are written with mpack_write_bytes(). + * + * This will track writes to ensure that the correct number of bytes are written. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @see mpack_start_ext() + * @see mpack_write_bytes() + */ +MPACK_INLINE void mpack_finish_ext(mpack_writer_t* writer) { + mpack_writer_track_pop(writer, mpack_type_ext); +} +#endif + +/** + * Finishes writing the given compound type. + * + * This will track writes to ensure that the correct number of elements + * or bytes are written. + * + * This can be called with the appropriate type instead the corresponding + * mpack_finish_*() function if you want to finish a dynamic type. + */ +MPACK_INLINE void mpack_finish_type(mpack_writer_t* writer, mpack_type_t type) { + mpack_writer_track_pop(writer, type); +} + +/** + * @} + */ + +#if MPACK_HAS_GENERIC && !defined(__cplusplus) + +/** + * @name Type-Generic Writers + * @{ + */ + +/** + * @def mpack_write(writer, value) + * + * Type-generic writer for primitive types. + * + * The compiler will dispatch to an appropriate write function based + * on the type of the @a value parameter. + * + * @note This requires C11 `_Generic` support. (A set of inline overloads + * are used in C++ to provide the same functionality.) + * + * @warning In C11, the indentifiers `true`, `false` and `NULL` are + * all of type `int`, not `bool` or `void*`! They will emit unexpected + * types when passed uncast, so be careful when using them. + */ +#define mpack_write(writer, value) \ + _Generic(((void)0, value), \ + int8_t: mpack_write_i8, \ + int16_t: mpack_write_i16, \ + int32_t: mpack_write_i32, \ + int64_t: mpack_write_i64, \ + uint8_t: mpack_write_u8, \ + uint16_t: mpack_write_u16, \ + uint32_t: mpack_write_u32, \ + uint64_t: mpack_write_u64, \ + bool: mpack_write_bool, \ + float: mpack_write_float, \ + double: mpack_write_double, \ + char *: mpack_write_cstr_or_nil, \ + const char *: mpack_write_cstr_or_nil \ + )(writer, value) + +/** + * @def mpack_write_kv(writer, key, value) + * + * Type-generic writer for key-value pairs of null-terminated string + * keys and primitive values. + * + * @warning @a writer may be evaluated multiple times. + * + * @warning In C11, the indentifiers `true`, `false` and `NULL` are + * all of type `int`, not `bool` or `void*`! They will emit unexpected + * types when passed uncast, so be careful when using them. + * + * @param writer The writer. + * @param key A null-terminated C string. + * @param value A primitive type supported by mpack_write(). + */ +#define mpack_write_kv(writer, key, value) do { \ + mpack_write_cstr(writer, key); \ + mpack_write(writer, value); \ +} while (0) + +/** + * @} + */ + +#endif // MPACK_HAS_GENERIC && !defined(__cplusplus) + +// The rest of this file contains C++ overloads, so we end extern "C" here. +MPACK_EXTERN_C_END + +#if defined(__cplusplus) || defined(MPACK_DOXYGEN) + +/** + * @name C++ write overloads + * @{ + */ + +/* + * C++ generic writers for primitive values + */ + +#ifdef MPACK_DOXYGEN +#undef mpack_write +#undef mpack_write_kv +#endif + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) { + mpack_write_i8(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) { + mpack_write_i16(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, int32_t value) { + mpack_write_i32(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, int64_t value) { + mpack_write_i64(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint8_t value) { + mpack_write_u8(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint16_t value) { + mpack_write_u16(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint32_t value) { + mpack_write_u32(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint64_t value) { + mpack_write_u64(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, bool value) { + mpack_write_bool(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, float value) { + mpack_write_float(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, double value) { + mpack_write_double(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, char *value) { + mpack_write_cstr_or_nil(writer, value); +} + +MPACK_INLINE void mpack_write(mpack_writer_t* writer, const char *value) { + mpack_write_cstr_or_nil(writer, value); +} + +/* C++ generic write for key-value pairs */ + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int8_t value) { + mpack_write_cstr(writer, key); + mpack_write_i8(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int16_t value) { + mpack_write_cstr(writer, key); + mpack_write_i16(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int32_t value) { + mpack_write_cstr(writer, key); + mpack_write_i32(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int64_t value) { + mpack_write_cstr(writer, key); + mpack_write_i64(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint8_t value) { + mpack_write_cstr(writer, key); + mpack_write_u8(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint16_t value) { + mpack_write_cstr(writer, key); + mpack_write_u16(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint32_t value) { + mpack_write_cstr(writer, key); + mpack_write_u32(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint64_t value) { + mpack_write_cstr(writer, key); + mpack_write_u64(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, bool value) { + mpack_write_cstr(writer, key); + mpack_write_bool(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, float value) { + mpack_write_cstr(writer, key); + mpack_write_float(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, double value) { + mpack_write_cstr(writer, key); + mpack_write_double(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, char *value) { + mpack_write_cstr(writer, key); + mpack_write_cstr_or_nil(writer, value); +} + +MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, const char *value) { + mpack_write_cstr(writer, key); + mpack_write_cstr_or_nil(writer, value); +} + +/** + * @} + */ + +#endif /* __cplusplus */ + +/** + * @} + */ + +MPACK_HEADER_END + +#endif // MPACK_WRITER + +#endif + +/* mpack/mpack-reader.h.h */ + +/** + * @file + * + * Declares the core MPack Tag Reader. + */ + +#ifndef MPACK_READER_H +#define MPACK_READER_H 1 + +/* #include "mpack-common.h" */ + +MPACK_HEADER_START +MPACK_EXTERN_C_START + +#if MPACK_READER + +#if MPACK_READ_TRACKING +struct mpack_track_t; +#endif + +// The denominator to determine whether a read is a small +// fraction of the buffer size. +#define MPACK_READER_SMALL_FRACTION_DENOMINATOR 32 + +/** + * @defgroup reader Reader API + * + * The MPack Reader API contains functions for imperatively reading dynamically + * typed data from a MessagePack stream. + * + * See @ref docs/reader.md for examples. + * + * @note If you are not writing code for an embedded device (or otherwise do + * not need maximum performance with minimal memory usage), you should not use + * this. You probably want to use the @link node Node API@endlink instead. + * + * This forms the basis of the @link expect Expect API@endlink, which can be + * used to interpret the stream of elements in expected types and value ranges. + * + * @{ + */ + +/** + * @def MPACK_READER_MINIMUM_BUFFER_SIZE + * + * The minimum buffer size for a reader with a fill function. + */ +#define MPACK_READER_MINIMUM_BUFFER_SIZE 32 + +/** + * A buffered MessagePack decoder. + * + * The decoder wraps an existing buffer and, optionally, a fill function. + * This allows efficiently decoding data from existing memory buffers, files, + * streams, etc. + * + * All read operations are synchronous; they will block until the + * requested data is fully read, or an error occurs. + * + * This structure is opaque; its fields should not be accessed outside + * of MPack. + */ +typedef struct mpack_reader_t mpack_reader_t; + +/** + * The MPack reader's fill function. It should fill the buffer with at + * least one byte and at most the given @c count, returning the number + * of bytes written to the buffer. + * + * In case of error, it should flag an appropriate error on the reader + * (usually @ref mpack_error_io), or simply return zero. If zero is + * returned, mpack_error_io is raised. + * + * @note When reading from a stream, you should only copy and return + * the bytes that are immediately available. It is always safe to return + * less than the requested count as long as some non-zero number of bytes + * are read; if more bytes are needed, the read function will simply be + * called again. + * + * @see mpack_reader_context() + */ +typedef size_t (*mpack_reader_fill_t)(mpack_reader_t* reader, char* buffer, size_t count); + +/** + * The MPack reader's skip function. It should discard the given number + * of bytes from the source (for example by seeking forward.) + * + * In case of error, it should flag an appropriate error on the reader. + * + * @see mpack_reader_context() + */ +typedef void (*mpack_reader_skip_t)(mpack_reader_t* reader, size_t count); + +/** + * An error handler function to be called when an error is flagged on + * the reader. + * + * The error handler will only be called once on the first error flagged; + * any subsequent reads and errors are ignored, and the reader is + * permanently in that error state. + * + * MPack is safe against non-local jumps out of error handler callbacks. + * This means you are allowed to longjmp or throw an exception (in C++, + * Objective-C, or with SEH) out of this callback. + * + * Bear in mind when using longjmp that local non-volatile variables that + * have changed are undefined when setjmp() returns, so you can't put the + * reader on the stack in the same activation frame as the setjmp without + * declaring it volatile. + * + * You must still eventually destroy the reader. It is not destroyed + * automatically when an error is flagged. It is safe to destroy the + * reader within this error callback, but you will either need to perform + * a non-local jump, or store something in your context to identify + * that the reader is destroyed since any future accesses to it cause + * undefined behavior. + */ +typedef void (*mpack_reader_error_t)(mpack_reader_t* reader, mpack_error_t error); + +/** + * A teardown function to be called when the reader is destroyed. + */ +typedef void (*mpack_reader_teardown_t)(mpack_reader_t* reader); + +/* Hide internals from documentation */ +/** @cond */ + +struct mpack_reader_t { + void* context; /* Context for reader callbacks */ + mpack_reader_fill_t fill; /* Function to read bytes into the buffer */ + mpack_reader_error_t error_fn; /* Function to call on error */ + mpack_reader_teardown_t teardown; /* Function to teardown the context on destroy */ + mpack_reader_skip_t skip; /* Function to skip bytes from the source */ + + char* buffer; /* Writeable byte buffer */ + size_t size; /* Size of the buffer */ + + const char* data; /* Current data pointer (in the buffer, if it is used) */ + const char* end; /* The end of available data (in the buffer, if it is used) */ + + mpack_error_t error; /* Error state */ + + #if MPACK_READ_TRACKING + mpack_track_t track; /* Stack of map/array/str/bin/ext reads */ + #endif +}; + +/** @endcond */ + +/** + * @name Lifecycle Functions + * @{ + */ + +/** + * Initializes an MPack reader with the given buffer. The reader does + * not assume ownership of the buffer, but the buffer must be writeable + * if a fill function will be used to refill it. + * + * @param reader The MPack reader. + * @param buffer The buffer with which to read MessagePack data. + * @param size The size of the buffer. + * @param count The number of bytes already in the buffer. + */ +void mpack_reader_init(mpack_reader_t* reader, char* buffer, size_t size, size_t count); + +/** + * Initializes an MPack reader directly into an error state. Use this if you + * are writing a wrapper to mpack_reader_init() which can fail its setup. + */ +void mpack_reader_init_error(mpack_reader_t* reader, mpack_error_t error); + +/** + * Initializes an MPack reader to parse a pre-loaded contiguous chunk of data. The + * reader does not assume ownership of the data. + * + * @param reader The MPack reader. + * @param data The data to parse. + * @param count The number of bytes pointed to by data. + */ +void mpack_reader_init_data(mpack_reader_t* reader, const char* data, size_t count); + +#if MPACK_STDIO +/** + * Initializes an MPack reader that reads from a file. + * + * The file will be automatically opened and closed by the reader. + */ +void mpack_reader_init_filename(mpack_reader_t* reader, const char* filename); + +/** + * Deprecated. + * + * \deprecated Renamed to mpack_reader_init_filename(). + */ +MPACK_INLINE void mpack_reader_init_file(mpack_reader_t* reader, const char* filename) { + mpack_reader_init_filename(reader, filename); +} + +/** + * Initializes an MPack reader that reads from a libc FILE. This can be used to + * read from stdin, or from a file opened separately. + * + * @param reader The MPack reader. + * @param stdfile The FILE. + * @param close_when_done If true, fclose() will be called on the FILE when it + * is no longer needed. If false, the file will not be closed when + * reading is done. + * + * @warning The reader is buffered. It will read data in advance of parsing it, + * and it may read more data than it parsed. See mpack_reader_remaining() to + * access the extra data. + */ +void mpack_reader_init_stdfile(mpack_reader_t* reader, FILE* stdfile, bool close_when_done); +#endif + +/** + * @def mpack_reader_init_stack(reader) + * @hideinitializer + * + * Initializes an MPack reader using stack space as a buffer. A fill function + * should be added to the reader to fill the buffer. + * + * @see mpack_reader_set_fill + */ + +/** @cond */ +#define mpack_reader_init_stack_line_ex(line, reader) \ + char mpack_buf_##line[MPACK_STACK_SIZE]; \ + mpack_reader_init((reader), mpack_buf_##line, sizeof(mpack_buf_##line), 0) + +#define mpack_reader_init_stack_line(line, reader) \ + mpack_reader_init_stack_line_ex(line, reader) +/** @endcond */ + +#define mpack_reader_init_stack(reader) \ + mpack_reader_init_stack_line(__LINE__, (reader)) + +/** + * Cleans up the MPack reader, ensuring that all compound elements + * have been completely read. Returns the final error state of the + * reader. + * + * This will assert in tracking mode if the reader is not in an error + * state and has any incomplete reads. If you want to cancel reading + * in the middle of a document, you need to flag an error on the reader + * before destroying it (such as mpack_error_data). + * + * @see mpack_read_tag() + * @see mpack_reader_flag_error() + * @see mpack_error_data + */ +mpack_error_t mpack_reader_destroy(mpack_reader_t* reader); + +/** + * @} + */ + +/** + * @name Callbacks + * @{ + */ + +/** + * Sets the custom pointer to pass to the reader callbacks, such as fill + * or teardown. + * + * @param reader The MPack reader. + * @param context User data to pass to the reader callbacks. + * + * @see mpack_reader_context() + */ +MPACK_INLINE void mpack_reader_set_context(mpack_reader_t* reader, void* context) { + reader->context = context; +} + +/** + * Returns the custom context for reader callbacks. + * + * @see mpack_reader_set_context + * @see mpack_reader_set_fill + * @see mpack_reader_set_skip + */ +MPACK_INLINE void* mpack_reader_context(mpack_reader_t* reader) { + return reader->context; +} + +/** + * Sets the fill function to refill the data buffer when it runs out of data. + * + * If no fill function is used, truncated MessagePack data results in + * mpack_error_invalid (since the buffer is assumed to contain a + * complete MessagePack object.) + * + * If a fill function is used, truncated MessagePack data usually + * results in mpack_error_io (since the fill function fails to get + * the missing data.) + * + * This should normally be used with mpack_reader_set_context() to register + * a custom pointer to pass to the fill function. + * + * @param reader The MPack reader. + * @param fill The function to fetch additional data into the buffer. + */ +void mpack_reader_set_fill(mpack_reader_t* reader, mpack_reader_fill_t fill); + +/** + * Sets the skip function to discard bytes from the source stream. + * + * It's not necessary to implement this function. If the stream is not + * seekable, don't set a skip callback. The reader will fall back to + * using the fill function instead. + * + * This should normally be used with mpack_reader_set_context() to register + * a custom pointer to pass to the skip function. + * + * The skip function is ignored in size-optimized builds to reduce code + * size. Data will be skipped with the fill function when necessary. + * + * @param reader The MPack reader. + * @param skip The function to discard bytes from the source stream. + */ +void mpack_reader_set_skip(mpack_reader_t* reader, mpack_reader_skip_t skip); + +/** + * Sets the error function to call when an error is flagged on the reader. + * + * This should normally be used with mpack_reader_set_context() to register + * a custom pointer to pass to the error function. + * + * See the definition of mpack_reader_error_t for more information about + * what you can do from an error callback. + * + * @see mpack_reader_error_t + * @param reader The MPack reader. + * @param error_fn The function to call when an error is flagged on the reader. + */ +MPACK_INLINE void mpack_reader_set_error_handler(mpack_reader_t* reader, mpack_reader_error_t error_fn) { + reader->error_fn = error_fn; +} + +/** + * Sets the teardown function to call when the reader is destroyed. + * + * This should normally be used with mpack_reader_set_context() to register + * a custom pointer to pass to the teardown function. + * + * @param reader The MPack reader. + * @param teardown The function to call when the reader is destroyed. + */ +MPACK_INLINE void mpack_reader_set_teardown(mpack_reader_t* reader, mpack_reader_teardown_t teardown) { + reader->teardown = teardown; +} + +/** + * @} + */ + +/** + * @name Core Reader Functions + * @{ + */ + +/** + * Queries the error state of the MPack reader. + * + * If a reader is in an error state, you should discard all data since the + * last time the error flag was checked. The error flag cannot be cleared. + */ +MPACK_INLINE mpack_error_t mpack_reader_error(mpack_reader_t* reader) { + return reader->error; +} + +/** + * Places the reader in the given error state, calling the error callback if one + * is set. + * + * This allows you to externally flag errors, for example if you are validating + * data as you read it. + * + * If the reader is already in an error state, this call is ignored and no + * error callback is called. + */ +void mpack_reader_flag_error(mpack_reader_t* reader, mpack_error_t error); + +/** + * Places the reader in the given error state if the given error is not mpack_ok, + * returning the resulting error state of the reader. + * + * This allows you to externally flag errors, for example if you are validating + * data as you read it. + * + * If the given error is mpack_ok or if the reader is already in an error state, + * this call is ignored and the actual error state of the reader is returned. + */ +MPACK_INLINE mpack_error_t mpack_reader_flag_if_error(mpack_reader_t* reader, mpack_error_t error) { + if (error != mpack_ok) + mpack_reader_flag_error(reader, error); + return mpack_reader_error(reader); +} + +/** + * Returns bytes left in the reader's buffer. + * + * If you are done reading MessagePack data but there is other interesting data + * following it, the reader may have buffered too much data. The number of bytes + * remaining in the buffer and a pointer to the position of those bytes can be + * queried here. + * + * If you know the length of the MPack chunk beforehand, it's better to instead + * have your fill function limit the data it reads so that the reader does not + * have extra data. In this case you can simply check that this returns zero. + * + * Returns 0 if the reader is in an error state. + * + * @param reader The MPack reader from which to query remaining data. + * @param data [out] A pointer to the remaining data, or NULL. + * @return The number of bytes remaining in the buffer. + */ +size_t mpack_reader_remaining(mpack_reader_t* reader, const char** data); + +/** + * Reads a MessagePack object header (an MPack tag.) + * + * If an error occurs, the reader is placed in an error state and a + * nil tag is returned. If the reader is already in an error state, + * a nil tag is returned. + * + * If the type is compound (i.e. is a map, array, string, binary or + * extension type), additional reads are required to get the contained + * data, and the corresponding done function must be called when done. + * + * @note Maps in JSON are unordered, so it is recommended not to expect + * a specific ordering for your map values in case your data is converted + * to/from JSON. + * + * @see mpack_read_bytes() + * @see mpack_done_array() + * @see mpack_done_map() + * @see mpack_done_str() + * @see mpack_done_bin() + * @see mpack_done_ext() + */ +mpack_tag_t mpack_read_tag(mpack_reader_t* reader); + +/** + * Parses the next MessagePack object header (an MPack tag) without + * advancing the reader. + * + * If an error occurs, the reader is placed in an error state and a + * nil tag is returned. If the reader is already in an error state, + * a nil tag is returned. + * + * @note Maps in JSON are unordered, so it is recommended not to expect + * a specific ordering for your map values in case your data is converted + * to/from JSON. + * + * @see mpack_read_tag() + * @see mpack_discard() + */ +mpack_tag_t mpack_peek_tag(mpack_reader_t* reader); + +/** + * @} + */ + +/** + * @name String and Data Functions + * @{ + */ + +/** + * Skips bytes from the underlying stream. This is used only to + * skip the contents of a string, binary blob or extension object. + */ +void mpack_skip_bytes(mpack_reader_t* reader, size_t count); + +/** + * Reads bytes from a string, binary blob or extension object, copying + * them into the given buffer. + * + * A str, bin or ext must have been opened by a call to mpack_read_tag() + * which yielded one of these types, or by a call to an expect function + * such as mpack_expect_str() or mpack_expect_bin(). + * + * If an error occurs, the buffer contents are undefined. + * + * This can be called multiple times for a single str, bin or ext + * to read the data in chunks. The total data read must add up + * to the size of the object. + * + * @param reader The MPack reader + * @param p The buffer in which to copy the bytes + * @param count The number of bytes to read + */ +void mpack_read_bytes(mpack_reader_t* reader, char* p, size_t count); + +/** + * Reads bytes from a string, ensures that the string is valid UTF-8, + * and copies the bytes into the given buffer. + * + * A string must have been opened by a call to mpack_read_tag() which + * yielded a string, or by a call to an expect function such as + * mpack_expect_str(). + * + * The given byte count must match the complete size of the string as + * returned by the tag or expect function. You must ensure that the + * buffer fits the data. + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed. + * + * If an error occurs, the buffer contents are undefined. + * + * Unlike mpack_read_bytes(), this cannot be used to read the data in + * chunks (since this might split a character's UTF-8 bytes, and the + * reader does not keep track of the UTF-8 decoding state between reads.) + * + * @throws mpack_error_type if the string contains invalid UTF-8. + */ +void mpack_read_utf8(mpack_reader_t* reader, char* p, size_t byte_count); + +/** + * Reads bytes from a string, ensures that the string contains no NUL + * bytes, copies the bytes into the given buffer and adds a null-terminator. + * + * A string must have been opened by a call to mpack_read_tag() which + * yielded a string, or by a call to an expect function such as + * mpack_expect_str(). + * + * The given byte count must match the size of the string as returned + * by the tag or expect function. The string will only be copied if + * the buffer is large enough to store it. + * + * If an error occurs, the buffer will contain an empty string. + * + * @note If you know the object will be a string before reading it, + * it is highly recommended to use mpack_expect_cstr() instead. + * Alternatively you could use mpack_peek_tag() and call + * mpack_expect_cstr() if it's a string. + * + * @throws mpack_error_too_big if the string plus null-terminator is larger than the given buffer size + * @throws mpack_error_type if the string contains a null byte. + * + * @see mpack_peek_tag() + * @see mpack_expect_cstr() + * @see mpack_expect_utf8_cstr() + */ +void mpack_read_cstr(mpack_reader_t* reader, char* buf, size_t buffer_size, size_t byte_count); + +/** + * Reads bytes from a string, ensures that the string is valid UTF-8 + * with no NUL bytes, copies the bytes into the given buffer and adds a + * null-terminator. + * + * A string must have been opened by a call to mpack_read_tag() which + * yielded a string, or by a call to an expect function such as + * mpack_expect_str(). + * + * The given byte count must match the size of the string as returned + * by the tag or expect function. The string will only be copied if + * the buffer is large enough to store it. + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed, but without the NUL character, since + * it cannot be represented in a null-terminated string. + * + * If an error occurs, the buffer will contain an empty string. + * + * @note If you know the object will be a string before reading it, + * it is highly recommended to use mpack_expect_utf8_cstr() instead. + * Alternatively you could use mpack_peek_tag() and call + * mpack_expect_utf8_cstr() if it's a string. + * + * @throws mpack_error_too_big if the string plus null-terminator is larger than the given buffer size + * @throws mpack_error_type if the string contains invalid UTF-8 or a null byte. + * + * @see mpack_peek_tag() + * @see mpack_expect_utf8_cstr() + */ +void mpack_read_utf8_cstr(mpack_reader_t* reader, char* buf, size_t buffer_size, size_t byte_count); + +#ifdef MPACK_MALLOC +/** @cond */ +// This can optionally add a null-terminator, but it does not check +// whether the data contains null bytes. This must be done separately +// in a cstring read function (possibly as part of a UTF-8 check.) +char* mpack_read_bytes_alloc_impl(mpack_reader_t* reader, size_t count, bool null_terminated); +/** @endcond */ + +/** + * Reads bytes from a string, binary blob or extension object, allocating + * storage for them and returning the allocated pointer. + * + * The allocated string must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * + * Returns NULL if any error occurs, or if count is zero. + */ +MPACK_INLINE char* mpack_read_bytes_alloc(mpack_reader_t* reader, size_t count) { + return mpack_read_bytes_alloc_impl(reader, count, false); +} +#endif + +/** + * Reads bytes from a string, binary blob or extension object in-place in + * the buffer. This can be used to avoid copying the data. + * + * A str, bin or ext must have been opened by a call to mpack_read_tag() + * which yielded one of these types, or by a call to an expect function + * such as mpack_expect_str() or mpack_expect_bin(). + * + * If the bytes are from a string, the string is not null-terminated! Use + * mpack_read_cstr() to copy the string into a buffer and add a null-terminator. + * + * The returned pointer is invalidated on the next read, or when the buffer + * is destroyed. + * + * The reader will move data around in the buffer if needed to ensure that + * the pointer can always be returned, so this should only be used if + * count is very small compared to the buffer size. If you need to check + * whether a small size is reasonable (for example you intend to handle small and + * large sizes differently), you can call mpack_should_read_bytes_inplace(). + * + * This can be called multiple times for a single str, bin or ext + * to read the data in chunks. The total data read must add up + * to the size of the object. + * + * NULL is returned if the reader is in an error state. + * + * @throws mpack_error_too_big if the requested size is larger than the buffer size + * + * @see mpack_should_read_bytes_inplace() + */ +const char* mpack_read_bytes_inplace(mpack_reader_t* reader, size_t count); + +/** + * Reads bytes from a string in-place in the buffer and ensures they are + * valid UTF-8. This can be used to avoid copying the data. + * + * A string must have been opened by a call to mpack_read_tag() which + * yielded a string, or by a call to an expect function such as + * mpack_expect_str(). + * + * The string is not null-terminated! Use mpack_read_utf8_cstr() to + * copy the string into a buffer and add a null-terminator. + * + * The returned pointer is invalidated on the next read, or when the buffer + * is destroyed. + * + * The reader will move data around in the buffer if needed to ensure that + * the pointer can always be returned, so this should only be used if + * count is very small compared to the buffer size. If you need to check + * whether a small size is reasonable (for example you intend to handle small and + * large sizes differently), you can call mpack_should_read_bytes_inplace(). + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed. + * + * Unlike mpack_read_bytes_inplace(), this cannot be used to read the data in + * chunks (since this might split a character's UTF-8 bytes, and the + * reader does not keep track of the UTF-8 decoding state between reads.) + * + * NULL is returned if the reader is in an error state. + * + * @throws mpack_error_type if the string contains invalid UTF-8 + * @throws mpack_error_too_big if the requested size is larger than the buffer size + * + * @see mpack_should_read_bytes_inplace() + */ +const char* mpack_read_utf8_inplace(mpack_reader_t* reader, size_t count); + +/** + * Returns true if it's a good idea to read the given number of bytes + * in-place. + * + * If the read will be larger than some small fraction of the buffer size, + * this will return false to avoid shuffling too much data back and forth + * in the buffer. + * + * Use this if you're expecting arbitrary size data, and you want to read + * in-place for the best performance when possible but will fall back to + * a normal read if the data is too large. + * + * @see mpack_read_bytes_inplace() + */ +MPACK_INLINE bool mpack_should_read_bytes_inplace(mpack_reader_t* reader, size_t count) { + return (reader->size == 0 || count <= reader->size / MPACK_READER_SMALL_FRACTION_DENOMINATOR); +} + +#if MPACK_EXTENSIONS +/** + * Reads a timestamp contained in an ext object of the given size, closing the + * ext type. + * + * An ext object of exttype @ref MPACK_EXTTYPE_TIMESTAMP must have been opened + * by a call to e.g. mpack_read_tag() or mpack_expect_ext(). + * + * You must NOT call mpack_done_ext() after calling this. A timestamp ext + * object can only contain a single timestamp value, so this calls + * mpack_done_ext() automatically. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @throws mpack_error_invalid if the size is not one of the supported + * timestamp sizes, or if the nanoseconds are out of range. + */ +mpack_timestamp_t mpack_read_timestamp(mpack_reader_t* reader, size_t size); +#endif + +/** + * @} + */ + +/** + * @name Core Reader Functions + * @{ + */ + +#if MPACK_READ_TRACKING +/** + * Finishes reading the given type. + * + * This will track reads to ensure that the correct number of elements + * or bytes are read. + */ +void mpack_done_type(mpack_reader_t* reader, mpack_type_t type); +#else +MPACK_INLINE void mpack_done_type(mpack_reader_t* reader, mpack_type_t type) { + MPACK_UNUSED(reader); + MPACK_UNUSED(type); +} +#endif + +/** + * Finishes reading an array. + * + * This will track reads to ensure that the correct number of elements are read. + */ +MPACK_INLINE void mpack_done_array(mpack_reader_t* reader) { + mpack_done_type(reader, mpack_type_array); +} + +/** + * @fn mpack_done_map(mpack_reader_t* reader) + * + * Finishes reading a map. + * + * This will track reads to ensure that the correct number of elements are read. + */ +MPACK_INLINE void mpack_done_map(mpack_reader_t* reader) { + mpack_done_type(reader, mpack_type_map); +} + +/** + * @fn mpack_done_str(mpack_reader_t* reader) + * + * Finishes reading a string. + * + * This will track reads to ensure that the correct number of bytes are read. + */ +MPACK_INLINE void mpack_done_str(mpack_reader_t* reader) { + mpack_done_type(reader, mpack_type_str); +} + +/** + * @fn mpack_done_bin(mpack_reader_t* reader) + * + * Finishes reading a binary data blob. + * + * This will track reads to ensure that the correct number of bytes are read. + */ +MPACK_INLINE void mpack_done_bin(mpack_reader_t* reader) { + mpack_done_type(reader, mpack_type_bin); +} + +#if MPACK_EXTENSIONS +/** + * @fn mpack_done_ext(mpack_reader_t* reader) + * + * Finishes reading an extended type binary data blob. + * + * This will track reads to ensure that the correct number of bytes are read. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +MPACK_INLINE void mpack_done_ext(mpack_reader_t* reader) { + mpack_done_type(reader, mpack_type_ext); +} +#endif + +/** + * Reads and discards the next object. This will read and discard all + * contained data as well if it is a compound type. + */ +void mpack_discard(mpack_reader_t* reader); + +/** + * @} + */ + +/** @cond */ + +#if MPACK_DEBUG && MPACK_STDIO +/** + * @name Debugging Functions + * @{ + */ +/* + * Converts a blob of MessagePack to a pseudo-JSON string for debugging + * purposes, placing the result in the given buffer with a null-terminator. + * + * If the buffer does not have enough space, the result will be truncated (but + * it is guaranteed to be null-terminated.) + * + * This is only available in debug mode, and only if stdio is available (since + * it uses snprintf().) It's strictly for debugging purposes. + */ +void mpack_print_data_to_buffer(const char* data, size_t data_size, char* buffer, size_t buffer_size); + +/* + * Converts a node to pseudo-JSON for debugging purposes, calling the given + * callback as many times as is necessary to output the character data. + * + * No null-terminator or trailing newline will be written. + * + * This is only available in debug mode, and only if stdio is available (since + * it uses snprintf().) It's strictly for debugging purposes. + */ +void mpack_print_data_to_callback(const char* data, size_t size, mpack_print_callback_t callback, void* context); + +/* + * Converts a blob of MessagePack to pseudo-JSON for debugging purposes + * and pretty-prints it to the given file. + */ +void mpack_print_data_to_file(const char* data, size_t len, FILE* file); + +/* + * Converts a blob of MessagePack to pseudo-JSON for debugging purposes + * and pretty-prints it to stdout. + */ +MPACK_INLINE void mpack_print_data_to_stdout(const char* data, size_t len) { + mpack_print_data_to_file(data, len, stdout); +} + +/* + * Converts the MessagePack contained in the given `FILE*` to pseudo-JSON for + * debugging purposes, calling the given callback as many times as is necessary + * to output the character data. + */ +void mpack_print_stdfile_to_callback(FILE* file, mpack_print_callback_t callback, void* context); + +/* + * Deprecated. + * + * \deprecated Renamed to mpack_print_data_to_stdout(). + */ +MPACK_INLINE void mpack_print(const char* data, size_t len) { + mpack_print_data_to_stdout(data, len); +} + +/** + * @} + */ +#endif + +/** @endcond */ + +/** + * @} + */ + + + +#if MPACK_INTERNAL + +bool mpack_reader_ensure_straddle(mpack_reader_t* reader, size_t count); + +/* + * Ensures there are at least @c count bytes left in the + * data, raising an error and returning false if more + * data cannot be made available. + */ +MPACK_INLINE bool mpack_reader_ensure(mpack_reader_t* reader, size_t count) { + mpack_assert(count != 0, "cannot ensure zero bytes!"); + mpack_assert(reader->error == mpack_ok, "reader cannot be in an error state!"); + + if (count <= (size_t)(reader->end - reader->data)) + return true; + return mpack_reader_ensure_straddle(reader, count); +} + +void mpack_read_native_straddle(mpack_reader_t* reader, char* p, size_t count); + +// Reads count bytes into p, deferring to mpack_read_native_straddle() if more +// bytes are needed than are available in the buffer. +MPACK_INLINE void mpack_read_native(mpack_reader_t* reader, char* p, size_t count) { + mpack_assert(count == 0 || p != NULL, "data pointer for %i bytes is NULL", (int)count); + + if (count > (size_t)(reader->end - reader->data)) { + mpack_read_native_straddle(reader, p, count); + } else { + mpack_memcpy(p, reader->data, count); + reader->data += count; + } +} + +#if MPACK_READ_TRACKING +#define MPACK_READER_TRACK(reader, error_expr) \ + (((reader)->error == mpack_ok) ? mpack_reader_flag_if_error((reader), (error_expr)) : (reader)->error) +#else +#define MPACK_READER_TRACK(reader, error_expr) (MPACK_UNUSED(reader), mpack_ok) +#endif + +MPACK_INLINE mpack_error_t mpack_reader_track_element(mpack_reader_t* reader) { + return MPACK_READER_TRACK(reader, mpack_track_element(&reader->track, true)); +} + +MPACK_INLINE mpack_error_t mpack_reader_track_peek_element(mpack_reader_t* reader) { + return MPACK_READER_TRACK(reader, mpack_track_peek_element(&reader->track, true)); +} + +MPACK_INLINE mpack_error_t mpack_reader_track_bytes(mpack_reader_t* reader, size_t count) { + MPACK_UNUSED(count); + return MPACK_READER_TRACK(reader, mpack_track_bytes(&reader->track, true, count)); +} + +MPACK_INLINE mpack_error_t mpack_reader_track_str_bytes_all(mpack_reader_t* reader, size_t count) { + MPACK_UNUSED(count); + return MPACK_READER_TRACK(reader, mpack_track_str_bytes_all(&reader->track, true, count)); +} + +#endif + + + +#endif + +MPACK_EXTERN_C_END +MPACK_HEADER_END + +#endif + + +/* mpack/mpack-expect.h.h */ + +/** + * @file + * + * Declares the MPack static Expect API. + */ + +#ifndef MPACK_EXPECT_H +#define MPACK_EXPECT_H 1 + +/* #include "mpack-reader.h" */ + +MPACK_HEADER_START +MPACK_EXTERN_C_START + +#if MPACK_EXPECT + +#if !MPACK_READER +#error "MPACK_EXPECT requires MPACK_READER." +#endif + +/** + * @defgroup expect Expect API + * + * The MPack Expect API allows you to easily read MessagePack data when you + * expect it to follow a predefined schema. + * + * @note If you are not writing code for an embedded device (or otherwise do + * not need maximum performance with minimal memory usage), you should not use + * this. You probably want to use the @link node Node API@endlink instead. + * + * See @ref docs/expect.md for examples. + * + * The main purpose of the Expect API is convenience, so the API is lax. It + * automatically converts between similar types where there is no loss of + * precision. + * + * When using any of the expect functions, if the type or value of what was + * read does not match what is expected, @ref mpack_error_type is raised. + * + * @{ + */ + +/** + * @name Basic Number Functions + * @{ + */ + +/** + * Reads an 8-bit unsigned integer. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an 8-bit unsigned int. + * + * Returns zero if an error occurs. + */ +uint8_t mpack_expect_u8(mpack_reader_t* reader); + +/** + * Reads a 16-bit unsigned integer. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 16-bit unsigned int. + * + * Returns zero if an error occurs. + */ +uint16_t mpack_expect_u16(mpack_reader_t* reader); + +/** + * Reads a 32-bit unsigned integer. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 32-bit unsigned int. + * + * Returns zero if an error occurs. + */ +uint32_t mpack_expect_u32(mpack_reader_t* reader); + +/** + * Reads a 64-bit unsigned integer. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 64-bit unsigned int. + * + * Returns zero if an error occurs. + */ +uint64_t mpack_expect_u64(mpack_reader_t* reader); + +/** + * Reads an 8-bit signed integer. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an 8-bit signed int. + * + * Returns zero if an error occurs. + */ +int8_t mpack_expect_i8(mpack_reader_t* reader); + +/** + * Reads a 16-bit signed integer. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 16-bit signed int. + * + * Returns zero if an error occurs. + */ +int16_t mpack_expect_i16(mpack_reader_t* reader); + +/** + * Reads a 32-bit signed integer. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 32-bit signed int. + * + * Returns zero if an error occurs. + */ +int32_t mpack_expect_i32(mpack_reader_t* reader); + +/** + * Reads a 64-bit signed integer. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 64-bit signed int. + * + * Returns zero if an error occurs. + */ +int64_t mpack_expect_i64(mpack_reader_t* reader); + +/** + * Reads a number, returning the value as a float. The underlying value can be an + * integer, float or double; the value is converted to a float. + * + * @note Reading a double or a large integer with this function can incur a + * loss of precision. + * + * @throws mpack_error_type if the underlying value is not a float, double or integer. + */ +float mpack_expect_float(mpack_reader_t* reader); + +/** + * Reads a number, returning the value as a double. The underlying value can be an + * integer, float or double; the value is converted to a double. + * + * @note Reading a very large integer with this function can incur a + * loss of precision. + * + * @throws mpack_error_type if the underlying value is not a float, double or integer. + */ +double mpack_expect_double(mpack_reader_t* reader); + +/** + * Reads a float. The underlying value must be a float, not a double or an integer. + * This ensures no loss of precision can occur. + * + * @throws mpack_error_type if the underlying value is not a float. + */ +float mpack_expect_float_strict(mpack_reader_t* reader); + +/** + * Reads a double. The underlying value must be a float or double, not an integer. + * This ensures no loss of precision can occur. + * + * @throws mpack_error_type if the underlying value is not a float or double. + */ +double mpack_expect_double_strict(mpack_reader_t* reader); + +/** + * @} + */ + +/** + * @name Ranged Number Functions + * @{ + */ + +/** + * Reads an 8-bit unsigned integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an 8-bit unsigned int. + * + * Returns min_value if an error occurs. + */ +uint8_t mpack_expect_u8_range(mpack_reader_t* reader, uint8_t min_value, uint8_t max_value); + +/** + * Reads a 16-bit unsigned integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 16-bit unsigned int. + * + * Returns min_value if an error occurs. + */ +uint16_t mpack_expect_u16_range(mpack_reader_t* reader, uint16_t min_value, uint16_t max_value); + +/** + * Reads a 32-bit unsigned integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 32-bit unsigned int. + * + * Returns min_value if an error occurs. + */ +uint32_t mpack_expect_u32_range(mpack_reader_t* reader, uint32_t min_value, uint32_t max_value); + +/** + * Reads a 64-bit unsigned integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 64-bit unsigned int. + * + * Returns min_value if an error occurs. + */ +uint64_t mpack_expect_u64_range(mpack_reader_t* reader, uint64_t min_value, uint64_t max_value); + +/** + * Reads an unsigned integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an unsigned int. + * + * Returns min_value if an error occurs. + */ +MPACK_INLINE unsigned int mpack_expect_uint_range(mpack_reader_t* reader, unsigned int min_value, unsigned int max_value) { + // This should be true at compile-time, so this just wraps the 32-bit + // function. We fallback to 64-bit if for some reason sizeof(int) isn't 4. + if (sizeof(unsigned int) == 4) + return (unsigned int)mpack_expect_u32_range(reader, (uint32_t)min_value, (uint32_t)max_value); + return (unsigned int)mpack_expect_u64_range(reader, min_value, max_value); +} + +/** + * Reads an 8-bit unsigned integer, ensuring that it is at most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an 8-bit unsigned int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE uint8_t mpack_expect_u8_max(mpack_reader_t* reader, uint8_t max_value) { + return mpack_expect_u8_range(reader, 0, max_value); +} + +/** + * Reads a 16-bit unsigned integer, ensuring that it is at most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 16-bit unsigned int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE uint16_t mpack_expect_u16_max(mpack_reader_t* reader, uint16_t max_value) { + return mpack_expect_u16_range(reader, 0, max_value); +} + +/** + * Reads a 32-bit unsigned integer, ensuring that it is at most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 32-bit unsigned int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE uint32_t mpack_expect_u32_max(mpack_reader_t* reader, uint32_t max_value) { + return mpack_expect_u32_range(reader, 0, max_value); +} + +/** + * Reads a 64-bit unsigned integer, ensuring that it is at most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 64-bit unsigned int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE uint64_t mpack_expect_u64_max(mpack_reader_t* reader, uint64_t max_value) { + return mpack_expect_u64_range(reader, 0, max_value); +} + +/** + * Reads an unsigned integer, ensuring that it is at most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an unsigned int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE unsigned int mpack_expect_uint_max(mpack_reader_t* reader, unsigned int max_value) { + return mpack_expect_uint_range(reader, 0, max_value); +} + +/** + * Reads an 8-bit signed integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an 8-bit signed int. + * + * Returns min_value if an error occurs. + */ +int8_t mpack_expect_i8_range(mpack_reader_t* reader, int8_t min_value, int8_t max_value); + +/** + * Reads a 16-bit signed integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 16-bit signed int. + * + * Returns min_value if an error occurs. + */ +int16_t mpack_expect_i16_range(mpack_reader_t* reader, int16_t min_value, int16_t max_value); + +/** + * Reads a 32-bit signed integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 32-bit signed int. + * + * Returns min_value if an error occurs. + */ +int32_t mpack_expect_i32_range(mpack_reader_t* reader, int32_t min_value, int32_t max_value); + +/** + * Reads a 64-bit signed integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 64-bit signed int. + * + * Returns min_value if an error occurs. + */ +int64_t mpack_expect_i64_range(mpack_reader_t* reader, int64_t min_value, int64_t max_value); + +/** + * Reads a signed integer, ensuring that it falls within the given range. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a signed int. + * + * Returns min_value if an error occurs. + */ +MPACK_INLINE int mpack_expect_int_range(mpack_reader_t* reader, int min_value, int max_value) { + // This should be true at compile-time, so this just wraps the 32-bit + // function. We fallback to 64-bit if for some reason sizeof(int) isn't 4. + if (sizeof(int) == 4) + return (int)mpack_expect_i32_range(reader, (int32_t)min_value, (int32_t)max_value); + return (int)mpack_expect_i64_range(reader, min_value, max_value); +} + +/** + * Reads an 8-bit signed integer, ensuring that it is at least zero and at + * most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an 8-bit signed int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE int8_t mpack_expect_i8_max(mpack_reader_t* reader, int8_t max_value) { + return mpack_expect_i8_range(reader, 0, max_value); +} + +/** + * Reads a 16-bit signed integer, ensuring that it is at least zero and at + * most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 16-bit signed int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE int16_t mpack_expect_i16_max(mpack_reader_t* reader, int16_t max_value) { + return mpack_expect_i16_range(reader, 0, max_value); +} + +/** + * Reads a 32-bit signed integer, ensuring that it is at least zero and at + * most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 32-bit signed int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE int32_t mpack_expect_i32_max(mpack_reader_t* reader, int32_t max_value) { + return mpack_expect_i32_range(reader, 0, max_value); +} + +/** + * Reads a 64-bit signed integer, ensuring that it is at least zero and at + * most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a 64-bit signed int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE int64_t mpack_expect_i64_max(mpack_reader_t* reader, int64_t max_value) { + return mpack_expect_i64_range(reader, 0, max_value); +} + +/** + * Reads an int, ensuring that it is at least zero and at most @a max_value. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a signed int. + * + * Returns 0 if an error occurs. + */ +MPACK_INLINE int mpack_expect_int_max(mpack_reader_t* reader, int max_value) { + return mpack_expect_int_range(reader, 0, max_value); +} + +/** + * Reads a number, ensuring that it falls within the given range and returning + * the value as a float. The underlying value can be an integer, float or + * double; the value is converted to a float. + * + * @note Reading a double or a large integer with this function can incur a + * loss of precision. + * + * @throws mpack_error_type if the underlying value is not a float, double or integer. + */ +float mpack_expect_float_range(mpack_reader_t* reader, float min_value, float max_value); + +/** + * Reads a number, ensuring that it falls within the given range and returning + * the value as a double. The underlying value can be an integer, float or + * double; the value is converted to a double. + * + * @note Reading a very large integer with this function can incur a + * loss of precision. + * + * @throws mpack_error_type if the underlying value is not a float, double or integer. + */ +double mpack_expect_double_range(mpack_reader_t* reader, double min_value, double max_value); + +/** + * @} + */ + + + +// These are additional Basic Number functions that wrap inline range functions. + +/** + * @name Basic Number Functions + * @{ + */ + +/** + * Reads an unsigned int. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in an unsigned int. + * + * Returns zero if an error occurs. + */ +MPACK_INLINE unsigned int mpack_expect_uint(mpack_reader_t* reader) { + + // This should be true at compile-time, so this just wraps the 32-bit function. + if (sizeof(unsigned int) == 4) + return (unsigned int)mpack_expect_u32(reader); + + // Otherwise we wrap the max function to ensure it fits. + return (unsigned int)mpack_expect_u64_max(reader, UINT_MAX); + +} + +/** + * Reads a signed int. + * + * The underlying type may be an integer type of any size and signedness, + * as long as the value can be represented in a signed int. + * + * Returns zero if an error occurs. + */ +MPACK_INLINE int mpack_expect_int(mpack_reader_t* reader) { + + // This should be true at compile-time, so this just wraps the 32-bit function. + if (sizeof(int) == 4) + return (int)mpack_expect_i32(reader); + + // Otherwise we wrap the range function to ensure it fits. + return (int)mpack_expect_i64_range(reader, INT_MIN, INT_MAX); + +} + +/** + * @} + */ + + + +/** + * @name Matching Number Functions + * @{ + */ + +/** + * Reads an unsigned integer, ensuring that it exactly matches the given value. + * + * mpack_error_type is raised if the value is not representable as an unsigned + * integer or if it does not exactly match the given value. + */ +void mpack_expect_uint_match(mpack_reader_t* reader, uint64_t value); + +/** + * Reads a signed integer, ensuring that it exactly matches the given value. + * + * mpack_error_type is raised if the value is not representable as a signed + * integer or if it does not exactly match the given value. + */ +void mpack_expect_int_match(mpack_reader_t* reader, int64_t value); + +/** + * @name Other Basic Types + * @{ + */ + +/** + * Reads a nil, raising @ref mpack_error_type if the value is not nil. + */ +void mpack_expect_nil(mpack_reader_t* reader); + +/** + * Reads a boolean. + * + * @note Integers will raise mpack_error_type; the value must be strictly a boolean. + */ +bool mpack_expect_bool(mpack_reader_t* reader); + +/** + * Reads a boolean, raising @ref mpack_error_type if its value is not @c true. + */ +void mpack_expect_true(mpack_reader_t* reader); + +/** + * Reads a boolean, raising @ref mpack_error_type if its value is not @c false. + */ +void mpack_expect_false(mpack_reader_t* reader); + +/** + * @} + */ + +/** + * @name Extension Functions + * @{ + */ + +#if MPACK_EXTENSIONS +/** + * Reads a timestamp. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +mpack_timestamp_t mpack_expect_timestamp(mpack_reader_t* reader); + +/** + * Reads a timestamp in seconds, truncating the nanoseconds (if any). + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +int64_t mpack_expect_timestamp_truncate(mpack_reader_t* reader); +#endif + +/** + * @} + */ + +/** + * @name Compound Types + * @{ + */ + +/** + * Reads the start of a map, returning its element count. + * + * A number of values follow equal to twice the element count of the map, + * alternating between keys and values. @ref mpack_done_map() must be called + * once all elements have been read. + * + * @note Maps in JSON are unordered, so it is recommended not to expect + * a specific ordering for your map values in case your data is converted + * to/from JSON. + * + * @warning This call is dangerous! It does not have a size limit, and it + * does not have any way of checking whether there is enough data in the + * message (since the data could be coming from a stream.) When looping + * through the map's contents, you must check for errors on each iteration + * of the loop. Otherwise an attacker could craft a message declaring a map + * of a billion elements which would throw your parsing code into an + * infinite loop! You should strongly consider using mpack_expect_map_max() + * with a safe maximum size instead. + * + * @throws mpack_error_type if the value is not a map. + */ +uint32_t mpack_expect_map(mpack_reader_t* reader); + +/** + * Reads the start of a map with a number of elements in the given range, returning + * its element count. + * + * A number of values follow equal to twice the element count of the map, + * alternating between keys and values. @ref mpack_done_map() must be called + * once all elements have been read. + * + * @note Maps in JSON are unordered, so it is recommended not to expect + * a specific ordering for your map values in case your data is converted + * to/from JSON. + * + * min_count is returned if an error occurs. + * + * @throws mpack_error_type if the value is not a map or if its size does + * not fall within the given range. + */ +uint32_t mpack_expect_map_range(mpack_reader_t* reader, uint32_t min_count, uint32_t max_count); + +/** + * Reads the start of a map with a number of elements at most @a max_count, + * returning its element count. + * + * A number of values follow equal to twice the element count of the map, + * alternating between keys and values. @ref mpack_done_map() must be called + * once all elements have been read. + * + * @note Maps in JSON are unordered, so it is recommended not to expect + * a specific ordering for your map values in case your data is converted + * to/from JSON. + * + * Zero is returned if an error occurs. + * + * @throws mpack_error_type if the value is not a map or if its size is + * greater than max_count. + */ +MPACK_INLINE uint32_t mpack_expect_map_max(mpack_reader_t* reader, uint32_t max_count) { + return mpack_expect_map_range(reader, 0, max_count); +} + +/** + * Reads the start of a map of the exact size given. + * + * A number of values follow equal to twice the element count of the map, + * alternating between keys and values. @ref mpack_done_map() must be called + * once all elements have been read. + * + * @note Maps in JSON are unordered, so it is recommended not to expect + * a specific ordering for your map values in case your data is converted + * to/from JSON. + * + * @throws mpack_error_type if the value is not a map or if its size + * does not match the given count. + */ +void mpack_expect_map_match(mpack_reader_t* reader, uint32_t count); + +/** + * Reads a nil node or the start of a map, returning whether a map was + * read and placing its number of key/value pairs in count. + * + * If a map was read, a number of values follow equal to twice the element count + * of the map, alternating between keys and values. @ref mpack_done_map() should + * also be called once all elements have been read (only if a map was read.) + * + * @note Maps in JSON are unordered, so it is recommended not to expect + * a specific ordering for your map values in case your data is converted + * to/from JSON. + * + * @warning This call is dangerous! It does not have a size limit, and it + * does not have any way of checking whether there is enough data in the + * message (since the data could be coming from a stream.) When looping + * through the map's contents, you must check for errors on each iteration + * of the loop. Otherwise an attacker could craft a message declaring a map + * of a billion elements which would throw your parsing code into an + * infinite loop! You should strongly consider using mpack_expect_map_max_or_nil() + * with a safe maximum size instead. + * + * @returns @c true if a map was read successfully; @c false if nil was read + * or an error occurred. + * @throws mpack_error_type if the value is not a nil or map. + */ +bool mpack_expect_map_or_nil(mpack_reader_t* reader, uint32_t* count); + +/** + * Reads a nil node or the start of a map with a number of elements at most + * max_count, returning whether a map was read and placing its number of + * key/value pairs in count. + * + * If a map was read, a number of values follow equal to twice the element count + * of the map, alternating between keys and values. @ref mpack_done_map() should + * anlso be called once all elements have been read (only if a map was read.) + * + * @note Maps in JSON are unordered, so it is recommended not to expect + * a specific ordering for your map values in case your data is converted + * to/from JSON. Consider using mpack_expect_key_cstr() or mpack_expect_key_uint() + * to switch on the key; see @ref docs/expect.md for examples. + * + * @returns @c true if a map was read successfully; @c false if nil was read + * or an error occurred. + * @throws mpack_error_type if the value is not a nil or map. + */ +bool mpack_expect_map_max_or_nil(mpack_reader_t* reader, uint32_t max_count, uint32_t* count); + +/** + * Reads the start of an array, returning its element count. + * + * A number of values follow equal to the element count of the array. + * @ref mpack_done_array() must be called once all elements have been read. + * + * @warning This call is dangerous! It does not have a size limit, and it + * does not have any way of checking whether there is enough data in the + * message (since the data could be coming from a stream.) When looping + * through the array's contents, you must check for errors on each iteration + * of the loop. Otherwise an attacker could craft a message declaring an array + * of a billion elements which would throw your parsing code into an + * infinite loop! You should strongly consider using mpack_expect_array_max() + * with a safe maximum size instead. + */ +uint32_t mpack_expect_array(mpack_reader_t* reader); + +/** + * Reads the start of an array with a number of elements in the given range, + * returning its element count. + * + * A number of values follow equal to the element count of the array. + * @ref mpack_done_array() must be called once all elements have been read. + * + * min_count is returned if an error occurs. + * + * @throws mpack_error_type if the value is not an array or if its size does + * not fall within the given range. + */ +uint32_t mpack_expect_array_range(mpack_reader_t* reader, uint32_t min_count, uint32_t max_count); + +/** + * Reads the start of an array with a number of elements at most @a max_count, + * returning its element count. + * + * A number of values follow equal to the element count of the array. + * @ref mpack_done_array() must be called once all elements have been read. + * + * Zero is returned if an error occurs. + * + * @throws mpack_error_type if the value is not an array or if its size is + * greater than max_count. + */ +MPACK_INLINE uint32_t mpack_expect_array_max(mpack_reader_t* reader, uint32_t max_count) { + return mpack_expect_array_range(reader, 0, max_count); +} + +/** + * Reads the start of an array of the exact size given. + * + * A number of values follow equal to the element count of the array. + * @ref mpack_done_array() must be called once all elements have been read. + * + * @throws mpack_error_type if the value is not an array or if its size does + * not match the given count. + */ +void mpack_expect_array_match(mpack_reader_t* reader, uint32_t count); + +/** + * Reads a nil node or the start of an array, returning whether an array was + * read and placing its number of elements in count. + * + * If an array was read, a number of values follow equal to the element count + * of the array. @ref mpack_done_array() should also be called once all elements + * have been read (only if an array was read.) + * + * @warning This call is dangerous! It does not have a size limit, and it + * does not have any way of checking whether there is enough data in the + * message (since the data could be coming from a stream.) When looping + * through the array's contents, you must check for errors on each iteration + * of the loop. Otherwise an attacker could craft a message declaring an array + * of a billion elements which would throw your parsing code into an + * infinite loop! You should strongly consider using mpack_expect_array_max_or_nil() + * with a safe maximum size instead. + * + * @returns @c true if an array was read successfully; @c false if nil was read + * or an error occurred. + * @throws mpack_error_type if the value is not a nil or array. + */ +bool mpack_expect_array_or_nil(mpack_reader_t* reader, uint32_t* count); + +/** + * Reads a nil node or the start of an array with a number of elements at most + * max_count, returning whether an array was read and placing its number of + * key/value pairs in count. + * + * If an array was read, a number of values follow equal to the element count + * of the array. @ref mpack_done_array() should also be called once all elements + * have been read (only if an array was read.) + * + * @returns @c true if an array was read successfully; @c false if nil was read + * or an error occurred. + * @throws mpack_error_type if the value is not a nil or array. + */ +bool mpack_expect_array_max_or_nil(mpack_reader_t* reader, uint32_t max_count, uint32_t* count); + +#ifdef MPACK_MALLOC +/** + * @hideinitializer + * + * Reads the start of an array and allocates storage for it, placing its + * size in out_count. A number of objects follow equal to the element count + * of the array. You must call @ref mpack_done_array() when done (even + * if the element count is zero.) + * + * If an error occurs, NULL is returned and the reader is placed in an + * error state. + * + * If the count is zero, NULL is returned. This does not indicate error. + * You should not check the return value for NULL to check for errors; only + * check the reader's error state. + * + * The allocated array must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * + * @throws mpack_error_type if the value is not an array or if its size is + * greater than max_count. + */ +#define mpack_expect_array_alloc(reader, Type, max_count, out_count) \ + ((Type*)mpack_expect_array_alloc_impl(reader, sizeof(Type), max_count, out_count, false)) + +/** + * @hideinitializer + * + * Reads a nil node or the start of an array and allocates storage for it, + * placing its size in out_count. A number of objects follow equal to the element + * count of the array if a non-empty array was read. + * + * If an error occurs, NULL is returned and the reader is placed in an + * error state. + * + * If a nil node was read, NULL is returned. If an empty array was read, + * mpack_done_array() is called automatically and NULL is returned. These + * do not indicate error. You should not check the return value for NULL + * to check for errors; only check the reader's error state. + * + * The allocated array must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * + * @warning You must call @ref mpack_done_array() if and only if a non-zero + * element count is read. This function does not differentiate between nil + * and an empty array. + * + * @throws mpack_error_type if the value is not an array or if its size is + * greater than max_count. + */ +#define mpack_expect_array_or_nil_alloc(reader, Type, max_count, out_count) \ + ((Type*)mpack_expect_array_alloc_impl(reader, sizeof(Type), max_count, out_count, true)) +#endif + +/** + * @} + */ + +/** @cond */ +#ifdef MPACK_MALLOC +void* mpack_expect_array_alloc_impl(mpack_reader_t* reader, + size_t element_size, uint32_t max_count, uint32_t* out_count, bool allow_nil); +#endif +/** @endcond */ + + +/** + * @name String Functions + * @{ + */ + +/** + * Reads the start of a string, returning its size in bytes. + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). mpack_done_str() must be called + * once all bytes have been read. + * + * NUL bytes are allowed in the string, and no encoding checks are done. + * + * mpack_error_type is raised if the value is not a string. + */ +uint32_t mpack_expect_str(mpack_reader_t* reader); + +/** + * Reads a string of at most the given size, writing it into the + * given buffer and returning its size in bytes. + * + * This does not add a null-terminator! Use mpack_expect_cstr() to + * add a null-terminator. + * + * NUL bytes are allowed in the string, and no encoding checks are done. + */ +size_t mpack_expect_str_buf(mpack_reader_t* reader, char* buf, size_t bufsize); + +/** + * Reads a string into the given buffer, ensuring it is a valid UTF-8 string + * and returning its size in bytes. + * + * This does not add a null-terminator! Use mpack_expect_utf8_cstr() to + * add a null-terminator. + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed. + * + * NUL bytes are allowed in the string (as they are in UTF-8.) + * + * Raises mpack_error_too_big if there is not enough room for the string. + * Raises mpack_error_type if the value is not a string or is not a valid UTF-8 string. + */ +size_t mpack_expect_utf8(mpack_reader_t* reader, char* buf, size_t bufsize); + +/** + * Reads the start of a string, raising an error if its length is not + * at most the given number of bytes (not including any null-terminator.) + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). @ref mpack_done_str() must be called + * once all bytes have been read. + * + * @throws mpack_error_type If the value is not a string. + * @throws mpack_error_too_big If the string's length in bytes is larger than the given maximum size. + */ +MPACK_INLINE uint32_t mpack_expect_str_max(mpack_reader_t* reader, uint32_t maxsize) { + uint32_t length = mpack_expect_str(reader); + if (length > maxsize) { + mpack_reader_flag_error(reader, mpack_error_too_big); + return 0; + } + return length; +} + +/** + * Reads the start of a string, raising an error if its length is not + * exactly the given number of bytes (not including any null-terminator.) + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). @ref mpack_done_str() must be called + * once all bytes have been read. + * + * mpack_error_type is raised if the value is not a string or if its + * length does not match. + */ +MPACK_INLINE void mpack_expect_str_length(mpack_reader_t* reader, uint32_t count) { + if (mpack_expect_str(reader) != count) + mpack_reader_flag_error(reader, mpack_error_type); +} + +/** + * Reads a string, ensuring it exactly matches the given string. + * + * Remember that maps are unordered in JSON. Don't use this for map keys + * unless the map has only a single key! + */ +void mpack_expect_str_match(mpack_reader_t* reader, const char* str, size_t length); + +/** + * Reads a string into the given buffer, ensures it has no null bytes, + * and adds a null-terminator at the end. + * + * Raises mpack_error_too_big if there is not enough room for the string and null-terminator. + * Raises mpack_error_type if the value is not a string or contains a null byte. + */ +void mpack_expect_cstr(mpack_reader_t* reader, char* buf, size_t size); + +/** + * Reads a string into the given buffer, ensures it is a valid UTF-8 string + * without NUL characters, and adds a null-terminator at the end. + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed, but without the NUL character, since + * it cannot be represented in a null-terminated string. + * + * Raises mpack_error_too_big if there is not enough room for the string and null-terminator. + * Raises mpack_error_type if the value is not a string or is not a valid UTF-8 string. + */ +void mpack_expect_utf8_cstr(mpack_reader_t* reader, char* buf, size_t size); + +#ifdef MPACK_MALLOC +/** + * Reads a string with the given total maximum size (including space for a + * null-terminator), allocates storage for it, ensures it has no null-bytes, + * and adds a null-terminator at the end. You assume ownership of the + * returned pointer if reading succeeds. + * + * The allocated string must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * + * @throws mpack_error_too_big If the string plus null-terminator is larger than the given maxsize. + * @throws mpack_error_type If the value is not a string or contains a null byte. + */ +char* mpack_expect_cstr_alloc(mpack_reader_t* reader, size_t maxsize); + +/** + * Reads a string with the given total maximum size (including space for a + * null-terminator), allocates storage for it, ensures it is valid UTF-8 + * with no null-bytes, and adds a null-terminator at the end. You assume + * ownership of the returned pointer if reading succeeds. + * + * The length in bytes of the string, not including the null-terminator, + * will be written to size. + * + * This does not accept any UTF-8 variant such as Modified UTF-8, CESU-8 or + * WTF-8. Only pure UTF-8 is allowed, but without the NUL character, since + * it cannot be represented in a null-terminated string. + * + * The allocated string must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * if you want a null-terminator. + * + * @throws mpack_error_too_big If the string plus null-terminator is larger + * than the given maxsize. + * @throws mpack_error_type If the value is not a string or contains + * invalid UTF-8 or a null byte. + */ +char* mpack_expect_utf8_cstr_alloc(mpack_reader_t* reader, size_t maxsize); +#endif + +/** + * Reads a string, ensuring it exactly matches the given null-terminated + * string. + * + * Remember that maps are unordered in JSON. Don't use this for map keys + * unless the map has only a single key! + */ +MPACK_INLINE void mpack_expect_cstr_match(mpack_reader_t* reader, const char* cstr) { + mpack_assert(cstr != NULL, "cstr pointer is NULL"); + mpack_expect_str_match(reader, cstr, mpack_strlen(cstr)); +} + +/** + * @} + */ + +/** + * @name Binary Data + * @{ + */ + +/** + * Reads the start of a binary blob, returning its size in bytes. + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). @ref mpack_done_bin() must be called + * once all bytes have been read. + * + * mpack_error_type is raised if the value is not a binary blob. + */ +uint32_t mpack_expect_bin(mpack_reader_t* reader); + +/** + * Reads the start of a binary blob, raising an error if its length is not + * at most the given number of bytes. + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). @ref mpack_done_bin() must be called + * once all bytes have been read. + * + * mpack_error_type is raised if the value is not a binary blob or if its + * length does not match. + */ +MPACK_INLINE uint32_t mpack_expect_bin_max(mpack_reader_t* reader, uint32_t maxsize) { + uint32_t length = mpack_expect_bin(reader); + if (length > maxsize) { + mpack_reader_flag_error(reader, mpack_error_type); + return 0; + } + return length; +} + +/** + * Reads the start of a binary blob, raising an error if its length is not + * exactly the given number of bytes. + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). @ref mpack_done_bin() must be called + * once all bytes have been read. + * + * @throws mpack_error_type if the value is not a binary blob or if its size + * does not match. + */ +MPACK_INLINE void mpack_expect_bin_size(mpack_reader_t* reader, uint32_t count) { + if (mpack_expect_bin(reader) != count) + mpack_reader_flag_error(reader, mpack_error_type); +} + +/** + * Reads a binary blob into the given buffer, returning its size in bytes. + * + * For compatibility, this will accept if the underlying type is string or + * binary (since in MessagePack 1.0, strings and binary data were combined + * under the "raw" type which became string in 1.1.) + */ +size_t mpack_expect_bin_buf(mpack_reader_t* reader, char* buf, size_t size); + +/** + * Reads a binary blob with the exact given size into the given buffer. + * + * For compatibility, this will accept if the underlying type is string or + * binary (since in MessagePack 1.0, strings and binary data were combined + * under the "raw" type which became string in 1.1.) + * + * @throws mpack_error_type if the value is not a binary blob or if its size + * does not match. + */ +void mpack_expect_bin_size_buf(mpack_reader_t* reader, char* buf, uint32_t size); + +/** + * Reads a binary blob with the given total maximum size, allocating storage for it. + */ +char* mpack_expect_bin_alloc(mpack_reader_t* reader, size_t maxsize, size_t* size); + +/** + * @} + */ + +/** + * @name Extension Functions + * @{ + */ + +#if MPACK_EXTENSIONS +/** + * Reads the start of an extension blob, returning its size in bytes and + * placing the type into @p type. + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). @ref mpack_done_ext() must be called + * once all bytes have been read. + * + * @p type will be a user-defined type in the range [0,127] or a reserved type + * in the range [-128,-2]. + * + * mpack_error_type is raised if the value is not an extension blob. The @p + * type value is zero if an error occurs. + * + * @note This cannot be used to match a timestamp. @ref mpack_error_type will + * be flagged if the value is a timestamp. Use mpack_expect_timestamp() or + * mpack_expect_timestamp_truncate() instead. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @warning Be careful when using reserved types. They may no longer be ext + * types in the future, and previously valid data containing reserved types may + * become invalid in the future. + */ +uint32_t mpack_expect_ext(mpack_reader_t* reader, int8_t* type); + +/** + * Reads the start of an extension blob, raising an error if its length is not + * at most the given number of bytes and placing the type into @p type. + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). @ref mpack_done_ext() must be called + * once all bytes have been read. + * + * mpack_error_type is raised if the value is not an extension blob or if its + * length does not match. The @p type value is zero if an error is raised. + * + * @p type will be a user-defined type in the range [0,127] or a reserved type + * in the range [-128,-2]. + * + * @note This cannot be used to match a timestamp. @ref mpack_error_type will + * be flagged if the value is a timestamp. Use mpack_expect_timestamp() or + * mpack_expect_timestamp_truncate() instead. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @warning Be careful when using reserved types. They may no longer be ext + * types in the future, and previously valid data containing reserved types may + * become invalid in the future. + * + * @see mpack_expect_ext() + */ +MPACK_INLINE uint32_t mpack_expect_ext_max(mpack_reader_t* reader, int8_t* type, uint32_t maxsize) { + uint32_t length = mpack_expect_ext(reader, type); + if (length > maxsize) { + mpack_reader_flag_error(reader, mpack_error_type); + return 0; + } + return length; +} + +/** + * Reads the start of an extension blob, raising an error if its length is not + * exactly the given number of bytes and placing the type into @p type. + * + * The bytes follow and must be read separately with mpack_read_bytes() + * or mpack_read_bytes_inplace(). @ref mpack_done_ext() must be called + * once all bytes have been read. + * + * mpack_error_type is raised if the value is not an extension blob or if its + * length does not match. The @p type value is zero if an error is raised. + * + * @p type will be a user-defined type in the range [0,127] or a reserved type + * in the range [-128,-2]. + * + * @note This cannot be used to match a timestamp. @ref mpack_error_type will + * be flagged if the value is a timestamp. Use mpack_expect_timestamp() or + * mpack_expect_timestamp_truncate() instead. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @warning Be careful when using reserved types. They may no longer be ext + * types in the future, and previously valid data containing reserved types may + * become invalid in the future. + * + * @see mpack_expect_ext() + */ +MPACK_INLINE void mpack_expect_ext_size(mpack_reader_t* reader, int8_t* type, uint32_t count) { + if (mpack_expect_ext(reader, type) != count) { + *type = 0; + mpack_reader_flag_error(reader, mpack_error_type); + } +} + +/** + * Reads an extension blob into the given buffer, returning its size in bytes + * and placing the type into @p type. + * + * mpack_error_type is raised if the value is not an extension blob or if its + * length does not match. The @p type value is zero if an error is raised. + * + * @p type will be a user-defined type in the range [0,127] or a reserved type + * in the range [-128,-2]. + * + * @note This cannot be used to match a timestamp. @ref mpack_error_type will + * be flagged if the value is a timestamp. Use mpack_expect_timestamp() or + * mpack_expect_timestamp_truncate() instead. + * + * @warning Be careful when using reserved types. They may no longer be ext + * types in the future, and previously valid data containing reserved types may + * become invalid in the future. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @see mpack_expect_ext() + */ +size_t mpack_expect_ext_buf(mpack_reader_t* reader, int8_t* type, char* buf, size_t size); +#endif + +#if MPACK_EXTENSIONS && defined(MPACK_MALLOC) +/** + * Reads an extension blob with the given total maximum size, allocating + * storage for it, and placing the type into @p type. + * + * mpack_error_type is raised if the value is not an extension blob or if its + * length does not match. The @p type value is zero if an error is raised. + * + * @p type will be a user-defined type in the range [0,127] or a reserved type + * in the range [-128,-2]. + * + * @note This cannot be used to match a timestamp. @ref mpack_error_type will + * be flagged if the value is a timestamp. Use mpack_expect_timestamp() or + * mpack_expect_timestamp_truncate() instead. + * + * @warning Be careful when using reserved types. They may no longer be ext + * types in the future, and previously valid data containing reserved types may + * become invalid in the future. + * + * @note This requires @ref MPACK_EXTENSIONS and @ref MPACK_MALLOC. + * + * @see mpack_expect_ext() + */ +char* mpack_expect_ext_alloc(mpack_reader_t* reader, int8_t* type, size_t maxsize, size_t* size); +#endif + +/** + * @} + */ + +/** + * @name Special Functions + * @{ + */ + +/** + * Reads a MessagePack object header (an MPack tag), expecting it to exactly + * match the given tag. + * + * If the type is compound (i.e. is a map, array, string, binary or + * extension type), additional reads are required to get the contained + * data, and the corresponding done function must be called when done. + * + * @throws mpack_error_type if the tag does not match + * + * @see mpack_read_bytes() + * @see mpack_done_array() + * @see mpack_done_map() + * @see mpack_done_str() + * @see mpack_done_bin() + * @see mpack_done_ext() + */ +void mpack_expect_tag(mpack_reader_t* reader, mpack_tag_t tag); + +/** + * Expects a string matching one of the strings in the given array, + * returning its array index. + * + * If the value does not match any of the given strings, + * @ref mpack_error_type is flagged. Use mpack_expect_enum_optional() + * if you want to allow other values than the given strings. + * + * If any error occurs or the reader is in an error state, @a count + * is returned. + * + * This can be used to quickly parse a string into an enum when the + * enum values range from 0 to @a count-1. If the last value in the + * enum is a special "count" value, it can be passed as the count, + * and the return value can be cast directly to the enum type. + * + * @code{.c} + * typedef enum { APPLE , BANANA , ORANGE , COUNT} fruit_t; + * const char* fruits[] = {"apple", "banana", "orange"}; + * + * fruit_t fruit = (fruit_t)mpack_expect_enum(reader, fruits, COUNT); + * @endcode + * + * See @ref docs/expect.md for more examples. + * + * The maximum string length is the size of the buffer (strings are read in-place.) + * + * @param reader The reader + * @param strings An array of expected strings of length count + * @param count The number of strings + * @return The index of the matched string, or @a count in case of error + */ +size_t mpack_expect_enum(mpack_reader_t* reader, const char* strings[], size_t count); + +/** + * Expects a string matching one of the strings in the given array + * returning its array index, or @a count if no strings match. + * + * If the value is not a string, or it does not match any of the + * given strings, @a count is returned and no error is flagged. + * + * If any error occurs or the reader is in an error state, @a count + * is returned. + * + * This can be used to quickly parse a string into an enum when the + * enum values range from 0 to @a count-1. If the last value in the + * enum is a special "count" value, it can be passed as the count, + * and the return value can be cast directly to the enum type. + * + * @code{.c} + * typedef enum { APPLE , BANANA , ORANGE , COUNT} fruit_t; + * const char* fruits[] = {"apple", "banana", "orange"}; + * + * fruit_t fruit = (fruit_t)mpack_expect_enum_optional(reader, fruits, COUNT); + * @endcode + * + * See @ref docs/expect.md for more examples. + * + * The maximum string length is the size of the buffer (strings are read in-place.) + * + * @param reader The reader + * @param strings An array of expected strings of length count + * @param count The number of strings + * + * @return The index of the matched string, or @a count if it does not + * match or an error occurs + */ +size_t mpack_expect_enum_optional(mpack_reader_t* reader, const char* strings[], size_t count); + +/** + * Expects an unsigned integer map key between 0 and count-1, marking it + * as found in the given bool array and returning it. + * + * This is a helper for switching among int keys in a map. It is + * typically used with an enum to define the key values. It should + * be called in the expression of a switch() statement. See @ref + * docs/expect.md for an example. + * + * The found array must be cleared before expecting the first key. If the + * flag for a given key is already set when found (i.e. the map contains a + * duplicate key), mpack_error_invalid is flagged. + * + * If the key is not a non-negative integer, or if the key is @a count or + * larger, @a count is returned and no error is flagged. If you want an error + * on unrecognized keys, flag an error in the default case in your switch; + * otherwise you must call mpack_discard() to discard its content. + * + * @param reader The reader + * @param found An array of bool flags of length count + * @param count The number of values in the found array, and one more than the + * maximum allowed key + * + * @see @ref docs/expect.md + */ +size_t mpack_expect_key_uint(mpack_reader_t* reader, bool found[], size_t count); + +/** + * Expects a string map key matching one of the strings in the given key list, + * marking it as found in the given bool array and returning its index. + * + * This is a helper for switching among string keys in a map. It is + * typically used with an enum with names matching the strings in the + * array to define the key indices. It should be called in the expression + * of a switch() statement. See @ref docs/expect.md for an example. + * + * The found array must be cleared before expecting the first key. If the + * flag for a given key is already set when found (i.e. the map contains a + * duplicate key), mpack_error_invalid is flagged. + * + * If the key is unrecognized, count is returned and no error is flagged. If + * you want an error on unrecognized keys, flag an error in the default case + * in your switch; otherwise you must call mpack_discard() to discard its content. + * + * The maximum key length is the size of the buffer (keys are read in-place.) + * + * @param reader The reader + * @param keys An array of expected string keys of length count + * @param found An array of bool flags of length count + * @param count The number of values in the keys and found arrays + * + * @see @ref docs/expect.md + */ +size_t mpack_expect_key_cstr(mpack_reader_t* reader, const char* keys[], + bool found[], size_t count); + +/** + * @} + */ + +/** + * @} + */ + +#endif + +MPACK_EXTERN_C_END +MPACK_HEADER_END + +#endif + + + +/* mpack/mpack-node.h.h */ + +/** + * @file + * + * Declares the MPack dynamic Node API. + */ + +#ifndef MPACK_NODE_H +#define MPACK_NODE_H 1 + +/* #include "mpack-reader.h" */ + +MPACK_HEADER_START +MPACK_EXTERN_C_START + +#if MPACK_NODE + +/** + * @defgroup node Node API + * + * The MPack Node API allows you to parse a chunk of MessagePack into a + * dynamically typed data structure, providing random access to the parsed + * data. + * + * See @ref docs/node.md for examples. + * + * @{ + */ + +/** + * A handle to node data in a parsed MPack tree. + * + * Nodes represent either primitive values or compound types. If a + * node is a compound type, it contains a pointer to its child nodes, + * or a pointer to its underlying data. + * + * Nodes are immutable. + * + * @note @ref mpack_node_t is an opaque reference to the node data, not the + * node data itself. (It contains pointers to both the node data and the tree.) + * It is passed by value in the Node API. + */ +typedef struct mpack_node_t mpack_node_t; + +/** + * The storage for nodes in an MPack tree. + * + * You only need to use this if you intend to provide your own storage + * for nodes instead of letting the tree allocate it. + * + * @ref mpack_node_data_t is 16 bytes on most common architectures (32-bit + * and 64-bit.) + */ +typedef struct mpack_node_data_t mpack_node_data_t; + +/** + * An MPack tree parser to parse a blob or stream of MessagePack. + * + * When a message is parsed, the tree contains a single root node which + * contains all parsed data. The tree and its nodes are immutable. + */ +typedef struct mpack_tree_t mpack_tree_t; + +/** + * An error handler function to be called when an error is flagged on + * the tree. + * + * The error handler will only be called once on the first error flagged; + * any subsequent node reads and errors are ignored, and the tree is + * permanently in that error state. + * + * MPack is safe against non-local jumps out of error handler callbacks. + * This means you are allowed to longjmp or throw an exception (in C++, + * Objective-C, or with SEH) out of this callback. + * + * Bear in mind when using longjmp that local non-volatile variables that + * have changed are undefined when setjmp() returns, so you can't put the + * tree on the stack in the same activation frame as the setjmp without + * declaring it volatile. + * + * You must still eventually destroy the tree. It is not destroyed + * automatically when an error is flagged. It is safe to destroy the + * tree within this error callback, but you will either need to perform + * a non-local jump, or store something in your context to identify + * that the tree is destroyed since any future accesses to it cause + * undefined behavior. + */ +typedef void (*mpack_tree_error_t)(mpack_tree_t* tree, mpack_error_t error); + +/** + * The MPack tree's read function. It should fill the buffer with as many bytes + * as are immediately available up to the given @c count, returning the number + * of bytes written to the buffer. + * + * In case of error, it should flag an appropriate error on the reader + * (usually @ref mpack_error_io.) + * + * The blocking or non-blocking behaviour of the read should match whether you + * are using mpack_tree_parse() or mpack_tree_try_parse(). + * + * If you are using mpack_tree_parse(), the read should block until at least + * one byte is read. If you return 0, mpack_tree_parse() will raise @ref + * mpack_error_io. + * + * If you are using mpack_tree_try_parse(), the read function can always + * return 0, and must never block waiting for data (otherwise + * mpack_tree_try_parse() would be equivalent to mpack_tree_parse().) + * When you return 0, mpack_tree_try_parse() will return false without flagging + * an error. + */ +typedef size_t (*mpack_tree_read_t)(mpack_tree_t* tree, char* buffer, size_t count); + +/** + * A teardown function to be called when the tree is destroyed. + */ +typedef void (*mpack_tree_teardown_t)(mpack_tree_t* tree); + + + +/* Hide internals from documentation */ +/** @cond */ + +struct mpack_node_t { + mpack_node_data_t* data; + mpack_tree_t* tree; +}; + +struct mpack_node_data_t { + mpack_type_t type; + + /* + * The element count if the type is an array; + * the number of key/value pairs if the type is map; + * or the number of bytes if the type is str, bin or ext. + */ + uint32_t len; + + union + { + bool b; /* The value if the type is bool. */ + float f; /* The value if the type is float. */ + double d; /* The value if the type is double. */ + int64_t i; /* The value if the type is signed int. */ + uint64_t u; /* The value if the type is unsigned int. */ + size_t offset; /* The byte offset for str, bin and ext */ + mpack_node_data_t* children; /* The children for map or array */ + } value; +}; + +typedef struct mpack_tree_page_t { + struct mpack_tree_page_t* next; + mpack_node_data_t nodes[1]; // variable size +} mpack_tree_page_t; + +typedef enum mpack_tree_parse_state_t { + mpack_tree_parse_state_not_started, + mpack_tree_parse_state_in_progress, + mpack_tree_parse_state_parsed, +} mpack_tree_parse_state_t; + +typedef struct mpack_level_t { + mpack_node_data_t* child; + size_t left; // children left in level +} mpack_level_t; + +typedef struct mpack_tree_parser_t { + mpack_tree_parse_state_t state; + + // We keep track of the number of "possible nodes" left in the data rather + // than the number of bytes. + // + // When a map or array is parsed, we ensure at least one byte for each child + // exists and subtract them right away. This ensures that if ever a map or + // array declares more elements than could possibly be contained in the data, + // we will error out immediately rather than allocating storage for them. + // + // For example malicious data that repeats 0xDE 0xFF 0xFF (start of a map + // with 65536 key-value pairs) would otherwise cause us to run out of + // memory. With this, the parser can allocate at most as many nodes as + // there are bytes in the data (plus the paging overhead, 12%.) An error + // will be flagged immediately if and when there isn't enough data left to + // fully read all children of all open compound types on the parsing stack. + // + // Once an entire message has been parsed (and there are no nodes left to + // parse whose bytes have been subtracted), this matches the number of left + // over bytes in the data. + size_t possible_nodes_left; + + mpack_node_data_t* nodes; // next node in current page/pool + size_t nodes_left; // nodes left in current page/pool + + size_t current_node_reserved; + size_t level; + + #ifdef MPACK_MALLOC + // It's much faster to allocate the initial parsing stack inline within the + // parser. We replace it with a heap allocation if we need to grow it. + mpack_level_t* stack; + size_t stack_capacity; + bool stack_owned; + mpack_level_t stack_local[MPACK_NODE_INITIAL_DEPTH]; + #else + // Without malloc(), we have to reserve a parsing stack the maximum allowed + // parsing depth. + mpack_level_t stack[MPACK_NODE_MAX_DEPTH_WITHOUT_MALLOC]; + #endif +} mpack_tree_parser_t; + +struct mpack_tree_t { + mpack_tree_error_t error_fn; /* Function to call on error */ + mpack_tree_read_t read_fn; /* Function to call to read more data */ + mpack_tree_teardown_t teardown; /* Function to teardown the context on destroy */ + void* context; /* Context for tree callbacks */ + + mpack_node_data_t nil_node; /* a nil node to be returned in case of error */ + mpack_node_data_t missing_node; /* a missing node to be returned in optional lookups */ + mpack_error_t error; + + #ifdef MPACK_MALLOC + char* buffer; + size_t buffer_capacity; + #endif + + const char* data; + size_t data_length; // length of data (and content of buffer, if used) + + size_t size; // size in bytes of tree (usually matches data_length, but not if tree has trailing data) + size_t node_count; // total number of nodes in tree (across all pages) + + size_t max_size; // maximum message size + size_t max_nodes; // maximum nodes in a message + + mpack_tree_parser_t parser; + mpack_node_data_t* root; + + mpack_node_data_t* pool; // pool, or NULL if no pool provided + size_t pool_count; + + #ifdef MPACK_MALLOC + mpack_tree_page_t* next; + #endif +}; + +// internal functions + +MPACK_INLINE mpack_node_t mpack_node(mpack_tree_t* tree, mpack_node_data_t* data) { + mpack_node_t node; + node.data = data; + node.tree = tree; + return node; +} + +MPACK_INLINE mpack_node_data_t* mpack_node_child(mpack_node_t node, size_t child) { + return node.data->value.children + child; +} + +MPACK_INLINE mpack_node_t mpack_tree_nil_node(mpack_tree_t* tree) { + return mpack_node(tree, &tree->nil_node); +} + +MPACK_INLINE mpack_node_t mpack_tree_missing_node(mpack_tree_t* tree) { + return mpack_node(tree, &tree->missing_node); +} + +/** @endcond */ + + + +/** + * @name Tree Initialization + * @{ + */ + +#ifdef MPACK_MALLOC +/** + * Initializes a tree parser with the given data. + * + * Configure the tree if desired, then call mpack_tree_parse() to parse it. The + * tree will allocate pages of nodes as needed and will free them when + * destroyed. + * + * The tree must be destroyed with mpack_tree_destroy(). + * + * Any string or blob data types reference the original data, so the given data + * pointer must remain valid until after the tree is destroyed. + */ +void mpack_tree_init_data(mpack_tree_t* tree, const char* data, size_t length); + +/** + * Deprecated. + * + * \deprecated Renamed to mpack_tree_init_data(). + */ +MPACK_INLINE void mpack_tree_init(mpack_tree_t* tree, const char* data, size_t length) { + mpack_tree_init_data(tree, data, length); +} + +/** + * Initializes a tree parser from an unbounded stream, or a stream of + * unknown length. + * + * The parser can be used to read a single message from a stream of unknown + * length, or multiple messages from an unbounded stream, allowing it to + * be used for RPC communication. Call @ref mpack_tree_parse() to parse + * a message from a blocking stream, or @ref mpack_tree_try_parse() for a + * non-blocking stream. + * + * The stream will use a growable internal buffer to store the most recent + * message, as well as allocated pages of nodes for the parse tree. + * + * Maximum allowances for message size and node count must be specified in this + * function (since the stream is unbounded.) They can be changed later with + * @ref mpack_tree_set_limits(). + * + * @param tree The tree parser + * @param read_fn The read function + * @param context The context for the read function + * @param max_message_size The maximum size of a message in bytes + * @param max_message_nodes The maximum number of nodes per message. See + * @ref mpack_node_data_t for the size of nodes. + * + * @see mpack_tree_read_t + * @see mpack_reader_context() + */ +void mpack_tree_init_stream(mpack_tree_t* tree, mpack_tree_read_t read_fn, void* context, + size_t max_message_size, size_t max_message_nodes); +#endif + +/** + * Initializes a tree parser with the given data, using the given node data + * pool to store the results. + * + * Configure the tree if desired, then call mpack_tree_parse() to parse it. + * + * If the data does not fit in the pool, @ref mpack_error_too_big will be flagged + * on the tree. + * + * The tree must be destroyed with mpack_tree_destroy(), even if parsing fails. + */ +void mpack_tree_init_pool(mpack_tree_t* tree, const char* data, size_t length, + mpack_node_data_t* node_pool, size_t node_pool_count); + +/** + * Initializes an MPack tree directly into an error state. Use this if you + * are writing a wrapper to another mpack_tree_init*() function which + * can fail its setup. + */ +void mpack_tree_init_error(mpack_tree_t* tree, mpack_error_t error); + +#if MPACK_STDIO +/** + * Initializes a tree to parse the given file. The tree must be destroyed with + * mpack_tree_destroy(), even if parsing fails. + * + * The file is opened, loaded fully into memory, and closed before this call + * returns. + * + * @param tree The tree to initialize + * @param filename The filename passed to fopen() to read the file + * @param max_bytes The maximum size of file to load, or 0 for unlimited size. + */ +void mpack_tree_init_filename(mpack_tree_t* tree, const char* filename, size_t max_bytes); + +/** + * Deprecated. + * + * \deprecated Renamed to mpack_tree_init_filename(). + */ +MPACK_INLINE void mpack_tree_init_file(mpack_tree_t* tree, const char* filename, size_t max_bytes) { + mpack_tree_init_filename(tree, filename, max_bytes); +} + +/** + * Initializes a tree to parse the given libc FILE. This can be used to + * read from stdin, or from a file opened separately. + * + * The tree must be destroyed with mpack_tree_destroy(), even if parsing fails. + * + * The FILE is fully loaded fully into memory (and closed if requested) before + * this call returns. + * + * @param tree The tree to initialize. + * @param stdfile The FILE. + * @param max_bytes The maximum size of file to load, or 0 for unlimited size. + * @param close_when_done If true, fclose() will be called on the FILE when it + * is no longer needed. If false, the file will not be closed when + * reading is done. + * + * @warning The tree will read all data in the FILE before parsing it. If this + * is used on stdin, the parser will block until it is closed, even if + * a complete message has been written to it! + */ +void mpack_tree_init_stdfile(mpack_tree_t* tree, FILE* stdfile, size_t max_bytes, bool close_when_done); +#endif + +/** + * @} + */ + +/** + * @name Tree Functions + * @{ + */ + +/** + * Sets the maximum byte size and maximum number of nodes allowed per message. + * + * The default is SIZE_MAX (no limit) unless @ref mpack_tree_init_stream() is + * called (where maximums are required.) + * + * If a pool of nodes is used, the node limit is the lesser of this limit and + * the pool size. + * + * @param tree The tree parser + * @param max_message_size The maximum size of a message in bytes + * @param max_message_nodes The maximum number of nodes per message. See + * @ref mpack_node_data_t for the size of nodes. + */ +void mpack_tree_set_limits(mpack_tree_t* tree, size_t max_message_size, + size_t max_message_nodes); + +/** + * Parses a MessagePack message into a tree of immutable nodes. + * + * If successful, the root node will be available under @ref mpack_tree_root(). + * If not, an appropriate error will be flagged. + * + * This can be called repeatedly to parse a series of messages from a data + * source. When this is called, all previous nodes from this tree and their + * contents (including the root node) are invalidated. + * + * If this is called with a stream (see @ref mpack_tree_init_stream()), the + * stream must block until data is available. (Otherwise, if this is called on + * a non-blocking stream, parsing will fail with @ref mpack_error_io when the + * fill function returns 0.) + * + * There is no way to recover a tree in an error state. It must be destroyed. + */ +void mpack_tree_parse(mpack_tree_t* tree); + +/** + * Attempts to parse a MessagePack message from a non-blocking stream into a + * tree of immutable nodes. + * + * A non-blocking read function must have been passed to the tree in + * mpack_tree_init_stream(). + * + * If this returns true, a message is available under + * @ref mpack_tree_root(). The tree nodes and data will be valid until + * the next time a parse is started. + * + * If this returns false, no message is available, because either not enough + * data is available yet or an error has occurred. You must check the tree for + * errors whenever this returns false. If there is no error, you should try + * again later when more data is available. (You will want to select()/poll() + * on the underlying socket or use some other asynchronous mechanism to + * determine when it has data.) + * + * There is no way to recover a tree in an error state. It must be destroyed. + * + * @see mpack_tree_init_stream() + */ +bool mpack_tree_try_parse(mpack_tree_t* tree); + +/** + * Returns the root node of the tree, if the tree is not in an error state. + * Returns a nil node otherwise. + * + * @warning You must call mpack_tree_parse() before calling this. If + * @ref mpack_tree_parse() was never called, the tree will assert. + */ +mpack_node_t mpack_tree_root(mpack_tree_t* tree); + +/** + * Returns the error state of the tree. + */ +MPACK_INLINE mpack_error_t mpack_tree_error(mpack_tree_t* tree) { + return tree->error; +} + +/** + * Returns the size in bytes of the current parsed message. + * + * If there is something in the buffer after the MessagePack object, this can + * be used to find it. + * + * This is zero if an error occurred during tree parsing (since the + * portion of the data that the first complete object occupies cannot + * be determined if the data is invalid or corrupted.) + */ +MPACK_INLINE size_t mpack_tree_size(mpack_tree_t* tree) { + return tree->size; +} + +/** + * Destroys the tree. + */ +mpack_error_t mpack_tree_destroy(mpack_tree_t* tree); + +/** + * Sets the custom pointer to pass to the tree callbacks, such as teardown. + * + * @param tree The MPack tree. + * @param context User data to pass to the tree callbacks. + * + * @see mpack_reader_context() + */ +MPACK_INLINE void mpack_tree_set_context(mpack_tree_t* tree, void* context) { + tree->context = context; +} + +/** + * Returns the custom context for tree callbacks. + * + * @see mpack_tree_set_context + * @see mpack_tree_init_stream + */ +MPACK_INLINE void* mpack_tree_context(mpack_tree_t* tree) { + return tree->context; +} + +/** + * Sets the error function to call when an error is flagged on the tree. + * + * This should normally be used with mpack_tree_set_context() to register + * a custom pointer to pass to the error function. + * + * See the definition of mpack_tree_error_t for more information about + * what you can do from an error callback. + * + * @see mpack_tree_error_t + * @param tree The MPack tree. + * @param error_fn The function to call when an error is flagged on the tree. + */ +MPACK_INLINE void mpack_tree_set_error_handler(mpack_tree_t* tree, mpack_tree_error_t error_fn) { + tree->error_fn = error_fn; +} + +/** + * Sets the teardown function to call when the tree is destroyed. + * + * This should normally be used with mpack_tree_set_context() to register + * a custom pointer to pass to the teardown function. + * + * @param tree The MPack tree. + * @param teardown The function to call when the tree is destroyed. + */ +MPACK_INLINE void mpack_tree_set_teardown(mpack_tree_t* tree, mpack_tree_teardown_t teardown) { + tree->teardown = teardown; +} + +/** + * Places the tree in the given error state, calling the error callback if one + * is set. + * + * This allows you to externally flag errors, for example if you are validating + * data as you read it. + * + * If the tree is already in an error state, this call is ignored and no + * error callback is called. + */ +void mpack_tree_flag_error(mpack_tree_t* tree, mpack_error_t error); + +/** + * @} + */ + +/** + * @name Node Core Functions + * @{ + */ + +/** + * Places the node's tree in the given error state, calling the error callback + * if one is set. + * + * This allows you to externally flag errors, for example if you are validating + * data as you read it. + * + * If the tree is already in an error state, this call is ignored and no + * error callback is called. + */ +void mpack_node_flag_error(mpack_node_t node, mpack_error_t error); + +/** + * Returns the error state of the node's tree. + */ +MPACK_INLINE mpack_error_t mpack_node_error(mpack_node_t node) { + return mpack_tree_error(node.tree); +} + +/** + * Returns a tag describing the given node, or a nil tag if the + * tree is in an error state. + */ +mpack_tag_t mpack_node_tag(mpack_node_t node); + +/** @cond */ + +#if MPACK_DEBUG && MPACK_STDIO +/* + * Converts a node to a pseudo-JSON string for debugging purposes, placing the + * result in the given buffer with a null-terminator. + * + * If the buffer does not have enough space, the result will be truncated (but + * it is guaranteed to be null-terminated.) + * + * This is only available in debug mode, and only if stdio is available (since + * it uses snprintf().) It's strictly for debugging purposes. + */ +void mpack_node_print_to_buffer(mpack_node_t node, char* buffer, size_t buffer_size); + +/* + * Converts a node to pseudo-JSON for debugging purposes, calling the given + * callback as many times as is necessary to output the character data. + * + * No null-terminator or trailing newline will be written. + * + * This is only available in debug mode, and only if stdio is available (since + * it uses snprintf().) It's strictly for debugging purposes. + */ +void mpack_node_print_to_callback(mpack_node_t node, mpack_print_callback_t callback, void* context); + +/* + * Converts a node to pseudo-JSON for debugging purposes + * and pretty-prints it to the given file. + * + * This is only available in debug mode, and only if stdio is available (since + * it uses snprintf().) It's strictly for debugging purposes. + */ +void mpack_node_print_to_file(mpack_node_t node, FILE* file); + +/* + * Converts a node to pseudo-JSON for debugging purposes + * and pretty-prints it to stdout. + * + * This is only available in debug mode, and only if stdio is available (since + * it uses snprintf().) It's strictly for debugging purposes. + */ +MPACK_INLINE void mpack_node_print_to_stdout(mpack_node_t node) { + mpack_node_print_to_file(node, stdout); +} + +/* + * Deprecated. + * + * \deprecated Renamed to mpack_node_print_to_stdout(). + */ +MPACK_INLINE void mpack_node_print(mpack_node_t node) { + mpack_node_print_to_stdout(node); +} +#endif + +/** @endcond */ + +/** + * @} + */ + +/** + * @name Node Primitive Value Functions + * @{ + */ + +/** + * Returns the type of the node. + */ +mpack_type_t mpack_node_type(mpack_node_t node); + +/** + * Returns true if the given node is a nil node; false otherwise. + * + * To ensure that a node is nil and flag an error otherwise, use + * mpack_node_nil(). + */ +bool mpack_node_is_nil(mpack_node_t node); + +/** + * Returns true if the given node handle indicates a missing node; false otherwise. + * + * To ensure that a node is missing and flag an error otherwise, use + * mpack_node_missing(). + */ +bool mpack_node_is_missing(mpack_node_t node); + +/** + * Checks that the given node is of nil type, raising @ref mpack_error_type + * otherwise. + * + * Use mpack_node_is_nil() to return whether the node is nil. + */ +void mpack_node_nil(mpack_node_t node); + +/** + * Checks that the given node indicates a missing node, raising @ref + * mpack_error_type otherwise. + * + * Use mpack_node_is_missing() to return whether the node is missing. + */ +void mpack_node_missing(mpack_node_t node); + +/** + * Returns the bool value of the node. If this node is not of the correct + * type, false is returned and mpack_error_type is raised. + */ +bool mpack_node_bool(mpack_node_t node); + +/** + * Checks if the given node is of bool type with value true, raising + * mpack_error_type otherwise. + */ +void mpack_node_true(mpack_node_t node); + +/** + * Checks if the given node is of bool type with value false, raising + * mpack_error_type otherwise. + */ +void mpack_node_false(mpack_node_t node); + +/** + * Returns the 8-bit unsigned value of the node. If this node is not + * of a compatible type, @ref mpack_error_type is raised and zero is returned. + */ +uint8_t mpack_node_u8(mpack_node_t node); + +/** + * Returns the 8-bit signed value of the node. If this node is not + * of a compatible type, @ref mpack_error_type is raised and zero is returned. + */ +int8_t mpack_node_i8(mpack_node_t node); + +/** + * Returns the 16-bit unsigned value of the node. If this node is not + * of a compatible type, @ref mpack_error_type is raised and zero is returned. + */ +uint16_t mpack_node_u16(mpack_node_t node); + +/** + * Returns the 16-bit signed value of the node. If this node is not + * of a compatible type, @ref mpack_error_type is raised and zero is returned. + */ +int16_t mpack_node_i16(mpack_node_t node); + +/** + * Returns the 32-bit unsigned value of the node. If this node is not + * of a compatible type, @ref mpack_error_type is raised and zero is returned. + */ +uint32_t mpack_node_u32(mpack_node_t node); + +/** + * Returns the 32-bit signed value of the node. If this node is not + * of a compatible type, @ref mpack_error_type is raised and zero is returned. + */ +int32_t mpack_node_i32(mpack_node_t node); + +/** + * Returns the 64-bit unsigned value of the node. If this node is not + * of a compatible type, @ref mpack_error_type is raised, and zero is returned. + */ +uint64_t mpack_node_u64(mpack_node_t node); + +/** + * Returns the 64-bit signed value of the node. If this node is not + * of a compatible type, @ref mpack_error_type is raised and zero is returned. + */ +int64_t mpack_node_i64(mpack_node_t node); + +/** + * Returns the unsigned int value of the node. + * + * Returns zero if an error occurs. + * + * @throws mpack_error_type If the node is not an integer type or does not fit in the range of an unsigned int + */ +unsigned int mpack_node_uint(mpack_node_t node); + +/** + * Returns the int value of the node. + * + * Returns zero if an error occurs. + * + * @throws mpack_error_type If the node is not an integer type or does not fit in the range of an int + */ +int mpack_node_int(mpack_node_t node); + +/** + * Returns the float value of the node. The underlying value can be an + * integer, float or double; the value is converted to a float. + * + * @note Reading a double or a large integer with this function can incur a + * loss of precision. + * + * @throws mpack_error_type if the underlying value is not a float, double or integer. + */ +float mpack_node_float(mpack_node_t node); + +/** + * Returns the double value of the node. The underlying value can be an + * integer, float or double; the value is converted to a double. + * + * @note Reading a very large integer with this function can incur a + * loss of precision. + * + * @throws mpack_error_type if the underlying value is not a float, double or integer. + */ +double mpack_node_double(mpack_node_t node); + +/** + * Returns the float value of the node. The underlying value must be a float, + * not a double or an integer. This ensures no loss of precision can occur. + * + * @throws mpack_error_type if the underlying value is not a float. + */ +float mpack_node_float_strict(mpack_node_t node); + +/** + * Returns the double value of the node. The underlying value must be a float + * or double, not an integer. This ensures no loss of precision can occur. + * + * @throws mpack_error_type if the underlying value is not a float or double. + */ +double mpack_node_double_strict(mpack_node_t node); + +#if MPACK_EXTENSIONS +/** + * Returns a timestamp. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @throws mpack_error_type if the underlying value is not a timestamp. + */ +mpack_timestamp_t mpack_node_timestamp(mpack_node_t node); + +/** + * Returns a timestamp's (signed) seconds since 1970-01-01T00:00:00Z. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @throws mpack_error_type if the underlying value is not a timestamp. + */ +int64_t mpack_node_timestamp_seconds(mpack_node_t node); + +/** + * Returns a timestamp's additional nanoseconds. + * + * @note This requires @ref MPACK_EXTENSIONS. + * + * @return A nanosecond count between 0 and 999,999,999 inclusive. + * @throws mpack_error_type if the underlying value is not a timestamp. + */ +uint32_t mpack_node_timestamp_nanoseconds(mpack_node_t node); +#endif + +/** + * @} + */ + +/** + * @name Node String and Data Functions + * @{ + */ + +/** + * Checks that the given node contains a valid UTF-8 string. + * + * If the string is invalid, this flags an error, which would cause subsequent calls + * to mpack_node_str() to return NULL and mpack_node_strlen() to return zero. So you + * can check the node for error immediately after calling this, or you can call those + * functions to use the data anyway and check for errors later. + * + * @throws mpack_error_type If this node is not a string or does not contain valid UTF-8. + * + * @param node The string node to test + * + * @see mpack_node_str() + * @see mpack_node_strlen() + */ +void mpack_node_check_utf8(mpack_node_t node); + +/** + * Checks that the given node contains a valid UTF-8 string with no NUL bytes. + * + * This does not check that the string has a null-terminator! It only checks whether + * the string could safely be represented as a C-string by appending a null-terminator. + * (If the string does already contain a null-terminator, this will flag an error.) + * + * This is performed automatically by other UTF-8 cstr helper functions. Only + * call this if you will do something else with the data directly, but you still + * want to ensure it will be valid as a UTF-8 C-string. + * + * @throws mpack_error_type If this node is not a string, does not contain valid UTF-8, + * or contains a NUL byte. + * + * @param node The string node to test + * + * @see mpack_node_str() + * @see mpack_node_strlen() + * @see mpack_node_copy_utf8_cstr() + * @see mpack_node_utf8_cstr_alloc() + */ +void mpack_node_check_utf8_cstr(mpack_node_t node); + +#if MPACK_EXTENSIONS +/** + * Returns the extension type of the given ext node. + * + * This returns zero if the tree is in an error state. + * + * @note This requires @ref MPACK_EXTENSIONS. + */ +int8_t mpack_node_exttype(mpack_node_t node); +#endif + +/** + * Returns the number of bytes in the given bin node. + * + * This returns zero if the tree is in an error state. + * + * If this node is not a bin, @ref mpack_error_type is raised and zero is returned. + */ +size_t mpack_node_bin_size(mpack_node_t node); + +/** + * Returns the length of the given str, bin or ext node. + * + * This returns zero if the tree is in an error state. + * + * If this node is not a str, bin or map, @ref mpack_error_type is raised and zero + * is returned. + */ +uint32_t mpack_node_data_len(mpack_node_t node); + +/** + * Returns the length in bytes of the given string node. This does not + * include any null-terminator. + * + * This returns zero if the tree is in an error state. + * + * If this node is not a str, @ref mpack_error_type is raised and zero is returned. + */ +size_t mpack_node_strlen(mpack_node_t node); + +/** + * Returns a pointer to the data contained by this node, ensuring the node is a + * string. + * + * @warning Strings are not null-terminated! Use one of the cstr functions + * to get a null-terminated string. + * + * The pointer is valid as long as the data backing the tree is valid. + * + * If this node is not a string, @ref mpack_error_type is raised and @c NULL is returned. + * + * @see mpack_node_copy_cstr() + * @see mpack_node_cstr_alloc() + * @see mpack_node_utf8_cstr_alloc() + */ +const char* mpack_node_str(mpack_node_t node); + +/** + * Returns a pointer to the data contained by this node. + * + * @note Strings are not null-terminated! Use one of the cstr functions + * to get a null-terminated string. + * + * The pointer is valid as long as the data backing the tree is valid. + * + * If this node is not of a str, bin or map, @ref mpack_error_type is raised, and + * @c NULL is returned. + * + * @see mpack_node_copy_cstr() + * @see mpack_node_cstr_alloc() + * @see mpack_node_utf8_cstr_alloc() + */ +const char* mpack_node_data(mpack_node_t node); + +/** + * Returns a pointer to the data contained by this bin node. + * + * The pointer is valid as long as the data backing the tree is valid. + * + * If this node is not a bin, @ref mpack_error_type is raised and @c NULL is + * returned. + */ +const char* mpack_node_bin_data(mpack_node_t node); + +/** + * Copies the bytes contained by this node into the given buffer, returning the + * number of bytes in the node. + * + * @throws mpack_error_type If this node is not a str, bin or ext type + * @throws mpack_error_too_big If the string does not fit in the given buffer + * + * @param node The string node from which to copy data + * @param buffer A buffer in which to copy the node's bytes + * @param bufsize The size of the given buffer + * + * @return The number of bytes in the node, or zero if an error occurs. + */ +size_t mpack_node_copy_data(mpack_node_t node, char* buffer, size_t bufsize); + +/** + * Checks that the given node contains a valid UTF-8 string and copies the + * string into the given buffer, returning the number of bytes in the string. + * + * @throws mpack_error_type If this node is not a string + * @throws mpack_error_too_big If the string does not fit in the given buffer + * + * @param node The string node from which to copy data + * @param buffer A buffer in which to copy the node's bytes + * @param bufsize The size of the given buffer + * + * @return The number of bytes in the node, or zero if an error occurs. + */ +size_t mpack_node_copy_utf8(mpack_node_t node, char* buffer, size_t bufsize); + +/** + * Checks that the given node contains a string with no NUL bytes, copies the string + * into the given buffer, and adds a null terminator. + * + * If this node is not of a string type, @ref mpack_error_type is raised. If the string + * does not fit, @ref mpack_error_data is raised. + * + * If any error occurs, the buffer will contain an empty null-terminated string. + * + * @param node The string node from which to copy data + * @param buffer A buffer in which to copy the node's string + * @param size The size of the given buffer + */ +void mpack_node_copy_cstr(mpack_node_t node, char* buffer, size_t size); + +/** + * Checks that the given node contains a valid UTF-8 string with no NUL bytes, + * copies the string into the given buffer, and adds a null terminator. + * + * If this node is not of a string type, @ref mpack_error_type is raised. If the string + * does not fit, @ref mpack_error_data is raised. + * + * If any error occurs, the buffer will contain an empty null-terminated string. + * + * @param node The string node from which to copy data + * @param buffer A buffer in which to copy the node's string + * @param size The size of the given buffer + */ +void mpack_node_copy_utf8_cstr(mpack_node_t node, char* buffer, size_t size); + +#ifdef MPACK_MALLOC +/** + * Allocates a new chunk of data using MPACK_MALLOC() with the bytes + * contained by this node. + * + * The allocated data must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * + * @throws mpack_error_type If this node is not a str, bin or ext type + * @throws mpack_error_too_big If the size of the data is larger than the + * given maximum size + * @throws mpack_error_memory If an allocation failure occurs + * + * @param node The node from which to allocate and copy data + * @param maxsize The maximum size to allocate + * + * @return The allocated data, or NULL if any error occurs. + */ +char* mpack_node_data_alloc(mpack_node_t node, size_t maxsize); + +/** + * Allocates a new null-terminated string using MPACK_MALLOC() with the string + * contained by this node. + * + * The allocated string must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * + * @throws mpack_error_type If this node is not a string or contains NUL bytes + * @throws mpack_error_too_big If the size of the string plus null-terminator + * is larger than the given maximum size + * @throws mpack_error_memory If an allocation failure occurs + * + * @param node The node from which to allocate and copy string data + * @param maxsize The maximum size to allocate, including the null-terminator + * + * @return The allocated string, or NULL if any error occurs. + */ +char* mpack_node_cstr_alloc(mpack_node_t node, size_t maxsize); + +/** + * Allocates a new null-terminated string using MPACK_MALLOC() with the UTF-8 + * string contained by this node. + * + * The allocated string must be freed with MPACK_FREE() (or simply free() + * if MPack's allocator hasn't been customized.) + * + * @throws mpack_error_type If this node is not a string, is not valid UTF-8, + * or contains NUL bytes + * @throws mpack_error_too_big If the size of the string plus null-terminator + * is larger than the given maximum size + * @throws mpack_error_memory If an allocation failure occurs + * + * @param node The node from which to allocate and copy string data + * @param maxsize The maximum size to allocate, including the null-terminator + * + * @return The allocated string, or NULL if any error occurs. + */ +char* mpack_node_utf8_cstr_alloc(mpack_node_t node, size_t maxsize); +#endif + +/** + * Searches the given string array for a string matching the given + * node and returns its index. + * + * If the node does not match any of the given strings, + * @ref mpack_error_type is flagged. Use mpack_node_enum_optional() + * if you want to allow values other than the given strings. + * + * If any error occurs or if the tree is in an error state, @a count + * is returned. + * + * This can be used to quickly parse a string into an enum when the + * enum values range from 0 to @a count-1. If the last value in the + * enum is a special "count" value, it can be passed as the count, + * and the return value can be cast directly to the enum type. + * + * @code{.c} + * typedef enum { APPLE , BANANA , ORANGE , COUNT} fruit_t; + * const char* fruits[] = {"apple", "banana", "orange"}; + * + * fruit_t fruit = (fruit_t)mpack_node_enum(node, fruits, COUNT); + * @endcode + * + * @param node The node + * @param strings An array of expected strings of length count + * @param count The number of strings + * @return The index of the matched string, or @a count in case of error + */ +size_t mpack_node_enum(mpack_node_t node, const char* strings[], size_t count); + +/** + * Searches the given string array for a string matching the given node, + * returning its index or @a count if no strings match. + * + * If the value is not a string, or it does not match any of the + * given strings, @a count is returned and no error is flagged. + * + * If any error occurs or if the tree is in an error state, @a count + * is returned. + * + * This can be used to quickly parse a string into an enum when the + * enum values range from 0 to @a count-1. If the last value in the + * enum is a special "count" value, it can be passed as the count, + * and the return value can be cast directly to the enum type. + * + * @code{.c} + * typedef enum { APPLE , BANANA , ORANGE , COUNT} fruit_t; + * const char* fruits[] = {"apple", "banana", "orange"}; + * + * fruit_t fruit = (fruit_t)mpack_node_enum_optional(node, fruits, COUNT); + * @endcode + * + * @param node The node + * @param strings An array of expected strings of length count + * @param count The number of strings + * @return The index of the matched string, or @a count in case of error + */ +size_t mpack_node_enum_optional(mpack_node_t node, const char* strings[], size_t count); + +/** + * @} + */ + +/** + * @name Compound Node Functions + * @{ + */ + +/** + * Returns the length of the given array node. Raises mpack_error_type + * and returns 0 if the given node is not an array. + */ +size_t mpack_node_array_length(mpack_node_t node); + +/** + * Returns the node in the given array at the given index. If the node + * is not an array, @ref mpack_error_type is raised and a nil node is returned. + * If the given index is out of bounds, @ref mpack_error_data is raised and + * a nil node is returned. + */ +mpack_node_t mpack_node_array_at(mpack_node_t node, size_t index); + +/** + * Returns the number of key/value pairs in the given map node. Raises + * mpack_error_type and returns 0 if the given node is not a map. + */ +size_t mpack_node_map_count(mpack_node_t node); + +/** + * Returns the key node in the given map at the given index. + * + * A nil node is returned in case of error. + * + * @throws mpack_error_type if the node is not a map + * @throws mpack_error_data if the given index is out of bounds + */ +mpack_node_t mpack_node_map_key_at(mpack_node_t node, size_t index); + +/** + * Returns the value node in the given map at the given index. + * + * A nil node is returned in case of error. + * + * @throws mpack_error_type if the node is not a map + * @throws mpack_error_data if the given index is out of bounds + */ +mpack_node_t mpack_node_map_value_at(mpack_node_t node, size_t index); + +/** + * Returns the value node in the given map for the given integer key. + * + * The key must exist within the map. Use mpack_node_map_int_optional() to + * check for optional keys. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node does not contain exactly one entry with the given key + * + * @return The value node for the given key, or a nil node in case of error + */ +mpack_node_t mpack_node_map_int(mpack_node_t node, int64_t num); + +/** + * Returns the value node in the given map for the given integer key, or a + * missing node if the map does not contain the given key. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node contains more than one entry with the given key + * + * @return The value node for the given key, or a missing node if the key does + * not exist, or a nil node in case of error + * + * @see mpack_node_is_missing() + */ +mpack_node_t mpack_node_map_int_optional(mpack_node_t node, int64_t num); + +/** + * Returns the value node in the given map for the given unsigned integer key. + * + * The key must exist within the map. Use mpack_node_map_uint_optional() to + * check for optional keys. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node does not contain exactly one entry with the given key + * + * @return The value node for the given key, or a nil node in case of error + */ +mpack_node_t mpack_node_map_uint(mpack_node_t node, uint64_t num); + +/** + * Returns the value node in the given map for the given unsigned integer + * key, or a missing node if the map does not contain the given key. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node contains more than one entry with the given key + * + * @return The value node for the given key, or a missing node if the key does + * not exist, or a nil node in case of error + * + * @see mpack_node_is_missing() + */ +mpack_node_t mpack_node_map_uint_optional(mpack_node_t node, uint64_t num); + +/** + * Returns the value node in the given map for the given string key. + * + * The key must exist within the map. Use mpack_node_map_str_optional() to + * check for optional keys. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node does not contain exactly one entry with the given key + * + * @return The value node for the given key, or a nil node in case of error + */ +mpack_node_t mpack_node_map_str(mpack_node_t node, const char* str, size_t length); + +/** + * Returns the value node in the given map for the given string key, or a missing + * node if the map does not contain the given key. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node contains more than one entry with the given key + * + * @return The value node for the given key, or a missing node if the key does + * not exist, or a nil node in case of error + * + * @see mpack_node_is_missing() + */ +mpack_node_t mpack_node_map_str_optional(mpack_node_t node, const char* str, size_t length); + +/** + * Returns the value node in the given map for the given null-terminated + * string key. + * + * The key must exist within the map. Use mpack_node_map_cstr_optional() to + * check for optional keys. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node does not contain exactly one entry with the given key + * + * @return The value node for the given key, or a nil node in case of error + */ +mpack_node_t mpack_node_map_cstr(mpack_node_t node, const char* cstr); + +/** + * Returns the value node in the given map for the given null-terminated + * string key, or a missing node if the map does not contain the given key. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node contains more than one entry with the given key + * + * @return The value node for the given key, or a missing node if the key does + * not exist, or a nil node in case of error + * + * @see mpack_node_is_missing() + */ +mpack_node_t mpack_node_map_cstr_optional(mpack_node_t node, const char* cstr); + +/** + * Returns true if the given node map contains exactly one entry with the + * given integer key. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node contains more than one entry with the given key + */ +bool mpack_node_map_contains_int(mpack_node_t node, int64_t num); + +/** + * Returns true if the given node map contains exactly one entry with the + * given unsigned integer key. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node contains more than one entry with the given key + */ +bool mpack_node_map_contains_uint(mpack_node_t node, uint64_t num); + +/** + * Returns true if the given node map contains exactly one entry with the + * given string key. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node contains more than one entry with the given key + */ +bool mpack_node_map_contains_str(mpack_node_t node, const char* str, size_t length); + +/** + * Returns true if the given node map contains exactly one entry with the + * given null-terminated string key. + * + * The key must be unique. An error is flagged if the node has multiple + * entries with the given key. + * + * @throws mpack_error_type If the node is not a map + * @throws mpack_error_data If the node contains more than one entry with the given key + */ +bool mpack_node_map_contains_cstr(mpack_node_t node, const char* cstr); + +/** + * @} + */ + +/** + * @} + */ + +#endif + +MPACK_EXTERN_C_END +MPACK_HEADER_END + +#endif + + +#endif + diff --git a/lib/cprofiles/src/CMakeLists.txt b/lib/cprofiles/src/CMakeLists.txt index 77e69cad47e..9035139bbc6 100644 --- a/lib/cprofiles/src/CMakeLists.txt +++ b/lib/cprofiles/src/CMakeLists.txt @@ -13,12 +13,15 @@ set(src cprof_sample.c cprof_scope_profiles.c cprof_decode_opentelemetry.c + cprof_encode_opentelemetry.c cprof_encode_text.c + cprof_encode_msgpack.c + cprof_decode_msgpack.c + cprof_mpack_utils.c ) set(src ${src} - ) # Static Library diff --git a/lib/cprofiles/src/cprof_decode_msgpack.c b/lib/cprofiles/src/cprof_decode_msgpack.c new file mode 100644 index 00000000000..5ba805dfbbe --- /dev/null +++ b/lib/cprofiles/src/cprof_decode_msgpack.c @@ -0,0 +1,2234 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ========= + * Copyright (C) 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include + +static int unpack_context_header(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_map(reader, + callbacks, + user_data); +} + +static int unpack_resource_attributes(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_resource *resource; + int result; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + resource = (struct cprof_resource *) user_data; + + if (resource->attributes != NULL) { + cfl_kvlist_destroy(resource->attributes); + + resource->attributes = NULL; + } + + result = unpack_cfl_kvlist(reader, &resource->attributes); + + if (result != 0) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return CPROF_DECODE_MSGPACK_SUCCESS; +} + +static int unpack_resource_dropped_attribute_count(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_resource *resource; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + resource = (struct cprof_resource *) user_data; + + return cprof_mpack_consume_uint32_tag(reader, &resource->dropped_attributes_count); +} + +static int unpack_resource_profiles_entry_resource(mpack_reader_t *reader, size_t index, void *user_data) +{ + int result; + struct cprof_resource *resource; + struct cprof_resource_profiles *profiles; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"attributes", unpack_resource_attributes}, + {"dropped_attribute_count", unpack_resource_dropped_attribute_count}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profiles = (struct cprof_resource_profiles *) user_data; + + resource = cprof_resource_create(NULL); + + if (resource == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) resource); + + if (result == CPROF_DECODE_MSGPACK_SUCCESS) { + if (profiles->resource != NULL) { + cprof_resource_destroy(profiles->resource); + } + + profiles->resource = resource; + } + else { + cprof_resource_destroy(resource); + } + + return result; +} + +static int unpack_instrumentation_scope_name(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_instrumentation_scope *instrumentation_scope; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + instrumentation_scope = (struct cprof_instrumentation_scope *) user_data; + + if (instrumentation_scope->name != NULL) { + cfl_sds_destroy(instrumentation_scope->name); + + instrumentation_scope->name = NULL; + } + + return cprof_mpack_consume_string_or_nil_tag(reader, &instrumentation_scope->name); +} + +static int unpack_instrumentation_scope_version(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_instrumentation_scope *instrumentation_scope; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + instrumentation_scope = (struct cprof_instrumentation_scope *) user_data; + + if (instrumentation_scope->version != NULL) { + cfl_sds_destroy(instrumentation_scope->version); + + instrumentation_scope->version = NULL; + } + + return cprof_mpack_consume_string_or_nil_tag(reader, &instrumentation_scope->version); +} + +static int unpack_instrumentation_scope_attributes(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_instrumentation_scope *instrumentation_scope; + int result; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + instrumentation_scope = (struct cprof_instrumentation_scope *) user_data; + + if (instrumentation_scope->attributes != NULL) { + cfl_kvlist_destroy(instrumentation_scope->attributes); + + instrumentation_scope->attributes = NULL; + } + + result = unpack_cfl_kvlist(reader, &instrumentation_scope->attributes); + + if (result != 0) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return CPROF_DECODE_MSGPACK_SUCCESS; +} + +static int unpack_instrumentation_scope_dropped_attribute_count(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_instrumentation_scope *instrumentation_scope; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + instrumentation_scope = (struct cprof_instrumentation_scope *) user_data; + + return cprof_mpack_consume_uint32_tag(reader, &instrumentation_scope->dropped_attributes_count); +} + +static int unpack_scope_profiles_entry_instrumentation_scope(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_instrumentation_scope *instrumentation_scope; + struct cprof_scope_profiles *scope_profiles; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"name", unpack_instrumentation_scope_name}, + {"version", unpack_instrumentation_scope_version}, + {"attributes", unpack_instrumentation_scope_attributes}, + {"dropped_attribute_count", unpack_instrumentation_scope_dropped_attribute_count}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + scope_profiles = (struct cprof_scope_profiles *) user_data; + + instrumentation_scope = cprof_instrumentation_scope_create(NULL, NULL, NULL, 0); + + if (instrumentation_scope == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) instrumentation_scope); + + if (result == CPROF_DECODE_MSGPACK_SUCCESS) { + if (scope_profiles->scope != NULL) { + cprof_instrumentation_scope_destroy(scope_profiles->scope); + } + + scope_profiles->scope = instrumentation_scope; + } + + if (result != CPROF_DECODE_MSGPACK_SUCCESS) { + cprof_instrumentation_scope_destroy(instrumentation_scope); + } + + return result; +} + +static int unpack_profile_profile_id(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + int result; + cfl_sds_t value; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + result = cprof_mpack_consume_binary_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + if (cfl_sds_len(value) != sizeof(profile->profile_id)) { + cfl_sds_destroy(value); + + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + memcpy(profile->profile_id, + value, + sizeof(profile->profile_id)); + + cfl_sds_destroy(value); + } + + return result; +} + +static int unpack_profile_start_time_unix_nano(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &profile->start_time_unix_nano); +} + +static int unpack_profile_end_time_unix_nano(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &profile->end_time_unix_nano); +} + +static int unpack_profile_attributes(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + int result; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + if (profile->attributes != NULL) { + cfl_kvlist_destroy(profile->attributes); + + profile->attributes = NULL; + } + + result = unpack_cfl_kvlist(reader, &profile->attributes); + + if (result != 0) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return CPROF_DECODE_MSGPACK_SUCCESS; +} + +static int unpack_profile_dropped_attributes(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_uint32_tag(reader, &profile->dropped_attributes_count); +} + +static int unpack_value_type_type(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_value_type *sample_type; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample_type = (struct cprof_value_type *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &sample_type->type); +} + +static int unpack_value_type_unit(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_value_type *sample_type; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample_type = (struct cprof_value_type *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &sample_type->unit); +} + +static int unpack_value_type_aggregation_temporality(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_value_type *sample_type; + int result; + uint64_t value; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample_type = (struct cprof_value_type *) user_data; + + result = cprof_mpack_consume_uint64_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + sample_type->aggregation_temporality = (int) value; + } + + return result; +} + +static int unpack_profile_sample_types_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_value_type *sample_type; + struct cprof_profile *profile; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"type", unpack_value_type_type}, + {"unit", unpack_value_type_unit}, + {"aggregation_temporality", unpack_value_type_aggregation_temporality}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + sample_type = cprof_sample_type_create(profile, 0, 0, 0); + + if (sample_type == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) sample_type); + + /* cprof_sample_type_create automatically attaches the newly created + * instance to the parent profile instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_profile_sample_types(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_sample_types_entry, + user_data); +} + +static int unpack_profile_sample_location_index_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + if (index >= sample->location_index_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_uint64_tag(reader, &sample->location_index[index]); +} + +static int unpack_profile_sample_location_index(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + if (sample->location_index != NULL) { + free(sample->location_index); + + sample->location_index = NULL; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + sample->location_index = calloc(array_length, sizeof(uint64_t)); + + if (sample->location_index == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + sample->location_index_count = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_sample_location_index_entry, + user_data); +} + +static int unpack_profile_sample_locations_start_index(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &sample->locations_start_index); +} + +static int unpack_profile_sample_locations_length(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &sample->locations_length); +} + +static int unpack_profile_sample_values_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + if (index >= sample->value_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_int64_tag(reader, &sample->values[index]); +} + +static int unpack_profile_sample_values(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + if (sample->values != NULL) { + free(sample->values); + + sample->values = NULL; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + sample->values = calloc(array_length, sizeof(int64_t)); + + if (sample->values == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + sample->value_count = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_sample_values_entry, + user_data); +} + +static int unpack_profile_sample_attributes_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + if (index >= sample->attributes_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_uint64_tag(reader, &sample->attributes[index]); +} + +static int unpack_profile_sample_attributes(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + if (sample->attributes != NULL) { + free(sample->attributes); + + sample->attributes = NULL; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + sample->attributes = calloc(array_length, sizeof(uint64_t)); + + if (sample->attributes == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + sample->attributes_count = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_sample_attributes_entry, + user_data); +} + +static int unpack_profile_sample_link(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &sample->link); +} + +static int unpack_profile_sample_timestamps_unix_nano_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + if (index >= sample->timestamps_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_uint64_tag(reader, &sample->timestamps_unix_nano[index]); +} + +static int unpack_profile_sample_timestamps_unix_nano(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_sample *sample; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + sample = (struct cprof_sample *) user_data; + + if (sample->timestamps_unix_nano != NULL) { + free(sample->timestamps_unix_nano); + + sample->timestamps_unix_nano = NULL; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + sample->timestamps_unix_nano = calloc(array_length, sizeof(uint64_t)); + + if (sample->timestamps_unix_nano == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + sample->timestamps_count = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_sample_timestamps_unix_nano_entry, + user_data); +} + +static int unpack_profile_sample_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_sample *sample; + struct cprof_profile *profile; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"location_index", unpack_profile_sample_location_index}, + {"locations_start_index", unpack_profile_sample_locations_start_index}, + {"locations_length", unpack_profile_sample_locations_length}, + {"values", unpack_profile_sample_values}, + {"attributes", unpack_profile_sample_attributes}, + {"link", unpack_profile_sample_link}, + {"timestamps_unix_nano", unpack_profile_sample_timestamps_unix_nano}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + sample = cprof_sample_create(profile); + + if (sample == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) sample); + + /* cprof_sample_create automatically attaches the newly created + * instance to the parent profile instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_profile_sample(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_sample_entry, + user_data); +} + + + + + +static int unpack_profile_mapping_id(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &mapping->id); +} + +static int unpack_profile_mapping_memory_start(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &mapping->memory_start); +} + +static int unpack_profile_mapping_memory_limit(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &mapping->memory_limit); +} + +static int unpack_profile_mapping_file_offset(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &mapping->file_offset); +} + +static int unpack_profile_mapping_filename(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &mapping->filename); +} + +static int unpack_profile_mapping_attributes_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + if (index >= mapping->attributes_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_uint64_tag(reader, &mapping->attributes[index]); +} + +static int unpack_profile_mapping_attributes(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_mapping *mapping; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + if (mapping->attributes != NULL) { + free(mapping->attributes); + + mapping->attributes = NULL; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + mapping->attributes = calloc(array_length, sizeof(uint64_t)); + + if (mapping->attributes == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + mapping->attributes_count = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_mapping_attributes_entry, + user_data); +} + +static int unpack_profile_mapping_has_functions(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + int result; + uint64_t value; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + result = cprof_mpack_consume_uint64_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + mapping->has_functions = (bool) value; + } + + return result; +} + +static int unpack_profile_mapping_has_filenames(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + int result; + uint64_t value; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + result = cprof_mpack_consume_uint64_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + mapping->has_filenames = (bool) value; + } + + return result; +} + +static int unpack_profile_mapping_has_line_numbers(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + int result; + uint64_t value; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + result = cprof_mpack_consume_uint64_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + mapping->has_line_numbers = (bool) value; + } + + return result; +} + +static int unpack_profile_mapping_has_inline_frames(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + int result; + uint64_t value; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + mapping = (struct cprof_mapping *) user_data; + + result = cprof_mpack_consume_uint64_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + mapping->has_inline_frames = (bool) value; + } + + return result; +} + +static int unpack_profile_mappings_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_mapping *mapping; + struct cprof_profile *profile; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"id", unpack_profile_mapping_id}, + {"memory_start", unpack_profile_mapping_memory_start}, + {"memory_limit", unpack_profile_mapping_memory_limit}, + {"file_offset", unpack_profile_mapping_file_offset}, + {"filename", unpack_profile_mapping_filename}, + {"attributes", unpack_profile_mapping_attributes}, + {"has_functions", unpack_profile_mapping_has_functions}, + {"has_filenames", unpack_profile_mapping_has_filenames}, + {"has_line_numbers", unpack_profile_mapping_has_line_numbers}, + {"has_inline_frames", unpack_profile_mapping_has_inline_frames}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + mapping = cprof_mapping_create(profile); + + if (mapping == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) mapping); + + /* cprof_mapping_create automatically attaches the newly created + * instance to the parent profile instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_profile_mappings(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_mappings_entry, + user_data); +} + + + + + + +static int unpack_location_id(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_location *location; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + location = (struct cprof_location *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &location->id); +} + +static int unpack_location_mapping_index(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_location *location; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + location = (struct cprof_location *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &location->mapping_index); +} + +static int unpack_location_address(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_location *location; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + location = (struct cprof_location *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &location->address); +} + + + + + + + +static int unpack_line_function_index(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_line *line; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + line = (struct cprof_line *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &line->function_index); +} + +static int unpack_line_line(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_line *line; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + line = (struct cprof_line *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &line->line); +} + +static int unpack_line_column(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_line *line; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + line = (struct cprof_line *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &line->column); +} + +static int unpack_location_lines_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_location *location; + struct cprof_line *line; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"function_index", unpack_line_function_index}, + {"line", unpack_line_line}, + {"column", unpack_line_column}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + location = (struct cprof_location *) user_data; + + line = cprof_line_create(location); + + if (line == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) line); + + /* cprof_line_create automatically attaches the newly created + * instance to the parent location instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_location_lines(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_location_lines_entry, + user_data); +} + +static int unpack_location_attributes_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_location *location; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + location = (struct cprof_location *) user_data; + + if (index >= location->attributes_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_uint64_tag(reader, &location->attributes[index]); +} + +static int unpack_location_attributes(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_location *location; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + location = (struct cprof_location *) user_data; + + if (location->attributes != NULL) { + free(location->attributes); + + location->attributes = NULL; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + location->attributes = calloc(array_length, sizeof(uint64_t)); + + if (location->attributes == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + location->attributes_count = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_location_attributes_entry, + user_data); +} + +static int unpack_profile_locations_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_location *location; + struct cprof_profile *profile; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"id", unpack_location_id}, + {"mapping_index", unpack_location_mapping_index}, + {"address", unpack_location_address}, + {"lines", unpack_location_lines}, + {"attributes", unpack_location_attributes}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + location = cprof_location_create(profile); + + if (location == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) location); + + /* cprof_location_create automatically attaches the newly created + * instance to the parent profile instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_profile_locations(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_locations_entry, + user_data); +} + + + +static int unpack_profile_location_indices_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + if (index >= profile->location_indices_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_int64_tag(reader, &profile->location_indices[index]); +} + +static int unpack_profile_location_indices(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + if (profile->location_indices != NULL) { + free(profile->location_indices); + + profile->location_indices = NULL; + profile->location_indices_count = 0; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + profile->location_indices = calloc(array_length, sizeof(int64_t)); + + if (profile->location_indices == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + profile->location_indices_count = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_location_indices_entry, + user_data); +} + + + + + + +static int unpack_function_id(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_function *function; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + function = (struct cprof_function *) user_data; + + return cprof_mpack_consume_uint64_tag(reader, &function->id); +} + +static int unpack_function_name(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_function *function; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + function = (struct cprof_function *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &function->name); +} + +static int unpack_function_system_name(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_function *function; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + function = (struct cprof_function *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &function->system_name); +} + +static int unpack_function_filename(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_function *function; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + function = (struct cprof_function *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &function->filename); +} + +static int unpack_function_start_line(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_function *function; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + function = (struct cprof_function *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &function->start_line); +} + +static int unpack_profile_functions_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_function *function; + struct cprof_profile *profile; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"id", unpack_function_id}, + {"name", unpack_function_name}, + {"system_name", unpack_function_system_name}, + {"filename", unpack_function_filename}, + {"start_line", unpack_function_start_line}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + function = cprof_function_create(profile); + + if (function == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) function); + + /* cprof_function_create automatically attaches the newly created + * instance to the parent profile instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_profile_functions(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_functions_entry, + user_data); +} + +static int unpack_profile_attribute_table(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + int result; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + if (profile->attribute_table != NULL) { + cfl_kvlist_destroy(profile->attribute_table); + + profile->attribute_table = NULL; + } + + result = unpack_cfl_kvlist(reader, &profile->attribute_table); + + if (result != 0) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return CPROF_DECODE_MSGPACK_SUCCESS; +} + + + + + + + + +static int unpack_profile_attribute_unit_attribute_key(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_attribute_unit *attribute_unit; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + attribute_unit = (struct cprof_attribute_unit *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &attribute_unit->attribute_key); +} + +static int unpack_profile_attribute_unit_unit(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_attribute_unit *attribute_unit; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + attribute_unit = (struct cprof_attribute_unit *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &attribute_unit->unit); +} + +static int unpack_profile_attribute_units_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_attribute_unit *attribute_unit; + struct cprof_profile *profile; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"attribute_key", unpack_profile_attribute_unit_attribute_key}, + {"unit", unpack_profile_attribute_unit_unit}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + attribute_unit = cprof_attribute_unit_create(profile); + + if (attribute_unit == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) attribute_unit); + + /* cprof_attribute_unit_create automatically attaches the newly created + * instance to the parent profile instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_profile_attribute_units(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_attribute_units_entry, + user_data); +} + + +static int unpack_profile_link_trace_id(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_link *link; + cfl_sds_t value; + int result; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + link = (struct cprof_link *) user_data; + + result = cprof_mpack_consume_binary_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + if (cfl_sds_len(value) != sizeof(link->trace_id)) { + cfl_sds_destroy(value); + + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + memcpy(link->trace_id, + value, + sizeof(link->trace_id)); + + cfl_sds_destroy(value); + } + + return result; +} + +static int unpack_profile_link_span_id(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_link *link; + cfl_sds_t value; + int result; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + link = (struct cprof_link *) user_data; + + result = cprof_mpack_consume_binary_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + if (cfl_sds_len(value) != sizeof(link->span_id)) { + cfl_sds_destroy(value); + + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + memcpy(link->span_id, + value, + sizeof(link->span_id)); + + cfl_sds_destroy(value); + } + + return result; +} + +static int unpack_profile_link_table_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_link *link; + struct cprof_profile *profile; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"trace_id", unpack_profile_link_trace_id}, + {"span_id", unpack_profile_link_span_id}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + link = cprof_link_create(profile); + + if (link == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) link); + + /* cprof_link_create automatically attaches the newly created + * instance to the parent profile instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_profile_link_table(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_link_table_entry, + user_data); +} + + + + + + + + + + + +static int unpack_profile_string_table_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + if (index >= profile->string_table_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_string_tag(reader, &profile->string_table[index]); +} + +static int unpack_profile_string_table(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + if (profile->string_table != NULL) { + free(profile->string_table); + + profile->string_table = NULL; + profile->string_table_count = 0; + profile->string_table_size = 0; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + profile->string_table = calloc(array_length, sizeof(char *)); + + if (profile->string_table == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + profile->string_table_count = (size_t) array_length; + profile->string_table_size = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_string_table_entry, + user_data); +} + + + +static int unpack_profile_drop_frames(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &profile->drop_frames); +} + +static int unpack_profile_keep_frames(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &profile->keep_frames); +} + +static int unpack_profile_time_nanos(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &profile->time_nanos); +} + +static int unpack_profile_duration_nanos(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &profile->duration_nanos); +} + + +static int unpack_profile_period_type(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"type", unpack_value_type_type}, + {"unit", unpack_value_type_unit}, + {"aggregation_temporality", unpack_value_type_aggregation_temporality}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_unpack_map(reader, + callbacks, + (void *) &profile->period_type); +} + + +static int unpack_profile_period(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &profile->period); +} + + + + +static int unpack_profile_comments_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + if (index >= profile->comments_count) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_consume_int64_tag(reader, &profile->comments[index]); +} + +static int unpack_profile_comments(mpack_reader_t *reader, size_t index, void *user_data) +{ + int array_length; + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + if (profile->comments != NULL) { + free(profile->comments); + + profile->comments = NULL; + profile->comments_count = 0; + } + + array_length = cprof_mpack_peek_array_length(reader); + + if (array_length > 0) { + profile->comments = calloc(array_length, sizeof(int64_t)); + + if (profile->comments == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + profile->comments_count = (size_t) array_length; + } + + return cprof_mpack_unpack_array(reader, + unpack_profile_comments_entry, + user_data); +} + +static int unpack_profile_default_sample_type(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_profile *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_profile *) user_data; + + return cprof_mpack_consume_int64_tag(reader, &profile->default_sample_type); +} + + + + +static int unpack_scope_profiles_entry_profiles_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_scope_profiles *scope_profiles; + struct cprof_profile *profile; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"profile_id", unpack_profile_profile_id}, + {"start_time_unix_nano", unpack_profile_start_time_unix_nano}, + {"end_time_unix_nano", unpack_profile_end_time_unix_nano}, + {"attributes", unpack_profile_attributes}, + {"dropped_attributes", unpack_profile_dropped_attributes}, + {"sample_types", unpack_profile_sample_types}, + {"sample", unpack_profile_sample}, + {"mappings", unpack_profile_mappings}, + {"locations", unpack_profile_locations}, + {"location_indices", unpack_profile_location_indices}, + {"functions", unpack_profile_functions}, + {"attribute_table", unpack_profile_attribute_table}, + {"attribute_units", unpack_profile_attribute_units}, + {"link_table", unpack_profile_link_table}, + {"string_table", unpack_profile_string_table}, + {"drop_frames", unpack_profile_drop_frames}, + {"keep_frames", unpack_profile_keep_frames}, + {"time_nanos", unpack_profile_time_nanos}, + {"duration_nanos", unpack_profile_duration_nanos}, + {"period_type", unpack_profile_period_type}, + {"period", unpack_profile_period}, + {"comments", unpack_profile_comments}, + {"default_sample_type", unpack_profile_default_sample_type}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + scope_profiles = (struct cprof_scope_profiles *) user_data; + + profile = cprof_profile_create(); + + if (profile == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) profile); + + if (result == CPROF_DECODE_MSGPACK_SUCCESS) { + cfl_list_add(&profile->_head, &scope_profiles->profiles); + } + else { + cprof_profile_destroy(profile); + } + + return result; +} + +static int unpack_scope_profiles_entry_profiles(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_scope_profiles_entry_profiles_entry, + user_data); +} + + +static int unpack_scope_profiles_entry_schema_url(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_scope_profiles *scope_profiles; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + scope_profiles = (struct cprof_scope_profiles *) user_data; + + if (scope_profiles->schema_url != NULL) { + cfl_sds_destroy(scope_profiles->schema_url); + + scope_profiles->schema_url = NULL; + } + + return cprof_mpack_consume_string_or_nil_tag(reader, &scope_profiles->schema_url); +} + +static int unpack_resource_profiles_entry_scope_profiles_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_resource_profiles *resource_profiles; + struct cprof_scope_profiles *scope_profiles; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"instrumentation_scope", unpack_scope_profiles_entry_instrumentation_scope}, + {"profiles", unpack_scope_profiles_entry_profiles}, + {"schema_url", unpack_scope_profiles_entry_schema_url}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + resource_profiles = (struct cprof_resource_profiles *) user_data; + + scope_profiles = cprof_scope_profiles_create(resource_profiles, ""); + + if (scope_profiles == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) scope_profiles); + + /* cprof_scope_profiles_create automatically attaches the newly created + * instance to the parent resource cprof profiles instance, because of + * that in case of failure we just let the parent destructor take care of + * it. + */ + + return result; +} + +static int unpack_resource_profiles_entry_scope_profiles(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_resource_profiles_entry_scope_profiles_entry, + user_data); +} + +static int unpack_resource_profiles_entry_schema_url(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_resource_profiles *profile; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + profile = (struct cprof_resource_profiles *) user_data; + + if (profile->schema_url != NULL) { + cfl_sds_destroy(profile->schema_url); + + profile->schema_url = NULL; + } + + return cprof_mpack_consume_string_or_nil_tag(reader, &profile->schema_url); +} + +static int unpack_cprof_resource_profiles_entry(mpack_reader_t *reader, size_t index, void *user_data) +{ + struct cprof_resource_profiles *profiles; + struct cprof *context; + int result; + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"resource", unpack_resource_profiles_entry_resource}, + {"scope_profiles", unpack_resource_profiles_entry_scope_profiles}, + {"schema_url", unpack_resource_profiles_entry_schema_url}, + {NULL, NULL} + }; + + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + context = (struct cprof *) user_data; + + profiles = cprof_resource_profiles_create(""); + + if (profiles == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + result = cprof_mpack_unpack_map(reader, + callbacks, + (void *) profiles); + + if (result == CPROF_DECODE_MSGPACK_SUCCESS) { + result = cprof_resource_profiles_add(context, profiles); + + if (result != 0) { + result = CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + } + + if (result != CPROF_DECODE_MSGPACK_SUCCESS) { + cprof_resource_profiles_destroy(profiles); + } + + return result; +} + +static int unpack_context_profiles(mpack_reader_t *reader, size_t index, void *user_data) +{ + if (reader == NULL || + user_data == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_array(reader, + unpack_cprof_resource_profiles_entry, + user_data); +} + + +int unpack_context(struct crof_msgpack_decode_context *context) +{ + struct cprof_mpack_map_entry_callback_t callbacks[] = \ + { + {"meta", unpack_context_header}, + {"profiles", unpack_context_profiles}, + {NULL, NULL} + }; + + if (context == NULL) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + return cprof_mpack_unpack_map(&context->reader, + callbacks, + (void *) context->inner_context); +} + +int cprof_decode_msgpack_create(struct cprof **result_context, + unsigned char *in_buf, + size_t in_size, + size_t *offset) +{ + int result; + struct crof_msgpack_decode_context context; + size_t remainder; + + if (result_context == NULL || + in_buf == NULL || + offset == NULL || + in_size < *offset ) { + return CPROF_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR; + } + + if (in_size == 0 || + (in_size - *offset) == 0) { + return CPROF_DECODE_MSGPACK_INSUFFICIENT_DATA; + } + + memset(&context, 0, sizeof(struct crof_msgpack_decode_context)); + + context.inner_context = cprof_create(); + + if (context.inner_context == NULL) { + return CPROF_DECODE_MSGPACK_ALLOCATION_ERROR; + } + + in_size -= *offset; + + mpack_reader_init_data(&context.reader, (const char *) &in_buf[*offset], in_size); + + result = unpack_context(&context); + + remainder = mpack_reader_remaining(&context.reader, NULL); + + *offset += in_size - remainder; + + mpack_reader_destroy(&context.reader); + + if (result != CPROF_DECODE_MSGPACK_SUCCESS) { + cprof_destroy(context.inner_context); + } + else { + *result_context = context.inner_context; + } + + return result; +} + +void cprof_decode_msgpack_destroy(struct cprof *context) +{ + if (context != NULL) { + cprof_destroy(context); + } +} diff --git a/lib/cprofiles/src/cprof_decode_opentelemetry.c b/lib/cprofiles/src/cprof_decode_opentelemetry.c index 2e24bc7c86a..14038a77ab6 100644 --- a/lib/cprofiles/src/cprof_decode_opentelemetry.c +++ b/lib/cprofiles/src/cprof_decode_opentelemetry.c @@ -501,7 +501,7 @@ static int decode_profile_container_entry(struct cprof_scope_profiles *scope_pro return CPROF_DECODE_OPENTELEMETRY_INVALID_ARGUMENT_ERROR; } - profile = cprof_profile_create(NULL); + profile = cprof_profile_create(); if (profile == NULL) { return CPROF_DECODE_OPENTELEMETRY_ALLOCATION_ERROR; diff --git a/lib/cprofiles/src/cprof_encode_msgpack.c b/lib/cprofiles/src/cprof_encode_msgpack.c new file mode 100644 index 00000000000..99d004e53a2 --- /dev/null +++ b/lib/cprofiles/src/cprof_encode_msgpack.c @@ -0,0 +1,955 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ========= + * Copyright (C) 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +static inline void mpack_write_sds_or_nil(mpack_writer_t *writer, + cfl_sds_t value) +{ + if (value != NULL) { + mpack_write_str(writer, + value, + cfl_sds_len(value)); + } + else { + mpack_write_nil(writer); + } +} + +static int encode_string_array( + struct cprof_msgpack_encoding_context *context, + char **data_list, + size_t data_length); + +static int encode_uint64_t_array( + struct cprof_msgpack_encoding_context *context, + uint64_t *data_list, + size_t data_length); + +static int encode_int64_t_array( + struct cprof_msgpack_encoding_context *context, + int64_t *data_list, + size_t data_length); + +static int encode_cprof_value_type( + struct cprof_msgpack_encoding_context *context, + struct cprof_value_type *instance); + +static int encode_cprof_sample( + struct cprof_msgpack_encoding_context *context, + struct cprof_sample *instance); + +static int encode_cprof_mapping( + struct cprof_msgpack_encoding_context *context, + struct cprof_mapping *instance); + +static int encode_cprof_line( + struct cprof_msgpack_encoding_context *context, + struct cprof_line *instance); + +static int encode_cprof_location( + struct cprof_msgpack_encoding_context *context, + struct cprof_location *instance); + +static int encode_cprof_function( + struct cprof_msgpack_encoding_context *context, + struct cprof_function *instance); + +static int encode_cprof_attribute_unit( + struct cprof_msgpack_encoding_context *context, + struct cprof_attribute_unit *instance); + + +static int encode_cprof_link( + struct cprof_msgpack_encoding_context *context, + struct cprof_link *instance); + + +static int encode_cprof_profile( + struct cprof_msgpack_encoding_context *context, + struct cprof_profile *instance); + + +static int encode_cprof_resource_profiles( + struct cprof_msgpack_encoding_context *context, + struct cprof_resource_profiles *instance); + + +static int encode_cprof_instrumentation_scope( + struct cprof_msgpack_encoding_context *context, + struct cprof_instrumentation_scope *instance); + + +static int encode_cprof_resource( + struct cprof_msgpack_encoding_context *context, + struct cprof_resource *instance); + + +static int encode_cprof_scope_profiles( + struct cprof_msgpack_encoding_context *context, + struct cprof_scope_profiles *instance); + + +static int encode_string_array( + struct cprof_msgpack_encoding_context *context, + char **data_list, + size_t data_length) +{ + size_t index; + + mpack_start_array(&context->writer, + data_length); + + for (index = 0 ; index < data_length ; index++) { + mpack_write_cstr(&context->writer, data_list[index]); + } + + mpack_finish_array(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int encode_uint64_t_array( + struct cprof_msgpack_encoding_context *context, + uint64_t *data_list, + size_t data_length) +{ + size_t index; + + mpack_start_array(&context->writer, + data_length); + + for (index = 0 ; index < data_length ; index++) { + mpack_write_u64(&context->writer, data_list[index]); + } + + mpack_finish_array(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int encode_int64_t_array( + struct cprof_msgpack_encoding_context *context, + int64_t *data_list, + size_t data_length) +{ + size_t index; + + mpack_start_array(&context->writer, + data_length); + + for (index = 0 ; index < data_length ; index++) { + mpack_write_i64(&context->writer, data_list[index]); + } + + mpack_finish_array(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + + +static int encode_cprof_value_type( + struct cprof_msgpack_encoding_context *context, + struct cprof_value_type *instance) { + mpack_start_map(&context->writer, 3); + + mpack_write_cstr(&context->writer, "type"); + mpack_write_i64(&context->writer, instance->type); + + mpack_write_cstr(&context->writer, "unit"); + mpack_write_i64(&context->writer, instance->unit); + + mpack_write_cstr(&context->writer, "aggregation_temporality"); + mpack_write_u64(&context->writer, instance->aggregation_temporality); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int encode_cprof_sample( + struct cprof_msgpack_encoding_context *context, + struct cprof_sample *instance) { + int result; + + mpack_start_map(&context->writer, 7); + + mpack_write_cstr(&context->writer, "location_index"); + + result = encode_uint64_t_array(context, + instance->location_index, + instance->location_index_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "locations_start_index"); + mpack_write_u64(&context->writer, instance->locations_start_index); + + mpack_write_cstr(&context->writer, "locations_length"); + mpack_write_u64(&context->writer, instance->locations_length); + + mpack_write_cstr(&context->writer, "values"); + result = encode_int64_t_array(context, + instance->values, + instance->value_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "attributes"); + result = encode_uint64_t_array(context, + instance->attributes, + instance->attributes_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "link"); + mpack_write_u64(&context->writer, instance->link); + + mpack_write_cstr(&context->writer, "timestamps_unix_nano"); + result = encode_uint64_t_array(context, + instance->timestamps_unix_nano, + instance->timestamps_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int encode_cprof_mapping( + struct cprof_msgpack_encoding_context *context, + struct cprof_mapping *instance) { + int result; + + mpack_start_map(&context->writer, 10); + + mpack_write_cstr(&context->writer, "id"); + mpack_write_u64(&context->writer, instance->id); + + mpack_write_cstr(&context->writer, "memory_start"); + mpack_write_u64(&context->writer, instance->memory_start); + + mpack_write_cstr(&context->writer, "memory_limit"); + mpack_write_u64(&context->writer, instance->memory_limit); + + mpack_write_cstr(&context->writer, "file_offset"); + mpack_write_u64(&context->writer, instance->file_offset); + + mpack_write_cstr(&context->writer, "filename"); + mpack_write_i64(&context->writer, instance->filename); + + mpack_write_cstr(&context->writer, "attributes"); + result = encode_uint64_t_array(context, + instance->attributes, + instance->attributes_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "has_functions"); + mpack_write_u64(&context->writer, instance->has_functions); + + mpack_write_cstr(&context->writer, "has_filenames"); + mpack_write_u64(&context->writer, instance->has_filenames); + + mpack_write_cstr(&context->writer, "has_line_numbers"); + mpack_write_u64(&context->writer, instance->has_line_numbers); + + mpack_write_cstr(&context->writer, "has_inline_frames"); + mpack_write_u64(&context->writer, instance->has_inline_frames); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + + + + + +static int encode_cprof_line( + struct cprof_msgpack_encoding_context *context, + struct cprof_line *instance) { + mpack_start_map(&context->writer, 3); + + mpack_write_cstr(&context->writer, "function_index"); + mpack_write_u64(&context->writer, instance->function_index); + + mpack_write_cstr(&context->writer, "line"); + mpack_write_i64(&context->writer, instance->line); + + mpack_write_cstr(&context->writer, "column"); + mpack_write_i64(&context->writer, instance->column); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + + + +static int encode_cprof_location( + struct cprof_msgpack_encoding_context *context, + struct cprof_location *instance) { + struct cfl_list *iterator; + int result; + struct cprof_line *line; + + mpack_start_map(&context->writer, 5); + + mpack_write_cstr(&context->writer, "id"); + mpack_write_u64(&context->writer, instance->id); + + mpack_write_cstr(&context->writer, "mapping_index"); + mpack_write_u64(&context->writer, instance->mapping_index); + + mpack_write_cstr(&context->writer, "address"); + mpack_write_u64(&context->writer, instance->address); + + mpack_write_cstr(&context->writer, "lines"); + mpack_start_array(&context->writer, cfl_list_size(&instance->lines)); + + if (!cfl_list_is_empty(&instance->lines)) { + cfl_list_foreach(iterator, + &instance->lines) { + line = cfl_list_entry(iterator, + struct cprof_line, _head); + + result = encode_cprof_line(context, line); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "attributes"); + + result = encode_uint64_t_array(context, + instance->attributes, + instance->attributes_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + + + + +static int encode_cprof_function( + struct cprof_msgpack_encoding_context *context, + struct cprof_function *instance) { + mpack_start_map(&context->writer, 5); + + mpack_write_cstr(&context->writer, "id"); + mpack_write_u64(&context->writer, instance->id); + + mpack_write_cstr(&context->writer, "name"); + mpack_write_i64(&context->writer, instance->name); + + mpack_write_cstr(&context->writer, "system_name"); + mpack_write_i64(&context->writer, instance->system_name); + + mpack_write_cstr(&context->writer, "filename"); + mpack_write_i64(&context->writer, instance->filename); + + mpack_write_cstr(&context->writer, "start_line"); + mpack_write_i64(&context->writer, instance->start_line); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + + + + +static int encode_cprof_attribute_unit( + struct cprof_msgpack_encoding_context *context, + struct cprof_attribute_unit *instance) { + mpack_start_map(&context->writer, 2); + + mpack_write_cstr(&context->writer, "attribute_key"); + mpack_write_i64(&context->writer, instance->attribute_key); + + mpack_write_cstr(&context->writer, "unit"); + mpack_write_i64(&context->writer, instance->unit); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int encode_cprof_link( + struct cprof_msgpack_encoding_context *context, + struct cprof_link *instance) +{ + mpack_start_map(&context->writer, 2); + + mpack_write_cstr(&context->writer, "trace_id"); + mpack_write_bin(&context->writer, + (const char *) instance->trace_id, + sizeof(instance->trace_id)); + + mpack_write_cstr(&context->writer, "span_id"); + mpack_write_bin(&context->writer, + (const char *) instance->span_id, + sizeof(instance->span_id)); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + + +static int encode_cprof_profile( + struct cprof_msgpack_encoding_context *context, + struct cprof_profile *instance) { + struct cprof_attribute_unit *attribute_unit; + struct cprof_value_type *sample_type; + struct cfl_list *iterator; + struct cprof_location *location; + struct cprof_function *function; + struct cprof_mapping *mapping; + struct cprof_sample *sample; + int result; + struct cprof_link *link; + + + mpack_start_map(&context->writer, 23); + + mpack_write_cstr(&context->writer, "profile_id"); + mpack_write_bin(&context->writer, + (const char *) instance->profile_id, + sizeof(instance->profile_id)); + + mpack_write_cstr(&context->writer, "start_time_unix_nano"); + mpack_write_i64(&context->writer, instance->start_time_unix_nano); + + mpack_write_cstr(&context->writer, "end_time_unix_nano"); + mpack_write_i64(&context->writer, instance->end_time_unix_nano); + + mpack_write_cstr(&context->writer, "attributes"); + + result = pack_cfl_variant_kvlist(&context->writer, + instance->attributes); + + if (result != 0) { + return -1; + } + + mpack_write_cstr(&context->writer, "dropped_attributes"); + mpack_write_u32(&context->writer, + instance->dropped_attributes_count); + + mpack_write_cstr(&context->writer, "sample_types"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->sample_type)); + + if (!cfl_list_is_empty(&instance->sample_type)) { + cfl_list_foreach(iterator, + &instance->sample_type) { + sample_type = cfl_list_entry( + iterator, + struct cprof_value_type, _head); + + result = encode_cprof_value_type(context, sample_type); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "sample"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->samples)); + + if (!cfl_list_is_empty(&instance->samples)) { + cfl_list_foreach(iterator, + &instance->samples) { + sample = cfl_list_entry( + iterator, + struct cprof_sample, _head); + + result = encode_cprof_sample(context, sample); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "mappings"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->mappings)); + + if (!cfl_list_is_empty(&instance->mappings)) { + cfl_list_foreach(iterator, + &instance->mappings) { + mapping = cfl_list_entry( + iterator, + struct cprof_mapping, _head); + + result = encode_cprof_mapping(context, mapping); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "locations"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->locations)); + + if (!cfl_list_is_empty(&instance->locations)) { + cfl_list_foreach(iterator, + &instance->locations) { + location = cfl_list_entry( + iterator, + struct cprof_location, _head); + + result = encode_cprof_location(context, location); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "location_indices"); + + result = encode_int64_t_array(context, + instance->location_indices, + instance->location_indices_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "functions"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->functions)); + + if (!cfl_list_is_empty(&instance->functions)) { + cfl_list_foreach(iterator, + &instance->functions) { + function = cfl_list_entry( + iterator, + struct cprof_function, _head); + + result = encode_cprof_function(context, function); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "attribute_table"); + + result = pack_cfl_variant_kvlist(&context->writer, + instance->attribute_table); + + if (result != 0) { + return -1; + } + + mpack_write_cstr(&context->writer, "attribute_units"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->attribute_units)); + + if (!cfl_list_is_empty(&instance->attribute_units)) { + cfl_list_foreach(iterator, + &instance->attribute_units) { + attribute_unit = cfl_list_entry( + iterator, + struct cprof_attribute_unit, _head); + + result = encode_cprof_attribute_unit(context, attribute_unit); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "link_table"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->link_table)); + + if (!cfl_list_is_empty(&instance->link_table)) { + cfl_list_foreach(iterator, + &instance->link_table) { + link = cfl_list_entry( + iterator, + struct cprof_link, _head); + + result = encode_cprof_link(context, link); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "string_table"); + + result = encode_string_array( + context, + (char **) instance->string_table, + instance->string_table_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "drop_frames"); + mpack_write_i64(&context->writer, instance->drop_frames); + + mpack_write_cstr(&context->writer, "keep_frames"); + mpack_write_i64(&context->writer, instance->keep_frames); + + mpack_write_cstr(&context->writer, "time_nanos"); + mpack_write_i64(&context->writer, instance->time_nanos); + + mpack_write_cstr(&context->writer, "duration_nanos"); + mpack_write_i64(&context->writer, instance->duration_nanos); + + mpack_write_cstr(&context->writer, "period_type"); + result = encode_cprof_value_type(context, &instance->period_type); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "period"); + mpack_write_i64(&context->writer, instance->period); + + mpack_write_cstr(&context->writer, "comments"); + result = encode_int64_t_array(context, + instance->comments, + instance->comments_count); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "default_sample_type"); + mpack_write_i64(&context->writer, instance->default_sample_type); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int encode_cprof_resource_profiles( + struct cprof_msgpack_encoding_context *context, + struct cprof_resource_profiles *instance) { + int result; + struct cfl_list *iterator; + struct cprof_scope_profiles *scope_profile; + + mpack_start_map(&context->writer, 3); + mpack_write_cstr(&context->writer, "resource"); + + result = encode_cprof_resource(context, instance->resource); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "scope_profiles"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->scope_profiles)); + + if (!cfl_list_is_empty(&instance->scope_profiles)) { + cfl_list_foreach(iterator, + &instance->scope_profiles) { + scope_profile = cfl_list_entry( + iterator, + struct cprof_scope_profiles, _head); + + result = encode_cprof_scope_profiles(context, scope_profile); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "schema_url"); + + mpack_write_sds_or_nil(&context->writer, + instance->schema_url); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int encode_cprof_instrumentation_scope( + struct cprof_msgpack_encoding_context *context, + struct cprof_instrumentation_scope *instance) { + int result; + + mpack_start_map(&context->writer, 4); + + mpack_write_cstr(&context->writer, "name"); + mpack_write_sds_or_nil(&context->writer, + instance->name); + + + mpack_write_cstr(&context->writer, "version"); + mpack_write_sds_or_nil(&context->writer, + instance->version); + + + mpack_write_cstr(&context->writer, "attributes"); + + result = pack_cfl_variant_kvlist(&context->writer, + instance->attributes); + + if (result != 0) { + return -1; + } + + mpack_write_cstr(&context->writer, "dropped_attribute_count"); + mpack_write_u32(&context->writer, instance->dropped_attributes_count); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + + + +static int encode_cprof_resource( + struct cprof_msgpack_encoding_context *context, + struct cprof_resource *instance) { + int result; + + mpack_start_map(&context->writer, 2); + + mpack_write_cstr(&context->writer, "attributes"); + + result = pack_cfl_variant_kvlist(&context->writer, + instance->attributes); + + if (result != 0) { + return -1; + } + + mpack_write_cstr(&context->writer, "dropped_attribute_count"); + mpack_write_u32(&context->writer, instance->dropped_attributes_count); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + + + + + +static int encode_cprof_scope_profiles( + struct cprof_msgpack_encoding_context *context, + struct cprof_scope_profiles *instance) { + int result; + struct cfl_list *iterator; + struct cprof_profile *profile; + + mpack_start_map(&context->writer, 3); + mpack_write_cstr(&context->writer, "instrumentation_scope"); + + result = encode_cprof_instrumentation_scope(context, instance->scope); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + + mpack_write_cstr(&context->writer, "profiles"); + + mpack_start_array(&context->writer, cfl_list_size(&instance->profiles)); + + if (!cfl_list_is_empty(&instance->profiles)) { + cfl_list_foreach(iterator, + &instance->profiles) { + profile = cfl_list_entry( + iterator, + struct cprof_profile, _head); + + result = encode_cprof_profile(context, profile); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + mpack_write_cstr(&context->writer, "schema_url"); + + mpack_write_sds_or_nil(&context->writer, + instance->schema_url); + + mpack_finish_map(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int pack_context_header(struct cprof_msgpack_encoding_context *context, + struct cprof *profile) +{ + mpack_write_cstr(&context->writer, "meta"); + mpack_start_map(&context->writer, 0); + mpack_finish_map(&context->writer); + + return 0; +} + +static int pack_context_profiles(struct cprof_msgpack_encoding_context *context, + struct cprof *profile) +{ + int result; + struct cfl_list *iterator; + size_t profile_count; + struct cprof_resource_profiles *resource_profiles; + + profile_count = 0 ; + profile_count = cfl_list_size(&profile->profiles); + + mpack_write_cstr(&context->writer, "profiles"); + mpack_start_array(&context->writer, profile_count); + + if (!cfl_list_is_empty(&profile->profiles)) { + cfl_list_foreach(iterator, + &profile->profiles) { + resource_profiles = cfl_list_entry( + iterator, + struct cprof_resource_profiles, _head); + + result = encode_cprof_resource_profiles(context, resource_profiles); + + if (result != CPROF_ENCODE_MSGPACK_SUCCESS) { + return result; + } + } + } + + mpack_finish_array(&context->writer); + + return CPROF_ENCODE_MSGPACK_SUCCESS; +} + +static int pack_context(struct cprof_msgpack_encoding_context *context, + struct cprof *profile) +{ + int result; + + mpack_start_map(&context->writer, 2); + + result = pack_context_header(context, profile); + + if (result != 0) { + return -1; + } + + result = pack_context_profiles(context, profile); + + if (result != 0) { + return -2; + } + + mpack_finish_map(&context->writer); /* outermost context scope */ + + return 0; +} + +int cprof_encode_msgpack_create(cfl_sds_t *result_buffer, + struct cprof *profile) +{ + int result; + struct cprof_msgpack_encoding_context context; + + *result_buffer = NULL; + + memset(&context, 0, sizeof(context)); + + mpack_writer_init_growable(&context.writer, + &context.output_buffer, + &context.output_size); + + + result = pack_context(&context, profile); + + if (mpack_writer_destroy(&context.writer) != mpack_ok) { + fprintf(stderr, "An error occurred encoding the data!\n"); + } + + if (result == CPROF_ENCODE_MSGPACK_SUCCESS) { + *result_buffer = cfl_sds_create_len(context.output_buffer, context.output_size); + } + + if (context.output_buffer != NULL) { + free(context.output_buffer); + } + + return result; +} + +void cprof_encode_msgpack_destroy(cfl_sds_t instance) +{ + if (instance != NULL) { + cfl_sds_destroy(instance); + } +} diff --git a/lib/cprofiles/src/cprof_encode_opentelemetry.c b/lib/cprofiles/src/cprof_encode_opentelemetry.c new file mode 100644 index 00000000000..59409c21cb7 --- /dev/null +++ b/lib/cprofiles/src/cprof_encode_opentelemetry.c @@ -0,0 +1,2388 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ========= + * Copyright (C) 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +static int is_string_releaseable(char *address) + { + return (address != NULL && + address != protobuf_c_empty_string); +} + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_to_otlp_any_value(struct cfl_variant *value); +static inline Opentelemetry__Proto__Common__V1__KeyValue *cfl_variant_kvpair_to_otlp_kvpair(struct cfl_kvpair *input_pair); +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_kvlist_to_otlp_any_value(struct cfl_variant *value); + +static inline void otlp_any_value_destroy(Opentelemetry__Proto__Common__V1__AnyValue *value); +static inline void otlp_kvpair_destroy(Opentelemetry__Proto__Common__V1__KeyValue *kvpair); +static inline void otlp_kvlist_destroy(Opentelemetry__Proto__Common__V1__KeyValueList *kvlist); +static inline void otlp_array_destroy(Opentelemetry__Proto__Common__V1__ArrayValue *array); + +static inline void otlp_kvpair_list_destroy(Opentelemetry__Proto__Common__V1__KeyValue **pair_list, size_t entry_count); + +static inline void otlp_kvpair_destroy(Opentelemetry__Proto__Common__V1__KeyValue *kvpair) +{ + if (kvpair != NULL) { + if (kvpair->key != NULL) { + free(kvpair->key); + } + + if (kvpair->value != NULL) { + otlp_any_value_destroy(kvpair->value); + } + + free(kvpair); + } +} + +static inline void otlp_kvlist_destroy(Opentelemetry__Proto__Common__V1__KeyValueList *kvlist) +{ + size_t index; + + if (kvlist != NULL) { + if (kvlist->values != NULL) { + for (index = 0 ; index < kvlist->n_values ; index++) { + otlp_kvpair_destroy(kvlist->values[index]); + } + + free(kvlist->values); + } + + free(kvlist); + } +} + +static inline void otlp_array_destroy(Opentelemetry__Proto__Common__V1__ArrayValue *array) +{ + size_t index; + + if (array != NULL) { + if (array->values != NULL) { + for (index = 0 ; index < array->n_values ; index++) { + otlp_any_value_destroy(array->values[index]); + } + + free(array->values); + } + + free(array); + } +} + +static inline void otlp_any_value_destroy(Opentelemetry__Proto__Common__V1__AnyValue *value) +{ + if (value != NULL) { + if (value->value_case == OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE) { + if (value->string_value != NULL) { + free(value->string_value); + } + } + else if (value->value_case == OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_ARRAY_VALUE) { + if (value->array_value != NULL) { + otlp_array_destroy(value->array_value); + } + } + else if (value->value_case == OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_KVLIST_VALUE) { + if (value->kvlist_value != NULL) { + otlp_kvlist_destroy(value->kvlist_value); + } + } + else if (value->value_case == OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_BYTES_VALUE) { + if (value->bytes_value.data != NULL) { + free(value->bytes_value.data); + } + } + + free(value); + } +} + +static inline Opentelemetry__Proto__Common__V1__KeyValue **otlp_kvpair_list_initialize(size_t entry_count) +{ + Opentelemetry__Proto__Common__V1__KeyValue **result; + + result = \ + calloc(entry_count, sizeof(Opentelemetry__Proto__Common__V1__KeyValue *)); + + return result; +} + + +static Opentelemetry__Proto__Common__V1__ArrayValue *otlp_array_value_initialize(size_t entry_count) +{ + Opentelemetry__Proto__Common__V1__ArrayValue *value; + + value = calloc(1, sizeof(Opentelemetry__Proto__Common__V1__ArrayValue)); + + if (value != NULL) { + opentelemetry__proto__common__v1__array_value__init(value); + + if (entry_count > 0) { + value->values = \ + calloc(entry_count, + sizeof(Opentelemetry__Proto__Common__V1__AnyValue *)); + + if (value->values == NULL) { + free(value); + + value = NULL; + } + else { + value->n_values = entry_count; + } + } + } + + return value; +} + +static Opentelemetry__Proto__Common__V1__KeyValue *otlp_kvpair_value_initialize() +{ + Opentelemetry__Proto__Common__V1__KeyValue *value; + + value = calloc(1, sizeof(Opentelemetry__Proto__Common__V1__KeyValue)); + + if (value != NULL) { + opentelemetry__proto__common__v1__key_value__init(value); + } + + return value; +} + +static Opentelemetry__Proto__Common__V1__KeyValueList *otlp_kvlist_value_initialize(size_t entry_count) +{ + Opentelemetry__Proto__Common__V1__KeyValueList *value; + + value = calloc(1, sizeof(Opentelemetry__Proto__Common__V1__KeyValueList)); + + if (value != NULL) { + opentelemetry__proto__common__v1__key_value_list__init(value); + + if (entry_count > 0) { + value->values = \ + calloc(entry_count, + sizeof(Opentelemetry__Proto__Common__V1__KeyValue *)); + + if (value->values == NULL) { + free(value); + + value = NULL; + } + else { + value->n_values = entry_count; + } + } + } + + return value; +} + +static Opentelemetry__Proto__Common__V1__AnyValue *otlp_any_value_initialize(int data_type, size_t entry_count) +{ + Opentelemetry__Proto__Common__V1__AnyValue *value; + + value = calloc(1, sizeof(Opentelemetry__Proto__Common__V1__AnyValue)); + + if (value == NULL) { + return NULL; + } + + opentelemetry__proto__common__v1__any_value__init(value); + + if (data_type == CFL_VARIANT_STRING) { + value->value_case = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE; + } + else if (data_type == CFL_VARIANT_BOOL) { + value->value_case = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_BOOL_VALUE; + } + else if (data_type == CFL_VARIANT_INT) { + value->value_case = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_INT_VALUE; + } + else if (data_type == CFL_VARIANT_DOUBLE) { + value->value_case = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_DOUBLE_VALUE; + } + else if (data_type == CFL_VARIANT_ARRAY) { + value->value_case = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_ARRAY_VALUE; + + value->array_value = otlp_array_value_initialize(entry_count); + + if (value->array_value == NULL) { + free(value); + + value = NULL; + } + } + else if (data_type == CFL_VARIANT_KVLIST) { + value->value_case = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_KVLIST_VALUE; + + value->kvlist_value = otlp_kvlist_value_initialize(entry_count); + + if (value->kvlist_value == NULL) { + free(value); + + value = NULL; + } + } + else if (data_type == CFL_VARIANT_BYTES) { + value->value_case = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_BYTES_VALUE; + } + else if (data_type == CFL_VARIANT_REFERENCE) { + value->value_case = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE; + } + else { + free(value); + + value = NULL; + } + + return value; +} + +static inline Opentelemetry__Proto__Common__V1__KeyValue *cfl_variant_kvpair_to_otlp_kvpair(struct cfl_kvpair *input_pair) +{ + Opentelemetry__Proto__Common__V1__KeyValue *pair; + + pair = otlp_kvpair_value_initialize(); + + if (pair != NULL) { + pair->key = strdup(input_pair->key); + + if (pair->key != NULL) { + pair->value = cfl_variant_to_otlp_any_value(input_pair->val); + + if (pair->value == NULL) { + free(pair->key); + + pair->key = NULL; + } + } + + if (pair->key == NULL) { + free(pair); + + pair = NULL; + } + } + + return pair; +} + +static inline void otlp_kvpair_list_destroy(Opentelemetry__Proto__Common__V1__KeyValue **pair_list, size_t entry_count) +{ + size_t index; + + if (pair_list != NULL) { + for (index = 0 ; index < entry_count ; index++) { + otlp_kvpair_destroy(pair_list[index]); + } + + free(pair_list); + } +} + +static inline Opentelemetry__Proto__Common__V1__KeyValue **cfl_kvlist_to_otlp_kvpair_list(struct cfl_kvlist *kvlist) +{ + size_t entry_count; + Opentelemetry__Proto__Common__V1__KeyValue *keyvalue; + struct cfl_list *iterator; + Opentelemetry__Proto__Common__V1__KeyValue **result; + struct cfl_kvpair *kvpair; + size_t index; + + entry_count = cfl_kvlist_count(kvlist); + + result = otlp_kvpair_list_initialize(entry_count + 1); + + if (result != NULL) { + index = 0; + + cfl_list_foreach(iterator, &kvlist->list) { + kvpair = cfl_list_entry(iterator, struct cfl_kvpair, _head); + + keyvalue = cfl_variant_kvpair_to_otlp_kvpair(kvpair); + + if (keyvalue == NULL) { + otlp_kvpair_list_destroy(result, entry_count); + + result = NULL; + + break; + } + + result[index++] = keyvalue; + } + } + + return result; +} + + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_kvlist_to_otlp_any_value(struct cfl_variant *value) +{ + size_t entry_count; + Opentelemetry__Proto__Common__V1__KeyValue *keyvalue; + struct cfl_list *iterator; + Opentelemetry__Proto__Common__V1__AnyValue *result; + struct cfl_kvpair *kvpair; + struct cfl_kvlist *kvlist; + size_t index; + + + kvlist = value->data.as_kvlist; + + entry_count = cfl_kvlist_count(kvlist); + + result = otlp_any_value_initialize(CFL_VARIANT_KVLIST, entry_count); + + if (result != NULL) { + index = 0; + + cfl_list_foreach(iterator, &kvlist->list) { + kvpair = cfl_list_entry(iterator, struct cfl_kvpair, _head); + + keyvalue = cfl_variant_kvpair_to_otlp_kvpair(kvpair); + + if (keyvalue == NULL) { + otlp_any_value_destroy(result); + + result = NULL; + + break; + } + + result->kvlist_value->values[index++] = keyvalue; + } + } + + return result; +} + + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_array_to_otlp_any_value(struct cfl_variant *value) +{ + size_t entry_count; + Opentelemetry__Proto__Common__V1__AnyValue *entry_value; + Opentelemetry__Proto__Common__V1__AnyValue *result; + struct cfl_array *array; + size_t index; + + array = value->data.as_array; + + entry_count = array->entry_count; + + result = otlp_any_value_initialize(CFL_VARIANT_ARRAY, entry_count); + + if (result != NULL) { + index = 0; + + for (index = 0 ; index < entry_count ; index++) { + entry_value = cfl_variant_to_otlp_any_value(cfl_array_fetch_by_index(array, index)); + + if (entry_value == NULL) { + otlp_any_value_destroy(result); + + result = NULL; + + break; + } + + result->array_value->values[index] = entry_value; + } + } + + return result; +} + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_string_to_otlp_any_value(struct cfl_variant *value) +{ + Opentelemetry__Proto__Common__V1__AnyValue *result; + + result = otlp_any_value_initialize(CFL_VARIANT_STRING, 0); + + if (result != NULL) { + result->string_value = strdup(value->data.as_string); + + if (result->string_value == NULL) { + otlp_any_value_destroy(result); + + result = NULL; + } + } + + return result; +} + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_boolean_to_otlp_any_value(struct cfl_variant *value) +{ + Opentelemetry__Proto__Common__V1__AnyValue *result; + + result = otlp_any_value_initialize(CFL_VARIANT_BOOL, 0); + + if (result != NULL) { + result->bool_value = value->data.as_bool; + } + + return result; +} + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_int64_to_otlp_any_value(struct cfl_variant *value) +{ + Opentelemetry__Proto__Common__V1__AnyValue *result; + + result = otlp_any_value_initialize(CFL_VARIANT_INT, 0); + + if (result != NULL) { + result->int_value = value->data.as_int64; + } + + return result; +} + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_double_to_otlp_any_value(struct cfl_variant *value) +{ + Opentelemetry__Proto__Common__V1__AnyValue *result; + + result = otlp_any_value_initialize(CFL_VARIANT_DOUBLE, 0); + + if (result != NULL) { + result->double_value = value->data.as_double; + } + + return result; +} + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_binary_to_otlp_any_value(struct cfl_variant *value) +{ + Opentelemetry__Proto__Common__V1__AnyValue *result; + + result = otlp_any_value_initialize(CFL_VARIANT_BYTES, 0); + + if (result != NULL) { + result->bytes_value.len = cfl_sds_len(value->data.as_bytes); + result->bytes_value.data = calloc(result->bytes_value.len, sizeof(char)); + + if (result->bytes_value.data) { + memcpy(result->bytes_value.data, value->data.as_bytes, result->bytes_value.len); + } + else { + otlp_any_value_destroy(result); + result = NULL; + } + } + + return result; +} + +static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_to_otlp_any_value(struct cfl_variant *value) +{ + Opentelemetry__Proto__Common__V1__AnyValue *result; + + if (value->type == CFL_VARIANT_STRING) { + result = cfl_variant_string_to_otlp_any_value(value); + } + else if (value->type == CFL_VARIANT_BOOL) { + result = cfl_variant_boolean_to_otlp_any_value(value); + } + else if (value->type == CFL_VARIANT_INT) { + result = cfl_variant_int64_to_otlp_any_value(value); + } + else if (value->type == CFL_VARIANT_DOUBLE) { + result = cfl_variant_double_to_otlp_any_value(value); + } + else if (value->type == CFL_VARIANT_ARRAY) { + result = cfl_variant_array_to_otlp_any_value(value); + } + else if (value->type == CFL_VARIANT_KVLIST) { + result = cfl_variant_kvlist_to_otlp_any_value(value); + } + else if (value->type == CFL_VARIANT_BYTES) { + result = cfl_variant_binary_to_otlp_any_value(value); + } + else if (value->type == CFL_VARIANT_REFERENCE) { + result = cfl_variant_string_to_otlp_any_value(value); + } + else { + result = NULL; + } + + return result; +} + + + + + + + +static void destroy_attribute( + Opentelemetry__Proto__Common__V1__KeyValue *attribute); + +static void destroy_attribute_list( + Opentelemetry__Proto__Common__V1__KeyValue **attribute_list); + +static Opentelemetry__Proto__Common__V1__KeyValue ** + initialize_attribute_list( + size_t element_count); + +static void destroy_attribute(Opentelemetry__Proto__Common__V1__KeyValue *attribute) +{ + if (attribute != NULL) { + if (attribute->value != NULL) { + if (attribute->value->value_case == \ + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE) { + if (is_string_releaseable(attribute->value->string_value)) { + free(attribute->value->string_value); + } + } + + free(attribute->value); + } + + if (is_string_releaseable(attribute->key)) { + free(attribute->key); + } + + free(attribute); + } +} + +static void destroy_attribute_list( + Opentelemetry__Proto__Common__V1__KeyValue **attribute_list) +{ + size_t element_index; + + if (attribute_list != NULL) { + for (element_index = 0 ; + attribute_list[element_index] != NULL ; + element_index++) { + destroy_attribute(attribute_list[element_index]); + + attribute_list[element_index] = NULL; + } + + free(attribute_list); + } +} + +static Opentelemetry__Proto__Common__V1__KeyValue ** + initialize_attribute_list( + size_t element_count) +{ + Opentelemetry__Proto__Common__V1__KeyValue **attribute_list; + + attribute_list = calloc(element_count + 1, + sizeof(Opentelemetry__Proto__Common__V1__KeyValue *)); + + return attribute_list; +} + + + + + +static void destroy_value_type( + Opentelemetry__Proto__Profiles__V1development__ValueType * + instance) +{ + if (instance != NULL) { + free(instance); + } +} + +static void destroy_sample( + Opentelemetry__Proto__Profiles__V1development__Sample * + instance) +{ + if (instance != NULL) { + if (instance->location_index != NULL) { + free(instance->location_index); + } + + if (instance->value != NULL) { + free(instance->value); + } + + if (instance->attributes != NULL) { + free(instance->attributes); + } + + if (instance->timestamps_unix_nano != NULL) { + free(instance->timestamps_unix_nano); + } + + free(instance); + } +} + + +static void destroy_mapping( + Opentelemetry__Proto__Profiles__V1development__Mapping * + instance) +{ + if (instance != NULL) { + if (instance->attributes != NULL) { + free(instance->attributes); + } + + free(instance); + } +} + + +static void destroy_resource( + Opentelemetry__Proto__Resource__V1__Resource * + instance) +{ + if (instance != NULL) { + destroy_attribute_list(instance->attributes); + + free(instance); + } +} + +static void destroy_line( + Opentelemetry__Proto__Profiles__V1development__Line * + instance) +{ + if (instance != NULL) { + free(instance); + } +} + +static void destroy_link( + Opentelemetry__Proto__Profiles__V1development__Link * + instance) +{ + if (instance != NULL) { + if (instance->trace_id.data != NULL) { + if (is_string_releaseable((cfl_sds_t) instance->trace_id.data)) { + cfl_sds_destroy((cfl_sds_t) instance->trace_id.data); + } + } + + if (instance->span_id.data != NULL) { + if (is_string_releaseable((cfl_sds_t) instance->span_id.data)) { + cfl_sds_destroy((cfl_sds_t) instance->span_id.data); + } + } + + free(instance); + } +} + + +static void destroy_location( + Opentelemetry__Proto__Profiles__V1development__Location * + instance) +{ + size_t index; + + if (instance != NULL) { + if (instance->line != NULL) { + for (index = 0 ; index < instance->n_line ; index++) { + destroy_line(instance->line[index]); + } + + free(instance->line); + } + + if (instance->attributes != NULL) { + free(instance->attributes); + } + + free(instance); + } +} + +static void destroy_attribute_unit( + Opentelemetry__Proto__Profiles__V1development__AttributeUnit * + instance) +{ + if (instance != NULL) { + free(instance); + } +} + +static void destroy_function( + Opentelemetry__Proto__Profiles__V1development__Function * + instance) +{ + if (instance != NULL) { + free(instance); + } +} + +static void destroy_instrumentation_scope( + Opentelemetry__Proto__Common__V1__InstrumentationScope * + instance) +{ + if (instance != NULL) { + destroy_attribute_list(instance->attributes); + + if (instance->name != NULL) { + if (is_string_releaseable(instance->name)) { + cfl_sds_destroy(instance->name); + } + } + + if (instance->version != NULL) { + if (is_string_releaseable(instance->version)) { + cfl_sds_destroy(instance->version); + } + } + + free(instance); + } +} + +static void destroy_profile( + Opentelemetry__Proto__Profiles__V1development__Profile * + instance) +{ + size_t index; + + if (instance != NULL) { + if (instance->sample_type != NULL) { + for (index = 0 ; index < instance->n_sample_type ; index++) { + destroy_value_type(instance->sample_type[index]); + } + + free(instance->sample_type); + } + + if (instance->sample != NULL) { + for (index = 0 ; index < instance->n_sample ; index++) { + destroy_sample(instance->sample[index]); + } + + free(instance->sample); + } + + if (instance->mapping != NULL) { + for (index = 0 ; index < instance->n_mapping ; index++) { + destroy_mapping(instance->mapping[index]); + } + + free(instance->mapping); + } + + if (instance->location != NULL) { + for (index = 0 ; index < instance->n_location ; index++) { + destroy_location(instance->location[index]); + } + + free(instance->location); + } + + if (instance->location_indices != NULL) { + free(instance->location_indices); + } + + if (instance->function != NULL) { + for (index = 0 ; index < instance->n_function ; index++) { + destroy_function(instance->function[index]); + } + + free(instance->function); + } + + if (instance->attribute_table != NULL) { + destroy_attribute_list(instance->attribute_table); + } + + for (index = 0 ; index < instance->n_attribute_units ; index++) { + destroy_attribute_unit(instance->attribute_units[index]); + } + + if (instance->link_table != NULL) { + for (index = 0 ; index < instance->n_link_table ; index++) { + destroy_link(instance->link_table[index]); + } + + free(instance->link_table); + } + + if (instance->string_table != NULL) { + for (index = 0 ; index < instance->n_string_table ; index++) { + if (is_string_releaseable(instance->string_table[index])) { + cfl_sds_destroy(instance->string_table[index]); + } + } + + free(instance->string_table); + } + + if (instance->period_type != NULL) { + destroy_value_type(instance->period_type); + } + + if (instance->comment != NULL) { + free(instance->comment); + } + + free(instance); + } +} + +static void destroy_profile_container( + Opentelemetry__Proto__Profiles__V1development__ProfileContainer * + instance) +{ + if (instance != NULL) { + if (instance->profile_id.data != NULL) { + if (is_string_releaseable((cfl_sds_t) instance->profile_id.data)) { + cfl_sds_destroy((cfl_sds_t) instance->profile_id.data); + } + } + + destroy_attribute_list(instance->attributes); + + if (instance->original_payload_format != NULL) { + if (is_string_releaseable(instance->original_payload_format)) { + cfl_sds_destroy(instance->original_payload_format); + } + } + + if (instance->original_payload.data != NULL) { + if (is_string_releaseable((cfl_sds_t) instance->original_payload.data)) { + cfl_sds_destroy((cfl_sds_t) instance->original_payload.data); + } + } + + destroy_profile(instance->profile); + + free(instance); + } +} + +static void destroy_scope_profiles( + Opentelemetry__Proto__Profiles__V1development__ScopeProfiles * + instance) +{ + size_t index; + + if (instance != NULL) { + if (instance->scope != NULL) { + destroy_instrumentation_scope(instance->scope); + } + + if (instance->profiles != NULL) { + for (index = 0 ; index < instance->n_profiles ; index++) { + destroy_profile_container(instance->profiles[index]); + } + + free(instance->profiles); + } + + if (instance->schema_url != NULL) { + if (is_string_releaseable(instance->schema_url)) { + cfl_sds_destroy(instance->schema_url); + } + } + + free(instance); + } +} +static void destroy_resource_profiles( + Opentelemetry__Proto__Profiles__V1development__ResourceProfiles * + instance) +{ + size_t index; + + if (instance != NULL) { + if (instance->resource != NULL) { + destroy_resource(instance->resource); + } + + if (instance->scope_profiles != NULL) { + for (index = 0 ; index < instance->n_scope_profiles ; index++) { + destroy_scope_profiles(instance->scope_profiles[index]); + } + + free(instance->scope_profiles); + } + + if (instance->schema_url != NULL) { + if (is_string_releaseable(instance->schema_url)) { + cfl_sds_destroy(instance->schema_url); + } + } + + free(instance); + } +} + +static void destroy_export_profiles_service_request( + Opentelemetry__Proto__Collector__Profiles__V1development__ExportProfilesServiceRequest * + instance) +{ + size_t index; + + if (instance != NULL) { + if (instance->resource_profiles != NULL) { + for (index = 0 ; index < instance->n_resource_profiles ; index++) { + destroy_resource_profiles(instance->resource_profiles[index]); + } + + free(instance->resource_profiles); + } + + free(instance); + } +} + + + + +static + Opentelemetry__Proto__Profiles__V1development__ValueType * + initialize_value_type() { + Opentelemetry__Proto__Profiles__V1development__ValueType *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__ValueType)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__value_type__init(instance); + + return instance; +} + + + +static + Opentelemetry__Proto__Profiles__V1development__Sample * + initialize_sample( + size_t location_index_count, + size_t value_count, + size_t attributes_count, + size_t timestamps_count) { + Opentelemetry__Proto__Profiles__V1development__Sample *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__Sample)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__sample__init(instance); + + if (location_index_count > 0) { + instance->location_index = calloc(location_index_count, sizeof(uint64_t)); + + if (instance->location_index == NULL) { + destroy_sample(instance); + + return NULL; + } + + instance->n_location_index = location_index_count; + } + + if (value_count > 0) { + instance->value = calloc(value_count, sizeof(int64_t)); + + if (instance->value == NULL) { + destroy_sample(instance); + + return NULL; + } + + instance->n_value = value_count; + } + + if (attributes_count > 0) { + instance->attributes = calloc(attributes_count, sizeof(uint64_t)); + + if (instance->attributes == NULL) { + destroy_sample(instance); + + return NULL; + } + + instance->n_attributes = attributes_count; + } + + if (timestamps_count > 0) { + instance->timestamps_unix_nano = calloc(timestamps_count, sizeof(uint64_t)); + + if (instance->timestamps_unix_nano == NULL) { + destroy_sample(instance); + + return NULL; + } + + instance->n_timestamps_unix_nano = timestamps_count; + } + + return instance; +} + + + + + + +static + Opentelemetry__Proto__Resource__V1__Resource * + initialize_resource(size_t attribute_count) { + Opentelemetry__Proto__Resource__V1__Resource *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Resource__V1__Resource)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__resource__v1__resource__init(instance); + + if (attribute_count > 0) { + instance->attributes = initialize_attribute_list(attribute_count); + + if (instance->attributes == NULL) { + free(instance); + + return NULL; + } + } + + instance->n_attributes = attribute_count; + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__AttributeUnit * + initialize_attribute_unit() { + Opentelemetry__Proto__Profiles__V1development__AttributeUnit *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__AttributeUnit)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__attribute_unit__init(instance); + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__Line * + initialize_line() { + Opentelemetry__Proto__Profiles__V1development__Line *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__Line)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__line__init(instance); + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__Link * + initialize_link() { + Opentelemetry__Proto__Profiles__V1development__Link *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__Link)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__link__init(instance); + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__Location * + initialize_location(size_t line_count, size_t attribute_count) { + Opentelemetry__Proto__Profiles__V1development__Location *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__Location)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__location__init(instance); + + if (line_count > 0) { + instance->line = calloc(line_count, sizeof(void *)); + + if (instance->line == NULL) { + destroy_location(instance); + + return NULL; + } + + instance->n_line = line_count; + } + + if (attribute_count > 0) { + instance->attributes = calloc(attribute_count, sizeof(uint64_t)); + + if (instance->attributes == NULL) { + destroy_location(instance); + + return NULL; + } + + instance->n_attributes = attribute_count; + } + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__Function * + initialize_function() { + Opentelemetry__Proto__Profiles__V1development__Function *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__Function)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__function__init(instance); + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__Mapping * + initialize_mapping(size_t attribute_count) { + Opentelemetry__Proto__Profiles__V1development__Mapping *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__Mapping)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__mapping__init(instance); + + if (attribute_count > 0) { + instance->attributes = calloc(attribute_count, sizeof(uint64_t)); + + if (instance->attributes == NULL) { + destroy_mapping(instance); + + return NULL; + } + + instance->n_attributes = attribute_count; + } + + return instance; +} + +static + Opentelemetry__Proto__Common__V1__InstrumentationScope * + initialize_instrumentation_scope(size_t attribute_count) { + Opentelemetry__Proto__Common__V1__InstrumentationScope *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Common__V1__InstrumentationScope)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__common__v1__instrumentation_scope__init(instance); + + if (attribute_count > 0) { + instance->attributes = initialize_attribute_list(attribute_count); + + if (instance->attributes == NULL) { + free(instance); + + return NULL; + } + } + + instance->n_attributes = attribute_count; + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__Profile * + initialize_profile( + size_t sample_type_count, + size_t sample_count, + size_t mapping_count, + size_t location_count, + size_t location_index_count, + size_t function_count, + size_t attribute_count, + size_t attribute_unit_count, + size_t link_count, + size_t string_count, + size_t comment_count) { + Opentelemetry__Proto__Profiles__V1development__Profile *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__Profile)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__profile__init(instance); + + if (sample_type_count > 0) { + instance->sample_type = calloc(sample_type_count, sizeof(void *)); + + if (instance->sample_type == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_sample_type = sample_type_count; + } + + if (sample_count > 0) { + instance->sample = calloc(sample_count, sizeof(void *)); + + if (instance->sample == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_sample = sample_count; + } + + if (mapping_count > 0) { + instance->mapping = calloc(mapping_count, sizeof(void *)); + + if (instance->mapping == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_mapping = mapping_count; + } + + if (location_count > 0) { + instance->location = calloc(location_count, sizeof(void *)); + + if (instance->location == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_location = location_count; + } + + if (location_index_count > 0) { + instance->location_indices = calloc(location_index_count, sizeof(uint64_t)); + + if (instance->location_indices == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_location_indices = location_index_count; + } + + if (function_count > 0) { + instance->function = calloc(function_count, sizeof(void *)); + + if (instance->function == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_function = function_count; + } + + if (attribute_count > 0) { + instance->attribute_table = calloc(attribute_count, sizeof(void *)); + + if (instance->attribute_table == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_attribute_table = attribute_count; + } + + if (attribute_unit_count > 0) { + instance->attribute_units = calloc(attribute_unit_count, sizeof(void *)); + + if (instance->attribute_units == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_attribute_units = attribute_unit_count; + } + + if (link_count > 0) { + instance->link_table = calloc(link_count, sizeof(void *)); + + if (instance->link_table == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_link_table = link_count; + } + + if (string_count > 0) { + instance->string_table = calloc(string_count, sizeof(void *)); + + if (instance->string_table == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_string_table = string_count; + } + + if (comment_count > 0) { + instance->comment = calloc(comment_count, sizeof(void *)); + + if (instance->comment == NULL) { + destroy_profile(instance); + + return NULL; + } + + instance->n_comment = comment_count; + } + + return instance; +} + + +static + Opentelemetry__Proto__Profiles__V1development__ProfileContainer * + initialize_profile_container(size_t attribute_count) { + Opentelemetry__Proto__Profiles__V1development__ProfileContainer *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__ProfileContainer)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__profile_container__init(instance); + + if (attribute_count > 0) { + instance->attributes = initialize_attribute_list(attribute_count); + + if (instance->attributes == NULL) { + free(instance); + + return NULL; + } + } + + instance->n_attributes = attribute_count; + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__ScopeProfiles * + initialize_scope_profiles(size_t profiles_count) { + Opentelemetry__Proto__Profiles__V1development__ScopeProfiles *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__ScopeProfiles)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__scope_profiles__init(instance); + + instance->profiles = calloc(profiles_count, sizeof(void *)); + + if (instance->profiles == NULL) { + free(instance); + + return NULL; + } + + instance->n_profiles = profiles_count; + + return instance; +} + +static + Opentelemetry__Proto__Profiles__V1development__ResourceProfiles * + initialize_resource_profiles(size_t scope_profiles_count) { + Opentelemetry__Proto__Profiles__V1development__ResourceProfiles *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Profiles__V1development__ResourceProfiles)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__profiles__v1development__resource_profiles__init(instance); + + instance->scope_profiles = calloc(scope_profiles_count, sizeof(void *)); + + if (instance->scope_profiles == NULL) { + free(instance); + + return NULL; + } + + instance->n_scope_profiles = scope_profiles_count; + + return instance; +} + + +static + Opentelemetry__Proto__Collector__Profiles__V1development__ExportProfilesServiceRequest * + initialize_export_profiles_service_request(size_t resource_profiles_count) { + Opentelemetry__Proto__Collector__Profiles__V1development__ExportProfilesServiceRequest *instance; + + instance = calloc(1, sizeof(Opentelemetry__Proto__Collector__Profiles__V1development__ExportProfilesServiceRequest)); + + if (instance == NULL) { + return NULL; + } + + opentelemetry__proto__collector__profiles__v1development__export_profiles_service_request__init(instance); + + instance->resource_profiles = calloc(resource_profiles_count, sizeof(void *)); + + if (instance->resource_profiles == NULL) { + free(instance); + + return NULL; + } + + instance->n_resource_profiles = resource_profiles_count; + + return instance; +} + + + + + +static int pack_cprof_resource( + Opentelemetry__Proto__Resource__V1__Resource **output_instance, + struct cprof_resource *input_instance) +{ + Opentelemetry__Proto__Resource__V1__Resource *otlp_resource; + + if (input_instance != NULL) { + otlp_resource = initialize_resource(0); + + if (otlp_resource == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_resource->attributes = cfl_kvlist_to_otlp_kvpair_list(input_instance->attributes); + + if (otlp_resource->attributes == NULL) { + destroy_resource(otlp_resource); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_resource->n_attributes = cfl_kvlist_count(input_instance->attributes); + + otlp_resource->dropped_attributes_count = \ + input_instance->dropped_attributes_count; + + *output_instance = otlp_resource; + } + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_instrumentation_scope( + Opentelemetry__Proto__Common__V1__InstrumentationScope **output_instance, + struct cprof_instrumentation_scope *input_instance) +{ + Opentelemetry__Proto__Common__V1__InstrumentationScope *otlp_instrumentation_scope; + + if (input_instance != NULL) { + otlp_instrumentation_scope = initialize_instrumentation_scope(0); + + if (otlp_instrumentation_scope == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_instrumentation_scope->attributes = cfl_kvlist_to_otlp_kvpair_list(input_instance->attributes); + + if (otlp_instrumentation_scope->attributes == NULL) { + destroy_instrumentation_scope(otlp_instrumentation_scope); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_instrumentation_scope->n_attributes = cfl_kvlist_count(input_instance->attributes); + + if (input_instance->name != NULL) { + otlp_instrumentation_scope->name = cfl_sds_create(input_instance->name); + + if (otlp_instrumentation_scope->name == NULL) { + destroy_instrumentation_scope(otlp_instrumentation_scope); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + } + + if (input_instance->version != NULL) { + otlp_instrumentation_scope->version = cfl_sds_create(input_instance->version); + + if (otlp_instrumentation_scope->version == NULL) { + destroy_instrumentation_scope(otlp_instrumentation_scope); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + } + + otlp_instrumentation_scope->dropped_attributes_count = \ + input_instance->dropped_attributes_count; + + *output_instance = otlp_instrumentation_scope; + } + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_value_type( + Opentelemetry__Proto__Profiles__V1development__ValueType **output_instance, + struct cprof_value_type *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__ValueType *otlp_value_type; + + otlp_value_type = initialize_value_type(); + + if (otlp_value_type == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_value_type->type = input_instance->type; + otlp_value_type->unit = input_instance->unit; + otlp_value_type->aggregation_temporality = input_instance->aggregation_temporality; + + *output_instance = otlp_value_type; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_sample( + Opentelemetry__Proto__Profiles__V1development__Sample **output_instance, + struct cprof_sample *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__Sample *otlp_sample; + size_t index; + + otlp_sample = initialize_sample(input_instance->location_index_count, + input_instance->value_count, + input_instance->attributes_count, + input_instance->timestamps_count); + + if (otlp_sample == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + for (index = 0 ; + index < input_instance->location_index_count ; + index++) { + otlp_sample->location_index[index] = input_instance->location_index[index]; + } + + otlp_sample->locations_start_index = input_instance->locations_start_index; + otlp_sample->locations_length = input_instance->locations_length; + + for (index = 0 ; + index < input_instance->value_count ; + index++) { + otlp_sample->value[index] = input_instance->values[index]; + } + + for (index = 0 ; + index < input_instance->attributes_count ; + index++) { + otlp_sample->attributes[index] = input_instance->attributes[index]; + } + + otlp_sample->link = input_instance->link; + + for (index = 0 ; + index < input_instance->timestamps_count ; + index++) { + otlp_sample->timestamps_unix_nano[index] = input_instance->timestamps_unix_nano[index]; + } + + *output_instance = otlp_sample; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + + +static int pack_cprof_mapping( + Opentelemetry__Proto__Profiles__V1development__Mapping **output_instance, + struct cprof_mapping *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__Mapping *otlp_mapping; + size_t index; + + otlp_mapping = initialize_mapping(input_instance->attributes_count); + + if (otlp_mapping == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_mapping->id = input_instance->id; + otlp_mapping->memory_start = input_instance->memory_start; + otlp_mapping->memory_limit = input_instance->memory_limit; + otlp_mapping->file_offset = input_instance->file_offset; + otlp_mapping->filename = input_instance->filename; + + for (index = 0 ; + index < input_instance->attributes_count ; + index++) { + otlp_mapping->attributes[index] = input_instance->attributes[index]; + } + + otlp_mapping->has_functions = input_instance->has_functions; + otlp_mapping->has_filenames = input_instance->has_filenames; + otlp_mapping->has_line_numbers = input_instance->has_line_numbers; + otlp_mapping->has_inline_frames = input_instance->has_inline_frames; + + *output_instance = otlp_mapping; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + + + +static int pack_cprof_line( + Opentelemetry__Proto__Profiles__V1development__Line **output_instance, + struct cprof_line *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__Line *otlp_line; + + otlp_line = initialize_line(); + + if (otlp_line == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_line->function_index = input_instance->function_index; + otlp_line->line = input_instance->line; + otlp_line->column = input_instance->column; + + *output_instance = otlp_line; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_location( + Opentelemetry__Proto__Profiles__V1development__Location **output_instance, + struct cprof_location *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__Location *otlp_location; + struct cfl_list *iterator; + int result; + struct cprof_line *line; + size_t index; + + otlp_location = initialize_location(cfl_list_size(&input_instance->lines), + input_instance->attributes_count); + + if (otlp_location == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_location->id = input_instance->id; + otlp_location->mapping_index = input_instance->mapping_index; + otlp_location->address = input_instance->address; + + + index = 0; + cfl_list_foreach(iterator, + &input_instance->lines) { + line = cfl_list_entry( + iterator, + struct cprof_line, _head); + + result = pack_cprof_line( + &otlp_location->line[index], + line); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_location(otlp_location); + + return result; + } + + index++; + } + + otlp_location->is_folded = input_instance->is_folded; + + for (index = 0 ; + index < input_instance->attributes_count ; + index++) { + otlp_location->attributes[index] = input_instance->attributes[index]; + } + + *output_instance = otlp_location; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_function( + Opentelemetry__Proto__Profiles__V1development__Function **output_instance, + struct cprof_function *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__Function *otlp_function; + + otlp_function = initialize_function(); + + if (otlp_function == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_function->id = input_instance->id; + otlp_function->name = input_instance->name; + otlp_function->system_name = input_instance->system_name; + otlp_function->filename = input_instance->filename; + otlp_function->start_line = input_instance->start_line; + + *output_instance = otlp_function; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_attribute_unit( + Opentelemetry__Proto__Profiles__V1development__AttributeUnit **output_instance, + struct cprof_attribute_unit *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__AttributeUnit *otlp_attribute_unit; + + otlp_attribute_unit = initialize_attribute_unit(); + + if (otlp_attribute_unit == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_attribute_unit->attribute_key = input_instance->attribute_key; + otlp_attribute_unit->unit = input_instance->unit; + + *output_instance = otlp_attribute_unit; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_link( + Opentelemetry__Proto__Profiles__V1development__Link **output_instance, + struct cprof_link *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__Link *otlp_link; + + otlp_link = initialize_link(); + + if (otlp_link == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_link->trace_id.data = \ + (uint8_t *) cfl_sds_create_len((const char *) input_instance->trace_id, + sizeof(input_instance->trace_id)); + + if (otlp_link->trace_id.data == NULL) { + destroy_link(otlp_link); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_link->trace_id.len = sizeof(input_instance->trace_id); + + + otlp_link->span_id.data = \ + (uint8_t *) cfl_sds_create_len((const char *) input_instance->span_id, + sizeof(input_instance->span_id)); + + if (otlp_link->span_id.data == NULL) { + destroy_link(otlp_link); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_link->span_id.len = sizeof(input_instance->span_id); + + + *output_instance = otlp_link; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_profile( + Opentelemetry__Proto__Profiles__V1development__Profile **output_instance, + struct cprof_profile *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__Profile *otlp_profile; + struct cfl_list *iterator; + struct cprof_sample *sample; + struct cprof_link *link; + struct cprof_mapping *mapping; + struct cprof_location *location; + struct cprof_function *function; + struct cprof_value_type *sample_type; + struct cprof_attribute_unit *attribute_unit; + int result; + size_t index; + + otlp_profile = initialize_profile(cfl_list_size(&input_instance->sample_type), + cfl_list_size(&input_instance->samples), + cfl_list_size(&input_instance->mappings), + cfl_list_size(&input_instance->locations), + input_instance->location_indices_count, + cfl_list_size(&input_instance->functions), + 0, + cfl_list_size(&input_instance->attribute_units), + cfl_list_size(&input_instance->link_table), + input_instance->string_table_count, + input_instance->comments_count); + + if (otlp_profile == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->sample_type) { + sample_type = cfl_list_entry( + iterator, + struct cprof_value_type, _head); + + result = pack_cprof_value_type( + &otlp_profile->sample_type[index], + sample_type); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile(otlp_profile); + + return result; + } + + index++; + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->samples) { + sample = cfl_list_entry( + iterator, + struct cprof_sample, _head); + + result = pack_cprof_sample( + &otlp_profile->sample[index], + sample); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile(otlp_profile); + + return result; + } + + index++; + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->mappings) { + mapping = cfl_list_entry( + iterator, + struct cprof_mapping, _head); + + result = pack_cprof_mapping( + &otlp_profile->mapping[index], + mapping); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile(otlp_profile); + + return result; + } + + index++; + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->locations) { + location = cfl_list_entry( + iterator, + struct cprof_location, _head); + + result = pack_cprof_location( + &otlp_profile->location[index], + location); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile(otlp_profile); + + return result; + } + + index++; + } + + for (index = 0 ; + index < input_instance->location_indices_count ; + index++) { + otlp_profile->location_indices[index] = input_instance->location_indices[index]; + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->functions) { + function = cfl_list_entry( + iterator, + struct cprof_function, _head); + + result = pack_cprof_function( + &otlp_profile->function[index], + function); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile(otlp_profile); + + return result; + } + + index++; + } + + if (input_instance->attribute_table != NULL) { + otlp_profile->attribute_table = cfl_kvlist_to_otlp_kvpair_list(input_instance->attribute_table); + + if (otlp_profile->attribute_table == NULL) { + destroy_profile(otlp_profile); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_profile->n_attribute_table = cfl_kvlist_count(input_instance->attribute_table); + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->attribute_units) { + attribute_unit = cfl_list_entry( + iterator, + struct cprof_attribute_unit, _head); + + result = pack_cprof_attribute_unit( + &otlp_profile->attribute_units[index], + attribute_unit); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile(otlp_profile); + + return result; + } + + index++; + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->link_table) { + link = cfl_list_entry( + iterator, + struct cprof_link, _head); + + result = pack_cprof_link( + &otlp_profile->link_table[index], + link); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile(otlp_profile); + + return result; + } + + index++; + } + + for (index = 0 ; + index < input_instance->string_table_count ; + index++) { + otlp_profile->string_table[index] = cfl_sds_create(input_instance->string_table[index]); + + if (otlp_profile->string_table[index] == NULL) { + destroy_profile(otlp_profile); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + } + + otlp_profile->drop_frames = input_instance->drop_frames; + otlp_profile->keep_frames = input_instance->keep_frames; + otlp_profile->time_nanos = input_instance->time_nanos; + otlp_profile->duration_nanos = input_instance->duration_nanos; + + result = pack_cprof_value_type( + &otlp_profile->period_type, + &input_instance->period_type); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile(otlp_profile); + + return result; + } + + otlp_profile->period = input_instance->period; + + for (index = 0 ; + index < input_instance->comments_count ; + index++) { + otlp_profile->comment[index] = input_instance->comments[index]; + } + + otlp_profile->default_sample_type = input_instance->default_sample_type; + + *output_instance = otlp_profile; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_profile_container( + Opentelemetry__Proto__Profiles__V1development__ProfileContainer **output_instance, + struct cprof_profile *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__ProfileContainer *otlp_profile_container; + int result; + + otlp_profile_container = initialize_profile_container(0); + + if (otlp_profile_container == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_profile_container->profile_id.data = \ + (uint8_t *) cfl_sds_create_len((const char *) input_instance->profile_id, + sizeof(input_instance->profile_id)); + + if (otlp_profile_container->profile_id.data == NULL) { + destroy_profile_container(otlp_profile_container); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_profile_container->profile_id.len = sizeof(input_instance->profile_id); + + otlp_profile_container->start_time_unix_nano = (uint64_t) input_instance->start_time_unix_nano; + otlp_profile_container->end_time_unix_nano = (uint64_t) input_instance->end_time_unix_nano; + + otlp_profile_container->attributes = cfl_kvlist_to_otlp_kvpair_list(input_instance->attributes); + + if (otlp_profile_container->attributes == NULL) { + destroy_profile_container(otlp_profile_container); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_profile_container->n_attributes = cfl_kvlist_count(input_instance->attributes); + + otlp_profile_container->dropped_attributes_count = input_instance->dropped_attributes_count; + + if (input_instance->original_payload_format != NULL) { + otlp_profile_container->original_payload_format = \ + cfl_sds_create(input_instance->original_payload_format); + + if (otlp_profile_container->original_payload_format == NULL) { + destroy_profile_container(otlp_profile_container); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + } + + if (input_instance->original_payload != NULL) { + otlp_profile_container->original_payload.data = \ + (uint8_t *) cfl_sds_create_len(input_instance->original_payload, + cfl_sds_len(input_instance->original_payload)); + + if (otlp_profile_container->original_payload.data == NULL) { + destroy_profile_container(otlp_profile_container); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + otlp_profile_container->original_payload.len = cfl_sds_len(input_instance->original_payload); + } + + result = pack_cprof_profile(&otlp_profile_container->profile, input_instance); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_profile_container(otlp_profile_container); + + return result; + } + + *output_instance = otlp_profile_container; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + + +static int pack_cprof_scope_profiles( + Opentelemetry__Proto__Profiles__V1development__ScopeProfiles **output_instance, + struct cprof_scope_profiles *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__ScopeProfiles *otlp_scope_profiles; + struct cfl_list *iterator; + struct cprof_profile *profile; + int result; + size_t index; + + otlp_scope_profiles = initialize_scope_profiles(cfl_list_size(&input_instance->profiles)); + + if (otlp_scope_profiles == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + if (input_instance->scope != NULL) { + result = pack_cprof_instrumentation_scope(&otlp_scope_profiles->scope, input_instance->scope); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + return result; + } + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->profiles) { + profile = cfl_list_entry( + iterator, + struct cprof_profile, _head); + + result = pack_cprof_profile_container( + &otlp_scope_profiles->profiles[index], + profile); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_scope_profiles(otlp_scope_profiles); + + return result; + } + + index++; + } + + if (input_instance->schema_url != NULL) { + otlp_scope_profiles->schema_url = cfl_sds_create(input_instance->schema_url); + + if (otlp_scope_profiles->schema_url == NULL) { + destroy_scope_profiles(otlp_scope_profiles); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + } + + *output_instance = otlp_scope_profiles; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_cprof_resource_profiles( + Opentelemetry__Proto__Profiles__V1development__ResourceProfiles **output_instance, + struct cprof_resource_profiles *input_instance) +{ + Opentelemetry__Proto__Profiles__V1development__ResourceProfiles *otlp_resource_profiles; + struct cprof_scope_profiles *scope_profiles; + struct cfl_list *iterator; + int result; + size_t index; + + otlp_resource_profiles = initialize_resource_profiles(cfl_list_size(&input_instance->scope_profiles)); + + if (otlp_resource_profiles == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + result = pack_cprof_resource(&otlp_resource_profiles->resource, input_instance->resource); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + return result; + } + + index = 0; + cfl_list_foreach(iterator, + &input_instance->scope_profiles) { + scope_profiles = cfl_list_entry( + iterator, + struct cprof_scope_profiles, _head); + + result = pack_cprof_scope_profiles( + &otlp_resource_profiles->scope_profiles[index], + scope_profiles); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_resource_profiles(otlp_resource_profiles); + + return result; + } + + index++; + } + + if (input_instance->schema_url != NULL) { + otlp_resource_profiles->schema_url = cfl_sds_create(input_instance->schema_url); + + if (otlp_resource_profiles->schema_url == NULL) { + destroy_resource_profiles(otlp_resource_profiles); + + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + } + + *output_instance = otlp_resource_profiles; + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + + +static int pack_context_profiles( + struct cprof_opentelemetry_encoding_context *context, + struct cprof *profile) +{ + size_t index; + int result; + struct cfl_list *iterator; + struct cprof_resource_profiles *resource_profiles; + + context->export_service_request = \ + initialize_export_profiles_service_request(cfl_list_size(&profile->profiles)); + + if (context->export_service_request == NULL) { + return CPROF_ENCODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + + index = 0; + cfl_list_foreach(iterator, + &profile->profiles) { + resource_profiles = cfl_list_entry( + iterator, + struct cprof_resource_profiles, _head); + + result = pack_cprof_resource_profiles( + &context->export_service_request->resource_profiles[index], + resource_profiles); + + if (result != CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + destroy_export_profiles_service_request(context->export_service_request); + + return result; + } + + index++; + } + + return CPROF_ENCODE_OPENTELEMETRY_SUCCESS; +} + +static int pack_context( + struct cprof_opentelemetry_encoding_context *context, + struct cprof *profile) +{ + memset(context, 0, sizeof(struct cprof_opentelemetry_encoding_context)); + + context->inner_context = profile; + + return pack_context_profiles(context, profile); +} + +static cfl_sds_t render_opentelemetry_context_to_sds( + struct cprof_opentelemetry_encoding_context *context) +{ + cfl_sds_t result_buffer; + size_t result_size; + + result_size = opentelemetry__proto__collector__profiles__v1development__export_profiles_service_request__get_packed_size( + context->export_service_request); + + result_buffer = cfl_sds_create_size(result_size); + + if(result_buffer != NULL) { + opentelemetry__proto__collector__profiles__v1development__export_profiles_service_request__pack( + context->export_service_request, + (uint8_t *) result_buffer); + + cfl_sds_set_len(result_buffer, result_size); + } + + return result_buffer; +} + +int cprof_encode_opentelemetry_create(cfl_sds_t *result_buffer, + struct cprof *profile) +{ + int result; + struct cprof_opentelemetry_encoding_context context; + + *result_buffer = NULL; + + result = pack_context(&context, profile); + + if (result == CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + *result_buffer = render_opentelemetry_context_to_sds(&context); + + if (*result_buffer == NULL) { + result = CPROF_ENCODE_OPENTELEMETRY_INTERNAL_ENCODER_ERROR; + } + + destroy_export_profiles_service_request(context.export_service_request); + } + + return result; +} + +void cprof_encode_opentelemetry_destroy(cfl_sds_t instance) +{ + if (instance != NULL) { + cfl_sds_destroy(instance); + } +} diff --git a/lib/cprofiles/src/cprof_encode_text.c b/lib/cprofiles/src/cprof_encode_text.c index 218a72b5b63..299af8aa2e2 100644 --- a/lib/cprofiles/src/cprof_encode_text.c +++ b/lib/cprofiles/src/cprof_encode_text.c @@ -208,7 +208,6 @@ static int increment_indentation_level( static int decrement_indentation_level( struct cprof_text_encoding_context *context) { - cfl_sds_t result; if (context->indentation_level <= 0) { return CPROF_ENCODE_TEXT_SUCCESS; } @@ -297,7 +296,6 @@ static int encode_string( { char *local_indentation; cfl_sds_t result; - size_t index; if (indent) { local_indentation = (char *) context->indentation_buffer; @@ -329,7 +327,6 @@ static int encode_double( { char *local_indentation; cfl_sds_t result; - size_t index; if (indent) { local_indentation = (char *) context->indentation_buffer; @@ -361,7 +358,6 @@ static int encode_uint64_t( { char *local_indentation; cfl_sds_t result; - size_t index; if (indent) { local_indentation = (char *) context->indentation_buffer; @@ -393,7 +389,6 @@ static int encode_int64_t( { char *local_indentation; cfl_sds_t result; - size_t index; if (indent) { local_indentation = (char *) context->indentation_buffer; @@ -426,7 +421,6 @@ static int encode_bool( char *local_indentation; char *local_value; cfl_sds_t result; - size_t index; if (indent) { local_indentation = (char *) context->indentation_buffer; @@ -716,7 +710,6 @@ static int encode_cfl_kvlist( cfl_sds_t sds_result; struct cfl_list *iterator; int result; - size_t index; struct cfl_kvpair *entry; if (indent) { @@ -858,7 +851,7 @@ static int encode_cfl_variant( indent, prefix, suffix, - value->data.as_bytes, + (uint8_t *) value->data.as_bytes, cfl_sds_len(value->data.as_bytes), CFL_TRUE); break; @@ -970,18 +963,15 @@ static int encode_cprof_value_type( static int encode_cprof_sample( struct cprof_text_encoding_context *context, struct cprof_sample *instance) { - cfl_sds_t sds_result; - int result; - size_t index; - + int result; - result = encode_int64_t_array(context, - CFL_TRUE, - "Location index : [ ", - ", ", - "]\n", - instance->location_index, - instance->location_index_count); + result = encode_uint64_t_array(context, + CFL_TRUE, + "Location index : [ ", + ", ", + "]\n", + instance->location_index, + instance->location_index_count); if (result != CPROF_ENCODE_TEXT_SUCCESS) { return result; @@ -1067,8 +1057,7 @@ static int encode_cprof_sample( static int encode_cprof_mapping( struct cprof_text_encoding_context *context, struct cprof_mapping *instance) { - int result; - size_t index; + int result; result = encode_uint64_t(context, CFL_TRUE, @@ -1183,8 +1172,7 @@ static int encode_cprof_mapping( static int encode_cprof_line( struct cprof_text_encoding_context *context, struct cprof_line *instance) { - int result; - size_t index; + int result; result = encode_uint64_t(context, CFL_TRUE, @@ -1226,7 +1214,6 @@ static int encode_cprof_location( struct cprof_location *instance) { struct cfl_list *iterator; int result; - size_t index; struct cprof_line *line; result = encode_uint64_t(context, @@ -1316,8 +1303,7 @@ static int encode_cprof_location( static int encode_cprof_function( struct cprof_text_encoding_context *context, struct cprof_function *instance) { - int result; - size_t index; + int result; result = encode_uint64_t(context, CFL_TRUE, @@ -1378,8 +1364,7 @@ static int encode_cprof_function( static int encode_cprof_attribute_unit( struct cprof_text_encoding_context *context, struct cprof_attribute_unit *instance) { - int result; - size_t index; + int result; result = encode_int64_t(context, CFL_TRUE, @@ -1408,8 +1393,7 @@ static int encode_cprof_link( struct cprof_text_encoding_context *context, struct cprof_link *instance) { - int result; - size_t index; + int result; result = encode_bytes(context, CFL_TRUE, @@ -1450,7 +1434,6 @@ static int encode_cprof_profile( struct cprof_mapping *mapping; struct cprof_sample *sample; int result; - size_t index; struct cprof_link *link; result = encode_bytes(context, @@ -1654,13 +1637,13 @@ static int encode_cprof_profile( } } - result = encode_uint64_t_array(context, - CFL_TRUE, - "Location indices : [ ", - ", ", - "]\n", - instance->location_indices, - instance->location_indices_count); + result = encode_int64_t_array(context, + CFL_TRUE, + "Location indices : [ ", + ", ", + "]\n", + instance->location_indices, + instance->location_indices_count); if (result != CPROF_ENCODE_TEXT_SUCCESS) { return result; @@ -1909,7 +1892,7 @@ static int encode_cprof_resource_profiles( struct cprof_resource_profiles *instance) { int result; struct cfl_list *iterator; - struct cprof_scope_profile *scope_profile; + struct cprof_scope_profiles *scope_profile; result = encode_string(context, CFL_TRUE, @@ -1996,9 +1979,7 @@ static int encode_cprof_resource_profiles( static int encode_cprof_instrumentation_scope( struct cprof_text_encoding_context *context, struct cprof_instrumentation_scope *instance) { - int result; - struct cfl_list *iterator; - struct cprof_profile *profile; + int result; result = encode_string(context, CFL_TRUE, @@ -2166,6 +2147,91 @@ static int encode_cprof_scope_profiles( return CPROF_ENCODE_TEXT_SUCCESS; } + + + + + + + + + + + + + + + + + + + +void print_profile(struct cprof_profile *profile) +{ + int i; + int sample_index = 0; + uint64_t location_idx; + char *tmp; + struct cfl_list *head; + struct cfl_list *type_head; + struct cprof_sample *sample; + struct cprof_value_type *sample_type; + + printf("\n"); + printf("--- profile debug\n"); + printf("Profile Duration: %" PRId64 " nanoseconds\n\n", profile->duration_nanos); + printf("Samples:\n"); + + cfl_list_foreach(head, &profile->samples) { + sample = cfl_list_entry(head, struct cprof_sample, _head); + + printf(" Sample #%d:\n", ++sample_index); + + printf(" Locations:\n"); + for (i = 0; i < sample->location_index_count; ++i) { + location_idx = sample->location_index[i]; + tmp = profile->string_table[location_idx]; + if (tmp[0] == '\0') { + printf(" [Empty String: No Function Name]\n"); + } else { + printf(" Function: %s\n", tmp); + } + } + + printf(" Values:\n"); + size_t value_index = 0; + cfl_list_foreach(type_head, &profile->sample_type) { + sample_type = cfl_list_entry(type_head, struct cprof_value_type, _head); + if (value_index < sample->value_count) { + printf(" %s: %" PRId64 " %s\n", + profile->string_table[sample_type->type], + sample->values[value_index], + profile->string_table[sample_type->unit]); + } + value_index++; + } + + if (sample->timestamps_count > 0) { + printf(" Timestamps:\n"); + for (i = 0; i < sample->timestamps_count; ++i) { + printf(" Timestamp %d: %" PRIu64 " ns\n", i, sample->timestamps_unix_nano[i]); + } + } else { + printf(" [No Timestamps]\n"); + } + + printf("\n"); // Add space between samples for readability + } + printf("String Table:\n"); + for (i = 0; i < profile->string_table_count; i++) { + printf(" %d: '%s'\n", i, profile->string_table[i]); + } + printf("\n"); +} + + + + int cprof_encode_text_create(cfl_sds_t *result_buffer, struct cprof *profile) { @@ -2190,6 +2256,10 @@ int cprof_encode_text_create(cfl_sds_t *result_buffer, return CPROF_ENCODE_TEXT_ALLOCATION_ERROR; } + memset(context.indentation_buffer, + 0, + cfl_sds_alloc(context.indentation_buffer)); + context.indentation_level_size = 4; context.indentation_character = ' '; diff --git a/lib/cprofiles/src/cprof_mpack_utils.c b/lib/cprofiles/src/cprof_mpack_utils.c new file mode 100644 index 00000000000..c204218cf21 --- /dev/null +++ b/lib/cprofiles/src/cprof_mpack_utils.c @@ -0,0 +1,488 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ======== + * Copyright 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +int cprof_mpack_consume_string_or_nil_tag(mpack_reader_t *reader, cfl_sds_t *output_buffer) +{ + int result; + + if (cprof_mpack_peek_type(reader) == mpack_type_str) { + result = cprof_mpack_consume_string_tag(reader, output_buffer); + } + else if (cprof_mpack_peek_type(reader) == mpack_type_nil) { + result = cprof_mpack_consume_nil_tag(reader); + + *output_buffer = NULL; + } + else { + result = CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + return result; +} + +int cprof_mpack_consume_binary_or_nil_tag(mpack_reader_t *reader, cfl_sds_t *output_buffer) +{ + int result; + + if (cprof_mpack_peek_type(reader) == mpack_type_bin) { + result = cprof_mpack_consume_binary_tag(reader, output_buffer); + } + else if (cprof_mpack_peek_type(reader) == mpack_type_nil) { + result = cprof_mpack_consume_nil_tag(reader); + + *output_buffer = NULL; + } + else { + result = CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + return result; +} + +int cprof_mpack_consume_nil_tag(mpack_reader_t *reader) +{ + mpack_tag_t tag; + + if (NULL == reader) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return CPROF_MPACK_ENGINE_ERROR; + } + + if (mpack_type_nil != mpack_tag_type(&tag)) { + return CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + return CPROF_MPACK_SUCCESS; +} + +int cprof_mpack_consume_double_tag(mpack_reader_t *reader, double *output_buffer) +{ + mpack_tag_t tag; + + if (NULL == output_buffer) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + if (NULL == reader) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return CPROF_MPACK_ENGINE_ERROR; + } + + if (mpack_type_double != mpack_tag_type(&tag)) { + return CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + *output_buffer = mpack_tag_double_value(&tag); + + return CPROF_MPACK_SUCCESS; +} + +int cprof_mpack_consume_uint_tag(mpack_reader_t *reader, uint64_t *output_buffer) +{ + mpack_tag_t tag; + + if (NULL == output_buffer) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + if (NULL == reader) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return CPROF_MPACK_ENGINE_ERROR; + } + + if (mpack_type_int == mpack_tag_type(&tag)) { + *output_buffer = (uint64_t) mpack_tag_int_value(&tag); + } + else if (mpack_type_uint == mpack_tag_type(&tag)) { + *output_buffer = (uint64_t) mpack_tag_uint_value(&tag); + } + else { + return CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + return CPROF_MPACK_SUCCESS; +} + +int cprof_mpack_consume_uint32_tag(mpack_reader_t *reader, uint32_t *output_buffer) +{ + int result; + uint64_t value; + + result = cprof_mpack_consume_uint_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + *output_buffer = (uint32_t) value; + } + + return result; +} + +int cprof_mpack_consume_uint64_tag(mpack_reader_t *reader, uint64_t *output_buffer) +{ + return cprof_mpack_consume_uint_tag(reader, output_buffer); +} + +int cprof_mpack_consume_int_tag(mpack_reader_t *reader, int64_t *output_buffer) +{ + mpack_tag_t tag; + + if (NULL == output_buffer) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + if (NULL == reader) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return CPROF_MPACK_ENGINE_ERROR; + } + + if (mpack_type_int == mpack_tag_type(&tag)) { + *output_buffer = (int64_t) mpack_tag_int_value(&tag); + } + else if (mpack_type_uint == mpack_tag_type(&tag)) { + *output_buffer = (int64_t) mpack_tag_uint_value(&tag); + } + else { + return CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + return CPROF_MPACK_SUCCESS; +} + +int cprof_mpack_consume_int32_tag(mpack_reader_t *reader, int32_t *output_buffer) +{ + int result; + int64_t value; + + result = cprof_mpack_consume_int_tag(reader, &value); + + if (result == CPROF_MPACK_SUCCESS) { + *output_buffer = (int32_t) value; + } + + return result; +} + +int cprof_mpack_consume_int64_tag(mpack_reader_t *reader, int64_t *output_buffer) +{ + return cprof_mpack_consume_int_tag(reader, output_buffer); +} + +int cprof_mpack_consume_string_tag(mpack_reader_t *reader, cfl_sds_t *output_buffer) +{ + uint32_t string_length; + mpack_tag_t tag; + + if (NULL == output_buffer) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + if (NULL == reader) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return CPROF_MPACK_ENGINE_ERROR; + } + + if (mpack_type_str != mpack_tag_type(&tag)) { + return CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + string_length = mpack_tag_str_length(&tag); + + /* This validation only applies to cmetrics and its use cases, we know + * for a fact that our label names and values are not supposed to be really + * long so a huge value here probably means that the data stream got corrupted. + */ + + if (CPROF_MPACK_MAX_STRING_LENGTH < string_length) { + return CPROF_MPACK_CORRUPT_INPUT_DATA_ERROR; + } + + *output_buffer = cfl_sds_create_size(string_length + 1); + + if (NULL == *output_buffer) { + return CPROF_MPACK_ALLOCATION_ERROR; + } + + cfl_sds_set_len(*output_buffer, string_length); + + mpack_read_cstr(reader, *output_buffer, string_length + 1, string_length); + + if (mpack_ok != mpack_reader_error(reader)) { + cfl_sds_destroy(*output_buffer); + + *output_buffer = NULL; + + return CPROF_MPACK_ENGINE_ERROR; + } + + mpack_done_str(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + cfl_sds_destroy(*output_buffer); + + *output_buffer = NULL; + + return CPROF_MPACK_ENGINE_ERROR; + } + + return CPROF_MPACK_SUCCESS; +} + +int cprof_mpack_consume_binary_tag(mpack_reader_t *reader, cfl_sds_t *output_buffer) +{ + uint32_t string_length; + mpack_tag_t tag; + + if (NULL == output_buffer) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + if (NULL == reader) { + return CPROF_MPACK_INVALID_ARGUMENT_ERROR; + } + + tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return CPROF_MPACK_ENGINE_ERROR; + } + + if (mpack_type_bin != mpack_tag_type(&tag)) { + return CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + string_length = mpack_tag_bin_length(&tag); + + *output_buffer = cfl_sds_create_size(string_length); + + if (NULL == *output_buffer) { + return CPROF_MPACK_ALLOCATION_ERROR; + } + + cfl_sds_set_len(*output_buffer, string_length); + + mpack_read_bytes(reader, *output_buffer, string_length); + + if (mpack_ok != mpack_reader_error(reader)) { + cfl_sds_destroy(*output_buffer); + + *output_buffer = NULL; + + return CPROF_MPACK_ENGINE_ERROR; + } + + mpack_done_bin(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + cfl_sds_destroy(*output_buffer); + + *output_buffer = NULL; + + return CPROF_MPACK_ENGINE_ERROR; + } + + return CPROF_MPACK_SUCCESS; +} + +int cprof_mpack_unpack_map(mpack_reader_t *reader, + struct cprof_mpack_map_entry_callback_t *callback_list, + void *context) +{ + struct cprof_mpack_map_entry_callback_t *callback_entry; + uint32_t entry_index; + uint32_t entry_count; + cfl_sds_t key_name; + int result; + mpack_tag_t tag; + + tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) { + return CPROF_MPACK_ENGINE_ERROR; + } + + if (mpack_type_map != mpack_tag_type(&tag)) { + return CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + entry_count = mpack_tag_map_count(&tag); + + /* This validation only applies to cmetrics and its use cases, we know + * how our schema looks and how many entries the different fields have and none + * of those exceed the number we set CPROF_MPACK_MAX_MAP_ENTRY_COUNT to which is 10. + * Making these sanity checks optional or configurable in runtime might be worth + * the itme and complexity cost but that's something I don't know at the moment. + */ + + if (CPROF_MPACK_MAX_MAP_ENTRY_COUNT < entry_count) { + return CPROF_MPACK_CORRUPT_INPUT_DATA_ERROR; + } + + result = 0; + + for (entry_index = 0 ; 0 == result && entry_index < entry_count ; entry_index++) { + result = cprof_mpack_consume_string_tag(reader, &key_name); + + if (CPROF_MPACK_SUCCESS == result) { + callback_entry = callback_list; + result = CPROF_MPACK_UNEXPECTED_KEY_ERROR; + + while (CPROF_MPACK_UNEXPECTED_KEY_ERROR == result && + NULL != callback_entry->identifier) { + + if (0 == strcmp(callback_entry->identifier, key_name)) { + result = callback_entry->handler(reader, entry_index, context); + } + + callback_entry++; + } + + cfl_sds_destroy(key_name); + } + } + + if (CPROF_MPACK_SUCCESS == result) { + mpack_done_map(reader); + + if (mpack_ok != mpack_reader_error(reader)) + { + return CPROF_MPACK_PENDING_MAP_ENTRIES; + } + } + + return result; +} + +int cprof_mpack_unpack_array(mpack_reader_t *reader, + cprof_mpack_unpacker_entry_callback_fn_t entry_processor_callback, + void *context) +{ + uint32_t entry_index; + uint32_t entry_count; + mpack_tag_t tag; + int result; + + tag = mpack_read_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) + { + return CPROF_MPACK_ENGINE_ERROR; + } + + if (mpack_type_array != mpack_tag_type(&tag)) { + return CPROF_MPACK_UNEXPECTED_DATA_TYPE_ERROR; + } + + entry_count = mpack_tag_array_count(&tag); + + /* This validation only applies to cmetrics and its use cases, we know + * that in our schema we have the following arrays : + * label text dictionary (strings) + * dimension labels (indexes) + * metric values + * dimension values + * + * IMO none of these arrays should be huge so I think using 65535 as a limit + * gives us more than enough wiggle space (in reality I don't expect any of these + * arrays to hold more than 128 values but I could be wrong as that probably depends + * on the flush interval) + */ + + if (CPROF_MPACK_MAX_ARRAY_ENTRY_COUNT < entry_count) { + return CPROF_MPACK_CORRUPT_INPUT_DATA_ERROR; + } + + result = CPROF_MPACK_SUCCESS; + + for (entry_index = 0 ; + CPROF_MPACK_SUCCESS == result && entry_index < entry_count ; + entry_index++) { + result = entry_processor_callback(reader, entry_index, context); + } + + if (CPROF_MPACK_SUCCESS == result) { + mpack_done_array(reader); + + if (mpack_ok != mpack_reader_error(reader)) + { + return CPROF_MPACK_PENDING_ARRAY_ENTRIES; + } + } + + return result; +} + +int cprof_mpack_peek_array_length(mpack_reader_t *reader) +{ + mpack_tag_t tag; + + tag = mpack_peek_tag(reader); + + if (mpack_ok != mpack_reader_error(reader)) + { + return 0; + } + + if (mpack_type_array != mpack_tag_type(&tag)) { + return 0; + } + + return mpack_tag_array_count(&tag); +} + +mpack_type_t cprof_mpack_peek_type(mpack_reader_t *reader) +{ + mpack_tag_t tag; + + tag = mpack_peek_tag(reader); + + if (mpack_reader_error(reader) != mpack_ok) { + return mpack_type_missing; + } + + return mpack_tag_type(&tag); +} diff --git a/lib/cprofiles/src/cprof_profile.c b/lib/cprofiles/src/cprof_profile.c index 66d62b3619d..2c833a4661a 100644 --- a/lib/cprofiles/src/cprof_profile.c +++ b/lib/cprofiles/src/cprof_profile.c @@ -98,7 +98,7 @@ void cprof_profile_destroy(struct cprof_profile *instance) struct cfl_list *iterator_backup; struct cprof_attribute_unit *attribute_unit; struct cprof_value_type *value_type; - struct cprof_mapping *location; + struct cprof_location *location; struct cprof_function *function; struct cfl_list *iterator; struct cprof_mapping *mapping; @@ -239,7 +239,7 @@ size_t cprof_profile_string_add(struct cprof_profile *profile, char *str, int st str_len = strlen(str); } - if (!profile->string_table) { + if (!profile->string_table && str_len > 0) { profile->string_table = malloc(alloc_size * sizeof(cfl_sds_t)); if (!profile->string_table) { return -1; diff --git a/lib/cprofiles/src/cprof_resource_profiles.c b/lib/cprofiles/src/cprof_resource_profiles.c index f0bec38e8b6..a2374930412 100644 --- a/lib/cprofiles/src/cprof_resource_profiles.c +++ b/lib/cprofiles/src/cprof_resource_profiles.c @@ -60,8 +60,7 @@ void cprof_resource_profiles_destroy(struct cprof_resource_profiles *instance) { iterator_backup, &instance->scope_profiles) { scope_profiles = cfl_list_entry(iterator, - struct cprof_scope_profiles, - _head); + struct cprof_scope_profiles, _head); cfl_list_del(&scope_profiles->_head); diff --git a/lib/cprofiles/tests/CMakeLists.txt b/lib/cprofiles/tests/CMakeLists.txt index cdecff12811..0da202814b1 100644 --- a/lib/cprofiles/tests/CMakeLists.txt +++ b/lib/cprofiles/tests/CMakeLists.txt @@ -1,5 +1,8 @@ set(UNIT_TESTS_FILES - decoder.c + profile.c + msgpack_transcoder.c + opentelemetry_transcoder.c + text_transcoder.c ) set(CPROF_TESTS_DATA_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data") diff --git a/lib/cprofiles/tests/msgpack_transcoder.c b/lib/cprofiles/tests/msgpack_transcoder.c new file mode 100644 index 00000000000..a14bec1c6b6 --- /dev/null +++ b/lib/cprofiles/tests/msgpack_transcoder.c @@ -0,0 +1,701 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ========= + * Copyright (C) 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "cprof_tests.h" +#include +#include + +#include +#include +#include + +unsigned char serialized_data[] = { + 0x82, 0xA4, 0x6D, 0x65, 0x74, 0x61, 0x80, 0xA8, 0x70, 0x72, 0x6F, 0x66, + 0x69, 0x6C, 0x65, 0x73, 0x91, 0x83, 0xA8, 0x72, 0x65, 0x73, 0x6F, 0x75, + 0x72, 0x63, 0x65, 0x82, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x85, 0xA7, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x69, 0x64, + 0xA1, 0x30, 0xA7, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x69, 0x70, 0xA9, 0x31, + 0x32, 0x37, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0xA9, 0x68, 0x6F, 0x73, + 0x74, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0xAC, 0x6C, 0x69, 0x6D, 0x61, 0x2D, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0xAF, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2E, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0xA0, + 0xA9, 0x6F, 0x73, 0x2E, 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0xA5, 0x36, + 0x2E, 0x35, 0x2E, 0x30, 0xB7, 0x64, 0x72, 0x6F, 0x70, 0x70, 0x65, 0x64, + 0x5F, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5F, 0x63, + 0x6F, 0x75, 0x6E, 0x74, 0x00, 0xAE, 0x73, 0x63, 0x6F, 0x70, 0x65, 0x5F, + 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x91, 0x83, 0xB5, 0x69, + 0x6E, 0x73, 0x74, 0x72, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x74, 0x69, + 0x6F, 0x6E, 0x5F, 0x73, 0x63, 0x6F, 0x70, 0x65, 0x84, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0xA0, 0xA7, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0xA0, + 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x80, + 0xB7, 0x64, 0x72, 0x6F, 0x70, 0x70, 0x65, 0x64, 0x5F, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5F, 0x63, 0x6F, 0x75, 0x6E, 0x74, + 0x00, 0xA8, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x91, 0xDE, + 0x00, 0x17, 0xAA, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x5F, 0x69, + 0x64, 0xC4, 0x10, 0xA4, 0x58, 0x33, 0xE6, 0x18, 0xE6, 0x34, 0x8D, 0xD6, + 0xFE, 0x00, 0x58, 0x56, 0xF5, 0xA7, 0x54, 0xB4, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5F, 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x75, 0x6E, 0x69, 0x78, 0x5F, + 0x6E, 0x61, 0x6E, 0x6F, 0xCF, 0x18, 0x04, 0xC7, 0x53, 0x2C, 0xAC, 0x39, + 0x69, 0xB2, 0x65, 0x6E, 0x64, 0x5F, 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x75, + 0x6E, 0x69, 0x78, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0xCF, 0x18, 0x04, 0xC7, + 0x53, 0x2C, 0xAC, 0x39, 0x69, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x80, 0xB2, 0x64, 0x72, 0x6F, 0x70, 0x70, 0x65, + 0x64, 0x5F, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x00, 0xAC, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x5F, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x91, 0x83, 0xA4, 0x74, 0x79, 0x70, 0x65, 0x01, 0xA4, 0x75, + 0x6E, 0x69, 0x74, 0x02, 0xB7, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x74, 0x65, 0x6D, 0x70, 0x6F, 0x72, 0x61, + 0x6C, 0x69, 0x74, 0x79, 0x00, 0xA6, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, + 0x93, 0x87, 0xAE, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x90, 0xB5, 0x6C, 0x6F, 0x63, 0x61, 0x74, + 0x69, 0x6F, 0x6E, 0x73, 0x5F, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x00, 0xB0, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, + 0x6F, 0x6E, 0x73, 0x5F, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x05, 0xA6, + 0x76, 0x61, 0x6C, 0x75, 0x65, 0x73, 0x91, 0x01, 0xAA, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x92, 0x01, 0x02, 0xA4, 0x6C, + 0x69, 0x6E, 0x6B, 0x00, 0xB4, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x74, 0x61, + 0x6D, 0x70, 0x73, 0x5F, 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x6E, 0x61, 0x6E, + 0x6F, 0x91, 0xCF, 0x18, 0x04, 0xC7, 0x52, 0xCA, 0x52, 0xB5, 0x76, 0x87, + 0xAE, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x90, 0xB5, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, + 0x6E, 0x73, 0x5F, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x69, 0x6E, 0x64, + 0x65, 0x78, 0x05, 0xB0, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, + 0x73, 0x5F, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x0E, 0xA6, 0x76, 0x61, + 0x6C, 0x75, 0x65, 0x73, 0x91, 0x01, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x92, 0x06, 0x07, 0xA4, 0x6C, 0x69, 0x6E, + 0x6B, 0x00, 0xB4, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x74, 0x61, 0x6D, 0x70, + 0x73, 0x5F, 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0x91, + 0xCF, 0x18, 0x04, 0xC7, 0x53, 0x11, 0xD8, 0xE9, 0xA8, 0x87, 0xAE, 0x6C, + 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, + 0x78, 0x90, 0xB5, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, + 0x5F, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, + 0x13, 0xB0, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x5F, + 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x12, 0xA6, 0x76, 0x61, 0x6C, 0x75, + 0x65, 0x73, 0x91, 0x01, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x92, 0x09, 0x0A, 0xA4, 0x6C, 0x69, 0x6E, 0x6B, 0x00, + 0xB4, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x74, 0x61, 0x6D, 0x70, 0x73, 0x5F, + 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0x91, 0xCF, 0x18, + 0x04, 0xC7, 0x53, 0x2C, 0xAC, 0x39, 0x69, 0xA8, 0x6D, 0x61, 0x70, 0x70, + 0x69, 0x6E, 0x67, 0x73, 0x93, 0x8A, 0xA2, 0x69, 0x64, 0x00, 0xAC, 0x6D, + 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x5F, 0x73, 0x74, 0x61, 0x72, 0x74, 0x00, + 0xAC, 0x6D, 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x5F, 0x6C, 0x69, 0x6D, 0x69, + 0x74, 0x00, 0xAB, 0x66, 0x69, 0x6C, 0x65, 0x5F, 0x6F, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, + 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x90, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, + 0x6F, 0x6E, 0x73, 0x00, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xB0, 0x68, 0x61, 0x73, 0x5F, + 0x6C, 0x69, 0x6E, 0x65, 0x5F, 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, 0x73, + 0x00, 0xB1, 0x68, 0x61, 0x73, 0x5F, 0x69, 0x6E, 0x6C, 0x69, 0x6E, 0x65, + 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, 0x8A, 0xA2, 0x69, 0x64, + 0x00, 0xAC, 0x6D, 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x5F, 0x73, 0x74, 0x61, + 0x72, 0x74, 0xCE, 0x00, 0x40, 0x00, 0x00, 0xAC, 0x6D, 0x65, 0x6D, 0x6F, + 0x72, 0x79, 0x5F, 0x6C, 0x69, 0x6D, 0x69, 0x74, 0xCE, 0x01, 0x1D, 0x00, + 0x00, 0xAB, 0x66, 0x69, 0x6C, 0x65, 0x5F, 0x6F, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x08, + 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x92, + 0x04, 0x05, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, + 0x69, 0x6F, 0x6E, 0x73, 0x00, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x69, + 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xB0, 0x68, 0x61, 0x73, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x5F, 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, + 0x73, 0x00, 0xB1, 0x68, 0x61, 0x73, 0x5F, 0x69, 0x6E, 0x6C, 0x69, 0x6E, + 0x65, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, 0x8A, 0xA2, 0x69, + 0x64, 0x00, 0xAC, 0x6D, 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x5F, 0x73, 0x74, + 0x61, 0x72, 0x74, 0xCE, 0x00, 0x01, 0x00, 0x00, 0xAC, 0x6D, 0x65, 0x6D, + 0x6F, 0x72, 0x79, 0x5F, 0x6C, 0x69, 0x6D, 0x69, 0x74, 0xCE, 0x00, 0xFE, + 0xE0, 0x00, 0xAB, 0x66, 0x69, 0x6C, 0x65, 0x5F, 0x6F, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, + 0x0A, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x91, 0x08, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, + 0x69, 0x6F, 0x6E, 0x73, 0x00, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x69, + 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xB0, 0x68, 0x61, 0x73, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x5F, 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, + 0x73, 0x00, 0xB1, 0x68, 0x61, 0x73, 0x5F, 0x69, 0x6E, 0x6C, 0x69, 0x6E, + 0x65, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xA9, 0x6C, 0x6F, + 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0xDC, 0x00, 0x25, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCE, 0x00, 0x10, 0xE0, 0xDB, 0xA5, 0x6C, 0x69, 0x6E, 0x65, + 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x01, 0xA4, 0x6C, 0x69, 0x6E, 0x65, + 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCE, 0x01, 0x54, 0x85, 0xC7, 0xA5, 0x6C, 0x69, 0x6E, 0x65, + 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x02, 0xA4, 0x6C, 0x69, 0x6E, 0x65, + 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCE, 0x00, 0x0E, 0x8A, 0x37, 0xA5, 0x6C, 0x69, 0x6E, 0x65, + 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x03, 0xA4, 0x6C, 0x69, 0x6E, 0x65, + 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCE, 0x00, 0x0F, 0x4B, 0x77, 0xA5, 0x6C, 0x69, 0x6E, 0x65, + 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x04, 0xA4, 0x6C, 0x69, 0x6E, 0x65, + 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCD, 0x7D, 0x07, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x05, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x48, 0x6B, 0x43, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x06, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x4C, 0xDA, 0xBB, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x07, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x4C, 0xDB, 0xE7, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x08, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x2E, 0x6A, 0x93, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x09, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x2E, 0x06, 0x57, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0A, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x2E, 0x89, 0x97, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0B, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x2E, 0x94, 0x1F, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0C, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x02, 0x3D, 0x6B, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0D, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x02, 0x3F, 0x53, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0E, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x02, 0x3F, 0xB7, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0F, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x01, 0x53, 0xDE, 0xA7, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x10, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x01, 0x53, 0xE5, 0x4F, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x11, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCD, 0x1E, 0x47, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, 0x83, 0xAE, + 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, 0x6E, 0x64, + 0x65, 0x78, 0x12, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, 0x63, 0x6F, + 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xAD, + 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, 0x64, 0x65, + 0x78, 0x01, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0xCE, 0x00, + 0x40, 0x53, 0x1F, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x90, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x03, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x4A, 0x66, 0x9F, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x13, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x4B, 0x2F, 0xC3, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x14, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x4B, 0x4F, 0xB3, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x15, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x48, 0x30, 0x9B, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x16, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0xB4, 0x4B, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x17, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0xF1, 0xEB, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x18, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x3F, 0x97, 0x7B, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x19, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x3F, 0x98, 0x67, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x1A, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0x48, 0x6F, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x1B, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0x79, 0xF7, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x1C, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0x7A, 0xCB, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x1D, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x02, 0x3D, 0x6B, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x0D, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x02, 0x3F, 0x53, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x0E, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x02, 0x3F, 0xB7, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x0F, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x53, 0xDE, 0xA7, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x10, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x53, 0xE5, 0x4F, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x11, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCD, 0x1E, 0x47, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, + 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x12, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, + 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x02, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0xCE, 0x00, 0x01, 0x5F, 0xAF, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, + 0x90, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x91, 0x03, 0xB0, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, + 0x69, 0x6E, 0x64, 0x69, 0x63, 0x65, 0x73, 0xDC, 0x00, 0x25, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, + 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0xA9, + 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0xDC, 0x00, 0x1E, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x18, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x10, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x24, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x19, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x21, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x1A, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x25, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x0B, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x26, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x11, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x14, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x15, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x12, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x22, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x16, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x0E, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x1B, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x1E, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x17, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x27, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x0C, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x13, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x1F, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x23, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x0F, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x1C, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x0D, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x20, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x1D, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0xAF, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5F, 0x74, + 0x61, 0x62, 0x6C, 0x65, 0x8B, 0xB2, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, + 0x65, 0x2E, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x2E, 0x74, 0x79, 0x70, 0x65, + 0xA6, 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0xAC, 0x63, 0x6F, 0x6E, 0x74, + 0x61, 0x69, 0x6E, 0x65, 0x72, 0x2E, 0x69, 0x64, 0xA1, 0x2F, 0xAB, 0x74, + 0x68, 0x72, 0x65, 0x61, 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0xAB, 0x6B, + 0x77, 0x6F, 0x72, 0x6B, 0x65, 0x72, 0x2F, 0x36, 0x3A, 0x31, 0xB2, 0x70, + 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x2E, 0x66, 0x72, 0x61, 0x6D, 0x65, + 0x2E, 0x74, 0x79, 0x70, 0x65, 0xA6, 0x6E, 0x61, 0x74, 0x69, 0x76, 0x65, + 0xBF, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E, 0x65, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x2E, 0x62, 0x75, 0x69, 0x6C, + 0x64, 0x5F, 0x69, 0x64, 0x2E, 0x67, 0x6E, 0x75, 0xD9, 0x28, 0x33, 0x34, + 0x31, 0x39, 0x61, 0x33, 0x65, 0x66, 0x30, 0x30, 0x31, 0x35, 0x34, 0x35, + 0x64, 0x38, 0x65, 0x65, 0x39, 0x66, 0x63, 0x64, 0x34, 0x62, 0x31, 0x38, + 0x64, 0x34, 0x63, 0x65, 0x31, 0x37, 0x32, 0x30, 0x35, 0x37, 0x65, 0x33, + 0x33, 0x39, 0xD9, 0x25, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x2E, 0x62, + 0x75, 0x69, 0x6C, 0x64, 0x5F, 0x69, 0x64, 0x2E, 0x70, 0x72, 0x6F, 0x66, + 0x69, 0x6C, 0x69, 0x6E, 0x67, 0xD9, 0x20, 0x37, 0x30, 0x35, 0x62, 0x64, + 0x66, 0x31, 0x34, 0x39, 0x38, 0x30, 0x66, 0x32, 0x63, 0x32, 0x32, 0x64, + 0x63, 0x34, 0x64, 0x65, 0x32, 0x65, 0x36, 0x35, 0x37, 0x36, 0x65, 0x64, + 0x66, 0x66, 0x38, 0xAC, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, + 0x72, 0x2E, 0x69, 0x64, 0xD9, 0x2A, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2E, + 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2D, 0x35, + 0x30, 0x31, 0x2E, 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6F, 0x6E, 0x2D, 0x32, 0x2E, 0x73, 0x63, 0x6F, 0x70, 0x65, + 0xAB, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, + 0xAD, 0x65, 0x62, 0x70, 0x66, 0x2D, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, + 0x65, 0x72, 0xD9, 0x25, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x2E, 0x62, + 0x75, 0x69, 0x6C, 0x64, 0x5F, 0x69, 0x64, 0x2E, 0x70, 0x72, 0x6F, 0x66, + 0x69, 0x6C, 0x69, 0x6E, 0x67, 0xD9, 0x20, 0x64, 0x37, 0x38, 0x30, 0x31, + 0x36, 0x30, 0x34, 0x65, 0x38, 0x62, 0x38, 0x39, 0x64, 0x64, 0x61, 0x63, + 0x66, 0x65, 0x31, 0x39, 0x38, 0x39, 0x39, 0x64, 0x36, 0x62, 0x61, 0x33, + 0x35, 0x36, 0x34, 0xAC, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, + 0x72, 0x2E, 0x69, 0x64, 0xD9, 0x48, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2E, + 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2D, 0x35, + 0x30, 0x31, 0x2E, 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x75, 0x73, 0x65, + 0x72, 0x40, 0x35, 0x30, 0x31, 0x2E, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2F, 0x61, 0x70, 0x70, 0x2E, 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, + 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x64, 0x2E, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xAB, 0x74, 0x68, 0x72, 0x65, 0x61, + 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0xAA, 0x63, 0x6F, 0x6E, 0x74, 0x61, + 0x69, 0x6E, 0x65, 0x72, 0x64, 0xAF, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x5F, 0x75, 0x6E, 0x69, 0x74, 0x73, 0x90, 0xAA, 0x6C, + 0x69, 0x6E, 0x6B, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x90, 0xAC, 0x73, + 0x74, 0x72, 0x69, 0x6E, 0x67, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0xDC, + 0x00, 0x28, 0xA0, 0xA7, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x73, 0xA5, + 0x63, 0x6F, 0x75, 0x6E, 0x74, 0xA3, 0x63, 0x70, 0x75, 0xAB, 0x6E, 0x61, + 0x6E, 0x6F, 0x73, 0x65, 0x63, 0x6F, 0x6E, 0x64, 0x73, 0xB6, 0x41, 0x54, + 0x73, 0x51, 0x46, 0x31, 0x72, 0x72, 0x49, 0x63, 0x30, 0x35, 0x74, 0x65, + 0x6A, 0x66, 0x79, 0x65, 0x73, 0x5A, 0x52, 0x77, 0xD9, 0x20, 0x62, 0x61, + 0x31, 0x63, 0x39, 0x61, 0x35, 0x61, 0x38, 0x32, 0x35, 0x36, 0x61, 0x36, + 0x65, 0x66, 0x33, 0x65, 0x36, 0x36, 0x33, 0x63, 0x63, 0x37, 0x33, 0x31, + 0x36, 0x38, 0x30, 0x33, 0x64, 0x39, 0xB6, 0x7A, 0x6A, 0x32, 0x51, 0x75, + 0x43, 0x52, 0x61, 0x70, 0x75, 0x6E, 0x30, 0x32, 0x73, 0x79, 0x68, 0x6C, + 0x41, 0x48, 0x71, 0x54, 0x77, 0xAD, 0x65, 0x62, 0x70, 0x66, 0x2D, 0x70, + 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x72, 0xB6, 0x36, 0x34, 0x41, 0x49, + 0x75, 0x76, 0x39, 0x69, 0x70, 0x47, 0x42, 0x41, 0x41, 0x64, 0x30, 0x52, + 0x5A, 0x6D, 0x76, 0x4C, 0x4C, 0x77, 0xAA, 0x63, 0x6F, 0x6E, 0x74, 0x61, + 0x69, 0x6E, 0x65, 0x72, 0x64, 0xB3, 0x5F, 0x5F, 0x63, 0x68, 0x65, 0x63, + 0x6B, 0x5F, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x5F, 0x73, 0x69, 0x7A, + 0x65, 0xB1, 0x6F, 0x62, 0x6A, 0x5F, 0x63, 0x67, 0x72, 0x6F, 0x75, 0x70, + 0x5F, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0xAD, 0x5F, 0x5F, 0x73, 0x6F, + 0x63, 0x6B, 0x5F, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0xA7, 0x65, 0x6C, + 0x30, 0x5F, 0x73, 0x76, 0x63, 0xAC, 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x31, 0xA8, 0x73, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6C, 0x65, 0xB0, 0x62, 0x70, 0x66, 0x5F, 0x6D, 0x61, 0x70, 0x5F, + 0x64, 0x6F, 0x5F, 0x62, 0x61, 0x74, 0x63, 0x68, 0xAE, 0x69, 0x6E, 0x76, + 0x6F, 0x6B, 0x65, 0x5F, 0x73, 0x79, 0x73, 0x63, 0x61, 0x6C, 0x6C, 0xB0, + 0x6B, 0x6D, 0x65, 0x6D, 0x5F, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5F, 0x61, + 0x6C, 0x6C, 0x6F, 0x63, 0xA9, 0x5F, 0x5F, 0x73, 0x79, 0x73, 0x5F, 0x62, + 0x70, 0x66, 0xAF, 0x5F, 0x5F, 0x61, 0x72, 0x6D, 0x36, 0x34, 0x5F, 0x73, + 0x79, 0x73, 0x5F, 0x62, 0x70, 0x66, 0xAA, 0x64, 0x6F, 0x5F, 0x65, 0x6C, + 0x30, 0x5F, 0x73, 0x76, 0x63, 0xB9, 0x70, 0x72, 0x6F, 0x70, 0x61, 0x67, + 0x61, 0x74, 0x65, 0x5F, 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x5F, 0x75, 0x73, 0x61, 0x67, 0x65, 0xB9, 0x66, 0x69, 0x6E, 0x69, + 0x73, 0x68, 0x5F, 0x74, 0x61, 0x73, 0x6B, 0x5F, 0x73, 0x77, 0x69, 0x74, + 0x63, 0x68, 0x2E, 0x69, 0x73, 0x72, 0x61, 0x2E, 0x30, 0xA7, 0x6B, 0x74, + 0x68, 0x72, 0x65, 0x61, 0x64, 0xB3, 0x5F, 0x5F, 0x63, 0x68, 0x65, 0x63, + 0x6B, 0x5F, 0x68, 0x65, 0x61, 0x70, 0x5F, 0x6F, 0x62, 0x6A, 0x65, 0x63, + 0x74, 0xB4, 0x65, 0x6C, 0x30, 0x74, 0x5F, 0x36, 0x34, 0x5F, 0x73, 0x79, + 0x6E, 0x63, 0x5F, 0x68, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x72, 0xAB, 0x75, + 0x6E, 0x69, 0x78, 0x5F, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0xB2, 0x5F, + 0x5F, 0x61, 0x72, 0x6D, 0x36, 0x34, 0x5F, 0x73, 0x79, 0x73, 0x5F, 0x73, + 0x6F, 0x63, 0x6B, 0x65, 0x74, 0xAC, 0x65, 0x6C, 0x30, 0x74, 0x5F, 0x36, + 0x34, 0x5F, 0x73, 0x79, 0x6E, 0x63, 0xAD, 0x73, 0x6B, 0x5F, 0x70, 0x72, + 0x6F, 0x74, 0x5F, 0x61, 0x6C, 0x6C, 0x6F, 0x63, 0xAC, 0x5F, 0x5F, 0x73, + 0x79, 0x73, 0x5F, 0x73, 0x6F, 0x63, 0x6B, 0x65, 0x74, 0xAD, 0x72, 0x65, + 0x74, 0x5F, 0x66, 0x72, 0x6F, 0x6D, 0x5F, 0x66, 0x6F, 0x72, 0x6B, 0xBA, + 0x65, 0x6C, 0x30, 0x5F, 0x73, 0x76, 0x63, 0x5F, 0x63, 0x6F, 0x6D, 0x6D, + 0x6F, 0x6E, 0x2E, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x70, 0x72, 0x6F, 0x70, + 0x2E, 0x30, 0xA8, 0x73, 0x6B, 0x5F, 0x61, 0x6C, 0x6C, 0x6F, 0x63, 0xAD, + 0x77, 0x6F, 0x72, 0x6B, 0x65, 0x72, 0x5F, 0x74, 0x68, 0x72, 0x65, 0x61, + 0x64, 0xBA, 0x5F, 0x5F, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x5F, 0x6F, 0x62, + 0x6A, 0x65, 0x63, 0x74, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x2E, 0x70, 0x61, + 0x72, 0x74, 0x2E, 0x30, 0xB8, 0x67, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, + 0x5F, 0x6D, 0x61, 0x70, 0x5F, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5F, + 0x62, 0x61, 0x74, 0x63, 0x68, 0xB0, 0x74, 0x72, 0x79, 0x5F, 0x63, 0x68, + 0x61, 0x72, 0x67, 0x65, 0x5F, 0x6D, 0x65, 0x6D, 0x63, 0x67, 0xAB, 0x64, + 0x72, 0x6F, 0x70, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xAB, + 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, + 0xAA, 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0x73, 0xCF, + 0x18, 0x04, 0xC7, 0x53, 0x2C, 0xAC, 0x39, 0x69, 0xAE, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0x73, 0x00, + 0xAB, 0x70, 0x65, 0x72, 0x69, 0x6F, 0x64, 0x5F, 0x74, 0x79, 0x70, 0x65, + 0x83, 0xA4, 0x74, 0x79, 0x70, 0x65, 0x03, 0xA4, 0x75, 0x6E, 0x69, 0x74, + 0x04, 0xB7, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x74, 0x65, 0x6D, 0x70, 0x6F, 0x72, 0x61, 0x6C, 0x69, 0x74, + 0x79, 0x00, 0xA6, 0x70, 0x65, 0x72, 0x69, 0x6F, 0x64, 0xCE, 0x02, 0xFA, + 0xF0, 0x80, 0xA8, 0x63, 0x6F, 0x6D, 0x6D, 0x65, 0x6E, 0x74, 0x73, 0x90, + 0xB3, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x5F, 0x73, 0x61, 0x6D, + 0x70, 0x6C, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x00, 0xAA, 0x73, 0x63, + 0x68, 0x65, 0x6D, 0x61, 0x5F, 0x75, 0x72, 0x6C, 0xA0, 0xAA, 0x73, 0x63, + 0x68, 0x65, 0x6D, 0x61, 0x5F, 0x75, 0x72, 0x6C, 0xA0 +}; + +#ifdef __CPROF_INCLUDE_DEBUG_HELPERS__ +int create_dump_file(char *filename, unsigned char *buffer, size_t buffer_length) +{ + FILE *output_file; + + output_file = fopen(filename, "wb+"); + + if (output_file == NULL) { + return -1; + } + + fwrite(buffer, + sizeof(unsigned char), + buffer_length, + output_file); + + fclose(output_file); +} +#endif + +static void test_encoder() +{ + cfl_sds_t msgpack_encoder_result; + struct cprof *context; + int result; + size_t offset; + + offset = 0; + context = NULL; + + result = cprof_decode_msgpack_create(&context, + (unsigned char *) serialized_data, + sizeof(serialized_data), + &offset); + + TEST_CHECK(result == CPROF_DECODE_MSGPACK_SUCCESS); + TEST_CHECK(offset == sizeof(serialized_data)); + + if (result == CPROF_DECODE_MSGPACK_SUCCESS) { + result = cprof_encode_msgpack_create(&msgpack_encoder_result, context); + + TEST_CHECK(result == CPROF_ENCODE_MSGPACK_SUCCESS); + + if (result == CPROF_ENCODE_MSGPACK_SUCCESS) { + cprof_encode_msgpack_destroy(msgpack_encoder_result); + } + + cprof_decode_msgpack_destroy(context); + } +} + +static void test_decoder() +{ + struct cprof *context; + int result; + size_t offset; + + offset = 0; + context = NULL; + + result = cprof_decode_msgpack_create(&context, + (unsigned char *) serialized_data, + sizeof(serialized_data), + &offset); + + TEST_CHECK(result == CPROF_DECODE_MSGPACK_SUCCESS); + TEST_CHECK(offset == sizeof(serialized_data)); + + if (result == CPROF_DECODE_MSGPACK_SUCCESS) { + cprof_decode_msgpack_destroy(context); + } +} + +TEST_LIST = { + {"encoder", test_encoder}, + {"decoder", test_decoder}, + { 0 } +}; diff --git a/lib/cprofiles/tests/decoder.c b/lib/cprofiles/tests/opentelemetry_transcoder.c similarity index 53% rename from lib/cprofiles/tests/decoder.c rename to lib/cprofiles/tests/opentelemetry_transcoder.c index 5b80be4361a..7c59e25fbd1 100644 --- a/lib/cprofiles/tests/decoder.c +++ b/lib/cprofiles/tests/opentelemetry_transcoder.c @@ -20,12 +20,13 @@ #include #include "cprof_tests.h" #include -#include +#include #include #include #include +/* unsigned char encoded_packet[] = { 0x0A, 0x9F, 0x11, 0x0A, 0x72, 0x0A, 0x0E, 0x0A, 0x07, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x69, 0x64, 0x12, 0x03, 0x0A, 0x01, 0x30, 0x0A, 0x16, 0x0A, 0x07, 0x68, 0x6F, 0x73, 0x74, 0x2E, \ 0x69, 0x70, 0x12, 0x0B, 0x0A, 0x09, 0x31, 0x32, 0x37, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0x0A, 0x1B, 0x0A, 0x09, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0x12, 0x0E, \ 0x0A, 0x0C, 0x6C, 0x69, 0x6D, 0x61, 0x2D, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x0A, 0x15, 0x0A, 0x0F, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2E, 0x76, 0x65, 0x72, 0x73, \ @@ -101,74 +102,228 @@ unsigned char encoded_packet[] = { 0x0A, 0x9F, 0x11, 0x0A, 0x72, 0x0A, 0x0E, 0x 0x65, 0x2F, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x64, 0x2E, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x82, 0x01, 0x1B, 0x0A, 0x0B, 0x74, 0x68, 0x72, 0x65, 0x61, \ 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0x12, 0x0C, 0x0A, 0x0A, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x64 }; +*/ -static void print_profile_(struct cprof_profile *profile) +unsigned char serialized_data[] = { + 0x0A, 0x9F, 0x11, 0x0A, 0x72, 0x0A, 0x0E, 0x0A, 0x07, 0x68, 0x6F, 0x73, + 0x74, 0x2E, 0x69, 0x64, 0x12, 0x03, 0x0A, 0x01, 0x30, 0x0A, 0x16, 0x0A, + 0x07, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x69, 0x70, 0x12, 0x0B, 0x0A, 0x09, + 0x31, 0x32, 0x37, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0x0A, 0x1B, 0x0A, + 0x09, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0x12, 0x0E, + 0x0A, 0x0C, 0x6C, 0x69, 0x6D, 0x61, 0x2D, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6C, 0x74, 0x0A, 0x15, 0x0A, 0x0F, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2E, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x12, 0x02, 0x0A, + 0x00, 0x0A, 0x14, 0x0A, 0x09, 0x6F, 0x73, 0x2E, 0x6B, 0x65, 0x72, 0x6E, + 0x65, 0x6C, 0x12, 0x07, 0x0A, 0x05, 0x36, 0x2E, 0x35, 0x2E, 0x30, 0x12, + 0xA8, 0x10, 0x0A, 0x00, 0x12, 0xA3, 0x10, 0x0A, 0x10, 0xA4, 0x58, 0x33, + 0xE6, 0x18, 0xE6, 0x34, 0x8D, 0xD6, 0xFE, 0x00, 0x58, 0x56, 0xF5, 0xA7, + 0x54, 0x11, 0x69, 0x39, 0xAC, 0x2C, 0x53, 0xC7, 0x04, 0x18, 0x19, 0x69, + 0x39, 0xAC, 0x2C, 0x53, 0xC7, 0x04, 0x18, 0x42, 0xFC, 0x0F, 0x0A, 0x04, + 0x08, 0x01, 0x10, 0x02, 0x12, 0x16, 0x12, 0x01, 0x01, 0x40, 0x05, 0x48, + 0x05, 0x52, 0x02, 0x01, 0x02, 0x6A, 0x09, 0xF6, 0xEA, 0xCA, 0xD2, 0xAC, + 0xEA, 0xB1, 0x82, 0x18, 0x12, 0x18, 0x12, 0x01, 0x01, 0x38, 0x05, 0x40, + 0x0E, 0x48, 0x07, 0x52, 0x02, 0x06, 0x07, 0x6A, 0x09, 0xA8, 0xD3, 0xE3, + 0x8E, 0xB1, 0xEA, 0xB1, 0x82, 0x18, 0x12, 0x18, 0x12, 0x01, 0x01, 0x38, + 0x13, 0x40, 0x12, 0x48, 0x09, 0x52, 0x02, 0x09, 0x0A, 0x6A, 0x09, 0xE9, + 0xF2, 0xB0, 0xE5, 0xB2, 0xEA, 0xB1, 0x82, 0x18, 0x1A, 0x04, 0x30, 0x06, + 0x58, 0x01, 0x1A, 0x10, 0x10, 0x80, 0x80, 0x80, 0x02, 0x18, 0x80, 0x80, + 0xF4, 0x08, 0x28, 0x08, 0x62, 0x02, 0x04, 0x05, 0x1A, 0x0E, 0x10, 0x80, + 0x80, 0x04, 0x18, 0x80, 0xC0, 0xFB, 0x07, 0x28, 0x0A, 0x62, 0x01, 0x08, + 0x22, 0x0B, 0x18, 0xDB, 0xC1, 0x43, 0x22, 0x02, 0x08, 0x01, 0x3A, 0x01, + 0x00, 0x22, 0x0C, 0x18, 0xC7, 0x8B, 0xD2, 0x0A, 0x22, 0x02, 0x08, 0x02, + 0x3A, 0x01, 0x00, 0x22, 0x0B, 0x18, 0xB7, 0x94, 0x3A, 0x22, 0x02, 0x08, + 0x03, 0x3A, 0x01, 0x00, 0x22, 0x0B, 0x18, 0xF7, 0x96, 0x3D, 0x22, 0x02, + 0x08, 0x04, 0x3A, 0x01, 0x00, 0x22, 0x0B, 0x18, 0x87, 0xFA, 0x01, 0x22, + 0x02, 0x08, 0x05, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xC3, 0xD6, 0xA1, + 0x02, 0x22, 0x02, 0x08, 0x06, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xBB, + 0xB5, 0xB3, 0x02, 0x22, 0x02, 0x08, 0x07, 0x3A, 0x01, 0x00, 0x22, 0x0C, + 0x18, 0xE7, 0xB7, 0xB3, 0x02, 0x22, 0x02, 0x08, 0x08, 0x3A, 0x01, 0x00, + 0x22, 0x0C, 0x18, 0x93, 0xD5, 0xB9, 0x01, 0x22, 0x02, 0x08, 0x09, 0x3A, + 0x01, 0x00, 0x22, 0x0C, 0x18, 0xD7, 0x8C, 0xB8, 0x01, 0x22, 0x02, 0x08, + 0x0A, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0x97, 0x93, 0xBA, 0x01, 0x22, + 0x02, 0x08, 0x0B, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0x9F, 0xA8, 0xBA, + 0x01, 0x22, 0x02, 0x08, 0x0C, 0x3A, 0x01, 0x00, 0x22, 0x0B, 0x18, 0xEB, + 0xFA, 0x08, 0x22, 0x02, 0x08, 0x0D, 0x3A, 0x01, 0x00, 0x22, 0x0B, 0x18, + 0xD3, 0xFE, 0x08, 0x22, 0x02, 0x08, 0x0E, 0x3A, 0x01, 0x00, 0x22, 0x0B, + 0x18, 0xB7, 0xFF, 0x08, 0x22, 0x02, 0x08, 0x0F, 0x3A, 0x01, 0x00, 0x22, + 0x0C, 0x18, 0xA7, 0xBD, 0xCF, 0x0A, 0x22, 0x02, 0x08, 0x10, 0x3A, 0x01, + 0x00, 0x22, 0x0C, 0x18, 0xCF, 0xCA, 0xCF, 0x0A, 0x22, 0x02, 0x08, 0x11, + 0x3A, 0x01, 0x00, 0x22, 0x0A, 0x18, 0xC7, 0x3C, 0x22, 0x02, 0x08, 0x12, + 0x3A, 0x01, 0x00, 0x22, 0x0A, 0x10, 0x01, 0x18, 0x9F, 0xA6, 0x81, 0x02, + 0x3A, 0x01, 0x03, 0x22, 0x0C, 0x18, 0x9F, 0xCD, 0xA9, 0x02, 0x22, 0x02, + 0x08, 0x13, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xC3, 0xDF, 0xAC, 0x02, + 0x22, 0x02, 0x08, 0x14, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xB3, 0x9F, + 0xAD, 0x02, 0x22, 0x02, 0x08, 0x15, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, + 0x9B, 0xE1, 0xA0, 0x02, 0x22, 0x02, 0x08, 0x16, 0x3A, 0x01, 0x00, 0x22, + 0x0C, 0x18, 0xCB, 0xE8, 0x86, 0x09, 0x22, 0x02, 0x08, 0x17, 0x3A, 0x01, + 0x00, 0x22, 0x0C, 0x18, 0xEB, 0xE3, 0x87, 0x09, 0x22, 0x02, 0x08, 0x18, + 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xFB, 0xAE, 0xFE, 0x09, 0x22, 0x02, + 0x08, 0x19, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xE7, 0xB0, 0xFE, 0x09, + 0x22, 0x02, 0x08, 0x1A, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xEF, 0x90, + 0x85, 0x09, 0x22, 0x02, 0x08, 0x1B, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, + 0xF7, 0xF3, 0x85, 0x09, 0x22, 0x02, 0x08, 0x1C, 0x3A, 0x01, 0x00, 0x22, + 0x0C, 0x18, 0xCB, 0xF5, 0x85, 0x09, 0x22, 0x02, 0x08, 0x1D, 0x3A, 0x01, + 0x00, 0x22, 0x0B, 0x18, 0xEB, 0xFA, 0x08, 0x22, 0x02, 0x08, 0x0D, 0x3A, + 0x01, 0x00, 0x22, 0x0B, 0x18, 0xD3, 0xFE, 0x08, 0x22, 0x02, 0x08, 0x0E, + 0x3A, 0x01, 0x00, 0x22, 0x0B, 0x18, 0xB7, 0xFF, 0x08, 0x22, 0x02, 0x08, + 0x0F, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xA7, 0xBD, 0xCF, 0x0A, 0x22, + 0x02, 0x08, 0x10, 0x3A, 0x01, 0x00, 0x22, 0x0C, 0x18, 0xCF, 0xCA, 0xCF, + 0x0A, 0x22, 0x02, 0x08, 0x11, 0x3A, 0x01, 0x00, 0x22, 0x0A, 0x18, 0xC7, + 0x3C, 0x22, 0x02, 0x08, 0x12, 0x3A, 0x01, 0x00, 0x22, 0x09, 0x10, 0x02, + 0x18, 0xAF, 0xBF, 0x05, 0x3A, 0x01, 0x03, 0x2A, 0x00, 0x2A, 0x02, 0x10, + 0x18, 0x2A, 0x02, 0x10, 0x10, 0x2A, 0x02, 0x10, 0x24, 0x2A, 0x02, 0x10, + 0x19, 0x2A, 0x02, 0x10, 0x21, 0x2A, 0x02, 0x10, 0x1A, 0x2A, 0x02, 0x10, + 0x25, 0x2A, 0x02, 0x10, 0x0B, 0x2A, 0x02, 0x10, 0x26, 0x2A, 0x02, 0x10, + 0x11, 0x2A, 0x02, 0x10, 0x14, 0x2A, 0x02, 0x10, 0x15, 0x2A, 0x02, 0x10, + 0x12, 0x2A, 0x02, 0x10, 0x22, 0x2A, 0x02, 0x10, 0x16, 0x2A, 0x02, 0x10, + 0x0E, 0x2A, 0x02, 0x10, 0x1B, 0x2A, 0x02, 0x10, 0x1E, 0x2A, 0x02, 0x10, + 0x17, 0x2A, 0x02, 0x10, 0x27, 0x2A, 0x02, 0x10, 0x0C, 0x2A, 0x02, 0x10, + 0x13, 0x2A, 0x02, 0x10, 0x1F, 0x2A, 0x02, 0x10, 0x23, 0x2A, 0x02, 0x10, + 0x0F, 0x2A, 0x02, 0x10, 0x1C, 0x2A, 0x02, 0x10, 0x0D, 0x2A, 0x02, 0x10, + 0x20, 0x2A, 0x02, 0x10, 0x1D, 0x32, 0x00, 0x32, 0x07, 0x73, 0x61, 0x6D, + 0x70, 0x6C, 0x65, 0x73, 0x32, 0x05, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x32, + 0x03, 0x63, 0x70, 0x75, 0x32, 0x0B, 0x6E, 0x61, 0x6E, 0x6F, 0x73, 0x65, + 0x63, 0x6F, 0x6E, 0x64, 0x73, 0x32, 0x16, 0x41, 0x54, 0x73, 0x51, 0x46, + 0x31, 0x72, 0x72, 0x49, 0x63, 0x30, 0x35, 0x74, 0x65, 0x6A, 0x66, 0x79, + 0x65, 0x73, 0x5A, 0x52, 0x77, 0x32, 0x20, 0x62, 0x61, 0x31, 0x63, 0x39, + 0x61, 0x35, 0x61, 0x38, 0x32, 0x35, 0x36, 0x61, 0x36, 0x65, 0x66, 0x33, + 0x65, 0x36, 0x36, 0x33, 0x63, 0x63, 0x37, 0x33, 0x31, 0x36, 0x38, 0x30, + 0x33, 0x64, 0x39, 0x32, 0x16, 0x7A, 0x6A, 0x32, 0x51, 0x75, 0x43, 0x52, + 0x61, 0x70, 0x75, 0x6E, 0x30, 0x32, 0x73, 0x79, 0x68, 0x6C, 0x41, 0x48, + 0x71, 0x54, 0x77, 0x32, 0x0D, 0x65, 0x62, 0x70, 0x66, 0x2D, 0x70, 0x72, + 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x72, 0x32, 0x16, 0x36, 0x34, 0x41, 0x49, + 0x75, 0x76, 0x39, 0x69, 0x70, 0x47, 0x42, 0x41, 0x41, 0x64, 0x30, 0x52, + 0x5A, 0x6D, 0x76, 0x4C, 0x4C, 0x77, 0x32, 0x0A, 0x63, 0x6F, 0x6E, 0x74, + 0x61, 0x69, 0x6E, 0x65, 0x72, 0x64, 0x32, 0x13, 0x5F, 0x5F, 0x63, 0x68, + 0x65, 0x63, 0x6B, 0x5F, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x5F, 0x73, + 0x69, 0x7A, 0x65, 0x32, 0x11, 0x6F, 0x62, 0x6A, 0x5F, 0x63, 0x67, 0x72, + 0x6F, 0x75, 0x70, 0x5F, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x32, 0x0D, + 0x5F, 0x5F, 0x73, 0x6F, 0x63, 0x6B, 0x5F, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x32, 0x07, 0x65, 0x6C, 0x30, 0x5F, 0x73, 0x76, 0x63, 0x32, 0x0C, + 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x31, + 0x32, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6C, 0x65, 0x32, 0x10, + 0x62, 0x70, 0x66, 0x5F, 0x6D, 0x61, 0x70, 0x5F, 0x64, 0x6F, 0x5F, 0x62, + 0x61, 0x74, 0x63, 0x68, 0x32, 0x0E, 0x69, 0x6E, 0x76, 0x6F, 0x6B, 0x65, + 0x5F, 0x73, 0x79, 0x73, 0x63, 0x61, 0x6C, 0x6C, 0x32, 0x10, 0x6B, 0x6D, + 0x65, 0x6D, 0x5F, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5F, 0x61, 0x6C, 0x6C, + 0x6F, 0x63, 0x32, 0x09, 0x5F, 0x5F, 0x73, 0x79, 0x73, 0x5F, 0x62, 0x70, + 0x66, 0x32, 0x0F, 0x5F, 0x5F, 0x61, 0x72, 0x6D, 0x36, 0x34, 0x5F, 0x73, + 0x79, 0x73, 0x5F, 0x62, 0x70, 0x66, 0x32, 0x0A, 0x64, 0x6F, 0x5F, 0x65, + 0x6C, 0x30, 0x5F, 0x73, 0x76, 0x63, 0x32, 0x19, 0x70, 0x72, 0x6F, 0x70, + 0x61, 0x67, 0x61, 0x74, 0x65, 0x5F, 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, + 0x74, 0x65, 0x64, 0x5F, 0x75, 0x73, 0x61, 0x67, 0x65, 0x32, 0x19, 0x66, + 0x69, 0x6E, 0x69, 0x73, 0x68, 0x5F, 0x74, 0x61, 0x73, 0x6B, 0x5F, 0x73, + 0x77, 0x69, 0x74, 0x63, 0x68, 0x2E, 0x69, 0x73, 0x72, 0x61, 0x2E, 0x30, + 0x32, 0x07, 0x6B, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x32, 0x13, 0x5F, + 0x5F, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x5F, 0x68, 0x65, 0x61, 0x70, 0x5F, + 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x32, 0x14, 0x65, 0x6C, 0x30, 0x74, + 0x5F, 0x36, 0x34, 0x5F, 0x73, 0x79, 0x6E, 0x63, 0x5F, 0x68, 0x61, 0x6E, + 0x64, 0x6C, 0x65, 0x72, 0x32, 0x0B, 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x32, 0x12, 0x5F, 0x5F, 0x61, 0x72, 0x6D, + 0x36, 0x34, 0x5F, 0x73, 0x79, 0x73, 0x5F, 0x73, 0x6F, 0x63, 0x6B, 0x65, + 0x74, 0x32, 0x0C, 0x65, 0x6C, 0x30, 0x74, 0x5F, 0x36, 0x34, 0x5F, 0x73, + 0x79, 0x6E, 0x63, 0x32, 0x0D, 0x73, 0x6B, 0x5F, 0x70, 0x72, 0x6F, 0x74, + 0x5F, 0x61, 0x6C, 0x6C, 0x6F, 0x63, 0x32, 0x0C, 0x5F, 0x5F, 0x73, 0x79, + 0x73, 0x5F, 0x73, 0x6F, 0x63, 0x6B, 0x65, 0x74, 0x32, 0x0D, 0x72, 0x65, + 0x74, 0x5F, 0x66, 0x72, 0x6F, 0x6D, 0x5F, 0x66, 0x6F, 0x72, 0x6B, 0x32, + 0x1A, 0x65, 0x6C, 0x30, 0x5F, 0x73, 0x76, 0x63, 0x5F, 0x63, 0x6F, 0x6D, + 0x6D, 0x6F, 0x6E, 0x2E, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x70, 0x72, 0x6F, + 0x70, 0x2E, 0x30, 0x32, 0x08, 0x73, 0x6B, 0x5F, 0x61, 0x6C, 0x6C, 0x6F, + 0x63, 0x32, 0x0D, 0x77, 0x6F, 0x72, 0x6B, 0x65, 0x72, 0x5F, 0x74, 0x68, + 0x72, 0x65, 0x61, 0x64, 0x32, 0x1A, 0x5F, 0x5F, 0x63, 0x68, 0x65, 0x63, + 0x6B, 0x5F, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x5F, 0x73, 0x69, 0x7A, + 0x65, 0x2E, 0x70, 0x61, 0x72, 0x74, 0x2E, 0x30, 0x32, 0x18, 0x67, 0x65, + 0x6E, 0x65, 0x72, 0x69, 0x63, 0x5F, 0x6D, 0x61, 0x70, 0x5F, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x5F, 0x62, 0x61, 0x74, 0x63, 0x68, 0x32, 0x10, + 0x74, 0x72, 0x79, 0x5F, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x5F, 0x6D, + 0x65, 0x6D, 0x63, 0x67, 0x48, 0xE9, 0xF2, 0xB0, 0xE5, 0xB2, 0xEA, 0xB1, + 0x82, 0x18, 0x5A, 0x04, 0x08, 0x03, 0x10, 0x04, 0x60, 0x80, 0xE1, 0xEB, + 0x17, 0x7A, 0x25, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, + 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, + 0x21, 0x22, 0x23, 0x24, 0x82, 0x01, 0x1E, 0x0A, 0x12, 0x70, 0x72, 0x6F, + 0x66, 0x69, 0x6C, 0x65, 0x2E, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x2E, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x08, 0x0A, 0x06, 0x6B, 0x65, 0x72, 0x6E, 0x65, + 0x6C, 0x82, 0x01, 0x13, 0x0A, 0x0C, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, + 0x6E, 0x65, 0x72, 0x2E, 0x69, 0x64, 0x12, 0x03, 0x0A, 0x01, 0x2F, 0x82, + 0x01, 0x1C, 0x0A, 0x0B, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2E, 0x6E, + 0x61, 0x6D, 0x65, 0x12, 0x0D, 0x0A, 0x0B, 0x6B, 0x77, 0x6F, 0x72, 0x6B, + 0x65, 0x72, 0x2F, 0x36, 0x3A, 0x31, 0x82, 0x01, 0x1E, 0x0A, 0x12, 0x70, + 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x2E, 0x66, 0x72, 0x61, 0x6D, 0x65, + 0x2E, 0x74, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0A, 0x06, 0x6E, 0x61, 0x74, + 0x69, 0x76, 0x65, 0x82, 0x01, 0x4D, 0x0A, 0x1F, 0x70, 0x72, 0x6F, 0x63, + 0x65, 0x73, 0x73, 0x2E, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, + 0x6C, 0x65, 0x2E, 0x62, 0x75, 0x69, 0x6C, 0x64, 0x5F, 0x69, 0x64, 0x2E, + 0x67, 0x6E, 0x75, 0x12, 0x2A, 0x0A, 0x28, 0x33, 0x34, 0x31, 0x39, 0x61, + 0x33, 0x65, 0x66, 0x30, 0x30, 0x31, 0x35, 0x34, 0x35, 0x64, 0x38, 0x65, + 0x65, 0x39, 0x66, 0x63, 0x64, 0x34, 0x62, 0x31, 0x38, 0x64, 0x34, 0x63, + 0x65, 0x31, 0x37, 0x32, 0x30, 0x35, 0x37, 0x65, 0x33, 0x33, 0x39, 0x82, + 0x01, 0x4B, 0x0A, 0x25, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x2E, 0x62, + 0x75, 0x69, 0x6C, 0x64, 0x5F, 0x69, 0x64, 0x2E, 0x70, 0x72, 0x6F, 0x66, + 0x69, 0x6C, 0x69, 0x6E, 0x67, 0x12, 0x22, 0x0A, 0x20, 0x37, 0x30, 0x35, + 0x62, 0x64, 0x66, 0x31, 0x34, 0x39, 0x38, 0x30, 0x66, 0x32, 0x63, 0x32, + 0x32, 0x64, 0x63, 0x34, 0x64, 0x65, 0x32, 0x65, 0x36, 0x35, 0x37, 0x36, + 0x65, 0x64, 0x66, 0x66, 0x38, 0x82, 0x01, 0x3C, 0x0A, 0x0C, 0x63, 0x6F, + 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x2E, 0x69, 0x64, 0x12, 0x2C, + 0x0A, 0x2A, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2E, 0x73, 0x6C, 0x69, 0x63, + 0x65, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2D, 0x35, 0x30, 0x31, 0x2E, 0x73, + 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6F, 0x6E, + 0x2D, 0x32, 0x2E, 0x73, 0x63, 0x6F, 0x70, 0x65, 0x82, 0x01, 0x1E, 0x0A, + 0x0B, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, + 0x12, 0x0F, 0x0A, 0x0D, 0x65, 0x62, 0x70, 0x66, 0x2D, 0x70, 0x72, 0x6F, + 0x66, 0x69, 0x6C, 0x65, 0x72, 0x82, 0x01, 0x4B, 0x0A, 0x25, 0x70, 0x72, + 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x61, 0x62, 0x6C, 0x65, 0x2E, 0x62, 0x75, 0x69, 0x6C, 0x64, 0x5F, 0x69, + 0x64, 0x2E, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x69, 0x6E, 0x67, 0x12, + 0x22, 0x0A, 0x20, 0x64, 0x37, 0x38, 0x30, 0x31, 0x36, 0x30, 0x34, 0x65, + 0x38, 0x62, 0x38, 0x39, 0x64, 0x64, 0x61, 0x63, 0x66, 0x65, 0x31, 0x39, + 0x38, 0x39, 0x39, 0x64, 0x36, 0x62, 0x61, 0x33, 0x35, 0x36, 0x34, 0x82, + 0x01, 0x5A, 0x0A, 0x0C, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, + 0x72, 0x2E, 0x69, 0x64, 0x12, 0x4A, 0x0A, 0x48, 0x2F, 0x75, 0x73, 0x65, + 0x72, 0x2E, 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x75, 0x73, 0x65, 0x72, + 0x2D, 0x35, 0x30, 0x31, 0x2E, 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x75, + 0x73, 0x65, 0x72, 0x40, 0x35, 0x30, 0x31, 0x2E, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2F, 0x61, 0x70, 0x70, 0x2E, 0x73, 0x6C, 0x69, 0x63, + 0x65, 0x2F, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x64, + 0x2E, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x82, 0x01, 0x1B, 0x0A, + 0x0B, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, + 0x12, 0x0C, 0x0A, 0x0A, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, + 0x72, 0x64 +}; + +static void test_encoder() { - int i; - int sample_index = 0; - uint64_t location_idx; - char *tmp; - struct cfl_list *head; - struct cfl_list *type_head; - struct cprof_sample *sample; - struct cprof_value_type *sample_type; - - printf("\n"); - printf("--- profile debug\n"); - printf("Profile Duration: %" PRId64 " nanoseconds\n\n", profile->duration_nanos); - printf("Samples:\n"); - - cfl_list_foreach(head, &profile->samples) { - sample = cfl_list_entry(head, struct cprof_sample, _head); - - printf(" Sample #%d:\n", ++sample_index); - - printf(" Locations:\n"); - for (i = 0; i < sample->location_index_count; ++i) { - location_idx = sample->location_index[i]; - tmp = profile->string_table[location_idx]; - if (tmp[0] == '\0') { - printf(" [Empty String: No Function Name]\n"); - } else { - printf(" Function: %s\n", tmp); - } - } + cfl_sds_t otlp_encoder_result; + struct cprof *context; + int result; + size_t offset; - printf(" Values:\n"); - size_t value_index = 0; - cfl_list_foreach(type_head, &profile->sample_type) { - sample_type = cfl_list_entry(type_head, struct cprof_value_type, _head); - if (value_index < sample->value_count) { - printf(" %s: %" PRId64 " %s\n", - profile->string_table[sample_type->type], - sample->values[value_index], - profile->string_table[sample_type->unit]); - } - value_index++; - } + offset = 0; + context = NULL; + + result = cprof_decode_opentelemetry_create(&context, + serialized_data, + sizeof(serialized_data), + &offset); + + TEST_CHECK(result == CPROF_DECODE_OPENTELEMETRY_SUCCESS); + + if (result == CPROF_DECODE_OPENTELEMETRY_SUCCESS) { + result = cprof_encode_opentelemetry_create(&otlp_encoder_result, context); - if (sample->timestamps_count > 0) { - printf(" Timestamps:\n"); - for (size_t i = 0; i < sample->timestamps_count; ++i) { - printf(" Timestamp %zu: %" PRIu64 " ns\n", i, sample->timestamps_unix_nano[i]); - } - } else { - printf(" [No Timestamps]\n"); + TEST_CHECK(result == CPROF_ENCODE_OPENTELEMETRY_SUCCESS); + + if (result == CPROF_ENCODE_OPENTELEMETRY_SUCCESS) { + cprof_encode_opentelemetry_destroy(otlp_encoder_result); } - printf("\n"); // Add space between samples for readability - } - printf("String Table:\n"); - for (i = 0; i < profile->string_table_count; i++) { - printf(" %d: '%s'\n", i, profile->string_table[i]); + cprof_decode_opentelemetry_destroy(context); } - printf("\n"); } -/* a basic test */ static void test_decoder() { - cfl_sds_t text_result; struct cprof *context; int result; size_t offset; @@ -176,33 +331,20 @@ static void test_decoder() offset = 0; context = NULL; - printf("TEST CASE\n"); - result = cprof_decode_opentelemetry_create(&context, - encoded_packet, - sizeof(encoded_packet), - &offset); - - if (result == CPROF_DECODE_OPENTELEMETRY_SUCCESS) { - result = cprof_encode_text_create(&text_result, context); - - if (result != CPROF_ENCODE_TEXT_SUCCESS) { - printf("TEXT ENCODING FAILED WITH ERROR : %d\n", result); - } - else { - printf("\n\n\n%s\n\n\n", text_result); - /* cprof_encode_text_destroy(text_result); */ - } - + serialized_data, + sizeof(serialized_data), + &offset); + TEST_CHECK(result == CPROF_DECODE_OPENTELEMETRY_SUCCESS); + if (result == CPROF_DECODE_OPENTELEMETRY_SUCCESS) { cprof_decode_opentelemetry_destroy(context); } } TEST_LIST = { + {"encoder", test_encoder}, {"decoder", test_decoder}, { 0 } }; - - diff --git a/lib/cprofiles/tests/profile.c b/lib/cprofiles/tests/profile.c index a983bf8b0c3..fcc22c460f5 100644 --- a/lib/cprofiles/tests/profile.c +++ b/lib/cprofiles/tests/profile.c @@ -35,7 +35,6 @@ void print_profile(struct cprof_profile *profile) struct cfl_list *type_head; struct cprof_sample *sample; struct cprof_value_type *sample_type; - size_t value_index = 0; printf("\n"); printf("--- profile debug\n"); @@ -59,6 +58,7 @@ void print_profile(struct cprof_profile *profile) } printf(" Values:\n"); + size_t value_index = 0; cfl_list_foreach(type_head, &profile->sample_type) { sample_type = cfl_list_entry(type_head, struct cprof_value_type, _head); if (value_index < sample->value_count) { @@ -73,7 +73,7 @@ void print_profile(struct cprof_profile *profile) if (sample->timestamps_count > 0) { printf(" Timestamps:\n"); for (i = 0; i < sample->timestamps_count; ++i) { - printf(" Timestamp %zu: %" PRIu64 " ns\n", i, sample->timestamps_unix_nano[i]); + printf(" Timestamp %d: %" PRIu64 " ns\n", i, sample->timestamps_unix_nano[i]); } } else { printf(" [No Timestamps]\n"); @@ -108,7 +108,7 @@ static void test_profile() TEST_CHECK(cprof != NULL); /* create profile */ - profile = cprof_profile_create(cprof); + profile = cprof_profile_create(); TEST_CHECK(profile != NULL); cprof_sample_type_str_create(profile, "CPU time", "ns", CPROF_AGGREGATION_TEMPORALITY_CUMULATIVE); @@ -154,6 +154,8 @@ static void test_profile() print_profile(profile); + cprof_profile_destroy(profile); + /* destroy context */ cprof_destroy(cprof); } diff --git a/lib/cprofiles/tests/text_transcoder.c b/lib/cprofiles/tests/text_transcoder.c new file mode 100644 index 00000000000..32aa074a1ce --- /dev/null +++ b/lib/cprofiles/tests/text_transcoder.c @@ -0,0 +1,660 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CProfiles + * ========= + * Copyright (C) 2024 The CProfiles Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "cprof_tests.h" +#include +#include + +#include +#include +#include + +unsigned char serialized_data[] = { + 0x82, 0xA4, 0x6D, 0x65, 0x74, 0x61, 0x80, 0xA8, 0x70, 0x72, 0x6F, 0x66, + 0x69, 0x6C, 0x65, 0x73, 0x91, 0x83, 0xA8, 0x72, 0x65, 0x73, 0x6F, 0x75, + 0x72, 0x63, 0x65, 0x82, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x85, 0xA7, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x69, 0x64, + 0xA1, 0x30, 0xA7, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x69, 0x70, 0xA9, 0x31, + 0x32, 0x37, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0xA9, 0x68, 0x6F, 0x73, + 0x74, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0xAC, 0x6C, 0x69, 0x6D, 0x61, 0x2D, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0xAF, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2E, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0xA0, + 0xA9, 0x6F, 0x73, 0x2E, 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0xA5, 0x36, + 0x2E, 0x35, 0x2E, 0x30, 0xB7, 0x64, 0x72, 0x6F, 0x70, 0x70, 0x65, 0x64, + 0x5F, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5F, 0x63, + 0x6F, 0x75, 0x6E, 0x74, 0x00, 0xAE, 0x73, 0x63, 0x6F, 0x70, 0x65, 0x5F, + 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x91, 0x83, 0xB5, 0x69, + 0x6E, 0x73, 0x74, 0x72, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x74, 0x69, + 0x6F, 0x6E, 0x5F, 0x73, 0x63, 0x6F, 0x70, 0x65, 0x84, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0xA0, 0xA7, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0xA0, + 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x80, + 0xB7, 0x64, 0x72, 0x6F, 0x70, 0x70, 0x65, 0x64, 0x5F, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5F, 0x63, 0x6F, 0x75, 0x6E, 0x74, + 0x00, 0xA8, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x91, 0xDE, + 0x00, 0x17, 0xAA, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x5F, 0x69, + 0x64, 0xC4, 0x10, 0xA4, 0x58, 0x33, 0xE6, 0x18, 0xE6, 0x34, 0x8D, 0xD6, + 0xFE, 0x00, 0x58, 0x56, 0xF5, 0xA7, 0x54, 0xB4, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5F, 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x75, 0x6E, 0x69, 0x78, 0x5F, + 0x6E, 0x61, 0x6E, 0x6F, 0xCF, 0x18, 0x04, 0xC7, 0x53, 0x2C, 0xAC, 0x39, + 0x69, 0xB2, 0x65, 0x6E, 0x64, 0x5F, 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x75, + 0x6E, 0x69, 0x78, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0xCF, 0x18, 0x04, 0xC7, + 0x53, 0x2C, 0xAC, 0x39, 0x69, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x80, 0xB2, 0x64, 0x72, 0x6F, 0x70, 0x70, 0x65, + 0x64, 0x5F, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x00, 0xAC, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x5F, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x91, 0x83, 0xA4, 0x74, 0x79, 0x70, 0x65, 0x01, 0xA4, 0x75, + 0x6E, 0x69, 0x74, 0x02, 0xB7, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x74, 0x65, 0x6D, 0x70, 0x6F, 0x72, 0x61, + 0x6C, 0x69, 0x74, 0x79, 0x00, 0xA6, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, + 0x93, 0x87, 0xAE, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x90, 0xB5, 0x6C, 0x6F, 0x63, 0x61, 0x74, + 0x69, 0x6F, 0x6E, 0x73, 0x5F, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x00, 0xB0, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, + 0x6F, 0x6E, 0x73, 0x5F, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x05, 0xA6, + 0x76, 0x61, 0x6C, 0x75, 0x65, 0x73, 0x91, 0x01, 0xAA, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x92, 0x01, 0x02, 0xA4, 0x6C, + 0x69, 0x6E, 0x6B, 0x00, 0xB4, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x74, 0x61, + 0x6D, 0x70, 0x73, 0x5F, 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x6E, 0x61, 0x6E, + 0x6F, 0x91, 0xCF, 0x18, 0x04, 0xC7, 0x52, 0xCA, 0x52, 0xB5, 0x76, 0x87, + 0xAE, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x90, 0xB5, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, + 0x6E, 0x73, 0x5F, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x69, 0x6E, 0x64, + 0x65, 0x78, 0x05, 0xB0, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, + 0x73, 0x5F, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x0E, 0xA6, 0x76, 0x61, + 0x6C, 0x75, 0x65, 0x73, 0x91, 0x01, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x92, 0x06, 0x07, 0xA4, 0x6C, 0x69, 0x6E, + 0x6B, 0x00, 0xB4, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x74, 0x61, 0x6D, 0x70, + 0x73, 0x5F, 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0x91, + 0xCF, 0x18, 0x04, 0xC7, 0x53, 0x11, 0xD8, 0xE9, 0xA8, 0x87, 0xAE, 0x6C, + 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, + 0x78, 0x90, 0xB5, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, + 0x5F, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, + 0x13, 0xB0, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x5F, + 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x12, 0xA6, 0x76, 0x61, 0x6C, 0x75, + 0x65, 0x73, 0x91, 0x01, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x92, 0x09, 0x0A, 0xA4, 0x6C, 0x69, 0x6E, 0x6B, 0x00, + 0xB4, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x74, 0x61, 0x6D, 0x70, 0x73, 0x5F, + 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0x91, 0xCF, 0x18, + 0x04, 0xC7, 0x53, 0x2C, 0xAC, 0x39, 0x69, 0xA8, 0x6D, 0x61, 0x70, 0x70, + 0x69, 0x6E, 0x67, 0x73, 0x93, 0x8A, 0xA2, 0x69, 0x64, 0x00, 0xAC, 0x6D, + 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x5F, 0x73, 0x74, 0x61, 0x72, 0x74, 0x00, + 0xAC, 0x6D, 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x5F, 0x6C, 0x69, 0x6D, 0x69, + 0x74, 0x00, 0xAB, 0x66, 0x69, 0x6C, 0x65, 0x5F, 0x6F, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, + 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x90, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, + 0x6F, 0x6E, 0x73, 0x00, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xB0, 0x68, 0x61, 0x73, 0x5F, + 0x6C, 0x69, 0x6E, 0x65, 0x5F, 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, 0x73, + 0x00, 0xB1, 0x68, 0x61, 0x73, 0x5F, 0x69, 0x6E, 0x6C, 0x69, 0x6E, 0x65, + 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, 0x8A, 0xA2, 0x69, 0x64, + 0x00, 0xAC, 0x6D, 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x5F, 0x73, 0x74, 0x61, + 0x72, 0x74, 0xCE, 0x00, 0x40, 0x00, 0x00, 0xAC, 0x6D, 0x65, 0x6D, 0x6F, + 0x72, 0x79, 0x5F, 0x6C, 0x69, 0x6D, 0x69, 0x74, 0xCE, 0x01, 0x1D, 0x00, + 0x00, 0xAB, 0x66, 0x69, 0x6C, 0x65, 0x5F, 0x6F, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x08, + 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x92, + 0x04, 0x05, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, + 0x69, 0x6F, 0x6E, 0x73, 0x00, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x69, + 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xB0, 0x68, 0x61, 0x73, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x5F, 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, + 0x73, 0x00, 0xB1, 0x68, 0x61, 0x73, 0x5F, 0x69, 0x6E, 0x6C, 0x69, 0x6E, + 0x65, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, 0x8A, 0xA2, 0x69, + 0x64, 0x00, 0xAC, 0x6D, 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x5F, 0x73, 0x74, + 0x61, 0x72, 0x74, 0xCE, 0x00, 0x01, 0x00, 0x00, 0xAC, 0x6D, 0x65, 0x6D, + 0x6F, 0x72, 0x79, 0x5F, 0x6C, 0x69, 0x6D, 0x69, 0x74, 0xCE, 0x00, 0xFE, + 0xE0, 0x00, 0xAB, 0x66, 0x69, 0x6C, 0x65, 0x5F, 0x6F, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, + 0x0A, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x91, 0x08, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, + 0x69, 0x6F, 0x6E, 0x73, 0x00, 0xAD, 0x68, 0x61, 0x73, 0x5F, 0x66, 0x69, + 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xB0, 0x68, 0x61, 0x73, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x5F, 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, + 0x73, 0x00, 0xB1, 0x68, 0x61, 0x73, 0x5F, 0x69, 0x6E, 0x6C, 0x69, 0x6E, + 0x65, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xA9, 0x6C, 0x6F, + 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0xDC, 0x00, 0x25, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCE, 0x00, 0x10, 0xE0, 0xDB, 0xA5, 0x6C, 0x69, 0x6E, 0x65, + 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x01, 0xA4, 0x6C, 0x69, 0x6E, 0x65, + 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCE, 0x01, 0x54, 0x85, 0xC7, 0xA5, 0x6C, 0x69, 0x6E, 0x65, + 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x02, 0xA4, 0x6C, 0x69, 0x6E, 0x65, + 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCE, 0x00, 0x0E, 0x8A, 0x37, 0xA5, 0x6C, 0x69, 0x6E, 0x65, + 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x03, 0xA4, 0x6C, 0x69, 0x6E, 0x65, + 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCE, 0x00, 0x0F, 0x4B, 0x77, 0xA5, 0x6C, 0x69, 0x6E, 0x65, + 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x04, 0xA4, 0x6C, 0x69, 0x6E, 0x65, + 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0xCD, 0x7D, 0x07, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x05, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x48, 0x6B, 0x43, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x06, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x4C, 0xDA, 0xBB, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x07, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x4C, 0xDB, 0xE7, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x08, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x2E, 0x6A, 0x93, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x09, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x2E, 0x06, 0x57, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0A, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x2E, 0x89, 0x97, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0B, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x2E, 0x94, 0x1F, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0C, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x02, 0x3D, 0x6B, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0D, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x02, 0x3F, 0x53, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0E, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x00, 0x02, 0x3F, 0xB7, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x0F, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x01, 0x53, 0xDE, 0xA7, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x10, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCE, 0x01, 0x53, 0xE5, 0x4F, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, + 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x11, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, + 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, + 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xCD, 0x1E, 0x47, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x91, 0x83, 0xAE, + 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, 0x6E, 0x64, + 0x65, 0x78, 0x12, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0xA6, 0x63, 0x6F, + 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xAD, + 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, 0x6E, 0x64, 0x65, + 0x78, 0x01, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0xCE, 0x00, + 0x40, 0x53, 0x1F, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, 0x90, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x03, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x4A, 0x66, 0x9F, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x13, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x4B, 0x2F, 0xC3, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x14, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x4B, 0x4F, 0xB3, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x15, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x48, 0x30, 0x9B, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x16, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0xB4, 0x4B, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x17, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0xF1, 0xEB, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x18, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x3F, 0x97, 0x7B, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x19, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x3F, 0x98, 0x67, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x1A, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0x48, 0x6F, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x1B, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0x79, 0xF7, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x1C, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x21, 0x7A, 0xCB, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x1D, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x02, 0x3D, 0x6B, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x0D, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x02, 0x3F, 0x53, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x0E, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x00, 0x02, 0x3F, 0xB7, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x0F, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x53, 0xDE, 0xA7, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x10, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCE, 0x01, 0x53, 0xE5, 0x4F, 0xA5, 0x6C, 0x69, 0x6E, + 0x65, 0x73, 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x11, 0xA4, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, + 0xA2, 0x69, 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, + 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0xA7, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0xCD, 0x1E, 0x47, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, + 0x91, 0x83, 0xAE, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, + 0x69, 0x6E, 0x64, 0x65, 0x78, 0x12, 0xA4, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0xA6, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x00, 0xAA, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x91, 0x00, 0x85, 0xA2, 0x69, + 0x64, 0x00, 0xAD, 0x6D, 0x61, 0x70, 0x70, 0x69, 0x6E, 0x67, 0x5F, 0x69, + 0x6E, 0x64, 0x65, 0x78, 0x02, 0xA7, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0xCE, 0x00, 0x01, 0x5F, 0xAF, 0xA5, 0x6C, 0x69, 0x6E, 0x65, 0x73, + 0x90, 0xAA, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x91, 0x03, 0xB0, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, + 0x69, 0x6E, 0x64, 0x69, 0x63, 0x65, 0x73, 0xDC, 0x00, 0x25, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, + 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0xA9, + 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0xDC, 0x00, 0x1E, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x18, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x10, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x24, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x19, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x21, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x1A, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x25, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x0B, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x26, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x11, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x14, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x15, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x12, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x22, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x16, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x0E, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x1B, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x1E, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x17, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x27, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x0C, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x13, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x1F, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x23, 0xAB, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, + 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x0F, 0xAB, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, + 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, + 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, 0x1C, 0xAB, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, + 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, + 0x6E, 0x61, 0x6D, 0x65, 0x0D, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, + 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, + 0x69, 0x6E, 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, + 0x6D, 0x65, 0x20, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, + 0x61, 0x6D, 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, + 0x65, 0x00, 0x85, 0xA2, 0x69, 0x64, 0x00, 0xA4, 0x6E, 0x61, 0x6D, 0x65, + 0x1D, 0xAB, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x6E, 0x61, 0x6D, + 0x65, 0x00, 0xA8, 0x66, 0x69, 0x6C, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0xAA, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5F, 0x6C, 0x69, 0x6E, 0x65, 0x00, + 0xAF, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5F, 0x74, + 0x61, 0x62, 0x6C, 0x65, 0x8B, 0xB2, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, + 0x65, 0x2E, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x2E, 0x74, 0x79, 0x70, 0x65, + 0xA6, 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0xAC, 0x63, 0x6F, 0x6E, 0x74, + 0x61, 0x69, 0x6E, 0x65, 0x72, 0x2E, 0x69, 0x64, 0xA1, 0x2F, 0xAB, 0x74, + 0x68, 0x72, 0x65, 0x61, 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0xAB, 0x6B, + 0x77, 0x6F, 0x72, 0x6B, 0x65, 0x72, 0x2F, 0x36, 0x3A, 0x31, 0xB2, 0x70, + 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x2E, 0x66, 0x72, 0x61, 0x6D, 0x65, + 0x2E, 0x74, 0x79, 0x70, 0x65, 0xA6, 0x6E, 0x61, 0x74, 0x69, 0x76, 0x65, + 0xBF, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E, 0x65, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x2E, 0x62, 0x75, 0x69, 0x6C, + 0x64, 0x5F, 0x69, 0x64, 0x2E, 0x67, 0x6E, 0x75, 0xD9, 0x28, 0x33, 0x34, + 0x31, 0x39, 0x61, 0x33, 0x65, 0x66, 0x30, 0x30, 0x31, 0x35, 0x34, 0x35, + 0x64, 0x38, 0x65, 0x65, 0x39, 0x66, 0x63, 0x64, 0x34, 0x62, 0x31, 0x38, + 0x64, 0x34, 0x63, 0x65, 0x31, 0x37, 0x32, 0x30, 0x35, 0x37, 0x65, 0x33, + 0x33, 0x39, 0xD9, 0x25, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x2E, 0x62, + 0x75, 0x69, 0x6C, 0x64, 0x5F, 0x69, 0x64, 0x2E, 0x70, 0x72, 0x6F, 0x66, + 0x69, 0x6C, 0x69, 0x6E, 0x67, 0xD9, 0x20, 0x37, 0x30, 0x35, 0x62, 0x64, + 0x66, 0x31, 0x34, 0x39, 0x38, 0x30, 0x66, 0x32, 0x63, 0x32, 0x32, 0x64, + 0x63, 0x34, 0x64, 0x65, 0x32, 0x65, 0x36, 0x35, 0x37, 0x36, 0x65, 0x64, + 0x66, 0x66, 0x38, 0xAC, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, + 0x72, 0x2E, 0x69, 0x64, 0xD9, 0x2A, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2E, + 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2D, 0x35, + 0x30, 0x31, 0x2E, 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6F, 0x6E, 0x2D, 0x32, 0x2E, 0x73, 0x63, 0x6F, 0x70, 0x65, + 0xAB, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, + 0xAD, 0x65, 0x62, 0x70, 0x66, 0x2D, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, + 0x65, 0x72, 0xD9, 0x25, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x2E, 0x62, + 0x75, 0x69, 0x6C, 0x64, 0x5F, 0x69, 0x64, 0x2E, 0x70, 0x72, 0x6F, 0x66, + 0x69, 0x6C, 0x69, 0x6E, 0x67, 0xD9, 0x20, 0x64, 0x37, 0x38, 0x30, 0x31, + 0x36, 0x30, 0x34, 0x65, 0x38, 0x62, 0x38, 0x39, 0x64, 0x64, 0x61, 0x63, + 0x66, 0x65, 0x31, 0x39, 0x38, 0x39, 0x39, 0x64, 0x36, 0x62, 0x61, 0x33, + 0x35, 0x36, 0x34, 0xAC, 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, + 0x72, 0x2E, 0x69, 0x64, 0xD9, 0x48, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2E, + 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x75, 0x73, 0x65, 0x72, 0x2D, 0x35, + 0x30, 0x31, 0x2E, 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, 0x75, 0x73, 0x65, + 0x72, 0x40, 0x35, 0x30, 0x31, 0x2E, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2F, 0x61, 0x70, 0x70, 0x2E, 0x73, 0x6C, 0x69, 0x63, 0x65, 0x2F, + 0x63, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x64, 0x2E, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xAB, 0x74, 0x68, 0x72, 0x65, 0x61, + 0x64, 0x2E, 0x6E, 0x61, 0x6D, 0x65, 0xAA, 0x63, 0x6F, 0x6E, 0x74, 0x61, + 0x69, 0x6E, 0x65, 0x72, 0x64, 0xAF, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x5F, 0x75, 0x6E, 0x69, 0x74, 0x73, 0x90, 0xAA, 0x6C, + 0x69, 0x6E, 0x6B, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x90, 0xAC, 0x73, + 0x74, 0x72, 0x69, 0x6E, 0x67, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0xDC, + 0x00, 0x28, 0xA0, 0xA7, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x73, 0xA5, + 0x63, 0x6F, 0x75, 0x6E, 0x74, 0xA3, 0x63, 0x70, 0x75, 0xAB, 0x6E, 0x61, + 0x6E, 0x6F, 0x73, 0x65, 0x63, 0x6F, 0x6E, 0x64, 0x73, 0xB6, 0x41, 0x54, + 0x73, 0x51, 0x46, 0x31, 0x72, 0x72, 0x49, 0x63, 0x30, 0x35, 0x74, 0x65, + 0x6A, 0x66, 0x79, 0x65, 0x73, 0x5A, 0x52, 0x77, 0xD9, 0x20, 0x62, 0x61, + 0x31, 0x63, 0x39, 0x61, 0x35, 0x61, 0x38, 0x32, 0x35, 0x36, 0x61, 0x36, + 0x65, 0x66, 0x33, 0x65, 0x36, 0x36, 0x33, 0x63, 0x63, 0x37, 0x33, 0x31, + 0x36, 0x38, 0x30, 0x33, 0x64, 0x39, 0xB6, 0x7A, 0x6A, 0x32, 0x51, 0x75, + 0x43, 0x52, 0x61, 0x70, 0x75, 0x6E, 0x30, 0x32, 0x73, 0x79, 0x68, 0x6C, + 0x41, 0x48, 0x71, 0x54, 0x77, 0xAD, 0x65, 0x62, 0x70, 0x66, 0x2D, 0x70, + 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x72, 0xB6, 0x36, 0x34, 0x41, 0x49, + 0x75, 0x76, 0x39, 0x69, 0x70, 0x47, 0x42, 0x41, 0x41, 0x64, 0x30, 0x52, + 0x5A, 0x6D, 0x76, 0x4C, 0x4C, 0x77, 0xAA, 0x63, 0x6F, 0x6E, 0x74, 0x61, + 0x69, 0x6E, 0x65, 0x72, 0x64, 0xB3, 0x5F, 0x5F, 0x63, 0x68, 0x65, 0x63, + 0x6B, 0x5F, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x5F, 0x73, 0x69, 0x7A, + 0x65, 0xB1, 0x6F, 0x62, 0x6A, 0x5F, 0x63, 0x67, 0x72, 0x6F, 0x75, 0x70, + 0x5F, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0xAD, 0x5F, 0x5F, 0x73, 0x6F, + 0x63, 0x6B, 0x5F, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0xA7, 0x65, 0x6C, + 0x30, 0x5F, 0x73, 0x76, 0x63, 0xAC, 0x75, 0x6E, 0x69, 0x78, 0x5F, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x31, 0xA8, 0x73, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6C, 0x65, 0xB0, 0x62, 0x70, 0x66, 0x5F, 0x6D, 0x61, 0x70, 0x5F, + 0x64, 0x6F, 0x5F, 0x62, 0x61, 0x74, 0x63, 0x68, 0xAE, 0x69, 0x6E, 0x76, + 0x6F, 0x6B, 0x65, 0x5F, 0x73, 0x79, 0x73, 0x63, 0x61, 0x6C, 0x6C, 0xB0, + 0x6B, 0x6D, 0x65, 0x6D, 0x5F, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5F, 0x61, + 0x6C, 0x6C, 0x6F, 0x63, 0xA9, 0x5F, 0x5F, 0x73, 0x79, 0x73, 0x5F, 0x62, + 0x70, 0x66, 0xAF, 0x5F, 0x5F, 0x61, 0x72, 0x6D, 0x36, 0x34, 0x5F, 0x73, + 0x79, 0x73, 0x5F, 0x62, 0x70, 0x66, 0xAA, 0x64, 0x6F, 0x5F, 0x65, 0x6C, + 0x30, 0x5F, 0x73, 0x76, 0x63, 0xB9, 0x70, 0x72, 0x6F, 0x70, 0x61, 0x67, + 0x61, 0x74, 0x65, 0x5F, 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x5F, 0x75, 0x73, 0x61, 0x67, 0x65, 0xB9, 0x66, 0x69, 0x6E, 0x69, + 0x73, 0x68, 0x5F, 0x74, 0x61, 0x73, 0x6B, 0x5F, 0x73, 0x77, 0x69, 0x74, + 0x63, 0x68, 0x2E, 0x69, 0x73, 0x72, 0x61, 0x2E, 0x30, 0xA7, 0x6B, 0x74, + 0x68, 0x72, 0x65, 0x61, 0x64, 0xB3, 0x5F, 0x5F, 0x63, 0x68, 0x65, 0x63, + 0x6B, 0x5F, 0x68, 0x65, 0x61, 0x70, 0x5F, 0x6F, 0x62, 0x6A, 0x65, 0x63, + 0x74, 0xB4, 0x65, 0x6C, 0x30, 0x74, 0x5F, 0x36, 0x34, 0x5F, 0x73, 0x79, + 0x6E, 0x63, 0x5F, 0x68, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x72, 0xAB, 0x75, + 0x6E, 0x69, 0x78, 0x5F, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0xB2, 0x5F, + 0x5F, 0x61, 0x72, 0x6D, 0x36, 0x34, 0x5F, 0x73, 0x79, 0x73, 0x5F, 0x73, + 0x6F, 0x63, 0x6B, 0x65, 0x74, 0xAC, 0x65, 0x6C, 0x30, 0x74, 0x5F, 0x36, + 0x34, 0x5F, 0x73, 0x79, 0x6E, 0x63, 0xAD, 0x73, 0x6B, 0x5F, 0x70, 0x72, + 0x6F, 0x74, 0x5F, 0x61, 0x6C, 0x6C, 0x6F, 0x63, 0xAC, 0x5F, 0x5F, 0x73, + 0x79, 0x73, 0x5F, 0x73, 0x6F, 0x63, 0x6B, 0x65, 0x74, 0xAD, 0x72, 0x65, + 0x74, 0x5F, 0x66, 0x72, 0x6F, 0x6D, 0x5F, 0x66, 0x6F, 0x72, 0x6B, 0xBA, + 0x65, 0x6C, 0x30, 0x5F, 0x73, 0x76, 0x63, 0x5F, 0x63, 0x6F, 0x6D, 0x6D, + 0x6F, 0x6E, 0x2E, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x70, 0x72, 0x6F, 0x70, + 0x2E, 0x30, 0xA8, 0x73, 0x6B, 0x5F, 0x61, 0x6C, 0x6C, 0x6F, 0x63, 0xAD, + 0x77, 0x6F, 0x72, 0x6B, 0x65, 0x72, 0x5F, 0x74, 0x68, 0x72, 0x65, 0x61, + 0x64, 0xBA, 0x5F, 0x5F, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x5F, 0x6F, 0x62, + 0x6A, 0x65, 0x63, 0x74, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x2E, 0x70, 0x61, + 0x72, 0x74, 0x2E, 0x30, 0xB8, 0x67, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, + 0x5F, 0x6D, 0x61, 0x70, 0x5F, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5F, + 0x62, 0x61, 0x74, 0x63, 0x68, 0xB0, 0x74, 0x72, 0x79, 0x5F, 0x63, 0x68, + 0x61, 0x72, 0x67, 0x65, 0x5F, 0x6D, 0x65, 0x6D, 0x63, 0x67, 0xAB, 0x64, + 0x72, 0x6F, 0x70, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, 0xAB, + 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x00, + 0xAA, 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0x73, 0xCF, + 0x18, 0x04, 0xC7, 0x53, 0x2C, 0xAC, 0x39, 0x69, 0xAE, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x6E, 0x61, 0x6E, 0x6F, 0x73, 0x00, + 0xAB, 0x70, 0x65, 0x72, 0x69, 0x6F, 0x64, 0x5F, 0x74, 0x79, 0x70, 0x65, + 0x83, 0xA4, 0x74, 0x79, 0x70, 0x65, 0x03, 0xA4, 0x75, 0x6E, 0x69, 0x74, + 0x04, 0xB7, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6F, + 0x6E, 0x5F, 0x74, 0x65, 0x6D, 0x70, 0x6F, 0x72, 0x61, 0x6C, 0x69, 0x74, + 0x79, 0x00, 0xA6, 0x70, 0x65, 0x72, 0x69, 0x6F, 0x64, 0xCE, 0x02, 0xFA, + 0xF0, 0x80, 0xA8, 0x63, 0x6F, 0x6D, 0x6D, 0x65, 0x6E, 0x74, 0x73, 0x90, + 0xB3, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x5F, 0x73, 0x61, 0x6D, + 0x70, 0x6C, 0x65, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x00, 0xAA, 0x73, 0x63, + 0x68, 0x65, 0x6D, 0x61, 0x5F, 0x75, 0x72, 0x6C, 0xA0, 0xAA, 0x73, 0x63, + 0x68, 0x65, 0x6D, 0x61, 0x5F, 0x75, 0x72, 0x6C, 0xA0 +}; + +static void test_encoder() +{ + cfl_sds_t text_encoder_result; + struct cprof *context; + int result; + size_t offset; + + offset = 0; + context = NULL; + + result = cprof_decode_msgpack_create(&context, + (unsigned char *) serialized_data, + sizeof(serialized_data), + &offset); + + TEST_CHECK(result == CPROF_DECODE_MSGPACK_SUCCESS); + TEST_CHECK(offset == sizeof(serialized_data)); + + if (result == CPROF_DECODE_MSGPACK_SUCCESS) { + result = cprof_encode_text_create(&text_encoder_result, context); + + TEST_CHECK(result == CPROF_ENCODE_TEXT_SUCCESS); + + if (result == CPROF_ENCODE_TEXT_SUCCESS) { + TEST_CHECK(cfl_sds_len(text_encoder_result) > 1); + + cprof_encode_text_destroy(text_encoder_result); + } + + cprof_decode_msgpack_destroy(context); + } +} + +TEST_LIST = { + {"encoder", test_encoder}, + { 0 } +};