mirror of https://github.com/lukechilds/node.git
Ryan Dahl
14 years ago
186 changed files with 131 additions and 96371 deletions
@ -1,37 +0,0 @@ |
|||||
c-ares is based on ares, and these are the people that have worked on it since |
|
||||
the fork was made: |
|
||||
|
|
||||
Alexander Lazic |
|
||||
Alexey Simak |
|
||||
Andreas Rieke |
|
||||
Ashish Sharma |
|
||||
Brad House |
|
||||
Brad Spencer |
|
||||
Bram Matthys |
|
||||
Dan Fandrich |
|
||||
Daniel Stenberg |
|
||||
Dirk Manske |
|
||||
Dominick Meglio |
|
||||
Doug Goldstein |
|
||||
Duncan Wilcox |
|
||||
Eino Tuominen |
|
||||
Erik Kline |
|
||||
George Neill |
|
||||
Gisle Vanem |
|
||||
Guilherme Balena Versiani |
|
||||
Gunter Knauf |
|
||||
Henrik Stoerner |
|
||||
James Bursa |
|
||||
Michael Wallner |
|
||||
Nick Mathewson |
|
||||
Phil Blundell |
|
||||
Ravi Pratap |
|
||||
Robin Cornelius |
|
||||
Sebastian at basti79.de |
|
||||
Shmulik Regev |
|
||||
Steinar H. Gunderson |
|
||||
Tofu Linden |
|
||||
Vlad Dinulescu |
|
||||
William Ahern |
|
||||
Yang Tse |
|
||||
liren at vivisimo.com |
|
File diff suppressed because it is too large
@ -1,22 +0,0 @@ |
|||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
|
||||
include_directories(${node_platform}-${cares_arch}) |
|
||||
add_definitions(-DHAVE_CONFIG_H=1) |
|
||||
|
|
||||
include(CheckLibraryExists) |
|
||||
check_library_exists(socket socket "" HAVE_SOCKET_LIB) |
|
||||
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIB) |
|
||||
|
|
||||
file(GLOB lib_sources *.c) |
|
||||
add_library(cares ${lib_sources}) |
|
||||
|
|
||||
if(${HAVE_SOCKET_LIB}) |
|
||||
set(cares_libs ${cares_libs} socket) |
|
||||
endif() |
|
||||
|
|
||||
if(${HAVE_NSL_LIB}) |
|
||||
set(cares_libs ${cares_libs} nsl) |
|
||||
endif() |
|
||||
|
|
||||
if(cares_libs) |
|
||||
target_link_libraries(cares ${cares_libs}) |
|
||||
endif() |
|
@ -1,21 +0,0 @@ |
|||||
Major changes since: |
|
||||
* see the CHANGES file |
|
||||
|
|
||||
Major changes in release 1.1.1: |
|
||||
* ares should now compile as C++ code (no longer uses reserved word |
|
||||
"class"). |
|
||||
* Added SRV support to adig test program. |
|
||||
* Fixed a few error handling bugs in query processing. |
|
||||
|
|
||||
Major changes in release 1.1.0: |
|
||||
* Added ares_free_string() function so that memory can be freed in the |
|
||||
same layer as it is allocated, a desirable feature in some |
|
||||
environments. |
|
||||
* A few of the ares_dns.h macros are fixed to use the proper bitwise |
|
||||
operator. |
|
||||
* Fixed a couple of fenceposts fixed in ares_expand_name()'s |
|
||||
bounds-checking. |
|
||||
* In process_timeouts(), extract query->next before calling |
|
||||
next_server() and possibly freeing the query structure. |
|
||||
* Casted arguments to ctype macros casted to unsigned char, since not |
|
||||
all char values are valid inputs to those macros according to ANSI. |
|
@ -1,60 +0,0 @@ |
|||||
c-ares |
|
||||
====== |
|
||||
|
|
||||
This is c-ares, an asynchronous resolver library. It is intended for |
|
||||
applications which need to perform DNS queries without blocking, or need to |
|
||||
perform multiple DNS queries in parallel. The primary examples of such |
|
||||
applications are servers which communicate with multiple clients and programs |
|
||||
with graphical user interfaces. |
|
||||
|
|
||||
The full source code is available in the 'c-ares' release archives, and in a |
|
||||
git repository: http://github.com/bagder/c-ares |
|
||||
|
|
||||
If you find bugs, correct flaws, have questions or have comments in general in |
|
||||
regard to c-ares (or by all means the original ares too), get in touch with us |
|
||||
on the c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares |
|
||||
|
|
||||
c-ares is of course distributed under the same MIT-style license as the |
|
||||
original ares. |
|
||||
|
|
||||
You'll find all c-ares details and news here: |
|
||||
|
|
||||
http://c-ares.haxx.se/ |
|
||||
|
|
||||
|
|
||||
NOTES FOR C-ARES HACKERS |
|
||||
|
|
||||
The following notes apply to c-ares version 1.7.0 and later. |
|
||||
|
|
||||
* The distributed ares_build.h file is only intended to be used on systems |
|
||||
which can not run the also distributed configure script. |
|
||||
|
|
||||
* The distributed ares_build.h file is generated as a copy of ares_build.h.dist |
|
||||
when the c-ares source code distribution archive file is originally created. |
|
||||
|
|
||||
* If you check out from git on a non-configure platform, you must run the |
|
||||
appropriate buildconf* script to set up ares_build.h and other local files |
|
||||
before being able of compiling the library. |
|
||||
|
|
||||
* On systems capable of running the configure script, the configure process |
|
||||
will overwrite the distributed ares_build.h file with one that is suitable |
|
||||
and specific to the library being configured and built, this new file is |
|
||||
generated from the ares_build.h.in template file. |
|
||||
|
|
||||
* If you intend to distribute an already compiled c-ares library you _MUST_ |
|
||||
also distribute along with it the generated ares_build.h which has been |
|
||||
used to compile it. Otherwise the library will be of no use for the users of |
|
||||
the library that you have built. It is _your_ responsibility to provide this |
|
||||
file. No one at the c-ares project can know how you have built the library. |
|
||||
|
|
||||
* File ares_build.h includes platform and configuration dependent info, |
|
||||
and must not be modified by anyone. Configure script generates it for you. |
|
||||
|
|
||||
* We cannot assume anything else but very basic compiler features being |
|
||||
present. While c-ares requires an ANSI C compiler to build, some of the |
|
||||
earlier ANSI compilers clearly can't deal with some preprocessor operators. |
|
||||
|
|
||||
* Newlines must remain unix-style for older compilers' sake. |
|
||||
|
|
||||
* Comments must be written in the old-style /* unnested C-fashion */ |
|
||||
|
|
@ -1,13 +0,0 @@ |
|||||
c-ares |
|
||||
====== |
|
||||
|
|
||||
This package is based on ares 1.1.1 (written by Greg Hudson). I decided to |
|
||||
fork and release a separate project since the ares author didn't want the |
|
||||
improvements that were vital for our use of it. |
|
||||
|
|
||||
This package is dubbed 'c-ares' since I (Daniel Stenberg) wanted this for use |
|
||||
within the curl project (hence the letter C) and it makes a nice pun. Also, |
|
||||
c-ares is not API compatible with ares: a new name makes that more obvious to |
|
||||
the public. |
|
||||
|
|
||||
The original libares was distributed at athena-dist.mit.edu:pub/ATHENA/ares. |
|
@ -1,118 +0,0 @@ |
|||||
|
|
||||
|
|
||||
___ __ _ _ __ ___ ___ |
|
||||
/ __| ___ / _` | '__/ _ \/ __| |
|
||||
| (_ |___| (_| | | | __/\__ \ |
|
||||
\___| \__,_|_| \___||___/ |
|
||||
|
|
||||
|
|
||||
How to build c-ares using MSVC or Visual Studio |
|
||||
================================================= |
|
||||
|
|
||||
|
|
||||
|
|
||||
How to build using MSVC from the command line |
|
||||
--------------------------------------------- |
|
||||
|
|
||||
Open a command prompt window and ensure that the environment is properly |
|
||||
set up in order to use MSVC or Visual Studio compiler tools. |
|
||||
|
|
||||
Change to c-ares source folder where Makefile.msvc file is located and run: |
|
||||
|
|
||||
> nmake -f Makefile.msvc |
|
||||
|
|
||||
This will build all c-ares libraries as well as three sample programs. |
|
||||
|
|
||||
Once the above command has finished a new folder named MSVCXX will exist |
|
||||
below the folder where makefile.msvc is found. The name of the folder |
|
||||
depends on the MSVC compiler version being used to build c-ares. |
|
||||
|
|
||||
Below the MSVCXX folder there will exist four folders named 'cares', |
|
||||
'ahost', 'acountry', and 'adig'. The 'cares' folder is the one that |
|
||||
holds the c-ares libraries you have just generated, the other three |
|
||||
hold sample programs that use the libraries. |
|
||||
|
|
||||
The above command builds four versions of the c-ares library, dynamic |
|
||||
and static versions and each one in release and debug flavours. Each |
|
||||
of these is found in folders named dll-release, dll-debug, lib-release, |
|
||||
and lib-debug, which hang from the 'cares' folder mentioned above. Each |
|
||||
sample program also has folders with the same names to reflect which |
|
||||
library version it is using. |
|
||||
|
|
||||
|
|
||||
How to build using Visual Studio 6 IDE |
|
||||
-------------------------------------- |
|
||||
|
|
||||
A VC++ 6.0 reference workspace (vc6aws.dsw) is available within the 'vc' |
|
||||
folder to allow proper building of the library and sample programs. |
|
||||
|
|
||||
1) Open the vc6aws.dsw workspace with MSVC6's IDE. |
|
||||
2) Select 'Build' from top menu. |
|
||||
3) Select 'Batch Build' from dropdown menu. |
|
||||
4) Make sure that the sixteen project configurations are 'checked'. |
|
||||
5) Click on the 'Build' button. |
|
||||
6) Once the sixteen project configurations are built you are done. |
|
||||
|
|
||||
Dynamic and static c-ares libraries are built in debug and release flavours, |
|
||||
and can be located each one in its own subdirectory, dll-debug, dll-release, |
|
||||
lib-debug and lib-release, all of them below the 'vc\cares' subdirectory. |
|
||||
|
|
||||
In the same way four executable versions of each sample program are built, |
|
||||
each using its respective library. The resulting sample executables are |
|
||||
located in its own subdirectory, dll-debug, dll-release, lib-debug and |
|
||||
lib-release, below the 'vc\acountry', 'vc\adig' and 'vc\ahost'folders. |
|
||||
|
|
||||
These reference VC++ 6.0 configurations are generated using the dynamic CRT. |
|
||||
|
|
||||
|
|
||||
How to build using Visual Studio 2003 or newer IDE |
|
||||
-------------------------------------------------- |
|
||||
|
|
||||
First you have to convert the VC++ 6.0 reference workspace and project files |
|
||||
to the Visual Studio IDE version you are using, following next steps: |
|
||||
|
|
||||
1) Open vc\vc6aws.dsw with VS20XX. |
|
||||
2) Allow VS20XX to update all projects and workspaces. |
|
||||
3) Save ALL and close VS20XX. |
|
||||
4) Open vc\vc6aws.sln with VS20XX. |
|
||||
5) Select batch build, check 'all' projects and click 'build' button. |
|
||||
|
|
||||
Same comments relative to generated files and folders as done above for |
|
||||
Visual Studio 6 IDE apply here. |
|
||||
|
|
||||
|
|
||||
Relationship between c-ares library file names and versions |
|
||||
----------------------------------------------------------- |
|
||||
|
|
||||
c-ares static release library version files: |
|
||||
|
|
||||
libcares.lib -> static release library |
|
||||
|
|
||||
c-ares static debug library version files: |
|
||||
|
|
||||
libcaresd.lib -> static debug library |
|
||||
|
|
||||
c-ares dynamic release library version files: |
|
||||
|
|
||||
cares.dll -> dynamic release library |
|
||||
cares.lib -> import library for the dynamic release library |
|
||||
cares.exp -> export file for the dynamic release library |
|
||||
|
|
||||
c-ares dynamic debug library version files: |
|
||||
|
|
||||
caresd.dll -> dynamic debug library |
|
||||
caresd.lib -> import library for the dynamic debug library |
|
||||
caresd.exp -> export file for the dynamic debug library |
|
||||
caresd.pdb -> debug symbol file for the dynamic debug library |
|
||||
|
|
||||
|
|
||||
How to use c-ares static libraries |
|
||||
---------------------------------- |
|
||||
|
|
||||
When using the c-ares static library in your program, you will have to |
|
||||
define preprocessor symbol CARES_STATICLIB while building your program, |
|
||||
otherwise you will get errors at linkage stage. |
|
||||
|
|
||||
|
|
||||
Have Fun! |
|
||||
|
|
@ -1,21 +0,0 @@ |
|||||
Library: c-ares, DNS resolver |
|
||||
|
|
||||
Version: 1.7.3 (11 June, 2010) |
|
||||
|
|
||||
Authors: Greg Hudson, Daniel Stenberg |
|
||||
|
|
||||
License: MIT |
|
||||
|
|
||||
Notes: |
|
||||
|
|
||||
Just use waf instead of the autoconf based configure script. Delete most of |
|
||||
the documentation and other files distributed with it. To upgrade, run |
|
||||
./configure on linux, macintosh, solaris (and other supported platforms) and |
|
||||
copy |
|
||||
- ares_config.h |
|
||||
- ares_setup.h |
|
||||
- ares_build.h |
|
||||
into the appropriate directory. |
|
||||
|
|
||||
|
|
||||
|
|
@ -1,25 +0,0 @@ |
|||||
c-ares version 1.7.4 |
|
||||
|
|
||||
Changed: |
|
||||
|
|
||||
o local-bind: Support binding to local interface/IPs, see |
|
||||
ares_set_local_ip4, ares_set_local_ip6, ares_set_local_dev |
|
||||
|
|
||||
Fixed: |
|
||||
|
|
||||
o memory leak in ares_getnameinfo |
|
||||
o add missing break that caused get_ares_servers to fail |
|
||||
o ares_parse_a_reply: fix CNAME response parsing |
|
||||
o init_by_options: don't copy an empty sortlist |
|
||||
o Replaced uint32_t with unsigned int to fix broken builds |
|
||||
on a couple of platforms |
|
||||
o Fix lookup with HOSTALIASES set |
|
||||
o adig: fix NAPTR parsing |
|
||||
o compiler warning cleanups |
|
||||
|
|
||||
Thanks go to these friendly people for their efforts and contributions: |
|
||||
|
|
||||
Andrew C. Morrow, Ben Greear, Ben Noordhuis, Daniel Stenberg, |
|
||||
Guenter Knauf, Mike Crowe, Patrik Thunstrom, Yang Tse |
|
||||
|
|
||||
Have fun! |
|
@ -1,23 +0,0 @@ |
|||||
TODO |
|
||||
==== |
|
||||
|
|
||||
ares_reinit() |
|
||||
|
|
||||
- To allow an app to force a re-read of /etc/resolv.conf etc, pretty much |
|
||||
like the res_init() resolver function offers |
|
||||
|
|
||||
ares_gethostbyname |
|
||||
|
|
||||
- When built to support IPv6, it needs to also support PF_UNSPEC or similar, |
|
||||
so that an application can ask for any protocol and then c-ares would return |
|
||||
all known resolves and not just explicitly IPv4 _or_ IPv6 resolves. |
|
||||
|
|
||||
ares_process |
|
||||
|
|
||||
- Upon next ABI breakage ares_process() should be changed to return 'int' |
|
||||
and return ARES_ENOTINITIALIZED if ares_library_init() has not been called. |
|
||||
|
|
||||
ares_process_fd |
|
||||
|
|
||||
- Upon next ABI breakage ares_process_fd() should be changed to return |
|
||||
'int' and return ARES_ENOTINITIALIZED if library has not been initialized. |
|
@ -1,581 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2007-2010 by Daniel Stenberg |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef ARES__H |
|
||||
#define ARES__H |
|
||||
|
|
||||
#include "ares_version.h" /* c-ares version defines */ |
|
||||
|
|
||||
/*
|
|
||||
* Define WIN32 when build target is Win32 API |
|
||||
*/ |
|
||||
|
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && \ |
|
||||
!defined(WIN32) && !defined(__SYMBIAN32__) |
|
||||
# define WIN32 |
|
||||
#endif |
|
||||
|
|
||||
/*************************** libuv patch ***************/ |
|
||||
|
|
||||
/*
|
|
||||
* We want to avoid autoconf altogether since there are a finite number of |
|
||||
* operating systems and simply build c-ares. Therefore we do not want the |
|
||||
* configurations provided by ares_build.h since we are always statically |
|
||||
* linking c-ares into libuv. Having a system dependent ares_build.h forces |
|
||||
* all users of ares.h to include the correct ares_build.h. We do not care |
|
||||
* about the linking checks provided by ares_rules.h. This would complicate |
|
||||
* the libuv build process. |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
#if defined(WIN32) |
|
||||
/* Configure process defines this to 1 when it finds out that system */ |
|
||||
/* header file ws2tcpip.h must be included by the external interface. */ |
|
||||
/* #undef CARES_PULL_WS2TCPIP_H */ |
|
||||
# include <winsock2.h> |
|
||||
# include <ws2tcpip.h> |
|
||||
# include <windows.h> |
|
||||
|
|
||||
#else /* Not Windows */ |
|
||||
|
|
||||
# include <sys/types.h> |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
|
|
||||
#if 0 |
|
||||
/* The size of `long', as computed by sizeof. */ |
|
||||
#define CARES_SIZEOF_LONG 4 |
|
||||
#endif |
|
||||
|
|
||||
/* Integral data type used for ares_socklen_t. */ |
|
||||
#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t |
|
||||
|
|
||||
#if 0 |
|
||||
/* The size of `ares_socklen_t', as computed by sizeof. */ |
|
||||
#define CARES_SIZEOF_ARES_SOCKLEN_T 4 |
|
||||
#endif |
|
||||
|
|
||||
/* Data type definition of ares_socklen_t. */ |
|
||||
typedef int ares_socklen_t; |
|
||||
|
|
||||
#if 0 /* libuv disabled */
|
|
||||
#include "ares_rules.h" /* c-ares rules enforcement */ |
|
||||
#endif |
|
||||
|
|
||||
/*********************** end libuv patch ***************/ |
|
||||
|
|
||||
#include <sys/types.h> |
|
||||
|
|
||||
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
|
|
||||
libc5-based Linux systems. Only include it on system that are known to |
|
||||
require it! */ |
|
||||
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ |
|
||||
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) |
|
||||
#include <sys/select.h> |
|
||||
#endif |
|
||||
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) |
|
||||
#include <sys/bsdskt.h> |
|
||||
#endif |
|
||||
|
|
||||
#if defined(WATT32) |
|
||||
# include <netinet/in.h> |
|
||||
# include <sys/socket.h> |
|
||||
# include <tcp.h> |
|
||||
#elif defined(WIN32) |
|
||||
# include <winsock2.h> |
|
||||
# include <ws2tcpip.h> |
|
||||
# include <windows.h> |
|
||||
#else |
|
||||
# include <sys/socket.h> |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef __cplusplus |
|
||||
extern "C" { |
|
||||
#endif |
|
||||
|
|
||||
/*
|
|
||||
** c-ares external API function linkage decorations. |
|
||||
*/ |
|
||||
|
|
||||
#if !defined(CARES_STATICLIB) && \ |
|
||||
(defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) |
|
||||
/* __declspec function decoration for Win32 and Symbian DLL's */ |
|
||||
# if defined(CARES_BUILDING_LIBRARY) |
|
||||
# define CARES_EXTERN __declspec(dllexport) |
|
||||
# else |
|
||||
# define CARES_EXTERN __declspec(dllimport) |
|
||||
# endif |
|
||||
#else |
|
||||
/* visibility function decoration for other cases */ |
|
||||
# if !defined(CARES_SYMBOL_HIDING) || \ |
|
||||
defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) |
|
||||
# define CARES_EXTERN |
|
||||
# else |
|
||||
# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
#define ARES_SUCCESS 0 |
|
||||
|
|
||||
/* Server error codes (ARES_ENODATA indicates no relevant answer) */ |
|
||||
#define ARES_ENODATA 1 |
|
||||
#define ARES_EFORMERR 2 |
|
||||
#define ARES_ESERVFAIL 3 |
|
||||
#define ARES_ENOTFOUND 4 |
|
||||
#define ARES_ENOTIMP 5 |
|
||||
#define ARES_EREFUSED 6 |
|
||||
|
|
||||
/* Locally generated error codes */ |
|
||||
#define ARES_EBADQUERY 7 |
|
||||
#define ARES_EBADNAME 8 |
|
||||
#define ARES_EBADFAMILY 9 |
|
||||
#define ARES_EBADRESP 10 |
|
||||
#define ARES_ECONNREFUSED 11 |
|
||||
#define ARES_ETIMEOUT 12 |
|
||||
#define ARES_EOF 13 |
|
||||
#define ARES_EFILE 14 |
|
||||
#define ARES_ENOMEM 15 |
|
||||
#define ARES_EDESTRUCTION 16 |
|
||||
#define ARES_EBADSTR 17 |
|
||||
|
|
||||
/* ares_getnameinfo error codes */ |
|
||||
#define ARES_EBADFLAGS 18 |
|
||||
|
|
||||
/* ares_getaddrinfo error codes */ |
|
||||
#define ARES_ENONAME 19 |
|
||||
#define ARES_EBADHINTS 20 |
|
||||
|
|
||||
/* Uninitialized library error code */ |
|
||||
#define ARES_ENOTINITIALIZED 21 /* introduced in 1.7.0 */ |
|
||||
|
|
||||
/* ares_library_init error codes */ |
|
||||
#define ARES_ELOADIPHLPAPI 22 /* introduced in 1.7.0 */ |
|
||||
#define ARES_EADDRGETNETWORKPARAMS 23 /* introduced in 1.7.0 */ |
|
||||
|
|
||||
/* More error codes */ |
|
||||
#define ARES_ECANCELLED 24 /* introduced in 1.7.0 */ |
|
||||
|
|
||||
/* Flag values */ |
|
||||
#define ARES_FLAG_USEVC (1 << 0) |
|
||||
#define ARES_FLAG_PRIMARY (1 << 1) |
|
||||
#define ARES_FLAG_IGNTC (1 << 2) |
|
||||
#define ARES_FLAG_NORECURSE (1 << 3) |
|
||||
#define ARES_FLAG_STAYOPEN (1 << 4) |
|
||||
#define ARES_FLAG_NOSEARCH (1 << 5) |
|
||||
#define ARES_FLAG_NOALIASES (1 << 6) |
|
||||
#define ARES_FLAG_NOCHECKRESP (1 << 7) |
|
||||
|
|
||||
/* Option mask values */ |
|
||||
#define ARES_OPT_FLAGS (1 << 0) |
|
||||
#define ARES_OPT_TIMEOUT (1 << 1) |
|
||||
#define ARES_OPT_TRIES (1 << 2) |
|
||||
#define ARES_OPT_NDOTS (1 << 3) |
|
||||
#define ARES_OPT_UDP_PORT (1 << 4) |
|
||||
#define ARES_OPT_TCP_PORT (1 << 5) |
|
||||
#define ARES_OPT_SERVERS (1 << 6) |
|
||||
#define ARES_OPT_DOMAINS (1 << 7) |
|
||||
#define ARES_OPT_LOOKUPS (1 << 8) |
|
||||
#define ARES_OPT_SOCK_STATE_CB (1 << 9) |
|
||||
#define ARES_OPT_SORTLIST (1 << 10) |
|
||||
#define ARES_OPT_SOCK_SNDBUF (1 << 11) |
|
||||
#define ARES_OPT_SOCK_RCVBUF (1 << 12) |
|
||||
#define ARES_OPT_TIMEOUTMS (1 << 13) |
|
||||
#define ARES_OPT_ROTATE (1 << 14) |
|
||||
|
|
||||
/* Nameinfo flag values */ |
|
||||
#define ARES_NI_NOFQDN (1 << 0) |
|
||||
#define ARES_NI_NUMERICHOST (1 << 1) |
|
||||
#define ARES_NI_NAMEREQD (1 << 2) |
|
||||
#define ARES_NI_NUMERICSERV (1 << 3) |
|
||||
#define ARES_NI_DGRAM (1 << 4) |
|
||||
#define ARES_NI_TCP 0 |
|
||||
#define ARES_NI_UDP ARES_NI_DGRAM |
|
||||
#define ARES_NI_SCTP (1 << 5) |
|
||||
#define ARES_NI_DCCP (1 << 6) |
|
||||
#define ARES_NI_NUMERICSCOPE (1 << 7) |
|
||||
#define ARES_NI_LOOKUPHOST (1 << 8) |
|
||||
#define ARES_NI_LOOKUPSERVICE (1 << 9) |
|
||||
/* Reserved for future use */ |
|
||||
#define ARES_NI_IDN (1 << 10) |
|
||||
#define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11) |
|
||||
#define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12) |
|
||||
|
|
||||
/* Addrinfo flag values */ |
|
||||
#define ARES_AI_CANONNAME (1 << 0) |
|
||||
#define ARES_AI_NUMERICHOST (1 << 1) |
|
||||
#define ARES_AI_PASSIVE (1 << 2) |
|
||||
#define ARES_AI_NUMERICSERV (1 << 3) |
|
||||
#define ARES_AI_V4MAPPED (1 << 4) |
|
||||
#define ARES_AI_ALL (1 << 5) |
|
||||
#define ARES_AI_ADDRCONFIG (1 << 6) |
|
||||
/* Reserved for future use */ |
|
||||
#define ARES_AI_IDN (1 << 10) |
|
||||
#define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11) |
|
||||
#define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12) |
|
||||
#define ARES_AI_CANONIDN (1 << 13) |
|
||||
|
|
||||
#define ARES_AI_MASK (ARES_AI_CANONNAME|ARES_AI_NUMERICHOST|ARES_AI_PASSIVE| \ |
|
||||
ARES_AI_NUMERICSERV|ARES_AI_V4MAPPED|ARES_AI_ALL| \ |
|
||||
ARES_AI_ADDRCONFIG) |
|
||||
#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about this |
|
||||
many sockets */ |
|
||||
#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num))) |
|
||||
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \ |
|
||||
ARES_GETSOCK_MAXNUM))) |
|
||||
|
|
||||
/* c-ares library initialization flag values */ |
|
||||
#define ARES_LIB_INIT_NONE (0) |
|
||||
#define ARES_LIB_INIT_WIN32 (1 << 0) |
|
||||
#define ARES_LIB_INIT_ALL (ARES_LIB_INIT_WIN32) |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Typedef our socket type |
|
||||
*/ |
|
||||
|
|
||||
#ifndef ares_socket_typedef |
|
||||
#ifdef WIN32 |
|
||||
typedef SOCKET ares_socket_t; |
|
||||
#define ARES_SOCKET_BAD INVALID_SOCKET |
|
||||
#else |
|
||||
typedef int ares_socket_t; |
|
||||
#define ARES_SOCKET_BAD -1 |
|
||||
#endif |
|
||||
#define ares_socket_typedef |
|
||||
#endif /* ares_socket_typedef */ |
|
||||
|
|
||||
typedef void (*ares_sock_state_cb)(void *data, |
|
||||
ares_socket_t socket_fd, |
|
||||
int readable, |
|
||||
int writable); |
|
||||
|
|
||||
struct apattern; |
|
||||
|
|
||||
/* NOTE about the ares_options struct to users and developers.
|
|
||||
|
|
||||
This struct will remain looking like this. It will not be extended nor |
|
||||
shrunk in future releases, but all new options will be set by ares_set_*() |
|
||||
options instead of with the ares_init_options() function. |
|
||||
|
|
||||
Eventually (in a galaxy far far away), all options will be settable by |
|
||||
ares_set_*() options and the ares_init_options() function will become |
|
||||
deprecated. |
|
||||
|
|
||||
When new options are added to c-ares, they are not added to this |
|
||||
struct. And they are not "saved" with the ares_save_options() function but |
|
||||
instead we encourage the use of the ares_dup() function. Needless to say, |
|
||||
if you add config options to c-ares you need to make sure ares_dup() |
|
||||
duplicates this new option. |
|
||||
|
|
||||
*/ |
|
||||
struct ares_options { |
|
||||
int flags; |
|
||||
int timeout; /* in seconds or milliseconds, depending on options */ |
|
||||
int tries; |
|
||||
int ndots; |
|
||||
unsigned short udp_port; |
|
||||
unsigned short tcp_port; |
|
||||
int socket_send_buffer_size; |
|
||||
int socket_receive_buffer_size; |
|
||||
struct in_addr *servers; |
|
||||
int nservers; |
|
||||
char **domains; |
|
||||
int ndomains; |
|
||||
char *lookups; |
|
||||
ares_sock_state_cb sock_state_cb; |
|
||||
void *sock_state_cb_data; |
|
||||
struct apattern *sortlist; |
|
||||
int nsort; |
|
||||
}; |
|
||||
|
|
||||
struct hostent; |
|
||||
struct timeval; |
|
||||
struct sockaddr; |
|
||||
struct ares_channeldata; |
|
||||
|
|
||||
typedef struct ares_channeldata *ares_channel; |
|
||||
|
|
||||
typedef void (*ares_callback)(void *arg, |
|
||||
int status, |
|
||||
int timeouts, |
|
||||
unsigned char *abuf, |
|
||||
int alen); |
|
||||
|
|
||||
typedef void (*ares_host_callback)(void *arg, |
|
||||
int status, |
|
||||
int timeouts, |
|
||||
struct hostent *hostent); |
|
||||
|
|
||||
typedef void (*ares_nameinfo_callback)(void *arg, |
|
||||
int status, |
|
||||
int timeouts, |
|
||||
char *node, |
|
||||
char *service); |
|
||||
|
|
||||
typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd, |
|
||||
int type, |
|
||||
void *data); |
|
||||
|
|
||||
CARES_EXTERN int ares_library_init(int flags); |
|
||||
|
|
||||
CARES_EXTERN void ares_library_cleanup(void); |
|
||||
|
|
||||
CARES_EXTERN const char *ares_version(int *version); |
|
||||
|
|
||||
CARES_EXTERN int ares_init(ares_channel *channelptr); |
|
||||
|
|
||||
CARES_EXTERN int ares_init_options(ares_channel *channelptr, |
|
||||
struct ares_options *options, |
|
||||
int optmask); |
|
||||
|
|
||||
CARES_EXTERN int ares_save_options(ares_channel channel, |
|
||||
struct ares_options *options, |
|
||||
int *optmask); |
|
||||
|
|
||||
CARES_EXTERN void ares_destroy_options(struct ares_options *options); |
|
||||
|
|
||||
CARES_EXTERN int ares_dup(ares_channel *dest, |
|
||||
ares_channel src); |
|
||||
|
|
||||
CARES_EXTERN void ares_destroy(ares_channel channel); |
|
||||
|
|
||||
CARES_EXTERN void ares_cancel(ares_channel channel); |
|
||||
|
|
||||
/* These next 3 configure local binding for the out-going socket
|
|
||||
* connection. Use these to specify source IP and/or network device |
|
||||
* on multi-homed systems. |
|
||||
*/ |
|
||||
CARES_EXTERN void ares_set_local_ip4(ares_channel channel, unsigned int local_ip); |
|
||||
|
|
||||
/* local_ip6 should be 16 bytes in length */ |
|
||||
CARES_EXTERN void ares_set_local_ip6(ares_channel channel, |
|
||||
const unsigned char* local_ip6); |
|
||||
|
|
||||
/* local_dev_name should be null terminated. */ |
|
||||
CARES_EXTERN void ares_set_local_dev(ares_channel channel, |
|
||||
const char* local_dev_name); |
|
||||
|
|
||||
CARES_EXTERN void ares_set_socket_callback(ares_channel channel, |
|
||||
ares_sock_create_callback callback, |
|
||||
void *user_data); |
|
||||
|
|
||||
CARES_EXTERN void ares_send(ares_channel channel, |
|
||||
const unsigned char *qbuf, |
|
||||
int qlen, |
|
||||
ares_callback callback, |
|
||||
void *arg); |
|
||||
|
|
||||
CARES_EXTERN void ares_query(ares_channel channel, |
|
||||
const char *name, |
|
||||
int dnsclass, |
|
||||
int type, |
|
||||
ares_callback callback, |
|
||||
void *arg); |
|
||||
|
|
||||
CARES_EXTERN void ares_search(ares_channel channel, |
|
||||
const char *name, |
|
||||
int dnsclass, |
|
||||
int type, |
|
||||
ares_callback callback, |
|
||||
void *arg); |
|
||||
|
|
||||
CARES_EXTERN void ares_gethostbyname(ares_channel channel, |
|
||||
const char *name, |
|
||||
int family, |
|
||||
ares_host_callback callback, |
|
||||
void *arg); |
|
||||
|
|
||||
CARES_EXTERN int ares_gethostbyname_file(ares_channel channel, |
|
||||
const char *name, |
|
||||
int family, |
|
||||
struct hostent **host); |
|
||||
|
|
||||
CARES_EXTERN void ares_gethostbyaddr(ares_channel channel, |
|
||||
const void *addr, |
|
||||
int addrlen, |
|
||||
int family, |
|
||||
ares_host_callback callback, |
|
||||
void *arg); |
|
||||
|
|
||||
CARES_EXTERN void ares_getnameinfo(ares_channel channel, |
|
||||
const struct sockaddr *sa, |
|
||||
ares_socklen_t salen, |
|
||||
int flags, |
|
||||
ares_nameinfo_callback callback, |
|
||||
void *arg); |
|
||||
|
|
||||
CARES_EXTERN int ares_fds(ares_channel channel, |
|
||||
fd_set *read_fds, |
|
||||
fd_set *write_fds); |
|
||||
|
|
||||
CARES_EXTERN int ares_getsock(ares_channel channel, |
|
||||
ares_socket_t *socks, |
|
||||
int numsocks); |
|
||||
|
|
||||
CARES_EXTERN struct timeval *ares_timeout(ares_channel channel, |
|
||||
struct timeval *maxtv, |
|
||||
struct timeval *tv); |
|
||||
|
|
||||
CARES_EXTERN void ares_process(ares_channel channel, |
|
||||
fd_set *read_fds, |
|
||||
fd_set *write_fds); |
|
||||
|
|
||||
CARES_EXTERN void ares_process_fd(ares_channel channel, |
|
||||
ares_socket_t read_fd, |
|
||||
ares_socket_t write_fd); |
|
||||
|
|
||||
CARES_EXTERN int ares_mkquery(const char *name, |
|
||||
int dnsclass, |
|
||||
int type, |
|
||||
unsigned short id, |
|
||||
int rd, |
|
||||
unsigned char **buf, |
|
||||
int *buflen); |
|
||||
|
|
||||
CARES_EXTERN int ares_expand_name(const unsigned char *encoded, |
|
||||
const unsigned char *abuf, |
|
||||
int alen, |
|
||||
char **s, |
|
||||
long *enclen); |
|
||||
|
|
||||
CARES_EXTERN int ares_expand_string(const unsigned char *encoded, |
|
||||
const unsigned char *abuf, |
|
||||
int alen, |
|
||||
unsigned char **s, |
|
||||
long *enclen); |
|
||||
|
|
||||
/*
|
|
||||
* NOTE: before c-ares 1.7.0 we would most often use the system in6_addr |
|
||||
* struct below when ares itself was built, but many apps would use this |
|
||||
* private version since the header checked a HAVE_* define for it. Starting |
|
||||
* with 1.7.0 we always declare and use our own to stop relying on the |
|
||||
* system's one. |
|
||||
*/ |
|
||||
struct ares_in6_addr { |
|
||||
union { |
|
||||
unsigned char _S6_u8[16]; |
|
||||
} _S6_un; |
|
||||
}; |
|
||||
|
|
||||
struct ares_addrttl { |
|
||||
struct in_addr ipaddr; |
|
||||
int ttl; |
|
||||
}; |
|
||||
|
|
||||
struct ares_addr6ttl { |
|
||||
struct ares_in6_addr ip6addr; |
|
||||
int ttl; |
|
||||
}; |
|
||||
|
|
||||
struct ares_srv_reply { |
|
||||
struct ares_srv_reply *next; |
|
||||
char *host; |
|
||||
unsigned short priority; |
|
||||
unsigned short weight; |
|
||||
unsigned short port; |
|
||||
}; |
|
||||
|
|
||||
struct ares_mx_reply { |
|
||||
struct ares_mx_reply *next; |
|
||||
char *host; |
|
||||
unsigned short priority; |
|
||||
}; |
|
||||
|
|
||||
struct ares_txt_reply { |
|
||||
struct ares_txt_reply *next; |
|
||||
unsigned char *txt; |
|
||||
size_t length; /* length excludes null termination */ |
|
||||
}; |
|
||||
|
|
||||
/*
|
|
||||
** Parse the buffer, starting at *abuf and of length alen bytes, previously |
|
||||
** obtained from an ares_search call. Put the results in *host, if nonnull. |
|
||||
** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with |
|
||||
** their TTLs in that array, and set *naddrttls to the number of addresses |
|
||||
** so written. |
|
||||
*/ |
|
||||
|
|
||||
CARES_EXTERN int ares_parse_a_reply(const unsigned char *abuf, |
|
||||
int alen, |
|
||||
struct hostent **host, |
|
||||
struct ares_addrttl *addrttls, |
|
||||
int *naddrttls); |
|
||||
|
|
||||
CARES_EXTERN int ares_parse_aaaa_reply(const unsigned char *abuf, |
|
||||
int alen, |
|
||||
struct hostent **host, |
|
||||
struct ares_addr6ttl *addrttls, |
|
||||
int *naddrttls); |
|
||||
|
|
||||
CARES_EXTERN int ares_parse_ptr_reply(const unsigned char *abuf, |
|
||||
int alen, |
|
||||
const void *addr, |
|
||||
int addrlen, |
|
||||
int family, |
|
||||
struct hostent **host); |
|
||||
|
|
||||
CARES_EXTERN int ares_parse_ns_reply(const unsigned char *abuf, |
|
||||
int alen, |
|
||||
struct hostent **host); |
|
||||
|
|
||||
CARES_EXTERN int ares_parse_srv_reply(const unsigned char* abuf, |
|
||||
int alen, |
|
||||
struct ares_srv_reply** srv_out); |
|
||||
|
|
||||
CARES_EXTERN int ares_parse_mx_reply(const unsigned char* abuf, |
|
||||
int alen, |
|
||||
struct ares_mx_reply** mx_out); |
|
||||
|
|
||||
CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf, |
|
||||
int alen, |
|
||||
struct ares_txt_reply** txt_out); |
|
||||
|
|
||||
CARES_EXTERN void ares_free_string(void *str); |
|
||||
|
|
||||
CARES_EXTERN void ares_free_hostent(struct hostent *host); |
|
||||
|
|
||||
CARES_EXTERN void ares_free_data(void *dataptr); |
|
||||
|
|
||||
CARES_EXTERN const char *ares_strerror(int code); |
|
||||
|
|
||||
/* TODO: Hold port here as well. */ |
|
||||
struct ares_addr_node { |
|
||||
struct ares_addr_node *next; |
|
||||
int family; |
|
||||
union { |
|
||||
struct in_addr addr4; |
|
||||
struct ares_in6_addr addr6; |
|
||||
} addr; |
|
||||
}; |
|
||||
|
|
||||
CARES_EXTERN int ares_set_servers(ares_channel channel, |
|
||||
struct ares_addr_node *servers); |
|
||||
|
|
||||
/* Incomming string format: host[:port][,host[:port]]... */ |
|
||||
CARES_EXTERN int ares_set_servers_csv(ares_channel channel, |
|
||||
const char* servers); |
|
||||
|
|
||||
CARES_EXTERN int ares_get_servers(ares_channel channel, |
|
||||
struct ares_addr_node **servers); |
|
||||
|
|
||||
#ifdef __cplusplus |
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
#endif /* ARES__H */ |
|
@ -1,66 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#ifdef HAVE_UNISTD_H |
|
||||
#include <unistd.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
void ares__close_sockets(ares_channel channel, struct server_state *server) |
|
||||
{ |
|
||||
struct send_request *sendreq; |
|
||||
|
|
||||
/* Free all pending output buffers. */ |
|
||||
while (server->qhead) |
|
||||
{ |
|
||||
/* Advance server->qhead; pull out query as we go. */ |
|
||||
sendreq = server->qhead; |
|
||||
server->qhead = sendreq->next; |
|
||||
if (sendreq->data_storage != NULL) |
|
||||
free(sendreq->data_storage); |
|
||||
free(sendreq); |
|
||||
} |
|
||||
server->qtail = NULL; |
|
||||
|
|
||||
/* Reset any existing input buffer. */ |
|
||||
if (server->tcp_buffer) |
|
||||
free(server->tcp_buffer); |
|
||||
server->tcp_buffer = NULL; |
|
||||
server->tcp_lenbuf_pos = 0; |
|
||||
|
|
||||
/* Reset brokenness */ |
|
||||
server->is_broken = 0; |
|
||||
|
|
||||
/* Close the TCP and UDP sockets. */ |
|
||||
if (server->tcp_socket != ARES_SOCKET_BAD) |
|
||||
{ |
|
||||
SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); |
|
||||
sclose(server->tcp_socket); |
|
||||
server->tcp_socket = ARES_SOCKET_BAD; |
|
||||
server->tcp_connection_generation = ++channel->tcp_connection_generation; |
|
||||
} |
|
||||
if (server->udp_socket != ARES_SOCKET_BAD) |
|
||||
{ |
|
||||
SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); |
|
||||
sclose(server->udp_socket); |
|
||||
server->udp_socket = ARES_SOCKET_BAD; |
|
||||
} |
|
||||
} |
|
@ -1,263 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998, 2010 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "inet_net_pton.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int ares__get_hostent(FILE *fp, int family, struct hostent **host) |
|
||||
{ |
|
||||
char *line = NULL, *p, *q, **alias; |
|
||||
char *txtaddr, *txthost, *txtalias; |
|
||||
int status; |
|
||||
size_t addrlen, linesize, naliases; |
|
||||
struct ares_addr addr; |
|
||||
struct hostent *hostent = NULL; |
|
||||
|
|
||||
*host = NULL; /* Assume failure */ |
|
||||
|
|
||||
/* Validate family */ |
|
||||
switch (family) { |
|
||||
case AF_INET: |
|
||||
case AF_INET6: |
|
||||
case AF_UNSPEC: |
|
||||
break; |
|
||||
default: |
|
||||
return ARES_EBADFAMILY; |
|
||||
} |
|
||||
|
|
||||
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) |
|
||||
{ |
|
||||
|
|
||||
/* Trim line comment. */ |
|
||||
p = line; |
|
||||
while (*p && (*p != '#')) |
|
||||
p++; |
|
||||
*p = '\0'; |
|
||||
|
|
||||
/* Trim trailing whitespace. */ |
|
||||
q = p - 1; |
|
||||
while ((q >= line) && ISSPACE(*q)) |
|
||||
q--; |
|
||||
*++q = '\0'; |
|
||||
|
|
||||
/* Skip leading whitespace. */ |
|
||||
p = line; |
|
||||
while (*p && ISSPACE(*p)) |
|
||||
p++; |
|
||||
if (!*p) |
|
||||
/* Ignore line if empty. */ |
|
||||
continue; |
|
||||
|
|
||||
/* Pointer to start of IPv4 or IPv6 address part. */ |
|
||||
txtaddr = p; |
|
||||
|
|
||||
/* Advance past address part. */ |
|
||||
while (*p && !ISSPACE(*p)) |
|
||||
p++; |
|
||||
if (!*p) |
|
||||
/* Ignore line if reached end of line. */ |
|
||||
continue; |
|
||||
|
|
||||
/* Null terminate address part. */ |
|
||||
*p = '\0'; |
|
||||
|
|
||||
/* Advance to host name */ |
|
||||
p++; |
|
||||
while (*p && ISSPACE(*p)) |
|
||||
p++; |
|
||||
if (!*p) |
|
||||
/* Ignore line if reached end of line. */ |
|
||||
continue; |
|
||||
|
|
||||
/* Pointer to start of host name. */ |
|
||||
txthost = p; |
|
||||
|
|
||||
/* Advance past host name. */ |
|
||||
while (*p && !ISSPACE(*p)) |
|
||||
p++; |
|
||||
|
|
||||
/* Pointer to start of first alias. */ |
|
||||
txtalias = NULL; |
|
||||
if (*p) |
|
||||
{ |
|
||||
q = p + 1; |
|
||||
while (*q && ISSPACE(*q)) |
|
||||
q++; |
|
||||
if (*q) |
|
||||
txtalias = q; |
|
||||
} |
|
||||
|
|
||||
/* Null terminate host name. */ |
|
||||
*p = '\0'; |
|
||||
|
|
||||
/* find out number of aliases. */ |
|
||||
naliases = 0; |
|
||||
if (txtalias) |
|
||||
{ |
|
||||
p = txtalias; |
|
||||
while (*p) |
|
||||
{ |
|
||||
while (*p && !ISSPACE(*p)) |
|
||||
p++; |
|
||||
while (*p && ISSPACE(*p)) |
|
||||
p++; |
|
||||
naliases++; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/* Convert address string to network address for the requested family. */ |
|
||||
addrlen = 0; |
|
||||
addr.family = AF_UNSPEC; |
|
||||
addr.addrV4.s_addr = INADDR_NONE; |
|
||||
if ((family == AF_INET) || (family == AF_UNSPEC)) |
|
||||
{ |
|
||||
addr.addrV4.s_addr = inet_addr(txtaddr); |
|
||||
if (addr.addrV4.s_addr != INADDR_NONE) |
|
||||
{ |
|
||||
/* Actual network address family and length. */ |
|
||||
addr.family = AF_INET; |
|
||||
addrlen = sizeof(addr.addrV4); |
|
||||
} |
|
||||
} |
|
||||
if ((family == AF_INET6) || ((family == AF_UNSPEC) && (!addrlen))) |
|
||||
{ |
|
||||
if (ares_inet_pton(AF_INET6, txtaddr, &addr.addrV6) > 0) |
|
||||
{ |
|
||||
/* Actual network address family and length. */ |
|
||||
addr.family = AF_INET6; |
|
||||
addrlen = sizeof(addr.addrV6); |
|
||||
} |
|
||||
} |
|
||||
if (!addrlen) |
|
||||
/* Ignore line if invalid address string for the requested family. */ |
|
||||
continue; |
|
||||
|
|
||||
/*
|
|
||||
** Actual address family possible values are AF_INET and AF_INET6 only. |
|
||||
*/ |
|
||||
|
|
||||
/* Allocate memory for the hostent structure. */ |
|
||||
hostent = malloc(sizeof(struct hostent)); |
|
||||
if (!hostent) |
|
||||
break; |
|
||||
|
|
||||
/* Initialize fields for out of memory condition. */ |
|
||||
hostent->h_aliases = NULL; |
|
||||
hostent->h_addr_list = NULL; |
|
||||
|
|
||||
/* Copy official host name. */ |
|
||||
hostent->h_name = strdup(txthost); |
|
||||
if (!hostent->h_name) |
|
||||
break; |
|
||||
|
|
||||
/* Copy network address. */ |
|
||||
hostent->h_addr_list = malloc(2 * sizeof(char *)); |
|
||||
if (!hostent->h_addr_list) |
|
||||
break; |
|
||||
hostent->h_addr_list[1] = NULL; |
|
||||
hostent->h_addr_list[0] = malloc(addrlen); |
|
||||
if (!hostent->h_addr_list[0]) |
|
||||
break; |
|
||||
if (addr.family == AF_INET) |
|
||||
memcpy(hostent->h_addr_list[0], &addr.addrV4, sizeof(addr.addrV4)); |
|
||||
else |
|
||||
memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(addr.addrV6)); |
|
||||
|
|
||||
/* Copy aliases. */ |
|
||||
hostent->h_aliases = malloc((naliases + 1) * sizeof(char *)); |
|
||||
if (!hostent->h_aliases) |
|
||||
break; |
|
||||
alias = hostent->h_aliases; |
|
||||
while (naliases) |
|
||||
*(alias + naliases--) = NULL; |
|
||||
*alias = NULL; |
|
||||
while (txtalias) |
|
||||
{ |
|
||||
p = txtalias; |
|
||||
while (*p && !ISSPACE(*p)) |
|
||||
p++; |
|
||||
q = p; |
|
||||
while (*q && ISSPACE(*q)) |
|
||||
q++; |
|
||||
*p = '\0'; |
|
||||
if ((*alias = strdup(txtalias)) == NULL) |
|
||||
break; |
|
||||
alias++; |
|
||||
txtalias = *q ? q : NULL; |
|
||||
} |
|
||||
if (txtalias) |
|
||||
/* Alias memory allocation failure. */ |
|
||||
break; |
|
||||
|
|
||||
/* Copy actual network address family and length. */ |
|
||||
hostent->h_addrtype = addr.family; |
|
||||
hostent->h_length = (int)addrlen; |
|
||||
|
|
||||
/* Free line buffer. */ |
|
||||
free(line); |
|
||||
|
|
||||
/* Return hostent successfully */ |
|
||||
*host = hostent; |
|
||||
return ARES_SUCCESS; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
/* If allocated, free line buffer. */ |
|
||||
if (line) |
|
||||
free(line); |
|
||||
|
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
/* Memory allocation failure; clean up. */ |
|
||||
if (hostent) |
|
||||
{ |
|
||||
if (hostent->h_name) |
|
||||
free((char *) hostent->h_name); |
|
||||
if (hostent->h_aliases) |
|
||||
{ |
|
||||
for (alias = hostent->h_aliases; *alias; alias++) |
|
||||
free(*alias); |
|
||||
free(hostent->h_aliases); |
|
||||
} |
|
||||
if (hostent->h_addr_list) |
|
||||
{ |
|
||||
if (hostent->h_addr_list[0]) |
|
||||
free(hostent->h_addr_list[0]); |
|
||||
free(hostent->h_addr_list); |
|
||||
} |
|
||||
free(hostent); |
|
||||
} |
|
||||
return ARES_ENOMEM; |
|
||||
} |
|
||||
|
|
||||
return status; |
|
||||
} |
|
@ -1,71 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include <stdio.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_nowarn.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
/* This is an internal function. Its contract is to read a line from
|
|
||||
* a file into a dynamically allocated buffer, zeroing the trailing |
|
||||
* newline if there is one. The calling routine may call |
|
||||
* ares__read_line multiple times with the same buf and bufsize |
|
||||
* pointers; *buf will be reallocated and *bufsize adjusted as |
|
||||
* appropriate. The initial value of *buf should be NULL. After the |
|
||||
* calling routine is done reading lines, it should free *buf. |
|
||||
*/ |
|
||||
int ares__read_line(FILE *fp, char **buf, size_t *bufsize) |
|
||||
{ |
|
||||
char *newbuf; |
|
||||
size_t offset = 0; |
|
||||
size_t len; |
|
||||
|
|
||||
if (*buf == NULL) |
|
||||
{ |
|
||||
*buf = malloc(128); |
|
||||
if (!*buf) |
|
||||
return ARES_ENOMEM; |
|
||||
*bufsize = 128; |
|
||||
} |
|
||||
|
|
||||
for (;;) |
|
||||
{ |
|
||||
int bytestoread = aresx_uztosi(*bufsize - offset); |
|
||||
|
|
||||
if (!fgets(*buf + offset, bytestoread, fp)) |
|
||||
return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF; |
|
||||
len = offset + strlen(*buf + offset); |
|
||||
if ((*buf)[len - 1] == '\n') |
|
||||
{ |
|
||||
(*buf)[len - 1] = 0; |
|
||||
break; |
|
||||
} |
|
||||
offset = len; |
|
||||
if(len < *bufsize - 1) |
|
||||
continue; |
|
||||
|
|
||||
/* Allocate more space. */ |
|
||||
newbuf = realloc(*buf, *bufsize * 2); |
|
||||
if (!newbuf) |
|
||||
return ARES_ENOMEM; |
|
||||
*buf = newbuf; |
|
||||
*bufsize *= 2; |
|
||||
} |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
@ -1,111 +0,0 @@ |
|||||
|
|
||||
/* Copyright (C) 2008 by Daniel Stenberg et al
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software and its |
|
||||
* documentation for any purpose and without fee is hereby granted, provided |
|
||||
* that the above copyright notice appear in all copies and that both that |
|
||||
* copyright notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or |
|
||||
* publicity pertaining to distribution of the software without specific, |
|
||||
* written prior permission. M.I.T. makes no representations about the |
|
||||
* suitability of this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
#if defined(WIN32) && !defined(MSDOS) |
|
||||
|
|
||||
struct timeval ares__tvnow(void) |
|
||||
{ |
|
||||
/*
|
|
||||
** GetTickCount() is available on _all_ Windows versions from W95 up |
|
||||
** to nowadays. Returns milliseconds elapsed since last system boot, |
|
||||
** increases monotonically and wraps once 49.7 days have elapsed. |
|
||||
*/ |
|
||||
struct timeval now; |
|
||||
DWORD milliseconds = GetTickCount(); |
|
||||
now.tv_sec = milliseconds / 1000; |
|
||||
now.tv_usec = (milliseconds % 1000) * 1000; |
|
||||
return now; |
|
||||
} |
|
||||
|
|
||||
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) |
|
||||
|
|
||||
struct timeval ares__tvnow(void) |
|
||||
{ |
|
||||
/*
|
|
||||
** clock_gettime() is granted to be increased monotonically when the |
|
||||
** monotonic clock is queried. Time starting point is unspecified, it |
|
||||
** could be the system start-up time, the Epoch, or something else, |
|
||||
** in any case the time starting point does not change once that the |
|
||||
** system has started up. |
|
||||
*/ |
|
||||
struct timeval now; |
|
||||
struct timespec tsnow; |
|
||||
if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) { |
|
||||
now.tv_sec = tsnow.tv_sec; |
|
||||
now.tv_usec = tsnow.tv_nsec / 1000; |
|
||||
} |
|
||||
/*
|
|
||||
** Even when the configure process has truly detected monotonic clock |
|
||||
** availability, it might happen that it is not actually available at |
|
||||
** run-time. When this occurs simply fallback to other time source. |
|
||||
*/ |
|
||||
#ifdef HAVE_GETTIMEOFDAY |
|
||||
else |
|
||||
(void)gettimeofday(&now, NULL); |
|
||||
#else |
|
||||
else { |
|
||||
now.tv_sec = (long)time(NULL); |
|
||||
now.tv_usec = 0; |
|
||||
} |
|
||||
#endif |
|
||||
return now; |
|
||||
} |
|
||||
|
|
||||
#elif defined(HAVE_GETTIMEOFDAY) |
|
||||
|
|
||||
struct timeval ares__tvnow(void) |
|
||||
{ |
|
||||
/*
|
|
||||
** gettimeofday() is not granted to be increased monotonically, due to |
|
||||
** clock drifting and external source time synchronization it can jump |
|
||||
** forward or backward in time. |
|
||||
*/ |
|
||||
struct timeval now; |
|
||||
(void)gettimeofday(&now, NULL); |
|
||||
return now; |
|
||||
} |
|
||||
|
|
||||
#else |
|
||||
|
|
||||
struct timeval ares__tvnow(void) |
|
||||
{ |
|
||||
/*
|
|
||||
** time() returns the value of time in seconds since the Epoch. |
|
||||
*/ |
|
||||
struct timeval now; |
|
||||
now.tv_sec = (long)time(NULL); |
|
||||
now.tv_usec = 0; |
|
||||
return now; |
|
||||
} |
|
||||
|
|
||||
#endif |
|
||||
|
|
||||
#if 0 /* Not used */
|
|
||||
/*
|
|
||||
* Make sure that the first argument is the more recent time, as otherwise |
|
||||
* we'll get a weird negative time-diff back... |
|
||||
* |
|
||||
* Returns: the time difference in number of milliseconds. |
|
||||
*/ |
|
||||
long ares__tvdiff(struct timeval newer, struct timeval older) |
|
||||
{ |
|
||||
return (newer.tv_sec-older.tv_sec)*1000+ |
|
||||
(newer.tv_usec-older.tv_usec)/1000; |
|
||||
} |
|
||||
#endif |
|
||||
|
|
@ -1,63 +0,0 @@ |
|||||
|
|
||||
/* Copyright (C) 2004 by Daniel Stenberg et al
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software and its |
|
||||
* documentation for any purpose and without fee is hereby granted, provided |
|
||||
* that the above copyright notice appear in all copies and that both that |
|
||||
* copyright notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or |
|
||||
* publicity pertaining to distribution of the software without specific, |
|
||||
* written prior permission. M.I.T. makes no representations about the |
|
||||
* suitability of this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include <assert.h> |
|
||||
#include <stdlib.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
/*
|
|
||||
* ares_cancel() cancels all ongoing requests/resolves that might be going on |
|
||||
* on the given channel. It does NOT kill the channel, use ares_destroy() for |
|
||||
* that. |
|
||||
*/ |
|
||||
void ares_cancel(ares_channel channel) |
|
||||
{ |
|
||||
struct query *query; |
|
||||
struct list_node* list_head; |
|
||||
struct list_node* list_node; |
|
||||
int i; |
|
||||
|
|
||||
list_head = &(channel->all_queries); |
|
||||
for (list_node = list_head->next; list_node != list_head; ) |
|
||||
{ |
|
||||
query = list_node->data; |
|
||||
list_node = list_node->next; /* since we're deleting the query */ |
|
||||
query->callback(query->arg, ARES_ECANCELLED, 0, NULL, 0); |
|
||||
ares__free_query(query); |
|
||||
} |
|
||||
#ifndef NDEBUG |
|
||||
/* Freeing the query should remove it from all the lists in which it sits,
|
|
||||
* so all query lists should be empty now. |
|
||||
*/ |
|
||||
assert(ares__is_list_empty(&(channel->all_queries))); |
|
||||
for (i = 0; i < ARES_QID_TABLE_SIZE; i++) |
|
||||
{ |
|
||||
assert(ares__is_list_empty(&(channel->queries_by_qid[i]))); |
|
||||
} |
|
||||
for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) |
|
||||
{ |
|
||||
assert(ares__is_list_empty(&(channel->queries_by_timeout[i]))); |
|
||||
} |
|
||||
#endif |
|
||||
if (!(channel->flags & ARES_FLAG_STAYOPEN)) |
|
||||
{ |
|
||||
if (channel->servers) |
|
||||
{ |
|
||||
for (i = 0; i < channel->nservers; i++) |
|
||||
ares__close_sockets(channel, &channel->servers[i]); |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,190 +0,0 @@ |
|||||
|
|
||||
/* Copyright (C) 2009-2010 by Daniel Stenberg
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#include <stddef.h> |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_data.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
** ares_free_data() - c-ares external API function. |
|
||||
** |
|
||||
** This function must be used by the application to free data memory that |
|
||||
** has been internally allocated by some c-ares function and for which a |
|
||||
** pointer has already been returned to the calling application. The list |
|
||||
** of c-ares functions returning pointers that must be free'ed using this |
|
||||
** function is: |
|
||||
** |
|
||||
** ares_get_servers() |
|
||||
** ares_parse_srv_reply() |
|
||||
** ares_parse_txt_reply() |
|
||||
*/ |
|
||||
|
|
||||
void ares_free_data(void *dataptr) |
|
||||
{ |
|
||||
struct ares_data *ptr; |
|
||||
|
|
||||
if (!dataptr) |
|
||||
return; |
|
||||
|
|
||||
#ifdef __INTEL_COMPILER |
|
||||
# pragma warning(push) |
|
||||
# pragma warning(disable:1684) |
|
||||
/* 1684: conversion from pointer to same-sized integral type */ |
|
||||
#endif |
|
||||
|
|
||||
ptr = (void *)((char *)dataptr - offsetof(struct ares_data, data)); |
|
||||
|
|
||||
#ifdef __INTEL_COMPILER |
|
||||
# pragma warning(pop) |
|
||||
#endif |
|
||||
|
|
||||
if (ptr->mark != ARES_DATATYPE_MARK) |
|
||||
return; |
|
||||
|
|
||||
switch (ptr->type) |
|
||||
{ |
|
||||
case ARES_DATATYPE_MX_REPLY: |
|
||||
|
|
||||
if (ptr->data.mx_reply.next) |
|
||||
ares_free_data(ptr->data.mx_reply.next); |
|
||||
if (ptr->data.mx_reply.host) |
|
||||
free(ptr->data.mx_reply.host); |
|
||||
break; |
|
||||
|
|
||||
case ARES_DATATYPE_SRV_REPLY: |
|
||||
|
|
||||
if (ptr->data.srv_reply.next) |
|
||||
ares_free_data(ptr->data.srv_reply.next); |
|
||||
if (ptr->data.srv_reply.host) |
|
||||
free(ptr->data.srv_reply.host); |
|
||||
break; |
|
||||
|
|
||||
case ARES_DATATYPE_TXT_REPLY: |
|
||||
|
|
||||
if (ptr->data.txt_reply.next) |
|
||||
ares_free_data(ptr->data.txt_reply.next); |
|
||||
if (ptr->data.txt_reply.txt) |
|
||||
free(ptr->data.txt_reply.txt); |
|
||||
break; |
|
||||
|
|
||||
case ARES_DATATYPE_ADDR_NODE: |
|
||||
|
|
||||
if (ptr->data.addr_node.next) |
|
||||
ares_free_data(ptr->data.addr_node.next); |
|
||||
break; |
|
||||
|
|
||||
default: |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
free(ptr); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
** ares_malloc_data() - c-ares internal helper function. |
|
||||
** |
|
||||
** This function allocates memory for a c-ares private ares_data struct |
|
||||
** for the specified ares_datatype, initializes c-ares private fields |
|
||||
** and zero initializes those which later might be used from the public |
|
||||
** API. It returns an interior pointer which can be passed by c-ares |
|
||||
** functions to the calling application, and that must be free'ed using |
|
||||
** c-ares external API function ares_free_data(). |
|
||||
*/ |
|
||||
|
|
||||
void *ares_malloc_data(ares_datatype type) |
|
||||
{ |
|
||||
struct ares_data *ptr; |
|
||||
|
|
||||
ptr = malloc(sizeof(struct ares_data)); |
|
||||
if (!ptr) |
|
||||
return NULL; |
|
||||
|
|
||||
switch (type) |
|
||||
{ |
|
||||
case ARES_DATATYPE_MX_REPLY: |
|
||||
ptr->data.mx_reply.next = NULL; |
|
||||
ptr->data.mx_reply.host = NULL; |
|
||||
ptr->data.mx_reply.priority = 0; |
|
||||
break; |
|
||||
|
|
||||
case ARES_DATATYPE_SRV_REPLY: |
|
||||
ptr->data.srv_reply.next = NULL; |
|
||||
ptr->data.srv_reply.host = NULL; |
|
||||
ptr->data.srv_reply.priority = 0; |
|
||||
ptr->data.srv_reply.weight = 0; |
|
||||
ptr->data.srv_reply.port = 0; |
|
||||
break; |
|
||||
|
|
||||
case ARES_DATATYPE_TXT_REPLY: |
|
||||
ptr->data.txt_reply.next = NULL; |
|
||||
ptr->data.txt_reply.txt = NULL; |
|
||||
ptr->data.txt_reply.length = 0; |
|
||||
break; |
|
||||
|
|
||||
case ARES_DATATYPE_ADDR_NODE: |
|
||||
ptr->data.addr_node.next = NULL; |
|
||||
ptr->data.addr_node.family = 0; |
|
||||
memset(&ptr->data.addr_node.addrV6, 0, |
|
||||
sizeof(ptr->data.addr_node.addrV6)); |
|
||||
break; |
|
||||
|
|
||||
default: |
|
||||
free(ptr); |
|
||||
return NULL; |
|
||||
} |
|
||||
|
|
||||
ptr->mark = ARES_DATATYPE_MARK; |
|
||||
ptr->type = type; |
|
||||
|
|
||||
return &ptr->data; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
** ares_get_datatype() - c-ares internal helper function. |
|
||||
** |
|
||||
** This function returns the ares_datatype of the data stored in a |
|
||||
** private ares_data struct when given the public API pointer. |
|
||||
*/ |
|
||||
|
|
||||
ares_datatype ares_get_datatype(void * dataptr) |
|
||||
{ |
|
||||
struct ares_data *ptr; |
|
||||
|
|
||||
#ifdef __INTEL_COMPILER |
|
||||
# pragma warning(push) |
|
||||
# pragma warning(disable:1684) |
|
||||
/* 1684: conversion from pointer to same-sized integral type */ |
|
||||
#endif |
|
||||
|
|
||||
ptr = (void *)((char *)dataptr - offsetof(struct ares_data, data)); |
|
||||
|
|
||||
#ifdef __INTEL_COMPILER |
|
||||
# pragma warning(pop) |
|
||||
#endif |
|
||||
|
|
||||
if (ptr->mark == ARES_DATATYPE_MARK) |
|
||||
return ptr->type; |
|
||||
|
|
||||
return ARES_DATATYPE_UNKNOWN; |
|
||||
} |
|
@ -1,65 +0,0 @@ |
|||||
|
|
||||
/* Copyright (C) 2009-2010 by Daniel Stenberg
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
typedef enum { |
|
||||
ARES_DATATYPE_UNKNOWN = 1, /* unknown data type - introduced in 1.7.0 */ |
|
||||
ARES_DATATYPE_SRV_REPLY, /* struct ares_srv_reply - introduced in 1.7.0 */ |
|
||||
ARES_DATATYPE_TXT_REPLY, /* struct ares_txt_reply - introduced in 1.7.0 */ |
|
||||
ARES_DATATYPE_ADDR_NODE, /* struct ares_addr_node - introduced in 1.7.1 */ |
|
||||
ARES_DATATYPE_MX_REPLY, /* struct ares_mx_reply - introduced in 1.7.2 */ |
|
||||
#if 0 |
|
||||
ARES_DATATYPE_ADDR6TTL, /* struct ares_addrttl */ |
|
||||
ARES_DATATYPE_ADDRTTL, /* struct ares_addr6ttl */ |
|
||||
ARES_DATATYPE_HOSTENT, /* struct hostent */ |
|
||||
ARES_DATATYPE_OPTIONS, /* struct ares_options */ |
|
||||
#endif |
|
||||
ARES_DATATYPE_LAST /* not used - introduced in 1.7.0 */ |
|
||||
} ares_datatype; |
|
||||
|
|
||||
#define ARES_DATATYPE_MARK 0xbead |
|
||||
|
|
||||
/*
|
|
||||
* ares_data struct definition is internal to c-ares and shall not |
|
||||
* be exposed by the public API in order to allow future changes |
|
||||
* and extensions to it without breaking ABI. This will be used |
|
||||
* internally by c-ares as the container of multiple types of data |
|
||||
* dynamically allocated for which a reference will be returned |
|
||||
* to the calling application. |
|
||||
* |
|
||||
* c-ares API functions returning a pointer to c-ares internally |
|
||||
* allocated data will actually be returning an interior pointer |
|
||||
* into this ares_data struct. |
|
||||
* |
|
||||
* All this is 'invisible' to the calling application, the only |
|
||||
* requirement is that this kind of data must be free'ed by the |
|
||||
* calling application using ares_free_data() with the pointer |
|
||||
* it has received from a previous c-ares function call. |
|
||||
*/ |
|
||||
|
|
||||
struct ares_data { |
|
||||
ares_datatype type; /* Actual data type identifier. */ |
|
||||
unsigned int mark; /* Private ares_data signature. */ |
|
||||
union { |
|
||||
struct ares_txt_reply txt_reply; |
|
||||
struct ares_srv_reply srv_reply; |
|
||||
struct ares_addr_node addr_node; |
|
||||
struct ares_mx_reply mx_reply; |
|
||||
} data; |
|
||||
}; |
|
||||
|
|
||||
void *ares_malloc_data(ares_datatype type); |
|
||||
|
|
||||
ares_datatype ares_get_datatype(void * dataptr); |
|
@ -1,105 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2004-2010 by Daniel Stenberg |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include <assert.h> |
|
||||
#include <stdlib.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
void ares_destroy_options(struct ares_options *options) |
|
||||
{ |
|
||||
int i; |
|
||||
|
|
||||
if(options->servers) |
|
||||
free(options->servers); |
|
||||
for (i = 0; i < options->ndomains; i++) |
|
||||
free(options->domains[i]); |
|
||||
free(options->domains); |
|
||||
if(options->sortlist) |
|
||||
free(options->sortlist); |
|
||||
free(options->lookups); |
|
||||
} |
|
||||
|
|
||||
void ares_destroy(ares_channel channel) |
|
||||
{ |
|
||||
int i; |
|
||||
struct query *query; |
|
||||
struct list_node* list_head; |
|
||||
struct list_node* list_node; |
|
||||
|
|
||||
if (!channel) |
|
||||
return; |
|
||||
|
|
||||
list_head = &(channel->all_queries); |
|
||||
for (list_node = list_head->next; list_node != list_head; ) |
|
||||
{ |
|
||||
query = list_node->data; |
|
||||
list_node = list_node->next; /* since we're deleting the query */ |
|
||||
query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0); |
|
||||
ares__free_query(query); |
|
||||
} |
|
||||
#ifndef NDEBUG |
|
||||
/* Freeing the query should remove it from all the lists in which it sits,
|
|
||||
* so all query lists should be empty now. |
|
||||
*/ |
|
||||
assert(ares__is_list_empty(&(channel->all_queries))); |
|
||||
for (i = 0; i < ARES_QID_TABLE_SIZE; i++) |
|
||||
{ |
|
||||
assert(ares__is_list_empty(&(channel->queries_by_qid[i]))); |
|
||||
} |
|
||||
for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) |
|
||||
{ |
|
||||
assert(ares__is_list_empty(&(channel->queries_by_timeout[i]))); |
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
ares__destroy_servers_state(channel); |
|
||||
|
|
||||
if (channel->domains) { |
|
||||
for (i = 0; i < channel->ndomains; i++) |
|
||||
free(channel->domains[i]); |
|
||||
free(channel->domains); |
|
||||
} |
|
||||
|
|
||||
if(channel->sortlist) |
|
||||
free(channel->sortlist); |
|
||||
|
|
||||
if (channel->lookups) |
|
||||
free(channel->lookups); |
|
||||
|
|
||||
free(channel); |
|
||||
} |
|
||||
|
|
||||
void ares__destroy_servers_state(ares_channel channel) |
|
||||
{ |
|
||||
struct server_state *server; |
|
||||
int i; |
|
||||
|
|
||||
if (channel->servers) |
|
||||
{ |
|
||||
for (i = 0; i < channel->nservers; i++) |
|
||||
{ |
|
||||
server = &channel->servers[i]; |
|
||||
ares__close_sockets(channel, server); |
|
||||
assert(ares__is_list_empty(&server->queries_to_server)); |
|
||||
} |
|
||||
free(channel->servers); |
|
||||
channel->servers = NULL; |
|
||||
} |
|
||||
channel->nservers = -1; |
|
||||
} |
|
@ -1,90 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef ARES__DNS_H |
|
||||
#define ARES__DNS_H |
|
||||
|
|
||||
#define DNS__16BIT(p) (((p)[0] << 8) | (p)[1]) |
|
||||
#define DNS__32BIT(p) (((p)[0] << 24) | ((p)[1] << 16) | \ |
|
||||
((p)[2] << 8) | (p)[3]) |
|
||||
|
|
||||
#define DNS__SET16BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 8) & 0xff)), \ |
|
||||
((p)[1] = (unsigned char)((v) & 0xff))) |
|
||||
#define DNS__SET32BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 24) & 0xff)), \ |
|
||||
((p)[1] = (unsigned char)(((v) >> 16) & 0xff)), \ |
|
||||
((p)[2] = (unsigned char)(((v) >> 8) & 0xff)), \ |
|
||||
((p)[3] = (unsigned char)((v) & 0xff))) |
|
||||
|
|
||||
#if 0 |
|
||||
/* we cannot use this approach on systems where we can't access 16/32 bit
|
|
||||
data on un-aligned addresses */ |
|
||||
#define DNS__16BIT(p) ntohs(*(unsigned short*)(p)) |
|
||||
#define DNS__32BIT(p) ntohl(*(unsigned long*)(p)) |
|
||||
#define DNS__SET16BIT(p, v) *(unsigned short*)(p) = htons(v) |
|
||||
#define DNS__SET32BIT(p, v) *(unsigned long*)(p) = htonl(v) |
|
||||
#endif |
|
||||
|
|
||||
/* Macros for parsing a DNS header */ |
|
||||
#define DNS_HEADER_QID(h) DNS__16BIT(h) |
|
||||
#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1) |
|
||||
#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf) |
|
||||
#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1) |
|
||||
#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1) |
|
||||
#define DNS_HEADER_RD(h) ((h)[2] & 0x1) |
|
||||
#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1) |
|
||||
#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7) |
|
||||
#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf) |
|
||||
#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4) |
|
||||
#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6) |
|
||||
#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8) |
|
||||
#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10) |
|
||||
|
|
||||
/* Macros for constructing a DNS header */ |
|
||||
#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v) |
|
||||
#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 7)) |
|
||||
#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (unsigned char)(((v) & 0xf) << 3)) |
|
||||
#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 2)) |
|
||||
#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 1)) |
|
||||
#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (unsigned char)((v) & 0x1)) |
|
||||
#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (unsigned char)(((v) & 0x1) << 7)) |
|
||||
#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (unsigned char)(((v) & 0x7) << 4)) |
|
||||
#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (unsigned char)((v) & 0xf)) |
|
||||
#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v) |
|
||||
#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v) |
|
||||
#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v) |
|
||||
#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v) |
|
||||
|
|
||||
/* Macros for parsing the fixed part of a DNS question */ |
|
||||
#define DNS_QUESTION_TYPE(q) DNS__16BIT(q) |
|
||||
#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2) |
|
||||
|
|
||||
/* Macros for constructing the fixed part of a DNS question */ |
|
||||
#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v) |
|
||||
#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v) |
|
||||
|
|
||||
/* Macros for parsing the fixed part of a DNS resource record */ |
|
||||
#define DNS_RR_TYPE(r) DNS__16BIT(r) |
|
||||
#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2) |
|
||||
#define DNS_RR_TTL(r) DNS__32BIT((r) + 4) |
|
||||
#define DNS_RR_LEN(r) DNS__16BIT((r) + 8) |
|
||||
|
|
||||
/* Macros for constructing the fixed part of a DNS resource record */ |
|
||||
#define DNS_RR_SET_TYPE(r) DNS__SET16BIT(r, v) |
|
||||
#define DNS_RR_SET_CLASS(r) DNS__SET16BIT((r) + 2, v) |
|
||||
#define DNS_RR_SET_TTL(r) DNS__SET32BIT((r) + 4, v) |
|
||||
#define DNS_RR_SET_LEN(r) DNS__SET16BIT((r) + 8, v) |
|
||||
|
|
||||
#endif /* ARES__DNS_H */ |
|
@ -1,193 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" /* for the memdebug */ |
|
||||
|
|
||||
static int name_length(const unsigned char *encoded, const unsigned char *abuf, |
|
||||
int alen); |
|
||||
|
|
||||
/* Expand an RFC1035-encoded domain name given by encoded. The
|
|
||||
* containing message is given by abuf and alen. The result given by |
|
||||
* *s, which is set to a NUL-terminated allocated buffer. *enclen is |
|
||||
* set to the length of the encoded name (not the length of the |
|
||||
* expanded name; the goal is to tell the caller how many bytes to |
|
||||
* move forward to get past the encoded name). |
|
||||
* |
|
||||
* In the simple case, an encoded name is a series of labels, each |
|
||||
* composed of a one-byte length (limited to values between 0 and 63 |
|
||||
* inclusive) followed by the label contents. The name is terminated |
|
||||
* by a zero-length label. |
|
||||
* |
|
||||
* In the more complicated case, a label may be terminated by an |
|
||||
* indirection pointer, specified by two bytes with the high bits of |
|
||||
* the first byte (corresponding to INDIR_MASK) set to 11. With the |
|
||||
* two high bits of the first byte stripped off, the indirection |
|
||||
* pointer gives an offset from the beginning of the containing |
|
||||
* message with more labels to decode. Indirection can happen an |
|
||||
* arbitrary number of times, so we have to detect loops. |
|
||||
* |
|
||||
* Since the expanded name uses '.' as a label separator, we use |
|
||||
* backslashes to escape periods or backslashes in the expanded name. |
|
||||
*/ |
|
||||
|
|
||||
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, |
|
||||
int alen, char **s, long *enclen) |
|
||||
{ |
|
||||
int len, indir = 0; |
|
||||
char *q; |
|
||||
const unsigned char *p; |
|
||||
union { |
|
||||
ssize_t sig; |
|
||||
size_t uns; |
|
||||
} nlen; |
|
||||
|
|
||||
nlen.sig = name_length(encoded, abuf, alen); |
|
||||
if (nlen.sig < 0) |
|
||||
return ARES_EBADNAME; |
|
||||
|
|
||||
*s = malloc(nlen.uns + 1); |
|
||||
if (!*s) |
|
||||
return ARES_ENOMEM; |
|
||||
q = *s; |
|
||||
|
|
||||
if (nlen.uns == 0) { |
|
||||
/* RFC2181 says this should be ".": the root of the DNS tree.
|
|
||||
* Since this function strips trailing dots though, it becomes "" |
|
||||
*/ |
|
||||
q[0] = '\0'; |
|
||||
*enclen = 1; /* the caller should move one byte to get past this */ |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
/* No error-checking necessary; it was all done by name_length(). */ |
|
||||
p = encoded; |
|
||||
while (*p) |
|
||||
{ |
|
||||
if ((*p & INDIR_MASK) == INDIR_MASK) |
|
||||
{ |
|
||||
if (!indir) |
|
||||
{ |
|
||||
*enclen = p + 2 - encoded; |
|
||||
indir = 1; |
|
||||
} |
|
||||
p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1)); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
len = *p; |
|
||||
p++; |
|
||||
while (len--) |
|
||||
{ |
|
||||
if (*p == '.' || *p == '\\') |
|
||||
*q++ = '\\'; |
|
||||
*q++ = *p; |
|
||||
p++; |
|
||||
} |
|
||||
*q++ = '.'; |
|
||||
} |
|
||||
} |
|
||||
if (!indir) |
|
||||
*enclen = p + 1 - encoded; |
|
||||
|
|
||||
/* Nuke the trailing period if we wrote one. */ |
|
||||
if (q > *s) |
|
||||
*(q - 1) = 0; |
|
||||
else |
|
||||
*q = 0; /* zero terminate */ |
|
||||
|
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
/* Return the length of the expansion of an encoded domain name, or
|
|
||||
* -1 if the encoding is invalid. |
|
||||
*/ |
|
||||
static int name_length(const unsigned char *encoded, const unsigned char *abuf, |
|
||||
int alen) |
|
||||
{ |
|
||||
int n = 0, offset, indir = 0; |
|
||||
|
|
||||
/* Allow the caller to pass us abuf + alen and have us check for it. */ |
|
||||
if (encoded == abuf + alen) |
|
||||
return -1; |
|
||||
|
|
||||
while (*encoded) |
|
||||
{ |
|
||||
if ((*encoded & INDIR_MASK) == INDIR_MASK) |
|
||||
{ |
|
||||
/* Check the offset and go there. */ |
|
||||
if (encoded + 1 >= abuf + alen) |
|
||||
return -1; |
|
||||
offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1); |
|
||||
if (offset >= alen) |
|
||||
return -1; |
|
||||
encoded = abuf + offset; |
|
||||
|
|
||||
/* If we've seen more indirects than the message length,
|
|
||||
* then there's a loop. |
|
||||
*/ |
|
||||
if (++indir > alen) |
|
||||
return -1; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
offset = *encoded; |
|
||||
if (encoded + offset + 1 >= abuf + alen) |
|
||||
return -1; |
|
||||
encoded++; |
|
||||
while (offset--) |
|
||||
{ |
|
||||
n += (*encoded == '.' || *encoded == '\\') ? 2 : 1; |
|
||||
encoded++; |
|
||||
} |
|
||||
n++; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/* If there were any labels at all, then the number of dots is one
|
|
||||
* less than the number of labels, so subtract one. |
|
||||
*/ |
|
||||
return (n) ? n - 1 : n; |
|
||||
} |
|
||||
|
|
||||
/* Like ares_expand_name but returns EBADRESP in case of invalid input. */ |
|
||||
int ares__expand_name_for_response(const unsigned char *encoded, |
|
||||
const unsigned char *abuf, int alen, |
|
||||
char **s, long *enclen) |
|
||||
{ |
|
||||
int status = ares_expand_name(encoded, abuf, alen, s, enclen); |
|
||||
if (status == ARES_EBADNAME) |
|
||||
status = ARES_EBADRESP; |
|
||||
return status; |
|
||||
} |
|
@ -1,75 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
|
|
||||
#include <string.h> |
|
||||
#include <stdlib.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" /* for the memdebug */ |
|
||||
|
|
||||
/* Simply decodes a length-encoded character string. The first byte of the
|
|
||||
* input is the length of the string to be returned and the bytes thereafter |
|
||||
* are the characters of the string. The returned result will be NULL |
|
||||
* terminated. |
|
||||
*/ |
|
||||
int ares_expand_string(const unsigned char *encoded, |
|
||||
const unsigned char *abuf, |
|
||||
int alen, |
|
||||
unsigned char **s, |
|
||||
long *enclen) |
|
||||
{ |
|
||||
unsigned char *q; |
|
||||
union { |
|
||||
ssize_t sig; |
|
||||
size_t uns; |
|
||||
} elen; |
|
||||
|
|
||||
if (encoded == abuf+alen) |
|
||||
return ARES_EBADSTR; |
|
||||
|
|
||||
elen.uns = *encoded; |
|
||||
if (encoded+elen.sig+1 > abuf+alen) |
|
||||
return ARES_EBADSTR; |
|
||||
|
|
||||
encoded++; |
|
||||
|
|
||||
*s = malloc(elen.uns+1); |
|
||||
if (*s == NULL) |
|
||||
return ARES_ENOMEM; |
|
||||
q = *s; |
|
||||
strncpy((char *)q, (char *)encoded, elen.uns); |
|
||||
q[elen.uns] = '\0'; |
|
||||
|
|
||||
*s = q; |
|
||||
|
|
||||
*enclen = (long)(elen.sig+1); |
|
||||
|
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
@ -1,62 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_TIME_H |
|
||||
#include <sys/time.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds) |
|
||||
{ |
|
||||
struct server_state *server; |
|
||||
ares_socket_t nfds; |
|
||||
int i; |
|
||||
|
|
||||
/* Are there any active queries? */ |
|
||||
int active_queries = !ares__is_list_empty(&(channel->all_queries)); |
|
||||
|
|
||||
nfds = 0; |
|
||||
for (i = 0; i < channel->nservers; i++) |
|
||||
{ |
|
||||
server = &channel->servers[i]; |
|
||||
/* We only need to register interest in UDP sockets if we have
|
|
||||
* outstanding queries. |
|
||||
*/ |
|
||||
if (active_queries && server->udp_socket != ARES_SOCKET_BAD) |
|
||||
{ |
|
||||
FD_SET(server->udp_socket, read_fds); |
|
||||
if (server->udp_socket >= nfds) |
|
||||
nfds = server->udp_socket + 1; |
|
||||
} |
|
||||
/* We always register for TCP events, because we want to know
|
|
||||
* when the other side closes the connection, so we don't waste |
|
||||
* time trying to use a broken connection. |
|
||||
*/ |
|
||||
if (server->tcp_socket != ARES_SOCKET_BAD) |
|
||||
{ |
|
||||
FD_SET(server->tcp_socket, read_fds); |
|
||||
if (server->qhead) |
|
||||
FD_SET(server->tcp_socket, write_fds); |
|
||||
if (server->tcp_socket >= nfds) |
|
||||
nfds = server->tcp_socket + 1; |
|
||||
} |
|
||||
} |
|
||||
return (int)nfds; |
|
||||
} |
|
@ -1,39 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include <stdlib.h> |
|
||||
|
|
||||
#ifdef HAVE_NETDB_H |
|
||||
#include <netdb.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" /* for memdebug */ |
|
||||
|
|
||||
void ares_free_hostent(struct hostent *host) |
|
||||
{ |
|
||||
char **p; |
|
||||
|
|
||||
free((char *)(host->h_name)); |
|
||||
for (p = host->h_aliases; *p; p++) |
|
||||
free(*p); |
|
||||
free(host->h_aliases); |
|
||||
free(host->h_addr_list[0]); /* no matter if there is one or many entries,
|
|
||||
there is only one malloc for all of them */ |
|
||||
free(host->h_addr_list); |
|
||||
free(host); |
|
||||
} |
|
@ -1,25 +0,0 @@ |
|||||
|
|
||||
/* Copyright 2000 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include <stdlib.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
void ares_free_string(void *str) |
|
||||
{ |
|
||||
free(str); |
|
||||
} |
|
@ -1,292 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdio.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "inet_net_pton.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
#ifdef WATT32 |
|
||||
#undef WIN32 |
|
||||
#endif |
|
||||
|
|
||||
struct addr_query { |
|
||||
/* Arguments passed to ares_gethostbyaddr() */ |
|
||||
ares_channel channel; |
|
||||
struct ares_addr addr; |
|
||||
ares_host_callback callback; |
|
||||
void *arg; |
|
||||
|
|
||||
const char *remaining_lookups; |
|
||||
int timeouts; |
|
||||
}; |
|
||||
|
|
||||
static void next_lookup(struct addr_query *aquery); |
|
||||
static void addr_callback(void *arg, int status, int timeouts, |
|
||||
unsigned char *abuf, int alen); |
|
||||
static void end_aquery(struct addr_query *aquery, int status, |
|
||||
struct hostent *host); |
|
||||
static int file_lookup(struct ares_addr *addr, struct hostent **host); |
|
||||
static void ptr_rr_name(char *name, const struct ares_addr *addr); |
|
||||
|
|
||||
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, |
|
||||
int family, ares_host_callback callback, void *arg) |
|
||||
{ |
|
||||
struct addr_query *aquery; |
|
||||
|
|
||||
if (family != AF_INET && family != AF_INET6) |
|
||||
{ |
|
||||
callback(arg, ARES_ENOTIMP, 0, NULL); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
if ((family == AF_INET && addrlen != sizeof(aquery->addr.addrV4)) || |
|
||||
(family == AF_INET6 && addrlen != sizeof(aquery->addr.addrV6))) |
|
||||
{ |
|
||||
callback(arg, ARES_ENOTIMP, 0, NULL); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
aquery = malloc(sizeof(struct addr_query)); |
|
||||
if (!aquery) |
|
||||
{ |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL); |
|
||||
return; |
|
||||
} |
|
||||
aquery->channel = channel; |
|
||||
if (family == AF_INET) |
|
||||
memcpy(&aquery->addr.addrV4, addr, sizeof(aquery->addr.addrV4)); |
|
||||
else |
|
||||
memcpy(&aquery->addr.addrV6, addr, sizeof(aquery->addr.addrV6)); |
|
||||
aquery->addr.family = family; |
|
||||
aquery->callback = callback; |
|
||||
aquery->arg = arg; |
|
||||
aquery->remaining_lookups = channel->lookups; |
|
||||
aquery->timeouts = 0; |
|
||||
|
|
||||
next_lookup(aquery); |
|
||||
} |
|
||||
|
|
||||
static void next_lookup(struct addr_query *aquery) |
|
||||
{ |
|
||||
const char *p; |
|
||||
char name[128]; |
|
||||
int status; |
|
||||
struct hostent *host; |
|
||||
|
|
||||
for (p = aquery->remaining_lookups; *p; p++) |
|
||||
{ |
|
||||
switch (*p) |
|
||||
{ |
|
||||
case 'b': |
|
||||
ptr_rr_name(name, &aquery->addr); |
|
||||
aquery->remaining_lookups = p + 1; |
|
||||
ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback, |
|
||||
aquery); |
|
||||
return; |
|
||||
case 'f': |
|
||||
status = file_lookup(&aquery->addr, &host); |
|
||||
|
|
||||
/* this status check below previously checked for !ARES_ENOTFOUND,
|
|
||||
but we should not assume that this single error code is the one |
|
||||
that can occur, as that is in fact no longer the case */ |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
end_aquery(aquery, status, host); |
|
||||
return; |
|
||||
} |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
end_aquery(aquery, ARES_ENOTFOUND, NULL); |
|
||||
} |
|
||||
|
|
||||
static void addr_callback(void *arg, int status, int timeouts, |
|
||||
unsigned char *abuf, int alen) |
|
||||
{ |
|
||||
struct addr_query *aquery = (struct addr_query *) arg; |
|
||||
struct hostent *host; |
|
||||
size_t addrlen; |
|
||||
|
|
||||
aquery->timeouts += timeouts; |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
if (aquery->addr.family == AF_INET) |
|
||||
{ |
|
||||
addrlen = sizeof(aquery->addr.addrV4); |
|
||||
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4, |
|
||||
(int)addrlen, AF_INET, &host); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
addrlen = sizeof(aquery->addr.addrV6); |
|
||||
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6, |
|
||||
(int)addrlen, AF_INET6, &host); |
|
||||
} |
|
||||
end_aquery(aquery, status, host); |
|
||||
} |
|
||||
else if (status == ARES_EDESTRUCTION) |
|
||||
end_aquery(aquery, status, NULL); |
|
||||
else |
|
||||
next_lookup(aquery); |
|
||||
} |
|
||||
|
|
||||
static void end_aquery(struct addr_query *aquery, int status, |
|
||||
struct hostent *host) |
|
||||
{ |
|
||||
aquery->callback(aquery->arg, status, aquery->timeouts, host); |
|
||||
if (host) |
|
||||
ares_free_hostent(host); |
|
||||
free(aquery); |
|
||||
} |
|
||||
|
|
||||
static int file_lookup(struct ares_addr *addr, struct hostent **host) |
|
||||
{ |
|
||||
FILE *fp; |
|
||||
int status; |
|
||||
int error; |
|
||||
|
|
||||
#ifdef WIN32 |
|
||||
char PATH_HOSTS[MAX_PATH]; |
|
||||
if (IS_NT()) { |
|
||||
char tmp[MAX_PATH]; |
|
||||
HKEY hkeyHosts; |
|
||||
|
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, |
|
||||
&hkeyHosts) == ERROR_SUCCESS) |
|
||||
{ |
|
||||
DWORD dwLength = MAX_PATH; |
|
||||
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, |
|
||||
&dwLength); |
|
||||
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH); |
|
||||
RegCloseKey(hkeyHosts); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
GetWindowsDirectory(PATH_HOSTS, MAX_PATH); |
|
||||
|
|
||||
strcat(PATH_HOSTS, WIN_PATH_HOSTS); |
|
||||
|
|
||||
#elif defined(WATT32) |
|
||||
extern const char *_w32_GetHostsFile (void); |
|
||||
const char *PATH_HOSTS = _w32_GetHostsFile(); |
|
||||
|
|
||||
if (!PATH_HOSTS) |
|
||||
return ARES_ENOTFOUND; |
|
||||
#endif |
|
||||
|
|
||||
fp = fopen(PATH_HOSTS, "r"); |
|
||||
if (!fp) |
|
||||
{ |
|
||||
error = ERRNO; |
|
||||
switch(error) |
|
||||
{ |
|
||||
case ENOENT: |
|
||||
case ESRCH: |
|
||||
return ARES_ENOTFOUND; |
|
||||
default: |
|
||||
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", |
|
||||
error, strerror(error))); |
|
||||
DEBUGF(fprintf(stderr, "Error opening file: %s\n", |
|
||||
PATH_HOSTS)); |
|
||||
*host = NULL; |
|
||||
return ARES_EFILE; |
|
||||
} |
|
||||
} |
|
||||
while ((status = ares__get_hostent(fp, addr->family, host)) == ARES_SUCCESS) |
|
||||
{ |
|
||||
if (addr->family != (*host)->h_addrtype) |
|
||||
{ |
|
||||
ares_free_hostent(*host); |
|
||||
continue; |
|
||||
} |
|
||||
if (addr->family == AF_INET) |
|
||||
{ |
|
||||
if (memcmp((*host)->h_addr, &addr->addrV4, |
|
||||
sizeof(addr->addrV4)) == 0) |
|
||||
break; |
|
||||
} |
|
||||
else if (addr->family == AF_INET6) |
|
||||
{ |
|
||||
if (memcmp((*host)->h_addr, &addr->addrV6, |
|
||||
sizeof(addr->addrV6)) == 0) |
|
||||
break; |
|
||||
} |
|
||||
ares_free_hostent(*host); |
|
||||
} |
|
||||
fclose(fp); |
|
||||
if (status == ARES_EOF) |
|
||||
status = ARES_ENOTFOUND; |
|
||||
if (status != ARES_SUCCESS) |
|
||||
*host = NULL; |
|
||||
return status; |
|
||||
} |
|
||||
|
|
||||
static void ptr_rr_name(char *name, const struct ares_addr *addr) |
|
||||
{ |
|
||||
if (addr->family == AF_INET) |
|
||||
{ |
|
||||
unsigned long laddr = ntohl(addr->addrV4.s_addr); |
|
||||
unsigned long a1 = (laddr >> 24UL) & 0xFFUL; |
|
||||
unsigned long a2 = (laddr >> 16UL) & 0xFFUL; |
|
||||
unsigned long a3 = (laddr >> 8UL) & 0xFFUL; |
|
||||
unsigned long a4 = laddr & 0xFFUL; |
|
||||
sprintf(name, "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
unsigned char *bytes = (unsigned char *)&addr->addrV6; |
|
||||
/* There are too many arguments to do this in one line using
|
|
||||
* minimally C89-compliant compilers */ |
|
||||
sprintf(name, |
|
||||
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.", |
|
||||
bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4, |
|
||||
bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4, |
|
||||
bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4, |
|
||||
bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4); |
|
||||
sprintf(name+strlen(name), |
|
||||
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa", |
|
||||
bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4, |
|
||||
bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4, |
|
||||
bytes[3]&0xf, bytes[3] >> 4, bytes[2]&0xf, bytes[2] >> 4, |
|
||||
bytes[1]&0xf, bytes[1] >> 4, bytes[0]&0xf, bytes[0] >> 4); |
|
||||
} |
|
||||
} |
|
@ -1,515 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdio.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include <ctype.h> |
|
||||
#ifdef HAVE_STRINGS_H |
|
||||
#include <strings.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "inet_net_pton.h" |
|
||||
#include "bitncmp.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
#ifdef WATT32 |
|
||||
#undef WIN32 |
|
||||
#endif |
|
||||
|
|
||||
struct host_query { |
|
||||
/* Arguments passed to ares_gethostbyname() */ |
|
||||
ares_channel channel; |
|
||||
char *name; |
|
||||
ares_host_callback callback; |
|
||||
void *arg; |
|
||||
int sent_family; /* this family is what was is being used */ |
|
||||
int want_family; /* this family is what is asked for in the API */ |
|
||||
const char *remaining_lookups; |
|
||||
int timeouts; |
|
||||
}; |
|
||||
|
|
||||
static void next_lookup(struct host_query *hquery, int status_code); |
|
||||
static void host_callback(void *arg, int status, int timeouts, |
|
||||
unsigned char *abuf, int alen); |
|
||||
static void end_hquery(struct host_query *hquery, int status, |
|
||||
struct hostent *host); |
|
||||
static int fake_hostent(const char *name, int family, |
|
||||
ares_host_callback callback, void *arg); |
|
||||
static int file_lookup(const char *name, int family, struct hostent **host); |
|
||||
static void sort_addresses(struct hostent *host, |
|
||||
const struct apattern *sortlist, int nsort); |
|
||||
static void sort6_addresses(struct hostent *host, |
|
||||
const struct apattern *sortlist, int nsort); |
|
||||
static int get_address_index(const struct in_addr *addr, |
|
||||
const struct apattern *sortlist, int nsort); |
|
||||
static int get6_address_index(const struct ares_in6_addr *addr, |
|
||||
const struct apattern *sortlist, int nsort); |
|
||||
|
|
||||
void ares_gethostbyname(ares_channel channel, const char *name, int family, |
|
||||
ares_host_callback callback, void *arg) |
|
||||
{ |
|
||||
struct host_query *hquery; |
|
||||
|
|
||||
/* Right now we only know how to look up Internet addresses - and unspec
|
|
||||
means try both basically. */ |
|
||||
switch (family) { |
|
||||
case AF_INET: |
|
||||
case AF_INET6: |
|
||||
case AF_UNSPEC: |
|
||||
break; |
|
||||
default: |
|
||||
callback(arg, ARES_ENOTIMP, 0, NULL); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
if (fake_hostent(name, family, callback, arg)) |
|
||||
return; |
|
||||
|
|
||||
/* Allocate and fill in the host query structure. */ |
|
||||
hquery = malloc(sizeof(struct host_query)); |
|
||||
if (!hquery) |
|
||||
{ |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL); |
|
||||
return; |
|
||||
} |
|
||||
hquery->channel = channel; |
|
||||
hquery->name = strdup(name); |
|
||||
hquery->want_family = family; |
|
||||
hquery->sent_family = -1; /* nothing is sent yet */ |
|
||||
if (!hquery->name) { |
|
||||
free(hquery); |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL); |
|
||||
return; |
|
||||
} |
|
||||
hquery->callback = callback; |
|
||||
hquery->arg = arg; |
|
||||
hquery->remaining_lookups = channel->lookups; |
|
||||
hquery->timeouts = 0; |
|
||||
|
|
||||
/* Start performing lookups according to channel->lookups. */ |
|
||||
next_lookup(hquery, ARES_ECONNREFUSED /* initial error code */); |
|
||||
} |
|
||||
|
|
||||
static void next_lookup(struct host_query *hquery, int status_code) |
|
||||
{ |
|
||||
const char *p; |
|
||||
struct hostent *host; |
|
||||
int status = status_code; |
|
||||
|
|
||||
for (p = hquery->remaining_lookups; *p; p++) |
|
||||
{ |
|
||||
switch (*p) |
|
||||
{ |
|
||||
case 'b': |
|
||||
/* DNS lookup */ |
|
||||
hquery->remaining_lookups = p + 1; |
|
||||
if ((hquery->want_family == AF_INET6) || |
|
||||
(hquery->want_family == AF_UNSPEC)) { |
|
||||
/* if inet6 or unspec, start out with AAAA */ |
|
||||
hquery->sent_family = AF_INET6; |
|
||||
ares_search(hquery->channel, hquery->name, C_IN, T_AAAA, |
|
||||
host_callback, hquery); |
|
||||
} |
|
||||
else { |
|
||||
hquery->sent_family = AF_INET; |
|
||||
ares_search(hquery->channel, hquery->name, C_IN, T_A, |
|
||||
host_callback, hquery); |
|
||||
} |
|
||||
return; |
|
||||
|
|
||||
case 'f': |
|
||||
/* Host file lookup */ |
|
||||
status = file_lookup(hquery->name, hquery->want_family, &host); |
|
||||
|
|
||||
/* this status check below previously checked for !ARES_ENOTFOUND,
|
|
||||
but we should not assume that this single error code is the one |
|
||||
that can occur, as that is in fact no longer the case */ |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
end_hquery(hquery, status, host); |
|
||||
return; |
|
||||
} |
|
||||
status = status_code; /* Use original status code */ |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
end_hquery(hquery, status, NULL); |
|
||||
} |
|
||||
|
|
||||
static void host_callback(void *arg, int status, int timeouts, |
|
||||
unsigned char *abuf, int alen) |
|
||||
{ |
|
||||
struct host_query *hquery = (struct host_query *) arg; |
|
||||
ares_channel channel = hquery->channel; |
|
||||
struct hostent *host = NULL; |
|
||||
|
|
||||
hquery->timeouts += timeouts; |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
if (hquery->sent_family == AF_INET) |
|
||||
{ |
|
||||
status = ares_parse_a_reply(abuf, alen, &host, NULL, NULL); |
|
||||
if (host && channel->nsort) |
|
||||
sort_addresses(host, channel->sortlist, channel->nsort); |
|
||||
} |
|
||||
else if (hquery->sent_family == AF_INET6) |
|
||||
{ |
|
||||
status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL); |
|
||||
if (status == ARES_ENODATA || status == ARES_EBADRESP) { |
|
||||
/* The query returned something but either there were no AAAA
|
|
||||
records (e.g. just CNAME) or the response was malformed. Try |
|
||||
looking up A instead. We should possibly limit this |
|
||||
attempt-next logic to AF_UNSPEC lookups only. */ |
|
||||
hquery->sent_family = AF_INET; |
|
||||
ares_search(hquery->channel, hquery->name, C_IN, T_A, |
|
||||
host_callback, hquery); |
|
||||
return; |
|
||||
} |
|
||||
if (host && channel->nsort) |
|
||||
sort6_addresses(host, channel->sortlist, channel->nsort); |
|
||||
} |
|
||||
end_hquery(hquery, status, host); |
|
||||
} |
|
||||
else if ((status == ARES_ENODATA || status == ARES_EBADRESP || |
|
||||
status == ARES_ETIMEOUT) && hquery->sent_family == AF_INET6) |
|
||||
{ |
|
||||
/* The AAAA query yielded no useful result. Now look up an A instead.
|
|
||||
We should possibly limit this attempt-next logic to AF_UNSPEC lookups |
|
||||
only. */ |
|
||||
hquery->sent_family = AF_INET; |
|
||||
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback, |
|
||||
hquery); |
|
||||
} |
|
||||
else if (status == ARES_EDESTRUCTION) |
|
||||
end_hquery(hquery, status, NULL); |
|
||||
else |
|
||||
next_lookup(hquery, status); |
|
||||
} |
|
||||
|
|
||||
static void end_hquery(struct host_query *hquery, int status, |
|
||||
struct hostent *host) |
|
||||
{ |
|
||||
hquery->callback(hquery->arg, status, hquery->timeouts, host); |
|
||||
if (host) |
|
||||
ares_free_hostent(host); |
|
||||
free(hquery->name); |
|
||||
free(hquery); |
|
||||
} |
|
||||
|
|
||||
/* If the name looks like an IP address, fake up a host entry, end the
|
|
||||
* query immediately, and return true. Otherwise return false. |
|
||||
*/ |
|
||||
static int fake_hostent(const char *name, int family, |
|
||||
ares_host_callback callback, void *arg) |
|
||||
{ |
|
||||
struct hostent hostent; |
|
||||
char *aliases[1] = { NULL }; |
|
||||
char *addrs[2]; |
|
||||
int result = 0; |
|
||||
struct in_addr in; |
|
||||
struct ares_in6_addr in6; |
|
||||
|
|
||||
if (family == AF_INET || family == AF_INET6) |
|
||||
{ |
|
||||
/* It only looks like an IP address if it's all numbers and dots. */ |
|
||||
int numdots = 0, valid = 1; |
|
||||
const char *p; |
|
||||
for (p = name; *p; p++) |
|
||||
{ |
|
||||
if (!ISDIGIT(*p) && *p != '.') { |
|
||||
valid = 0; |
|
||||
break; |
|
||||
} else if (*p == '.') { |
|
||||
numdots++; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/* if we don't have 3 dots, it is illegal
|
|
||||
* (although inet_addr doesn't think so). |
|
||||
*/ |
|
||||
if (numdots != 3 || !valid) |
|
||||
result = 0; |
|
||||
else |
|
||||
result = ((in.s_addr = inet_addr(name)) == INADDR_NONE ? 0 : 1); |
|
||||
|
|
||||
if (result) |
|
||||
family = AF_INET; |
|
||||
} |
|
||||
if (family == AF_INET6) |
|
||||
result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1); |
|
||||
|
|
||||
if (!result) |
|
||||
return 0; |
|
||||
|
|
||||
if (family == AF_INET) |
|
||||
{ |
|
||||
hostent.h_length = (int)sizeof(struct in_addr); |
|
||||
addrs[0] = (char *)∈ |
|
||||
} |
|
||||
else if (family == AF_INET6) |
|
||||
{ |
|
||||
hostent.h_length = (int)sizeof(struct ares_in6_addr); |
|
||||
addrs[0] = (char *)&in6; |
|
||||
} |
|
||||
/* Duplicate the name, to avoid a constness violation. */ |
|
||||
hostent.h_name = strdup(name); |
|
||||
if (!hostent.h_name) |
|
||||
{ |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL); |
|
||||
return 1; |
|
||||
} |
|
||||
|
|
||||
/* Fill in the rest of the host structure and terminate the query. */ |
|
||||
addrs[1] = NULL; |
|
||||
hostent.h_aliases = aliases; |
|
||||
hostent.h_addrtype = family; |
|
||||
hostent.h_addr_list = addrs; |
|
||||
callback(arg, ARES_SUCCESS, 0, &hostent); |
|
||||
|
|
||||
free((char *)(hostent.h_name)); |
|
||||
return 1; |
|
||||
} |
|
||||
|
|
||||
/* This is an API method */ |
|
||||
int ares_gethostbyname_file(ares_channel channel, const char *name, |
|
||||
int family, struct hostent **host) |
|
||||
{ |
|
||||
int result; |
|
||||
|
|
||||
/* We only take the channel to ensure that ares_init() been called. */ |
|
||||
if(channel == NULL) |
|
||||
{ |
|
||||
/* Anything will do, really. This seems fine, and is consistent with
|
|
||||
other error cases. */ |
|
||||
*host = NULL; |
|
||||
return ARES_ENOTFOUND; |
|
||||
} |
|
||||
|
|
||||
/* Just chain to the internal implementation we use here; it's exactly
|
|
||||
* what we want. |
|
||||
*/ |
|
||||
result = file_lookup(name, family, host); |
|
||||
if(result != ARES_SUCCESS) |
|
||||
{ |
|
||||
/* We guarantee a NULL hostent on failure. */ |
|
||||
*host = NULL; |
|
||||
} |
|
||||
return result; |
|
||||
} |
|
||||
|
|
||||
static int file_lookup(const char *name, int family, struct hostent **host) |
|
||||
{ |
|
||||
FILE *fp; |
|
||||
char **alias; |
|
||||
int status; |
|
||||
int error; |
|
||||
|
|
||||
#ifdef WIN32 |
|
||||
char PATH_HOSTS[MAX_PATH]; |
|
||||
if (IS_NT()) { |
|
||||
char tmp[MAX_PATH]; |
|
||||
HKEY hkeyHosts; |
|
||||
|
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, |
|
||||
&hkeyHosts) == ERROR_SUCCESS) |
|
||||
{ |
|
||||
DWORD dwLength = MAX_PATH; |
|
||||
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, |
|
||||
&dwLength); |
|
||||
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH); |
|
||||
RegCloseKey(hkeyHosts); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
GetWindowsDirectory(PATH_HOSTS, MAX_PATH); |
|
||||
|
|
||||
strcat(PATH_HOSTS, WIN_PATH_HOSTS); |
|
||||
|
|
||||
#elif defined(WATT32) |
|
||||
extern const char *_w32_GetHostsFile (void); |
|
||||
const char *PATH_HOSTS = _w32_GetHostsFile(); |
|
||||
|
|
||||
if (!PATH_HOSTS) |
|
||||
return ARES_ENOTFOUND; |
|
||||
#endif |
|
||||
|
|
||||
fp = fopen(PATH_HOSTS, "r"); |
|
||||
if (!fp) |
|
||||
{ |
|
||||
error = ERRNO; |
|
||||
switch(error) |
|
||||
{ |
|
||||
case ENOENT: |
|
||||
case ESRCH: |
|
||||
return ARES_ENOTFOUND; |
|
||||
default: |
|
||||
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", |
|
||||
error, strerror(error))); |
|
||||
DEBUGF(fprintf(stderr, "Error opening file: %s\n", |
|
||||
PATH_HOSTS)); |
|
||||
*host = NULL; |
|
||||
return ARES_EFILE; |
|
||||
} |
|
||||
} |
|
||||
while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS) |
|
||||
{ |
|
||||
if (strcasecmp((*host)->h_name, name) == 0) |
|
||||
break; |
|
||||
for (alias = (*host)->h_aliases; *alias; alias++) |
|
||||
{ |
|
||||
if (strcasecmp(*alias, name) == 0) |
|
||||
break; |
|
||||
} |
|
||||
if (*alias) |
|
||||
break; |
|
||||
ares_free_hostent(*host); |
|
||||
} |
|
||||
fclose(fp); |
|
||||
if (status == ARES_EOF) |
|
||||
status = ARES_ENOTFOUND; |
|
||||
if (status != ARES_SUCCESS) |
|
||||
*host = NULL; |
|
||||
return status; |
|
||||
} |
|
||||
|
|
||||
static void sort_addresses(struct hostent *host, |
|
||||
const struct apattern *sortlist, int nsort) |
|
||||
{ |
|
||||
struct in_addr a1, a2; |
|
||||
int i1, i2, ind1, ind2; |
|
||||
|
|
||||
/* This is a simple insertion sort, not optimized at all. i1 walks
|
|
||||
* through the address list, with the loop invariant that everything |
|
||||
* to the left of i1 is sorted. In the loop body, the value at i1 is moved |
|
||||
* back through the list (via i2) until it is in sorted order. |
|
||||
*/ |
|
||||
for (i1 = 0; host->h_addr_list[i1]; i1++) |
|
||||
{ |
|
||||
memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr)); |
|
||||
ind1 = get_address_index(&a1, sortlist, nsort); |
|
||||
for (i2 = i1 - 1; i2 >= 0; i2--) |
|
||||
{ |
|
||||
memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr)); |
|
||||
ind2 = get_address_index(&a2, sortlist, nsort); |
|
||||
if (ind2 <= ind1) |
|
||||
break; |
|
||||
memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr)); |
|
||||
} |
|
||||
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr)); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/* Find the first entry in sortlist which matches addr. Return nsort
|
|
||||
* if none of them match. |
|
||||
*/ |
|
||||
static int get_address_index(const struct in_addr *addr, |
|
||||
const struct apattern *sortlist, |
|
||||
int nsort) |
|
||||
{ |
|
||||
int i; |
|
||||
|
|
||||
for (i = 0; i < nsort; i++) |
|
||||
{ |
|
||||
if (sortlist[i].family != AF_INET) |
|
||||
continue; |
|
||||
if (sortlist[i].type == PATTERN_MASK) |
|
||||
{ |
|
||||
if ((addr->s_addr & sortlist[i].mask.addr4.s_addr) |
|
||||
== sortlist[i].addrV4.s_addr) |
|
||||
break; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
if (!ares_bitncmp(&addr->s_addr, &sortlist[i].addrV4.s_addr, |
|
||||
sortlist[i].mask.bits)) |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
return i; |
|
||||
} |
|
||||
|
|
||||
static void sort6_addresses(struct hostent *host, |
|
||||
const struct apattern *sortlist, int nsort) |
|
||||
{ |
|
||||
struct ares_in6_addr a1, a2; |
|
||||
int i1, i2, ind1, ind2; |
|
||||
|
|
||||
/* This is a simple insertion sort, not optimized at all. i1 walks
|
|
||||
* through the address list, with the loop invariant that everything |
|
||||
* to the left of i1 is sorted. In the loop body, the value at i1 is moved |
|
||||
* back through the list (via i2) until it is in sorted order. |
|
||||
*/ |
|
||||
for (i1 = 0; host->h_addr_list[i1]; i1++) |
|
||||
{ |
|
||||
memcpy(&a1, host->h_addr_list[i1], sizeof(struct ares_in6_addr)); |
|
||||
ind1 = get6_address_index(&a1, sortlist, nsort); |
|
||||
for (i2 = i1 - 1; i2 >= 0; i2--) |
|
||||
{ |
|
||||
memcpy(&a2, host->h_addr_list[i2], sizeof(struct ares_in6_addr)); |
|
||||
ind2 = get6_address_index(&a2, sortlist, nsort); |
|
||||
if (ind2 <= ind1) |
|
||||
break; |
|
||||
memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct ares_in6_addr)); |
|
||||
} |
|
||||
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct ares_in6_addr)); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/* Find the first entry in sortlist which matches addr. Return nsort
|
|
||||
* if none of them match. |
|
||||
*/ |
|
||||
static int get6_address_index(const struct ares_in6_addr *addr, |
|
||||
const struct apattern *sortlist, |
|
||||
int nsort) |
|
||||
{ |
|
||||
int i; |
|
||||
|
|
||||
for (i = 0; i < nsort; i++) |
|
||||
{ |
|
||||
if (sortlist[i].family != AF_INET6) |
|
||||
continue; |
|
||||
if (!ares_bitncmp(addr, |
|
||||
&sortlist[i].addrV6, |
|
||||
sortlist[i].mask.bits)) |
|
||||
break; |
|
||||
} |
|
||||
return i; |
|
||||
} |
|
@ -1,426 +0,0 @@ |
|||||
|
|
||||
/* Copyright 2005 by Dominick Meglio
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_GETSERVBYPORT_R |
|
||||
# if !defined(GETSERVBYPORT_R_ARGS) || \ |
|
||||
(GETSERVBYPORT_R_ARGS < 4) || (GETSERVBYPORT_R_ARGS > 6) |
|
||||
# error "you MUST specifiy a valid number of arguments for getservbyport_r" |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_NET_IF_H |
|
||||
#include <net/if.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_UNISTD_H |
|
||||
#include <unistd.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdio.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_ipv6.h" |
|
||||
#include "inet_ntop.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
struct nameinfo_query { |
|
||||
ares_nameinfo_callback callback; |
|
||||
void *arg; |
|
||||
union { |
|
||||
struct sockaddr_in addr4; |
|
||||
struct sockaddr_in6 addr6; |
|
||||
} addr; |
|
||||
int family; |
|
||||
int flags; |
|
||||
int timeouts; |
|
||||
}; |
|
||||
|
|
||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID |
|
||||
#define IPBUFSIZ \ |
|
||||
(sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + IF_NAMESIZE) |
|
||||
#else |
|
||||
#define IPBUFSIZ \ |
|
||||
(sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")) |
|
||||
#endif |
|
||||
|
|
||||
static void nameinfo_callback(void *arg, int status, int timeouts, |
|
||||
struct hostent *host); |
|
||||
static char *lookup_service(unsigned short port, int flags, |
|
||||
char *buf, size_t buflen); |
|
||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID |
|
||||
static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int scopeid, |
|
||||
char *buf, size_t buflen); |
|
||||
#endif |
|
||||
static char *ares_striendstr(const char *s1, const char *s2); |
|
||||
|
|
||||
void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, |
|
||||
ares_socklen_t salen, |
|
||||
int flags, ares_nameinfo_callback callback, void *arg) |
|
||||
{ |
|
||||
struct sockaddr_in *addr = NULL; |
|
||||
struct sockaddr_in6 *addr6 = NULL; |
|
||||
struct nameinfo_query *niquery; |
|
||||
unsigned int port = 0; |
|
||||
|
|
||||
/* Validate socket address family and length */ |
|
||||
if ((sa->sa_family == AF_INET) && |
|
||||
(salen == sizeof(struct sockaddr_in))) |
|
||||
{ |
|
||||
addr = (struct sockaddr_in *)sa; |
|
||||
port = addr->sin_port; |
|
||||
} |
|
||||
else if ((sa->sa_family == AF_INET6) && |
|
||||
(salen == sizeof(struct sockaddr_in6))) |
|
||||
{ |
|
||||
addr6 = (struct sockaddr_in6 *)sa; |
|
||||
port = addr6->sin6_port; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
callback(arg, ARES_ENOTIMP, 0, NULL, NULL); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
/* If neither, assume they want a host */ |
|
||||
if (!(flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST)) |
|
||||
flags |= ARES_NI_LOOKUPHOST; |
|
||||
|
|
||||
/* All they want is a service, no need for DNS */ |
|
||||
if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST)) |
|
||||
{ |
|
||||
char buf[33], *service; |
|
||||
|
|
||||
service = lookup_service((unsigned short)(port & 0xffff), |
|
||||
flags, buf, sizeof(buf)); |
|
||||
callback(arg, ARES_SUCCESS, 0, NULL, service); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
/* They want a host lookup */ |
|
||||
if ((flags & ARES_NI_LOOKUPHOST)) |
|
||||
{ |
|
||||
/* A numeric host can be handled without DNS */ |
|
||||
if ((flags & ARES_NI_NUMERICHOST)) |
|
||||
{ |
|
||||
char ipbuf[IPBUFSIZ]; |
|
||||
char srvbuf[33]; |
|
||||
char *service = NULL; |
|
||||
ipbuf[0] = 0; |
|
||||
|
|
||||
/* Specifying not to lookup a host, but then saying a host
|
|
||||
* is required has to be illegal. |
|
||||
*/ |
|
||||
if (flags & ARES_NI_NAMEREQD) |
|
||||
{ |
|
||||
callback(arg, ARES_EBADFLAGS, 0, NULL, NULL); |
|
||||
return; |
|
||||
} |
|
||||
if (salen == sizeof(struct sockaddr_in6)) |
|
||||
{ |
|
||||
ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ); |
|
||||
/* If the system supports scope IDs, use it */ |
|
||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID |
|
||||
append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf)); |
|
||||
#endif |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ); |
|
||||
} |
|
||||
/* They also want a service */ |
|
||||
if (flags & ARES_NI_LOOKUPSERVICE) |
|
||||
service = lookup_service((unsigned short)(port & 0xffff), |
|
||||
flags, srvbuf, sizeof(srvbuf)); |
|
||||
callback(arg, ARES_SUCCESS, 0, ipbuf, service); |
|
||||
return; |
|
||||
} |
|
||||
/* This is where a DNS lookup becomes necessary */ |
|
||||
else |
|
||||
{ |
|
||||
niquery = malloc(sizeof(struct nameinfo_query)); |
|
||||
if (!niquery) |
|
||||
{ |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, NULL); |
|
||||
return; |
|
||||
} |
|
||||
niquery->callback = callback; |
|
||||
niquery->arg = arg; |
|
||||
niquery->flags = flags; |
|
||||
niquery->timeouts = 0; |
|
||||
if (sa->sa_family == AF_INET) |
|
||||
{ |
|
||||
niquery->family = AF_INET; |
|
||||
memcpy(&niquery->addr.addr4, addr, sizeof(addr)); |
|
||||
ares_gethostbyaddr(channel, &addr->sin_addr, |
|
||||
sizeof(struct in_addr), AF_INET, |
|
||||
nameinfo_callback, niquery); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
niquery->family = AF_INET6; |
|
||||
memcpy(&niquery->addr.addr6, addr6, sizeof(addr6)); |
|
||||
ares_gethostbyaddr(channel, &addr6->sin6_addr, |
|
||||
sizeof(struct ares_in6_addr), AF_INET6, |
|
||||
nameinfo_callback, niquery); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
static void nameinfo_callback(void *arg, int status, int timeouts, |
|
||||
struct hostent *host) |
|
||||
{ |
|
||||
struct nameinfo_query *niquery = (struct nameinfo_query *) arg; |
|
||||
char srvbuf[33]; |
|
||||
char *service = NULL; |
|
||||
|
|
||||
niquery->timeouts += timeouts; |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
/* They want a service too */ |
|
||||
if (niquery->flags & ARES_NI_LOOKUPSERVICE) |
|
||||
{ |
|
||||
if (niquery->family == AF_INET) |
|
||||
service = lookup_service(niquery->addr.addr4.sin_port, |
|
||||
niquery->flags, srvbuf, sizeof(srvbuf)); |
|
||||
else |
|
||||
service = lookup_service(niquery->addr.addr6.sin6_port, |
|
||||
niquery->flags, srvbuf, sizeof(srvbuf)); |
|
||||
} |
|
||||
/* NOFQDN means we have to strip off the domain name portion. We do
|
|
||||
this by determining our own domain name, then searching the string |
|
||||
for this domain name and removing it. |
|
||||
*/ |
|
||||
#ifdef HAVE_GETHOSTNAME |
|
||||
if (niquery->flags & ARES_NI_NOFQDN) |
|
||||
{ |
|
||||
char buf[255]; |
|
||||
char *domain; |
|
||||
gethostname(buf, 255); |
|
||||
if ((domain = strchr(buf, '.')) != NULL) |
|
||||
{ |
|
||||
char *end = ares_striendstr(host->h_name, domain); |
|
||||
if (end) |
|
||||
*end = 0; |
|
||||
} |
|
||||
} |
|
||||
#endif |
|
||||
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, |
|
||||
(char *)(host->h_name), |
|
||||
service); |
|
||||
free(niquery); |
|
||||
return; |
|
||||
} |
|
||||
/* We couldn't find the host, but it's OK, we can use the IP */ |
|
||||
else if (status == ARES_ENOTFOUND && !(niquery->flags & ARES_NI_NAMEREQD)) |
|
||||
{ |
|
||||
char ipbuf[IPBUFSIZ]; |
|
||||
if (niquery->family == AF_INET) |
|
||||
ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, |
|
||||
IPBUFSIZ); |
|
||||
else |
|
||||
{ |
|
||||
ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, |
|
||||
IPBUFSIZ); |
|
||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID |
|
||||
append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf, |
|
||||
sizeof(ipbuf)); |
|
||||
#endif |
|
||||
} |
|
||||
/* They want a service too */ |
|
||||
if (niquery->flags & ARES_NI_LOOKUPSERVICE) |
|
||||
{ |
|
||||
if (niquery->family == AF_INET) |
|
||||
service = lookup_service(niquery->addr.addr4.sin_port, |
|
||||
niquery->flags, srvbuf, sizeof(srvbuf)); |
|
||||
else |
|
||||
service = lookup_service(niquery->addr.addr6.sin6_port, |
|
||||
niquery->flags, srvbuf, sizeof(srvbuf)); |
|
||||
} |
|
||||
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf, |
|
||||
service); |
|
||||
free(niquery); |
|
||||
return; |
|
||||
} |
|
||||
niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL); |
|
||||
free(niquery); |
|
||||
} |
|
||||
|
|
||||
static char *lookup_service(unsigned short port, int flags, |
|
||||
char *buf, size_t buflen) |
|
||||
{ |
|
||||
const char *proto; |
|
||||
struct servent *sep; |
|
||||
#ifdef HAVE_GETSERVBYPORT_R |
|
||||
struct servent se; |
|
||||
#endif |
|
||||
char tmpbuf[4096]; |
|
||||
|
|
||||
if (port) |
|
||||
{ |
|
||||
if (flags & ARES_NI_NUMERICSERV) |
|
||||
sep = NULL; |
|
||||
else |
|
||||
{ |
|
||||
if (flags & ARES_NI_UDP) |
|
||||
proto = "udp"; |
|
||||
else if (flags & ARES_NI_SCTP) |
|
||||
proto = "sctp"; |
|
||||
else if (flags & ARES_NI_DCCP) |
|
||||
proto = "dccp"; |
|
||||
else |
|
||||
proto = "tcp"; |
|
||||
#ifdef HAVE_GETSERVBYPORT_R |
|
||||
sep = &se; |
|
||||
memset(tmpbuf, 0, sizeof(tmpbuf)); |
|
||||
#if GETSERVBYPORT_R_ARGS == 6 |
|
||||
if (getservbyport_r(port, proto, &se, (void *)tmpbuf, |
|
||||
sizeof(tmpbuf), &sep) != 0) |
|
||||
sep = NULL; |
|
||||
#elif GETSERVBYPORT_R_ARGS == 5 |
|
||||
sep = getservbyport_r(port, proto, &se, (void *)tmpbuf, |
|
||||
sizeof(tmpbuf)); |
|
||||
#elif GETSERVBYPORT_R_ARGS == 4 |
|
||||
if (getservbyport_r(port, proto, &se, (void *)tmpbuf) != 0) |
|
||||
sep = NULL; |
|
||||
#else |
|
||||
/* Lets just hope the OS uses TLS! */ |
|
||||
sep = getservbyport(port, proto); |
|
||||
#endif |
|
||||
#else |
|
||||
/* Lets just hope the OS uses TLS! */ |
|
||||
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) |
|
||||
sep = getservbyport(port, (char*)proto); |
|
||||
#else |
|
||||
sep = getservbyport(port, proto); |
|
||||
#endif |
|
||||
#endif |
|
||||
} |
|
||||
if (sep && sep->s_name) |
|
||||
/* get service name */ |
|
||||
strcpy(tmpbuf, sep->s_name); |
|
||||
else |
|
||||
/* get port as a string */ |
|
||||
sprintf(tmpbuf, "%u", (unsigned int)ntohs(port)); |
|
||||
if (strlen(tmpbuf) < buflen) |
|
||||
/* return it if buffer big enough */ |
|
||||
strcpy(buf, tmpbuf); |
|
||||
else |
|
||||
/* avoid reusing previous one */ |
|
||||
buf[0] = '\0'; |
|
||||
return buf; |
|
||||
} |
|
||||
buf[0] = '\0'; |
|
||||
return NULL; |
|
||||
} |
|
||||
|
|
||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID |
|
||||
static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, |
|
||||
char *buf, size_t buflen) |
|
||||
{ |
|
||||
#ifdef HAVE_IF_INDEXTONAME |
|
||||
int is_ll, is_mcll; |
|
||||
#endif |
|
||||
static const char fmt_u[] = "%u"; |
|
||||
static const char fmt_lu[] = "%lu"; |
|
||||
char tmpbuf[IF_NAMESIZE + 2]; |
|
||||
size_t bufl; |
|
||||
const char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))? |
|
||||
fmt_lu:fmt_u; |
|
||||
|
|
||||
tmpbuf[0] = '%'; |
|
||||
|
|
||||
#ifdef HAVE_IF_INDEXTONAME |
|
||||
is_ll = IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr); |
|
||||
is_mcll = IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr); |
|
||||
if ((flags & ARES_NI_NUMERICSCOPE) || |
|
||||
(!is_ll && !is_mcll)) |
|
||||
{ |
|
||||
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL) |
|
||||
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); |
|
||||
} |
|
||||
#else |
|
||||
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); |
|
||||
(void) flags; |
|
||||
#endif |
|
||||
tmpbuf[IF_NAMESIZE + 1] = '\0'; |
|
||||
bufl = strlen(buf); |
|
||||
|
|
||||
if(bufl + strlen(tmpbuf) < buflen) |
|
||||
/* only append the scopeid string if it fits in the target buffer */ |
|
||||
strcpy(&buf[bufl], tmpbuf); |
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
/* Determines if s1 ends with the string in s2 (case-insensitive) */ |
|
||||
static char *ares_striendstr(const char *s1, const char *s2) |
|
||||
{ |
|
||||
const char *c1, *c2, *c1_begin; |
|
||||
int lo1, lo2; |
|
||||
size_t s1_len = strlen(s1), s2_len = strlen(s2); |
|
||||
|
|
||||
/* If the substr is longer than the full str, it can't match */ |
|
||||
if (s2_len > s1_len) |
|
||||
return NULL; |
|
||||
|
|
||||
/* Jump to the end of s1 minus the length of s2 */ |
|
||||
c1_begin = s1+s1_len-s2_len; |
|
||||
c1 = (const char *)c1_begin; |
|
||||
c2 = s2; |
|
||||
while (c2 < s2+s2_len) |
|
||||
{ |
|
||||
lo1 = TOLOWER(*c1); |
|
||||
lo2 = TOLOWER(*c2); |
|
||||
if (lo1 != lo2) |
|
||||
return NULL; |
|
||||
else |
|
||||
{ |
|
||||
c1++; |
|
||||
c2++; |
|
||||
} |
|
||||
} |
|
||||
if (c2 == c1 && c2 == NULL) |
|
||||
return (char *)c1_begin; |
|
||||
return NULL; |
|
||||
} |
|
@ -1,122 +0,0 @@ |
|||||
/*
|
|
||||
* Original file name getopt.c Initial import into the c-ares source tree |
|
||||
* on 2007-04-11. Lifted from version 5.2 of the 'Open Mash' project with |
|
||||
* the modified BSD license, BSD license without the advertising clause. |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
/*
|
|
||||
* getopt.c -- |
|
||||
* |
|
||||
* Standard UNIX getopt function. Code is from BSD. |
|
||||
* |
|
||||
* Copyright (c) 1987-2001 The Regents of the University of California. |
|
||||
* All rights reserved. |
|
||||
* |
|
||||
* Redistribution and use in source and binary forms, with or without |
|
||||
* modification, are permitted provided that the following conditions are met: |
|
||||
* |
|
||||
* A. Redistributions of source code must retain the above copyright notice, |
|
||||
* this list of conditions and the following disclaimer. |
|
||||
* B. Redistributions in binary form must reproduce the above copyright notice, |
|
||||
* this list of conditions and the following disclaimer in the documentation |
|
||||
* and/or other materials provided with the distribution. |
|
||||
* C. Neither the names of the copyright holders nor the names of its |
|
||||
* contributors may be used to endorse or promote products derived from this |
|
||||
* software without specific prior written permission. |
|
||||
* |
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS |
|
||||
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE |
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
* POSSIBILITY OF SUCH DAMAGE. |
|
||||
*/ |
|
||||
|
|
||||
/* #if !defined(lint)
|
|
||||
* static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94"; |
|
||||
* #endif |
|
||||
*/ |
|
||||
|
|
||||
#include <stdio.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include "ares_getopt.h" |
|
||||
|
|
||||
int opterr = 1, /* if error message should be printed */ |
|
||||
optind = 1; /* index into parent argv vector */ |
|
||||
int optopt = 0; /* character checked for validity */ |
|
||||
static int optreset; /* reset getopt */ |
|
||||
char *optarg; /* argument associated with option */ |
|
||||
|
|
||||
#define BADCH (int)'?' |
|
||||
#define BADARG (int)':' |
|
||||
#define EMSG (char *)"" |
|
||||
|
|
||||
/*
|
|
||||
* ares_getopt -- |
|
||||
* Parse argc/argv argument vector. |
|
||||
*/ |
|
||||
int |
|
||||
ares_getopt(int nargc, char * const nargv[], const char *ostr) |
|
||||
{ |
|
||||
static char *place = EMSG; /* option letter processing */ |
|
||||
char *oli; /* option letter list index */ |
|
||||
|
|
||||
if (optreset || !*place) { /* update scanning pointer */ |
|
||||
optreset = 0; |
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') { |
|
||||
place = EMSG; |
|
||||
return (EOF); |
|
||||
} |
|
||||
if (place[1] && *++place == '-') { /* found "--" */ |
|
||||
++optind; |
|
||||
place = EMSG; |
|
||||
return (EOF); |
|
||||
} |
|
||||
} /* option letter okay? */ |
|
||||
if ((optopt = (int)*place++) == (int)':' || |
|
||||
(oli = strchr(ostr, optopt)) == NULL) { |
|
||||
/*
|
|
||||
* if the user didn't specify '-' as an option, |
|
||||
* assume it means EOF. |
|
||||
*/ |
|
||||
if (optopt == (int)'-') |
|
||||
return (EOF); |
|
||||
if (!*place) |
|
||||
++optind; |
|
||||
if (opterr && *ostr != ':') |
|
||||
(void)fprintf(stderr, |
|
||||
"%s: illegal option -- %c\n", __FILE__, optopt); |
|
||||
return (BADCH); |
|
||||
} |
|
||||
if (*++oli != ':') { /* don't need argument */ |
|
||||
optarg = NULL; |
|
||||
if (!*place) |
|
||||
++optind; |
|
||||
} |
|
||||
else { /* need an argument */ |
|
||||
if (*place) /* no white space */ |
|
||||
optarg = place; |
|
||||
else if (nargc <= ++optind) { /* no arg */ |
|
||||
place = EMSG; |
|
||||
if (*ostr == ':') |
|
||||
return (BADARG); |
|
||||
if (opterr) |
|
||||
(void)fprintf(stderr, |
|
||||
"%s: option requires an argument -- %c\n", |
|
||||
__FILE__, optopt); |
|
||||
return (BADCH); |
|
||||
} |
|
||||
else /* white space */ |
|
||||
optarg = nargv[optind]; |
|
||||
place = EMSG; |
|
||||
++optind; |
|
||||
} |
|
||||
return (optopt); /* dump back option letter */ |
|
||||
} |
|
@ -1,53 +0,0 @@ |
|||||
#ifndef ARES_GETOPT_H |
|
||||
#define ARES_GETOPT_H |
|
||||
|
|
||||
/*
|
|
||||
* Copyright (c) 1987-2001 The Regents of the University of California. |
|
||||
* All rights reserved. |
|
||||
* |
|
||||
* Redistribution and use in source and binary forms, with or without |
|
||||
* modification, are permitted provided that the following conditions are met: |
|
||||
* |
|
||||
* A. Redistributions of source code must retain the above copyright notice, |
|
||||
* this list of conditions and the following disclaimer. |
|
||||
* B. Redistributions in binary form must reproduce the above copyright notice, |
|
||||
* this list of conditions and the following disclaimer in the documentation |
|
||||
* and/or other materials provided with the distribution. |
|
||||
* C. Neither the names of the copyright holders nor the names of its |
|
||||
* contributors may be used to endorse or promote products derived from this |
|
||||
* software without specific prior written permission. |
|
||||
* |
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS |
|
||||
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE |
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
* POSSIBILITY OF SUCH DAMAGE. |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
int ares_getopt(int nargc, char * const nargv[], const char *ostr); |
|
||||
|
|
||||
#undef optarg |
|
||||
#undef optind |
|
||||
#undef opterr |
|
||||
#undef optopt |
|
||||
#undef optreset |
|
||||
|
|
||||
#define optarg ares_optarg |
|
||||
#define optind ares_optind |
|
||||
#define opterr ares_opterr |
|
||||
#define optopt ares_optopt |
|
||||
#define optreset ares_optreset |
|
||||
|
|
||||
extern char *optarg; |
|
||||
extern int optind; |
|
||||
extern int opterr; |
|
||||
extern int optopt; |
|
||||
|
|
||||
#endif /* ARES_GETOPT_H */ |
|
@ -1,72 +0,0 @@ |
|||||
|
|
||||
/* Copyright (C) 2005 - 2010, 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. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_TIME_H |
|
||||
#include <sys/time.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int ares_getsock(ares_channel channel, |
|
||||
ares_socket_t *socks, |
|
||||
int numsocks) /* size of the 'socks' array */ |
|
||||
{ |
|
||||
struct server_state *server; |
|
||||
int i; |
|
||||
int sockindex=0; |
|
||||
int bitmap = 0; |
|
||||
unsigned int setbits = 0xffffffff; |
|
||||
|
|
||||
/* Are there any active queries? */ |
|
||||
int active_queries = !ares__is_list_empty(&(channel->all_queries)); |
|
||||
|
|
||||
for (i = 0; |
|
||||
(i < channel->nservers) && (sockindex < ARES_GETSOCK_MAXNUM); |
|
||||
i++) |
|
||||
{ |
|
||||
server = &channel->servers[i]; |
|
||||
/* We only need to register interest in UDP sockets if we have
|
|
||||
* outstanding queries. |
|
||||
*/ |
|
||||
if (active_queries && server->udp_socket != ARES_SOCKET_BAD) |
|
||||
{ |
|
||||
if(sockindex >= numsocks) |
|
||||
break; |
|
||||
socks[sockindex] = server->udp_socket; |
|
||||
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); |
|
||||
sockindex++; |
|
||||
} |
|
||||
/* We always register for TCP events, because we want to know
|
|
||||
* when the other side closes the connection, so we don't waste |
|
||||
* time trying to use a broken connection. |
|
||||
*/ |
|
||||
if (server->tcp_socket != ARES_SOCKET_BAD) |
|
||||
{ |
|
||||
if(sockindex >= numsocks) |
|
||||
break; |
|
||||
socks[sockindex] = server->tcp_socket; |
|
||||
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); |
|
||||
|
|
||||
if (server->qhead && active_queries) |
|
||||
/* then the tcp socket is also writable! */ |
|
||||
bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex); |
|
||||
|
|
||||
sockindex++; |
|
||||
} |
|
||||
} |
|
||||
return bitmap; |
|
||||
} |
|
File diff suppressed because it is too large
@ -1,78 +0,0 @@ |
|||||
|
|
||||
/* Copyright (C) 2005 by Dominick Meglio
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef ARES_IPV6_H |
|
||||
#define ARES_IPV6_H |
|
||||
|
|
||||
#ifndef HAVE_PF_INET6 |
|
||||
#define PF_INET6 AF_INET6 |
|
||||
#endif |
|
||||
|
|
||||
#ifndef HAVE_STRUCT_SOCKADDR_IN6 |
|
||||
struct sockaddr_in6 |
|
||||
{ |
|
||||
unsigned short sin6_family; |
|
||||
unsigned short sin6_port; |
|
||||
unsigned long sin6_flowinfo; |
|
||||
struct ares_in6_addr sin6_addr; |
|
||||
unsigned int sin6_scope_id; |
|
||||
}; |
|
||||
#endif |
|
||||
|
|
||||
#ifndef HAVE_STRUCT_ADDRINFO |
|
||||
struct addrinfo |
|
||||
{ |
|
||||
int ai_flags; |
|
||||
int ai_family; |
|
||||
int ai_socktype; |
|
||||
int ai_protocol; |
|
||||
ares_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ |
|
||||
char *ai_canonname; |
|
||||
struct sockaddr *ai_addr; |
|
||||
struct addrinfo *ai_next; |
|
||||
}; |
|
||||
#endif |
|
||||
|
|
||||
#ifndef NS_IN6ADDRSZ |
|
||||
#if SIZEOF_STRUCT_IN6_ADDR == 0 |
|
||||
/* We cannot have it set to zero, so we pick a fixed value here */ |
|
||||
#define NS_IN6ADDRSZ 16 |
|
||||
#else |
|
||||
#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR |
|
||||
#endif |
|
||||
#endif |
|
||||
|
|
||||
#ifndef NS_INADDRSZ |
|
||||
#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR |
|
||||
#endif |
|
||||
|
|
||||
#ifndef NS_INT16SZ |
|
||||
#define NS_INT16SZ 2 |
|
||||
#endif |
|
||||
|
|
||||
#ifndef IF_NAMESIZE |
|
||||
#ifdef IFNAMSIZ |
|
||||
#define IF_NAMESIZE IFNAMSIZ |
|
||||
#else |
|
||||
#define IF_NAMESIZE 256 |
|
||||
#endif |
|
||||
#endif |
|
||||
|
|
||||
/* Defined in ares_net_pton.c for no particular reason. */ |
|
||||
extern const struct ares_in6_addr ares_in6addr_any; /* :: */ |
|
||||
|
|
||||
|
|
||||
#endif /* ARES_IPV6_H */ |
|
@ -1,132 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2004-2009 by Daniel Stenberg |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_library_init.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
/* library-private global and unique instance vars */ |
|
||||
|
|
||||
#ifdef USE_WINSOCK |
|
||||
fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL; |
|
||||
fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL; |
|
||||
#endif |
|
||||
|
|
||||
/* library-private global vars with source visibility restricted to this file */ |
|
||||
|
|
||||
static unsigned int ares_initialized; |
|
||||
static int ares_init_flags; |
|
||||
|
|
||||
#ifdef USE_WINSOCK |
|
||||
static HMODULE hnd_iphlpapi; |
|
||||
static HMODULE hnd_advapi32; |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
static int ares_win32_init(void) |
|
||||
{ |
|
||||
#ifdef USE_WINSOCK |
|
||||
|
|
||||
hnd_iphlpapi = 0; |
|
||||
hnd_iphlpapi = LoadLibrary("iphlpapi.dll"); |
|
||||
if (!hnd_iphlpapi) |
|
||||
return ARES_ELOADIPHLPAPI; |
|
||||
|
|
||||
ares_fpGetNetworkParams = (fpGetNetworkParams_t) |
|
||||
GetProcAddress(hnd_iphlpapi, "GetNetworkParams"); |
|
||||
if (!ares_fpGetNetworkParams) |
|
||||
{ |
|
||||
FreeLibrary(hnd_iphlpapi); |
|
||||
return ARES_EADDRGETNETWORKPARAMS; |
|
||||
} |
|
||||
|
|
||||
/*
|
|
||||
* When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036, |
|
||||
* also known as RtlGenRandom, which is the case for Windows versions prior |
|
||||
* to WinXP then c-ares uses portable rand() function. Then don't error here. |
|
||||
*/ |
|
||||
|
|
||||
hnd_advapi32 = 0; |
|
||||
hnd_advapi32 = LoadLibrary("advapi32.dll"); |
|
||||
if (hnd_advapi32) |
|
||||
{ |
|
||||
ares_fpSystemFunction036 = (fpSystemFunction036_t) |
|
||||
GetProcAddress(hnd_advapi32, "SystemFunction036"); |
|
||||
} |
|
||||
|
|
||||
#endif |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
static void ares_win32_cleanup(void) |
|
||||
{ |
|
||||
#ifdef USE_WINSOCK |
|
||||
if (hnd_advapi32) |
|
||||
FreeLibrary(hnd_advapi32); |
|
||||
if (hnd_iphlpapi) |
|
||||
FreeLibrary(hnd_iphlpapi); |
|
||||
#endif |
|
||||
} |
|
||||
|
|
||||
|
|
||||
int ares_library_init(int flags) |
|
||||
{ |
|
||||
int res; |
|
||||
|
|
||||
if (ares_initialized) |
|
||||
return ARES_SUCCESS; |
|
||||
ares_initialized++; |
|
||||
|
|
||||
if (flags & ARES_LIB_INIT_WIN32) |
|
||||
{ |
|
||||
res = ares_win32_init(); |
|
||||
if (res != ARES_SUCCESS) |
|
||||
return res; |
|
||||
} |
|
||||
|
|
||||
ares_init_flags = flags; |
|
||||
|
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
void ares_library_cleanup(void) |
|
||||
{ |
|
||||
if (!ares_initialized) |
|
||||
return; |
|
||||
ares_initialized--; |
|
||||
|
|
||||
if (ares_init_flags & ARES_LIB_INIT_WIN32) |
|
||||
ares_win32_cleanup(); |
|
||||
|
|
||||
ares_init_flags = ARES_LIB_INIT_NONE; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
int ares_library_initialized(void) |
|
||||
{ |
|
||||
#ifdef USE_WINSOCK |
|
||||
if (!ares_initialized) |
|
||||
return ARES_ENOTINITIALIZED; |
|
||||
#endif |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
|
|
@ -1,39 +0,0 @@ |
|||||
#ifndef HEADER_CARES_LIBRARY_INIT_H |
|
||||
#define HEADER_CARES_LIBRARY_INIT_H |
|
||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2004-2009 by Daniel Stenberg |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef USE_WINSOCK |
|
||||
|
|
||||
#include <iphlpapi.h> |
|
||||
|
|
||||
typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*); |
|
||||
typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG); |
|
||||
|
|
||||
/* Forward-declaration of variables defined in ares_library_init.c */ |
|
||||
/* that are global and unique instances for whole c-ares library. */ |
|
||||
|
|
||||
extern fpGetNetworkParams_t ares_fpGetNetworkParams; |
|
||||
extern fpSystemFunction036_t ares_fpSystemFunction036; |
|
||||
|
|
||||
#endif /* USE_WINSOCK */ |
|
||||
|
|
||||
#endif /* HEADER_CARES_LIBRARY_INIT_H */ |
|
||||
|
|
@ -1,86 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
/* Routines for managing doubly-linked circular linked lists with a
|
|
||||
* dummy head. |
|
||||
*/ |
|
||||
|
|
||||
/* Initialize a new head node */ |
|
||||
void ares__init_list_head(struct list_node* head) { |
|
||||
head->prev = head; |
|
||||
head->next = head; |
|
||||
head->data = NULL; |
|
||||
} |
|
||||
|
|
||||
/* Initialize a list node */ |
|
||||
void ares__init_list_node(struct list_node* node, void* d) { |
|
||||
node->prev = NULL; |
|
||||
node->next = NULL; |
|
||||
node->data = d; |
|
||||
} |
|
||||
|
|
||||
/* Returns true iff the given list is empty */ |
|
||||
int ares__is_list_empty(struct list_node* head) { |
|
||||
return ((head->next == head) && (head->prev == head)); |
|
||||
} |
|
||||
|
|
||||
/* Inserts new_node before old_node */ |
|
||||
void ares__insert_in_list(struct list_node* new_node, |
|
||||
struct list_node* old_node) { |
|
||||
new_node->next = old_node; |
|
||||
new_node->prev = old_node->prev; |
|
||||
old_node->prev->next = new_node; |
|
||||
old_node->prev = new_node; |
|
||||
} |
|
||||
|
|
||||
/* Removes the node from the list it's in, if any */ |
|
||||
void ares__remove_from_list(struct list_node* node) { |
|
||||
if (node->next != NULL) { |
|
||||
node->prev->next = node->next; |
|
||||
node->next->prev = node->prev; |
|
||||
node->prev = NULL; |
|
||||
node->next = NULL; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/* Swap the contents of two lists */ |
|
||||
void ares__swap_lists(struct list_node* head_a, |
|
||||
struct list_node* head_b) { |
|
||||
int is_a_empty = ares__is_list_empty(head_a); |
|
||||
int is_b_empty = ares__is_list_empty(head_b); |
|
||||
struct list_node old_a = *head_a; |
|
||||
struct list_node old_b = *head_b; |
|
||||
|
|
||||
if (is_a_empty) { |
|
||||
ares__init_list_head(head_b); |
|
||||
} else { |
|
||||
*head_b = old_a; |
|
||||
old_a.next->prev = head_b; |
|
||||
old_a.prev->next = head_b; |
|
||||
} |
|
||||
if (is_b_empty) { |
|
||||
ares__init_list_head(head_a); |
|
||||
} else { |
|
||||
*head_a = old_b; |
|
||||
old_b.next->prev = head_a; |
|
||||
old_b.prev->next = head_a; |
|
||||
} |
|
||||
} |
|
@ -1,42 +0,0 @@ |
|||||
#ifndef __ARES_LLIST_H |
|
||||
#define __ARES_LLIST_H |
|
||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
/* Node definition for circular, doubly-linked list */ |
|
||||
struct list_node { |
|
||||
struct list_node *prev; |
|
||||
struct list_node *next; |
|
||||
void* data; |
|
||||
}; |
|
||||
|
|
||||
void ares__init_list_head(struct list_node* head); |
|
||||
|
|
||||
void ares__init_list_node(struct list_node* node, void* d); |
|
||||
|
|
||||
int ares__is_list_empty(struct list_node* head); |
|
||||
|
|
||||
void ares__insert_in_list(struct list_node* new_node, |
|
||||
struct list_node* old_node); |
|
||||
|
|
||||
void ares__remove_from_list(struct list_node* node); |
|
||||
|
|
||||
void ares__swap_lists(struct list_node* head_a, |
|
||||
struct list_node* head_b); |
|
||||
|
|
||||
#endif /* __ARES_LLIST_H */ |
|
@ -1,195 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
/* Header format, from RFC 1035:
|
|
||||
* 1 1 1 1 1 1 |
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* | ID | |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* |QR| Opcode |AA|TC|RD|RA| Z | RCODE | |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* | QDCOUNT | |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* | ANCOUNT | |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* | NSCOUNT | |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* | ARCOUNT | |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* |
|
||||
* AA, TC, RA, and RCODE are only set in responses. Brief description |
|
||||
* of the remaining fields: |
|
||||
* ID Identifier to match responses with queries |
|
||||
* QR Query (0) or response (1) |
|
||||
* Opcode For our purposes, always QUERY |
|
||||
* RD Recursion desired |
|
||||
* Z Reserved (zero) |
|
||||
* QDCOUNT Number of queries |
|
||||
* ANCOUNT Number of answers |
|
||||
* NSCOUNT Number of name server records |
|
||||
* ARCOUNT Number of additional records |
|
||||
* |
|
||||
* Question format, from RFC 1035: |
|
||||
* 1 1 1 1 1 1 |
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* | | |
|
||||
* / QNAME / |
|
||||
* / / |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* | QTYPE | |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* | QCLASS | |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
|
||||
* |
|
||||
* The query name is encoded as a series of labels, each represented |
|
||||
* as a one-byte length (maximum 63) followed by the text of the |
|
||||
* label. The list is terminated by a label of length zero (which can |
|
||||
* be thought of as the root domain). |
|
||||
*/ |
|
||||
|
|
||||
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id, |
|
||||
int rd, unsigned char **buf, int *buflen) |
|
||||
{ |
|
||||
int len; |
|
||||
unsigned char *q; |
|
||||
const char *p; |
|
||||
|
|
||||
/* Set our results early, in case we bail out early with an error. */ |
|
||||
*buflen = 0; |
|
||||
*buf = NULL; |
|
||||
|
|
||||
/* Compute the length of the encoded name so we can check buflen.
|
|
||||
* Start counting at 1 for the zero-length label at the end. */ |
|
||||
len = 1; |
|
||||
for (p = name; *p; p++) |
|
||||
{ |
|
||||
if (*p == '\\' && *(p + 1) != 0) |
|
||||
p++; |
|
||||
len++; |
|
||||
} |
|
||||
/* If there are n periods in the name, there are n + 1 labels, and
|
|
||||
* thus n + 1 length fields, unless the name is empty or ends with a |
|
||||
* period. So add 1 unless name is empty or ends with a period. |
|
||||
*/ |
|
||||
if (*name && *(p - 1) != '.') |
|
||||
len++; |
|
||||
|
|
||||
/* Immediately reject names that are longer than the maximum of 255
|
|
||||
* bytes that's specified in RFC 1035 ("To simplify implementations, |
|
||||
* the total length of a domain name (i.e., label octets and label |
|
||||
* length octets) is restricted to 255 octets or less."). We aren't |
|
||||
* doing this just to be a stickler about RFCs. For names that are |
|
||||
* too long, 'dnscache' closes its TCP connection to us immediately |
|
||||
* (when using TCP) and ignores the request when using UDP, and |
|
||||
* BIND's named returns ServFail (TCP or UDP). Sending a request |
|
||||
* that we know will cause 'dnscache' to close the TCP connection is |
|
||||
* painful, since that makes any other outstanding requests on that |
|
||||
* connection fail. And sending a UDP request that we know |
|
||||
* 'dnscache' will ignore is bad because resources will be tied up |
|
||||
* until we time-out the request. |
|
||||
*/ |
|
||||
if (len > MAXCDNAME) |
|
||||
return ARES_EBADNAME; |
|
||||
|
|
||||
*buflen = len + HFIXEDSZ + QFIXEDSZ; |
|
||||
*buf = malloc(*buflen); |
|
||||
if (!*buf) |
|
||||
return ARES_ENOMEM; |
|
||||
|
|
||||
/* Set up the header. */ |
|
||||
q = *buf; |
|
||||
memset(q, 0, HFIXEDSZ); |
|
||||
DNS_HEADER_SET_QID(q, id); |
|
||||
DNS_HEADER_SET_OPCODE(q, QUERY); |
|
||||
if (rd) { |
|
||||
DNS_HEADER_SET_RD(q, 1); |
|
||||
} |
|
||||
else { |
|
||||
DNS_HEADER_SET_RD(q, 0); |
|
||||
} |
|
||||
DNS_HEADER_SET_QDCOUNT(q, 1); |
|
||||
|
|
||||
/* A name of "." is a screw case for the loop below, so adjust it. */ |
|
||||
if (strcmp(name, ".") == 0) |
|
||||
name++; |
|
||||
|
|
||||
/* Start writing out the name after the header. */ |
|
||||
q += HFIXEDSZ; |
|
||||
while (*name) |
|
||||
{ |
|
||||
if (*name == '.') |
|
||||
return ARES_EBADNAME; |
|
||||
|
|
||||
/* Count the number of bytes in this label. */ |
|
||||
len = 0; |
|
||||
for (p = name; *p && *p != '.'; p++) |
|
||||
{ |
|
||||
if (*p == '\\' && *(p + 1) != 0) |
|
||||
p++; |
|
||||
len++; |
|
||||
} |
|
||||
if (len > MAXLABEL) |
|
||||
return ARES_EBADNAME; |
|
||||
|
|
||||
/* Encode the length and copy the data. */ |
|
||||
*q++ = (unsigned char)len; |
|
||||
for (p = name; *p && *p != '.'; p++) |
|
||||
{ |
|
||||
if (*p == '\\' && *(p + 1) != 0) |
|
||||
p++; |
|
||||
*q++ = *p; |
|
||||
} |
|
||||
|
|
||||
/* Go to the next label and repeat, unless we hit the end. */ |
|
||||
if (!*p) |
|
||||
break; |
|
||||
name = p + 1; |
|
||||
} |
|
||||
|
|
||||
/* Add the zero-length label at the end. */ |
|
||||
*q++ = 0; |
|
||||
|
|
||||
/* Finish off the question with the type and class. */ |
|
||||
DNS_QUESTION_SET_TYPE(q, type); |
|
||||
DNS_QUESTION_SET_CLASS(q, dnsclass); |
|
||||
|
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
@ -1,59 +0,0 @@ |
|||||
|
|
||||
/* Copyright (C) 2010 by Daniel Stenberg
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#include "ares_nowarn.h" |
|
||||
|
|
||||
#define CARES_MASK_UINT (~(unsigned int) 0) |
|
||||
#define CARES_MASK_SINT (CARES_MASK_UINT >> 1) |
|
||||
|
|
||||
/*
|
|
||||
** size_t to signed int |
|
||||
*/ |
|
||||
|
|
||||
int aresx_uztosi(size_t uznum) |
|
||||
{ |
|
||||
#ifdef __INTEL_COMPILER |
|
||||
# pragma warning(push) |
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */ |
|
||||
#endif |
|
||||
|
|
||||
return (int)(uznum & (size_t) CARES_MASK_SINT); |
|
||||
|
|
||||
#ifdef __INTEL_COMPILER |
|
||||
# pragma warning(pop) |
|
||||
#endif |
|
||||
} |
|
||||
|
|
||||
/*
|
|
||||
** signed long to signed int |
|
||||
*/ |
|
||||
|
|
||||
int aresx_sltosi(long slnum) |
|
||||
{ |
|
||||
#ifdef __INTEL_COMPILER |
|
||||
# pragma warning(push) |
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */ |
|
||||
#endif |
|
||||
|
|
||||
return (int)(slnum & (long) CARES_MASK_SINT); |
|
||||
|
|
||||
#ifdef __INTEL_COMPILER |
|
||||
# pragma warning(pop) |
|
||||
#endif |
|
||||
} |
|
@ -1,24 +0,0 @@ |
|||||
#ifndef HEADER_CARES_NOWARN_H |
|
||||
#define HEADER_CARES_NOWARN_H |
|
||||
|
|
||||
|
|
||||
/* Copyright (C) 2010 by Daniel Stenberg
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
int aresx_uztosi(size_t uznum); |
|
||||
|
|
||||
int aresx_sltosi(long slnum); |
|
||||
|
|
||||
#endif /* HEADER_CARES_NOWARN_H */ |
|
@ -1,253 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2008-2010 by Daniel Stenberg |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_data.h" |
|
||||
#include "inet_net_pton.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
|
|
||||
int ares_get_servers(ares_channel channel, |
|
||||
struct ares_addr_node **servers) |
|
||||
{ |
|
||||
struct ares_addr_node *srvr_head = NULL; |
|
||||
struct ares_addr_node *srvr_last = NULL; |
|
||||
struct ares_addr_node *srvr_curr; |
|
||||
int status = ARES_SUCCESS; |
|
||||
int i; |
|
||||
|
|
||||
if (!channel) |
|
||||
return ARES_ENODATA; |
|
||||
|
|
||||
for (i = 0; i < channel->nservers; i++) |
|
||||
{ |
|
||||
/* Allocate storage for this server node appending it to the list */ |
|
||||
srvr_curr = ares_malloc_data(ARES_DATATYPE_ADDR_NODE); |
|
||||
if (!srvr_curr) |
|
||||
{ |
|
||||
status = ARES_ENOMEM; |
|
||||
break; |
|
||||
} |
|
||||
if (srvr_last) |
|
||||
{ |
|
||||
srvr_last->next = srvr_curr; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
srvr_head = srvr_curr; |
|
||||
} |
|
||||
srvr_last = srvr_curr; |
|
||||
|
|
||||
/* Fill this server node data */ |
|
||||
srvr_curr->family = channel->servers[i].addr.family; |
|
||||
if (srvr_curr->family == AF_INET) |
|
||||
memcpy(&srvr_curr->addrV4, &channel->servers[i].addr.addrV4, |
|
||||
sizeof(srvr_curr->addrV4)); |
|
||||
else |
|
||||
memcpy(&srvr_curr->addrV6, &channel->servers[i].addr.addrV6, |
|
||||
sizeof(srvr_curr->addrV6)); |
|
||||
} |
|
||||
|
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
if (srvr_head) |
|
||||
{ |
|
||||
ares_free_data(srvr_head); |
|
||||
srvr_head = NULL; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
*servers = srvr_head; |
|
||||
|
|
||||
return status; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
int ares_set_servers(ares_channel channel, |
|
||||
struct ares_addr_node *servers) |
|
||||
{ |
|
||||
struct ares_addr_node *srvr; |
|
||||
int num_srvrs = 0; |
|
||||
int i; |
|
||||
|
|
||||
if (ares_library_initialized() != ARES_SUCCESS) |
|
||||
return ARES_ENOTINITIALIZED; |
|
||||
|
|
||||
if (!channel) |
|
||||
return ARES_ENODATA; |
|
||||
|
|
||||
ares__destroy_servers_state(channel); |
|
||||
|
|
||||
for (srvr = servers; srvr; srvr = srvr->next) |
|
||||
{ |
|
||||
num_srvrs++; |
|
||||
} |
|
||||
|
|
||||
if (num_srvrs > 0) |
|
||||
{ |
|
||||
/* Allocate storage for servers state */ |
|
||||
channel->servers = malloc(num_srvrs * sizeof(struct server_state)); |
|
||||
if (!channel->servers) |
|
||||
{ |
|
||||
return ARES_ENOMEM; |
|
||||
} |
|
||||
channel->nservers = num_srvrs; |
|
||||
/* Fill servers state address data */ |
|
||||
for (i = 0, srvr = servers; srvr; i++, srvr = srvr->next) |
|
||||
{ |
|
||||
channel->servers[i].addr.family = srvr->family; |
|
||||
if (srvr->family == AF_INET) |
|
||||
memcpy(&channel->servers[i].addr.addrV4, &srvr->addrV4, |
|
||||
sizeof(srvr->addrV4)); |
|
||||
else |
|
||||
memcpy(&channel->servers[i].addr.addrV6, &srvr->addrV6, |
|
||||
sizeof(srvr->addrV6)); |
|
||||
} |
|
||||
/* Initialize servers state remaining data */ |
|
||||
ares__init_servers_state(channel); |
|
||||
} |
|
||||
|
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
/* Incomming string format: host[:port][,host[:port]]... */ |
|
||||
int ares_set_servers_csv(ares_channel channel, |
|
||||
const char* _csv) |
|
||||
{ |
|
||||
int i; |
|
||||
char* csv = NULL; |
|
||||
char* ptr; |
|
||||
char* start_host; |
|
||||
long port; |
|
||||
bool found_port; |
|
||||
int rv = ARES_SUCCESS; |
|
||||
struct ares_addr_node *servers = NULL; |
|
||||
struct ares_addr_node *last = NULL; |
|
||||
|
|
||||
if (ares_library_initialized() != ARES_SUCCESS) |
|
||||
return ARES_ENOTINITIALIZED; |
|
||||
|
|
||||
if (!channel) |
|
||||
return ARES_ENODATA; |
|
||||
|
|
||||
ares__destroy_servers_state(channel); |
|
||||
|
|
||||
i = strlen(_csv); |
|
||||
if (i == 0) |
|
||||
return ARES_SUCCESS; /* blank all servers */ |
|
||||
|
|
||||
csv = malloc(i + 2); |
|
||||
strcpy(csv, _csv); |
|
||||
if (csv[i-1] != ',') { /* make parsing easier by ensuring ending ',' */ |
|
||||
csv[i] = ','; |
|
||||
csv[i+1] = 0; |
|
||||
} |
|
||||
|
|
||||
start_host = csv; |
|
||||
found_port = false; |
|
||||
for (ptr = csv; *ptr; ptr++) { |
|
||||
if (*ptr == ',') { |
|
||||
char* pp = ptr - 1; |
|
||||
struct in_addr in4; |
|
||||
struct ares_in6_addr in6; |
|
||||
struct ares_addr_node *s = NULL; |
|
||||
|
|
||||
*ptr = 0; /* null terminate host:port string */ |
|
||||
/* Got an entry..see if port was specified. */ |
|
||||
while (pp > start_host) { |
|
||||
if (*pp == ':') |
|
||||
break; /* yes */ |
|
||||
if (!ISDIGIT(*pp)) { |
|
||||
/* Found end of digits before we found :, so wasn't a port */ |
|
||||
pp = ptr; |
|
||||
break; |
|
||||
} |
|
||||
pp--; |
|
||||
} |
|
||||
if ((pp != start_host) && ((pp + 1) < ptr)) { |
|
||||
/* Found it. */ |
|
||||
found_port = true; |
|
||||
port = strtol(pp + 1, NULL, 10); |
|
||||
*pp = 0; /* null terminate host */ |
|
||||
} |
|
||||
/* resolve host, try ipv4 first, rslt is in network byte order */ |
|
||||
rv = ares_inet_pton(AF_INET, start_host, &in4); |
|
||||
if (!rv) { |
|
||||
/* Ok, try IPv6 then */ |
|
||||
rv = ares_inet_pton(AF_INET6, start_host, &in6); |
|
||||
if (!rv) { |
|
||||
rv = ARES_EBADSTR; |
|
||||
goto out; |
|
||||
} |
|
||||
/* was ipv6, add new server */ |
|
||||
s = malloc(sizeof(*s)); |
|
||||
if (!s) { |
|
||||
rv = ARES_ENOMEM; |
|
||||
goto out; |
|
||||
} |
|
||||
s->family = AF_INET6; |
|
||||
memcpy(&s->addr, &in6, sizeof(struct ares_in6_addr)); |
|
||||
} |
|
||||
else { |
|
||||
/* was ipv4, add new server */ |
|
||||
s = malloc(sizeof(*s)); |
|
||||
if (!s) { |
|
||||
rv = ARES_ENOMEM; |
|
||||
goto out; |
|
||||
} |
|
||||
s->family = AF_INET; |
|
||||
memcpy(&s->addr, &in4, sizeof(struct in_addr)); |
|
||||
} |
|
||||
if (s) { |
|
||||
/* TODO: Add port to ares_addr_node and assign it here. */ |
|
||||
|
|
||||
s->next = NULL; |
|
||||
if (last) { |
|
||||
last->next = s; |
|
||||
} |
|
||||
else { |
|
||||
servers = s; |
|
||||
last = s; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/* Set up for next one */ |
|
||||
found_port = false; |
|
||||
start_host = ptr + 1; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
rv = ares_set_servers(channel, servers); |
|
||||
|
|
||||
out: |
|
||||
if (csv) |
|
||||
free(csv); |
|
||||
while (servers) { |
|
||||
struct ares_addr_node *s = servers; |
|
||||
servers = servers->next; |
|
||||
free(s); |
|
||||
} |
|
||||
|
|
||||
return rv; |
|
||||
} |
|
@ -1,258 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_STRINGS_H |
|
||||
# include <strings.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#ifdef HAVE_LIMITS_H |
|
||||
# include <limits.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int ares_parse_a_reply(const unsigned char *abuf, int alen, |
|
||||
struct hostent **host, |
|
||||
struct ares_addrttl *addrttls, int *naddrttls) |
|
||||
{ |
|
||||
unsigned int qdcount, ancount; |
|
||||
int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs; |
|
||||
int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */ |
|
||||
int naliases; |
|
||||
long len; |
|
||||
const unsigned char *aptr; |
|
||||
char *hostname, *rr_name, *rr_data, **aliases; |
|
||||
struct in_addr *addrs; |
|
||||
struct hostent *hostent; |
|
||||
const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0; |
|
||||
|
|
||||
/* Set *host to NULL for all failure cases. */ |
|
||||
if (host) |
|
||||
*host = NULL; |
|
||||
/* Same with *naddrttls. */ |
|
||||
if (naddrttls) |
|
||||
*naddrttls = 0; |
|
||||
|
|
||||
/* Give up if abuf doesn't have room for a header. */ |
|
||||
if (alen < HFIXEDSZ) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Fetch the question and answer count from the header. */ |
|
||||
qdcount = DNS_HEADER_QDCOUNT(abuf); |
|
||||
ancount = DNS_HEADER_ANCOUNT(abuf); |
|
||||
if (qdcount != 1) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Expand the name from the question, and skip past the question. */ |
|
||||
aptr = abuf + HFIXEDSZ; |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
return status; |
|
||||
if (aptr + len + QFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
free(hostname); |
|
||||
return ARES_EBADRESP; |
|
||||
} |
|
||||
aptr += len + QFIXEDSZ; |
|
||||
|
|
||||
if (host) |
|
||||
{ |
|
||||
/* Allocate addresses and aliases; ancount gives an upper bound for
|
|
||||
both. */ |
|
||||
addrs = malloc(ancount * sizeof(struct in_addr)); |
|
||||
if (!addrs) |
|
||||
{ |
|
||||
free(hostname); |
|
||||
return ARES_ENOMEM; |
|
||||
} |
|
||||
aliases = malloc((ancount + 1) * sizeof(char *)); |
|
||||
if (!aliases) |
|
||||
{ |
|
||||
free(hostname); |
|
||||
free(addrs); |
|
||||
return ARES_ENOMEM; |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
addrs = NULL; |
|
||||
aliases = NULL; |
|
||||
} |
|
||||
|
|
||||
naddrs = 0; |
|
||||
naliases = 0; |
|
||||
|
|
||||
/* Examine each answer resource record (RR) in turn. */ |
|
||||
for (i = 0; i < (int)ancount; i++) |
|
||||
{ |
|
||||
/* Decode the RR up to the data field. */ |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
aptr += len; |
|
||||
if (aptr + RRFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
rr_type = DNS_RR_TYPE(aptr); |
|
||||
rr_class = DNS_RR_CLASS(aptr); |
|
||||
rr_len = DNS_RR_LEN(aptr); |
|
||||
rr_ttl = DNS_RR_TTL(aptr); |
|
||||
aptr += RRFIXEDSZ; |
|
||||
|
|
||||
if (rr_class == C_IN && rr_type == T_A |
|
||||
&& rr_len == sizeof(struct in_addr) |
|
||||
&& strcasecmp(rr_name, hostname) == 0) |
|
||||
{ |
|
||||
if (addrs) |
|
||||
{ |
|
||||
if (aptr + sizeof(struct in_addr) > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr)); |
|
||||
} |
|
||||
if (naddrs < max_addr_ttls) |
|
||||
{ |
|
||||
struct ares_addrttl * const at = &addrttls[naddrs]; |
|
||||
if (aptr + sizeof(struct in_addr) > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
memcpy(&at->ipaddr, aptr, sizeof(struct in_addr)); |
|
||||
at->ttl = rr_ttl; |
|
||||
} |
|
||||
naddrs++; |
|
||||
status = ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
if (rr_class == C_IN && rr_type == T_CNAME) |
|
||||
{ |
|
||||
/* Record the RR name as an alias. */ |
|
||||
if (aliases) |
|
||||
aliases[naliases] = rr_name; |
|
||||
else |
|
||||
free(rr_name); |
|
||||
naliases++; |
|
||||
|
|
||||
/* Decode the RR data and replace the hostname with it. */ |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, |
|
||||
&len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
free(hostname); |
|
||||
hostname = rr_data; |
|
||||
|
|
||||
/* Take the min of the TTLs we see in the CNAME chain. */ |
|
||||
if (cname_ttl > rr_ttl) |
|
||||
cname_ttl = rr_ttl; |
|
||||
} |
|
||||
else |
|
||||
free(rr_name); |
|
||||
|
|
||||
aptr += rr_len; |
|
||||
if (aptr > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
if (status == ARES_SUCCESS && naddrs == 0 && naliases == 0) |
|
||||
/* the check for naliases to be zero is to make sure CNAME responses
|
|
||||
don't get caught here */ |
|
||||
status = ARES_ENODATA; |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
/* We got our answer. */ |
|
||||
if (naddrttls) |
|
||||
{ |
|
||||
const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls; |
|
||||
for (i = 0; i < n; i++) |
|
||||
{ |
|
||||
/* Ensure that each A TTL is no larger than the CNAME TTL. */ |
|
||||
if (addrttls[i].ttl > cname_ttl) |
|
||||
addrttls[i].ttl = cname_ttl; |
|
||||
} |
|
||||
*naddrttls = n; |
|
||||
} |
|
||||
if (aliases) |
|
||||
aliases[naliases] = NULL; |
|
||||
if (host) |
|
||||
{ |
|
||||
/* Allocate memory to build the host entry. */ |
|
||||
hostent = malloc(sizeof(struct hostent)); |
|
||||
if (hostent) |
|
||||
{ |
|
||||
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *)); |
|
||||
if (hostent->h_addr_list) |
|
||||
{ |
|
||||
/* Fill in the hostent and return successfully. */ |
|
||||
hostent->h_name = hostname; |
|
||||
hostent->h_aliases = aliases; |
|
||||
hostent->h_addrtype = AF_INET; |
|
||||
hostent->h_length = sizeof(struct in_addr); |
|
||||
for (i = 0; i < naddrs; i++) |
|
||||
hostent->h_addr_list[i] = (char *) &addrs[i]; |
|
||||
hostent->h_addr_list[naddrs] = NULL; |
|
||||
*host = hostent; |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
free(hostent); |
|
||||
} |
|
||||
status = ARES_ENOMEM; |
|
||||
} |
|
||||
} |
|
||||
if (aliases) |
|
||||
{ |
|
||||
for (i = 0; i < naliases; i++) |
|
||||
free(aliases[i]); |
|
||||
free(aliases); |
|
||||
} |
|
||||
free(addrs); |
|
||||
free(hostname); |
|
||||
return status; |
|
||||
} |
|
@ -1,256 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright 2005 Dominick Meglio |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_STRINGS_H |
|
||||
# include <strings.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#ifdef HAVE_LIMITS_H |
|
||||
# include <limits.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "inet_net_pton.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, |
|
||||
struct hostent **host, struct ares_addr6ttl *addrttls, |
|
||||
int *naddrttls) |
|
||||
{ |
|
||||
unsigned int qdcount, ancount; |
|
||||
int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs; |
|
||||
int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */ |
|
||||
int naliases; |
|
||||
long len; |
|
||||
const unsigned char *aptr; |
|
||||
char *hostname, *rr_name, *rr_data, **aliases; |
|
||||
struct ares_in6_addr *addrs; |
|
||||
struct hostent *hostent; |
|
||||
const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0; |
|
||||
|
|
||||
/* Set *host to NULL for all failure cases. */ |
|
||||
if (host) |
|
||||
*host = NULL; |
|
||||
/* Same with *naddrttls. */ |
|
||||
if (naddrttls) |
|
||||
*naddrttls = 0; |
|
||||
|
|
||||
/* Give up if abuf doesn't have room for a header. */ |
|
||||
if (alen < HFIXEDSZ) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Fetch the question and answer count from the header. */ |
|
||||
qdcount = DNS_HEADER_QDCOUNT(abuf); |
|
||||
ancount = DNS_HEADER_ANCOUNT(abuf); |
|
||||
if (qdcount != 1) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Expand the name from the question, and skip past the question. */ |
|
||||
aptr = abuf + HFIXEDSZ; |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
return status; |
|
||||
if (aptr + len + QFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
free(hostname); |
|
||||
return ARES_EBADRESP; |
|
||||
} |
|
||||
aptr += len + QFIXEDSZ; |
|
||||
|
|
||||
/* Allocate addresses and aliases; ancount gives an upper bound for both. */ |
|
||||
if (host) |
|
||||
{ |
|
||||
addrs = malloc(ancount * sizeof(struct ares_in6_addr)); |
|
||||
if (!addrs) |
|
||||
{ |
|
||||
free(hostname); |
|
||||
return ARES_ENOMEM; |
|
||||
} |
|
||||
aliases = malloc((ancount + 1) * sizeof(char *)); |
|
||||
if (!aliases) |
|
||||
{ |
|
||||
free(hostname); |
|
||||
free(addrs); |
|
||||
return ARES_ENOMEM; |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
addrs = NULL; |
|
||||
aliases = NULL; |
|
||||
} |
|
||||
naddrs = 0; |
|
||||
naliases = 0; |
|
||||
|
|
||||
/* Examine each answer resource record (RR) in turn. */ |
|
||||
for (i = 0; i < (int)ancount; i++) |
|
||||
{ |
|
||||
/* Decode the RR up to the data field. */ |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
aptr += len; |
|
||||
if (aptr + RRFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
rr_type = DNS_RR_TYPE(aptr); |
|
||||
rr_class = DNS_RR_CLASS(aptr); |
|
||||
rr_len = DNS_RR_LEN(aptr); |
|
||||
rr_ttl = DNS_RR_TTL(aptr); |
|
||||
aptr += RRFIXEDSZ; |
|
||||
|
|
||||
if (rr_class == C_IN && rr_type == T_AAAA |
|
||||
&& rr_len == sizeof(struct ares_in6_addr) |
|
||||
&& strcasecmp(rr_name, hostname) == 0) |
|
||||
{ |
|
||||
if (addrs) |
|
||||
{ |
|
||||
if (aptr + sizeof(struct ares_in6_addr) > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
memcpy(&addrs[naddrs], aptr, sizeof(struct ares_in6_addr)); |
|
||||
} |
|
||||
if (naddrs < max_addr_ttls) |
|
||||
{ |
|
||||
struct ares_addr6ttl * const at = &addrttls[naddrs]; |
|
||||
if (aptr + sizeof(struct ares_in6_addr) > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
memcpy(&at->ip6addr, aptr, sizeof(struct ares_in6_addr)); |
|
||||
at->ttl = rr_ttl; |
|
||||
} |
|
||||
naddrs++; |
|
||||
status = ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
if (rr_class == C_IN && rr_type == T_CNAME) |
|
||||
{ |
|
||||
/* Record the RR name as an alias. */ |
|
||||
if (aliases) |
|
||||
aliases[naliases] = rr_name; |
|
||||
else |
|
||||
free(rr_name); |
|
||||
naliases++; |
|
||||
|
|
||||
/* Decode the RR data and replace the hostname with it. */ |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, |
|
||||
&len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
free(hostname); |
|
||||
hostname = rr_data; |
|
||||
|
|
||||
/* Take the min of the TTLs we see in the CNAME chain. */ |
|
||||
if (cname_ttl > rr_ttl) |
|
||||
cname_ttl = rr_ttl; |
|
||||
} |
|
||||
else |
|
||||
free(rr_name); |
|
||||
|
|
||||
aptr += rr_len; |
|
||||
if (aptr > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
if (status == ARES_SUCCESS && naddrs == 0) |
|
||||
status = ARES_ENODATA; |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
/* We got our answer. */ |
|
||||
if (naddrttls) |
|
||||
{ |
|
||||
const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls; |
|
||||
for (i = 0; i < n; i++) |
|
||||
{ |
|
||||
/* Ensure that each A TTL is no larger than the CNAME TTL. */ |
|
||||
if (addrttls[i].ttl > cname_ttl) |
|
||||
addrttls[i].ttl = cname_ttl; |
|
||||
} |
|
||||
*naddrttls = n; |
|
||||
} |
|
||||
if (aliases) |
|
||||
aliases[naliases] = NULL; |
|
||||
if (host) |
|
||||
{ |
|
||||
/* Allocate memory to build the host entry. */ |
|
||||
hostent = malloc(sizeof(struct hostent)); |
|
||||
if (hostent) |
|
||||
{ |
|
||||
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *)); |
|
||||
if (hostent->h_addr_list) |
|
||||
{ |
|
||||
/* Fill in the hostent and return successfully. */ |
|
||||
hostent->h_name = hostname; |
|
||||
hostent->h_aliases = aliases; |
|
||||
hostent->h_addrtype = AF_INET6; |
|
||||
hostent->h_length = sizeof(struct ares_in6_addr); |
|
||||
for (i = 0; i < naddrs; i++) |
|
||||
hostent->h_addr_list[i] = (char *) &addrs[i]; |
|
||||
hostent->h_addr_list[naddrs] = NULL; |
|
||||
*host = hostent; |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
free(hostent); |
|
||||
} |
|
||||
status = ARES_ENOMEM; |
|
||||
} |
|
||||
} |
|
||||
if (aliases) |
|
||||
{ |
|
||||
for (i = 0; i < naliases; i++) |
|
||||
free(aliases[i]); |
|
||||
free(aliases); |
|
||||
} |
|
||||
free(addrs); |
|
||||
free(hostname); |
|
||||
return status; |
|
||||
} |
|
@ -1,170 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2010 Jeremy Lal <kapouer@melix.org> |
|
||||
* |
|
||||
* 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. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_data.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int |
|
||||
ares_parse_mx_reply (const unsigned char *abuf, int alen, |
|
||||
struct ares_mx_reply **mx_out) |
|
||||
{ |
|
||||
unsigned int qdcount, ancount, i; |
|
||||
const unsigned char *aptr, *vptr; |
|
||||
int status, rr_type, rr_class, rr_len; |
|
||||
long len; |
|
||||
char *hostname = NULL, *rr_name = NULL; |
|
||||
struct ares_mx_reply *mx_head = NULL; |
|
||||
struct ares_mx_reply *mx_last = NULL; |
|
||||
struct ares_mx_reply *mx_curr; |
|
||||
|
|
||||
/* Set *mx_out to NULL for all failure cases. */ |
|
||||
*mx_out = NULL; |
|
||||
|
|
||||
/* Give up if abuf doesn't have room for a header. */ |
|
||||
if (alen < HFIXEDSZ) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Fetch the question and answer count from the header. */ |
|
||||
qdcount = DNS_HEADER_QDCOUNT (abuf); |
|
||||
ancount = DNS_HEADER_ANCOUNT (abuf); |
|
||||
if (qdcount != 1) |
|
||||
return ARES_EBADRESP; |
|
||||
if (ancount == 0) |
|
||||
return ARES_ENODATA; |
|
||||
|
|
||||
/* Expand the name from the question, and skip past the question. */ |
|
||||
aptr = abuf + HFIXEDSZ; |
|
||||
status = ares_expand_name (aptr, abuf, alen, &hostname, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
return status; |
|
||||
|
|
||||
if (aptr + len + QFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
free (hostname); |
|
||||
return ARES_EBADRESP; |
|
||||
} |
|
||||
aptr += len + QFIXEDSZ; |
|
||||
|
|
||||
/* Examine each answer resource record (RR) in turn. */ |
|
||||
for (i = 0; i < ancount; i++) |
|
||||
{ |
|
||||
/* Decode the RR up to the data field. */ |
|
||||
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
break; |
|
||||
} |
|
||||
aptr += len; |
|
||||
if (aptr + RRFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
rr_type = DNS_RR_TYPE (aptr); |
|
||||
rr_class = DNS_RR_CLASS (aptr); |
|
||||
rr_len = DNS_RR_LEN (aptr); |
|
||||
aptr += RRFIXEDSZ; |
|
||||
|
|
||||
/* Check if we are really looking at a MX record */ |
|
||||
if (rr_class == C_IN && rr_type == T_MX) |
|
||||
{ |
|
||||
/* parse the MX record itself */ |
|
||||
if (rr_len < 2) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
/* Allocate storage for this MX answer appending it to the list */ |
|
||||
mx_curr = ares_malloc_data(ARES_DATATYPE_MX_REPLY); |
|
||||
if (!mx_curr) |
|
||||
{ |
|
||||
status = ARES_ENOMEM; |
|
||||
break; |
|
||||
} |
|
||||
if (mx_last) |
|
||||
{ |
|
||||
mx_last->next = mx_curr; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
mx_head = mx_curr; |
|
||||
} |
|
||||
mx_last = mx_curr; |
|
||||
|
|
||||
vptr = aptr; |
|
||||
mx_curr->priority = ntohs (*((unsigned short *)vptr)); |
|
||||
vptr += sizeof(unsigned short); |
|
||||
|
|
||||
status = ares_expand_name (vptr, abuf, alen, &mx_curr->host, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
/* Don't lose memory in the next iteration */ |
|
||||
free (rr_name); |
|
||||
rr_name = NULL; |
|
||||
|
|
||||
/* Move on to the next record */ |
|
||||
aptr += rr_len; |
|
||||
} |
|
||||
|
|
||||
if (hostname) |
|
||||
free (hostname); |
|
||||
if (rr_name) |
|
||||
free (rr_name); |
|
||||
|
|
||||
/* clean up on error */ |
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
if (mx_head) |
|
||||
ares_free_data (mx_head); |
|
||||
return status; |
|
||||
} |
|
||||
|
|
||||
/* everything looks fine, return the data */ |
|
||||
*mx_out = mx_head; |
|
||||
|
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
@ -1,182 +0,0 @@ |
|||||
/* $Id */ |
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
/*
|
|
||||
* ares_parse_ns_reply created by Vlad Dinulescu <vlad.dinulescu@avira.com> |
|
||||
* on behalf of AVIRA Gmbh - http://www.avira.com
|
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int ares_parse_ns_reply( const unsigned char* abuf, int alen, |
|
||||
struct hostent** host ) |
|
||||
{ |
|
||||
unsigned int qdcount, ancount; |
|
||||
int status, i, rr_type, rr_class, rr_len; |
|
||||
int nameservers_num; |
|
||||
long len; |
|
||||
const unsigned char *aptr; |
|
||||
char* hostname, *rr_name, *rr_data, **nameservers; |
|
||||
struct hostent *hostent; |
|
||||
|
|
||||
/* Set *host to NULL for all failure cases. */ |
|
||||
*host = NULL; |
|
||||
|
|
||||
/* Give up if abuf doesn't have room for a header. */ |
|
||||
if ( alen < HFIXEDSZ ) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Fetch the question and answer count from the header. */ |
|
||||
qdcount = DNS_HEADER_QDCOUNT( abuf ); |
|
||||
ancount = DNS_HEADER_ANCOUNT( abuf ); |
|
||||
if ( qdcount != 1 ) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Expand the name from the question, and skip past the question. */ |
|
||||
aptr = abuf + HFIXEDSZ; |
|
||||
status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len); |
|
||||
if ( status != ARES_SUCCESS ) |
|
||||
return status; |
|
||||
if ( aptr + len + QFIXEDSZ > abuf + alen ) |
|
||||
{ |
|
||||
free( hostname ); |
|
||||
return ARES_EBADRESP; |
|
||||
} |
|
||||
aptr += len + QFIXEDSZ; |
|
||||
|
|
||||
/* Allocate nameservers array; ancount gives an upper bound */ |
|
||||
nameservers = malloc( ( ancount + 1 ) * sizeof( char * ) ); |
|
||||
if ( !nameservers ) |
|
||||
{ |
|
||||
free( hostname ); |
|
||||
return ARES_ENOMEM; |
|
||||
} |
|
||||
nameservers_num = 0; |
|
||||
|
|
||||
/* Examine each answer resource record (RR) in turn. */ |
|
||||
for ( i = 0; i < ( int ) ancount; i++ ) |
|
||||
{ |
|
||||
/* Decode the RR up to the data field. */ |
|
||||
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len ); |
|
||||
if ( status != ARES_SUCCESS ) |
|
||||
break; |
|
||||
aptr += len; |
|
||||
if ( aptr + RRFIXEDSZ > abuf + alen ) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
rr_type = DNS_RR_TYPE( aptr ); |
|
||||
rr_class = DNS_RR_CLASS( aptr ); |
|
||||
rr_len = DNS_RR_LEN( aptr ); |
|
||||
aptr += RRFIXEDSZ; |
|
||||
|
|
||||
if ( rr_class == C_IN && rr_type == T_NS ) |
|
||||
{ |
|
||||
/* Decode the RR data and add it to the nameservers list */ |
|
||||
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data, |
|
||||
&len); |
|
||||
if ( status != ARES_SUCCESS ) |
|
||||
{ |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
nameservers[nameservers_num] = malloc(strlen(rr_data)+1); |
|
||||
|
|
||||
if (nameservers[nameservers_num]==NULL) |
|
||||
{ |
|
||||
free(rr_name); |
|
||||
free(rr_data); |
|
||||
status=ARES_ENOMEM; |
|
||||
break; |
|
||||
} |
|
||||
strcpy(nameservers[nameservers_num],rr_data); |
|
||||
free(rr_data); |
|
||||
|
|
||||
nameservers_num++; |
|
||||
} |
|
||||
|
|
||||
free( rr_name ); |
|
||||
|
|
||||
aptr += rr_len; |
|
||||
if ( aptr > abuf + alen ) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
if ( status == ARES_SUCCESS && nameservers_num == 0 ) |
|
||||
{ |
|
||||
status = ARES_ENODATA; |
|
||||
} |
|
||||
if ( status == ARES_SUCCESS ) |
|
||||
{ |
|
||||
/* We got our answer. Allocate memory to build the host entry. */ |
|
||||
nameservers[nameservers_num] = NULL; |
|
||||
hostent = malloc( sizeof( struct hostent ) ); |
|
||||
if ( hostent ) |
|
||||
{ |
|
||||
hostent->h_addr_list = malloc( 1 * sizeof( char * ) ); |
|
||||
if ( hostent->h_addr_list ) |
|
||||
{ |
|
||||
/* Fill in the hostent and return successfully. */ |
|
||||
hostent->h_name = hostname; |
|
||||
hostent->h_aliases = nameservers; |
|
||||
hostent->h_addrtype = AF_INET; |
|
||||
hostent->h_length = sizeof( struct in_addr ); |
|
||||
hostent->h_addr_list[0] = NULL; |
|
||||
*host = hostent; |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
free( hostent ); |
|
||||
} |
|
||||
status = ARES_ENOMEM; |
|
||||
} |
|
||||
for ( i = 0; i < nameservers_num; i++ ) |
|
||||
free( nameservers[i] ); |
|
||||
free( nameservers ); |
|
||||
free( hostname ); |
|
||||
return status; |
|
||||
} |
|
@ -1,208 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_STRINGS_H |
|
||||
# include <strings.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, |
|
||||
int addrlen, int family, struct hostent **host) |
|
||||
{ |
|
||||
unsigned int qdcount, ancount; |
|
||||
int status, i, rr_type, rr_class, rr_len; |
|
||||
long len; |
|
||||
const unsigned char *aptr; |
|
||||
char *ptrname, *hostname, *rr_name, *rr_data; |
|
||||
struct hostent *hostent; |
|
||||
int aliascnt = 0; |
|
||||
int alias_alloc = 8; |
|
||||
char ** aliases; |
|
||||
|
|
||||
/* Set *host to NULL for all failure cases. */ |
|
||||
*host = NULL; |
|
||||
|
|
||||
/* Give up if abuf doesn't have room for a header. */ |
|
||||
if (alen < HFIXEDSZ) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Fetch the question and answer count from the header. */ |
|
||||
qdcount = DNS_HEADER_QDCOUNT(abuf); |
|
||||
ancount = DNS_HEADER_ANCOUNT(abuf); |
|
||||
if (qdcount != 1) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Expand the name from the question, and skip past the question. */ |
|
||||
aptr = abuf + HFIXEDSZ; |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
return status; |
|
||||
if (aptr + len + QFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
free(ptrname); |
|
||||
return ARES_EBADRESP; |
|
||||
} |
|
||||
aptr += len + QFIXEDSZ; |
|
||||
|
|
||||
/* Examine each answer resource record (RR) in turn. */ |
|
||||
hostname = NULL; |
|
||||
aliases = malloc(alias_alloc * sizeof(char *)); |
|
||||
if (!aliases) |
|
||||
{ |
|
||||
free(ptrname); |
|
||||
return ARES_ENOMEM; |
|
||||
} |
|
||||
for (i = 0; i < (int)ancount; i++) |
|
||||
{ |
|
||||
/* Decode the RR up to the data field. */ |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
aptr += len; |
|
||||
if (aptr + RRFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
rr_type = DNS_RR_TYPE(aptr); |
|
||||
rr_class = DNS_RR_CLASS(aptr); |
|
||||
rr_len = DNS_RR_LEN(aptr); |
|
||||
aptr += RRFIXEDSZ; |
|
||||
|
|
||||
if (rr_class == C_IN && rr_type == T_PTR |
|
||||
&& strcasecmp(rr_name, ptrname) == 0) |
|
||||
{ |
|
||||
/* Decode the RR data and set hostname to it. */ |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, |
|
||||
&len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
if (hostname) |
|
||||
free(hostname); |
|
||||
hostname = rr_data; |
|
||||
aliases[aliascnt] = malloc((strlen(rr_data)+1) * sizeof(char *)); |
|
||||
if (!aliases[aliascnt]) |
|
||||
{ |
|
||||
status = ARES_ENOMEM; |
|
||||
break; |
|
||||
} |
|
||||
strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1); |
|
||||
aliascnt++; |
|
||||
if (aliascnt >= alias_alloc) { |
|
||||
char **ptr; |
|
||||
alias_alloc *= 2; |
|
||||
ptr = realloc(aliases, alias_alloc * sizeof(char *)); |
|
||||
if(!ptr) { |
|
||||
status = ARES_ENOMEM; |
|
||||
break; |
|
||||
} |
|
||||
aliases = ptr; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
if (rr_class == C_IN && rr_type == T_CNAME) |
|
||||
{ |
|
||||
/* Decode the RR data and replace ptrname with it. */ |
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, |
|
||||
&len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
free(ptrname); |
|
||||
ptrname = rr_data; |
|
||||
} |
|
||||
|
|
||||
free(rr_name); |
|
||||
aptr += rr_len; |
|
||||
if (aptr > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
if (status == ARES_SUCCESS && !hostname) |
|
||||
status = ARES_ENODATA; |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
/* We got our answer. Allocate memory to build the host entry. */ |
|
||||
hostent = malloc(sizeof(struct hostent)); |
|
||||
if (hostent) |
|
||||
{ |
|
||||
hostent->h_addr_list = malloc(2 * sizeof(char *)); |
|
||||
if (hostent->h_addr_list) |
|
||||
{ |
|
||||
hostent->h_addr_list[0] = malloc(addrlen); |
|
||||
if (hostent->h_addr_list[0]) |
|
||||
{ |
|
||||
hostent->h_aliases = malloc((aliascnt+1) * sizeof (char *)); |
|
||||
if (hostent->h_aliases) |
|
||||
{ |
|
||||
/* Fill in the hostent and return successfully. */ |
|
||||
hostent->h_name = hostname; |
|
||||
for (i=0 ; i<aliascnt ; i++) |
|
||||
hostent->h_aliases[i] = aliases[i]; |
|
||||
hostent->h_aliases[aliascnt] = NULL; |
|
||||
hostent->h_addrtype = family; |
|
||||
hostent->h_length = addrlen; |
|
||||
memcpy(hostent->h_addr_list[0], addr, addrlen); |
|
||||
hostent->h_addr_list[1] = NULL; |
|
||||
*host = hostent; |
|
||||
free(aliases); |
|
||||
free(ptrname); |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
free(hostent->h_addr_list[0]); |
|
||||
} |
|
||||
free(hostent->h_addr_list); |
|
||||
} |
|
||||
free(hostent); |
|
||||
} |
|
||||
status = ARES_ENOMEM; |
|
||||
} |
|
||||
for (i=0 ; i<aliascnt ; i++) |
|
||||
if (aliases[i]) |
|
||||
free(aliases[i]); |
|
||||
free(aliases); |
|
||||
if (hostname) |
|
||||
free(hostname); |
|
||||
free(ptrname); |
|
||||
return status; |
|
||||
} |
|
@ -1,179 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2009 by Jakub Hrozek <jhrozek@redhat.com> |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_data.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
/* AIX portability check */ |
|
||||
#ifndef T_SRV |
|
||||
# define T_SRV 33 /* server selection */ |
|
||||
#endif |
|
||||
|
|
||||
int |
|
||||
ares_parse_srv_reply (const unsigned char *abuf, int alen, |
|
||||
struct ares_srv_reply **srv_out) |
|
||||
{ |
|
||||
unsigned int qdcount, ancount, i; |
|
||||
const unsigned char *aptr, *vptr; |
|
||||
int status, rr_type, rr_class, rr_len; |
|
||||
long len; |
|
||||
char *hostname = NULL, *rr_name = NULL; |
|
||||
struct ares_srv_reply *srv_head = NULL; |
|
||||
struct ares_srv_reply *srv_last = NULL; |
|
||||
struct ares_srv_reply *srv_curr; |
|
||||
|
|
||||
/* Set *srv_out to NULL for all failure cases. */ |
|
||||
*srv_out = NULL; |
|
||||
|
|
||||
/* Give up if abuf doesn't have room for a header. */ |
|
||||
if (alen < HFIXEDSZ) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Fetch the question and answer count from the header. */ |
|
||||
qdcount = DNS_HEADER_QDCOUNT (abuf); |
|
||||
ancount = DNS_HEADER_ANCOUNT (abuf); |
|
||||
if (qdcount != 1) |
|
||||
return ARES_EBADRESP; |
|
||||
if (ancount == 0) |
|
||||
return ARES_ENODATA; |
|
||||
|
|
||||
/* Expand the name from the question, and skip past the question. */ |
|
||||
aptr = abuf + HFIXEDSZ; |
|
||||
status = ares_expand_name (aptr, abuf, alen, &hostname, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
return status; |
|
||||
|
|
||||
if (aptr + len + QFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
free (hostname); |
|
||||
return ARES_EBADRESP; |
|
||||
} |
|
||||
aptr += len + QFIXEDSZ; |
|
||||
|
|
||||
/* Examine each answer resource record (RR) in turn. */ |
|
||||
for (i = 0; i < ancount; i++) |
|
||||
{ |
|
||||
/* Decode the RR up to the data field. */ |
|
||||
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
break; |
|
||||
} |
|
||||
aptr += len; |
|
||||
if (aptr + RRFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
rr_type = DNS_RR_TYPE (aptr); |
|
||||
rr_class = DNS_RR_CLASS (aptr); |
|
||||
rr_len = DNS_RR_LEN (aptr); |
|
||||
aptr += RRFIXEDSZ; |
|
||||
|
|
||||
/* Check if we are really looking at a SRV record */ |
|
||||
if (rr_class == C_IN && rr_type == T_SRV) |
|
||||
{ |
|
||||
/* parse the SRV record itself */ |
|
||||
if (rr_len < 6) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
/* Allocate storage for this SRV answer appending it to the list */ |
|
||||
srv_curr = ares_malloc_data(ARES_DATATYPE_SRV_REPLY); |
|
||||
if (!srv_curr) |
|
||||
{ |
|
||||
status = ARES_ENOMEM; |
|
||||
break; |
|
||||
} |
|
||||
if (srv_last) |
|
||||
{ |
|
||||
srv_last->next = srv_curr; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
srv_head = srv_curr; |
|
||||
} |
|
||||
srv_last = srv_curr; |
|
||||
|
|
||||
vptr = aptr; |
|
||||
srv_curr->priority = ntohs (*((unsigned short *)vptr)); |
|
||||
vptr += sizeof(unsigned short); |
|
||||
srv_curr->weight = ntohs (*((unsigned short *)vptr)); |
|
||||
vptr += sizeof(unsigned short); |
|
||||
srv_curr->port = ntohs (*((unsigned short *)vptr)); |
|
||||
vptr += sizeof(unsigned short); |
|
||||
|
|
||||
status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
/* Don't lose memory in the next iteration */ |
|
||||
free (rr_name); |
|
||||
rr_name = NULL; |
|
||||
|
|
||||
/* Move on to the next record */ |
|
||||
aptr += rr_len; |
|
||||
} |
|
||||
|
|
||||
if (hostname) |
|
||||
free (hostname); |
|
||||
if (rr_name) |
|
||||
free (rr_name); |
|
||||
|
|
||||
/* clean up on error */ |
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
if (srv_head) |
|
||||
ares_free_data (srv_head); |
|
||||
return status; |
|
||||
} |
|
||||
|
|
||||
/* everything looks fine, return the data */ |
|
||||
*srv_out = srv_head; |
|
||||
|
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
@ -1,201 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2009 by Jakub Hrozek <jhrozek@redhat.com> |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETDB_H |
|
||||
# include <netdb.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_STRINGS_H |
|
||||
# include <strings.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_data.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
int |
|
||||
ares_parse_txt_reply (const unsigned char *abuf, int alen, |
|
||||
struct ares_txt_reply **txt_out) |
|
||||
{ |
|
||||
size_t substr_len, str_len; |
|
||||
unsigned int qdcount, ancount, i; |
|
||||
const unsigned char *aptr; |
|
||||
const unsigned char *strptr; |
|
||||
int status, rr_type, rr_class, rr_len; |
|
||||
long len; |
|
||||
char *hostname = NULL, *rr_name = NULL; |
|
||||
struct ares_txt_reply *txt_head = NULL; |
|
||||
struct ares_txt_reply *txt_last = NULL; |
|
||||
struct ares_txt_reply *txt_curr; |
|
||||
|
|
||||
/* Set *txt_out to NULL for all failure cases. */ |
|
||||
*txt_out = NULL; |
|
||||
|
|
||||
/* Give up if abuf doesn't have room for a header. */ |
|
||||
if (alen < HFIXEDSZ) |
|
||||
return ARES_EBADRESP; |
|
||||
|
|
||||
/* Fetch the question and answer count from the header. */ |
|
||||
qdcount = DNS_HEADER_QDCOUNT (abuf); |
|
||||
ancount = DNS_HEADER_ANCOUNT (abuf); |
|
||||
if (qdcount != 1) |
|
||||
return ARES_EBADRESP; |
|
||||
if (ancount == 0) |
|
||||
return ARES_ENODATA; |
|
||||
|
|
||||
/* Expand the name from the question, and skip past the question. */ |
|
||||
aptr = abuf + HFIXEDSZ; |
|
||||
status = ares_expand_name (aptr, abuf, alen, &hostname, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
return status; |
|
||||
|
|
||||
if (aptr + len + QFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
free (hostname); |
|
||||
return ARES_EBADRESP; |
|
||||
} |
|
||||
aptr += len + QFIXEDSZ; |
|
||||
|
|
||||
/* Examine each answer resource record (RR) in turn. */ |
|
||||
for (i = 0; i < ancount; i++) |
|
||||
{ |
|
||||
/* Decode the RR up to the data field. */ |
|
||||
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
break; |
|
||||
} |
|
||||
aptr += len; |
|
||||
if (aptr + RRFIXEDSZ > abuf + alen) |
|
||||
{ |
|
||||
status = ARES_EBADRESP; |
|
||||
break; |
|
||||
} |
|
||||
rr_type = DNS_RR_TYPE (aptr); |
|
||||
rr_class = DNS_RR_CLASS (aptr); |
|
||||
rr_len = DNS_RR_LEN (aptr); |
|
||||
aptr += RRFIXEDSZ; |
|
||||
|
|
||||
/* Check if we are really looking at a TXT record */ |
|
||||
if (rr_class == C_IN && rr_type == T_TXT) |
|
||||
{ |
|
||||
/* Allocate storage for this TXT answer appending it to the list */ |
|
||||
txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY); |
|
||||
if (!txt_curr) |
|
||||
{ |
|
||||
status = ARES_ENOMEM; |
|
||||
break; |
|
||||
} |
|
||||
if (txt_last) |
|
||||
{ |
|
||||
txt_last->next = txt_curr; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
txt_head = txt_curr; |
|
||||
} |
|
||||
txt_last = txt_curr; |
|
||||
|
|
||||
/*
|
|
||||
* There may be multiple substrings in a single TXT record. Each |
|
||||
* substring may be up to 255 characters in length, with a |
|
||||
* "length byte" indicating the size of the substring payload. |
|
||||
* RDATA contains both the length-bytes and payloads of all |
|
||||
* substrings contained therein. |
|
||||
*/ |
|
||||
|
|
||||
/* Compute total length to allow a single memory allocation */ |
|
||||
strptr = aptr; |
|
||||
while (strptr < (aptr + rr_len)) |
|
||||
{ |
|
||||
substr_len = (unsigned char)*strptr; |
|
||||
txt_curr->length += substr_len; |
|
||||
strptr += substr_len + 1; |
|
||||
} |
|
||||
|
|
||||
/* Including null byte */ |
|
||||
txt_curr->txt = malloc (txt_curr->length + 1); |
|
||||
if (txt_curr->txt == NULL) |
|
||||
{ |
|
||||
status = ARES_ENOMEM; |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
/* Step through the list of substrings, concatenating them */ |
|
||||
str_len = 0; |
|
||||
strptr = aptr; |
|
||||
while (strptr < (aptr + rr_len)) |
|
||||
{ |
|
||||
substr_len = (unsigned char)*strptr; |
|
||||
strptr++; |
|
||||
memcpy ((char *) txt_curr->txt + str_len, strptr, substr_len); |
|
||||
str_len += substr_len; |
|
||||
strptr += substr_len; |
|
||||
} |
|
||||
/* Make sure we NULL-terminate */ |
|
||||
*((char *) txt_curr->txt + txt_curr->length) = '\0'; |
|
||||
} |
|
||||
|
|
||||
/* Don't lose memory in the next iteration */ |
|
||||
free (rr_name); |
|
||||
rr_name = NULL; |
|
||||
|
|
||||
/* Move on to the next record */ |
|
||||
aptr += rr_len; |
|
||||
} |
|
||||
|
|
||||
if (hostname) |
|
||||
free (hostname); |
|
||||
if (rr_name) |
|
||||
free (rr_name); |
|
||||
|
|
||||
/* clean up on error */ |
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
if (txt_head) |
|
||||
ares_free_data (txt_head); |
|
||||
return status; |
|
||||
} |
|
||||
|
|
||||
/* everything looks fine, return the data */ |
|
||||
*txt_out = txt_head; |
|
||||
|
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
@ -1,351 +0,0 @@ |
|||||
#ifndef __ARES_PRIVATE_H |
|
||||
#define __ARES_PRIVATE_H |
|
||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* Copyright (C) 2004-2010 by Daniel Stenberg |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
/*
|
|
||||
* Define WIN32 when build target is Win32 API |
|
||||
*/ |
|
||||
|
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) |
|
||||
#define WIN32 |
|
||||
#endif |
|
||||
|
|
||||
#include <stdio.h> |
|
||||
#include <sys/types.h> |
|
||||
|
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
#include <netinet/in.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef WATT32 |
|
||||
#include <tcp.h> |
|
||||
#include <sys/ioctl.h> |
|
||||
#define writev(s,v,c) writev_s(s,v,c) |
|
||||
#define HAVE_WRITEV 1 |
|
||||
#endif |
|
||||
|
|
||||
#ifdef NETWARE |
|
||||
#include <time.h> |
|
||||
#endif |
|
||||
|
|
||||
#define DEFAULT_TIMEOUT 5000 /* milliseconds */ |
|
||||
#define DEFAULT_TRIES 4 |
|
||||
#ifndef INADDR_NONE |
|
||||
#define INADDR_NONE 0xffffffff |
|
||||
#endif |
|
||||
|
|
||||
#if defined(WIN32) && !defined(WATT32) |
|
||||
|
|
||||
#define IS_NT() ((int)GetVersion() > 0) |
|
||||
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" |
|
||||
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" |
|
||||
#define NAMESERVER "NameServer" |
|
||||
#define DHCPNAMESERVER "DhcpNameServer" |
|
||||
#define DATABASEPATH "DatabasePath" |
|
||||
#define WIN_PATH_HOSTS "\\hosts" |
|
||||
|
|
||||
#elif defined(WATT32) |
|
||||
|
|
||||
#define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf" |
|
||||
|
|
||||
#elif defined(NETWARE) |
|
||||
|
|
||||
#define PATH_RESOLV_CONF "sys:/etc/resolv.cfg" |
|
||||
#define PATH_HOSTS "sys:/etc/hosts" |
|
||||
|
|
||||
#elif defined(__riscos__) |
|
||||
|
|
||||
#define PATH_HOSTS "InetDBase: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 |
|
||||
|
|
||||
#define ARES_ID_KEY_LEN 31 |
|
||||
|
|
||||
#include "ares_ipv6.h" |
|
||||
#include "ares_llist.h" |
|
||||
|
|
||||
#ifndef HAVE_STRDUP |
|
||||
# include "ares_strdup.h" |
|
||||
# define strdup(ptr) ares_strdup(ptr) |
|
||||
#endif |
|
||||
|
|
||||
#ifndef HAVE_STRCASECMP |
|
||||
# include "ares_strcasecmp.h" |
|
||||
# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2) |
|
||||
#endif |
|
||||
|
|
||||
#ifndef HAVE_STRNCASECMP |
|
||||
# include "ares_strcasecmp.h" |
|
||||
# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n) |
|
||||
#endif |
|
||||
|
|
||||
#ifndef HAVE_WRITEV |
|
||||
# include "ares_writev.h" |
|
||||
# define writev(s,ptr,cnt) ares_writev(s,ptr,cnt) |
|
||||
#endif |
|
||||
|
|
||||
struct ares_addr { |
|
||||
int family; |
|
||||
union { |
|
||||
struct in_addr addr4; |
|
||||
struct ares_in6_addr addr6; |
|
||||
} addr; |
|
||||
}; |
|
||||
#define addrV4 addr.addr4 |
|
||||
#define addrV6 addr.addr6 |
|
||||
|
|
||||
struct query; |
|
||||
|
|
||||
struct send_request { |
|
||||
/* Remaining data to send */ |
|
||||
const unsigned char *data; |
|
||||
size_t len; |
|
||||
|
|
||||
/* The query for which we're sending this data */ |
|
||||
struct query* owner_query; |
|
||||
/* The buffer we're using, if we have our own copy of the packet */ |
|
||||
unsigned char *data_storage; |
|
||||
|
|
||||
/* Next request in queue */ |
|
||||
struct send_request *next; |
|
||||
}; |
|
||||
|
|
||||
struct server_state { |
|
||||
struct ares_addr addr; |
|
||||
ares_socket_t udp_socket; |
|
||||
ares_socket_t tcp_socket; |
|
||||
|
|
||||
/* Mini-buffer for reading the length word */ |
|
||||
unsigned char tcp_lenbuf[2]; |
|
||||
int tcp_lenbuf_pos; |
|
||||
int tcp_length; |
|
||||
|
|
||||
/* Buffer for reading actual TCP data */ |
|
||||
unsigned char *tcp_buffer; |
|
||||
int tcp_buffer_pos; |
|
||||
|
|
||||
/* TCP output queue */ |
|
||||
struct send_request *qhead; |
|
||||
struct send_request *qtail; |
|
||||
|
|
||||
/* Which incarnation of this connection is this? We don't want to
|
|
||||
* retransmit requests into the very same socket, but if the server |
|
||||
* closes on us and we re-open the connection, then we do want to |
|
||||
* re-send. */ |
|
||||
int tcp_connection_generation; |
|
||||
|
|
||||
/* Circular, doubly-linked list of outstanding queries to this server */ |
|
||||
struct list_node queries_to_server; |
|
||||
|
|
||||
/* Link back to owning channel */ |
|
||||
ares_channel channel; |
|
||||
|
|
||||
/* Is this server broken? We mark connections as broken when a
|
|
||||
* request that is queued for sending times out. |
|
||||
*/ |
|
||||
int is_broken; |
|
||||
}; |
|
||||
|
|
||||
/* State to represent a DNS query */ |
|
||||
struct query { |
|
||||
/* Query ID from qbuf, for faster lookup, and current timeout */ |
|
||||
unsigned short qid; |
|
||||
struct timeval timeout; |
|
||||
|
|
||||
/*
|
|
||||
* Links for the doubly-linked lists in which we insert a query. |
|
||||
* These circular, doubly-linked lists that are hash-bucketed based |
|
||||
* the attributes we care about, help making most important |
|
||||
* operations O(1). |
|
||||
*/ |
|
||||
struct list_node queries_by_qid; /* hopefully in same cache line as qid */ |
|
||||
struct list_node queries_by_timeout; |
|
||||
struct list_node queries_to_server; |
|
||||
struct list_node all_queries; |
|
||||
|
|
||||
/* Query buf with length at beginning, for TCP transmission */ |
|
||||
unsigned char *tcpbuf; |
|
||||
int tcplen; |
|
||||
|
|
||||
/* Arguments passed to ares_send() (qbuf points into tcpbuf) */ |
|
||||
const unsigned char *qbuf; |
|
||||
int qlen; |
|
||||
ares_callback callback; |
|
||||
void *arg; |
|
||||
|
|
||||
/* Query status */ |
|
||||
int try; /* Number of times we tried this query already. */ |
|
||||
int server; /* Server this query has last been sent to. */ |
|
||||
struct query_server_info *server_info; /* per-server state */ |
|
||||
int using_tcp; |
|
||||
int error_status; |
|
||||
int timeouts; /* number of timeouts we saw for this request */ |
|
||||
}; |
|
||||
|
|
||||
/* Per-server state for a query */ |
|
||||
struct query_server_info { |
|
||||
int skip_server; /* should we skip server, due to errors, etc? */ |
|
||||
int tcp_connection_generation; /* into which TCP connection did we send? */ |
|
||||
}; |
|
||||
|
|
||||
/* An IP address pattern; matches an IP address X if X & mask == addr */ |
|
||||
#define PATTERN_MASK 0x1 |
|
||||
#define PATTERN_CIDR 0x2 |
|
||||
|
|
||||
struct apattern { |
|
||||
union |
|
||||
{ |
|
||||
struct in_addr addr4; |
|
||||
struct ares_in6_addr addr6; |
|
||||
} addr; |
|
||||
union |
|
||||
{ |
|
||||
struct in_addr addr4; |
|
||||
struct ares_in6_addr addr6; |
|
||||
unsigned short bits; |
|
||||
} mask; |
|
||||
int family; |
|
||||
unsigned short type; |
|
||||
}; |
|
||||
|
|
||||
typedef struct rc4_key |
|
||||
{ |
|
||||
unsigned char state[256]; |
|
||||
unsigned char x; |
|
||||
unsigned char y; |
|
||||
} rc4_key; |
|
||||
|
|
||||
struct ares_channeldata { |
|
||||
/* Configuration data */ |
|
||||
int flags; |
|
||||
int timeout; /* in milliseconds */ |
|
||||
int tries; |
|
||||
int ndots; |
|
||||
int rotate; /* if true, all servers specified are used */ |
|
||||
int udp_port; |
|
||||
int tcp_port; |
|
||||
int socket_send_buffer_size; |
|
||||
int socket_receive_buffer_size; |
|
||||
char **domains; |
|
||||
int ndomains; |
|
||||
struct apattern *sortlist; |
|
||||
int nsort; |
|
||||
char *lookups; |
|
||||
|
|
||||
/* 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]; |
|
||||
|
|
||||
int optmask; /* the option bitfield passed in at init time */ |
|
||||
|
|
||||
/* Server addresses and communications state */ |
|
||||
struct server_state *servers; |
|
||||
int nservers; |
|
||||
|
|
||||
/* ID to use for next query */ |
|
||||
unsigned short next_id; |
|
||||
/* key to use when generating new ids */ |
|
||||
rc4_key id_key; |
|
||||
|
|
||||
/* Generation number to use for the next TCP socket open/close */ |
|
||||
int tcp_connection_generation; |
|
||||
|
|
||||
/* The time at which we last called process_timeouts(). Uses integer seconds
|
|
||||
just to draw the line somewhere. */ |
|
||||
time_t last_timeout_processed; |
|
||||
|
|
||||
/* Last server we sent a query to. */ |
|
||||
int last_server; |
|
||||
|
|
||||
/* Circular, doubly-linked list of queries, bucketed various ways.... */ |
|
||||
/* All active queries in a single list: */ |
|
||||
struct list_node all_queries; |
|
||||
/* Queries bucketed by qid, for quickly dispatching DNS responses: */ |
|
||||
#define ARES_QID_TABLE_SIZE 2048 |
|
||||
struct list_node queries_by_qid[ARES_QID_TABLE_SIZE]; |
|
||||
/* Queries bucketed by timeout, for quickly handling timeouts: */ |
|
||||
#define ARES_TIMEOUT_TABLE_SIZE 1024 |
|
||||
struct list_node queries_by_timeout[ARES_TIMEOUT_TABLE_SIZE]; |
|
||||
|
|
||||
ares_sock_state_cb sock_state_cb; |
|
||||
void *sock_state_cb_data; |
|
||||
|
|
||||
ares_sock_create_callback sock_create_cb; |
|
||||
void *sock_create_cb_data; |
|
||||
}; |
|
||||
|
|
||||
/* return true if now is exactly check time or later */ |
|
||||
int ares__timedout(struct timeval *now, |
|
||||
struct timeval *check); |
|
||||
/* add the specific number of milliseconds to the time in the first argument */ |
|
||||
int ares__timeadd(struct timeval *now, |
|
||||
int millisecs); |
|
||||
/* return time offset between now and (future) check, in milliseconds */ |
|
||||
long ares__timeoffset(struct timeval *now, |
|
||||
struct timeval *check); |
|
||||
/* returns ARES_SUCCESS if library has been initialized */ |
|
||||
int ares_library_initialized(void); |
|
||||
void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len); |
|
||||
void ares__send_query(ares_channel channel, struct query *query, |
|
||||
struct timeval *now); |
|
||||
void ares__close_sockets(ares_channel channel, struct server_state *server); |
|
||||
int ares__get_hostent(FILE *fp, int family, struct hostent **host); |
|
||||
int ares__read_line(FILE *fp, char **buf, size_t *bufsize); |
|
||||
void ares__free_query(struct query *query); |
|
||||
unsigned short ares__generate_new_id(rc4_key* key); |
|
||||
struct timeval ares__tvnow(void); |
|
||||
int ares__expand_name_for_response(const unsigned char *encoded, |
|
||||
const unsigned char *abuf, int alen, |
|
||||
char **s, long *enclen); |
|
||||
void ares__init_servers_state(ares_channel channel); |
|
||||
void ares__destroy_servers_state(ares_channel channel); |
|
||||
#if 0 /* Not used */
|
|
||||
long ares__tvdiff(struct timeval t1, struct timeval t2); |
|
||||
#endif |
|
||||
|
|
||||
#define ARES_SWAP_BYTE(a,b) \ |
|
||||
{ unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; } |
|
||||
|
|
||||
#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) |
|
||||
|
|
||||
#ifdef CURLDEBUG |
|
||||
/* This is low-level hard-hacking memory leak tracking and similar. Using the
|
|
||||
libcurl lowlevel code from within library is ugly and only works when |
|
||||
c-ares is built and linked with a similarly curldebug-enabled libcurl, |
|
||||
but we do this anyway for convenience. */ |
|
||||
#include "../lib/memdebug.h" |
|
||||
#endif |
|
||||
|
|
||||
#endif /* __ARES_PRIVATE_H */ |
|
File diff suppressed because it is too large
@ -1,183 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
struct qquery { |
|
||||
ares_callback callback; |
|
||||
void *arg; |
|
||||
}; |
|
||||
|
|
||||
static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen); |
|
||||
|
|
||||
void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len) |
|
||||
{ |
|
||||
unsigned char x; |
|
||||
unsigned char y; |
|
||||
unsigned char* state; |
|
||||
unsigned char xorIndex; |
|
||||
short counter; |
|
||||
|
|
||||
x = key->x; |
|
||||
y = key->y; |
|
||||
|
|
||||
state = &key->state[0]; |
|
||||
for(counter = 0; counter < buffer_len; counter ++) |
|
||||
{ |
|
||||
x = (unsigned char)((x + 1) % 256); |
|
||||
y = (unsigned char)((state[x] + y) % 256); |
|
||||
ARES_SWAP_BYTE(&state[x], &state[y]); |
|
||||
|
|
||||
xorIndex = (unsigned char)((state[x] + state[y]) % 256); |
|
||||
|
|
||||
buffer_ptr[counter] = (unsigned char)(buffer_ptr[counter]^state[xorIndex]); |
|
||||
} |
|
||||
key->x = x; |
|
||||
key->y = y; |
|
||||
} |
|
||||
|
|
||||
static struct query* find_query_by_id(ares_channel channel, unsigned short id) |
|
||||
{ |
|
||||
unsigned short qid; |
|
||||
struct list_node* list_head; |
|
||||
struct list_node* list_node; |
|
||||
DNS_HEADER_SET_QID(((unsigned char*)&qid), id); |
|
||||
|
|
||||
/* Find the query corresponding to this packet. */ |
|
||||
list_head = &(channel->queries_by_qid[qid % ARES_QID_TABLE_SIZE]); |
|
||||
for (list_node = list_head->next; list_node != list_head; |
|
||||
list_node = list_node->next) |
|
||||
{ |
|
||||
struct query *q = list_node->data; |
|
||||
if (q->qid == qid) |
|
||||
return q; |
|
||||
} |
|
||||
return NULL; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/* a unique query id is generated using an rc4 key. Since the id may already
|
|
||||
be used by a running query (as infrequent as it may be), a lookup is |
|
||||
performed per id generation. In practice this search should happen only |
|
||||
once per newly generated id |
|
||||
*/ |
|
||||
static unsigned short generate_unique_id(ares_channel channel) |
|
||||
{ |
|
||||
unsigned short id; |
|
||||
|
|
||||
do { |
|
||||
id = ares__generate_new_id(&channel->id_key); |
|
||||
} while (find_query_by_id(channel, id)); |
|
||||
|
|
||||
return (unsigned short)id; |
|
||||
} |
|
||||
|
|
||||
void ares_query(ares_channel channel, const char *name, int dnsclass, |
|
||||
int type, ares_callback callback, void *arg) |
|
||||
{ |
|
||||
struct qquery *qquery; |
|
||||
unsigned char *qbuf; |
|
||||
int qlen, rd, status; |
|
||||
|
|
||||
/* Compose the query. */ |
|
||||
rd = !(channel->flags & ARES_FLAG_NORECURSE); |
|
||||
status = ares_mkquery(name, dnsclass, type, channel->next_id, rd, &qbuf, |
|
||||
&qlen); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
if (qbuf != NULL) free(qbuf); |
|
||||
callback(arg, status, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
channel->next_id = generate_unique_id(channel); |
|
||||
|
|
||||
/* Allocate and fill in the query structure. */ |
|
||||
qquery = malloc(sizeof(struct qquery)); |
|
||||
if (!qquery) |
|
||||
{ |
|
||||
ares_free_string(qbuf); |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
qquery->callback = callback; |
|
||||
qquery->arg = arg; |
|
||||
|
|
||||
/* Send it off. qcallback will be called when we get an answer. */ |
|
||||
ares_send(channel, qbuf, qlen, qcallback, qquery); |
|
||||
ares_free_string(qbuf); |
|
||||
} |
|
||||
|
|
||||
static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen) |
|
||||
{ |
|
||||
struct qquery *qquery = (struct qquery *) arg; |
|
||||
unsigned int ancount; |
|
||||
int rcode; |
|
||||
|
|
||||
if (status != ARES_SUCCESS) |
|
||||
qquery->callback(qquery->arg, status, timeouts, abuf, alen); |
|
||||
else |
|
||||
{ |
|
||||
/* Pull the response code and answer count from the packet. */ |
|
||||
rcode = DNS_HEADER_RCODE(abuf); |
|
||||
ancount = DNS_HEADER_ANCOUNT(abuf); |
|
||||
|
|
||||
/* Convert errors. */ |
|
||||
switch (rcode) |
|
||||
{ |
|
||||
case NOERROR: |
|
||||
status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA; |
|
||||
break; |
|
||||
case FORMERR: |
|
||||
status = ARES_EFORMERR; |
|
||||
break; |
|
||||
case SERVFAIL: |
|
||||
status = ARES_ESERVFAIL; |
|
||||
break; |
|
||||
case NXDOMAIN: |
|
||||
status = ARES_ENOTFOUND; |
|
||||
break; |
|
||||
case NOTIMP: |
|
||||
status = ARES_ENOTIMP; |
|
||||
break; |
|
||||
case REFUSED: |
|
||||
status = ARES_EREFUSED; |
|
||||
break; |
|
||||
} |
|
||||
qquery->callback(qquery->arg, status, timeouts, abuf, alen); |
|
||||
} |
|
||||
free(qquery); |
|
||||
} |
|
@ -1,144 +0,0 @@ |
|||||
#ifndef __CARES_RULES_H |
|
||||
#define __CARES_RULES_H |
|
||||
|
|
||||
|
|
||||
/* Copyright (C) 2009 by Daniel Stenberg et al
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software and its |
|
||||
* documentation for any purpose and without fee is hereby granted, provided |
|
||||
* that the above copyright notice appear in all copies and that both that |
|
||||
* copyright notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or |
|
||||
* publicity pertaining to distribution of the software without specific, |
|
||||
* written prior permission. M.I.T. makes no representations about the |
|
||||
* suitability of this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
/* ================================================================ */ |
|
||||
/* COMPILE TIME SANITY CHECKS */ |
|
||||
/* ================================================================ */ |
|
||||
|
|
||||
/*
|
|
||||
* NOTE 1: |
|
||||
* ------- |
|
||||
* |
|
||||
* All checks done in this file are intentionally placed in a public |
|
||||
* header file which is pulled by ares.h when an application is |
|
||||
* being built using an already built c-ares library. Additionally |
|
||||
* this file is also included and used when building the library. |
|
||||
* |
|
||||
* If compilation fails on this file it is certainly sure that the |
|
||||
* problem is elsewhere. It could be a problem in the ares_build.h |
|
||||
* header file, or simply that you are using different compilation |
|
||||
* settings than those used to build the library. |
|
||||
* |
|
||||
* Nothing in this file is intended to be modified or adjusted by the |
|
||||
* c-ares library user nor by the c-ares library builder. |
|
||||
* |
|
||||
* Do not deactivate any check, these are done to make sure that the |
|
||||
* library is properly built and used. |
|
||||
* |
|
||||
* You can find further help on the c-ares development mailing list: |
|
||||
* http://cool.haxx.se/mailman/listinfo/c-ares/
|
|
||||
* |
|
||||
* NOTE 2 |
|
||||
* ------ |
|
||||
* |
|
||||
* Some of the following compile time checks are based on the fact |
|
||||
* that the dimension of a constant array can not be a negative one. |
|
||||
* In this way if the compile time verification fails, the compilation |
|
||||
* will fail issuing an error. The error description wording is compiler |
|
||||
* dependent but it will be quite similar to one of the following: |
|
||||
* |
|
||||
* "negative subscript or subscript is too large" |
|
||||
* "array must have at least one element" |
|
||||
* "-1 is an illegal array size" |
|
||||
* "size of array is negative" |
|
||||
* |
|
||||
* If you are building an application which tries to use an already |
|
||||
* built c-ares library and you are getting this kind of errors on |
|
||||
* this file, it is a clear indication that there is a mismatch between |
|
||||
* how the library was built and how you are trying to use it for your |
|
||||
* application. Your already compiled or binary library provider is the |
|
||||
* only one who can give you the details you need to properly use it. |
|
||||
*/ |
|
||||
|
|
||||
/*
|
|
||||
* Verify that some macros are actually defined. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef CARES_SIZEOF_LONG |
|
||||
# error "CARES_SIZEOF_LONG definition is missing!" |
|
||||
Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing |
|
||||
#endif |
|
||||
|
|
||||
#ifndef CARES_TYPEOF_ARES_SOCKLEN_T |
|
||||
# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!" |
|
||||
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing |
|
||||
#endif |
|
||||
|
|
||||
#ifndef CARES_SIZEOF_ARES_SOCKLEN_T |
|
||||
# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!" |
|
||||
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing |
|
||||
#endif |
|
||||
|
|
||||
/*
|
|
||||
* Macros private to this header file. |
|
||||
*/ |
|
||||
|
|
||||
#define CareschkszEQ(t, s) sizeof(t) == s ? 1 : -1 |
|
||||
|
|
||||
#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 |
|
||||
|
|
||||
/*
|
|
||||
* Verify that the size previously defined and expected for long |
|
||||
* is the same as the one reported by sizeof() at compile time. |
|
||||
*/ |
|
||||
|
|
||||
typedef char |
|
||||
__cares_rule_01__ |
|
||||
[CareschkszEQ(long, CARES_SIZEOF_LONG)]; |
|
||||
|
|
||||
/*
|
|
||||
* Verify that the size previously defined and expected for |
|
||||
* ares_socklen_t is actually the the same as the one reported |
|
||||
* by sizeof() at compile time. |
|
||||
*/ |
|
||||
|
|
||||
typedef char |
|
||||
__cares_rule_02__ |
|
||||
[CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)]; |
|
||||
|
|
||||
/*
|
|
||||
* Verify at compile time that the size of ares_socklen_t as reported |
|
||||
* by sizeof() is greater or equal than the one reported for int for |
|
||||
* the current compilation. |
|
||||
*/ |
|
||||
|
|
||||
typedef char |
|
||||
__cares_rule_03__ |
|
||||
[CareschkszGE(ares_socklen_t, int)]; |
|
||||
|
|
||||
/* ================================================================ */ |
|
||||
/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ |
|
||||
/* ================================================================ */ |
|
||||
|
|
||||
/*
|
|
||||
* Get rid of macros private to this header file. |
|
||||
*/ |
|
||||
|
|
||||
#undef CareschkszEQ |
|
||||
#undef CareschkszGE |
|
||||
|
|
||||
/*
|
|
||||
* Get rid of macros not intended to exist beyond this point. |
|
||||
*/ |
|
||||
|
|
||||
#undef CARES_PULL_WS2TCPIP_H |
|
||||
#undef CARES_PULL_SYS_TYPES_H |
|
||||
#undef CARES_PULL_SYS_SOCKET_H |
|
||||
|
|
||||
#undef CARES_TYPEOF_ARES_SOCKLEN_T |
|
||||
|
|
||||
#endif /* __CARES_RULES_H */ |
|
@ -1,322 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#include <stdio.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include <ctype.h> |
|
||||
#include <errno.h> |
|
||||
|
|
||||
#ifdef HAVE_STRINGS_H |
|
||||
# include <strings.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
struct search_query { |
|
||||
/* Arguments passed to ares_search */ |
|
||||
ares_channel channel; |
|
||||
char *name; /* copied into an allocated buffer */ |
|
||||
int dnsclass; |
|
||||
int type; |
|
||||
ares_callback callback; |
|
||||
void *arg; |
|
||||
|
|
||||
int status_as_is; /* error status from trying as-is */ |
|
||||
int next_domain; /* next search domain to try */ |
|
||||
int trying_as_is; /* current query is for name as-is */ |
|
||||
int timeouts; /* number of timeouts we saw for this request */ |
|
||||
int ever_got_nodata; /* did we ever get ARES_ENODATA along the way? */ |
|
||||
}; |
|
||||
|
|
||||
static void search_callback(void *arg, int status, int timeouts, |
|
||||
unsigned char *abuf, int alen); |
|
||||
static void end_squery(struct search_query *squery, int status, |
|
||||
unsigned char *abuf, int alen); |
|
||||
static int cat_domain(const char *name, const char *domain, char **s); |
|
||||
static int single_domain(ares_channel channel, const char *name, char **s); |
|
||||
|
|
||||
void ares_search(ares_channel channel, const char *name, int dnsclass, |
|
||||
int type, ares_callback callback, void *arg) |
|
||||
{ |
|
||||
struct search_query *squery; |
|
||||
char *s; |
|
||||
const char *p; |
|
||||
int status, ndots; |
|
||||
|
|
||||
/* If name only yields one domain to search, then we don't have
|
|
||||
* to keep extra state, so just do an ares_query(). |
|
||||
*/ |
|
||||
status = single_domain(channel, name, &s); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
{ |
|
||||
callback(arg, status, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
if (s) |
|
||||
{ |
|
||||
ares_query(channel, s, dnsclass, type, callback, arg); |
|
||||
free(s); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
/* Allocate a search_query structure to hold the state necessary for
|
|
||||
* doing multiple lookups. |
|
||||
*/ |
|
||||
squery = malloc(sizeof(struct search_query)); |
|
||||
if (!squery) |
|
||||
{ |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
squery->channel = channel; |
|
||||
squery->name = strdup(name); |
|
||||
if (!squery->name) |
|
||||
{ |
|
||||
free(squery); |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
squery->dnsclass = dnsclass; |
|
||||
squery->type = type; |
|
||||
squery->status_as_is = -1; |
|
||||
squery->callback = callback; |
|
||||
squery->arg = arg; |
|
||||
squery->timeouts = 0; |
|
||||
squery->ever_got_nodata = 0; |
|
||||
|
|
||||
/* Count the number of dots in name. */ |
|
||||
ndots = 0; |
|
||||
for (p = name; *p; p++) |
|
||||
{ |
|
||||
if (*p == '.') |
|
||||
ndots++; |
|
||||
} |
|
||||
|
|
||||
/* If ndots is at least the channel ndots threshold (usually 1),
|
|
||||
* then we try the name as-is first. Otherwise, we try the name |
|
||||
* as-is last. |
|
||||
*/ |
|
||||
if (ndots >= channel->ndots) |
|
||||
{ |
|
||||
/* Try the name as-is first. */ |
|
||||
squery->next_domain = 0; |
|
||||
squery->trying_as_is = 1; |
|
||||
ares_query(channel, name, dnsclass, type, search_callback, squery); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
/* Try the name as-is last; start with the first search domain. */ |
|
||||
squery->next_domain = 1; |
|
||||
squery->trying_as_is = 0; |
|
||||
status = cat_domain(name, channel->domains[0], &s); |
|
||||
if (status == ARES_SUCCESS) |
|
||||
{ |
|
||||
ares_query(channel, s, dnsclass, type, search_callback, squery); |
|
||||
free(s); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
/* failed, free the malloc()ed memory */ |
|
||||
free(squery->name); |
|
||||
free(squery); |
|
||||
callback(arg, status, 0, NULL, 0); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
static void search_callback(void *arg, int status, int timeouts, |
|
||||
unsigned char *abuf, int alen) |
|
||||
{ |
|
||||
struct search_query *squery = (struct search_query *) arg; |
|
||||
ares_channel channel = squery->channel; |
|
||||
char *s; |
|
||||
|
|
||||
squery->timeouts += timeouts; |
|
||||
|
|
||||
/* Stop searching unless we got a non-fatal error. */ |
|
||||
if (status != ARES_ENODATA && status != ARES_ESERVFAIL |
|
||||
&& status != ARES_ENOTFOUND) |
|
||||
end_squery(squery, status, abuf, alen); |
|
||||
else |
|
||||
{ |
|
||||
/* Save the status if we were trying as-is. */ |
|
||||
if (squery->trying_as_is) |
|
||||
squery->status_as_is = status; |
|
||||
|
|
||||
/*
|
|
||||
* If we ever get ARES_ENODATA along the way, record that; if the search |
|
||||
* should run to the very end and we got at least one ARES_ENODATA, |
|
||||
* then callers like ares_gethostbyname() may want to try a T_A search |
|
||||
* even if the last domain we queried for T_AAAA resource records |
|
||||
* returned ARES_ENOTFOUND. |
|
||||
*/ |
|
||||
if (status == ARES_ENODATA) |
|
||||
squery->ever_got_nodata = 1; |
|
||||
|
|
||||
if (squery->next_domain < channel->ndomains) |
|
||||
{ |
|
||||
/* Try the next domain. */ |
|
||||
status = cat_domain(squery->name, |
|
||||
channel->domains[squery->next_domain], &s); |
|
||||
if (status != ARES_SUCCESS) |
|
||||
end_squery(squery, status, NULL, 0); |
|
||||
else |
|
||||
{ |
|
||||
squery->trying_as_is = 0; |
|
||||
squery->next_domain++; |
|
||||
ares_query(channel, s, squery->dnsclass, squery->type, |
|
||||
search_callback, squery); |
|
||||
free(s); |
|
||||
} |
|
||||
} |
|
||||
else if (squery->status_as_is == -1) |
|
||||
{ |
|
||||
/* Try the name as-is at the end. */ |
|
||||
squery->trying_as_is = 1; |
|
||||
ares_query(channel, squery->name, squery->dnsclass, squery->type, |
|
||||
search_callback, squery); |
|
||||
} |
|
||||
else { |
|
||||
if (squery->status_as_is == ARES_ENOTFOUND && squery->ever_got_nodata) { |
|
||||
end_squery(squery, ARES_ENODATA, NULL, 0); |
|
||||
} |
|
||||
else |
|
||||
end_squery(squery, squery->status_as_is, NULL, 0); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
static void end_squery(struct search_query *squery, int status, |
|
||||
unsigned char *abuf, int alen) |
|
||||
{ |
|
||||
squery->callback(squery->arg, status, squery->timeouts, abuf, alen); |
|
||||
free(squery->name); |
|
||||
free(squery); |
|
||||
} |
|
||||
|
|
||||
/* Concatenate two domains. */ |
|
||||
static int cat_domain(const char *name, const char *domain, char **s) |
|
||||
{ |
|
||||
size_t nlen = strlen(name); |
|
||||
size_t dlen = strlen(domain); |
|
||||
|
|
||||
*s = malloc(nlen + 1 + dlen + 1); |
|
||||
if (!*s) |
|
||||
return ARES_ENOMEM; |
|
||||
memcpy(*s, name, nlen); |
|
||||
(*s)[nlen] = '.'; |
|
||||
memcpy(*s + nlen + 1, domain, dlen); |
|
||||
(*s)[nlen + 1 + dlen] = 0; |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
||||
|
|
||||
/* Determine if this name only yields one query. If it does, set *s to
|
|
||||
* the string we should query, in an allocated buffer. If not, set *s |
|
||||
* to NULL. |
|
||||
*/ |
|
||||
static int single_domain(ares_channel channel, const char *name, char **s) |
|
||||
{ |
|
||||
size_t len = strlen(name); |
|
||||
const char *hostaliases; |
|
||||
FILE *fp; |
|
||||
char *line = NULL; |
|
||||
int status; |
|
||||
size_t linesize; |
|
||||
const char *p, *q; |
|
||||
int error; |
|
||||
|
|
||||
/* If the name contains a trailing dot, then the single query is the name
|
|
||||
* sans the trailing dot. |
|
||||
*/ |
|
||||
if (name[len - 1] == '.') |
|
||||
{ |
|
||||
*s = strdup(name); |
|
||||
return (*s) ? ARES_SUCCESS : ARES_ENOMEM; |
|
||||
} |
|
||||
|
|
||||
if (!(channel->flags & ARES_FLAG_NOALIASES) && !strchr(name, '.')) |
|
||||
{ |
|
||||
/* The name might be a host alias. */ |
|
||||
hostaliases = getenv("HOSTALIASES"); |
|
||||
if (hostaliases) |
|
||||
{ |
|
||||
fp = fopen(hostaliases, "r"); |
|
||||
if (fp) |
|
||||
{ |
|
||||
while ((status = ares__read_line(fp, &line, &linesize)) |
|
||||
== ARES_SUCCESS) |
|
||||
{ |
|
||||
if (strncasecmp(line, name, len) != 0 || |
|
||||
!ISSPACE(line[len])) |
|
||||
continue; |
|
||||
p = line + len; |
|
||||
while (ISSPACE(*p)) |
|
||||
p++; |
|
||||
if (*p) |
|
||||
{ |
|
||||
q = p + 1; |
|
||||
while (*q && !ISSPACE(*q)) |
|
||||
q++; |
|
||||
*s = malloc(q - p + 1); |
|
||||
if (*s) |
|
||||
{ |
|
||||
memcpy(*s, p, q - p); |
|
||||
(*s)[q - p] = 0; |
|
||||
} |
|
||||
free(line); |
|
||||
fclose(fp); |
|
||||
return (*s) ? ARES_SUCCESS : ARES_ENOMEM; |
|
||||
} |
|
||||
} |
|
||||
free(line); |
|
||||
fclose(fp); |
|
||||
if (status != ARES_SUCCESS && status != ARES_EOF) |
|
||||
return status; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
error = errno; |
|
||||
switch(error) |
|
||||
{ |
|
||||
case ENOENT: |
|
||||
case ESRCH: |
|
||||
break; |
|
||||
default: |
|
||||
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", |
|
||||
error, strerror(error))); |
|
||||
DEBUGF(fprintf(stderr, "Error opening file: %s\n", |
|
||||
hostaliases)); |
|
||||
*s = NULL; |
|
||||
return ARES_EFILE; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
if (channel->flags & ARES_FLAG_NOSEARCH || channel->ndomains == 0) |
|
||||
{ |
|
||||
/* No domain search to do; just try the name as-is. */ |
|
||||
*s = strdup(name); |
|
||||
return (*s) ? ARES_SUCCESS : ARES_ENOMEM; |
|
||||
} |
|
||||
|
|
||||
*s = NULL; |
|
||||
return ARES_SUCCESS; |
|
||||
} |
|
@ -1,134 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include <time.h> |
|
||||
#include "ares.h" |
|
||||
#include "ares_dns.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, |
|
||||
ares_callback callback, void *arg) |
|
||||
{ |
|
||||
struct query *query; |
|
||||
int i; |
|
||||
struct timeval now; |
|
||||
|
|
||||
/* Verify that the query is at least long enough to hold the header. */ |
|
||||
if (qlen < HFIXEDSZ || qlen >= (1 << 16)) |
|
||||
{ |
|
||||
callback(arg, ARES_EBADQUERY, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
/* Allocate space for query and allocated fields. */ |
|
||||
query = malloc(sizeof(struct query)); |
|
||||
if (!query) |
|
||||
{ |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
query->tcpbuf = malloc(qlen + 2); |
|
||||
if (!query->tcpbuf) |
|
||||
{ |
|
||||
free(query); |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
query->server_info = malloc(channel->nservers * |
|
||||
sizeof(query->server_info[0])); |
|
||||
if (!query->server_info) |
|
||||
{ |
|
||||
free(query->tcpbuf); |
|
||||
free(query); |
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
/* Compute the query ID. Start with no timeout. */ |
|
||||
query->qid = (unsigned short)DNS_HEADER_QID(qbuf); |
|
||||
query->timeout.tv_sec = 0; |
|
||||
query->timeout.tv_usec = 0; |
|
||||
|
|
||||
/* Form the TCP query buffer by prepending qlen (as two
|
|
||||
* network-order bytes) to qbuf. |
|
||||
*/ |
|
||||
query->tcpbuf[0] = (unsigned char)((qlen >> 8) & 0xff); |
|
||||
query->tcpbuf[1] = (unsigned char)(qlen & 0xff); |
|
||||
memcpy(query->tcpbuf + 2, qbuf, qlen); |
|
||||
query->tcplen = qlen + 2; |
|
||||
|
|
||||
/* Fill in query arguments. */ |
|
||||
query->qbuf = query->tcpbuf + 2; |
|
||||
query->qlen = qlen; |
|
||||
query->callback = callback; |
|
||||
query->arg = arg; |
|
||||
|
|
||||
/* Initialize query status. */ |
|
||||
query->try = 0; |
|
||||
|
|
||||
/* Choose the server to send the query to. If rotation is enabled, keep track
|
|
||||
* of the next server we want to use. */ |
|
||||
query->server = channel->last_server; |
|
||||
if (channel->rotate == 1) |
|
||||
channel->last_server = (channel->last_server + 1) % channel->nservers; |
|
||||
|
|
||||
for (i = 0; i < channel->nservers; i++) |
|
||||
{ |
|
||||
query->server_info[i].skip_server = 0; |
|
||||
query->server_info[i].tcp_connection_generation = 0; |
|
||||
} |
|
||||
query->using_tcp = (channel->flags & ARES_FLAG_USEVC) || qlen > PACKETSZ; |
|
||||
query->error_status = ARES_ECONNREFUSED; |
|
||||
query->timeouts = 0; |
|
||||
|
|
||||
/* Initialize our list nodes. */ |
|
||||
ares__init_list_node(&(query->queries_by_qid), query); |
|
||||
ares__init_list_node(&(query->queries_by_timeout), query); |
|
||||
ares__init_list_node(&(query->queries_to_server), query); |
|
||||
ares__init_list_node(&(query->all_queries), query); |
|
||||
|
|
||||
/* Chain the query into the list of all queries. */ |
|
||||
ares__insert_in_list(&(query->all_queries), &(channel->all_queries)); |
|
||||
/* Keep track of queries bucketed by qid, so we can process DNS
|
|
||||
* responses quickly. |
|
||||
*/ |
|
||||
ares__insert_in_list( |
|
||||
&(query->queries_by_qid), |
|
||||
&(channel->queries_by_qid[query->qid % ARES_QID_TABLE_SIZE])); |
|
||||
|
|
||||
/* Perform the first query action. */ |
|
||||
now = ares__tvnow(); |
|
||||
ares__send_query(channel, query, &now); |
|
||||
} |
|
@ -1,197 +0,0 @@ |
|||||
#ifndef HEADER_CARES_SETUP_H |
|
||||
#define HEADER_CARES_SETUP_H |
|
||||
|
|
||||
/* $Id$ */ |
|
||||
|
|
||||
/* Copyright (C) 2004 - 2009 by Daniel Stenberg et al
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software and its |
|
||||
* documentation for any purpose and without fee is hereby granted, provided |
|
||||
* that the above copyright notice appear in all copies and that both that |
|
||||
* copyright notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or |
|
||||
* publicity pertaining to distribution of the software without specific, |
|
||||
* written prior permission. M.I.T. makes no representations about the |
|
||||
* suitability of this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
/*
|
|
||||
* Define WIN32 when build target is Win32 API |
|
||||
*/ |
|
||||
|
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) |
|
||||
#define WIN32 |
|
||||
#endif |
|
||||
|
|
||||
/*
|
|
||||
* Include configuration script results or hand-crafted |
|
||||
* configuration file for platforms which lack config tool. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef HAVE_CONFIG_H |
|
||||
#include "ares_config.h" |
|
||||
#else |
|
||||
|
|
||||
#ifdef WIN32 |
|
||||
#include "config-win32.h" |
|
||||
#endif |
|
||||
|
|
||||
#endif /* HAVE_CONFIG_H */ |
|
||||
|
|
||||
/* ================================================================ */ |
|
||||
/* Definition of preprocessor macros/symbols which modify compiler */ |
|
||||
/* behaviour or generated code characteristics must be done here, */ |
|
||||
/* as appropriate, before any system header file is included. It is */ |
|
||||
/* also possible to have them defined in the config file included */ |
|
||||
/* before this point. As a result of all this we frown inclusion of */ |
|
||||
/* system header files in our config files, avoid this at any cost. */ |
|
||||
/* ================================================================ */ |
|
||||
|
|
||||
/*
|
|
||||
* AIX 4.3 and newer needs _THREAD_SAFE defined to build |
|
||||
* proper reentrant code. Others may also need it. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef NEED_THREAD_SAFE |
|
||||
# ifndef _THREAD_SAFE |
|
||||
# define _THREAD_SAFE |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/*
|
|
||||
* Tru64 needs _REENTRANT set for a few function prototypes and |
|
||||
* things to appear in the system header files. Unixware needs it |
|
||||
* to build proper reentrant code. Others may also need it. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef NEED_REENTRANT |
|
||||
# ifndef _REENTRANT |
|
||||
# define _REENTRANT |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* ================================================================ */ |
|
||||
/* If you need to include a system header file for your platform, */ |
|
||||
/* please, do it beyond the point further indicated in this file. */ |
|
||||
/* ================================================================ */ |
|
||||
|
|
||||
#if 0 /* libuv disabled */
|
|
||||
/*
|
|
||||
* c-ares external interface definitions are also used internally, |
|
||||
* and might also include required system header files to define them. |
|
||||
*/ |
|
||||
|
|
||||
#include <ares_build.h> |
|
||||
|
|
||||
/*
|
|
||||
* Compile time sanity checks must also be done when building the library. |
|
||||
*/ |
|
||||
|
|
||||
#include <ares_rules.h> |
|
||||
#endif |
|
||||
|
|
||||
/* ================================================================= */ |
|
||||
/* No system header file shall be included in this file before this */ |
|
||||
/* point. The only allowed ones are those included from ares_build.h */ |
|
||||
/* ================================================================= */ |
|
||||
|
|
||||
/*
|
|
||||
* Include header files for windows builds before redefining anything. |
|
||||
* Use this preproessor block only to include or exclude windows.h, |
|
||||
* winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs |
|
||||
* to any other further and independent block. Under Cygwin things work |
|
||||
* just as under linux (e.g. <sys/socket.h>) and the winsock headers should |
|
||||
* never be included when __CYGWIN__ is defined. configure script takes |
|
||||
* care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H, |
|
||||
* neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef HAVE_WINDOWS_H |
|
||||
# ifdef HAVE_WINSOCK2_H |
|
||||
# include <winsock2.h> |
|
||||
# ifdef HAVE_WS2TCPIP_H |
|
||||
# include <ws2tcpip.h> |
|
||||
# endif |
|
||||
# else |
|
||||
# ifdef HAVE_WINSOCK_H |
|
||||
# include <winsock.h> |
|
||||
# endif |
|
||||
# endif |
|
||||
# include <windows.h> |
|
||||
#endif |
|
||||
|
|
||||
/*
|
|
||||
* Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else |
|
||||
* define USE_WINSOCK to 1 if we have and use WINSOCK API, else |
|
||||
* undefine USE_WINSOCK. |
|
||||
*/ |
|
||||
|
|
||||
#undef USE_WINSOCK |
|
||||
|
|
||||
#ifdef HAVE_WINSOCK2_H |
|
||||
# define USE_WINSOCK 2 |
|
||||
#else |
|
||||
# ifdef HAVE_WINSOCK_H |
|
||||
# define USE_WINSOCK 1 |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/*
|
|
||||
* Work-arounds for systems without configure support |
|
||||
*/ |
|
||||
|
|
||||
#ifndef HAVE_CONFIG_H |
|
||||
|
|
||||
#if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__) |
|
||||
#define HAVE_SYS_TIME_H |
|
||||
#endif |
|
||||
|
|
||||
#if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER) |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
#endif |
|
||||
|
|
||||
#if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS) |
|
||||
#define HAVE_SYS_UIO_H |
|
||||
#endif |
|
||||
|
|
||||
#endif /* HAVE_CONFIG_H */ |
|
||||
|
|
||||
#ifdef __POCC__ |
|
||||
# include <sys/types.h> |
|
||||
# include <unistd.h> |
|
||||
# define ESRCH 3 |
|
||||
#endif |
|
||||
|
|
||||
/*
|
|
||||
* Recent autoconf versions define these symbols in ares_config.h. We don't |
|
||||
* want them (since they collide with the libcurl ones when we build |
|
||||
* --enable-debug) so we undef them again here. |
|
||||
*/ |
|
||||
|
|
||||
#undef PACKAGE_STRING |
|
||||
#undef PACKAGE_TARNAME |
|
||||
#undef PACKAGE_VERSION |
|
||||
#undef PACKAGE_BUGREPORT |
|
||||
#undef PACKAGE_NAME |
|
||||
#undef VERSION |
|
||||
#undef PACKAGE |
|
||||
|
|
||||
/* IPv6 compatibility */ |
|
||||
#if !defined(HAVE_AF_INET6) |
|
||||
#if defined(HAVE_PF_INET6) |
|
||||
#define AF_INET6 PF_INET6 |
|
||||
#else |
|
||||
#define AF_INET6 AF_MAX+1 |
|
||||
#endif |
|
||||
#endif |
|
||||
|
|
||||
/*
|
|
||||
* Include macros and defines that should only be processed once. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef __SETUP_ONCE_H |
|
||||
#include "setup_once.h" |
|
||||
#endif |
|
||||
|
|
||||
#endif /* HEADER_CARES_SETUP_H */ |
|
@ -1,66 +0,0 @@ |
|||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.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 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; |
|
||||
int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; |
|
||||
if (c1 != c2) |
|
||||
return c1-c2; |
|
||||
if (!c1) |
|
||||
break; |
|
||||
} |
|
||||
return 0; |
|
||||
#endif |
|
||||
} |
|
||||
#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; |
|
||||
|
|
||||
for (i = 0; i < n; i++) { |
|
||||
int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; |
|
||||
int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; |
|
||||
if (c1 != c2) |
|
||||
return c1-c2; |
|
||||
if (!c1) |
|
||||
break; |
|
||||
} |
|
||||
return 0; |
|
||||
#endif |
|
||||
} |
|
||||
#endif |
|
||||
|
|
@ -1,30 +0,0 @@ |
|||||
#ifndef HEADER_CARES_STRCASECMP_H |
|
||||
#define HEADER_CARES_STRCASECMP_H |
|
||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifndef HAVE_STRCASECMP |
|
||||
extern int ares_strcasecmp(const char *a, const char *b); |
|
||||
#endif |
|
||||
|
|
||||
#ifndef HAVE_STRNCASECMP |
|
||||
extern int ares_strncasecmp(const char *a, const char *b, size_t n); |
|
||||
#endif |
|
||||
|
|
||||
#endif /* HEADER_CARES_STRCASECMP_H */ |
|
@ -1,42 +0,0 @@ |
|||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include "ares_strdup.h" |
|
||||
|
|
||||
#ifndef HAVE_STRDUP |
|
||||
char *ares_strdup(const char *s1) |
|
||||
{ |
|
||||
size_t sz; |
|
||||
char * s2; |
|
||||
|
|
||||
if(s1) { |
|
||||
sz = strlen(s1); |
|
||||
if(sz < (size_t)-1) { |
|
||||
sz++; |
|
||||
if(sz < ((size_t)-1) / sizeof(char)) { |
|
||||
s2 = malloc(sz * sizeof(char)); |
|
||||
if(s2) { |
|
||||
memcpy(s2, s1, sz * sizeof(char)); |
|
||||
return s2; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
return (char *)NULL; |
|
||||
} |
|
||||
#endif |
|
@ -1,26 +0,0 @@ |
|||||
#ifndef HEADER_CARES_STRDUP_H |
|
||||
#define HEADER_CARES_STRDUP_H |
|
||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifndef HAVE_STRDUP |
|
||||
extern char *ares_strdup(const char *s1); |
|
||||
#endif |
|
||||
|
|
||||
#endif /* HEADER_CARES_STRDUP_H */ |
|
@ -1,56 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include <assert.h> |
|
||||
#include "ares.h" |
|
||||
|
|
||||
const char *ares_strerror(int code) |
|
||||
{ |
|
||||
/* Return a string literal from a table. */ |
|
||||
const char *errtext[] = { |
|
||||
"Successful completion", |
|
||||
"DNS server returned answer with no data", |
|
||||
"DNS server claims query was misformatted", |
|
||||
"DNS server returned general failure", |
|
||||
"Domain name not found", |
|
||||
"DNS server does not implement requested operation", |
|
||||
"DNS server refused query", |
|
||||
"Misformatted DNS query", |
|
||||
"Misformatted domain name", |
|
||||
"Unsupported address family", |
|
||||
"Misformatted DNS reply", |
|
||||
"Could not contact DNS servers", |
|
||||
"Timeout while contacting DNS servers", |
|
||||
"End of file", |
|
||||
"Error reading file", |
|
||||
"Out of memory", |
|
||||
"Channel is being destroyed", |
|
||||
"Misformatted string", |
|
||||
"Illegal flags specified", |
|
||||
"Given hostname is not numeric", |
|
||||
"Illegal hints flags specified", |
|
||||
"c-ares library initialization not yet performed", |
|
||||
"Error loading iphlpapi.dll", |
|
||||
"Could not find GetNetworkParams function", |
|
||||
"DNS query cancelled" |
|
||||
}; |
|
||||
|
|
||||
if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) |
|
||||
return errtext[code]; |
|
||||
else |
|
||||
return "unknown"; |
|
||||
} |
|
@ -1,80 +0,0 @@ |
|||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_TIME_H |
|
||||
#include <sys/time.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <time.h> |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
/* WARNING: Beware that this is linear in the number of outstanding
|
|
||||
* requests! You are probably far better off just calling ares_process() |
|
||||
* once per second, rather than calling ares_timeout() to figure out |
|
||||
* when to next call ares_process(). |
|
||||
*/ |
|
||||
struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, |
|
||||
struct timeval *tvbuf) |
|
||||
{ |
|
||||
struct query *query; |
|
||||
struct list_node* list_head; |
|
||||
struct list_node* list_node; |
|
||||
struct timeval now; |
|
||||
struct timeval nextstop; |
|
||||
long offset, min_offset; |
|
||||
|
|
||||
/* No queries, no timeout (and no fetch of the current time). */ |
|
||||
if (ares__is_list_empty(&(channel->all_queries))) |
|
||||
return maxtv; |
|
||||
|
|
||||
/* Find the minimum timeout for the current set of queries. */ |
|
||||
now = ares__tvnow(); |
|
||||
min_offset = -1; |
|
||||
|
|
||||
list_head = &(channel->all_queries); |
|
||||
for (list_node = list_head->next; list_node != list_head; |
|
||||
list_node = list_node->next) |
|
||||
{ |
|
||||
query = list_node->data; |
|
||||
if (query->timeout.tv_sec == 0) |
|
||||
continue; |
|
||||
offset = ares__timeoffset(&now, &query->timeout); |
|
||||
if (offset < 0) |
|
||||
offset = 0; |
|
||||
if (min_offset == -1 || offset < min_offset) |
|
||||
min_offset = offset; |
|
||||
} |
|
||||
|
|
||||
if(min_offset != -1) { |
|
||||
nextstop.tv_sec = min_offset/1000; |
|
||||
nextstop.tv_usec = (min_offset%1000)*1000; |
|
||||
} |
|
||||
|
|
||||
/* If we found a minimum timeout and it's sooner than the one specified in
|
|
||||
* maxtv (if any), return it. Otherwise go with maxtv. |
|
||||
*/ |
|
||||
if (min_offset != -1 && (!maxtv || ares__timedout(maxtv, &nextstop))) |
|
||||
{ |
|
||||
*tvbuf = nextstop; |
|
||||
return tvbuf; |
|
||||
} |
|
||||
else |
|
||||
return maxtv; |
|
||||
} |
|
@ -1,11 +0,0 @@ |
|||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include "ares.h" |
|
||||
|
|
||||
const char *ares_version(int *version) |
|
||||
{ |
|
||||
if(version) |
|
||||
*version = ARES_VERSION; |
|
||||
|
|
||||
return ARES_VERSION_STR; |
|
||||
} |
|
@ -1,24 +0,0 @@ |
|||||
|
|
||||
#ifndef ARES__VERSION_H |
|
||||
#define ARES__VERSION_H |
|
||||
|
|
||||
/* This is the global package copyright */ |
|
||||
#define ARES_COPYRIGHT "2004 - 2010 Daniel Stenberg, <daniel@haxx.se>." |
|
||||
|
|
||||
#define ARES_VERSION_MAJOR 1 |
|
||||
#define ARES_VERSION_MINOR 7 |
|
||||
#define ARES_VERSION_PATCH 4 |
|
||||
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ |
|
||||
(ARES_VERSION_MINOR<<8)|\ |
|
||||
(ARES_VERSION_PATCH)) |
|
||||
#define ARES_VERSION_STR "1.7.4" |
|
||||
|
|
||||
#if (ARES_VERSION >= 0x010700) |
|
||||
# define CARES_HAVE_ARES_LIBRARY_INIT 1 |
|
||||
# define CARES_HAVE_ARES_LIBRARY_CLEANUP 1 |
|
||||
#else |
|
||||
# undef CARES_HAVE_ARES_LIBRARY_INIT |
|
||||
# undef CARES_HAVE_ARES_LIBRARY_CLEANUP |
|
||||
#endif |
|
||||
|
|
||||
#endif |
|
@ -1,79 +0,0 @@ |
|||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_LIMITS_H |
|
||||
# include <limits.h> |
|
||||
#endif |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_private.h" |
|
||||
|
|
||||
#ifndef HAVE_WRITEV |
|
||||
ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt) |
|
||||
{ |
|
||||
char *buffer, *bp; |
|
||||
int i; |
|
||||
size_t bytes = 0; |
|
||||
ssize_t result; |
|
||||
|
|
||||
/* Validate iovcnt */ |
|
||||
if (iovcnt <= 0) |
|
||||
{ |
|
||||
SET_ERRNO(EINVAL); |
|
||||
return (-1); |
|
||||
} |
|
||||
|
|
||||
/* Validate and find the sum of the iov_len values in the iov array */ |
|
||||
for (i = 0; i < iovcnt; i++) |
|
||||
{ |
|
||||
if (iov[i].iov_len > INT_MAX - bytes) |
|
||||
{ |
|
||||
SET_ERRNO(EINVAL); |
|
||||
return (-1); |
|
||||
} |
|
||||
bytes += iov[i].iov_len; |
|
||||
} |
|
||||
|
|
||||
if (bytes == 0) |
|
||||
return (0); |
|
||||
|
|
||||
/* Allocate a temporary buffer to hold the data */ |
|
||||
buffer = malloc(bytes); |
|
||||
if (!buffer) |
|
||||
{ |
|
||||
SET_ERRNO(ENOMEM); |
|
||||
return (-1); |
|
||||
} |
|
||||
|
|
||||
/* Copy the data into buffer */ |
|
||||
for (bp = buffer, i = 0; i < iovcnt; ++i) |
|
||||
{ |
|
||||
memcpy (bp, iov[i].iov_base, iov[i].iov_len); |
|
||||
bp += iov[i].iov_len; |
|
||||
} |
|
||||
|
|
||||
/* Send buffer contents */ |
|
||||
result = swrite(s, buffer, bytes); |
|
||||
|
|
||||
free(buffer); |
|
||||
|
|
||||
return (result); |
|
||||
} |
|
||||
#endif |
|
||||
|
|
@ -1,36 +0,0 @@ |
|||||
#ifndef HEADER_CARES_WRITEV_H |
|
||||
#define HEADER_CARES_WRITEV_H |
|
||||
|
|
||||
|
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include "ares.h" |
|
||||
|
|
||||
#ifndef HAVE_WRITEV |
|
||||
|
|
||||
/* Structure for scatter/gather I/O. */ |
|
||||
struct iovec |
|
||||
{ |
|
||||
void *iov_base; /* Pointer to data. */ |
|
||||
size_t iov_len; /* Length of data. */ |
|
||||
}; |
|
||||
|
|
||||
extern ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt); |
|
||||
|
|
||||
#endif |
|
||||
|
|
||||
#endif /* HEADER_CARES_WRITEV_H */ |
|
@ -1,59 +0,0 @@ |
|||||
|
|
||||
/*
|
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") |
|
||||
* Copyright (c) 1996,1999 by Internet Software Consortium. |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software for any |
|
||||
* purpose with or without fee is hereby granted, provided that the above |
|
||||
* copyright notice and this permission notice appear in all copies. |
|
||||
* |
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES |
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR |
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef HAVE_BITNCMP |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
#include "bitncmp.h" |
|
||||
|
|
||||
/*
|
|
||||
* int |
|
||||
* bitncmp(l, r, n) |
|
||||
* compare bit masks l and r, for n bits. |
|
||||
* return: |
|
||||
* -1, 1, or 0 in the libc tradition. |
|
||||
* note: |
|
||||
* network byte order assumed. this means 192.5.5.240/28 has |
|
||||
* 0x11110000 in its fourth octet. |
|
||||
* author: |
|
||||
* Paul Vixie (ISC), June 1996 |
|
||||
*/ |
|
||||
int |
|
||||
ares_bitncmp(const void *l, const void *r, int n) { |
|
||||
unsigned int lb, rb; |
|
||||
int x, b; |
|
||||
|
|
||||
b = n / 8; |
|
||||
x = memcmp(l, r, b); |
|
||||
if (x || (n % 8) == 0) |
|
||||
return (x); |
|
||||
|
|
||||
lb = ((const unsigned char *)l)[b]; |
|
||||
rb = ((const unsigned char *)r)[b]; |
|
||||
for (b = n % 8; b > 0; b--) { |
|
||||
if ((lb & 0x80) != (rb & 0x80)) { |
|
||||
if (lb & 0x80) |
|
||||
return (1); |
|
||||
return (-1); |
|
||||
} |
|
||||
lb <<= 1; |
|
||||
rb <<= 1; |
|
||||
} |
|
||||
return (0); |
|
||||
} |
|
||||
#endif |
|
@ -1,26 +0,0 @@ |
|||||
#ifndef __ARES_BITNCMP_H |
|
||||
#define __ARES_BITNCMP_H |
|
||||
|
|
||||
|
|
||||
/* Copyright (C) 2005 by Dominick Meglio
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef HAVE_BITNCMP |
|
||||
int ares_bitncmp(const void *l, const void *r, int n); |
|
||||
#else |
|
||||
#define ares_bitncmp(x,y,z) bitncmp(x,y,z) |
|
||||
#endif |
|
||||
|
|
||||
#endif /* __ARES_BITNCMP_H */ |
|
@ -1,357 +0,0 @@ |
|||||
#ifndef __ARES_CONFIG_WIN32_H |
|
||||
#define __ARES_CONFIG_WIN32_H |
|
||||
|
|
||||
|
|
||||
/* Copyright (C) 2004 - 2008 by Daniel Stenberg et al
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software and its |
|
||||
* documentation for any purpose and without fee is hereby granted, provided |
|
||||
* that the above copyright notice appear in all copies and that both that |
|
||||
* copyright notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or |
|
||||
* publicity pertaining to distribution of the software without specific, |
|
||||
* written prior permission. M.I.T. makes no representations about the |
|
||||
* suitability of this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
/* ================================================================ */ |
|
||||
/* ares/config-win32.h - Hand crafted config file for Windows */ |
|
||||
/* ================================================================ */ |
|
||||
|
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
/* HEADER FILES */ |
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
|
|
||||
/* Define if you have the <getopt.h> header file. */ |
|
||||
#if defined(__MINGW32__) || defined(__POCC__) |
|
||||
#define HAVE_GETOPT_H 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define if you have the <limits.h> header file. */ |
|
||||
#define HAVE_LIMITS_H 1 |
|
||||
|
|
||||
/* Define if you have the <process.h> header file. */ |
|
||||
#ifndef __SALFORDC__ |
|
||||
#define HAVE_PROCESS_H 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define if you have the <signal.h> header file. */ |
|
||||
#define HAVE_SIGNAL_H 1 |
|
||||
|
|
||||
/* Define if you have the <sys/time.h> header file */ |
|
||||
/* #define HAVE_SYS_TIME_H 1 */ |
|
||||
|
|
||||
/* Define if you have the <time.h> header file. */ |
|
||||
#define HAVE_TIME_H 1 |
|
||||
|
|
||||
/* Define if you have the <unistd.h> header file. */ |
|
||||
#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \ |
|
||||
defined(__POCC__) |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define if you have the <winsock.h> header file. */ |
|
||||
#define HAVE_WINSOCK_H 1 |
|
||||
|
|
||||
/* Define if you have the <winsock2.h> header file. */ |
|
||||
#ifndef __SALFORDC__ |
|
||||
#define HAVE_WINSOCK2_H 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define if you have the <ws2tcpip.h> header file. */ |
|
||||
#ifndef __SALFORDC__ |
|
||||
#define HAVE_WS2TCPIP_H 1 |
|
||||
#endif |
|
||||
|
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
/* OTHER HEADER INFO */ |
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
|
|
||||
/* Define if sig_atomic_t is an available typedef. */ |
|
||||
#define HAVE_SIG_ATOMIC_T 1 |
|
||||
|
|
||||
/* Define if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */ |
|
||||
/* #define TIME_WITH_SYS_TIME 1 */ |
|
||||
|
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
/* FUNCTIONS */ |
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
|
|
||||
/* Define if you have the closesocket function. */ |
|
||||
#define HAVE_CLOSESOCKET 1 |
|
||||
|
|
||||
/* Define if you have the gethostname function. */ |
|
||||
#define HAVE_GETHOSTNAME 1 |
|
||||
|
|
||||
/* Define if you have the ioctlsocket function. */ |
|
||||
#define HAVE_IOCTLSOCKET 1 |
|
||||
|
|
||||
/* Define if you have a working ioctlsocket FIONBIO function. */ |
|
||||
#define HAVE_IOCTLSOCKET_FIONBIO 1 |
|
||||
|
|
||||
/* Define if you have the strcasecmp function. */ |
|
||||
/* #define HAVE_STRCASECMP 1 */ |
|
||||
|
|
||||
/* Define if you have the strdup function. */ |
|
||||
#define HAVE_STRDUP 1 |
|
||||
|
|
||||
/* Define if you have the stricmp function. */ |
|
||||
#define HAVE_STRICMP 1 |
|
||||
|
|
||||
/* Define if you have the strncasecmp function. */ |
|
||||
/* #define HAVE_STRNCASECMP 1 */ |
|
||||
|
|
||||
/* Define if you have the strnicmp function. */ |
|
||||
#define HAVE_STRNICMP 1 |
|
||||
|
|
||||
/* Define if you have the recv function. */ |
|
||||
#define HAVE_RECV 1 |
|
||||
|
|
||||
/* Define to the type of arg 1 for recv. */ |
|
||||
#define RECV_TYPE_ARG1 SOCKET |
|
||||
|
|
||||
/* Define to the type of arg 2 for recv. */ |
|
||||
#define RECV_TYPE_ARG2 char * |
|
||||
|
|
||||
/* Define to the type of arg 3 for recv. */ |
|
||||
#define RECV_TYPE_ARG3 int |
|
||||
|
|
||||
/* Define to the type of arg 4 for recv. */ |
|
||||
#define RECV_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for recv. */ |
|
||||
#define RECV_TYPE_RETV int |
|
||||
|
|
||||
/* Define if you have the recvfrom function. */ |
|
||||
#define HAVE_RECVFROM 1 |
|
||||
|
|
||||
/* Define to the type of arg 1 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG1 SOCKET |
|
||||
|
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG2 char |
|
||||
|
|
||||
/* Define to the type of arg 3 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG3 int |
|
||||
|
|
||||
/* Define to the type of arg 4 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr |
|
||||
|
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG6 int |
|
||||
|
|
||||
/* Define to the function return type for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_RETV int |
|
||||
|
|
||||
/* Define if you have the send function. */ |
|
||||
#define HAVE_SEND 1 |
|
||||
|
|
||||
/* Define to the type of arg 1 for send. */ |
|
||||
#define SEND_TYPE_ARG1 SOCKET |
|
||||
|
|
||||
/* Define to the type qualifier of arg 2 for send. */ |
|
||||
#define SEND_QUAL_ARG2 const |
|
||||
|
|
||||
/* Define to the type of arg 2 for send. */ |
|
||||
#define SEND_TYPE_ARG2 char * |
|
||||
|
|
||||
/* Define to the type of arg 3 for send. */ |
|
||||
#define SEND_TYPE_ARG3 int |
|
||||
|
|
||||
/* Define to the type of arg 4 for send. */ |
|
||||
#define SEND_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for send. */ |
|
||||
#define SEND_TYPE_RETV int |
|
||||
|
|
||||
/* Specifics for the Watt-32 tcp/ip stack */ |
|
||||
#ifdef WATT32 |
|
||||
#define SOCKET int |
|
||||
#define NS_INADDRSZ 4 |
|
||||
#define HAVE_ARPA_NAMESER_H 1 |
|
||||
#define HAVE_ARPA_INET_H 1 |
|
||||
#define HAVE_NETDB_H 1 |
|
||||
#define HAVE_NETINET_IN_H 1 |
|
||||
#define HAVE_SYS_SOCKET_H 1 |
|
||||
#define HAVE_NETINET_TCP_H 1 |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
#undef HAVE_WINSOCK_H |
|
||||
#undef HAVE_WINSOCK2_H |
|
||||
#undef HAVE_WS2TCPIP_H |
|
||||
#endif |
|
||||
|
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
/* TYPEDEF REPLACEMENTS */ |
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
|
|
||||
/* Define this if in_addr_t is not an available 'typedefed' type */ |
|
||||
#define in_addr_t unsigned long |
|
||||
|
|
||||
/* Define as the return type of signal handlers (int or void). */ |
|
||||
#define RETSIGTYPE void |
|
||||
|
|
||||
/* Define ssize_t if it is not an available 'typedefed' type */ |
|
||||
#ifndef _SSIZE_T_DEFINED |
|
||||
# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ |
|
||||
defined(__POCC__) || \ |
|
||||
defined(__MINGW32__) |
|
||||
# elif defined(_WIN64) |
|
||||
# define _SSIZE_T_DEFINED |
|
||||
# define ssize_t __int64 |
|
||||
# else |
|
||||
# define _SSIZE_T_DEFINED |
|
||||
# define ssize_t int |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
/* TYPE SIZES */ |
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
|
|
||||
/* The size of `int', as computed by sizeof. */ |
|
||||
#define SIZEOF_INT 4 |
|
||||
|
|
||||
/* The size of `short', as computed by sizeof. */ |
|
||||
#define SIZEOF_SHORT 2 |
|
||||
|
|
||||
/* The size of `size_t', as computed by sizeof. */ |
|
||||
#if defined(_WIN64) |
|
||||
# define SIZEOF_SIZE_T 8 |
|
||||
#else |
|
||||
# define SIZEOF_SIZE_T 4 |
|
||||
#endif |
|
||||
|
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
/* STRUCT RELATED */ |
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
|
|
||||
/* Define this if you have struct addrinfo */ |
|
||||
#define HAVE_STRUCT_ADDRINFO 1 |
|
||||
|
|
||||
/* Define this if you have struct sockaddr_storage */ |
|
||||
#ifndef __SALFORDC__ |
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define this if you have struct timeval */ |
|
||||
#define HAVE_STRUCT_TIMEVAL 1 |
|
||||
|
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
/* COMPILER SPECIFIC */ |
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
|
|
||||
/* Define to avoid VS2005 complaining about portable C functions */ |
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) |
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1 |
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows
|
|
||||
2000 as a supported build target. VS2008 default installations provide an |
|
||||
embedded Windows SDK v6.0A along with the claim that Windows 2000 is a |
|
||||
valid build target for VS2008. Popular belief is that binaries built using |
|
||||
Windows SDK versions 6.X and Windows 2000 as a build target are functional */ |
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500) |
|
||||
# define VS2008_MINIMUM_TARGET 0x0500 |
|
||||
#endif |
|
||||
|
|
||||
/* When no build target is specified VS2008 default build target is Windows
|
|
||||
Vista, which leaves out even Winsows XP. If no build target has been given |
|
||||
for VS2008 we will target the minimum Officially supported build target, |
|
||||
which happens to be Windows XP. */ |
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500) |
|
||||
# define VS2008_DEFAULT_TARGET 0x0501 |
|
||||
#endif |
|
||||
|
|
||||
/* VS2008 default target settings and minimum build target check */ |
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500) |
|
||||
# ifndef _WIN32_WINNT |
|
||||
# define _WIN32_WINNT VS2008_DEFAULT_TARGET |
|
||||
# endif |
|
||||
# ifndef WINVER |
|
||||
# define WINVER VS2008_DEFAULT_TARGET |
|
||||
# endif |
|
||||
# if (_WIN32_WINNT < VS2008_MINIMUM_TARGET) || (WINVER < VS2008_MINIMUM_TARGET) |
|
||||
# error VS2008 does not support Windows build targets prior to Windows 2000 |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* When no build target is specified Pelles C 5.00 and later default build
|
|
||||
target is Windows Vista. We override default target to be Windows 2000. */ |
|
||||
#if defined(__POCC__) && (__POCC__ >= 500) |
|
||||
# ifndef _WIN32_WINNT |
|
||||
# define _WIN32_WINNT 0x0500 |
|
||||
# endif |
|
||||
# ifndef WINVER |
|
||||
# define WINVER 0x0500 |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is
|
|
||||
quite convoluted, compiler dependent and even build target dependent. */ |
|
||||
#if defined(HAVE_WS2TCPIP_H) |
|
||||
# if defined(__POCC__) |
|
||||
# define HAVE_FREEADDRINFO 1 |
|
||||
# define HAVE_GETADDRINFO 1 |
|
||||
# define HAVE_GETNAMEINFO 1 |
|
||||
# elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) |
|
||||
# define HAVE_FREEADDRINFO 1 |
|
||||
# define HAVE_GETADDRINFO 1 |
|
||||
# define HAVE_GETNAMEINFO 1 |
|
||||
# elif defined(_MSC_VER) && (_MSC_VER >= 1200) |
|
||||
# define HAVE_FREEADDRINFO 1 |
|
||||
# define HAVE_GETADDRINFO 1 |
|
||||
# define HAVE_GETNAMEINFO 1 |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
#if defined(__POCC__) |
|
||||
# ifndef _MSC_VER |
|
||||
# error Microsoft extensions /Ze compiler option is required |
|
||||
# endif |
|
||||
# ifndef __POCC__OLDNAMES |
|
||||
# error Compatibility names /Go compiler option is required |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
/* IPV6 COMPATIBILITY */ |
|
||||
/* ---------------------------------------------------------------- */ |
|
||||
|
|
||||
/* Define this if you have address family AF_INET6 */ |
|
||||
#ifdef HAVE_WINSOCK2_H |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define this if you have protocol family PF_INET6 */ |
|
||||
#ifdef HAVE_WINSOCK2_H |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define this if you have struct in6_addr */ |
|
||||
#ifdef HAVE_WS2TCPIP_H |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define this if you have struct sockaddr_in6 */ |
|
||||
#ifdef HAVE_WS2TCPIP_H |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
#endif |
|
||||
|
|
||||
/* Define this if you have sockaddr_in6 with scopeid */ |
|
||||
#ifdef HAVE_WS2TCPIP_H |
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
#endif /* __ARES_CONFIG_WIN32_H */ |
|
@ -1,510 +0,0 @@ |
|||||
/* ares_config.h. Generated from ares_config.h.in by configure. */ |
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define if building universal (internal helper macro) */ |
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
||||
|
|
||||
/* define this if ares is built for a big endian system */ |
|
||||
/* #undef ARES_BIG_ENDIAN */ |
|
||||
|
|
||||
/* when building as static part of libcurl */ |
|
||||
/* #undef BUILDING_LIBCURL */ |
|
||||
|
|
||||
/* when building c-ares library */ |
|
||||
/* #undef CARES_BUILDING_LIBRARY */ |
|
||||
|
|
||||
/* when not building a shared library */ |
|
||||
/* #undef CARES_STATICLIB */ |
|
||||
|
|
||||
/* Define to 1 to enable hiding of library internal symbols. */ |
|
||||
#define CARES_SYMBOL_HIDING 1 |
|
||||
|
|
||||
/* Definition to make a library symbol externally visible. */ |
|
||||
#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((visibility ("default"))) |
|
||||
|
|
||||
/* if a /etc/inet dir is being used */ |
|
||||
/* #undef ETC_INET */ |
|
||||
|
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_QUAL_ARG1 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * |
|
||||
|
|
||||
/* Define to the type of arg 2 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG2 socklen_t |
|
||||
|
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG46 int |
|
||||
|
|
||||
/* Define to the type of arg 7 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG7 int |
|
||||
|
|
||||
/* Specifies the number of arguments to getservbyport_r */ |
|
||||
/* #undef GETSERVBYPORT_R_ARGS */ |
|
||||
|
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */ |
|
||||
/* #undef GETSERVBYPORT_R_BUFSIZE */ |
|
||||
|
|
||||
/* Define to 1 if you have AF_INET6. */ |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */ |
|
||||
#define HAVE_ARPA_INET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_COMPAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <assert.h> header file. */ |
|
||||
#define HAVE_ASSERT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `bitncmp' function. */ |
|
||||
/* #undef HAVE_BITNCMP */ |
|
||||
|
|
||||
/* Define to 1 if bool is an available type. */ |
|
||||
#define HAVE_BOOL_T 1 |
|
||||
|
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */ |
|
||||
/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ |
|
||||
|
|
||||
/* Define to 1 if you have the closesocket function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have the connect function. */ |
|
||||
#define HAVE_CONNECT 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <errno.h> header file. */ |
|
||||
#define HAVE_ERRNO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the fcntl function. */ |
|
||||
#define HAVE_FCNTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */ |
|
||||
#define HAVE_FCNTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ |
|
||||
#define HAVE_FCNTL_O_NONBLOCK 1 |
|
||||
|
|
||||
/* Define to 1 if you have the freeaddrinfo function. */ |
|
||||
#define HAVE_FREEADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working getaddrinfo function. */ |
|
||||
#define HAVE_GETADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */ |
|
||||
/* #undef HAVE_GETADDRINFO_THREADSAFE */ |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyaddr function. */ |
|
||||
#define HAVE_GETHOSTBYADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyname function. */ |
|
||||
#define HAVE_GETHOSTBYNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostname function. */ |
|
||||
#define HAVE_GETHOSTNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getnameinfo function. */ |
|
||||
#define HAVE_GETNAMEINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getservbyport_r function. */ |
|
||||
/* #undef HAVE_GETSERVBYPORT_R */ |
|
||||
|
|
||||
/* Define to 1 if you have the `gettimeofday' function. */ |
|
||||
#define HAVE_GETTIMEOFDAY 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `if_indextoname' function. */ |
|
||||
#define HAVE_IF_INDEXTONAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `inet_net_pton' function. */ |
|
||||
/* #undef HAVE_INET_NET_PTON */ |
|
||||
|
|
||||
/* Define to 1 if inet_net_pton supports IPv6. */ |
|
||||
/* #undef HAVE_INET_NET_PTON_IPV6 */ |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ |
|
||||
#define HAVE_INET_NTOP 1 |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */ |
|
||||
#define HAVE_INET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctl function. */ |
|
||||
#define HAVE_IOCTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctlsocket function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
|
||||
*/ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */ |
|
||||
#define HAVE_IOCTL_FIONBIO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ |
|
||||
#define HAVE_IOCTL_SIOCGIFADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */ |
|
||||
/* #undef HAVE_LIBRESOLVE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <limits.h> header file. */ |
|
||||
#define HAVE_LIMITS_H 1 |
|
||||
|
|
||||
/* if your compiler supports LL */ |
|
||||
#define HAVE_LL 1 |
|
||||
|
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */ |
|
||||
#define HAVE_LONGLONG 1 |
|
||||
|
|
||||
/* Define to 1 if you have the malloc.h header file. */ |
|
||||
#define HAVE_MALLOC_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the memory.h header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */ |
|
||||
#define HAVE_MSG_NOSIGNAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netdb.h> header file. */ |
|
||||
#define HAVE_NETDB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */ |
|
||||
#define HAVE_NETINET_IN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */ |
|
||||
#define HAVE_NETINET_TCP_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <net/if.h> header file. */ |
|
||||
#define HAVE_NET_IF_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have PF_INET6. */ |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recv function. */ |
|
||||
#define HAVE_RECV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recvfrom function. */ |
|
||||
#define HAVE_RECVFROM 1 |
|
||||
|
|
||||
/* Define to 1 if you have the send function. */ |
|
||||
#define HAVE_SEND 1 |
|
||||
|
|
||||
/* Define to 1 if you have the setsockopt function. */ |
|
||||
#define HAVE_SETSOCKOPT 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ |
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ |
|
||||
|
|
||||
/* Define to 1 if you have the <signal.h> header file. */ |
|
||||
#define HAVE_SIGNAL_H 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */ |
|
||||
#define HAVE_SIG_ATOMIC_T 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */ |
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ |
|
||||
|
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ |
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 |
|
||||
|
|
||||
/* Define to 1 if you have the socket function. */ |
|
||||
#define HAVE_SOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <socket.h> header file. */ |
|
||||
/* #undef HAVE_SOCKET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */ |
|
||||
#define HAVE_STDBOOL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcasecmp function. */ |
|
||||
#define HAVE_STRCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcmpi function. */ |
|
||||
/* #undef HAVE_STRCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strdup function. */ |
|
||||
#define HAVE_STRDUP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the stricmp function. */ |
|
||||
/* #undef HAVE_STRICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncasecmp function. */ |
|
||||
#define HAVE_STRNCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncmpi function. */ |
|
||||
/* #undef HAVE_STRNCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strnicmp function. */ |
|
||||
/* #undef HAVE_STRNICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stropts.h> header file. */ |
|
||||
/* #undef HAVE_STROPTS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have struct addrinfo. */ |
|
||||
#define HAVE_STRUCT_ADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct in6_addr. */ |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct sockaddr_in6. */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
|
|
||||
/* if struct sockaddr_storage is defined */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the timeval struct. */ |
|
||||
#define HAVE_STRUCT_TIMEVAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */ |
|
||||
#define HAVE_SYS_IOCTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */ |
|
||||
#define HAVE_SYS_PARAM_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */ |
|
||||
#define HAVE_SYS_SELECT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */ |
|
||||
#define HAVE_SYS_SOCKET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */ |
|
||||
#define HAVE_SYS_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */ |
|
||||
#define HAVE_SYS_UIO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <time.h> header file. */ |
|
||||
#define HAVE_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the windows.h header file. */ |
|
||||
/* #undef HAVE_WINDOWS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock2.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK2_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the writev function. */ |
|
||||
#define HAVE_WRITEV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */ |
|
||||
/* #undef HAVE_WS2TCPIP_H */ |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Define to 1 if you are building a native Windows target. */ |
|
||||
/* #undef NATIVE_WINDOWS */ |
|
||||
|
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MEMORY_H */ |
|
||||
|
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_REENTRANT */ |
|
||||
|
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_THREAD_SAFE */ |
|
||||
|
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ |
|
||||
/* #undef NO_MINUS_C_MINUS_O */ |
|
||||
|
|
||||
/* cpu-machine-OS */ |
|
||||
#define OS "i686-pc-cygwin" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "c-ares" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares"
|
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "c-ares" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "c-ares 1.7.1" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "c-ares" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "1.7.1" |
|
||||
|
|
||||
/* a suitable file/device to read random data from */ |
|
||||
#define RANDOM_FILE "/dev/urandom" |
|
||||
|
|
||||
/* Define to the type of arg 1 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG2 void |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ |
|
||||
#define RECVFROM_TYPE_ARG2_IS_VOID 1 |
|
||||
|
|
||||
/* Define to the type of arg 3 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ |
|
||||
|
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG6 socklen_t |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ |
|
||||
|
|
||||
/* Define to the function return type for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_RETV int |
|
||||
|
|
||||
/* Define to the type of arg 1 for recv. */ |
|
||||
#define RECV_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for recv. */ |
|
||||
#define RECV_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for recv. */ |
|
||||
#define RECV_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recv. */ |
|
||||
#define RECV_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for recv. */ |
|
||||
#define RECV_TYPE_RETV int |
|
||||
|
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */ |
|
||||
#define RETSIGTYPE void |
|
||||
|
|
||||
/* Define to the type qualifier of arg 2 for send. */ |
|
||||
#define SEND_QUAL_ARG2 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for send. */ |
|
||||
#define SEND_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for send. */ |
|
||||
#define SEND_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for send. */ |
|
||||
#define SEND_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for send. */ |
|
||||
#define SEND_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for send. */ |
|
||||
#define SEND_TYPE_RETV int |
|
||||
|
|
||||
/* The size of `int', as computed by sizeof. */ |
|
||||
#define SIZEOF_INT 4 |
|
||||
|
|
||||
/* The size of `long', as computed by sizeof. */ |
|
||||
#define SIZEOF_LONG 4 |
|
||||
|
|
||||
/* The size of `size_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_SIZE_T 4 |
|
||||
|
|
||||
/* The size of `struct in6_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN6_ADDR 16 |
|
||||
|
|
||||
/* The size of `struct in_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN_ADDR 4 |
|
||||
|
|
||||
/* The size of `time_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_TIME_T 4 |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
|
||||
#define TIME_WITH_SYS_TIME 1 |
|
||||
|
|
||||
/* Define to disable non-blocking sockets. */ |
|
||||
/* #undef USE_BLOCKING_SOCKETS */ |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.7.1" |
|
||||
|
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD |
|
||||
# if defined __BIG_ENDIAN__ |
|
||||
# define WORDS_BIGENDIAN 1 |
|
||||
# endif |
|
||||
#else |
|
||||
# ifndef WORDS_BIGENDIAN |
|
||||
/* # undef WORDS_BIGENDIAN */ |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* Define to 1 if OS is AIX. */ |
|
||||
#ifndef _ALL_SOURCE |
|
||||
/* # undef _ALL_SOURCE */ |
|
||||
#endif |
|
||||
|
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */ |
|
||||
/* #undef _FILE_OFFSET_BITS */ |
|
||||
|
|
||||
/* Define for large files, on AIX-style hosts. */ |
|
||||
/* #undef _LARGE_FILES */ |
|
||||
|
|
||||
/* Define to empty if `const' does not conform to ANSI C. */ |
|
||||
/* #undef const */ |
|
||||
|
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */ |
|
||||
/* #undef in_addr_t */ |
|
||||
|
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */ |
|
||||
/* #undef size_t */ |
|
||||
|
|
||||
/* the signed version of size_t */ |
|
||||
/* #undef ssize_t */ |
|
@ -1,510 +0,0 @@ |
|||||
/* ares_config.h. Generated from ares_config.h.in by configure. */ |
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define if building universal (internal helper macro) */ |
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
||||
|
|
||||
/* define this if ares is built for a big endian system */ |
|
||||
/* #undef ARES_BIG_ENDIAN */ |
|
||||
|
|
||||
/* when building as static part of libcurl */ |
|
||||
/* #undef BUILDING_LIBCURL */ |
|
||||
|
|
||||
/* when building c-ares library */ |
|
||||
/* #undef CARES_BUILDING_LIBRARY */ |
|
||||
|
|
||||
/* when not building a shared library */ |
|
||||
/* #undef CARES_STATICLIB */ |
|
||||
|
|
||||
/* Define to 1 to enable hiding of library internal symbols. */ |
|
||||
#define CARES_SYMBOL_HIDING 1 |
|
||||
|
|
||||
/* Definition to make a library symbol externally visible. */ |
|
||||
#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((visibility ("default"))) |
|
||||
|
|
||||
/* if a /etc/inet dir is being used */ |
|
||||
/* #undef ETC_INET */ |
|
||||
|
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_QUAL_ARG1 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * |
|
||||
|
|
||||
/* Define to the type of arg 2 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG2 socklen_t |
|
||||
|
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG46 socklen_t |
|
||||
|
|
||||
/* Define to the type of arg 7 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG7 int |
|
||||
|
|
||||
/* Specifies the number of arguments to getservbyport_r */ |
|
||||
/* #undef GETSERVBYPORT_R_ARGS */ |
|
||||
|
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */ |
|
||||
/* #undef GETSERVBYPORT_R_BUFSIZE */ |
|
||||
|
|
||||
/* Define to 1 if you have AF_INET6. */ |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */ |
|
||||
#define HAVE_ARPA_INET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_COMPAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <assert.h> header file. */ |
|
||||
#define HAVE_ASSERT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `bitncmp' function. */ |
|
||||
/* #undef HAVE_BITNCMP */ |
|
||||
|
|
||||
/* Define to 1 if bool is an available type. */ |
|
||||
#define HAVE_BOOL_T 1 |
|
||||
|
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */ |
|
||||
/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ |
|
||||
|
|
||||
/* Define to 1 if you have the closesocket function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have the connect function. */ |
|
||||
#define HAVE_CONNECT 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <errno.h> header file. */ |
|
||||
#define HAVE_ERRNO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the fcntl function. */ |
|
||||
#define HAVE_FCNTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */ |
|
||||
#define HAVE_FCNTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ |
|
||||
#define HAVE_FCNTL_O_NONBLOCK 1 |
|
||||
|
|
||||
/* Define to 1 if you have the freeaddrinfo function. */ |
|
||||
#define HAVE_FREEADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working getaddrinfo function. */ |
|
||||
#define HAVE_GETADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */ |
|
||||
#define HAVE_GETADDRINFO_THREADSAFE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyaddr function. */ |
|
||||
#define HAVE_GETHOSTBYADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyname function. */ |
|
||||
#define HAVE_GETHOSTBYNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostname function. */ |
|
||||
#define HAVE_GETHOSTNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getnameinfo function. */ |
|
||||
#define HAVE_GETNAMEINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getservbyport_r function. */ |
|
||||
/* #undef HAVE_GETSERVBYPORT_R */ |
|
||||
|
|
||||
/* Define to 1 if you have the `gettimeofday' function. */ |
|
||||
#define HAVE_GETTIMEOFDAY 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `if_indextoname' function. */ |
|
||||
#define HAVE_IF_INDEXTONAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `inet_net_pton' function. */ |
|
||||
#define HAVE_INET_NET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if inet_net_pton supports IPv6. */ |
|
||||
#define HAVE_INET_NET_PTON_IPV6 1 |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ |
|
||||
#define HAVE_INET_NTOP 1 |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */ |
|
||||
#define HAVE_INET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctl function. */ |
|
||||
#define HAVE_IOCTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctlsocket function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
|
||||
*/ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */ |
|
||||
#define HAVE_IOCTL_FIONBIO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ |
|
||||
#define HAVE_IOCTL_SIOCGIFADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */ |
|
||||
/* #undef HAVE_LIBRESOLVE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <limits.h> header file. */ |
|
||||
#define HAVE_LIMITS_H 1 |
|
||||
|
|
||||
/* if your compiler supports LL */ |
|
||||
#define HAVE_LL 1 |
|
||||
|
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */ |
|
||||
#define HAVE_LONGLONG 1 |
|
||||
|
|
||||
/* Define to 1 if you have the malloc.h header file. */ |
|
||||
/* #undef HAVE_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the memory.h header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */ |
|
||||
/* #undef HAVE_MSG_NOSIGNAL */ |
|
||||
|
|
||||
/* Define to 1 if you have the <netdb.h> header file. */ |
|
||||
#define HAVE_NETDB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */ |
|
||||
#define HAVE_NETINET_IN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */ |
|
||||
#define HAVE_NETINET_TCP_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <net/if.h> header file. */ |
|
||||
#define HAVE_NET_IF_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have PF_INET6. */ |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recv function. */ |
|
||||
#define HAVE_RECV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recvfrom function. */ |
|
||||
#define HAVE_RECVFROM 1 |
|
||||
|
|
||||
/* Define to 1 if you have the send function. */ |
|
||||
#define HAVE_SEND 1 |
|
||||
|
|
||||
/* Define to 1 if you have the setsockopt function. */ |
|
||||
#define HAVE_SETSOCKOPT 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ |
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ |
|
||||
|
|
||||
/* Define to 1 if you have the <signal.h> header file. */ |
|
||||
#define HAVE_SIGNAL_H 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */ |
|
||||
#define HAVE_SIG_ATOMIC_T 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */ |
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ |
|
||||
|
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ |
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 |
|
||||
|
|
||||
/* Define to 1 if you have the socket function. */ |
|
||||
#define HAVE_SOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <socket.h> header file. */ |
|
||||
/* #undef HAVE_SOCKET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */ |
|
||||
#define HAVE_STDBOOL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcasecmp function. */ |
|
||||
#define HAVE_STRCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcmpi function. */ |
|
||||
/* #undef HAVE_STRCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strdup function. */ |
|
||||
#define HAVE_STRDUP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the stricmp function. */ |
|
||||
/* #undef HAVE_STRICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncasecmp function. */ |
|
||||
#define HAVE_STRNCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncmpi function. */ |
|
||||
/* #undef HAVE_STRNCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strnicmp function. */ |
|
||||
/* #undef HAVE_STRNICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stropts.h> header file. */ |
|
||||
/* #undef HAVE_STROPTS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have struct addrinfo. */ |
|
||||
#define HAVE_STRUCT_ADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct in6_addr. */ |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct sockaddr_in6. */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
|
|
||||
/* if struct sockaddr_storage is defined */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the timeval struct. */ |
|
||||
#define HAVE_STRUCT_TIMEVAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */ |
|
||||
#define HAVE_SYS_IOCTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */ |
|
||||
#define HAVE_SYS_PARAM_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */ |
|
||||
#define HAVE_SYS_SELECT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */ |
|
||||
#define HAVE_SYS_SOCKET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */ |
|
||||
#define HAVE_SYS_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */ |
|
||||
#define HAVE_SYS_UIO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <time.h> header file. */ |
|
||||
#define HAVE_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the windows.h header file. */ |
|
||||
/* #undef HAVE_WINDOWS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock2.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK2_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the writev function. */ |
|
||||
#define HAVE_WRITEV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */ |
|
||||
/* #undef HAVE_WS2TCPIP_H */ |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Define to 1 if you are building a native Windows target. */ |
|
||||
/* #undef NATIVE_WINDOWS */ |
|
||||
|
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MEMORY_H */ |
|
||||
|
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_REENTRANT */ |
|
||||
|
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_THREAD_SAFE */ |
|
||||
|
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ |
|
||||
/* #undef NO_MINUS_C_MINUS_O */ |
|
||||
|
|
||||
/* cpu-machine-OS */ |
|
||||
#define OS "i386-apple-darwin9.8.0" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "c-ares" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares"
|
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "c-ares" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "c-ares 1.7.1" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "c-ares" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "1.7.1" |
|
||||
|
|
||||
/* a suitable file/device to read random data from */ |
|
||||
#define RANDOM_FILE "/dev/urandom" |
|
||||
|
|
||||
/* Define to the type of arg 1 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG2 void |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ |
|
||||
#define RECVFROM_TYPE_ARG2_IS_VOID 1 |
|
||||
|
|
||||
/* Define to the type of arg 3 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ |
|
||||
|
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG6 socklen_t |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ |
|
||||
|
|
||||
/* Define to the function return type for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_RETV ssize_t |
|
||||
|
|
||||
/* Define to the type of arg 1 for recv. */ |
|
||||
#define RECV_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for recv. */ |
|
||||
#define RECV_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for recv. */ |
|
||||
#define RECV_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recv. */ |
|
||||
#define RECV_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for recv. */ |
|
||||
#define RECV_TYPE_RETV ssize_t |
|
||||
|
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */ |
|
||||
#define RETSIGTYPE void |
|
||||
|
|
||||
/* Define to the type qualifier of arg 2 for send. */ |
|
||||
#define SEND_QUAL_ARG2 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for send. */ |
|
||||
#define SEND_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for send. */ |
|
||||
#define SEND_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for send. */ |
|
||||
#define SEND_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for send. */ |
|
||||
#define SEND_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for send. */ |
|
||||
#define SEND_TYPE_RETV ssize_t |
|
||||
|
|
||||
/* The size of `int', as computed by sizeof. */ |
|
||||
#define SIZEOF_INT 4 |
|
||||
|
|
||||
/* The size of `long', as computed by sizeof. */ |
|
||||
#define SIZEOF_LONG 4 |
|
||||
|
|
||||
/* The size of `size_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_SIZE_T 4 |
|
||||
|
|
||||
/* The size of `struct in6_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN6_ADDR 16 |
|
||||
|
|
||||
/* The size of `struct in_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN_ADDR 4 |
|
||||
|
|
||||
/* The size of `time_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_TIME_T 4 |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
|
||||
#define TIME_WITH_SYS_TIME 1 |
|
||||
|
|
||||
/* Define to disable non-blocking sockets. */ |
|
||||
/* #undef USE_BLOCKING_SOCKETS */ |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.7.1" |
|
||||
|
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD |
|
||||
# if defined __BIG_ENDIAN__ |
|
||||
# define WORDS_BIGENDIAN 1 |
|
||||
# endif |
|
||||
#else |
|
||||
# ifndef WORDS_BIGENDIAN |
|
||||
/* # undef WORDS_BIGENDIAN */ |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* Define to 1 if OS is AIX. */ |
|
||||
#ifndef _ALL_SOURCE |
|
||||
/* # undef _ALL_SOURCE */ |
|
||||
#endif |
|
||||
|
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */ |
|
||||
/* #undef _FILE_OFFSET_BITS */ |
|
||||
|
|
||||
/* Define for large files, on AIX-style hosts. */ |
|
||||
/* #undef _LARGE_FILES */ |
|
||||
|
|
||||
/* Define to empty if `const' does not conform to ANSI C. */ |
|
||||
/* #undef const */ |
|
||||
|
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */ |
|
||||
/* #undef in_addr_t */ |
|
||||
|
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */ |
|
||||
/* #undef size_t */ |
|
||||
|
|
||||
/* the signed version of size_t */ |
|
||||
/* #undef ssize_t */ |
|
@ -1,510 +0,0 @@ |
|||||
/* ares_config.h. Generated from ares_config.h.in by configure. */ |
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define if building universal (internal helper macro) */ |
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
||||
|
|
||||
/* define this if ares is built for a big endian system */ |
|
||||
/* #undef ARES_BIG_ENDIAN */ |
|
||||
|
|
||||
/* when building as static part of libcurl */ |
|
||||
/* #undef BUILDING_LIBCURL */ |
|
||||
|
|
||||
/* when building c-ares library */ |
|
||||
/* #undef CARES_BUILDING_LIBRARY */ |
|
||||
|
|
||||
/* when not building a shared library */ |
|
||||
/* #undef CARES_STATICLIB */ |
|
||||
|
|
||||
/* Define to 1 to enable hiding of library internal symbols. */ |
|
||||
#define CARES_SYMBOL_HIDING 1 |
|
||||
|
|
||||
/* Definition to make a library symbol externally visible. */ |
|
||||
#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((visibility ("default"))) |
|
||||
|
|
||||
/* if a /etc/inet dir is being used */ |
|
||||
/* #undef ETC_INET */ |
|
||||
|
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_QUAL_ARG1 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * |
|
||||
|
|
||||
/* Define to the type of arg 2 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG2 socklen_t |
|
||||
|
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG46 size_t |
|
||||
|
|
||||
/* Define to the type of arg 7 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG7 int |
|
||||
|
|
||||
/* Specifies the number of arguments to getservbyport_r */ |
|
||||
#define GETSERVBYPORT_R_ARGS 6 |
|
||||
|
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */ |
|
||||
#define GETSERVBYPORT_R_BUFSIZE 4096 |
|
||||
|
|
||||
/* Define to 1 if you have AF_INET6. */ |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */ |
|
||||
#define HAVE_ARPA_INET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_COMPAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <assert.h> header file. */ |
|
||||
#define HAVE_ASSERT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `bitncmp' function. */ |
|
||||
/* #undef HAVE_BITNCMP */ |
|
||||
|
|
||||
/* Define to 1 if bool is an available type. */ |
|
||||
#define HAVE_BOOL_T 1 |
|
||||
|
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */ |
|
||||
#define HAVE_CLOCK_GETTIME_MONOTONIC 1 |
|
||||
|
|
||||
/* Define to 1 if you have the closesocket function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have the connect function. */ |
|
||||
#define HAVE_CONNECT 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <errno.h> header file. */ |
|
||||
#define HAVE_ERRNO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the fcntl function. */ |
|
||||
#define HAVE_FCNTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */ |
|
||||
#define HAVE_FCNTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ |
|
||||
#define HAVE_FCNTL_O_NONBLOCK 1 |
|
||||
|
|
||||
/* Define to 1 if you have the freeaddrinfo function. */ |
|
||||
#define HAVE_FREEADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working getaddrinfo function. */ |
|
||||
#define HAVE_GETADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */ |
|
||||
#define HAVE_GETADDRINFO_THREADSAFE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyaddr function. */ |
|
||||
#define HAVE_GETHOSTBYADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyname function. */ |
|
||||
#define HAVE_GETHOSTBYNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostname function. */ |
|
||||
#define HAVE_GETHOSTNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getnameinfo function. */ |
|
||||
#define HAVE_GETNAMEINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getservbyport_r function. */ |
|
||||
#define HAVE_GETSERVBYPORT_R 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `gettimeofday' function. */ |
|
||||
#define HAVE_GETTIMEOFDAY 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `if_indextoname' function. */ |
|
||||
#define HAVE_IF_INDEXTONAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `inet_net_pton' function. */ |
|
||||
#define HAVE_INET_NET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if inet_net_pton supports IPv6. */ |
|
||||
/* #undef HAVE_INET_NET_PTON_IPV6 */ |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ |
|
||||
#define HAVE_INET_NTOP 1 |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */ |
|
||||
#define HAVE_INET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctl function. */ |
|
||||
#define HAVE_IOCTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctlsocket function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
|
||||
*/ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */ |
|
||||
#define HAVE_IOCTL_FIONBIO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ |
|
||||
#define HAVE_IOCTL_SIOCGIFADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */ |
|
||||
/* #undef HAVE_LIBRESOLVE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <limits.h> header file. */ |
|
||||
#define HAVE_LIMITS_H 1 |
|
||||
|
|
||||
/* if your compiler supports LL */ |
|
||||
#define HAVE_LL 1 |
|
||||
|
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */ |
|
||||
#define HAVE_LONGLONG 1 |
|
||||
|
|
||||
/* Define to 1 if you have the malloc.h header file. */ |
|
||||
/* #undef HAVE_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the memory.h header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */ |
|
||||
#define HAVE_MSG_NOSIGNAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netdb.h> header file. */ |
|
||||
#define HAVE_NETDB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */ |
|
||||
#define HAVE_NETINET_IN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */ |
|
||||
#define HAVE_NETINET_TCP_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <net/if.h> header file. */ |
|
||||
#define HAVE_NET_IF_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have PF_INET6. */ |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recv function. */ |
|
||||
#define HAVE_RECV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recvfrom function. */ |
|
||||
#define HAVE_RECVFROM 1 |
|
||||
|
|
||||
/* Define to 1 if you have the send function. */ |
|
||||
#define HAVE_SEND 1 |
|
||||
|
|
||||
/* Define to 1 if you have the setsockopt function. */ |
|
||||
#define HAVE_SETSOCKOPT 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ |
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ |
|
||||
|
|
||||
/* Define to 1 if you have the <signal.h> header file. */ |
|
||||
#define HAVE_SIGNAL_H 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */ |
|
||||
#define HAVE_SIG_ATOMIC_T 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */ |
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ |
|
||||
|
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ |
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 |
|
||||
|
|
||||
/* Define to 1 if you have the socket function. */ |
|
||||
#define HAVE_SOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <socket.h> header file. */ |
|
||||
/* #undef HAVE_SOCKET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */ |
|
||||
#define HAVE_STDBOOL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcasecmp function. */ |
|
||||
#define HAVE_STRCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcmpi function. */ |
|
||||
/* #undef HAVE_STRCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strdup function. */ |
|
||||
#define HAVE_STRDUP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the stricmp function. */ |
|
||||
/* #undef HAVE_STRICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncasecmp function. */ |
|
||||
#define HAVE_STRNCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncmpi function. */ |
|
||||
/* #undef HAVE_STRNCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strnicmp function. */ |
|
||||
/* #undef HAVE_STRNICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stropts.h> header file. */ |
|
||||
/* #undef HAVE_STROPTS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have struct addrinfo. */ |
|
||||
#define HAVE_STRUCT_ADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct in6_addr. */ |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct sockaddr_in6. */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
|
|
||||
/* if struct sockaddr_storage is defined */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the timeval struct. */ |
|
||||
#define HAVE_STRUCT_TIMEVAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */ |
|
||||
#define HAVE_SYS_IOCTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */ |
|
||||
#define HAVE_SYS_PARAM_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */ |
|
||||
#define HAVE_SYS_SELECT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */ |
|
||||
#define HAVE_SYS_SOCKET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */ |
|
||||
#define HAVE_SYS_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */ |
|
||||
#define HAVE_SYS_UIO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <time.h> header file. */ |
|
||||
#define HAVE_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the windows.h header file. */ |
|
||||
/* #undef HAVE_WINDOWS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock2.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK2_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the writev function. */ |
|
||||
#define HAVE_WRITEV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */ |
|
||||
/* #undef HAVE_WS2TCPIP_H */ |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Define to 1 if you are building a native Windows target. */ |
|
||||
/* #undef NATIVE_WINDOWS */ |
|
||||
|
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MEMORY_H */ |
|
||||
|
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_REENTRANT */ |
|
||||
|
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_THREAD_SAFE */ |
|
||||
|
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ |
|
||||
/* #undef NO_MINUS_C_MINUS_O */ |
|
||||
|
|
||||
/* cpu-machine-OS */ |
|
||||
#define OS "i386-portbld-freebsd8.0" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "c-ares" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares"
|
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "c-ares" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "c-ares 1.7.1" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "c-ares" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "1.7.1" |
|
||||
|
|
||||
/* a suitable file/device to read random data from */ |
|
||||
#define RANDOM_FILE "/dev/urandom" |
|
||||
|
|
||||
/* Define to the type of arg 1 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG2 void |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ |
|
||||
#define RECVFROM_TYPE_ARG2_IS_VOID 1 |
|
||||
|
|
||||
/* Define to the type of arg 3 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ |
|
||||
|
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG6 socklen_t |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ |
|
||||
|
|
||||
/* Define to the function return type for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_RETV int |
|
||||
|
|
||||
/* Define to the type of arg 1 for recv. */ |
|
||||
#define RECV_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for recv. */ |
|
||||
#define RECV_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for recv. */ |
|
||||
#define RECV_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recv. */ |
|
||||
#define RECV_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for recv. */ |
|
||||
#define RECV_TYPE_RETV int |
|
||||
|
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */ |
|
||||
#define RETSIGTYPE void |
|
||||
|
|
||||
/* Define to the type qualifier of arg 2 for send. */ |
|
||||
#define SEND_QUAL_ARG2 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for send. */ |
|
||||
#define SEND_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for send. */ |
|
||||
#define SEND_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for send. */ |
|
||||
#define SEND_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for send. */ |
|
||||
#define SEND_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for send. */ |
|
||||
#define SEND_TYPE_RETV int |
|
||||
|
|
||||
/* The size of `int', as computed by sizeof. */ |
|
||||
#define SIZEOF_INT 4 |
|
||||
|
|
||||
/* The size of `long', as computed by sizeof. */ |
|
||||
#define SIZEOF_LONG 4 |
|
||||
|
|
||||
/* The size of `size_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_SIZE_T 4 |
|
||||
|
|
||||
/* The size of `struct in6_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN6_ADDR 16 |
|
||||
|
|
||||
/* The size of `struct in_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN_ADDR 4 |
|
||||
|
|
||||
/* The size of `time_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_TIME_T 4 |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
|
||||
#define TIME_WITH_SYS_TIME 1 |
|
||||
|
|
||||
/* Define to disable non-blocking sockets. */ |
|
||||
/* #undef USE_BLOCKING_SOCKETS */ |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.7.1" |
|
||||
|
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD |
|
||||
# if defined __BIG_ENDIAN__ |
|
||||
# define WORDS_BIGENDIAN 1 |
|
||||
# endif |
|
||||
#else |
|
||||
# ifndef WORDS_BIGENDIAN |
|
||||
/* # undef WORDS_BIGENDIAN */ |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* Define to 1 if OS is AIX. */ |
|
||||
#ifndef _ALL_SOURCE |
|
||||
/* # undef _ALL_SOURCE */ |
|
||||
#endif |
|
||||
|
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */ |
|
||||
/* #undef _FILE_OFFSET_BITS */ |
|
||||
|
|
||||
/* Define for large files, on AIX-style hosts. */ |
|
||||
/* #undef _LARGE_FILES */ |
|
||||
|
|
||||
/* Define to empty if `const' does not conform to ANSI C. */ |
|
||||
/* #undef const */ |
|
||||
|
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */ |
|
||||
/* #undef in_addr_t */ |
|
||||
|
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */ |
|
||||
/* #undef size_t */ |
|
||||
|
|
||||
/* the signed version of size_t */ |
|
||||
/* #undef ssize_t */ |
|
@ -1,510 +0,0 @@ |
|||||
/* ares_config.h. Generated from ares_config.h.in by configure. */ |
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define if building universal (internal helper macro) */ |
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
||||
|
|
||||
/* define this if ares is built for a big endian system */ |
|
||||
/* #undef ARES_BIG_ENDIAN */ |
|
||||
|
|
||||
/* when building as static part of libcurl */ |
|
||||
/* #undef BUILDING_LIBCURL */ |
|
||||
|
|
||||
/* when building c-ares library */ |
|
||||
/* #undef CARES_BUILDING_LIBRARY */ |
|
||||
|
|
||||
/* when not building a shared library */ |
|
||||
/* #undef CARES_STATICLIB */ |
|
||||
|
|
||||
/* Define to 1 to enable hiding of library internal symbols. */ |
|
||||
#define CARES_SYMBOL_HIDING 1 |
|
||||
|
|
||||
/* Definition to make a library symbol externally visible. */ |
|
||||
#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((visibility ("default"))) |
|
||||
|
|
||||
/* if a /etc/inet dir is being used */ |
|
||||
/* #undef ETC_INET */ |
|
||||
|
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_QUAL_ARG1 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * |
|
||||
|
|
||||
/* Define to the type of arg 2 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG2 socklen_t |
|
||||
|
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG46 size_t |
|
||||
|
|
||||
/* Define to the type of arg 7 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG7 unsigned int |
|
||||
|
|
||||
/* Specifies the number of arguments to getservbyport_r */ |
|
||||
#define GETSERVBYPORT_R_ARGS 6 |
|
||||
|
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */ |
|
||||
#define GETSERVBYPORT_R_BUFSIZE 4096 |
|
||||
|
|
||||
/* Define to 1 if you have AF_INET6. */ |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */ |
|
||||
#define HAVE_ARPA_INET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_COMPAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <assert.h> header file. */ |
|
||||
#define HAVE_ASSERT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `bitncmp' function. */ |
|
||||
/* #undef HAVE_BITNCMP */ |
|
||||
|
|
||||
/* Define to 1 if bool is an available type. */ |
|
||||
#define HAVE_BOOL_T 1 |
|
||||
|
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */ |
|
||||
#define HAVE_CLOCK_GETTIME_MONOTONIC 1 |
|
||||
|
|
||||
/* Define to 1 if you have the closesocket function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have the connect function. */ |
|
||||
#define HAVE_CONNECT 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <errno.h> header file. */ |
|
||||
#define HAVE_ERRNO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the fcntl function. */ |
|
||||
#define HAVE_FCNTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */ |
|
||||
#define HAVE_FCNTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ |
|
||||
#define HAVE_FCNTL_O_NONBLOCK 1 |
|
||||
|
|
||||
/* Define to 1 if you have the freeaddrinfo function. */ |
|
||||
#define HAVE_FREEADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working getaddrinfo function. */ |
|
||||
#define HAVE_GETADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */ |
|
||||
#define HAVE_GETADDRINFO_THREADSAFE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyaddr function. */ |
|
||||
#define HAVE_GETHOSTBYADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyname function. */ |
|
||||
#define HAVE_GETHOSTBYNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostname function. */ |
|
||||
#define HAVE_GETHOSTNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getnameinfo function. */ |
|
||||
#define HAVE_GETNAMEINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getservbyport_r function. */ |
|
||||
#define HAVE_GETSERVBYPORT_R 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `gettimeofday' function. */ |
|
||||
#define HAVE_GETTIMEOFDAY 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `if_indextoname' function. */ |
|
||||
#define HAVE_IF_INDEXTONAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `inet_net_pton' function. */ |
|
||||
/* #undef HAVE_INET_NET_PTON */ |
|
||||
|
|
||||
/* Define to 1 if inet_net_pton supports IPv6. */ |
|
||||
/* #undef HAVE_INET_NET_PTON_IPV6 */ |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ |
|
||||
#define HAVE_INET_NTOP 1 |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */ |
|
||||
#define HAVE_INET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctl function. */ |
|
||||
#define HAVE_IOCTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctlsocket function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
|
||||
*/ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */ |
|
||||
#define HAVE_IOCTL_FIONBIO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ |
|
||||
#define HAVE_IOCTL_SIOCGIFADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */ |
|
||||
/* #undef HAVE_LIBRESOLVE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <limits.h> header file. */ |
|
||||
#define HAVE_LIMITS_H 1 |
|
||||
|
|
||||
/* if your compiler supports LL */ |
|
||||
#define HAVE_LL 1 |
|
||||
|
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */ |
|
||||
#define HAVE_LONGLONG 1 |
|
||||
|
|
||||
/* Define to 1 if you have the malloc.h header file. */ |
|
||||
#define HAVE_MALLOC_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the memory.h header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */ |
|
||||
#define HAVE_MSG_NOSIGNAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netdb.h> header file. */ |
|
||||
#define HAVE_NETDB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */ |
|
||||
#define HAVE_NETINET_IN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */ |
|
||||
#define HAVE_NETINET_TCP_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <net/if.h> header file. */ |
|
||||
#define HAVE_NET_IF_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have PF_INET6. */ |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recv function. */ |
|
||||
#define HAVE_RECV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recvfrom function. */ |
|
||||
#define HAVE_RECVFROM 1 |
|
||||
|
|
||||
/* Define to 1 if you have the send function. */ |
|
||||
#define HAVE_SEND 1 |
|
||||
|
|
||||
/* Define to 1 if you have the setsockopt function. */ |
|
||||
#define HAVE_SETSOCKOPT 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ |
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ |
|
||||
|
|
||||
/* Define to 1 if you have the <signal.h> header file. */ |
|
||||
#define HAVE_SIGNAL_H 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */ |
|
||||
#define HAVE_SIG_ATOMIC_T 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */ |
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ |
|
||||
|
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ |
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 |
|
||||
|
|
||||
/* Define to 1 if you have the socket function. */ |
|
||||
#define HAVE_SOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <socket.h> header file. */ |
|
||||
/* #undef HAVE_SOCKET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */ |
|
||||
#define HAVE_STDBOOL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcasecmp function. */ |
|
||||
#define HAVE_STRCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcmpi function. */ |
|
||||
/* #undef HAVE_STRCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strdup function. */ |
|
||||
#define HAVE_STRDUP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the stricmp function. */ |
|
||||
/* #undef HAVE_STRICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncasecmp function. */ |
|
||||
#define HAVE_STRNCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncmpi function. */ |
|
||||
/* #undef HAVE_STRNCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strnicmp function. */ |
|
||||
/* #undef HAVE_STRNICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stropts.h> header file. */ |
|
||||
#define HAVE_STROPTS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct addrinfo. */ |
|
||||
#define HAVE_STRUCT_ADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct in6_addr. */ |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct sockaddr_in6. */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
|
|
||||
/* if struct sockaddr_storage is defined */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the timeval struct. */ |
|
||||
#define HAVE_STRUCT_TIMEVAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */ |
|
||||
#define HAVE_SYS_IOCTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */ |
|
||||
#define HAVE_SYS_PARAM_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */ |
|
||||
#define HAVE_SYS_SELECT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */ |
|
||||
#define HAVE_SYS_SOCKET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */ |
|
||||
#define HAVE_SYS_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */ |
|
||||
#define HAVE_SYS_UIO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <time.h> header file. */ |
|
||||
#define HAVE_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the windows.h header file. */ |
|
||||
/* #undef HAVE_WINDOWS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock2.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK2_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the writev function. */ |
|
||||
#define HAVE_WRITEV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */ |
|
||||
/* #undef HAVE_WS2TCPIP_H */ |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Define to 1 if you are building a native Windows target. */ |
|
||||
/* #undef NATIVE_WINDOWS */ |
|
||||
|
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MEMORY_H */ |
|
||||
|
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_REENTRANT */ |
|
||||
|
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_THREAD_SAFE */ |
|
||||
|
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ |
|
||||
/* #undef NO_MINUS_C_MINUS_O */ |
|
||||
|
|
||||
/* cpu-machine-OS */ |
|
||||
#define OS "i686-pc-linux-gnu" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "c-ares" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares"
|
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "c-ares" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "c-ares 1.7.1" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "c-ares" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "1.7.1" |
|
||||
|
|
||||
/* a suitable file/device to read random data from */ |
|
||||
#define RANDOM_FILE "/dev/urandom" |
|
||||
|
|
||||
/* Define to the type of arg 1 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG2 void |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ |
|
||||
#define RECVFROM_TYPE_ARG2_IS_VOID 1 |
|
||||
|
|
||||
/* Define to the type of arg 3 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ |
|
||||
|
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG6 socklen_t |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ |
|
||||
|
|
||||
/* Define to the function return type for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_RETV int |
|
||||
|
|
||||
/* Define to the type of arg 1 for recv. */ |
|
||||
#define RECV_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for recv. */ |
|
||||
#define RECV_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for recv. */ |
|
||||
#define RECV_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recv. */ |
|
||||
#define RECV_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for recv. */ |
|
||||
#define RECV_TYPE_RETV int |
|
||||
|
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */ |
|
||||
#define RETSIGTYPE void |
|
||||
|
|
||||
/* Define to the type qualifier of arg 2 for send. */ |
|
||||
#define SEND_QUAL_ARG2 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for send. */ |
|
||||
#define SEND_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for send. */ |
|
||||
#define SEND_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for send. */ |
|
||||
#define SEND_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for send. */ |
|
||||
#define SEND_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for send. */ |
|
||||
#define SEND_TYPE_RETV int |
|
||||
|
|
||||
/* The size of `int', as computed by sizeof. */ |
|
||||
#define SIZEOF_INT 4 |
|
||||
|
|
||||
/* The size of `long', as computed by sizeof. */ |
|
||||
#define SIZEOF_LONG 4 |
|
||||
|
|
||||
/* The size of `size_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_SIZE_T 4 |
|
||||
|
|
||||
/* The size of `struct in6_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN6_ADDR 16 |
|
||||
|
|
||||
/* The size of `struct in_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN_ADDR 4 |
|
||||
|
|
||||
/* The size of `time_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_TIME_T 4 |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
|
||||
#define TIME_WITH_SYS_TIME 1 |
|
||||
|
|
||||
/* Define to disable non-blocking sockets. */ |
|
||||
/* #undef USE_BLOCKING_SOCKETS */ |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.7.1" |
|
||||
|
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD |
|
||||
# if defined __BIG_ENDIAN__ |
|
||||
# define WORDS_BIGENDIAN 1 |
|
||||
# endif |
|
||||
#else |
|
||||
# ifndef WORDS_BIGENDIAN |
|
||||
/* # undef WORDS_BIGENDIAN */ |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* Define to 1 if OS is AIX. */ |
|
||||
#ifndef _ALL_SOURCE |
|
||||
/* # undef _ALL_SOURCE */ |
|
||||
#endif |
|
||||
|
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */ |
|
||||
#define _FILE_OFFSET_BITS 64 |
|
||||
|
|
||||
/* Define for large files, on AIX-style hosts. */ |
|
||||
/* #undef _LARGE_FILES */ |
|
||||
|
|
||||
/* Define to empty if `const' does not conform to ANSI C. */ |
|
||||
/* #undef const */ |
|
||||
|
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */ |
|
||||
/* #undef in_addr_t */ |
|
||||
|
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */ |
|
||||
/* #undef size_t */ |
|
||||
|
|
||||
/* the signed version of size_t */ |
|
||||
/* #undef ssize_t */ |
|
@ -1,510 +0,0 @@ |
|||||
/* ares_config.h. Generated from ares_config.h.in by configure. */ |
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define if building universal (internal helper macro) */ |
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
||||
|
|
||||
/* define this if ares is built for a big endian system */ |
|
||||
/* #undef ARES_BIG_ENDIAN */ |
|
||||
|
|
||||
/* when building as static part of libcurl */ |
|
||||
/* #undef BUILDING_LIBCURL */ |
|
||||
|
|
||||
/* when building c-ares library */ |
|
||||
/* #undef CARES_BUILDING_LIBRARY */ |
|
||||
|
|
||||
/* when not building a shared library */ |
|
||||
/* #undef CARES_STATICLIB */ |
|
||||
|
|
||||
/* Define to 1 to enable hiding of library internal symbols. */ |
|
||||
/* #undef CARES_SYMBOL_HIDING */ |
|
||||
|
|
||||
/* Definition to make a library symbol externally visible. */ |
|
||||
/* #undef CARES_SYMBOL_SCOPE_EXTERN */ |
|
||||
|
|
||||
/* if a /etc/inet dir is being used */ |
|
||||
/* #undef ETC_INET */ |
|
||||
|
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_QUAL_ARG1 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * |
|
||||
|
|
||||
/* Define to the type of arg 2 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG2 socklen_t |
|
||||
|
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG46 size_t |
|
||||
|
|
||||
/* Define to the type of arg 7 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG7 int |
|
||||
|
|
||||
/* Specifies the number of arguments to getservbyport_r */ |
|
||||
#define GETSERVBYPORT_R_ARGS 4 |
|
||||
|
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */ |
|
||||
#define GETSERVBYPORT_R_BUFSIZE sizeof(struct servent_data) |
|
||||
|
|
||||
/* Define to 1 if you have AF_INET6. */ |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */ |
|
||||
#define HAVE_ARPA_INET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */ |
|
||||
/* #undef HAVE_ARPA_NAMESER_COMPAT_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <assert.h> header file. */ |
|
||||
#define HAVE_ASSERT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `bitncmp' function. */ |
|
||||
/* #undef HAVE_BITNCMP */ |
|
||||
|
|
||||
/* Define to 1 if bool is an available type. */ |
|
||||
#define HAVE_BOOL_T 1 |
|
||||
|
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */ |
|
||||
#define HAVE_CLOCK_GETTIME_MONOTONIC 1 |
|
||||
|
|
||||
/* Define to 1 if you have the closesocket function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have the connect function. */ |
|
||||
#define HAVE_CONNECT 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <errno.h> header file. */ |
|
||||
#define HAVE_ERRNO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the fcntl function. */ |
|
||||
#define HAVE_FCNTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */ |
|
||||
#define HAVE_FCNTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ |
|
||||
#define HAVE_FCNTL_O_NONBLOCK 1 |
|
||||
|
|
||||
/* Define to 1 if you have the freeaddrinfo function. */ |
|
||||
#define HAVE_FREEADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working getaddrinfo function. */ |
|
||||
#define HAVE_GETADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */ |
|
||||
/* #undef HAVE_GETADDRINFO_THREADSAFE */ |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyaddr function. */ |
|
||||
#define HAVE_GETHOSTBYADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyname function. */ |
|
||||
#define HAVE_GETHOSTBYNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostname function. */ |
|
||||
#define HAVE_GETHOSTNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getnameinfo function. */ |
|
||||
#define HAVE_GETNAMEINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getservbyport_r function. */ |
|
||||
#define HAVE_GETSERVBYPORT_R 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `gettimeofday' function. */ |
|
||||
#define HAVE_GETTIMEOFDAY 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `if_indextoname' function. */ |
|
||||
#define HAVE_IF_INDEXTONAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `inet_net_pton' function. */ |
|
||||
#define HAVE_INET_NET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if inet_net_pton supports IPv6. */ |
|
||||
/* #undef HAVE_INET_NET_PTON_IPV6 */ |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ |
|
||||
#define HAVE_INET_NTOP 1 |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */ |
|
||||
#define HAVE_INET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctl function. */ |
|
||||
#define HAVE_IOCTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctlsocket function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
|
||||
*/ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */ |
|
||||
#define HAVE_IOCTL_FIONBIO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ |
|
||||
#define HAVE_IOCTL_SIOCGIFADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */ |
|
||||
/* #undef HAVE_LIBRESOLVE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <limits.h> header file. */ |
|
||||
#define HAVE_LIMITS_H 1 |
|
||||
|
|
||||
/* if your compiler supports LL */ |
|
||||
#define HAVE_LL 1 |
|
||||
|
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */ |
|
||||
#define HAVE_LONGLONG 1 |
|
||||
|
|
||||
/* Define to 1 if you have the malloc.h header file. */ |
|
||||
#define HAVE_MALLOC_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the memory.h header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */ |
|
||||
/* #undef HAVE_MSG_NOSIGNAL */ |
|
||||
|
|
||||
/* Define to 1 if you have the <netdb.h> header file. */ |
|
||||
#define HAVE_NETDB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */ |
|
||||
#define HAVE_NETINET_IN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */ |
|
||||
#define HAVE_NETINET_TCP_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <net/if.h> header file. */ |
|
||||
#define HAVE_NET_IF_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have PF_INET6. */ |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recv function. */ |
|
||||
#define HAVE_RECV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recvfrom function. */ |
|
||||
#define HAVE_RECVFROM 1 |
|
||||
|
|
||||
/* Define to 1 if you have the send function. */ |
|
||||
#define HAVE_SEND 1 |
|
||||
|
|
||||
/* Define to 1 if you have the setsockopt function. */ |
|
||||
#define HAVE_SETSOCKOPT 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ |
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ |
|
||||
|
|
||||
/* Define to 1 if you have the <signal.h> header file. */ |
|
||||
#define HAVE_SIGNAL_H 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */ |
|
||||
#define HAVE_SIG_ATOMIC_T 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */ |
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ |
|
||||
|
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ |
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 |
|
||||
|
|
||||
/* Define to 1 if you have the socket function. */ |
|
||||
#define HAVE_SOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <socket.h> header file. */ |
|
||||
/* #undef HAVE_SOCKET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */ |
|
||||
#define HAVE_STDBOOL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcasecmp function. */ |
|
||||
#define HAVE_STRCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcmpi function. */ |
|
||||
/* #undef HAVE_STRCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strdup function. */ |
|
||||
#define HAVE_STRDUP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the stricmp function. */ |
|
||||
/* #undef HAVE_STRICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncasecmp function. */ |
|
||||
#define HAVE_STRNCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncmpi function. */ |
|
||||
/* #undef HAVE_STRNCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strnicmp function. */ |
|
||||
/* #undef HAVE_STRNICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stropts.h> header file. */ |
|
||||
/* #undef HAVE_STROPTS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have struct addrinfo. */ |
|
||||
#define HAVE_STRUCT_ADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct in6_addr. */ |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct sockaddr_in6. */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
|
|
||||
/* if struct sockaddr_storage is defined */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the timeval struct. */ |
|
||||
#define HAVE_STRUCT_TIMEVAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */ |
|
||||
#define HAVE_SYS_IOCTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */ |
|
||||
#define HAVE_SYS_PARAM_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */ |
|
||||
#define HAVE_SYS_SELECT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */ |
|
||||
#define HAVE_SYS_SOCKET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */ |
|
||||
#define HAVE_SYS_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */ |
|
||||
#define HAVE_SYS_UIO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <time.h> header file. */ |
|
||||
#define HAVE_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the windows.h header file. */ |
|
||||
/* #undef HAVE_WINDOWS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock2.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK2_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the writev function. */ |
|
||||
#define HAVE_WRITEV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */ |
|
||||
/* #undef HAVE_WS2TCPIP_H */ |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Define to 1 if you are building a native Windows target. */ |
|
||||
/* #undef NATIVE_WINDOWS */ |
|
||||
|
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MEMORY_H */ |
|
||||
|
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_REENTRANT */ |
|
||||
|
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_THREAD_SAFE */ |
|
||||
|
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ |
|
||||
/* #undef NO_MINUS_C_MINUS_O */ |
|
||||
|
|
||||
/* cpu-machine-OS */ |
|
||||
#define OS "i386-unknown-openbsd4.7" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "c-ares" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares"
|
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "c-ares" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "c-ares 1.7.1" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "c-ares" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "1.7.1" |
|
||||
|
|
||||
/* a suitable file/device to read random data from */ |
|
||||
#define RANDOM_FILE "/dev/urandom" |
|
||||
|
|
||||
/* Define to the type of arg 1 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG2 void |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ |
|
||||
#define RECVFROM_TYPE_ARG2_IS_VOID 1 |
|
||||
|
|
||||
/* Define to the type of arg 3 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ |
|
||||
|
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG6 socklen_t |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ |
|
||||
|
|
||||
/* Define to the function return type for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_RETV int |
|
||||
|
|
||||
/* Define to the type of arg 1 for recv. */ |
|
||||
#define RECV_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for recv. */ |
|
||||
#define RECV_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for recv. */ |
|
||||
#define RECV_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recv. */ |
|
||||
#define RECV_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for recv. */ |
|
||||
#define RECV_TYPE_RETV int |
|
||||
|
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */ |
|
||||
#define RETSIGTYPE void |
|
||||
|
|
||||
/* Define to the type qualifier of arg 2 for send. */ |
|
||||
#define SEND_QUAL_ARG2 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for send. */ |
|
||||
#define SEND_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for send. */ |
|
||||
#define SEND_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for send. */ |
|
||||
#define SEND_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for send. */ |
|
||||
#define SEND_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for send. */ |
|
||||
#define SEND_TYPE_RETV int |
|
||||
|
|
||||
/* The size of `int', as computed by sizeof. */ |
|
||||
#define SIZEOF_INT 4 |
|
||||
|
|
||||
/* The size of `long', as computed by sizeof. */ |
|
||||
#define SIZEOF_LONG 4 |
|
||||
|
|
||||
/* The size of `size_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_SIZE_T 4 |
|
||||
|
|
||||
/* The size of `struct in6_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN6_ADDR 16 |
|
||||
|
|
||||
/* The size of `struct in_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN_ADDR 4 |
|
||||
|
|
||||
/* The size of `time_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_TIME_T 4 |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
|
||||
#define TIME_WITH_SYS_TIME 1 |
|
||||
|
|
||||
/* Define to disable non-blocking sockets. */ |
|
||||
/* #undef USE_BLOCKING_SOCKETS */ |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.7.1" |
|
||||
|
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD |
|
||||
# if defined __BIG_ENDIAN__ |
|
||||
# define WORDS_BIGENDIAN 1 |
|
||||
# endif |
|
||||
#else |
|
||||
# ifndef WORDS_BIGENDIAN |
|
||||
/* # undef WORDS_BIGENDIAN */ |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* Define to 1 if OS is AIX. */ |
|
||||
#ifndef _ALL_SOURCE |
|
||||
/* # undef _ALL_SOURCE */ |
|
||||
#endif |
|
||||
|
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */ |
|
||||
/* #undef _FILE_OFFSET_BITS */ |
|
||||
|
|
||||
/* Define for large files, on AIX-style hosts. */ |
|
||||
/* #undef _LARGE_FILES */ |
|
||||
|
|
||||
/* Define to empty if `const' does not conform to ANSI C. */ |
|
||||
/* #undef const */ |
|
||||
|
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */ |
|
||||
/* #undef in_addr_t */ |
|
||||
|
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */ |
|
||||
/* #undef size_t */ |
|
||||
|
|
||||
/* the signed version of size_t */ |
|
||||
/* #undef ssize_t */ |
|
@ -1,510 +0,0 @@ |
|||||
/* ares_config.h. Generated from ares_config.h.in by configure. */ |
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define if building universal (internal helper macro) */ |
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
||||
|
|
||||
/* define this if ares is built for a big endian system */ |
|
||||
/* #undef ARES_BIG_ENDIAN */ |
|
||||
|
|
||||
/* when building as static part of libcurl */ |
|
||||
/* #undef BUILDING_LIBCURL */ |
|
||||
|
|
||||
/* when building c-ares library */ |
|
||||
/* #undef CARES_BUILDING_LIBRARY */ |
|
||||
|
|
||||
/* when not building a shared library */ |
|
||||
/* #undef CARES_STATICLIB */ |
|
||||
|
|
||||
/* Define to 1 to enable hiding of library internal symbols. */ |
|
||||
/* #undef CARES_SYMBOL_HIDING */ |
|
||||
|
|
||||
/* Definition to make a library symbol externally visible. */ |
|
||||
/* #undef CARES_SYMBOL_SCOPE_EXTERN */ |
|
||||
|
|
||||
/* if a /etc/inet dir is being used */ |
|
||||
#define ETC_INET 1 |
|
||||
|
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_QUAL_ARG1 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * |
|
||||
|
|
||||
/* Define to the type of arg 2 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG2 socklen_t |
|
||||
|
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG46 size_t |
|
||||
|
|
||||
/* Define to the type of arg 7 for getnameinfo. */ |
|
||||
#define GETNAMEINFO_TYPE_ARG7 int |
|
||||
|
|
||||
/* Specifies the number of arguments to getservbyport_r */ |
|
||||
#define GETSERVBYPORT_R_ARGS 5 |
|
||||
|
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */ |
|
||||
#define GETSERVBYPORT_R_BUFSIZE 4096 |
|
||||
|
|
||||
/* Define to 1 if you have AF_INET6. */ |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */ |
|
||||
#define HAVE_ARPA_INET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_COMPAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */ |
|
||||
#define HAVE_ARPA_NAMESER_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <assert.h> header file. */ |
|
||||
#define HAVE_ASSERT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `bitncmp' function. */ |
|
||||
/* #undef HAVE_BITNCMP */ |
|
||||
|
|
||||
/* Define to 1 if bool is an available type. */ |
|
||||
#define HAVE_BOOL_T 1 |
|
||||
|
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */ |
|
||||
#define HAVE_CLOCK_GETTIME_MONOTONIC 1 |
|
||||
|
|
||||
/* Define to 1 if you have the closesocket function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have the connect function. */ |
|
||||
#define HAVE_CONNECT 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <errno.h> header file. */ |
|
||||
#define HAVE_ERRNO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the fcntl function. */ |
|
||||
#define HAVE_FCNTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */ |
|
||||
#define HAVE_FCNTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ |
|
||||
#define HAVE_FCNTL_O_NONBLOCK 1 |
|
||||
|
|
||||
/* Define to 1 if you have the freeaddrinfo function. */ |
|
||||
#define HAVE_FREEADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working getaddrinfo function. */ |
|
||||
#define HAVE_GETADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */ |
|
||||
#define HAVE_GETADDRINFO_THREADSAFE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyaddr function. */ |
|
||||
#define HAVE_GETHOSTBYADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyname function. */ |
|
||||
#define HAVE_GETHOSTBYNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostname function. */ |
|
||||
#define HAVE_GETHOSTNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getnameinfo function. */ |
|
||||
#define HAVE_GETNAMEINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getservbyport_r function. */ |
|
||||
#define HAVE_GETSERVBYPORT_R 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `gettimeofday' function. */ |
|
||||
#define HAVE_GETTIMEOFDAY 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `if_indextoname' function. */ |
|
||||
#define HAVE_IF_INDEXTONAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `inet_net_pton' function. */ |
|
||||
/* #undef HAVE_INET_NET_PTON */ |
|
||||
|
|
||||
/* Define to 1 if inet_net_pton supports IPv6. */ |
|
||||
/* #undef HAVE_INET_NET_PTON_IPV6 */ |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ |
|
||||
#define HAVE_INET_NTOP 1 |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */ |
|
||||
#define HAVE_INET_PTON 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctl function. */ |
|
||||
#define HAVE_IOCTL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctlsocket function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET */ |
|
||||
|
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
|
||||
*/ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */ |
|
||||
/* #undef HAVE_IOCTL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ |
|
||||
/* #undef HAVE_IOCTL_SIOCGIFADDR */ |
|
||||
|
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */ |
|
||||
/* #undef HAVE_LIBRESOLVE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <limits.h> header file. */ |
|
||||
#define HAVE_LIMITS_H 1 |
|
||||
|
|
||||
/* if your compiler supports LL */ |
|
||||
#define HAVE_LL 1 |
|
||||
|
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */ |
|
||||
#define HAVE_LONGLONG 1 |
|
||||
|
|
||||
/* Define to 1 if you have the malloc.h header file. */ |
|
||||
#define HAVE_MALLOC_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the memory.h header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */ |
|
||||
/* #undef HAVE_MSG_NOSIGNAL */ |
|
||||
|
|
||||
/* Define to 1 if you have the <netdb.h> header file. */ |
|
||||
#define HAVE_NETDB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */ |
|
||||
#define HAVE_NETINET_IN_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */ |
|
||||
#define HAVE_NETINET_TCP_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <net/if.h> header file. */ |
|
||||
#define HAVE_NET_IF_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have PF_INET6. */ |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recv function. */ |
|
||||
#define HAVE_RECV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recvfrom function. */ |
|
||||
#define HAVE_RECVFROM 1 |
|
||||
|
|
||||
/* Define to 1 if you have the send function. */ |
|
||||
#define HAVE_SEND 1 |
|
||||
|
|
||||
/* Define to 1 if you have the setsockopt function. */ |
|
||||
#define HAVE_SETSOCKOPT 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ |
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ |
|
||||
|
|
||||
/* Define to 1 if you have the <signal.h> header file. */ |
|
||||
#define HAVE_SIGNAL_H 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */ |
|
||||
#define HAVE_SIG_ATOMIC_T 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */ |
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ |
|
||||
|
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ |
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 |
|
||||
|
|
||||
/* Define to 1 if you have the socket function. */ |
|
||||
#define HAVE_SOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <socket.h> header file. */ |
|
||||
/* #undef HAVE_SOCKET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */ |
|
||||
#define HAVE_STDBOOL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcasecmp function. */ |
|
||||
#define HAVE_STRCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcmpi function. */ |
|
||||
/* #undef HAVE_STRCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strdup function. */ |
|
||||
#define HAVE_STRDUP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the stricmp function. */ |
|
||||
/* #undef HAVE_STRICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncasecmp function. */ |
|
||||
#define HAVE_STRNCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncmpi function. */ |
|
||||
/* #undef HAVE_STRNCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strnicmp function. */ |
|
||||
/* #undef HAVE_STRNICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stropts.h> header file. */ |
|
||||
#define HAVE_STROPTS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct addrinfo. */ |
|
||||
#define HAVE_STRUCT_ADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct in6_addr. */ |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct sockaddr_in6. */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
|
|
||||
/* if struct sockaddr_storage is defined */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the timeval struct. */ |
|
||||
#define HAVE_STRUCT_TIMEVAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */ |
|
||||
#define HAVE_SYS_IOCTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */ |
|
||||
#define HAVE_SYS_PARAM_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */ |
|
||||
#define HAVE_SYS_SELECT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */ |
|
||||
#define HAVE_SYS_SOCKET_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */ |
|
||||
#define HAVE_SYS_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */ |
|
||||
#define HAVE_SYS_UIO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <time.h> header file. */ |
|
||||
#define HAVE_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the windows.h header file. */ |
|
||||
/* #undef HAVE_WINDOWS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock2.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK2_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the winsock.h header file. */ |
|
||||
/* #undef HAVE_WINSOCK_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the writev function. */ |
|
||||
#define HAVE_WRITEV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */ |
|
||||
/* #undef HAVE_WS2TCPIP_H */ |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Define to 1 if you are building a native Windows target. */ |
|
||||
/* #undef NATIVE_WINDOWS */ |
|
||||
|
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MEMORY_H */ |
|
||||
|
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ |
|
||||
#define NEED_REENTRANT 1 |
|
||||
|
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_THREAD_SAFE */ |
|
||||
|
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ |
|
||||
/* #undef NO_MINUS_C_MINUS_O */ |
|
||||
|
|
||||
/* cpu-machine-OS */ |
|
||||
#define OS "i386-pc-solaris2.11" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "c-ares" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares"
|
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "c-ares" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "c-ares 1.7.1" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "c-ares" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "1.7.1" |
|
||||
|
|
||||
/* a suitable file/device to read random data from */ |
|
||||
#define RANDOM_FILE "/dev/urandom" |
|
||||
|
|
||||
/* Define to the type of arg 1 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG2 void |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ |
|
||||
#define RECVFROM_TYPE_ARG2_IS_VOID 1 |
|
||||
|
|
||||
/* Define to the type of arg 3 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ |
|
||||
|
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG6 void |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ |
|
||||
#define RECVFROM_TYPE_ARG6_IS_VOID 1 |
|
||||
|
|
||||
/* Define to the function return type for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_RETV int |
|
||||
|
|
||||
/* Define to the type of arg 1 for recv. */ |
|
||||
#define RECV_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for recv. */ |
|
||||
#define RECV_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for recv. */ |
|
||||
#define RECV_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for recv. */ |
|
||||
#define RECV_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for recv. */ |
|
||||
#define RECV_TYPE_RETV int |
|
||||
|
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */ |
|
||||
#define RETSIGTYPE void |
|
||||
|
|
||||
/* Define to the type qualifier of arg 2 for send. */ |
|
||||
#define SEND_QUAL_ARG2 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for send. */ |
|
||||
#define SEND_TYPE_ARG1 int |
|
||||
|
|
||||
/* Define to the type of arg 2 for send. */ |
|
||||
#define SEND_TYPE_ARG2 void * |
|
||||
|
|
||||
/* Define to the type of arg 3 for send. */ |
|
||||
#define SEND_TYPE_ARG3 size_t |
|
||||
|
|
||||
/* Define to the type of arg 4 for send. */ |
|
||||
#define SEND_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for send. */ |
|
||||
#define SEND_TYPE_RETV int |
|
||||
|
|
||||
/* The size of `int', as computed by sizeof. */ |
|
||||
#define SIZEOF_INT 4 |
|
||||
|
|
||||
/* The size of `long', as computed by sizeof. */ |
|
||||
#define SIZEOF_LONG 4 |
|
||||
|
|
||||
/* The size of `size_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_SIZE_T 4 |
|
||||
|
|
||||
/* The size of `struct in6_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN6_ADDR 16 |
|
||||
|
|
||||
/* The size of `struct in_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN_ADDR 4 |
|
||||
|
|
||||
/* The size of `time_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_TIME_T 4 |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
|
||||
#define TIME_WITH_SYS_TIME 1 |
|
||||
|
|
||||
/* Define to disable non-blocking sockets. */ |
|
||||
/* #undef USE_BLOCKING_SOCKETS */ |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.7.1" |
|
||||
|
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD |
|
||||
# if defined __BIG_ENDIAN__ |
|
||||
# define WORDS_BIGENDIAN 1 |
|
||||
# endif |
|
||||
#else |
|
||||
# ifndef WORDS_BIGENDIAN |
|
||||
/* # undef WORDS_BIGENDIAN */ |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* Define to 1 if OS is AIX. */ |
|
||||
#ifndef _ALL_SOURCE |
|
||||
/* # undef _ALL_SOURCE */ |
|
||||
#endif |
|
||||
|
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */ |
|
||||
#define _FILE_OFFSET_BITS 64 |
|
||||
|
|
||||
/* Define for large files, on AIX-style hosts. */ |
|
||||
/* #undef _LARGE_FILES */ |
|
||||
|
|
||||
/* Define to empty if `const' does not conform to ANSI C. */ |
|
||||
/* #undef const */ |
|
||||
|
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */ |
|
||||
/* #undef in_addr_t */ |
|
||||
|
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */ |
|
||||
/* #undef size_t */ |
|
||||
|
|
||||
/* the signed version of size_t */ |
|
||||
/* #undef ssize_t */ |
|
@ -1,510 +0,0 @@ |
|||||
/* ares_config.h. Generated from ares_config.h.in by configure. */ |
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define if building universal (internal helper macro) */ |
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
||||
|
|
||||
/* define this if ares is built for a big endian system */ |
|
||||
/* #undef ARES_BIG_ENDIAN */ |
|
||||
|
|
||||
/* when building as static part of libcurl */ |
|
||||
/* #undef BUILDING_LIBCURL */ |
|
||||
|
|
||||
/* when building c-ares library */ |
|
||||
/* #undef CARES_BUILDING_LIBRARY */ |
|
||||
|
|
||||
/* when not building a shared library */ |
|
||||
#define CARES_STATICLIB 1 |
|
||||
|
|
||||
/* Define to 1 to enable hiding of library internal symbols. */ |
|
||||
/* #undef CARES_SYMBOL_HIDING */ |
|
||||
|
|
||||
/* Definition to make a library symbol externally visible. */ |
|
||||
/* #undef CARES_SYMBOL_SCOPE_EXTERN */ |
|
||||
|
|
||||
/* if a /etc/inet dir is being used */ |
|
||||
/* #undef ETC_INET */ |
|
||||
|
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */ |
|
||||
/* #undef GETNAMEINFO_QUAL_ARG1 */ |
|
||||
|
|
||||
/* Define to the type of arg 1 for getnameinfo. */ |
|
||||
/* #undef GETNAMEINFO_TYPE_ARG1 */ |
|
||||
|
|
||||
/* Define to the type of arg 2 for getnameinfo. */ |
|
||||
/* #undef GETNAMEINFO_TYPE_ARG2 */ |
|
||||
|
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */ |
|
||||
/* #undef GETNAMEINFO_TYPE_ARG46 */ |
|
||||
|
|
||||
/* Define to the type of arg 7 for getnameinfo. */ |
|
||||
/* #undef GETNAMEINFO_TYPE_ARG7 */ |
|
||||
|
|
||||
/* Specifies the number of arguments to getservbyport_r */ |
|
||||
/* #undef GETSERVBYPORT_R_ARGS */ |
|
||||
|
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */ |
|
||||
/* #undef GETSERVBYPORT_R_BUFSIZE */ |
|
||||
|
|
||||
/* Define to 1 if you have AF_INET6. */ |
|
||||
#define HAVE_AF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */ |
|
||||
/* #undef HAVE_ARPA_INET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */ |
|
||||
/* #undef HAVE_ARPA_NAMESER_COMPAT_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */ |
|
||||
/* #undef HAVE_ARPA_NAMESER_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <assert.h> header file. */ |
|
||||
#define HAVE_ASSERT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `bitncmp' function. */ |
|
||||
/* #undef HAVE_BITNCMP */ |
|
||||
|
|
||||
/* Define to 1 if bool is an available type. */ |
|
||||
#define HAVE_BOOL_T 1 |
|
||||
|
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */ |
|
||||
/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ |
|
||||
|
|
||||
/* Define to 1 if you have the closesocket function. */ |
|
||||
#define HAVE_CLOSESOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */ |
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have the connect function. */ |
|
||||
#define HAVE_CONNECT 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
/* #undef HAVE_DLFCN_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <errno.h> header file. */ |
|
||||
#define HAVE_ERRNO_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the fcntl function. */ |
|
||||
/* #undef HAVE_FCNTL */ |
|
||||
|
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */ |
|
||||
#define HAVE_FCNTL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ |
|
||||
/* #undef HAVE_FCNTL_O_NONBLOCK */ |
|
||||
|
|
||||
/* Define to 1 if you have the freeaddrinfo function. */ |
|
||||
/* #undef HAVE_FREEADDRINFO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working getaddrinfo function. */ |
|
||||
/* #undef HAVE_GETADDRINFO */ |
|
||||
|
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */ |
|
||||
/* #undef HAVE_GETADDRINFO_THREADSAFE */ |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyaddr function. */ |
|
||||
#define HAVE_GETHOSTBYADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostbyname function. */ |
|
||||
#define HAVE_GETHOSTBYNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the gethostname function. */ |
|
||||
#define HAVE_GETHOSTNAME 1 |
|
||||
|
|
||||
/* Define to 1 if you have the getnameinfo function. */ |
|
||||
/* #undef HAVE_GETNAMEINFO */ |
|
||||
|
|
||||
/* Define to 1 if you have the getservbyport_r function. */ |
|
||||
/* #undef HAVE_GETSERVBYPORT_R */ |
|
||||
|
|
||||
/* Define to 1 if you have the `gettimeofday' function. */ |
|
||||
#define HAVE_GETTIMEOFDAY 1 |
|
||||
|
|
||||
/* Define to 1 if you have the `if_indextoname' function. */ |
|
||||
/* #undef HAVE_IF_INDEXTONAME */ |
|
||||
|
|
||||
/* Define to 1 if you have the `inet_net_pton' function. */ |
|
||||
/* #undef HAVE_INET_NET_PTON */ |
|
||||
|
|
||||
/* Define to 1 if inet_net_pton supports IPv6. */ |
|
||||
/* #undef HAVE_INET_NET_PTON_IPV6 */ |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ |
|
||||
/* #undef HAVE_INET_NTOP */ |
|
||||
|
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */ |
|
||||
/* #undef HAVE_INET_PTON */ |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the ioctl function. */ |
|
||||
/* #undef HAVE_IOCTL */ |
|
||||
|
|
||||
/* Define to 1 if you have the ioctlsocket function. */ |
|
||||
#define HAVE_IOCTLSOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */ |
|
||||
|
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
|
||||
*/ |
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ |
|
||||
#define HAVE_IOCTLSOCKET_FIONBIO 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */ |
|
||||
/* #undef HAVE_IOCTL_FIONBIO */ |
|
||||
|
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ |
|
||||
/* #undef HAVE_IOCTL_SIOCGIFADDR */ |
|
||||
|
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */ |
|
||||
/* #undef HAVE_LIBRESOLVE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <limits.h> header file. */ |
|
||||
#define HAVE_LIMITS_H 1 |
|
||||
|
|
||||
/* if your compiler supports LL */ |
|
||||
#define HAVE_LL 1 |
|
||||
|
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */ |
|
||||
#define HAVE_LONGLONG 1 |
|
||||
|
|
||||
/* Define to 1 if you have the malloc.h header file. */ |
|
||||
#define HAVE_MALLOC_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the memory.h header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */ |
|
||||
/* #undef HAVE_MSG_NOSIGNAL */ |
|
||||
|
|
||||
/* Define to 1 if you have the <netdb.h> header file. */ |
|
||||
/* #undef HAVE_NETDB_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */ |
|
||||
/* #undef HAVE_NETINET_IN_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */ |
|
||||
/* #undef HAVE_NETINET_TCP_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <net/if.h> header file. */ |
|
||||
/* #undef HAVE_NET_IF_H */ |
|
||||
|
|
||||
/* Define to 1 if you have PF_INET6. */ |
|
||||
#define HAVE_PF_INET6 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recv function. */ |
|
||||
#define HAVE_RECV 1 |
|
||||
|
|
||||
/* Define to 1 if you have the recvfrom function. */ |
|
||||
#define HAVE_RECVFROM 1 |
|
||||
|
|
||||
/* Define to 1 if you have the send function. */ |
|
||||
#define HAVE_SEND 1 |
|
||||
|
|
||||
/* Define to 1 if you have the setsockopt function. */ |
|
||||
#define HAVE_SETSOCKOPT 1 |
|
||||
|
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ |
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ |
|
||||
|
|
||||
/* Define to 1 if you have the <signal.h> header file. */ |
|
||||
#define HAVE_SIGNAL_H 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */ |
|
||||
#define HAVE_SIG_ATOMIC_T 1 |
|
||||
|
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */ |
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ |
|
||||
|
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ |
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 |
|
||||
|
|
||||
/* Define to 1 if you have the socket function. */ |
|
||||
#define HAVE_SOCKET 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <socket.h> header file. */ |
|
||||
/* #undef HAVE_SOCKET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */ |
|
||||
#define HAVE_STDBOOL_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcasecmp function. */ |
|
||||
#define HAVE_STRCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strcmpi function. */ |
|
||||
#define HAVE_STRCMPI 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strdup function. */ |
|
||||
#define HAVE_STRDUP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the stricmp function. */ |
|
||||
#define HAVE_STRICMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncasecmp function. */ |
|
||||
#define HAVE_STRNCASECMP 1 |
|
||||
|
|
||||
/* Define to 1 if you have the strncmpi function. */ |
|
||||
/* #undef HAVE_STRNCMPI */ |
|
||||
|
|
||||
/* Define to 1 if you have the strnicmp function. */ |
|
||||
/* #undef HAVE_STRNICMP */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stropts.h> header file. */ |
|
||||
/* #undef HAVE_STROPTS_H */ |
|
||||
|
|
||||
/* Define to 1 if you have struct addrinfo. */ |
|
||||
#define HAVE_STRUCT_ADDRINFO 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct in6_addr. */ |
|
||||
#define HAVE_STRUCT_IN6_ADDR 1 |
|
||||
|
|
||||
/* Define to 1 if you have struct sockaddr_in6. */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1 |
|
||||
|
|
||||
/* if struct sockaddr_storage is defined */ |
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the timeval struct. */ |
|
||||
#define HAVE_STRUCT_TIMEVAL 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */ |
|
||||
/* #undef HAVE_SYS_IOCTL_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */ |
|
||||
#define HAVE_SYS_PARAM_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */ |
|
||||
/* #undef HAVE_SYS_SELECT_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */ |
|
||||
/* #undef HAVE_SYS_SOCKET_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */ |
|
||||
#define HAVE_SYS_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */ |
|
||||
/* #undef HAVE_SYS_UIO_H */ |
|
||||
|
|
||||
/* Define to 1 if you have the <time.h> header file. */ |
|
||||
#define HAVE_TIME_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the windows.h header file. */ |
|
||||
#define HAVE_WINDOWS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the winsock2.h header file. */ |
|
||||
#define HAVE_WINSOCK2_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the winsock.h header file. */ |
|
||||
#define HAVE_WINSOCK_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the writev function. */ |
|
||||
/* #undef HAVE_WRITEV */ |
|
||||
|
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */ |
|
||||
#define HAVE_WS2TCPIP_H 1 |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Define to 1 if you are building a native Windows target. */ |
|
||||
#define NATIVE_WINDOWS 1 |
|
||||
|
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MALLOC_H */ |
|
||||
|
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */ |
|
||||
/* #undef NEED_MEMORY_H */ |
|
||||
|
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_REENTRANT */ |
|
||||
|
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ |
|
||||
/* #undef NEED_THREAD_SAFE */ |
|
||||
|
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ |
|
||||
/* #undef NO_MINUS_C_MINUS_O */ |
|
||||
|
|
||||
/* cpu-machine-OS */ |
|
||||
#define OS "i686-pc-mingw32" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "c-ares" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares"
|
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "c-ares" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "c-ares 1.7.3" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "c-ares" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "1.7.3" |
|
||||
|
|
||||
/* a suitable file/device to read random data from */ |
|
||||
#define RANDOM_FILE "/dev/urandom" |
|
||||
|
|
||||
/* Define to the type of arg 1 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG1 SOCKET |
|
||||
|
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG2 char |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG2_IS_VOID */ |
|
||||
|
|
||||
/* Define to the type of arg 3 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG3 int |
|
||||
|
|
||||
/* Define to the type of arg 4 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ |
|
||||
|
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_ARG6 int |
|
||||
|
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ |
|
||||
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ |
|
||||
|
|
||||
/* Define to the function return type for recvfrom. */ |
|
||||
#define RECVFROM_TYPE_RETV int |
|
||||
|
|
||||
/* Define to the type of arg 1 for recv. */ |
|
||||
#define RECV_TYPE_ARG1 SOCKET |
|
||||
|
|
||||
/* Define to the type of arg 2 for recv. */ |
|
||||
#define RECV_TYPE_ARG2 char * |
|
||||
|
|
||||
/* Define to the type of arg 3 for recv. */ |
|
||||
#define RECV_TYPE_ARG3 int |
|
||||
|
|
||||
/* Define to the type of arg 4 for recv. */ |
|
||||
#define RECV_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for recv. */ |
|
||||
#define RECV_TYPE_RETV int |
|
||||
|
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */ |
|
||||
#define RETSIGTYPE void |
|
||||
|
|
||||
/* Define to the type qualifier of arg 2 for send. */ |
|
||||
#define SEND_QUAL_ARG2 const |
|
||||
|
|
||||
/* Define to the type of arg 1 for send. */ |
|
||||
#define SEND_TYPE_ARG1 SOCKET |
|
||||
|
|
||||
/* Define to the type of arg 2 for send. */ |
|
||||
#define SEND_TYPE_ARG2 char * |
|
||||
|
|
||||
/* Define to the type of arg 3 for send. */ |
|
||||
#define SEND_TYPE_ARG3 int |
|
||||
|
|
||||
/* Define to the type of arg 4 for send. */ |
|
||||
#define SEND_TYPE_ARG4 int |
|
||||
|
|
||||
/* Define to the function return type for send. */ |
|
||||
#define SEND_TYPE_RETV int |
|
||||
|
|
||||
/* The size of `int', as computed by sizeof. */ |
|
||||
#define SIZEOF_INT 4 |
|
||||
|
|
||||
/* The size of `long', as computed by sizeof. */ |
|
||||
#define SIZEOF_LONG 4 |
|
||||
|
|
||||
/* The size of `size_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_SIZE_T 4 |
|
||||
|
|
||||
/* The size of `struct in6_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN6_ADDR 16 |
|
||||
|
|
||||
/* The size of `struct in_addr', as computed by sizeof. */ |
|
||||
#define SIZEOF_STRUCT_IN_ADDR 4 |
|
||||
|
|
||||
/* The size of `time_t', as computed by sizeof. */ |
|
||||
#define SIZEOF_TIME_T 4 |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
|
||||
#define TIME_WITH_SYS_TIME 1 |
|
||||
|
|
||||
/* Define to disable non-blocking sockets. */ |
|
||||
/* #undef USE_BLOCKING_SOCKETS */ |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.7.3" |
|
||||
|
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD |
|
||||
# if defined __BIG_ENDIAN__ |
|
||||
# define WORDS_BIGENDIAN 1 |
|
||||
# endif |
|
||||
#else |
|
||||
# ifndef WORDS_BIGENDIAN |
|
||||
/* # undef WORDS_BIGENDIAN */ |
|
||||
# endif |
|
||||
#endif |
|
||||
|
|
||||
/* Define to 1 if OS is AIX. */ |
|
||||
#ifndef _ALL_SOURCE |
|
||||
/* # undef _ALL_SOURCE */ |
|
||||
#endif |
|
||||
|
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */ |
|
||||
/* #undef _FILE_OFFSET_BITS */ |
|
||||
|
|
||||
/* Define for large files, on AIX-style hosts. */ |
|
||||
/* #undef _LARGE_FILES */ |
|
||||
|
|
||||
/* Define to empty if `const' does not conform to ANSI C. */ |
|
||||
/* #undef const */ |
|
||||
|
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */ |
|
||||
#define in_addr_t unsigned long |
|
||||
|
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */ |
|
||||
/* #undef size_t */ |
|
||||
|
|
||||
/* the signed version of size_t */ |
|
||||
/* #undef ssize_t */ |
|
@ -1,35 +0,0 @@ |
|||||
# *************************************************************************** |
|
||||
# * Project: c-ares |
|
||||
# * |
|
||||
# *************************************************************************** |
|
||||
# awk script which fetches c-ares version number and string from input |
|
||||
# file and writes them to STDOUT. Here you can get an awk version for Win32: |
|
||||
# http://www.gknw.net/development/prgtools/awk-20070501.zip |
|
||||
# |
|
||||
BEGIN { |
|
||||
if (match (ARGV[1], /ares_version.h/)) { |
|
||||
while ((getline < ARGV[1]) > 0) { |
|
||||
if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/)) { |
|
||||
libcares_copyright_str = substr($0, 25, length($0)-25); |
|
||||
} |
|
||||
else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/)) { |
|
||||
libcares_ver_str = substr($3, 2, length($3)-2); |
|
||||
} |
|
||||
else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/)) { |
|
||||
libcares_ver_major = substr($3, 1, length($3)); |
|
||||
} |
|
||||
else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/)) { |
|
||||
libcares_ver_minor = substr($3, 1, length($3)); |
|
||||
} |
|
||||
else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/)) { |
|
||||
libcares_ver_patch = substr($3, 1, length($3)); |
|
||||
} |
|
||||
} |
|
||||
libcares_ver = libcares_ver_major "," libcares_ver_minor "," libcares_ver_patch; |
|
||||
print "LIBCARES_VERSION = " libcares_ver ""; |
|
||||
print "LIBCARES_VERSION_STR = " libcares_ver_str ""; |
|
||||
print "LIBCARES_COPYRIGHT_STR = " libcares_copyright_str ""; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
@ -1,450 +0,0 @@ |
|||||
|
|
||||
/*
|
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") |
|
||||
* Copyright (c) 1996,1999 by Internet Software Consortium. |
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software for any |
|
||||
* purpose with or without fee is hereby granted, provided that the above |
|
||||
* copyright notice and this permission notice appear in all copies. |
|
||||
* |
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES |
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR |
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <ctype.h> |
|
||||
#include <errno.h> |
|
||||
#include <stdio.h> |
|
||||
#include <string.h> |
|
||||
#include <stdlib.h> |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_ipv6.h" |
|
||||
#include "inet_net_pton.h" |
|
||||
|
|
||||
|
|
||||
const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; |
|
||||
|
|
||||
|
|
||||
#if !defined(HAVE_INET_NET_PTON) || !defined(HAVE_INET_NET_PTON_IPV6) |
|
||||
|
|
||||
/*
|
|
||||
* static int |
|
||||
* inet_net_pton_ipv4(src, dst, size) |
|
||||
* convert IPv4 network number from presentation to network format. |
|
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR. |
|
||||
* "size" is in bytes and describes "dst". |
|
||||
* return: |
|
||||
* number of bits, either imputed classfully or specified with /CIDR, |
|
||||
* or -1 if some failure occurred (check errno). ENOENT means it was |
|
||||
* not an IPv4 network specification. |
|
||||
* note: |
|
||||
* network byte order assumed. this means 192.5.5.240/28 has |
|
||||
* 0b11110000 in its fourth octet. |
|
||||
* note: |
|
||||
* On Windows we store the error in the thread errno, not |
|
||||
* in the winsock error code. This is to avoid loosing the |
|
||||
* actual last winsock error. So use macro ERRNO to fetch the |
|
||||
* errno this funtion sets when returning (-1), not SOCKERRNO. |
|
||||
* author: |
|
||||
* Paul Vixie (ISC), June 1996 |
|
||||
*/ |
|
||||
static int |
|
||||
inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) |
|
||||
{ |
|
||||
static const char xdigits[] = "0123456789abcdef"; |
|
||||
static const char digits[] = "0123456789"; |
|
||||
int n, ch, tmp = 0, dirty, bits; |
|
||||
const unsigned char *odst = dst; |
|
||||
|
|
||||
ch = *src++; |
|
||||
if (ch == '0' && (src[0] == 'x' || src[0] == 'X') |
|
||||
&& ISXDIGIT(src[1])) { |
|
||||
/* Hexadecimal: Eat nybble string. */ |
|
||||
if (!size) |
|
||||
goto emsgsize; |
|
||||
dirty = 0; |
|
||||
src++; /* skip x or X. */ |
|
||||
while ((ch = *src++) != '\0' && ISXDIGIT(ch)) { |
|
||||
if (ISUPPER(ch)) |
|
||||
ch = tolower(ch); |
|
||||
n = (int)(strchr(xdigits, ch) - xdigits); |
|
||||
if (dirty == 0) |
|
||||
tmp = n; |
|
||||
else |
|
||||
tmp = (tmp << 4) | n; |
|
||||
if (++dirty == 2) { |
|
||||
if (!size--) |
|
||||
goto emsgsize; |
|
||||
*dst++ = (unsigned char) tmp; |
|
||||
dirty = 0; |
|
||||
} |
|
||||
} |
|
||||
if (dirty) { /* Odd trailing nybble? */ |
|
||||
if (!size--) |
|
||||
goto emsgsize; |
|
||||
*dst++ = (unsigned char) (tmp << 4); |
|
||||
} |
|
||||
} else if (ISDIGIT(ch)) { |
|
||||
/* Decimal: eat dotted digit string. */ |
|
||||
for (;;) { |
|
||||
tmp = 0; |
|
||||
do { |
|
||||
n = (int)(strchr(digits, ch) - digits); |
|
||||
tmp *= 10; |
|
||||
tmp += n; |
|
||||
if (tmp > 255) |
|
||||
goto enoent; |
|
||||
} while ((ch = *src++) != '\0' && |
|
||||
ISDIGIT(ch)); |
|
||||
if (!size--) |
|
||||
goto emsgsize; |
|
||||
*dst++ = (unsigned char) tmp; |
|
||||
if (ch == '\0' || ch == '/') |
|
||||
break; |
|
||||
if (ch != '.') |
|
||||
goto enoent; |
|
||||
ch = *src++; |
|
||||
if (!ISDIGIT(ch)) |
|
||||
goto enoent; |
|
||||
} |
|
||||
} else |
|
||||
goto enoent; |
|
||||
|
|
||||
bits = -1; |
|
||||
if (ch == '/' && |
|
||||
ISDIGIT(src[0]) && dst > odst) { |
|
||||
/* CIDR width specifier. Nothing can follow it. */ |
|
||||
ch = *src++; /* Skip over the /. */ |
|
||||
bits = 0; |
|
||||
do { |
|
||||
n = (int)(strchr(digits, ch) - digits); |
|
||||
bits *= 10; |
|
||||
bits += n; |
|
||||
} while ((ch = *src++) != '\0' && ISDIGIT(ch)); |
|
||||
if (ch != '\0') |
|
||||
goto enoent; |
|
||||
if (bits > 32) |
|
||||
goto emsgsize; |
|
||||
} |
|
||||
|
|
||||
/* Firey death and destruction unless we prefetched EOS. */ |
|
||||
if (ch != '\0') |
|
||||
goto enoent; |
|
||||
|
|
||||
/* If nothing was written to the destination, we found no address. */ |
|
||||
if (dst == odst) |
|
||||
goto enoent; |
|
||||
/* If no CIDR spec was given, infer width from net class. */ |
|
||||
if (bits == -1) { |
|
||||
if (*odst >= 240) /* Class E */ |
|
||||
bits = 32; |
|
||||
else if (*odst >= 224) /* Class D */ |
|
||||
bits = 8; |
|
||||
else if (*odst >= 192) /* Class C */ |
|
||||
bits = 24; |
|
||||
else if (*odst >= 128) /* Class B */ |
|
||||
bits = 16; |
|
||||
else /* Class A */ |
|
||||
bits = 8; |
|
||||
/* If imputed mask is narrower than specified octets, widen. */ |
|
||||
if (bits < ((dst - odst) * 8)) |
|
||||
bits = (int)(dst - odst) * 8; |
|
||||
/*
|
|
||||
* If there are no additional bits specified for a class D |
|
||||
* address adjust bits to 4. |
|
||||
*/ |
|
||||
if (bits == 8 && *odst == 224) |
|
||||
bits = 4; |
|
||||
} |
|
||||
/* Extend network to cover the actual mask. */ |
|
||||
while (bits > ((dst - odst) * 8)) { |
|
||||
if (!size--) |
|
||||
goto emsgsize; |
|
||||
*dst++ = '\0'; |
|
||||
} |
|
||||
return (bits); |
|
||||
|
|
||||
enoent: |
|
||||
SET_ERRNO(ENOENT); |
|
||||
return (-1); |
|
||||
|
|
||||
emsgsize: |
|
||||
SET_ERRNO(EMSGSIZE); |
|
||||
return (-1); |
|
||||
} |
|
||||
|
|
||||
static int |
|
||||
getbits(const char *src, int *bitsp) |
|
||||
{ |
|
||||
static const char digits[] = "0123456789"; |
|
||||
int n; |
|
||||
int val; |
|
||||
char ch; |
|
||||
|
|
||||
val = 0; |
|
||||
n = 0; |
|
||||
while ((ch = *src++) != '\0') { |
|
||||
const char *pch; |
|
||||
|
|
||||
pch = strchr(digits, ch); |
|
||||
if (pch != NULL) { |
|
||||
if (n++ != 0 && val == 0) /* no leading zeros */ |
|
||||
return (0); |
|
||||
val *= 10; |
|
||||
val += (pch - digits); |
|
||||
if (val > 128) /* range */ |
|
||||
return (0); |
|
||||
continue; |
|
||||
} |
|
||||
return (0); |
|
||||
} |
|
||||
if (n == 0) |
|
||||
return (0); |
|
||||
*bitsp = val; |
|
||||
return (1); |
|
||||
} |
|
||||
|
|
||||
static int |
|
||||
getv4(const char *src, unsigned char *dst, int *bitsp) |
|
||||
{ |
|
||||
static const char digits[] = "0123456789"; |
|
||||
unsigned char *odst = dst; |
|
||||
int n; |
|
||||
unsigned int val; |
|
||||
char ch; |
|
||||
|
|
||||
val = 0; |
|
||||
n = 0; |
|
||||
while ((ch = *src++) != '\0') { |
|
||||
const char *pch; |
|
||||
|
|
||||
pch = strchr(digits, ch); |
|
||||
if (pch != NULL) { |
|
||||
if (n++ != 0 && val == 0) /* no leading zeros */ |
|
||||
return (0); |
|
||||
val *= 10; |
|
||||
val += (pch - digits); |
|
||||
if (val > 255) /* range */ |
|
||||
return (0); |
|
||||
continue; |
|
||||
} |
|
||||
if (ch == '.' || ch == '/') { |
|
||||
if (dst - odst > 3) /* too many octets? */ |
|
||||
return (0); |
|
||||
*dst++ = (unsigned char)val; |
|
||||
if (ch == '/') |
|
||||
return (getbits(src, bitsp)); |
|
||||
val = 0; |
|
||||
n = 0; |
|
||||
continue; |
|
||||
} |
|
||||
return (0); |
|
||||
} |
|
||||
if (n == 0) |
|
||||
return (0); |
|
||||
if (dst - odst > 3) /* too many octets? */ |
|
||||
return (0); |
|
||||
*dst++ = (unsigned char)val; |
|
||||
return (1); |
|
||||
} |
|
||||
|
|
||||
static int |
|
||||
inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) |
|
||||
{ |
|
||||
static const char xdigits_l[] = "0123456789abcdef", |
|
||||
xdigits_u[] = "0123456789ABCDEF"; |
|
||||
unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; |
|
||||
const char *xdigits, *curtok; |
|
||||
int ch, saw_xdigit; |
|
||||
unsigned int val; |
|
||||
int digits; |
|
||||
int bits; |
|
||||
size_t bytes; |
|
||||
int words; |
|
||||
int ipv4; |
|
||||
|
|
||||
memset((tp = tmp), '\0', NS_IN6ADDRSZ); |
|
||||
endp = tp + NS_IN6ADDRSZ; |
|
||||
colonp = NULL; |
|
||||
/* Leading :: requires some special handling. */ |
|
||||
if (*src == ':') |
|
||||
if (*++src != ':') |
|
||||
goto enoent; |
|
||||
curtok = src; |
|
||||
saw_xdigit = 0; |
|
||||
val = 0; |
|
||||
digits = 0; |
|
||||
bits = -1; |
|
||||
ipv4 = 0; |
|
||||
while ((ch = *src++) != '\0') { |
|
||||
const char *pch; |
|
||||
|
|
||||
if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) |
|
||||
pch = strchr((xdigits = xdigits_u), ch); |
|
||||
if (pch != NULL) { |
|
||||
val <<= 4; |
|
||||
val |= (pch - xdigits); |
|
||||
if (++digits > 4) |
|
||||
goto enoent; |
|
||||
saw_xdigit = 1; |
|
||||
continue; |
|
||||
} |
|
||||
if (ch == ':') { |
|
||||
curtok = src; |
|
||||
if (!saw_xdigit) { |
|
||||
if (colonp) |
|
||||
goto enoent; |
|
||||
colonp = tp; |
|
||||
continue; |
|
||||
} else if (*src == '\0') |
|
||||
goto enoent; |
|
||||
if (tp + NS_INT16SZ > endp) |
|
||||
return (0); |
|
||||
*tp++ = (unsigned char)((val >> 8) & 0xff); |
|
||||
*tp++ = (unsigned char)(val & 0xff); |
|
||||
saw_xdigit = 0; |
|
||||
digits = 0; |
|
||||
val = 0; |
|
||||
continue; |
|
||||
} |
|
||||
if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && |
|
||||
getv4(curtok, tp, &bits) > 0) { |
|
||||
tp += NS_INADDRSZ; |
|
||||
saw_xdigit = 0; |
|
||||
ipv4 = 1; |
|
||||
break; /* '\0' was seen by inet_pton4(). */ |
|
||||
} |
|
||||
if (ch == '/' && getbits(src, &bits) > 0) |
|
||||
break; |
|
||||
goto enoent; |
|
||||
} |
|
||||
if (saw_xdigit) { |
|
||||
if (tp + NS_INT16SZ > endp) |
|
||||
goto enoent; |
|
||||
*tp++ = (unsigned char)((val >> 8) & 0xff); |
|
||||
*tp++ = (unsigned char)(val & 0xff); |
|
||||
} |
|
||||
if (bits == -1) |
|
||||
bits = 128; |
|
||||
|
|
||||
words = (bits + 15) / 16; |
|
||||
if (words < 2) |
|
||||
words = 2; |
|
||||
if (ipv4) |
|
||||
words = 8; |
|
||||
endp = tmp + 2 * words; |
|
||||
|
|
||||
if (colonp != NULL) { |
|
||||
/*
|
|
||||
* Since some memmove()'s erroneously fail to handle |
|
||||
* overlapping regions, we'll do the shift by hand. |
|
||||
*/ |
|
||||
const ssize_t n = tp - colonp; |
|
||||
ssize_t i; |
|
||||
|
|
||||
if (tp == endp) |
|
||||
goto enoent; |
|
||||
for (i = 1; i <= n; i++) { |
|
||||
*(endp - i) = *(colonp + n - i); |
|
||||
*(colonp + n - i) = 0; |
|
||||
} |
|
||||
tp = endp; |
|
||||
} |
|
||||
if (tp != endp) |
|
||||
goto enoent; |
|
||||
|
|
||||
bytes = (bits + 7) / 8; |
|
||||
if (bytes > size) |
|
||||
goto emsgsize; |
|
||||
memcpy(dst, tmp, bytes); |
|
||||
return (bits); |
|
||||
|
|
||||
enoent: |
|
||||
SET_ERRNO(ENOENT); |
|
||||
return (-1); |
|
||||
|
|
||||
emsgsize: |
|
||||
SET_ERRNO(EMSGSIZE); |
|
||||
return (-1); |
|
||||
} |
|
||||
|
|
||||
/*
|
|
||||
* int |
|
||||
* inet_net_pton(af, src, dst, size) |
|
||||
* convert network number from presentation to network format. |
|
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR. |
|
||||
* "size" is in bytes and describes "dst". |
|
||||
* return: |
|
||||
* 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 loosing the |
|
||||
* actual last winsock error. So use macro ERRNO to fetch the |
|
||||
* errno this funtion 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) |
|
||||
{ |
|
||||
switch (af) { |
|
||||
case AF_INET: |
|
||||
return (inet_net_pton_ipv4(src, dst, size)); |
|
||||
case AF_INET6: |
|
||||
return (inet_net_pton_ipv6(src, dst, size)); |
|
||||
default: |
|
||||
SET_ERRNO(EAFNOSUPPORT); |
|
||||
return (-1); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#endif |
|
||||
|
|
||||
#ifndef HAVE_INET_PTON |
|
||||
int ares_inet_pton(int af, const char *src, void *dst) |
|
||||
{ |
|
||||
int result; |
|
||||
size_t size; |
|
||||
|
|
||||
if (af == AF_INET) |
|
||||
size = sizeof(struct in_addr); |
|
||||
else if (af == AF_INET6) |
|
||||
size = sizeof(struct ares_in6_addr); |
|
||||
else |
|
||||
{ |
|
||||
SET_ERRNO(EAFNOSUPPORT); |
|
||||
return -1; |
|
||||
} |
|
||||
result = ares_inet_net_pton(af, src, dst, size); |
|
||||
if (result == -1 && ERRNO == ENOENT) |
|
||||
return 0; |
|
||||
return (result > -1 ? 1 : -1); |
|
||||
} |
|
||||
#endif |
|
@ -1,31 +0,0 @@ |
|||||
#ifndef __ARES_INET_NET_PTON_H |
|
||||
#define __ARES_INET_NET_PTON_H |
|
||||
|
|
||||
|
|
||||
/* Copyright (C) 2005 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. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef HAVE_INET_PTON |
|
||||
#define ares_inet_pton(x,y,z) inet_pton(x,y,z) |
|
||||
#else |
|
||||
int ares_inet_pton(int af, const char *src, void *dst); |
|
||||
#endif |
|
||||
#if defined(HAVE_INET_NET_PTON) && defined(HAVE_INET_NET_PTON_IPV6) |
|
||||
#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 /* __ARES_INET_NET_PTON_H */ |
|
@ -1,232 +0,0 @@ |
|||||
|
|
||||
/* Copyright (c) 1996 by Internet Software Consortium.
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software for any |
|
||||
* purpose with or without fee is hereby granted, provided that the above |
|
||||
* copyright notice and this permission notice appear in all copies. |
|
||||
* |
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS |
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE |
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS |
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
|
||||
* SOFTWARE. |
|
||||
*/ |
|
||||
|
|
||||
#include "ares_setup.h" |
|
||||
|
|
||||
#ifdef HAVE_SYS_SOCKET_H |
|
||||
# include <sys/socket.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_NETINET_IN_H |
|
||||
# include <netinet/in.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_INET_H |
|
||||
# include <arpa/inet.h> |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_H |
|
||||
# include <arpa/nameser.h> |
|
||||
#else |
|
||||
# include "nameser.h" |
|
||||
#endif |
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
# include <arpa/nameser_compat.h> |
|
||||
#endif |
|
||||
|
|
||||
#include <ctype.h> |
|
||||
#include <errno.h> |
|
||||
#include <stdio.h> |
|
||||
#include <string.h> |
|
||||
#include <stdlib.h> |
|
||||
|
|
||||
#include "ares.h" |
|
||||
#include "ares_ipv6.h" |
|
||||
#include "inet_ntop.h" |
|
||||
|
|
||||
|
|
||||
#ifndef HAVE_INET_NTOP |
|
||||
|
|
||||
#ifdef SPRINTF_CHAR |
|
||||
# define SPRINTF(x) strlen(sprintf/**/x) |
|
||||
#else |
|
||||
# define SPRINTF(x) ((size_t)sprintf 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. |
|
||||
*/ |
|
||||
|
|
||||
static const char *inet_ntop4(const unsigned char *src, char *dst, size_t size); |
|
||||
static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size); |
|
||||
|
|
||||
/* char *
|
|
||||
* inet_ntop(af, src, dst, 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 loosing the |
|
||||
* actual last winsock error. So use macro ERRNO to fetch the |
|
||||
* errno this funtion sets when returning NULL, not SOCKERRNO. |
|
||||
* author: |
|
||||
* Paul Vixie, 1996. |
|
||||
*/ |
|
||||
const char * |
|
||||
ares_inet_ntop(int af, const void *src, char *dst, size_t size) |
|
||||
{ |
|
||||
switch (af) |
|
||||
{ |
|
||||
case AF_INET: |
|
||||
return (inet_ntop4(src, dst, size)); |
|
||||
case AF_INET6: |
|
||||
return (inet_ntop6(src, dst, size)); |
|
||||
default: |
|
||||
SET_ERRNO(EAFNOSUPPORT); |
|
||||
return (NULL); |
|
||||
} |
|
||||
/* NOTREACHED */ |
|
||||
} |
|
||||
|
|
||||
/* const char *
|
|
||||
* inet_ntop4(src, dst, size) |
|
||||
* format an IPv4 address, more or less like inet_ntoa() |
|
||||
* return: |
|
||||
* `dst' (as a const) |
|
||||
* notes: |
|
||||
* (1) uses no statics |
|
||||
* (2) takes a unsigned char* not an in_addr as input |
|
||||
* author: |
|
||||
* Paul Vixie, 1996. |
|
||||
*/ |
|
||||
static const char * |
|
||||
inet_ntop4(const unsigned char *src, char *dst, size_t size) |
|
||||
{ |
|
||||
static const char fmt[] = "%u.%u.%u.%u"; |
|
||||
char tmp[sizeof "255.255.255.255"]; |
|
||||
|
|
||||
if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) |
|
||||
{ |
|
||||
SET_ERRNO(ENOSPC); |
|
||||
return (NULL); |
|
||||
} |
|
||||
strcpy(dst, tmp); |
|
||||
return (dst); |
|
||||
} |
|
||||
|
|
||||
/* const char *
|
|
||||
* inet_ntop6(src, dst, size) |
|
||||
* convert IPv6 binary address into presentation (printable) format |
|
||||
* author: |
|
||||
* Paul Vixie, 1996. |
|
||||
*/ |
|
||||
static const char * |
|
||||
inet_ntop6(const unsigned char *src, char *dst, size_t size) |
|
||||
{ |
|
||||
/*
|
|
||||
* Note that int32_t and int16_t need only be "at least" large enough |
|
||||
* to contain a value of the specified size. On some systems, like |
|
||||
* Crays, there is no such thing as an integer variable with 16 bits. |
|
||||
* Keep this in mind if you think this function should have been coded |
|
||||
* to use pointer overlays. All the world's not a VAX. |
|
||||
*/ |
|
||||
char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; |
|
||||
char *tp; |
|
||||
struct { |
|
||||
long base; |
|
||||
long len; |
|
||||
} best, cur; |
|
||||
unsigned long words[NS_IN6ADDRSZ / NS_INT16SZ]; |
|
||||
int i; |
|
||||
|
|
||||
/*
|
|
||||
* Preprocess: |
|
||||
* Copy the input (bytewise) array into a wordwise array. |
|
||||
* Find the longest run of 0x00's in src[] for :: shorthanding. |
|
||||
*/ |
|
||||
memset(words, '\0', sizeof(words)); |
|
||||
for (i = 0; i < NS_IN6ADDRSZ; i++) |
|
||||
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); |
|
||||
|
|
||||
best.base = -1; |
|
||||
cur.base = -1; |
|
||||
best.len = 0; |
|
||||
cur.len = 0; |
|
||||
|
|
||||
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) |
|
||||
{ |
|
||||
if (words[i] == 0) |
|
||||
{ |
|
||||
if (cur.base == -1) |
|
||||
cur.base = i, cur.len = 1; |
|
||||
else |
|
||||
cur.len++; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
if (cur.base != -1) |
|
||||
{ |
|
||||
if (best.base == -1 || cur.len > best.len) |
|
||||
best = cur; |
|
||||
cur.base = -1; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
if (cur.base != -1) |
|
||||
{ |
|
||||
if (best.base == -1 || cur.len > best.len) |
|
||||
best = cur; |
|
||||
} |
|
||||
if (best.base != -1 && best.len < 2) |
|
||||
best.base = -1; |
|
||||
|
|
||||
/*
|
|
||||
* Format the result. |
|
||||
*/ |
|
||||
tp = tmp; |
|
||||
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) |
|
||||
{ |
|
||||
/* Are we inside the best run of 0x00's? */ |
|
||||
if (best.base != -1 && i >= best.base && |
|
||||
i < (best.base + best.len)) |
|
||||
{ |
|
||||
if (i == best.base) |
|
||||
*tp++ = ':'; |
|
||||
continue; |
|
||||
} |
|
||||
/* Are we following an initial run of 0x00s or any real hex? */ |
|
||||
if (i != 0) |
|
||||
*tp++ = ':'; |
|
||||
/* Is this address an encapsulated IPv4? */ |
|
||||
if (i == 6 && best.base == 0 && |
|
||||
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) |
|
||||
{ |
|
||||
if (!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp))) |
|
||||
return (NULL); |
|
||||
tp += strlen(tp); |
|
||||
break; |
|
||||
} |
|
||||
tp += SPRINTF((tp, "%lx", words[i])); |
|
||||
} |
|
||||
|
|
||||
/* Was it a trailing run of 0x00's? */ |
|
||||
if (best.base != -1 && (best.base + best.len) == (NS_IN6ADDRSZ / NS_INT16SZ)) |
|
||||
*tp++ = ':'; |
|
||||
*tp++ = '\0'; |
|
||||
|
|
||||
/*
|
|
||||
* Check for overflow, copy, and we're done. |
|
||||
*/ |
|
||||
if ((size_t)(tp - tmp) > size) |
|
||||
{ |
|
||||
SET_ERRNO(ENOSPC); |
|
||||
return (NULL); |
|
||||
} |
|
||||
strcpy(dst, tmp); |
|
||||
return (dst); |
|
||||
} |
|
||||
#endif |
|
||||
|
|
@ -1,26 +0,0 @@ |
|||||
#ifndef __ARES_INET_NTOP_H |
|
||||
#define __ARES_INET_NTOP_H |
|
||||
|
|
||||
|
|
||||
/* Copyright (C) 2005 by Dominick Meglio
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this |
|
||||
* software and its documentation for any purpose and without |
|
||||
* fee is hereby granted, provided that the above copyright |
|
||||
* notice appear in all copies and that both that copyright |
|
||||
* notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in |
|
||||
* advertising or publicity pertaining to distribution of the |
|
||||
* software without specific, written prior permission. |
|
||||
* M.I.T. makes no representations about the suitability of |
|
||||
* this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef HAVE_INET_NTOP |
|
||||
#define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z) |
|
||||
#else |
|
||||
const char *ares_inet_ntop(int af, const void *src, char *dst, size_t size); |
|
||||
#endif |
|
||||
|
|
||||
#endif /* __ARES_INET_NTOP_H */ |
|
@ -1,193 +0,0 @@ |
|||||
|
|
||||
#ifndef ARES_NAMESER_H |
|
||||
#define ARES_NAMESER_H |
|
||||
|
|
||||
/* header file provided by liren@vivisimo.com */ |
|
||||
|
|
||||
#ifndef HAVE_ARPA_NAMESER_H |
|
||||
|
|
||||
#define NS_PACKETSZ 512 /* maximum packet size */ |
|
||||
#define NS_MAXDNAME 256 /* maximum domain name */ |
|
||||
#define NS_MAXCDNAME 255 /* maximum compressed domain name */ |
|
||||
#define NS_MAXLABEL 63 |
|
||||
#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ |
|
||||
#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ |
|
||||
#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ |
|
||||
#define NS_INT16SZ 2 |
|
||||
#define NS_INADDRSZ 4 |
|
||||
#define NS_IN6ADDRSZ 16 |
|
||||
#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ |
|
||||
#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ |
|
||||
|
|
||||
typedef enum __ns_class { |
|
||||
ns_c_invalid = 0, /* Cookie. */ |
|
||||
ns_c_in = 1, /* Internet. */ |
|
||||
ns_c_2 = 2, /* unallocated/unsupported. */ |
|
||||
ns_c_chaos = 3, /* MIT Chaos-net. */ |
|
||||
ns_c_hs = 4, /* MIT Hesiod. */ |
|
||||
/* Query class values which do not appear in resource records */ |
|
||||
ns_c_none = 254, /* for prereq. sections in update requests */ |
|
||||
ns_c_any = 255, /* Wildcard match. */ |
|
||||
ns_c_max = 65536 |
|
||||
} ns_class; |
|
||||
|
|
||||
typedef enum __ns_type { |
|
||||
ns_t_invalid = 0, /* Cookie. */ |
|
||||
ns_t_a = 1, /* Host address. */ |
|
||||
ns_t_ns = 2, /* Authoritative server. */ |
|
||||
ns_t_md = 3, /* Mail destination. */ |
|
||||
ns_t_mf = 4, /* Mail forwarder. */ |
|
||||
ns_t_cname = 5, /* Canonical name. */ |
|
||||
ns_t_soa = 6, /* Start of authority zone. */ |
|
||||
ns_t_mb = 7, /* Mailbox domain name. */ |
|
||||
ns_t_mg = 8, /* Mail group member. */ |
|
||||
ns_t_mr = 9, /* Mail rename name. */ |
|
||||
ns_t_null = 10, /* Null resource record. */ |
|
||||
ns_t_wks = 11, /* Well known service. */ |
|
||||
ns_t_ptr = 12, /* Domain name pointer. */ |
|
||||
ns_t_hinfo = 13, /* Host information. */ |
|
||||
ns_t_minfo = 14, /* Mailbox information. */ |
|
||||
ns_t_mx = 15, /* Mail routing information. */ |
|
||||
ns_t_txt = 16, /* Text strings. */ |
|
||||
ns_t_rp = 17, /* Responsible person. */ |
|
||||
ns_t_afsdb = 18, /* AFS cell database. */ |
|
||||
ns_t_x25 = 19, /* X_25 calling address. */ |
|
||||
ns_t_isdn = 20, /* ISDN calling address. */ |
|
||||
ns_t_rt = 21, /* Router. */ |
|
||||
ns_t_nsap = 22, /* NSAP address. */ |
|
||||
ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ |
|
||||
ns_t_sig = 24, /* Security signature. */ |
|
||||
ns_t_key = 25, /* Security key. */ |
|
||||
ns_t_px = 26, /* X.400 mail mapping. */ |
|
||||
ns_t_gpos = 27, /* Geographical position (withdrawn). */ |
|
||||
ns_t_aaaa = 28, /* Ip6 Address. */ |
|
||||
ns_t_loc = 29, /* Location Information. */ |
|
||||
ns_t_nxt = 30, /* Next domain (security). */ |
|
||||
ns_t_eid = 31, /* Endpoint identifier. */ |
|
||||
ns_t_nimloc = 32, /* Nimrod Locator. */ |
|
||||
ns_t_srv = 33, /* Server Selection. */ |
|
||||
ns_t_atma = 34, /* ATM Address */ |
|
||||
ns_t_naptr = 35, /* Naming Authority PoinTeR */ |
|
||||
ns_t_kx = 36, /* Key Exchange */ |
|
||||
ns_t_cert = 37, /* Certification record */ |
|
||||
ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ |
|
||||
ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ |
|
||||
ns_t_sink = 40, /* Kitchen sink (experimentatl) */ |
|
||||
ns_t_opt = 41, /* EDNS0 option (meta-RR) */ |
|
||||
ns_t_apl = 42, /* Address prefix list (RFC3123) */ |
|
||||
ns_t_tkey = 249, /* Transaction key */ |
|
||||
ns_t_tsig = 250, /* Transaction signature. */ |
|
||||
ns_t_ixfr = 251, /* Incremental zone transfer. */ |
|
||||
ns_t_axfr = 252, /* Transfer zone of authority. */ |
|
||||
ns_t_mailb = 253, /* Transfer mailbox records. */ |
|
||||
ns_t_maila = 254, /* Transfer mail agent records. */ |
|
||||
ns_t_any = 255, /* Wildcard match. */ |
|
||||
ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ |
|
||||
ns_t_max = 65536 |
|
||||
} ns_type; |
|
||||
|
|
||||
typedef enum __ns_opcode { |
|
||||
ns_o_query = 0, /* Standard query. */ |
|
||||
ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ |
|
||||
ns_o_status = 2, /* Name server status query (unsupported). */ |
|
||||
/* Opcode 3 is undefined/reserved. */ |
|
||||
ns_o_notify = 4, /* Zone change notification. */ |
|
||||
ns_o_update = 5, /* Zone update message. */ |
|
||||
ns_o_max = 6 |
|
||||
} ns_opcode; |
|
||||
|
|
||||
typedef enum __ns_rcode { |
|
||||
ns_r_noerror = 0, /* No error occurred. */ |
|
||||
ns_r_formerr = 1, /* Format error. */ |
|
||||
ns_r_servfail = 2, /* Server failure. */ |
|
||||
ns_r_nxdomain = 3, /* Name error. */ |
|
||||
ns_r_notimpl = 4, /* Unimplemented. */ |
|
||||
ns_r_refused = 5, /* Operation refused. */ |
|
||||
/* these are for BIND_UPDATE */ |
|
||||
ns_r_yxdomain = 6, /* Name exists */ |
|
||||
ns_r_yxrrset = 7, /* RRset exists */ |
|
||||
ns_r_nxrrset = 8, /* RRset does not exist */ |
|
||||
ns_r_notauth = 9, /* Not authoritative for zone */ |
|
||||
ns_r_notzone = 10, /* Zone of record different from zone section */ |
|
||||
ns_r_max = 11, |
|
||||
/* The following are TSIG extended errors */ |
|
||||
ns_r_badsig = 16, |
|
||||
ns_r_badkey = 17, |
|
||||
ns_r_badtime = 18 |
|
||||
} ns_rcode; |
|
||||
|
|
||||
#endif /* HAVE_ARPA_NAMESER_H */ |
|
||||
|
|
||||
#ifndef HAVE_ARPA_NAMESER_COMPAT_H |
|
||||
|
|
||||
#define PACKETSZ NS_PACKETSZ |
|
||||
#define MAXDNAME NS_MAXDNAME |
|
||||
#define MAXCDNAME NS_MAXCDNAME |
|
||||
#define MAXLABEL NS_MAXLABEL |
|
||||
#define HFIXEDSZ NS_HFIXEDSZ |
|
||||
#define QFIXEDSZ NS_QFIXEDSZ |
|
||||
#define RRFIXEDSZ NS_RRFIXEDSZ |
|
||||
#define INDIR_MASK NS_CMPRSFLGS |
|
||||
#define NAMESERVER_PORT NS_DEFAULTPORT |
|
||||
|
|
||||
#define QUERY ns_o_query |
|
||||
|
|
||||
#define SERVFAIL ns_r_servfail |
|
||||
#define NOTIMP ns_r_notimpl |
|
||||
#define REFUSED ns_r_refused |
|
||||
#undef NOERROR /* it seems this is already defined in winerror.h */ |
|
||||
#define NOERROR ns_r_noerror |
|
||||
#define FORMERR ns_r_formerr |
|
||||
#define NXDOMAIN ns_r_nxdomain |
|
||||
|
|
||||
#define C_IN ns_c_in |
|
||||
#define C_CHAOS ns_c_chaos |
|
||||
#define C_HS ns_c_hs |
|
||||
#define C_NONE ns_c_none |
|
||||
#define C_ANY ns_c_any |
|
||||
|
|
||||
#define T_A ns_t_a |
|
||||
#define T_NS ns_t_ns |
|
||||
#define T_MD ns_t_md |
|
||||
#define T_MF ns_t_mf |
|
||||
#define T_CNAME ns_t_cname |
|
||||
#define T_SOA ns_t_soa |
|
||||
#define T_MB ns_t_mb |
|
||||
#define T_MG ns_t_mg |
|
||||
#define T_MR ns_t_mr |
|
||||
#define T_NULL ns_t_null |
|
||||
#define T_WKS ns_t_wks |
|
||||
#define T_PTR ns_t_ptr |
|
||||
#define T_HINFO ns_t_hinfo |
|
||||
#define T_MINFO ns_t_minfo |
|
||||
#define T_MX ns_t_mx |
|
||||
#define T_TXT ns_t_txt |
|
||||
#define T_RP ns_t_rp |
|
||||
#define T_AFSDB ns_t_afsdb |
|
||||
#define T_X25 ns_t_x25 |
|
||||
#define T_ISDN ns_t_isdn |
|
||||
#define T_RT ns_t_rt |
|
||||
#define T_NSAP ns_t_nsap |
|
||||
#define T_NSAP_PTR ns_t_nsap_ptr |
|
||||
#define T_SIG ns_t_sig |
|
||||
#define T_KEY ns_t_key |
|
||||
#define T_PX ns_t_px |
|
||||
#define T_GPOS ns_t_gpos |
|
||||
#define T_AAAA ns_t_aaaa |
|
||||
#define T_LOC ns_t_loc |
|
||||
#define T_NXT ns_t_nxt |
|
||||
#define T_EID ns_t_eid |
|
||||
#define T_NIMLOC ns_t_nimloc |
|
||||
#define T_SRV ns_t_srv |
|
||||
#define T_ATMA ns_t_atma |
|
||||
#define T_NAPTR ns_t_naptr |
|
||||
#define T_TSIG ns_t_tsig |
|
||||
#define T_IXFR ns_t_ixfr |
|
||||
#define T_AXFR ns_t_axfr |
|
||||
#define T_MAILB ns_t_mailb |
|
||||
#define T_MAILA ns_t_maila |
|
||||
#define T_ANY ns_t_any |
|
||||
|
|
||||
#endif /* HAVE_ARPA_NAMESER_COMPAT_H */ |
|
||||
|
|
||||
#endif /* ARES_NAMESER_H */ |
|
@ -1,488 +0,0 @@ |
|||||
#ifndef __SETUP_ONCE_H |
|
||||
#define __SETUP_ONCE_H |
|
||||
|
|
||||
|
|
||||
/* Copyright (C) 2004 - 2010 by Daniel Stenberg et al
|
|
||||
* |
|
||||
* Permission to use, copy, modify, and distribute this software and its |
|
||||
* documentation for any purpose and without fee is hereby granted, provided |
|
||||
* that the above copyright notice appear in all copies and that both that |
|
||||
* copyright notice and this permission notice appear in supporting |
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or |
|
||||
* publicity pertaining to distribution of the software without specific, |
|
||||
* written prior permission. M.I.T. makes no representations about the |
|
||||
* suitability of this software for any purpose. It is provided "as is" |
|
||||
* without express or implied warranty. |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
/********************************************************************
|
|
||||
* NOTICE * |
|
||||
* ======== * |
|
||||
* * |
|
||||
* Content of header files lib/setup_once.h and ares/setup_once.h * |
|
||||
* must be kept in sync. Modify the other one if you change this. * |
|
||||
* * |
|
||||
********************************************************************/ |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Inclusion of common header files. |
|
||||
*/ |
|
||||
|
|
||||
#include <stdio.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <string.h> |
|
||||
#include <stdarg.h> |
|
||||
#include <ctype.h> |
|
||||
#include <errno.h> |
|
||||
|
|
||||
#ifdef HAVE_SYS_TYPES_H |
|
||||
#include <sys/types.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef NEED_MALLOC_H |
|
||||
#include <malloc.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef NEED_MEMORY_H |
|
||||
#include <memory.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_SYS_STAT_H |
|
||||
#include <sys/stat.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_SYS_TIME_H |
|
||||
#include <sys/time.h> |
|
||||
#ifdef TIME_WITH_SYS_TIME |
|
||||
#include <time.h> |
|
||||
#endif |
|
||||
#else |
|
||||
#ifdef HAVE_TIME_H |
|
||||
#include <time.h> |
|
||||
#endif |
|
||||
#endif |
|
||||
|
|
||||
#ifdef WIN32 |
|
||||
#include <io.h> |
|
||||
#include <fcntl.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_STDBOOL_H |
|
||||
#include <stdbool.h> |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Definition of timeval struct for platforms that don't have it. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef HAVE_STRUCT_TIMEVAL |
|
||||
struct timeval { |
|
||||
long tv_sec; |
|
||||
long tv_usec; |
|
||||
}; |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* If we have the MSG_NOSIGNAL define, make sure we use |
|
||||
* it as the fourth argument of function send() |
|
||||
*/ |
|
||||
|
|
||||
#ifdef HAVE_MSG_NOSIGNAL |
|
||||
#define SEND_4TH_ARG MSG_NOSIGNAL |
|
||||
#else |
|
||||
#define SEND_4TH_ARG 0 |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
#if defined(__minix) |
|
||||
/* Minix doesn't support recv on TCP sockets */ |
|
||||
#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ |
|
||||
(RECV_TYPE_ARG2)(y), \ |
|
||||
(RECV_TYPE_ARG3)(z)) |
|
||||
|
|
||||
#elif defined(HAVE_RECV) |
|
||||
/*
|
|
||||
* The definitions for the return type and arguments types |
|
||||
* of functions recv() and send() belong and come from the |
|
||||
* configuration file. Do not define them in any other place. |
|
||||
* |
|
||||
* HAVE_RECV is defined if you have a function named recv() |
|
||||
* which is used to read incoming data from sockets. If your |
|
||||
* function has another name then don't define HAVE_RECV. |
|
||||
* |
|
||||
* If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2, |
|
||||
* RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also |
|
||||
* be defined. |
|
||||
* |
|
||||
* HAVE_SEND is defined if you have a function named send() |
|
||||
* which is used to write outgoing data on a connected socket. |
|
||||
* If yours has another name then don't define HAVE_SEND. |
|
||||
* |
|
||||
* If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2, |
|
||||
* SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and |
|
||||
* SEND_TYPE_RETV must also be defined. |
|
||||
*/ |
|
||||
|
|
||||
#if !defined(RECV_TYPE_ARG1) || \ |
|
||||
!defined(RECV_TYPE_ARG2) || \ |
|
||||
!defined(RECV_TYPE_ARG3) || \ |
|
||||
!defined(RECV_TYPE_ARG4) || \ |
|
||||
!defined(RECV_TYPE_RETV) |
|
||||
/* */ |
|
||||
Error Missing_definition_of_return_and_arguments_types_of_recv |
|
||||
/* */ |
|
||||
#else |
|
||||
#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \ |
|
||||
(RECV_TYPE_ARG2)(y), \ |
|
||||
(RECV_TYPE_ARG3)(z), \ |
|
||||
(RECV_TYPE_ARG4)(0)) |
|
||||
#endif |
|
||||
#else /* HAVE_RECV */ |
|
||||
#ifndef sread |
|
||||
/* */ |
|
||||
Error Missing_definition_of_macro_sread |
|
||||
/* */ |
|
||||
#endif |
|
||||
#endif /* HAVE_RECV */ |
|
||||
|
|
||||
|
|
||||
#if defined(__minix) |
|
||||
/* Minix doesn't support send on TCP sockets */ |
|
||||
#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \ |
|
||||
(SEND_TYPE_ARG2)(y), \ |
|
||||
(SEND_TYPE_ARG3)(z)) |
|
||||
|
|
||||
#elif defined(HAVE_SEND) |
|
||||
#if !defined(SEND_TYPE_ARG1) || \ |
|
||||
!defined(SEND_QUAL_ARG2) || \ |
|
||||
!defined(SEND_TYPE_ARG2) || \ |
|
||||
!defined(SEND_TYPE_ARG3) || \ |
|
||||
!defined(SEND_TYPE_ARG4) || \ |
|
||||
!defined(SEND_TYPE_RETV) |
|
||||
/* */ |
|
||||
Error Missing_definition_of_return_and_arguments_types_of_send |
|
||||
/* */ |
|
||||
#else |
|
||||
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \ |
|
||||
(SEND_TYPE_ARG2)(y), \ |
|
||||
(SEND_TYPE_ARG3)(z), \ |
|
||||
(SEND_TYPE_ARG4)(SEND_4TH_ARG)) |
|
||||
#endif |
|
||||
#else /* HAVE_SEND */ |
|
||||
#ifndef swrite |
|
||||
/* */ |
|
||||
Error Missing_definition_of_macro_swrite |
|
||||
/* */ |
|
||||
#endif |
|
||||
#endif /* HAVE_SEND */ |
|
||||
|
|
||||
|
|
||||
#if 0 |
|
||||
#if defined(HAVE_RECVFROM) |
|
||||
/*
|
|
||||
* Currently recvfrom is only used on udp sockets. |
|
||||
*/ |
|
||||
#if !defined(RECVFROM_TYPE_ARG1) || \ |
|
||||
!defined(RECVFROM_TYPE_ARG2) || \ |
|
||||
!defined(RECVFROM_TYPE_ARG3) || \ |
|
||||
!defined(RECVFROM_TYPE_ARG4) || \ |
|
||||
!defined(RECVFROM_TYPE_ARG5) || \ |
|
||||
!defined(RECVFROM_TYPE_ARG6) || \ |
|
||||
!defined(RECVFROM_TYPE_RETV) |
|
||||
/* */ |
|
||||
Error Missing_definition_of_return_and_arguments_types_of_recvfrom |
|
||||
/* */ |
|
||||
#else |
|
||||
#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \ |
|
||||
(RECVFROM_TYPE_ARG2 *)(b), \ |
|
||||
(RECVFROM_TYPE_ARG3) (bl), \ |
|
||||
(RECVFROM_TYPE_ARG4) (0), \ |
|
||||
(RECVFROM_TYPE_ARG5 *)(f), \ |
|
||||
(RECVFROM_TYPE_ARG6 *)(fl)) |
|
||||
#endif |
|
||||
#else /* HAVE_RECVFROM */ |
|
||||
#ifndef sreadfrom |
|
||||
/* */ |
|
||||
Error Missing_definition_of_macro_sreadfrom |
|
||||
/* */ |
|
||||
#endif |
|
||||
#endif /* HAVE_RECVFROM */ |
|
||||
|
|
||||
|
|
||||
#ifdef RECVFROM_TYPE_ARG6_IS_VOID |
|
||||
# define RECVFROM_ARG6_T int |
|
||||
#else |
|
||||
# define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6 |
|
||||
#endif |
|
||||
#endif /* if 0 */ |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* 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)) |
|
||||
#else |
|
||||
# define sclose(x) close((x)) |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Uppercase macro versions of ANSI/ISO is*() functions/macros which |
|
||||
* avoid negative number inputs with argument byte codes > 127. |
|
||||
*/ |
|
||||
|
|
||||
#define ISSPACE(x) (isspace((int) ((unsigned char)x))) |
|
||||
#define ISDIGIT(x) (isdigit((int) ((unsigned char)x))) |
|
||||
#define ISALNUM(x) (isalnum((int) ((unsigned char)x))) |
|
||||
#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x))) |
|
||||
#define ISGRAPH(x) (isgraph((int) ((unsigned char)x))) |
|
||||
#define ISALPHA(x) (isalpha((int) ((unsigned char)x))) |
|
||||
#define ISPRINT(x) (isprint((int) ((unsigned char)x))) |
|
||||
#define ISUPPER(x) (isupper((int) ((unsigned char)x))) |
|
||||
#define ISLOWER(x) (islower((int) ((unsigned char)x))) |
|
||||
|
|
||||
#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \ |
|
||||
(((unsigned char)x) == '\t')) |
|
||||
|
|
||||
#define TOLOWER(x) (tolower((int) ((unsigned char)x))) |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms. |
|
||||
* On non-C99 platforms there's no bool, so define an enum for that. |
|
||||
* On C99 platforms 'false' and 'true' also exist. Enum uses a |
|
||||
* global namespace though, so use bool_false and bool_true. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef HAVE_BOOL_T |
|
||||
typedef enum { |
|
||||
bool_false = 0, |
|
||||
bool_true = 1 |
|
||||
} bool; |
|
||||
|
|
||||
/*
|
|
||||
* Use a define to let 'true' and 'false' use those enums. There |
|
||||
* are currently no use of true and false in libcurl proper, but |
|
||||
* there are some in the examples. This will cater for any later |
|
||||
* code happening to use true and false. |
|
||||
*/ |
|
||||
# define false bool_false |
|
||||
# define true bool_true |
|
||||
# define HAVE_BOOL_T |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Redefine TRUE and FALSE too, to catch current use. With this |
|
||||
* change, 'bool found = 1' will give a warning on MIPSPro, but |
|
||||
* 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro, |
|
||||
* AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef TRUE |
|
||||
#define TRUE true |
|
||||
#endif |
|
||||
#ifndef FALSE |
|
||||
#define FALSE false |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef HAVE_SIG_ATOMIC_T |
|
||||
typedef int sig_atomic_t; |
|
||||
#define HAVE_SIG_ATOMIC_T |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Convenience SIG_ATOMIC_T definition |
|
||||
*/ |
|
||||
|
|
||||
#ifdef HAVE_SIG_ATOMIC_T_VOLATILE |
|
||||
#define SIG_ATOMIC_T static sig_atomic_t |
|
||||
#else |
|
||||
#define SIG_ATOMIC_T static volatile sig_atomic_t |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Default return type for signal handlers. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef RETSIGTYPE |
|
||||
#define RETSIGTYPE void |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Macro used to include code only in debug builds. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef DEBUGBUILD |
|
||||
#define DEBUGF(x) x |
|
||||
#else |
|
||||
#define DEBUGF(x) do { } while (0) |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Macro used to include assertion code only in debug builds. |
|
||||
*/ |
|
||||
|
|
||||
#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H) |
|
||||
#define DEBUGASSERT(x) assert(x) |
|
||||
#else |
|
||||
#define DEBUGASSERT(x) do { } 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. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef WIN32 |
|
||||
#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 |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid() |
|
||||
*/ |
|
||||
|
|
||||
#if defined(__VMS) && \ |
|
||||
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) |
|
||||
#define getpwuid __32_getpwuid |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* Macro argv_item_t hides platform details to code using it. |
|
||||
*/ |
|
||||
|
|
||||
#ifdef __VMS |
|
||||
#define argv_item_t __char_ptr32 |
|
||||
#else |
|
||||
#define argv_item_t char * |
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/*
|
|
||||
* We use this ZERO_NULL to avoid picky compiler warnings, |
|
||||
* when assigning a NULL pointer to a function pointer var. |
|
||||
*/ |
|
||||
|
|
||||
#define ZERO_NULL 0 |
|
||||
|
|
||||
|
|
||||
#endif /* __SETUP_ONCE_H */ |
|
||||
|
|
@ -1,22 +0,0 @@ |
|||||
#include "ares_setup.h" |
|
||||
|
|
||||
|
|
||||
/* only do the following on windows
|
|
||||
*/ |
|
||||
#if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS) |
|
||||
|
|
||||
#ifdef __WATCOMC__ |
|
||||
/*
|
|
||||
* Watcom needs a DllMain() in order to initialise the clib startup code. |
|
||||
*/ |
|
||||
BOOL |
|
||||
WINAPI DllMain (HINSTANCE hnd, DWORD reason, LPVOID reserved) |
|
||||
{ |
|
||||
(void) hnd; |
|
||||
(void) reason; |
|
||||
(void) reserved; |
|
||||
return (TRUE); |
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
#endif /* WIN32 builds only */ |
|
@ -1,159 +0,0 @@ |
|||||
Warning: this is not actual API but desired API. |
|
||||
|
|
||||
# `uv_handle_t` |
|
||||
|
|
||||
This is the abstract base class of all types of handles. All handles have in |
|
||||
common: |
|
||||
|
|
||||
* When handles are initialized, the reference count to the event loop is |
|
||||
increased by one. |
|
||||
|
|
||||
* The user owns the `uv_handle_t` memory and is in charge of freeing it. |
|
||||
|
|
||||
* In order to free resources associated with a handle, one must `uv_close()` |
|
||||
and wait for the `uv_close_cb` callback. After the close callback has been |
|
||||
made, the user is allowed to the `uv_handle_t` object. |
|
||||
|
|
||||
* The `uv_close_cb` is always made directly off the event loop. That is, it |
|
||||
is not called from `uv_close()`. |
|
||||
|
|
||||
|
|
||||
|
|
||||
# `uv_tcp_server_t` |
|
||||
|
|
||||
A TCP server class that is a subclass of `uv_handle_t`. This can be bound to |
|
||||
an address and begin accepting new TCP sockets. |
|
||||
|
|
||||
int uv_bind4(uv_tcp_server_t* tcp_server, struct sockaddr_in* address); |
|
||||
int uv_bind6(uv_tcp_server_t* tcp_server, struct sockaddr_in6* address); |
|
||||
|
|
||||
Binds the TCP server to an address. The `address` can be created with |
|
||||
`uv_ip4_addr()`. Call this before `uv_listen()` |
|
||||
|
|
||||
Returns zero on success, -1 on failure. Errors in order of least-seriousness: |
|
||||
|
|
||||
* `UV_EADDRINUSE` There is already another socket bound to the specified |
|
||||
address. |
|
||||
|
|
||||
* `UV_EADDRNOTAVAIL` The `address` parameter is an IP address that is not |
|
||||
|
|
||||
* `UV_EINVAL` The server is already bound to an address. |
|
||||
|
|
||||
* `UV_EFAULT` Memory of `address` parameter is unintelligible. |
|
||||
|
|
||||
|
|
||||
int uv_listen(uv_tcp_server_t*, int backlog, uv_connection_cb cb); |
|
||||
|
|
||||
Begins listening for connections. The accept callback is level-triggered. |
|
||||
|
|
||||
|
|
||||
int uv_accept(uv_tcp_server_t* server, |
|
||||
uv_tcp_t* client); |
|
||||
|
|
||||
Accepts a connection. This should be called after the accept callback is |
|
||||
made. The `client` parameter should be uninitialized memory; `uv_accept` is |
|
||||
used instead of `uv_tcp_init` for server-side `uv_tcp_t` initialization. |
|
||||
|
|
||||
Return value 0 indicates success, -1 failure. Possible errors: |
|
||||
|
|
||||
* `UV_EAGAIN` There are no connections. Wait for the `uv_connection_cb` callback |
|
||||
to be called again. |
|
||||
|
|
||||
* `UV_EFAULT` The memory of either `server` is unintelligible. |
|
||||
|
|
||||
|
|
||||
|
|
||||
# `uv_stream_t` |
|
||||
|
|
||||
An abstract subclass of `uv_handle_t`. Streams represent something that |
|
||||
reads and/or writes data. Streams can be half or full-duplex. TCP sockets |
|
||||
are streams, files are streams with offsets. |
|
||||
|
|
||||
int uv_read_start(uv_stream_t* stream, |
|
||||
uv_alloc_cb alloc_cb, |
|
||||
uv_read_cb read_cb); |
|
||||
|
|
||||
Starts the stream reading continuously. The `alloc_cb` is used to allow the |
|
||||
user to implement various means of supplying the stream with buffers to |
|
||||
fill. The `read_cb` returns buffers to the user filled with data. |
|
||||
|
|
||||
Sometimes the buffers returned to the user do not contain data. This does |
|
||||
not indicate EOF as in other systems. EOF is made via the `uv_eof_cb` which |
|
||||
can be set like this `uv_set_eof_cb(stream, eof_cb);` |
|
||||
|
|
||||
|
|
||||
int uv_read_stop(uv_stream_t* stream); |
|
||||
|
|
||||
Stops reading from the stream. |
|
||||
|
|
||||
int uv_write_req_init(uv_write_req_t*, |
|
||||
uv_stream_t*, |
|
||||
uv_buf_t bufs[], |
|
||||
int butcnf); |
|
||||
|
|
||||
Initiates a write request on a stream. |
|
||||
|
|
||||
int uv_shutdown_req_init(uv_shutdown_req_t*, uv_stream_t*) |
|
||||
|
|
||||
Initiates a shutdown of outgoing data once the write queue drains. |
|
||||
|
|
||||
|
|
||||
|
|
||||
# `uv_tcp_t` |
|
||||
|
|
||||
The TCP handle class represents one endpoint of a duplex TCP stream. |
|
||||
`uv_tcp_t` is a subclass of `uv_stream_t`. A TCP handle can represent a |
|
||||
client side connection (one that has been used with uv_connect_req_init`) |
|
||||
or a server-side connection (one that was initialized with `uv_accept`) |
|
||||
|
|
||||
int uv_connect_req_init(uv_connect_req_t* req, |
|
||||
uv_tcp_t* socket, |
|
||||
struct sockaddr* addr); |
|
||||
|
|
||||
Initiates a request to open a connection. |
|
||||
|
|
||||
|
|
||||
|
|
||||
# `uv_req_t` |
|
||||
|
|
||||
Abstract class represents an asynchronous request. This is a subclass of `uv_handle_t`. |
|
||||
|
|
||||
|
|
||||
# `uv_connect_req_t` |
|
||||
|
|
||||
Subclass of `uv_req_t`. Represents a request for a TCP connection. Operates |
|
||||
on `uv_tcp_t` handles. Like other types of requests the `close_cb` indicates |
|
||||
completion of the request. |
|
||||
|
|
||||
int uv_connect_req_init(uv_connect_req_t* req, |
|
||||
uv_tcp_t* socket, |
|
||||
struct sockaddr* addr); |
|
||||
|
|
||||
Initializes the connection request. Returning 0 indicates success, -1 if |
|
||||
there was an error. The following values can be retrieved from |
|
||||
`uv_last_error` in the case of an error: |
|
||||
|
|
||||
* ??? |
|
||||
|
|
||||
|
|
||||
# `uv_shutdown_req_t` |
|
||||
|
|
||||
Subclass of `uv_req_t`. Represents an ongoing shutdown request. Once the |
|
||||
write queue of the parent `uv_stream_t` is drained, the outbound data |
|
||||
channel is shutdown. Once a shutdown request is initiated on a stream, the |
|
||||
stream will allow no more writes. |
|
||||
|
|
||||
int uv_shutdown_req_init(uv_shutdown_req_t*, |
|
||||
uv_stream_t* parent); |
|
||||
|
|
||||
Initializes the shutdown request. |
|
||||
|
|
||||
|
|
||||
# `uv_write_req_t` |
|
||||
|
|
||||
int uv_write_req_init(uv_write_req_t*, |
|
||||
uv_stream_t*, |
|
||||
uv_buf_t bufs[], |
|
||||
int butcnf); |
|
||||
|
|
||||
Initiates a write request on a stream. |
|
@ -1,35 +0,0 @@ |
|||||
Revision history for libeio |
|
||||
|
|
||||
TODO: maybe add mincore support? available on at least darwin, solaris, linux, freebsd |
|
||||
TODO: openbsd requites stdint.h for intptr_t - why posix? |
|
||||
|
|
||||
1.0 |
|
||||
- readdir: correctly handle malloc failures. |
|
||||
- readdir: new flags argument, can return inode |
|
||||
and possibly filetype, can sort in various ways. |
|
||||
- readdir: stop immediately when cancelled, do |
|
||||
not continue reading the directory. |
|
||||
- fix return value of eio_sendfile_sync. |
|
||||
- include sys/mman.h for msync. |
|
||||
- added EIO_STACKSIZE. |
|
||||
- added msync, mtouch support (untested). |
|
||||
- added sync_file_range (untested). |
|
||||
- fixed custom support. |
|
||||
- use a more robust feed-add detection method. |
|
||||
- "outbundled" from IO::AIO. |
|
||||
- eio_set_max_polltime did not properly convert time to ticks. |
|
||||
- tentatively support darwin in sendfile. |
|
||||
- fix freebsd/darwin sendfile. |
|
||||
- also use sendfile emulation for ENOTSUP and EOPNOTSUPP |
|
||||
error codes. |
|
||||
- add OS-independent EIO_MT_* and EIO_MS_* flag enums. |
|
||||
- add eio_statvfs/eio_fstatvfs. |
|
||||
- add eio_mlock/eio_mlockall and OS-independent MCL_* flag enums. |
|
||||
- no longer set errno to 0 before making syscalls, this only lures |
|
||||
people into the trap of believing errno shows success or failure. |
|
||||
- "fix" demo.c so that it works as non-root. |
|
||||
- suppoert utimes seperately from futimes, as some systems have |
|
||||
utimes but not futimes. |
|
||||
- use _POSIX_MEMLOCK_RANGE for mlock. |
|
||||
- do not (errornously) overwrite CFLAGS in configure.ac. |
|
||||
|
|
@ -1,36 +0,0 @@ |
|||||
All files in libeio are Copyright (C)2007,2008 Marc Alexander Lehmann. |
|
||||
|
|
||||
Redistribution and use in source and binary forms, with or without |
|
||||
modification, are permitted provided that the following conditions are |
|
||||
met: |
|
||||
|
|
||||
* Redistributions of source code must retain the above copyright |
|
||||
notice, this list of conditions and the following disclaimer. |
|
||||
|
|
||||
* Redistributions in binary form must reproduce the above |
|
||||
copyright notice, this list of conditions and the following |
|
||||
disclaimer in the documentation and/or other materials provided |
|
||||
with the distribution. |
|
||||
|
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
|
|
||||
Alternatively, the contents of this package may be used under the terms |
|
||||
of the GNU General Public License ("GPL") version 2 or any later version, |
|
||||
in which case the provisions of the GPL are applicable instead of the |
|
||||
above. If you wish to allow the use of your version of this package only |
|
||||
under the terms of the GPL and not to allow others to use your version of |
|
||||
this file under the BSD license, indicate your decision by deleting the |
|
||||
provisions above and replace them with the notice and other provisions |
|
||||
required by the GPL in this and the other files of this package. If you do |
|
||||
not delete the provisions above, a recipient may use your version of this |
|
||||
file under either the BSD or the GPL. |
|
@ -1,15 +0,0 @@ |
|||||
AUTOMAKE_OPTIONS = foreign no-dependencies |
|
||||
|
|
||||
VERSION_INFO = 1:0 |
|
||||
|
|
||||
EXTRA_DIST = LICENSE Changes autogen.sh |
|
||||
|
|
||||
#man_MANS = ev.3
|
|
||||
|
|
||||
include_HEADERS = eio.h |
|
||||
|
|
||||
lib_LTLIBRARIES = libeio.la |
|
||||
|
|
||||
libeio_la_SOURCES = eio.c xthread.h config.h |
|
||||
libeio_la_LDFLAGS = -version-info $(VERSION_INFO) |
|
||||
|
|
File diff suppressed because it is too large
@ -1,5 +0,0 @@ |
|||||
libtoolize |
|
||||
aclocal |
|
||||
automake --add-missing |
|
||||
autoconf |
|
||||
autoheader |
|
@ -1,86 +0,0 @@ |
|||||
/* config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#undef HAVE_DLFCN_H |
|
||||
|
|
||||
/* fdatasync(2) is available */ |
|
||||
#undef HAVE_FDATASYNC |
|
||||
|
|
||||
/* futimes(2) is available */ |
|
||||
#undef HAVE_FUTIMES |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#undef HAVE_INTTYPES_H |
|
||||
|
|
||||
/* Define to 1 if you have the <memory.h> header file. */ |
|
||||
#undef HAVE_MEMORY_H |
|
||||
|
|
||||
/* posix_fadvise(2) is available */ |
|
||||
#undef HAVE_POSIX_FADVISE |
|
||||
|
|
||||
/* posix_madvise(2) is available */ |
|
||||
#undef HAVE_POSIX_MADVISE |
|
||||
|
|
||||
/* pread(2) and pwrite(2) are available */ |
|
||||
#undef HAVE_PREADWRITE |
|
||||
|
|
||||
/* readahead(2) is available (linux) */ |
|
||||
#undef HAVE_READAHEAD |
|
||||
|
|
||||
/* sendfile(2) is available and supported */ |
|
||||
#undef HAVE_SENDFILE |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#undef HAVE_STDINT_H |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#undef HAVE_STDLIB_H |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#undef HAVE_STRINGS_H |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#undef HAVE_STRING_H |
|
||||
|
|
||||
/* sync_file_range(2) is available */ |
|
||||
#undef HAVE_SYNC_FILE_RANGE |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#undef HAVE_SYS_STAT_H |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#undef HAVE_SYS_TYPES_H |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#undef HAVE_UNISTD_H |
|
||||
|
|
||||
/* utimes(2) is available */ |
|
||||
#undef HAVE_UTIMES |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#undef LT_OBJDIR |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#undef PACKAGE |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#undef PACKAGE_BUGREPORT |
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#undef PACKAGE_NAME |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#undef PACKAGE_STRING |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#undef PACKAGE_TARNAME |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#undef PACKAGE_URL |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#undef PACKAGE_VERSION |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#undef STDC_HEADERS |
|
@ -1,77 +0,0 @@ |
|||||
/* config.h. Generated from config.h.in by configure. */ |
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* fdatasync(2) is available */ |
|
||||
#define HAVE_FDATASYNC 1 |
|
||||
|
|
||||
/* futimes(2) is available */ |
|
||||
#define HAVE_FUTIMES 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <memory.h> header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* pread(2) and pwrite(2) are available */ |
|
||||
#define HAVE_PREADWRITE 1 |
|
||||
|
|
||||
/* readahead(2) is available (linux) */ |
|
||||
/* #undef HAVE_READAHEAD */ |
|
||||
|
|
||||
/* sendfile(2) is available and supported */ |
|
||||
/* #undef HAVE_SENDFILE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* sync_file_range(2) is available */ |
|
||||
/* #undef HAVE_SYNC_FILE_RANGE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "libeio" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "" |
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "" |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.0" |
|
@ -1,82 +0,0 @@ |
|||||
/* config.h. Generated from config.h.in by configure. */ |
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* fdatasync(2) is not available on 10.5 but is on 10.6
|
|
||||
* How should we deal with this? */ |
|
||||
/* #define HAVE_FDATASYNC 0 */ |
|
||||
|
|
||||
/* futimes(2) is available */ |
|
||||
#define HAVE_FUTIMES 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <memory.h> header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* pread(2) and pwrite(2) are available */ |
|
||||
#define HAVE_PREADWRITE 1 |
|
||||
|
|
||||
/* readahead(2) is available (linux) */ |
|
||||
/* #undef HAVE_READAHEAD */ |
|
||||
|
|
||||
/* sendfile(2) is available and supported */ |
|
||||
#define HAVE_SENDFILE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* sync_file_range(2) is available */ |
|
||||
/* #undef HAVE_SYNC_FILE_RANGE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "libeio" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "" |
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "" |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.0" |
|
@ -1,78 +0,0 @@ |
|||||
/* config.h. Generated from config.h.in by configure. */ |
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* fdatasync(2) is available */ |
|
||||
/* #undef HAVE_FDATASYNC */ |
|
||||
|
|
||||
/* futimes(2) is available */ |
|
||||
#define HAVE_FUTIMES 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <memory.h> header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* pread(2) and pwrite(2) are available */ |
|
||||
#define HAVE_PREADWRITE 1 |
|
||||
|
|
||||
/* readahead(2) is available (linux) */ |
|
||||
/* #undef HAVE_READAHEAD */ |
|
||||
|
|
||||
/* sendfile(2) is available and supported */ |
|
||||
#define HAVE_SENDFILE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* sync_file_range(2) is available */ |
|
||||
/* #undef HAVE_SYNC_FILE_RANGE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "libeio" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "" |
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "" |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.0" |
|
@ -1,81 +0,0 @@ |
|||||
/* config.h. Generated from config.h.in by configure. */ |
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* fdatasync(2) is available */ |
|
||||
#define HAVE_FDATASYNC 1 |
|
||||
|
|
||||
/* futimes(2) is available */ |
|
||||
#define HAVE_FUTIMES 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <memory.h> header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* pread(2) and pwrite(2) are available */ |
|
||||
#define HAVE_PREADWRITE 1 |
|
||||
|
|
||||
/* readahead(2) is available (linux) */ |
|
||||
#define HAVE_READAHEAD 1 |
|
||||
|
|
||||
/* sendfile(2) is available and supported */ |
|
||||
#define HAVE_SENDFILE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* sync_file_range(2) is available */ |
|
||||
#define HAVE_SYNC_FILE_RANGE 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "libeio" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "" |
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "" |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.0" |
|
@ -1,81 +0,0 @@ |
|||||
/* config.h. Generated from config.h.in by configure. */ |
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */ |
|
||||
|
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||
#define HAVE_DLFCN_H 1 |
|
||||
|
|
||||
/* fdatasync(2) is available */ |
|
||||
#define HAVE_FDATASYNC 1 |
|
||||
|
|
||||
/* futimes(2) is available */ |
|
||||
/* #undef HAVE_FUTIMES */ |
|
||||
|
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||
#define HAVE_INTTYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <memory.h> header file. */ |
|
||||
#define HAVE_MEMORY_H 1 |
|
||||
|
|
||||
/* pread(2) and pwrite(2) are available */ |
|
||||
#define HAVE_PREADWRITE 1 |
|
||||
|
|
||||
/* readahead(2) is available (linux) */ |
|
||||
/* #undef HAVE_READAHEAD */ |
|
||||
|
|
||||
/* sendfile(2) is available and supported */ |
|
||||
/* #undef HAVE_SENDFILE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||
#define HAVE_STDINT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||
#define HAVE_STDLIB_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||
#define HAVE_STRINGS_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||
#define HAVE_STRING_H 1 |
|
||||
|
|
||||
/* sync_file_range(2) is available */ |
|
||||
/* #undef HAVE_SYNC_FILE_RANGE */ |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||
#define HAVE_SYS_STAT_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||
#define HAVE_SYS_TYPES_H 1 |
|
||||
|
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||
#define HAVE_UNISTD_H 1 |
|
||||
|
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||
*/ |
|
||||
#define LT_OBJDIR ".libs/" |
|
||||
|
|
||||
/* Name of package */ |
|
||||
#define PACKAGE "libeio" |
|
||||
|
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||
#define PACKAGE_BUGREPORT "" |
|
||||
|
|
||||
/* Define to the full name of this package. */ |
|
||||
#define PACKAGE_NAME "" |
|
||||
|
|
||||
/* Define to the full name and version of this package. */ |
|
||||
#define PACKAGE_STRING "" |
|
||||
|
|
||||
/* Define to the one symbol short name of this package. */ |
|
||||
#define PACKAGE_TARNAME "" |
|
||||
|
|
||||
/* Define to the home page for this package. */ |
|
||||
#define PACKAGE_URL "" |
|
||||
|
|
||||
/* Define to the version of this package. */ |
|
||||
#define PACKAGE_VERSION "" |
|
||||
|
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||
#define STDC_HEADERS 1 |
|
||||
|
|
||||
/* Version number of package */ |
|
||||
#define VERSION "1.0" |
|
@ -1,22 +0,0 @@ |
|||||
AC_PREREQ(2.59) |
|
||||
AC_INIT |
|
||||
AC_CONFIG_SRCDIR([eio.h]) |
|
||||
AC_CONFIG_HEADERS([config.h]) |
|
||||
|
|
||||
AM_INIT_AUTOMAKE(libeio,1.0) |
|
||||
AM_MAINTAINER_MODE |
|
||||
AC_PROG_LIBTOOL |
|
||||
|
|
||||
AC_PROG_CC |
|
||||
|
|
||||
if test "x$GCC" = xyes ; then |
|
||||
CFLAGS="$CFLAGS -O3" |
|
||||
fi |
|
||||
|
|
||||
dnl somebody will forgive me |
|
||||
CFLAGS="-D_GNU_SOURCE $CFLAGS" |
|
||||
|
|
||||
m4_include([libeio.m4]) |
|
||||
|
|
||||
AC_CONFIG_FILES([Makefile]) |
|
||||
AC_OUTPUT |
|
@ -1,194 +0,0 @@ |
|||||
#include <stdio.h> |
|
||||
#include <stdlib.h> |
|
||||
#include <unistd.h> |
|
||||
#include <poll.h> |
|
||||
#include <string.h> |
|
||||
#include <assert.h> |
|
||||
#include <fcntl.h> |
|
||||
#include <sys/types.h> |
|
||||
#include <sys/stat.h> |
|
||||
|
|
||||
#include "eio.h" |
|
||||
|
|
||||
int respipe [2]; |
|
||||
|
|
||||
void |
|
||||
want_poll (void) |
|
||||
{ |
|
||||
char dummy; |
|
||||
printf ("want_poll ()\n"); |
|
||||
write (respipe [1], &dummy, 1); |
|
||||
} |
|
||||
|
|
||||
void |
|
||||
done_poll (void) |
|
||||
{ |
|
||||
char dummy; |
|
||||
printf ("done_poll ()\n"); |
|
||||
read (respipe [0], &dummy, 1); |
|
||||
} |
|
||||
|
|
||||
void |
|
||||
event_loop (void) |
|
||||
{ |
|
||||
// an event loop. yeah.
|
|
||||
struct pollfd pfd; |
|
||||
pfd.fd = respipe [0]; |
|
||||
pfd.events = POLLIN; |
|
||||
|
|
||||
printf ("\nentering event loop\n"); |
|
||||
while (eio_nreqs ()) |
|
||||
{ |
|
||||
poll (&pfd, 1, -1); |
|
||||
printf ("eio_poll () = %d\n", eio_poll ()); |
|
||||
} |
|
||||
printf ("leaving event loop\n"); |
|
||||
} |
|
||||
|
|
||||
int |
|
||||
res_cb (eio_req *req) |
|
||||
{ |
|
||||
printf ("res_cb(%d|%s) = %d\n", req->type, req->data ? req->data : "?", EIO_RESULT (req)); |
|
||||
|
|
||||
if (req->result < 0) |
|
||||
abort (); |
|
||||
|
|
||||
return 0; |
|
||||
} |
|
||||
|
|
||||
int |
|
||||
readdir_cb (eio_req *req) |
|
||||
{ |
|
||||
char *buf = (char *)EIO_BUF (req); |
|
||||
|
|
||||
printf ("readdir_cb = %d\n", EIO_RESULT (req)); |
|
||||
|
|
||||
if (EIO_RESULT (req) < 0) |
|
||||
return 0; |
|
||||
|
|
||||
while (EIO_RESULT (req)--) |
|
||||
{ |
|
||||
printf ("readdir = <%s>\n", buf); |
|
||||
buf += strlen (buf) + 1; |
|
||||
} |
|
||||
|
|
||||
return 0; |
|
||||
} |
|
||||
|
|
||||
int |
|
||||
stat_cb (eio_req *req) |
|
||||
{ |
|
||||
struct stat *buf = EIO_STAT_BUF (req); |
|
||||
|
|
||||
if (req->type == EIO_FSTAT) |
|
||||
printf ("fstat_cb = %d\n", EIO_RESULT (req)); |
|
||||
else |
|
||||
printf ("stat_cb(%s) = %d\n", EIO_PATH (req), EIO_RESULT (req)); |
|
||||
|
|
||||
if (!EIO_RESULT (req)) |
|
||||
printf ("stat size %d perm 0%o\n", buf->st_size, buf->st_mode & 0777); |
|
||||
|
|
||||
return 0; |
|
||||
} |
|
||||
|
|
||||
int |
|
||||
read_cb (eio_req *req) |
|
||||
{ |
|
||||
unsigned char *buf = (unsigned char *)EIO_BUF (req); |
|
||||
|
|
||||
printf ("read_cb = %d (%02x%02x%02x%02x %02x%02x%02x%02x)\n", |
|
||||
EIO_RESULT (req), |
|
||||
buf [0], buf [1], buf [2], buf [3], |
|
||||
buf [4], buf [5], buf [6], buf [7]); |
|
||||
|
|
||||
return 0; |
|
||||
} |
|
||||
|
|
||||
int last_fd; |
|
||||
|
|
||||
int |
|
||||
open_cb (eio_req *req) |
|
||||
{ |
|
||||
printf ("open_cb = %d\n", EIO_RESULT (req)); |
|
||||
|
|
||||
last_fd = EIO_RESULT (req); |
|
||||
|
|
||||
return 0; |
|
||||
} |
|
||||
|
|
||||
int |
|
||||
main (void) |
|
||||
{ |
|
||||
printf ("pipe ()\n"); |
|
||||
if (pipe (respipe)) abort (); |
|
||||
|
|
||||
printf ("eio_init ()\n"); |
|
||||
if (eio_init (want_poll, done_poll)) abort (); |
|
||||
|
|
||||
do |
|
||||
{ |
|
||||
/* avoid relative paths yourself(!) */ |
|
||||
eio_mkdir ("eio-test-dir", 0777, 0, res_cb, "mkdir"); |
|
||||
eio_nop (0, res_cb, "nop"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_stat ("eio-test-dir", 0, stat_cb, "stat"); |
|
||||
eio_lstat ("eio-test-dir", 0, stat_cb, "stat"); |
|
||||
eio_open ("eio-test-dir/eio-test-file", O_RDWR | O_CREAT, 0777, 0, open_cb, "open"); |
|
||||
eio_symlink ("test", "eio-test-dir/eio-symlink", 0, res_cb, "symlink"); |
|
||||
eio_mknod ("eio-test-dir/eio-fifo", S_IFIFO, 0, 0, res_cb, "mknod"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_utime ("eio-test-dir", 12345.678, 23456.789, 0, res_cb, "utime"); |
|
||||
eio_futime (last_fd, 92345.678, 93456.789, 0, res_cb, "futime"); |
|
||||
eio_chown ("eio-test-dir", getuid (), getgid (), 0, res_cb, "chown"); |
|
||||
eio_fchown (last_fd, getuid (), getgid (), 0, res_cb, "fchown"); |
|
||||
eio_fchmod (last_fd, 0723, 0, res_cb, "fchmod"); |
|
||||
eio_readdir ("eio-test-dir", 0, 0, readdir_cb, "readdir"); |
|
||||
eio_readdir ("/nonexistant", 0, 0, readdir_cb, "readdir"); |
|
||||
eio_fstat (last_fd, 0, stat_cb, "stat"); |
|
||||
eio_write (last_fd, "test\nfail\n", 10, 4, 0, res_cb, "write"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_read (last_fd, 0, 8, 0, EIO_PRI_DEFAULT, read_cb, "read"); |
|
||||
eio_readlink ("eio-test-dir/eio-symlink", 0, res_cb, "readlink"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_dup2 (1, 2, EIO_PRI_DEFAULT, res_cb, "dup"); // dup stdout to stderr
|
|
||||
eio_chmod ("eio-test-dir", 0765, 0, res_cb, "chmod"); |
|
||||
eio_ftruncate (last_fd, 9, 0, res_cb, "ftruncate"); |
|
||||
eio_fdatasync (last_fd, 0, res_cb, "fdatasync"); |
|
||||
eio_fsync (last_fd, 0, res_cb, "fsync"); |
|
||||
eio_sync (0, res_cb, "sync"); |
|
||||
eio_busy (0.5, 0, res_cb, "busy"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_sendfile (1, last_fd, 4, 5, 0, res_cb, "sendfile"); // write "test\n" to stdout
|
|
||||
eio_fstat (last_fd, 0, stat_cb, "stat"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_truncate ("eio-test-dir/eio-test-file", 6, 0, res_cb, "truncate"); |
|
||||
eio_readahead (last_fd, 0, 64, 0, res_cb, "readahead"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_close (last_fd, 0, res_cb, "close"); |
|
||||
eio_link ("eio-test-dir/eio-test-file", "eio-test-dir/eio-test-file-2", 0, res_cb, "link"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_rename ("eio-test-dir/eio-test-file", "eio-test-dir/eio-test-file-renamed", 0, res_cb, "rename"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_unlink ("eio-test-dir/eio-fifo", 0, res_cb, "unlink"); |
|
||||
eio_unlink ("eio-test-dir/eio-symlink", 0, res_cb, "unlink"); |
|
||||
eio_unlink ("eio-test-dir/eio-test-file-2", 0, res_cb, "unlink"); |
|
||||
eio_unlink ("eio-test-dir/eio-test-file-renamed", 0, res_cb, "unlink"); |
|
||||
event_loop (); |
|
||||
|
|
||||
eio_rmdir ("eio-test-dir", 0, res_cb, "rmdir"); |
|
||||
event_loop (); |
|
||||
} |
|
||||
while (0); |
|
||||
|
|
||||
return 0; |
|
||||
} |
|
||||
|
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue