mirror of https://github.com/mongodb/mongo
third_party
This commit is contained in:
parent
dce1272082
commit
c4e82a30b3
|
|
@ -0,0 +1,84 @@
|
|||
c-ares is based on ares, and these are the people that have worked on it since
|
||||
the fork was made:
|
||||
|
||||
Albert Chin
|
||||
Alex Loukissas
|
||||
Alexander Klauer
|
||||
Alexander Lazic
|
||||
Alexey Simak
|
||||
Andreas Rieke
|
||||
Andrew Andkjar
|
||||
Andrew Ayer
|
||||
Andrew C. Morrow
|
||||
Ashish Sharma
|
||||
Ben Greear
|
||||
Ben Noordhuis
|
||||
BogDan Vatra
|
||||
Brad House
|
||||
Brad Spencer
|
||||
Bram Matthys
|
||||
Chris Araman
|
||||
Dan Fandrich
|
||||
Daniel Johnson
|
||||
Daniel Stenberg
|
||||
David Drysdale
|
||||
David Stuart
|
||||
Denis Bilenko
|
||||
Dima Tisnek
|
||||
Dirk Manske
|
||||
Dominick Meglio
|
||||
Doug Goldstein
|
||||
Doug Kwan
|
||||
Duncan Wilcox
|
||||
Eino Tuominen
|
||||
Erik Kline
|
||||
Fedor Indutny
|
||||
Frederic Germain
|
||||
Geert Uytterhoeven
|
||||
George Neill
|
||||
Gisle Vanem
|
||||
Google LLC
|
||||
Gregor Jasny
|
||||
Guenter Knauf
|
||||
Guilherme Balena Versiani
|
||||
Gunter Knauf
|
||||
Henrik Stoerner
|
||||
Jakub Hrozek
|
||||
James Bursa
|
||||
Jérémy Lal
|
||||
John Schember
|
||||
Keith Shaw
|
||||
Lei Shi
|
||||
Marko Kreen
|
||||
Michael Wallner
|
||||
Mike Crowe
|
||||
Nick Alcock
|
||||
Nick Mathewson
|
||||
Nicolas "Pixel" Noble
|
||||
Ning Dong
|
||||
Oleg Pudeyev
|
||||
Patrick Valsecchi
|
||||
Patrik Thunstrom
|
||||
Paul Saab
|
||||
Peter Pentchev
|
||||
Phil Blundell
|
||||
Poul Thomas Lomholt
|
||||
Ravi Pratap
|
||||
Robin Cornelius
|
||||
Saúl Ibarra Corretgé
|
||||
Sebastian at basti79.de
|
||||
Shmulik Regev
|
||||
Stefan Bühler
|
||||
Steinar H. Gunderson
|
||||
Svante Karlsson
|
||||
Tofu Linden
|
||||
Tom Hughes
|
||||
Tor Arntsen
|
||||
Viktor Szakats
|
||||
Vlad Dinulescu
|
||||
William Ahern
|
||||
Yang Tse
|
||||
hpopescu at ixiacom.com
|
||||
liren at vivisimo.com
|
||||
nordsturm
|
||||
saghul
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
This file no longer holds the changelog. Now you can generate it yourself
|
||||
like this:
|
||||
|
||||
$ git log --pretty=fuller --no-color --date=short --decorate=full -1000 |
|
||||
./git2changes.pl
|
||||
|
||||
The older, manually edited, changelog is found in git named CHANGES.0
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,15 @@
|
|||
Contributing to c-ares
|
||||
======================
|
||||
|
||||
To contribute patches to c-ares, please generate a GitHub pull request
|
||||
and follow these guidelines:
|
||||
|
||||
- Check that the Travis builds are green for your pull request.
|
||||
- Please update the test suite to add a test case for any new functionality.
|
||||
- Build the library with `./configure --enable-debug --enable-maintainer-mode` and
|
||||
ensure there are no new warnings.
|
||||
|
||||
To improve the chances of the c-ares maintainers responding to your request:
|
||||
|
||||
- Also send an email to the mailing list at `c-ares@cool.haxx.se` describing your change.
|
||||
- To follow any associated discussion, please subscribe to the [mailing list](http://cool.haxx.se/mailman/listinfo/c-ares).
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
GIT-INFO
|
||||
|
||||
This file is only present in git - never in release archives. It is used as a
|
||||
sentinel file in buildconf.bat in order to differentiate a git checkout from
|
||||
release and daily snapshot archives.
|
||||
|
||||
On *nix-like systems, run the ./buildconf script first to generate a fresh
|
||||
configure script. This requires autotools to be installed locally.
|
||||
|
|
@ -0,0 +1,409 @@
|
|||
** This file is adapted from libcurl and not yet fully rewritten for c-ares! **
|
||||
|
||||
```
|
||||
___ __ _ _ __ ___ ___
|
||||
/ __| ___ / _` | '__/ _ \/ __|
|
||||
| (_ |___| (_| | | | __/\__ \
|
||||
\___| \__,_|_| \___||___/
|
||||
|
||||
How To Compile
|
||||
```
|
||||
|
||||
Installing Binary Packages
|
||||
==========================
|
||||
|
||||
Lots of people download binary distributions of c-ares. This document
|
||||
does not describe how to install c-ares using such a binary package.
|
||||
This document describes how to compile, build and install c-ares from
|
||||
source code.
|
||||
|
||||
Building from Git
|
||||
=================
|
||||
|
||||
If you get your code off a Git repository rather than an official
|
||||
release tarball, see the [GIT-INFO](GIT-INFO) file in the root directory
|
||||
for specific instructions on how to proceed.
|
||||
|
||||
In particular, if not using CMake you will need to run `./buildconf` (Unix) or
|
||||
`buildconf.bat` (Windows) to generate build files, and for the former
|
||||
you will need a local installation of Autotools. If using CMake the steps are
|
||||
the same for both Git and official release tarballs.
|
||||
|
||||
AutoTools Build
|
||||
===============
|
||||
|
||||
### General Information, works on most Unix Platforms (Linux, FreeBSD, etc)
|
||||
|
||||
A normal Unix installation is made in three or four steps (after you've
|
||||
unpacked the source archive):
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
You probably need to be root when doing the last command.
|
||||
|
||||
If you have checked out the sources from the git repository, read the
|
||||
[GIT-INFO](GIT_INFO) on how to proceed.
|
||||
|
||||
Get a full listing of all available configure options by invoking it like:
|
||||
|
||||
./configure --help
|
||||
|
||||
If you want to install c-ares in a different file hierarchy than /usr/local,
|
||||
you need to specify that already when running configure:
|
||||
|
||||
./configure --prefix=/path/to/c-ares/tree
|
||||
|
||||
If you happen to have write permission in that directory, you can do `make
|
||||
install` without being root. An example of this would be to make a local
|
||||
install in your own home directory:
|
||||
|
||||
./configure --prefix=$HOME
|
||||
make
|
||||
make install
|
||||
|
||||
### More Options
|
||||
|
||||
To force configure to use the standard cc compiler if both cc and gcc are
|
||||
present, run configure like
|
||||
|
||||
CC=cc ./configure
|
||||
# or
|
||||
env CC=cc ./configure
|
||||
|
||||
To force a static library compile, disable the shared library creation
|
||||
by running configure like:
|
||||
|
||||
./configure --disable-shared
|
||||
|
||||
If you're a c-ares developer and use gcc, you might want to enable more
|
||||
debug options with the `--enable-debug` option.
|
||||
|
||||
### Special Cases
|
||||
|
||||
Some versions of uClibc require configuring with `CPPFLAGS=-D_GNU_SOURCE=1`
|
||||
to get correct large file support.
|
||||
|
||||
The Open Watcom C compiler on Linux requires configuring with the variables:
|
||||
|
||||
./configure CC=owcc AR="$WATCOM/binl/wlib" AR_FLAGS=-q \
|
||||
RANLIB=/bin/true STRIP="$WATCOM/binl/wstrip" CFLAGS=-Wextra
|
||||
|
||||
|
||||
### CROSS COMPILE
|
||||
|
||||
(This section was graciously brought to us by Jim Duey, with additions by
|
||||
Dan Fandrich)
|
||||
|
||||
Download and unpack the c-ares package.
|
||||
|
||||
`cd` to the new directory. (e.g. `cd c-ares-1.7.6`)
|
||||
|
||||
Set environment variables to point to the cross-compile toolchain and call
|
||||
configure with any options you need. Be sure and specify the `--host` and
|
||||
`--build` parameters at configuration time. The following script is an
|
||||
example of cross-compiling for the IBM 405GP PowerPC processor using the
|
||||
toolchain from MonteVista for Hardhat Linux.
|
||||
|
||||
```sh
|
||||
#! /bin/sh
|
||||
|
||||
export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin
|
||||
export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include"
|
||||
export AR=ppc_405-ar
|
||||
export AS=ppc_405-as
|
||||
export LD=ppc_405-ld
|
||||
export RANLIB=ppc_405-ranlib
|
||||
export CC=ppc_405-gcc
|
||||
export NM=ppc_405-nm
|
||||
|
||||
./configure --target=powerpc-hardhat-linux \
|
||||
--host=powerpc-hardhat-linux \
|
||||
--build=i586-pc-linux-gnu \
|
||||
--prefix=/opt/hardhat/devkit/ppc/405/target/usr/local \
|
||||
--exec-prefix=/usr/local
|
||||
```
|
||||
|
||||
You may also need to provide a parameter like `--with-random=/dev/urandom`
|
||||
to configure as it cannot detect the presence of a random number
|
||||
generating device for a target system. The `--prefix` parameter
|
||||
specifies where c-ares will be installed. If `configure` completes
|
||||
successfully, do `make` and `make install` as usual.
|
||||
|
||||
In some cases, you may be able to simplify the above commands to as
|
||||
little as:
|
||||
|
||||
./configure --host=ARCH-OS
|
||||
|
||||
|
||||
### Cygwin (Windows)
|
||||
|
||||
Almost identical to the unix installation. Run the configure script in the
|
||||
c-ares root with `sh configure`. Make sure you have the sh executable in
|
||||
`/bin/` or you'll see the configure fail toward the end.
|
||||
|
||||
Run `make`
|
||||
|
||||
|
||||
### QNX
|
||||
|
||||
(This section was graciously brought to us by David Bentham)
|
||||
|
||||
As QNX is targeted for resource constrained environments, the QNX headers
|
||||
set conservative limits. This includes the `FD_SETSIZE` macro, set by default
|
||||
to 32. Socket descriptors returned within the c-ares library may exceed this,
|
||||
resulting in memory faults/SIGSEGV crashes when passed into `select(..)`
|
||||
calls using `fd_set` macros.
|
||||
|
||||
A good all-round solution to this is to override the default when building
|
||||
c-ares, by overriding `CFLAGS` during configure, example:
|
||||
|
||||
# configure CFLAGS='-DFD_SETSIZE=64 -g -O2'
|
||||
|
||||
|
||||
### RISC OS
|
||||
|
||||
The library can be cross-compiled using gccsdk as follows:
|
||||
|
||||
CC=riscos-gcc AR=riscos-ar RANLIB='riscos-ar -s' ./configure \
|
||||
--host=arm-riscos-aof --without-random --disable-shared
|
||||
make
|
||||
|
||||
where `riscos-gcc` and `riscos-ar` are links to the gccsdk tools.
|
||||
You can then link your program with `c-ares/lib/.libs/libcares.a`.
|
||||
|
||||
|
||||
### Android
|
||||
|
||||
Method using a configure cross-compile (tested with Android NDK r7b):
|
||||
|
||||
- prepare the toolchain of the Android NDK for standalone use; this can
|
||||
be done by invoking the script:
|
||||
|
||||
./tools/make-standalone-toolchain.sh
|
||||
|
||||
which creates a usual cross-compile toolchain. Lets assume that you put
|
||||
this toolchain below `/opt` then invoke configure with something
|
||||
like:
|
||||
|
||||
```
|
||||
export PATH=/opt/arm-linux-androideabi-4.4.3/bin:$PATH
|
||||
./configure --host=arm-linux-androideabi [more configure options]
|
||||
make
|
||||
```
|
||||
- if you want to compile directly from our GIT repo you might run into
|
||||
this issue with older automake stuff:
|
||||
|
||||
```
|
||||
checking host system type...
|
||||
Invalid configuration `arm-linux-androideabi':
|
||||
system `androideabi' not recognized
|
||||
configure: error: /bin/sh ./config.sub arm-linux-androideabi failed
|
||||
```
|
||||
this issue can be fixed with using more recent versions of `config.sub`
|
||||
and `config.guess` which can be obtained here:
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree
|
||||
you need to replace your system-own versions which usually can be
|
||||
found in your automake folder:
|
||||
`find /usr -name config.sub`
|
||||
|
||||
|
||||
CMake builds
|
||||
============
|
||||
|
||||
Current releases of c-ares introduce a CMake v3+ build system that has been
|
||||
tested on most platforms including Windows, Linux, FreeBSD, MacOS, AIX and
|
||||
Solaris.
|
||||
|
||||
In the most basic form, building with CMake might look like:
|
||||
|
||||
```sh
|
||||
cd /path/to/cmake/source
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/cares ..
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
Options to CMake are passed on the command line using "-D${OPTION}=${VALUE}".
|
||||
The values defined are all boolean and take values like On, Off, True, False.
|
||||
|
||||
* CARES_STATIC - Build the static library (off by default)
|
||||
* CARES_SHARED - Build the shared library (on by default)
|
||||
* CARES_INSTALL - Hook in installation, useful to disable if chain building
|
||||
* CARES_STATIC_PIC - Build the static library as position-independent (off by
|
||||
default)
|
||||
|
||||
|
||||
Ninja
|
||||
-----
|
||||
|
||||
Ninja is the next-generation build system meant for generators like CMake that
|
||||
heavily parallize builds. Its use is very similar to the normal build:
|
||||
|
||||
```sh
|
||||
cd /path/to/cmake/source
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/cares -G "Ninja" ..
|
||||
ninja
|
||||
sudo ninja install
|
||||
```
|
||||
|
||||
Windows MSVC Command Line
|
||||
-------------------------
|
||||
|
||||
```
|
||||
cd \path\to\cmake\source
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:\cares -G "NMake Makefiles" ..
|
||||
nmake
|
||||
nmake install
|
||||
```
|
||||
|
||||
Windows MinGW-w64 Command Line via MSYS
|
||||
---------------------------------------
|
||||
```
|
||||
cd \path\to\cmake\source
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:\cares -G "MSYS Makefiles" ..
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
|
||||
Platform-specific build systems
|
||||
===============================
|
||||
|
||||
Win32
|
||||
-----
|
||||
|
||||
### Building Windows DLLs and C run-time (CRT) linkage issues
|
||||
|
||||
As a general rule, building a DLL with static CRT linkage is highly
|
||||
discouraged, and intermixing CRTs in the same app is something to
|
||||
avoid at any cost.
|
||||
|
||||
Reading and comprehension of Microsoft Knowledge Base articles
|
||||
KB94248 and KB140584 is a must for any Windows developer. Especially
|
||||
important is full understanding if you are not going to follow the
|
||||
advice given above.
|
||||
|
||||
- [KB94248](http://support.microsoft.com/kb/94248/en-us) - How To Use the C Run-Time
|
||||
|
||||
- [KB140584](http://support.microsoft.com/kb/140584/en-us) - How to link with the correct C Run-Time (CRT) library
|
||||
|
||||
- [KB190799](http://msdn.microsoft.com/en-us/library/ms235460) - Potential Errors Passing CRT Objects Across DLL Boundaries
|
||||
|
||||
If your app is misbehaving in some strange way, or it is suffering
|
||||
from memory corruption, before asking for further help, please try
|
||||
first to rebuild every single library your app uses as well as your
|
||||
app using the debug multithreaded dynamic C runtime.
|
||||
|
||||
|
||||
### MingW32
|
||||
|
||||
Make sure that MinGW32's bin dir is in the search path, for example:
|
||||
|
||||
set PATH=c:\mingw32\bin;%PATH%
|
||||
|
||||
then run 'make -f Makefile.m32' in the root dir.
|
||||
|
||||
|
||||
### MSVC 6 caveats
|
||||
|
||||
If you use MSVC 6 it is required that you use the February 2003 edition PSDK:
|
||||
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
|
||||
|
||||
|
||||
### MSVC from command line
|
||||
|
||||
Run the `vcvars32.bat` file to get a proper environment. The
|
||||
`vcvars32.bat` file is part of the Microsoft development environment and
|
||||
you may find it in `C:\Program Files\Microsoft Visual Studio\vc98\bin`
|
||||
provided that you installed Visual C/C++ 6 in the default directory.
|
||||
|
||||
Further details in [README.msvc](README.msvc)
|
||||
|
||||
|
||||
### Important static c-ares usage note
|
||||
|
||||
When building an application that uses the static c-ares library, you must
|
||||
add `-DCARES_STATICLIB` to your `CFLAGS`. Otherwise the linker will look for
|
||||
dynamic import symbols.
|
||||
|
||||
|
||||
IBM OS/2
|
||||
--------
|
||||
|
||||
Building under OS/2 is not much different from building under unix.
|
||||
You need:
|
||||
|
||||
- emx 0.9d
|
||||
- GNU make
|
||||
- GNU patch
|
||||
- ksh
|
||||
- GNU bison
|
||||
- GNU file utilities
|
||||
- GNU sed
|
||||
- autoconf 2.13
|
||||
|
||||
If during the linking you get an error about `_errno` being an undefined
|
||||
symbol referenced from the text segment, you need to add `-D__ST_MT_ERRNO__`
|
||||
in your definitions.
|
||||
|
||||
If you're getting huge binaries, probably your makefiles have the `-g` in
|
||||
`CFLAGS`.
|
||||
|
||||
|
||||
NetWare
|
||||
-------
|
||||
|
||||
To compile `libcares.a` / `libcares.lib` you need:
|
||||
|
||||
- either any gcc / nlmconv, or CodeWarrior 7 PDK 4 or later.
|
||||
- gnu make and awk running on the platform you compile on;
|
||||
native Win32 versions can be downloaded from:
|
||||
http://www.gknw.net/development/prgtools/
|
||||
- recent Novell LibC SDK available from:
|
||||
http://developer.novell.com/ndk/libc.htm
|
||||
- or recent Novell CLib SDK available from:
|
||||
http://developer.novell.com/ndk/clib.htm
|
||||
|
||||
Set a search path to your compiler, linker and tools; on Linux make
|
||||
sure that the var `OSTYPE` contains the string 'linux'; set the var
|
||||
`NDKBASE` to point to the base of your Novell NDK; and then type
|
||||
`make -f Makefile.netware` from the top source directory;
|
||||
|
||||
|
||||
PORTS
|
||||
=====
|
||||
|
||||
This is a probably incomplete list of known hardware and operating systems
|
||||
that c-ares has been compiled for. If you know a system c-ares compiles and
|
||||
runs on, that isn't listed, please let us know!
|
||||
|
||||
- Alpha Tru64 v5.0 5.1
|
||||
- ARM Android 1.5, 2.1, 2.3
|
||||
- MIPS IRIX 6.2, 6.5
|
||||
- Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1, 5.2
|
||||
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6
|
||||
- i386 Novell NetWare
|
||||
- i386 Windows 95, 98, ME, NT, 2000, XP, 2003
|
||||
- x86_64 Linux
|
||||
|
||||
|
||||
Useful URLs
|
||||
===========
|
||||
|
||||
- c-ares: https://c-ares.haxx.se/
|
||||
- MingW: http://www.mingw.org/
|
||||
- MinGW-w64: http://mingw-w64.sourceforge.net/
|
||||
- OpenWatcom: http://www.openwatcom.org/
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# c-ares license
|
||||
|
||||
Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS
|
||||
file.
|
||||
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted, provided that
|
||||
the above copyright notice appear in all copies and that both that copyright
|
||||
notice and this permission notice appear in supporting documentation, and that
|
||||
the name of M.I.T. not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior permission.
|
||||
M.I.T. makes no representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied warranty.
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
#
|
||||
# Watcom / OpenWatcom / Win32 makefile for cares.
|
||||
# Quick hack by Guenter; comments to: /dev/nul
|
||||
#
|
||||
|
||||
!ifndef %watcom
|
||||
!error WATCOM environment variable not set!
|
||||
!else
|
||||
SYS_INCL = -I$(%watcom)\h\nt -I$(%watcom)\h
|
||||
SYS_LIBS = $(%watcom)\lib386\nt;$(%watcom)\lib386
|
||||
!endif
|
||||
|
||||
!ifdef %libname
|
||||
LIBNAME = $(%libname)
|
||||
!else
|
||||
LIBNAME = cares
|
||||
!endif
|
||||
TARGETS = $(LIBNAME).dll $(LIBNAME)_imp.lib $(LIBNAME).lib
|
||||
DEMOS = adig.exe ahost.exe acountry.exe
|
||||
|
||||
CC = wcc386
|
||||
LD = wlink
|
||||
AR = wlib
|
||||
RC = wrc
|
||||
|
||||
!ifdef __LOADDLL__
|
||||
! loaddll wcc386 wccd386
|
||||
! loaddll wpp386 wppd386
|
||||
! loaddll wlib wlibd
|
||||
!endif
|
||||
|
||||
!if $(__VERSION__) < 1250
|
||||
RM = del /q /f 2>NUL
|
||||
!else
|
||||
RM = rm -f
|
||||
!endif
|
||||
MD = mkdir
|
||||
RD = rmdir /q /s 2>NUL
|
||||
CP = copy
|
||||
|
||||
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
|
||||
-wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY &
|
||||
-dNTDDI_VERSION=0x05010000 -I. $(SYS_INCL)
|
||||
|
||||
LFLAGS = option quiet, map, caseexact, eliminate
|
||||
|
||||
!ifdef %debug
|
||||
DEBUG = -dDEBUG=1 -dDEBUGBUILD
|
||||
CFLAGS += -d3 $(DEBUG)
|
||||
LFLAGS += debug all
|
||||
!else
|
||||
CFLAGS += -d0
|
||||
!endif
|
||||
|
||||
CFLAGS += -d_WIN32_WINNT=0x0600
|
||||
|
||||
#
|
||||
# Change to suite.
|
||||
#
|
||||
!ifdef %use_watt32
|
||||
CFLAGS += -dWATT32 -I$(%watt_root)\inc
|
||||
!endif
|
||||
|
||||
OBJ_BASE = WC_Win32.obj
|
||||
LINK_ARG = $(OBJ_BASE)\dyn\wlink.arg
|
||||
LIB_ARG = $(OBJ_BASE)\stat\wlib.arg
|
||||
|
||||
# In order to process Makefile.inc wmake must be called with -u switch!
|
||||
!ifneq __MAKEOPTS__ -u
|
||||
!error You MUST call wmake with the -u switch!
|
||||
!else
|
||||
!include Makefile.inc
|
||||
!endif
|
||||
|
||||
OBJS = $(CSOURCES:.c=.obj)
|
||||
OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\)
|
||||
|
||||
#
|
||||
# Use $(OBJS) as a template to generate $(OBJS_STAT) and $(OBJS_DYN).
|
||||
#
|
||||
OBJ_DIR = $(OBJ_BASE)\stat
|
||||
OBJS_STAT = $+ $(OBJS) $-
|
||||
|
||||
OBJ_DIR = $(OBJ_BASE)\dyn
|
||||
OBJS_DYN = $+ $(OBJS) $-
|
||||
|
||||
ARESBUILDH = ares_build.h
|
||||
RESOURCE = $(OBJ_BASE)\dyn\cares.res
|
||||
|
||||
all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) $(DEMOS) .SYMBOLIC
|
||||
@echo Welcome to cares
|
||||
|
||||
$(OBJ_BASE):
|
||||
-$(MD) $^@
|
||||
-$(MD) $^@\stat
|
||||
-$(MD) $^@\dyn
|
||||
-$(MD) $^@\demos
|
||||
|
||||
$(ARESBUILDH): .EXISTSONLY
|
||||
$(CP) $^@.dist $^@
|
||||
|
||||
$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(LINK_ARG)
|
||||
$(LD) name $^@ @$]@
|
||||
|
||||
$(LIBNAME).lib: $(OBJS_STAT) $(LIB_ARG)
|
||||
$(AR) -q -b -c $^@ @$]@
|
||||
|
||||
adig.exe: $(OBJ_BASE)\demos\adig.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
|
||||
|
||||
ahost.exe: $(OBJ_BASE)\demos\ahost.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
|
||||
|
||||
acountry.exe: $(OBJ_BASE)\demos\acountry.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
|
||||
|
||||
clean: .SYMBOLIC
|
||||
-$(RM) $(OBJS_STAT)
|
||||
-$(RM) $(OBJS_DYN)
|
||||
-$(RM) $(RESOURCE) $(LINK_ARG) $(LIB_ARG)
|
||||
|
||||
vclean realclean: clean .SYMBOLIC
|
||||
-$(RM) $(TARGETS) $(LIBNAME).map
|
||||
-$(RM) $(DEMOS) $(DEMOS:.exe=.map)
|
||||
-$(RD) $(OBJ_BASE)\stat
|
||||
-$(RD) $(OBJ_BASE)\dyn
|
||||
-$(RD) $(OBJ_BASE)\demos
|
||||
-$(RD) $(OBJ_BASE)
|
||||
|
||||
.ERASE
|
||||
$(RESOURCE): cares.rc .AUTODEPEND
|
||||
$(RC) $(DEBUG) -q -r -zm -I..\include $(SYS_INCL) $[@ -fo=$^@
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_BASE)\dyn}.obj:
|
||||
$(CC) $(CFLAGS) -bd $[@ -fo=$^@
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_BASE)\stat}.obj:
|
||||
$(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_BASE)\demos}.obj:
|
||||
$(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@
|
||||
|
||||
$(LINK_ARG): $(__MAKEFILES__)
|
||||
%create $^@
|
||||
@%append $^@ system nt dll
|
||||
@%append $^@ file { $(OBJS_DYN) }
|
||||
@%append $^@ option res=$(RESOURCE), implib=$(LIBNAME)_imp.lib
|
||||
@%append $^@ $(LFLAGS)
|
||||
@%append $^@ libpath $(SYS_LIBS)
|
||||
# @%append $^@ library clib3r.lib
|
||||
!ifdef %use_watt32
|
||||
@%append $^@ library $(%watt_root)\lib\wattcpw_imp.lib
|
||||
!else
|
||||
@%append $^@ library ws2_32.lib
|
||||
!endif
|
||||
|
||||
$(LIB_ARG): $(__MAKEFILES__)
|
||||
%create $^@
|
||||
@for %f in ($(OBJS_STAT)) do @%append $^@ +- %f
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
|
||||
ACLOCAL_AMFLAGS = -I m4 --install
|
||||
|
||||
MSVCFILES = msvc_ver.inc buildconf.bat
|
||||
|
||||
# adig and ahost are just sample programs and thus not mentioned with the
|
||||
# regular sources and headers
|
||||
EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES \
|
||||
c-ares-config.cmake.in libcares.pc.cmake libcares.pc.in buildconf get_ver.awk \
|
||||
maketgz TODO README.msvc $(MSVCFILES) INSTALL.md README.md LICENSE.md \
|
||||
CMakeLists.txt Makefile.dj Makefile.m32 Makefile.netware Makefile.msvc \
|
||||
Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO
|
||||
|
||||
|
||||
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
|
||||
|
||||
DISTCLEANFILES = include/ares_build.h
|
||||
|
||||
DIST_SUBDIRS = include src test docs
|
||||
|
||||
SUBDIRS = @BUILD_SUBDIRS@
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libcares.pc
|
||||
|
||||
# where to install the c-ares headers
|
||||
libcares_ladir = $(includedir)
|
||||
|
||||
|
||||
# Make files named *.dist replace the file without .dist extension
|
||||
dist-hook:
|
||||
find $(distdir) -name "*.dist" -exec rm {} \;
|
||||
(distit=`find $(srcdir) -name "*.dist"`; \
|
||||
for file in $$distit; do \
|
||||
strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
|
||||
cp $$file $(distdir)$$strip; \
|
||||
done)
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
#
|
||||
# c-ares Makefile for djgpp/gcc/Watt-32.
|
||||
# By Gisle Vanem <gvanem@yahoo.no> 2004 - 2020.
|
||||
#
|
||||
include src/lib/Makefile.inc
|
||||
|
||||
CSOURCES := $(addprefix src/lib/, $(CSOURCES))
|
||||
CSOURCES := $(filter-out src/lib/windows_port.c, $(CSOURCES))
|
||||
|
||||
VPATH = src/lib src/tools
|
||||
|
||||
#
|
||||
# Root directory for Waterloo tcp/ip.
|
||||
# WATT_ROOT should be set during Watt-32 install.
|
||||
#
|
||||
WATT32_ROOT = $(realpath $(WATT_ROOT))
|
||||
WATT32_LIB = $(WATT32_ROOT)/lib/libwatt.a
|
||||
|
||||
OBJ_DIR = djgpp
|
||||
|
||||
CFLAGS = -g -O2 -I./include -I./src/lib \
|
||||
-I$(WATT32_ROOT)/inc -Wall \
|
||||
-DWATT32 -DHAVE_CONFIG_H \
|
||||
-Dselect=select_s
|
||||
|
||||
LDFLAGS = -s
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
#
|
||||
# Windows hosted djgpp cross compiler. Get it from:
|
||||
# https://github.com/andrewwutw/build-djgpp/releases
|
||||
#
|
||||
DJ_PREFIX ?= c:/some-path/djgpp/bin/i586-pc-msdosdjgpp-
|
||||
CC = $(DJ_PREFIX)gcc
|
||||
|
||||
else
|
||||
#
|
||||
# The normal djgpp 'gcc' for MSDOS.
|
||||
#
|
||||
CC = gcc
|
||||
endif
|
||||
|
||||
OBJECTS = $(addprefix $(OBJ_DIR)/, \
|
||||
$(notdir $(CSOURCES:.c=.o)))
|
||||
|
||||
GENERATED = src/lib/ares_config.h \
|
||||
include/ares_build.h
|
||||
|
||||
TARGETS = libcares.a acountry.exe adig.exe ahost.exe
|
||||
|
||||
.SECONDARY: $(OBJ_DIR)/ares_getopt.o
|
||||
|
||||
all: $(OBJ_DIR) $(GENERATED) $(TARGETS)
|
||||
@echo Welcome to c-ares.
|
||||
|
||||
libcares.a: $(OBJECTS)
|
||||
ar rs $@ $(OBJECTS)
|
||||
|
||||
src/lib/ares_config.h: src/lib/config-dos.h
|
||||
cp --update $< $@
|
||||
|
||||
include/ares_build.h: include/ares_build.h.dist
|
||||
cp --update $< $@
|
||||
|
||||
%.exe: src/tools/%.c $(OBJ_DIR)/ares_getopt.o libcares.a
|
||||
$(call compile_and_link, $@, $^ $(WATT32_LIB))
|
||||
|
||||
# Clean generated files and objects.
|
||||
#
|
||||
clean:
|
||||
- rm -f depend.dj $(GENERATED) $(OBJ_DIR)/*.o
|
||||
- rmdir $(OBJ_DIR)
|
||||
|
||||
# Clean everything
|
||||
#
|
||||
realclean vclean: clean
|
||||
- rm -f $(TARGETS) $(TARGETS:.exe=.map)
|
||||
|
||||
$(OBJ_DIR):
|
||||
- mkdir $@
|
||||
|
||||
$(OBJ_DIR)/%.o: %.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
@echo
|
||||
|
||||
define compile_and_link
|
||||
$(CC) -o $(1) $(CFLAGS) $(LDFLAGS) -Wl,--print-map,--sort-common $(2) > $(1:.exe=.map)
|
||||
@echo
|
||||
endef
|
||||
|
||||
DEP_REPLACE = sed -e 's@\(.*\)\.o: @\n$$(OBJ_DIR)\/\1.o: @' \
|
||||
-e 's@$(WATT32_ROOT)@$$(WATT32_ROOT)@g'
|
||||
|
||||
#
|
||||
# One may have to do 'make -f Makefile.dj clean' first in case
|
||||
# a foreign 'curl_config.h' is making trouble.
|
||||
#
|
||||
depend: $(GENERATED) Makefile.dj
|
||||
$(CC) -MM $(CFLAGS) $(CSOURCES) | $(DEP_REPLACE) > depend.dj
|
||||
|
||||
-include depend.dj
|
||||
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
#############################################################
|
||||
#
|
||||
## Makefile for building libcares.a with MingW32 (GCC-3.2)
|
||||
## Use: make -f Makefile.m32 [demos]
|
||||
##
|
||||
## Quick hack by Guenter; comments to: /dev/nul
|
||||
#
|
||||
########################################################
|
||||
## Nothing more to do below this line!
|
||||
|
||||
LIB = src/lib/libcares.a
|
||||
|
||||
AR = $(CROSSPREFIX)ar
|
||||
CC = $(CROSSPREFIX)gcc
|
||||
LD = $(CROSSPREFIX)gcc
|
||||
RANLIB = $(CROSSPREFIX)ranlib
|
||||
#RM = rm -f
|
||||
CP = cp -afv
|
||||
|
||||
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0600
|
||||
CFLAGS += -DCARES_STATICLIB
|
||||
LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
|
||||
LIBS = -lwsock32
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include src/lib/Makefile.inc
|
||||
|
||||
OBJLIB := $(patsubst %.c,src/lib/%.o,$(strip $(CSOURCES)))
|
||||
|
||||
|
||||
$(LIB): $(OBJLIB)
|
||||
$(AR) cru $@ $^
|
||||
$(RANLIB) $@
|
||||
|
||||
all: $(LIB) demos
|
||||
|
||||
demos: src/tools/adig.exe src/tools/ahost.exe src/tools/acountry.exe
|
||||
|
||||
tags:
|
||||
etags *.[ch]
|
||||
|
||||
%.exe: %.o src/tools/ares_getopt.o $(LIB)
|
||||
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
$(OBJLIB): include/ares.h include/ares_dns.h include/ares_build.h
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
include/ares_build.h:
|
||||
$(CP) include/ares_build.h.dist include/ares_build.h
|
||||
|
||||
check:
|
||||
|
||||
install:
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
|
||||
${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
|
||||
${RANLIB} ${DESTDIR}${libdir}/$(LIB)
|
||||
chmod u-w ${DESTDIR}${libdir}/$(LIB)
|
||||
${INSTALL} -m 444 ${srcdir}/include/ares.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/include/ares_build.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/include/ares_rules.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/include/ares_version.h ${DESTDIR}${includedir}
|
||||
(for man in $(MANPAGES); do \
|
||||
${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
|
||||
done)
|
||||
|
||||
clean:
|
||||
$(RM) src/tools/ares_getopt.o $(OBJLIB) $(LIB) src/tools/adig.exe src/tools/ahost.exe src/tools/acountry.exe
|
||||
|
||||
distclean: clean
|
||||
$(RM) config.cache config.log config.status Makefile
|
||||
ifeq "$(wildcard include/ares_build.h.dist)" "include/ares_build.h.dist"
|
||||
$(RM) include/ares_build.h
|
||||
endif
|
||||
|
|
@ -0,0 +1,491 @@
|
|||
|
||||
# Copyright (C) 2009-2013 by Daniel Stenberg
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose and without
|
||||
# fee is hereby granted, provided that the above copyright
|
||||
# notice appear in all copies and that both that copyright
|
||||
# notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in
|
||||
# advertising or publicity pertaining to distribution of the
|
||||
# software without specific, written prior permission.
|
||||
# M.I.T. makes no representations about the suitability of
|
||||
# this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile for building c-ares libraries and sample programs with MSVC.
|
||||
#
|
||||
# Usage: nmake /f makefile.msvc CFG=<config> <target>
|
||||
#
|
||||
# <config> must be one of: [ lib-release | lib-debug | dll-release | dll-debug }
|
||||
# <target> must be one of: [ ALL | c-ares | acountry | adig | ahost | clean }
|
||||
#
|
||||
# If a <target> other than ALL or clean is given, <config> becomes mandatory.
|
||||
#
|
||||
# If neither <config> nor <target> are specified this results in
|
||||
# all targets being built for all <config> c-ares library types.
|
||||
#
|
||||
# This makefile must be processed from the subdir where it is located.
|
||||
#
|
||||
# All results are generated below a subdirectory named msvcXXX.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
NAME = cares
|
||||
|
||||
# ------------------------------------------------
|
||||
# c-ares static and dynamic libraries common base
|
||||
# file names for release and debug configurations
|
||||
# ------------------------------------------------
|
||||
|
||||
STA_LIB_REL = lib$(NAME)
|
||||
DYN_LIB_REL = $(NAME)
|
||||
STA_LIB_DBG = $(STA_LIB_REL)d
|
||||
DYN_LIB_DBG = $(DYN_LIB_REL)d
|
||||
|
||||
# -------------------------------------------
|
||||
# Base names for c-ares DLL import libraries
|
||||
# -------------------------------------------
|
||||
|
||||
IMP_LIB_REL = $(DYN_LIB_REL)
|
||||
IMP_LIB_DBG = $(DYN_LIB_DBG)
|
||||
|
||||
# --------------------------
|
||||
# Runtime library selection
|
||||
# --------------------------
|
||||
|
||||
RTLIB = /MD
|
||||
RTLIBD = /MDd
|
||||
|
||||
!IF "$(RTLIBCFG)" == "static"
|
||||
RTLIB = /MT
|
||||
RTLIBD = /MTd
|
||||
!ENDIF
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Define USE_WATT32 to 1 to use the Watt-32 tcp/ip stack,
|
||||
# otherwise Winsock tcp/ip stack will be used as default.
|
||||
# --------------------------------------------------------
|
||||
|
||||
USE_WATT32 = 0
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Detect compiler version.
|
||||
# --------------------------------------------------------
|
||||
!INCLUDE .\msvc_ver.inc
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Verify that current subdir is the c-ares source one
|
||||
# ----------------------------------------------------
|
||||
|
||||
!IF ! EXIST(.\src\lib\ares_init.c)
|
||||
! MESSAGE Can not process Makefile.msvc from outside of c-ares source subdirectory.
|
||||
! MESSAGE Change to the subdirectory where Makefile.msvc is found, and try again.
|
||||
! ERROR See previous message.
|
||||
!ENDIF
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Base subdir is the common root from which other subdirs will hang.
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
BASE_DIR = .\msvc
|
||||
|
||||
# ----------------------------------------
|
||||
# Subdir holding sources for all projects
|
||||
# ----------------------------------------
|
||||
|
||||
SRCDIR = .
|
||||
|
||||
# -----------------------------
|
||||
# Default installation subdirs
|
||||
# -----------------------------
|
||||
|
||||
!IFNDEF INSTALL_DIR
|
||||
INSTALL_DIR = .
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF INSTALL_DIR_LIB
|
||||
INSTALL_DIR_LIB = $(INSTALL_DIR)\lib
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF INSTALL_DIR_INC
|
||||
INSTALL_DIR_INC = $(INSTALL_DIR)\include
|
||||
!ENDIF
|
||||
|
||||
# -------------------------
|
||||
# Configuration validation
|
||||
# -------------------------
|
||||
|
||||
VALID_CFGSET = FALSE
|
||||
!IF "$(CFG)" == "lib-release" || "$(CFG)" == "lib-debug" || \
|
||||
"$(CFG)" == "dll-release" || "$(CFG)" == "dll-debug"
|
||||
VALID_CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
!IF "$(VALID_CFGSET)" == "FALSE" && "$(CFG)" != ""
|
||||
! MESSAGE MSVC c-ares makefile
|
||||
! MESSAGE
|
||||
! MESSAGE Usage: nmake /f makefile.msvc CFG=<config> <target>
|
||||
! MESSAGE
|
||||
! MESSAGE <config> must be one of: [ lib-release | lib-debug | dll-release | dll-debug }
|
||||
! MESSAGE <target> must be one of: [ ALL | c-ares | acountry | adig | ahost | clean }
|
||||
! MESSAGE
|
||||
! MESSAGE If a <target> other than ALL or clean is given, <config> becomes mandatory.
|
||||
! MESSAGE
|
||||
! MESSAGE If neither <config> nor <target> are specified this results in
|
||||
! MESSAGE all targets being built for all <config> c-ares library types.
|
||||
! MESSAGE
|
||||
! ERROR Choose a valid configuration.
|
||||
!ENDIF
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Project subdirs independent of configuration being used
|
||||
# --------------------------------------------------------
|
||||
|
||||
CARES_DIR = $(BASE_DIR)\cares
|
||||
PROG1_DIR = $(BASE_DIR)\acountry
|
||||
PROG2_DIR = $(BASE_DIR)\adig
|
||||
PROG3_DIR = $(BASE_DIR)\ahost
|
||||
|
||||
# ---------------------------------------------------
|
||||
# Subdirs which are configuration dependent are only
|
||||
# defined when a valid configuration has been given.
|
||||
# ---------------------------------------------------
|
||||
|
||||
!IF "$(VALID_CFGSET)" == "TRUE"
|
||||
CARES_OUTDIR = $(CARES_DIR)\$(CFG)
|
||||
PROG1_OUTDIR = $(PROG1_DIR)\$(CFG)
|
||||
PROG2_OUTDIR = $(PROG2_DIR)\$(CFG)
|
||||
PROG3_OUTDIR = $(PROG3_DIR)\$(CFG)
|
||||
CARES_OBJDIR = $(CARES_OUTDIR)\obj
|
||||
PROG1_OBJDIR = $(PROG1_OUTDIR)\obj
|
||||
PROG2_OBJDIR = $(PROG2_OUTDIR)\obj
|
||||
PROG3_OBJDIR = $(PROG3_OUTDIR)\obj
|
||||
!ELSE
|
||||
!UNDEF CARES_OUTDIR
|
||||
!UNDEF PROG1_OUTDIR
|
||||
!UNDEF PROG2_OUTDIR
|
||||
!UNDEF PROG3_OUTDIR
|
||||
!UNDEF CARES_OBJDIR
|
||||
!UNDEF PROG1_OBJDIR
|
||||
!UNDEF PROG2_OBJDIR
|
||||
!UNDEF PROG3_OBJDIR
|
||||
!ENDIF
|
||||
|
||||
# -------------------------------------
|
||||
# Settings that depend on tcp/ip stack
|
||||
# -------------------------------------
|
||||
|
||||
!IF "$(USE_WATT32)" == "1"
|
||||
CFLAGS = /UWIN32 /DWATT32 /I$(WATT_ROOT)\inc
|
||||
EX_LIBS_REL = $(WATT_ROOT)\lib\wattcpvc_imp.lib
|
||||
EX_LIBS_DBG = $(WATT_ROOT)\lib\wattcpvc_imp_d.lib
|
||||
!ELSE
|
||||
CFLAGS = /DWIN32 /D_WIN32_WINNT=0x0600
|
||||
EX_LIBS_REL = ws2_32.lib advapi32.lib kernel32.lib
|
||||
EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib
|
||||
!ENDIF
|
||||
|
||||
# -------------------------------------------------
|
||||
# Switches that depend on ancient compiler versions
|
||||
# -------------------------------------------------
|
||||
|
||||
!IF $(CC_VERS_NUM) == 60
|
||||
PDB_NONE = /pdb:none
|
||||
PDBTYPE_CONSOLIDATE = /pdbtype:consolidate
|
||||
!ELSE
|
||||
!UNDEF PDB_NONE
|
||||
!UNDEF PDBTYPE_CONSOLIDATE
|
||||
!ENDIF
|
||||
|
||||
!IF $(CC_VERS_NUM) <= 70
|
||||
RT_ERROR_CHECKING = /GZ
|
||||
!ELSE
|
||||
RT_ERROR_CHECKING = /RTCsu
|
||||
!ENDIF
|
||||
|
||||
# ----------------------------
|
||||
# Assorted commands and flags
|
||||
# ----------------------------
|
||||
|
||||
CC_CMD_REL = cl.exe /nologo $(RTLIB) /DNDEBUG /O2
|
||||
CC_CMD_DBG = cl.exe /nologo $(RTLIBD) /D_DEBUG /Od /Zi $(RT_ERROR_CHECKING)
|
||||
CC_CFLAGS = $(CFLAGS) /I.\src\lib /I.\include /W3 /EHsc /FD
|
||||
|
||||
RC_CMD_REL = rc.exe /l 0x409 /d "NDEBUG"
|
||||
RC_CMD_DBG = rc.exe /l 0x409 /d "_DEBUG"
|
||||
|
||||
LINK_CMD_LIB = link.exe /lib /nologo
|
||||
LINK_CMD_DLL = link.exe /dll /nologo /incremental:no /fixed:no
|
||||
LINK_CMD_EXE = link.exe /nologo /incremental:no /fixed:no /subsystem:console
|
||||
|
||||
LINK_CMD_EXE_REL = $(LINK_CMD_EXE) /release $(PDB_NONE)
|
||||
LINK_CMD_EXE_DBG = $(LINK_CMD_EXE) /debug $(PDBTYPE_CONSOLIDATE)
|
||||
|
||||
# ---------------------------------
|
||||
# Configuration dependent settings
|
||||
# ---------------------------------
|
||||
|
||||
!IF "$(CFG)" == "lib-release"
|
||||
CARES_TARGET = $(STA_LIB_REL).lib
|
||||
CARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DCARES_STATICLIB
|
||||
CARES_LFLAGS =
|
||||
SPROG_CFLAGS = /DCARES_STATICLIB
|
||||
SPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_REL) $(STA_LIB_REL).lib
|
||||
CARES_LINK = $(LINK_CMD_LIB)
|
||||
SPROG_LINK = $(LINK_CMD_EXE_REL)
|
||||
CC_CMD = $(CC_CMD_REL)
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "lib-debug"
|
||||
CARES_TARGET = $(STA_LIB_DBG).lib
|
||||
CARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DCARES_STATICLIB /DDEBUGBUILD
|
||||
CARES_LFLAGS =
|
||||
SPROG_CFLAGS = /DCARES_STATICLIB
|
||||
SPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_DBG) $(STA_LIB_DBG).lib
|
||||
CARES_LINK = $(LINK_CMD_LIB)
|
||||
SPROG_LINK = $(LINK_CMD_EXE_DBG)
|
||||
CC_CMD = $(CC_CMD_DBG)
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "dll-release"
|
||||
CARES_TARGET = $(DYN_LIB_REL).dll
|
||||
CARES_CFLAGS = /DCARES_BUILDING_LIBRARY
|
||||
CARES_LFLAGS = /release $(EX_LIBS_REL) /implib:$(CARES_OUTDIR)\$(IMP_LIB_REL).lib $(PDB_NONE)
|
||||
SPROG_CFLAGS =
|
||||
SPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_REL) $(IMP_LIB_REL).lib
|
||||
CARES_LINK = $(LINK_CMD_DLL)
|
||||
SPROG_LINK = $(LINK_CMD_EXE_REL)
|
||||
CC_CMD = $(CC_CMD_REL)
|
||||
USE_RES_FILE = TRUE
|
||||
RC_CMD = $(RC_CMD_REL)
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "dll-debug"
|
||||
CARES_TARGET = $(DYN_LIB_DBG).dll
|
||||
CARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DDEBUGBUILD
|
||||
CARES_LFLAGS = /debug $(EX_LIBS_DBG) /implib:$(CARES_OUTDIR)\$(IMP_LIB_DBG).lib /pdb:$(CARES_OUTDIR)\$(DYN_LIB_DBG).pdb $(PDBTYPE_CONSOLIDATE)
|
||||
SPROG_CFLAGS =
|
||||
SPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_DBG) $(IMP_LIB_DBG).lib
|
||||
CARES_LINK = $(LINK_CMD_DLL)
|
||||
SPROG_LINK = $(LINK_CMD_EXE_DBG)
|
||||
CC_CMD = $(CC_CMD_DBG)
|
||||
USE_RES_FILE = TRUE
|
||||
RC_CMD = $(RC_CMD_DBG)
|
||||
!ENDIF
|
||||
|
||||
# --------------------------------------------
|
||||
# Makefile.inc provides lists of source files
|
||||
# --------------------------------------------
|
||||
|
||||
!INCLUDE .\src\lib\Makefile.inc
|
||||
!INCLUDE .\src\tools\Makefile.inc
|
||||
|
||||
# ----------------------------
|
||||
# Build lists of object files
|
||||
# ----------------------------
|
||||
|
||||
!IF "$(VALID_CFGSET)" == "TRUE"
|
||||
|
||||
!IF [ECHO CARES_OBJS=^$(CARES_OBJDIR)\$(CSOURCES: = $(CARES_OBJDIR^)\) > .\cares_objs.inc] == 0
|
||||
!INCLUDE .\cares_objs.inc
|
||||
!IF [DEL .\cares_objs.inc]
|
||||
!ENDIF
|
||||
!ELSE
|
||||
!ERROR Problem generating CARES_OBJS list.
|
||||
!ENDIF
|
||||
CARES_OBJS = $(CARES_OBJS:.c=.obj)
|
||||
!IF "$(USE_RES_FILE)" == "TRUE"
|
||||
CARES_OBJS = $(CARES_OBJS) $(CARES_OBJDIR)\cares.res
|
||||
!ENDIF
|
||||
|
||||
!IF [ECHO PROG1_OBJS=^$(PROG1_OBJDIR)\$(SAMPLESOURCES: = $(PROG1_OBJDIR^)\) > .\prog1_objs.inc] == 0
|
||||
!INCLUDE .\prog1_objs.inc
|
||||
!IF [DEL .\prog1_objs.inc]
|
||||
!ENDIF
|
||||
!ELSE
|
||||
!ERROR Problem generating PROG1_OBJS list.
|
||||
!ENDIF
|
||||
PROG1_OBJS = $(PROG1_OBJS:.c=.obj)
|
||||
PROG1_OBJS = $(PROG1_OBJS:/=\)
|
||||
PROG1_OBJS = $(PROG1_OBJS) $(PROG1_OBJDIR)\acountry.obj
|
||||
|
||||
!IF [ECHO PROG2_OBJS=^$(PROG2_OBJDIR)\$(SAMPLESOURCES: = $(PROG2_OBJDIR^)\) > .\prog2_objs.inc] == 0
|
||||
!INCLUDE .\prog2_objs.inc
|
||||
!IF [DEL .\prog2_objs.inc]
|
||||
!ENDIF
|
||||
!ELSE
|
||||
!ERROR Problem generating PROG2_OBJS list.
|
||||
!ENDIF
|
||||
PROG2_OBJS = $(PROG2_OBJS:.c=.obj)
|
||||
PROG2_OBJS = $(PROG2_OBJS:/=\)
|
||||
PROG2_OBJS = $(PROG2_OBJS) $(PROG2_OBJDIR)\adig.obj
|
||||
|
||||
!IF [ECHO PROG3_OBJS=^$(PROG3_OBJDIR)\$(SAMPLESOURCES: = $(PROG3_OBJDIR^)\) > .\prog3_objs.inc] == 0
|
||||
!INCLUDE .\prog3_objs.inc
|
||||
!IF [DEL .\prog3_objs.inc]
|
||||
!ENDIF
|
||||
!ELSE
|
||||
!ERROR Problem generating PROG3_OBJS list.
|
||||
!ENDIF
|
||||
PROG3_OBJS = $(PROG3_OBJS:.c=.obj)
|
||||
PROG3_OBJS = $(PROG3_OBJS:/=\)
|
||||
PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
# --------------------------------
|
||||
# Only our custom inference rules
|
||||
# --------------------------------
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .rc
|
||||
|
||||
{$(SRCDIR)\src\lib}.rc{$(CARES_OBJDIR)}.res:
|
||||
$(RC_CMD) /Fo $@ $<
|
||||
|
||||
{$(SRCDIR)\src\lib}.c{$(CARES_OBJDIR)}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
|
||||
|
||||
{$(SRCDIR)\src\tools}.c{$(PROG1_OBJDIR)}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
|
||||
|
||||
{$(SRCDIR)\src\tools}.c{$(PROG2_OBJDIR)}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
|
||||
|
||||
{$(SRCDIR)\src\tools}.c{$(PROG3_OBJDIR)}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
|
||||
|
||||
# Hack Alert! we reference ../lib/ files in the Makefile.inc for tools as they
|
||||
# share some files with the library itself. We need to hack around that here.
|
||||
|
||||
{$(SRCDIR)\src\lib}.c{$(PROG1_OBJDIR)\..\lib}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG1_OBJDIR)\$(@F) /Fd$(PROG1_OBJDIR)\ /c $<
|
||||
|
||||
{$(SRCDIR)\src\lib}.c{$(PROG2_OBJDIR)\..\lib}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\$(@F) /Fd$(PROG2_OBJDIR)\ /c $<
|
||||
|
||||
{$(SRCDIR)\src\lib}.c{$(PROG3_OBJDIR)\..\lib}.obj:
|
||||
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG3_OBJDIR)\$(@F) /Fd$(PROG3_OBJDIR)\ /c $<
|
||||
|
||||
# ------------------------------------------------------------- #
|
||||
# ------------------------------------------------------------- #
|
||||
# Default target when no CFG library type has been specified, #
|
||||
# results in building target ALL for all c-ares library types. #
|
||||
# ------------------------------------------------------------- #
|
||||
# ------------------------------------------------------------- #
|
||||
|
||||
!IF "$(VALID_CFGSET)" == "FALSE"
|
||||
|
||||
ALL:
|
||||
$(MAKE) /NOLOGO /f .\Makefile.msvc CFG=lib-release ALL
|
||||
$(MAKE) /NOLOGO /f .\Makefile.msvc CFG=lib-debug ALL
|
||||
$(MAKE) /NOLOGO /f .\Makefile.msvc CFG=dll-release ALL
|
||||
$(MAKE) /NOLOGO /f .\Makefile.msvc CFG=dll-debug ALL
|
||||
|
||||
clean:
|
||||
@-RMDIR /S /Q $(BASE_DIR) >NUL 2>&1
|
||||
|
||||
install:
|
||||
@$(MAKE) /nologo /f .\Makefile.msvc CFG=lib-release install
|
||||
@$(MAKE) /nologo /f .\Makefile.msvc CFG=lib-debug install
|
||||
@$(MAKE) /nologo /f .\Makefile.msvc CFG=dll-release install
|
||||
@$(MAKE) /nologo /f .\Makefile.msvc CFG=dll-debug install
|
||||
|
||||
!ENDIF
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Targets only available when a proper CFG library type has been given
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
!IF "$(VALID_CFGSET)" == "TRUE"
|
||||
|
||||
ALL: c-ares acountry adig ahost
|
||||
@
|
||||
|
||||
# $(HHEADERS) $(CSOURCES)
|
||||
c-ares: $(CARES_OBJDIR) $(CARES_OBJS) $(CARES_OUTDIR)
|
||||
$(CARES_LINK) $(CARES_LFLAGS) /out:$(CARES_OUTDIR)\$(CARES_TARGET) $(CARES_OBJS)
|
||||
! IF "$(USE_RES_FILE)" == "TRUE"
|
||||
@if exist $(CARES_OUTDIR)\$(CARES_TARGET).manifest mt -nologo -manifest $(CARES_OUTDIR)\$(CARES_TARGET).manifest -outputresource:$(CARES_OUTDIR)\$(CARES_TARGET);2
|
||||
! ENDIF
|
||||
|
||||
# acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
|
||||
acountry: c-ares $(PROG1_OBJDIR) $(PROG1_OBJS) $(PROG1_OUTDIR)
|
||||
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG1_OUTDIR)\acountry.exe $(PROG1_OBJS:..\lib=)
|
||||
@if exist $(PROG1_OUTDIR)\acountry.exe.manifest mt -nologo -manifest $(PROG1_OUTDIR)\acountry.exe.manifest -outputresource:$(PROG1_OUTDIR)\acountry.exe;1
|
||||
|
||||
# adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
|
||||
adig: c-ares $(PROG2_OBJDIR) $(PROG2_OBJS) $(PROG2_OUTDIR)
|
||||
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG2_OUTDIR)\adig.exe $(PROG2_OBJS:..\lib=)
|
||||
@if exist $(PROG2_OUTDIR)\adig.exe.manifest mt -nologo -manifest $(PROG2_OUTDIR)\adig.exe.manifest -outputresource:$(PROG2_OUTDIR)\adig.exe;1
|
||||
|
||||
# ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
|
||||
ahost: c-ares $(PROG3_OBJDIR) $(PROG3_OBJS) $(PROG3_OUTDIR)
|
||||
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG3_OUTDIR)\ahost.exe $(PROG3_OBJS:..\lib=)
|
||||
@if exist $(PROG3_OUTDIR)\ahost.exe.manifest mt -nologo -manifest $(PROG3_OUTDIR)\ahost.exe.manifest -outputresource:$(PROG3_OUTDIR)\ahost.exe;1
|
||||
|
||||
$(CARES_OUTDIR): $(CARES_DIR)
|
||||
@if not exist $(CARES_OUTDIR) mkdir $(CARES_OUTDIR)
|
||||
|
||||
$(PROG1_OUTDIR): $(PROG1_DIR)
|
||||
@if not exist $(PROG1_OUTDIR) mkdir $(PROG1_OUTDIR)
|
||||
|
||||
$(PROG2_OUTDIR): $(PROG2_DIR)
|
||||
@if not exist $(PROG2_OUTDIR) mkdir $(PROG2_OUTDIR)
|
||||
|
||||
$(PROG3_OUTDIR): $(PROG3_DIR)
|
||||
@if not exist $(PROG3_OUTDIR) mkdir $(PROG3_OUTDIR)
|
||||
|
||||
$(CARES_OBJDIR): $(CARES_OUTDIR)
|
||||
@if not exist $(CARES_OBJDIR) mkdir $(CARES_OBJDIR)
|
||||
|
||||
$(PROG1_OBJDIR): $(PROG1_OUTDIR)
|
||||
@if not exist $(PROG1_OBJDIR) mkdir $(PROG1_OBJDIR)
|
||||
|
||||
$(PROG2_OBJDIR): $(PROG2_OUTDIR)
|
||||
@if not exist $(PROG2_OBJDIR) mkdir $(PROG2_OBJDIR)
|
||||
|
||||
$(PROG3_OBJDIR): $(PROG3_OUTDIR)
|
||||
@if not exist $(PROG3_OBJDIR) mkdir $(PROG3_OBJDIR)
|
||||
|
||||
clean:
|
||||
@-RMDIR /S /Q $(CARES_OUTDIR) >NUL 2>&1
|
||||
@-RMDIR /S /Q $(PROG1_OUTDIR) >NUL 2>&1
|
||||
@-RMDIR /S /Q $(PROG2_OUTDIR) >NUL 2>&1
|
||||
@-RMDIR /S /Q $(PROG3_OUTDIR) >NUL 2>&1
|
||||
|
||||
install:
|
||||
@if not exist $(CARES_OUTDIR)\$(CARES_TARGET) \
|
||||
$(MAKE) /f .\Makefile.msvc CFG=$(CFG) c-ares
|
||||
@if not exist "$(INSTALL_DIR)" mkdir "$(INSTALL_DIR)"
|
||||
@if not exist "$(INSTALL_DIR_LIB)" mkdir "$(INSTALL_DIR_LIB)"
|
||||
@if not exist "$(INSTALL_DIR_INC)" mkdir "$(INSTALL_DIR_INC)"
|
||||
@copy /y $(CARES_OUTDIR)\*.* "$(INSTALL_DIR_LIB)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares_build.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares_rules.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares_version.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@echo Installed c-ares $(CFG)
|
||||
|
||||
!ENDIF
|
||||
|
||||
$(BASE_DIR):
|
||||
@if not exist $(BASE_DIR) mkdir $(BASE_DIR)
|
||||
|
||||
$(CARES_DIR): $(BASE_DIR)
|
||||
@if not exist $(CARES_DIR) mkdir $(CARES_DIR)
|
||||
|
||||
$(PROG1_DIR): $(BASE_DIR)
|
||||
@if not exist $(PROG1_DIR) mkdir $(PROG1_DIR)
|
||||
|
||||
$(PROG2_DIR): $(BASE_DIR)
|
||||
@if not exist $(PROG2_DIR) mkdir $(PROG2_DIR)
|
||||
|
||||
$(PROG3_DIR): $(BASE_DIR)
|
||||
@if not exist $(PROG3_DIR) mkdir $(PROG3_DIR)
|
||||
|
||||
# End of Makefile.msvc
|
||||
|
|
@ -0,0 +1,430 @@
|
|||
#################################################################
|
||||
#
|
||||
## Makefile for building libcares (NetWare version - gnu make)
|
||||
## Use: make -f Makefile.netware
|
||||
##
|
||||
## Comments to: Guenter Knauf http://www.gknw.de/phpbb
|
||||
#
|
||||
#################################################################
|
||||
|
||||
# Edit the path below to point to the base of your Novell NDK.
|
||||
ifndef NDKBASE
|
||||
NDKBASE = c:/novell
|
||||
endif
|
||||
|
||||
ifndef INSTDIR
|
||||
INSTDIR = ../ares-$(LIBCARES_VERSION_STR)-bin-nw
|
||||
endif
|
||||
|
||||
# Edit the vars below to change NLM target settings.
|
||||
TARGETS = adig.nlm ahost.nlm acountry.nlm
|
||||
LTARGET = libcares.$(LIBEXT)
|
||||
VERSION = $(LIBCARES_VERSION)
|
||||
COPYR = $(LIBCARES_COPYRIGHT_STR)
|
||||
DESCR = cURL $(subst .def,,$(notdir $@)) $(LIBCARES_VERSION_STR) - http://curl.haxx.se
|
||||
MTSAFE = YES
|
||||
STACK = 64000
|
||||
SCREEN = none
|
||||
#EXPORTS =
|
||||
# Comment the line below if you dont want to load protected automatically.
|
||||
#LDRING = 3
|
||||
|
||||
# Edit the var below to point to your lib architecture.
|
||||
ifndef LIBARCH
|
||||
LIBARCH = LIBC
|
||||
endif
|
||||
|
||||
# must be equal to NDEBUG or DEBUG
|
||||
ifndef DB
|
||||
DB = NDEBUG
|
||||
endif
|
||||
# Optimization: -O<n> or debugging: -g
|
||||
ifeq ($(DB),NDEBUG)
|
||||
OPT = -O2
|
||||
OBJDIR = release
|
||||
else
|
||||
OPT = -g
|
||||
OBJDIR = debug
|
||||
endif
|
||||
|
||||
# Include the version info retrieved from curlver.h
|
||||
-include $(OBJDIR)/version.inc
|
||||
|
||||
# The following lines defines your compiler.
|
||||
ifdef CWFolder
|
||||
METROWERKS = $(CWFolder)
|
||||
endif
|
||||
ifdef METROWERKS
|
||||
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
|
||||
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
|
||||
CC = mwccnlm
|
||||
else
|
||||
CC = gcc
|
||||
endif
|
||||
# a native win32 awk can be downloaded from here:
|
||||
# http://www.gknw.net/development/prgtools/awk-20070501.zip
|
||||
AWK = awk
|
||||
YACC = bison -y
|
||||
CP = cp -afv
|
||||
MKDIR = mkdir
|
||||
# RM = rm -f
|
||||
# if you want to mark the target as MTSAFE you will need a tool for
|
||||
# generating the xdc data for the linker; here's a minimal tool:
|
||||
# http://www.gknw.net/development/prgtools/mkxdc.zip
|
||||
MPKXDC = mkxdc
|
||||
|
||||
# Global flags for all compilers
|
||||
CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
|
||||
|
||||
ifeq ($(CC),mwccnlm)
|
||||
LD = mwldnlm
|
||||
LDFLAGS = -nostdlib $(PRELUDE) $(OBJEXE) $(<:.def=.o) -o $@ -commandfile
|
||||
AR = mwldnlm
|
||||
ARFLAGS = -nostdlib -type library -o
|
||||
LIBEXT = lib
|
||||
#RANLIB =
|
||||
CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
|
||||
CFLAGS += -relax_pointers
|
||||
#CFLAGS += -w on
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
||||
CFLAGS += -align 4
|
||||
else
|
||||
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
|
||||
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
|
||||
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
|
||||
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
|
||||
CFLAGS += -align 1
|
||||
endif
|
||||
else
|
||||
LD = nlmconv
|
||||
LDFLAGS = -T
|
||||
AR = ar
|
||||
ARFLAGS = -cq
|
||||
LIBEXT = a
|
||||
RANLIB = ranlib
|
||||
CFLAGS += -m32
|
||||
CFLAGS += -fno-builtin -fno-strict-aliasing
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
CFLAGS += -fpcc-struct-return
|
||||
endif
|
||||
CFLAGS += -Wall # -pedantic
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
|
||||
else
|
||||
# PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
|
||||
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
|
||||
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
|
||||
PRELUDE = $(NDK_ROOT)/pre/prelude.o
|
||||
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
|
||||
endif
|
||||
endif
|
||||
|
||||
NDK_ROOT = $(NDKBASE)/ndk
|
||||
SDK_CLIB = $(NDK_ROOT)/nwsdk
|
||||
SDK_LIBC = $(NDK_ROOT)/libc
|
||||
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
INCLUDES += -I$(SDK_LIBC)/include
|
||||
# INCLUDES += -I$(SDK_LIBC)/include/nks
|
||||
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
||||
CFLAGS += -D_POSIX_SOURCE
|
||||
else
|
||||
INCLUDES += -I$(SDK_CLIB)/include/nlm
|
||||
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
||||
# INCLUDES += -I$(SDK_CLIB)/include
|
||||
endif
|
||||
|
||||
CFLAGS += -I. $(INCLUDES)
|
||||
|
||||
ifeq ($(MTSAFE),YES)
|
||||
XDCOPT = -n
|
||||
endif
|
||||
ifeq ($(MTSAFE),NO)
|
||||
XDCOPT = -u
|
||||
endif
|
||||
|
||||
ifeq ($(findstring /sh,$(SHELL)),/sh)
|
||||
DL = '
|
||||
#-include $(NDKBASE)/nlmconv/ncpfs.inc
|
||||
endif
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
OBJLIB := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES)))
|
||||
OBJEXE = $(OBJLIB) $(OBJDIR)/ares_getopt.o
|
||||
|
||||
.PHONY: lib nlm prebuild dist install clean
|
||||
|
||||
lib: prebuild $(LTARGET)
|
||||
|
||||
nlm: prebuild $(TARGETS)
|
||||
|
||||
prebuild: $(OBJDIR) ares_build.h $(OBJDIR)/version.inc ares_config.h
|
||||
|
||||
install: $(INSTDIR) all
|
||||
@$(CP) *.nlm $(INSTDIR)
|
||||
@$(CP) ../CHANGES $(INSTDIR)
|
||||
@$(CP) ../COPYING $(INSTDIR)
|
||||
@$(CP) ../README $(INSTDIR)
|
||||
@$(CP) ../RELEASE-NOTES $(INSTDIR)
|
||||
|
||||
clean:
|
||||
-$(RM) $(LTARGET) $(TARGETS) ares_config.h
|
||||
-$(RM) -r $(OBJDIR)
|
||||
-$(RM) -r arpa
|
||||
|
||||
%.$(LIBEXT): $(OBJLIB)
|
||||
@echo Creating $@
|
||||
@-$(RM) $@
|
||||
@$(AR) $(ARFLAGS) $@ $^
|
||||
ifdef RANLIB
|
||||
@$(RANLIB) $@
|
||||
endif
|
||||
|
||||
%.nlm: $(OBJDIR)/%.def $(OBJDIR)/%.o $(OBJDIR)/%.xdc $(OBJEXE)
|
||||
@echo Linking $@
|
||||
@-$(RM) $@
|
||||
@$(LD) $(LDFLAGS) $<
|
||||
|
||||
$(OBJDIR) $(INSTDIR):
|
||||
@$(MKDIR) $@
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
# @echo Compiling $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/version.inc: ares_version.h $(OBJDIR)
|
||||
@echo Creating $@
|
||||
@$(AWK) -f get_ver.awk $< > $@
|
||||
|
||||
$(OBJDIR)/%.xdc: Makefile.netware
|
||||
@echo Creating $@
|
||||
@$(MPKXDC) $(XDCOPT) $@
|
||||
|
||||
$(OBJDIR)/%.def: Makefile.netware
|
||||
@echo Creating $@
|
||||
@echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
|
||||
@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
|
||||
@echo $(DL)# All your changes will be lost!!$(DL) >> $@
|
||||
@echo $(DL)#$(DL) >> $@
|
||||
@echo $(DL)copyright "$(COPYR)"$(DL) >> $@
|
||||
@echo $(DL)description "$(DESCR)"$(DL) >> $@
|
||||
@echo $(DL)version $(VERSION)$(DL) >> $@
|
||||
ifdef NLMTYPE
|
||||
@echo $(DL)type $(NLMTYPE)$(DL) >> $@
|
||||
endif
|
||||
ifdef STACK
|
||||
@echo $(DL)stack $(STACK)$(DL) >> $@
|
||||
endif
|
||||
ifdef SCREEN
|
||||
@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(DB),DEBUG)
|
||||
@echo $(DL)debug$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)threadname "$^"$(DL) >> $@
|
||||
ifdef XDCOPT
|
||||
@echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LDRING),0)
|
||||
@echo $(DL)flag_on 16$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LDRING),3)
|
||||
@echo $(DL)flag_on 512$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)start _Prelude$(DL) >> $@
|
||||
@echo $(DL)exit _Stop$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/clib.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
|
||||
@echo $(DL)module clib$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)flag_on 64$(DL) >> $@
|
||||
@echo $(DL)pseudopreemption$(DL) >> $@
|
||||
@echo $(DL)start _LibCPrelude$(DL) >> $@
|
||||
@echo $(DL)exit _LibCPostlude$(DL) >> $@
|
||||
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
|
||||
@echo $(DL)module libc$(DL) >> $@
|
||||
endif
|
||||
ifdef MODULES
|
||||
@echo $(DL)module $(MODULES)$(DL) >> $@
|
||||
endif
|
||||
ifdef EXPORTS
|
||||
@echo $(DL)export $(EXPORTS)$(DL) >> $@
|
||||
endif
|
||||
ifdef IMPORTS
|
||||
@echo $(DL)import $(IMPORTS)$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LD),nlmconv)
|
||||
@echo $(DL)input $(PRELUDE)$(DL) >> $@
|
||||
@echo $(DL)input $(OBJEXE)$(DL) >> $@
|
||||
@echo $(DL)input $(@:.def=.o)$(DL) >> $@
|
||||
@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
|
||||
endif
|
||||
|
||||
ares_config.h: Makefile.netware
|
||||
@echo Creating $@
|
||||
@echo $(DL)/* $@ for NetWare target.$(DL) > $@
|
||||
@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
|
||||
@echo $(DL)** All your changes will be lost!!$(DL) >> $@
|
||||
@echo $(DL)*/$(DL) >> $@
|
||||
@echo $(DL)#ifndef NETWARE$(DL) >> $@
|
||||
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
|
||||
@echo $(DL)#endif$(DL) >> $@
|
||||
@echo $(DL)#define VERSION "$(LIBCARES_VERSION_STR)"$(DL) >> $@
|
||||
@echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@
|
||||
ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRNICMP 1$(DL) >> $@
|
||||
@echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG2 char$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG2 void$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG6 size_t$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG2_IS_VOID 1$(DL) >> $@
|
||||
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETENV 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETHOSTNAME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LL 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_RECV 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SEND 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@
|
||||
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
|
||||
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
|
||||
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
|
||||
ifdef NW_WINSOCK
|
||||
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)#ifdef __GNUC__$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@
|
||||
@echo $(DL)#else$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@
|
||||
@echo $(DL)#endif$(DL) >> $@
|
||||
|
||||
FORCE: ;
|
||||
|
||||
ares_build.h: Makefile.netware FORCE
|
||||
@echo Creating $@
|
||||
@echo $(DL)/* $@ intended for NetWare target.$(DL) > $@
|
||||
@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
|
||||
@echo $(DL)** All your changes will be lost!!$(DL) >> $@
|
||||
@echo $(DL)*/$(DL) >> $@
|
||||
@echo $(DL)#ifndef NETWARE$(DL) >> $@
|
||||
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
|
||||
@echo $(DL)#endif$(DL) >> $@
|
||||
@echo $(DL)#ifndef __CARES_BUILD_H$(DL) >> $@
|
||||
@echo $(DL)#define __CARES_BUILD_H$(DL) >> $@
|
||||
ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T int$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;$(DL) >> $@
|
||||
@echo $(DL)#endif /* __CARES_BUILD_H */$(DL) >> $@
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
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.
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
c-ares
|
||||
======
|
||||
|
||||
This package is based on ares 1.1.1 (written by Greg Hudson). Daniel Stenberg
|
||||
decided to fork and release a separate project since the original ares author
|
||||
didn't want the improvements that were vital for our use of it.
|
||||
|
||||
This package is dubbed 'c-ares' since Daniel wanted this for use within the
|
||||
curl project (hence the letter C) and it makes a nice pun. c-ares is not API
|
||||
compatible with ares: a new name makes that more obvious to the public.
|
||||
|
||||
The original libares was distributed at
|
||||
ftp://athena-dist.mit.edu:pub/ATHENA/ares (which seems to not be alive
|
||||
anymore). A local copy of the original ares package is kept here:
|
||||
https://c-ares.haxx.se/download/ares-1.1.1.tar.gz
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
c-ares
|
||||
======
|
||||
|
||||
[](https://travis-ci.org/c-ares/c-ares)
|
||||
[](https://ci.appveyor.com/project/c-ares/c-ares/branch/master)
|
||||
[](https://coveralls.io/github/c-ares/c-ares?branch=master)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/291)
|
||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:c-ares)
|
||||
[](https://coderelease.io/github/repository/c-ares/c-ares)
|
||||
|
||||
This is c-ares, an asynchronous resolver library. It is intended for
|
||||
applications which need to perform DNS queries without blocking, or need to
|
||||
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](https://c-ares.haxx.se/download/),
|
||||
and in a git repository: http://github.com/c-ares/c-ares. See the
|
||||
[INSTALL.md](INSTALL.md) file for build information.
|
||||
|
||||
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:
|
||||
https://c-ares.haxx.se/
|
||||
|
||||
|
||||
Notes for c-ares hackers
|
||||
------------------------
|
||||
|
||||
* 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 to compile 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 */
|
||||
|
||||
* Try to keep line lengths below 80 columns.
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
|
||||
|
||||
___ __ _ _ __ ___ ___
|
||||
/ __| ___ / _` | '__/ _ \/ __|
|
||||
| (_ |___| (_| | | | __/\__ \
|
||||
\___| \__,_|_| \___||___/
|
||||
|
||||
|
||||
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 install using MSVC from the command line
|
||||
-----------------------------------------------
|
||||
|
||||
In order to allow easy usage of c-ares libraries it may be convenient to
|
||||
install c-ares libraries and header files to a common subdirectory tree.
|
||||
|
||||
Once that c-ares libraries have been built using procedure described above,
|
||||
use same command prompt window to define environment variable INSTALL_DIR
|
||||
to designate the top subdirectory where installation of c-ares libraries and
|
||||
header files will be done.
|
||||
|
||||
> set INSTALL_DIR=c:\c-ares
|
||||
|
||||
Afterwards, run following command to actually perform the installation:
|
||||
|
||||
> nmake -f Makefile.msvc install
|
||||
|
||||
Installation procedure will copy c-ares libraries to subdirectory 'lib' and
|
||||
c-ares header files to subdirectory 'include' below the INSTALL_DIR subdir.
|
||||
|
||||
When environment variable INSTALL_DIR is not defined, installation is done
|
||||
to c-ares source folder where Makefile.msvc file is located.
|
||||
|
||||
|
||||
|
||||
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!
|
||||
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
c-ares version 1.17.2
|
||||
|
||||
This is a security and bugfix release. It addresses a few security related
|
||||
issues along with various bugfixes mostly related to portability.
|
||||
|
||||
Security:
|
||||
o NodeJS passes NULL for addr and 0 for addrlen to ares_parse_ptr_reply() on
|
||||
systems where malloc(0) returns NULL. This would cause a crash. [8]
|
||||
o When building c-ares with CMake, the RANDOM_FILE would not be set and
|
||||
therefore downgrade to the less secure random number generator [12]
|
||||
o If ares_getaddrinfo() was terminated by an ares_destroy(), it would cause
|
||||
a crash [13]
|
||||
o Crash in sortaddrinfo() if the list size equals 0 due to an unexpected
|
||||
DNS response [14]
|
||||
o Expand number of escaped characters in DNS replies as per RFC1035 5.1 to
|
||||
prevent spoofing [16], [17]
|
||||
o Perform validation on hostnames to prevent possible XSS due to applications
|
||||
not performing valiation themselves [18]
|
||||
|
||||
Changes:
|
||||
o Use non-blocking /dev/urandom for random data to prevent early startup
|
||||
performance issues [5]
|
||||
o z/OS port [6]
|
||||
o ares_malloc(0) is now defined behavior (returns NULL) rather than
|
||||
system-specific to catch edge cases [7]
|
||||
|
||||
Bug fixes:
|
||||
o Fuzz testing files were not distributed with official archives [1]
|
||||
o Building tests should not force building of static libraries except on
|
||||
Windows [2]
|
||||
o Windows builds of the tools would fail if built as static due to a missing
|
||||
CARES_STATICLIB definition [3]
|
||||
o Relative headers must use double quotes to prevent pulling in a system
|
||||
library [4]
|
||||
o Fix OpenBSD building by implementing portability updates for including
|
||||
arpa/nameser.h [9]
|
||||
o Fix building out-of-tree for autotools [10]
|
||||
o Make install on MacOS/iOS with CMake was missing the bundle destination so
|
||||
libraries weren't actually installed [11]
|
||||
o Fix retrieving DNS server configuration on MacOS and iOS if the configuration
|
||||
did not include search domains [15]
|
||||
o ares_parse_a_reply and ares_parse_aaa_reply were erroneously using strdup()
|
||||
instead of ares_strdup() [19]
|
||||
|
||||
|
||||
Thanks go to these friendly people for their efforts and contributions:
|
||||
Anton Danielsson (@anton-danielsson)
|
||||
Brad House (@bradh352)
|
||||
Daniel Stenberg (@bagder)
|
||||
Dhrumil Rana (@dhrumilrana)
|
||||
František Dvořák (@valtri)
|
||||
@halx99
|
||||
Jay Freeman (@saurik)
|
||||
Jean-pierre Cartal (@jeanpierrecartal)
|
||||
Michael Kourlas
|
||||
Philipp Jeitner
|
||||
@vburdo
|
||||
(11 contributors)
|
||||
|
||||
References to bug reports and discussions on issues:
|
||||
[1] = https://github.com/c-ares/c-ares/issues/379
|
||||
[2] = https://github.com/c-ares/c-ares/issues/380
|
||||
[3] = https://github.com/c-ares/c-ares/issues/384
|
||||
[4] = https://github.com/c-ares/c-ares/pull/386
|
||||
[5] = https://github.com/c-ares/c-ares/pull/391
|
||||
[6] = https://github.com/c-ares/c-ares/pull/390
|
||||
[7] = https://github.com/c-ares/c-ares/commit/485fb66
|
||||
[8] = https://github.com/c-ares/c-ares/issues/392
|
||||
[9] = https://github.com/c-ares/c-ares/issues/388
|
||||
[10] = https://github.com/c-ares/c-ares/pull/394
|
||||
[11] = https://github.com/c-ares/c-ares/pull/395
|
||||
[12] = https://github.com/c-ares/c-ares/pull/397
|
||||
[13] = https://github.com/c-ares/c-ares/commit/df94703
|
||||
[14] = https://github.com/c-ares/c-ares/pull/400
|
||||
[15] = https://github.com/c-ares/c-ares/pull/401
|
||||
[16] = https://github.com/c-ares/c-ares/commit/362f91d
|
||||
[17] = https://github.com/c-ares/c-ares/commit/44c009b
|
||||
[18] = https://github.com/c-ares/c-ares/commit/c9b6c60
|
||||
[19] = https://github.com/c-ares/c-ares/pull/408
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
c-ares release procedure - how to do a release
|
||||
==============================================
|
||||
|
||||
in the source code repo
|
||||
-----------------------
|
||||
|
||||
- edit `RELEASE-NOTES` to be accurate
|
||||
|
||||
- edit `configure.ac`'s `CARES_VERSION_INFO`, and `CMakeLists.txt`'s
|
||||
`CARES_LIB_VERSIONINFO` set to the same value to denote the current shared
|
||||
object versioning.
|
||||
|
||||
- make sure all relevant changes are committed on the master branch
|
||||
|
||||
- tag the git repo in this style: `git tag -a cares-1_14_0` -a annotates the
|
||||
tag and we use underscores instead of dots in the version number.
|
||||
|
||||
- run "./maketgz 1.14.0" to build the release tarball. It is important that
|
||||
you run this on a machine with the correct set of autotools etc installed
|
||||
as this is what then will be shipped and used by most users on *nix like
|
||||
systems.
|
||||
|
||||
- push the git commits and the new tag
|
||||
|
||||
- gpg sign the tarball
|
||||
|
||||
- upload the resulting files to https://c-ares.haxx.se/download/
|
||||
|
||||
- update `ares_version.h` for the next version
|
||||
|
||||
in the c-ares-www repo
|
||||
----------------------
|
||||
|
||||
- edit `index.t` (version number and date),
|
||||
|
||||
- edit `changelog.t` (add the new release in there)
|
||||
|
||||
- commit all local changes
|
||||
|
||||
- tag the repo with the same tag as used for the source repo
|
||||
|
||||
- push the git commits and the new tag
|
||||
|
||||
inform
|
||||
------
|
||||
|
||||
- send an email to the c-ares mailing list. Insert the RELEASE-NOTES into the
|
||||
mail.
|
||||
|
||||
celebrate
|
||||
---------
|
||||
|
||||
- suitable beverage intake is encouraged for the festivities
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
c-ares security
|
||||
===============
|
||||
|
||||
This document is intended to provide guidance on how security vulnerabilities
|
||||
should be handled in the c-ares project.
|
||||
|
||||
Publishing Information
|
||||
----------------------
|
||||
|
||||
All known and public c-ares vulnerabilities will be listed on [the c-ares web
|
||||
site](https://c-ares.haxx.se/vulns.html).
|
||||
|
||||
Security vulnerabilities should not be entered in the project's public bug
|
||||
tracker unless the necessary configuration is in place to limit access to the
|
||||
issue to only the reporter and the project's security team.
|
||||
|
||||
Vulnerability Handling
|
||||
----------------------
|
||||
|
||||
The typical process for handling a new security vulnerability is as follows.
|
||||
|
||||
No information should be made public about a vulnerability until it is
|
||||
formally announced at the end of this process. That means, for example that a
|
||||
bug tracker entry must NOT be created to track the issue since that will make
|
||||
the issue public and it should not be discussed on the project's public
|
||||
mailing list. Also messages associated with any commits should not make any
|
||||
reference to the security nature of the commit if done prior to the public
|
||||
announcement.
|
||||
|
||||
- The person discovering the issue, the reporter, reports the vulnerability
|
||||
privately to `c-ares-security@haxx.se`. That's an email alias that reaches a
|
||||
handful of selected and trusted people.
|
||||
|
||||
- Messages that do not relate to the reporting or managing of an undisclosed
|
||||
security vulnerability in c-ares are ignored and no further action is
|
||||
required.
|
||||
|
||||
- A person in the security team sends an e-mail to the original reporter to
|
||||
acknowledge the report.
|
||||
|
||||
- The security team investigates the report and either rejects it or accepts
|
||||
it.
|
||||
|
||||
- If the report is rejected, the team writes to the reporter to explain why.
|
||||
|
||||
- If the report is accepted, the team writes to the reporter to let him/her
|
||||
know it is accepted and that they are working on a fix.
|
||||
|
||||
- The security team discusses the problem, works out a fix, considers the
|
||||
impact of the problem and suggests a release schedule. This discussion
|
||||
should involve the reporter as much as possible.
|
||||
|
||||
- The release of the information should be "as soon as possible" and is most
|
||||
often synced with an upcoming release that contains the fix. If the
|
||||
reporter, or anyone else, thinks the next planned release is too far away
|
||||
then a separate earlier release for security reasons should be considered.
|
||||
|
||||
- Write a security advisory draft about the problem that explains what the
|
||||
problem is, its impact, which versions it affects, solutions or
|
||||
workarounds, when the release is out and make sure to credit all
|
||||
contributors properly.
|
||||
|
||||
- Request a CVE number from
|
||||
[distros@openwall](http://oss-security.openwall.org/wiki/mailing-lists/distros)
|
||||
when also informing and preparing them for the upcoming public security
|
||||
vulnerability announcement - attach the advisory draft for information. Note
|
||||
that 'distros' won't accept an embargo longer than 19 days.
|
||||
|
||||
- Update the "security advisory" with the CVE number.
|
||||
|
||||
- The security team commits the fix in a private branch. The commit message
|
||||
should ideally contain the CVE number. This fix is usually also distributed
|
||||
to the 'distros' mailing list to allow them to use the fix prior to the
|
||||
public announcement.
|
||||
|
||||
- At the day of the next release, the private branch is merged into the master
|
||||
branch and pushed. Once pushed, the information is accessible to the public
|
||||
and the actual release should follow suit immediately afterwards.
|
||||
|
||||
- The project team creates a release that includes the fix.
|
||||
|
||||
- The project team announces the release and the vulnerability to the world in
|
||||
the same manner we always announce releases. It gets sent to the c-ares
|
||||
mailing list and the oss-security mailing list.
|
||||
|
||||
- The security web page on the web site should get the new vulnerability
|
||||
mentioned.
|
||||
|
||||
C-ARES-SECURITY (at haxx dot se)
|
||||
--------------------------------
|
||||
|
||||
Who is on this list? There are a couple of criteria you must meet, and then we
|
||||
might ask you to join the list or you can ask to join it. It really isn't very
|
||||
formal. We basically only require that you have a long-term presence in the
|
||||
c-ares project and you have shown an understanding for the project and its way
|
||||
of working. You must've been around for a good while and you should have no
|
||||
plans in vanishing in the near future.
|
||||
|
||||
We do not make the list of partipants public mostly because it tends to vary
|
||||
somewhat over time and a list somewhere will only risk getting outdated.
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
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.
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,103 @@
|
|||
image: Visual Studio 2015
|
||||
|
||||
# Github/Bitbucket only: get source code for one particular commit as zip archive, instead of git clone'ing.
|
||||
shallow_clone: true
|
||||
|
||||
# Github/Bitbucket only: per-file commit filtering
|
||||
skip_commits:
|
||||
files:
|
||||
- .gitignore
|
||||
- '**/*.md'
|
||||
- .travis.yml
|
||||
|
||||
# List of build configurations to test.
|
||||
configuration:
|
||||
- RelWithDebInfo
|
||||
|
||||
# Note: You can set extra cmake args for a particular matrix entry with CMAKE_EXTRA_OPTIONS. For example:
|
||||
# CMAKE_EXTRA_OPTIONS: -DOPENSSL_ROOT_DIR=C:/OpenSSL-Win32
|
||||
environment:
|
||||
matrix:
|
||||
# MSVC 2015, 32-bit x86 (cmake)
|
||||
- COMPILER: MSVC
|
||||
BUILDTOOL: CMAKE
|
||||
MSVC_SETUP_ARG: x86
|
||||
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
|
||||
|
||||
# MSVC 2015, 64-bit x86 (cmake)
|
||||
- COMPILER: MSVC
|
||||
BUILDTOOL: CMAKE
|
||||
MSVC_SETUP_ARG: x64
|
||||
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
|
||||
|
||||
# MinGW, 32-bit x86 (cmake)
|
||||
- COMPILER: MINGW
|
||||
BUILDTOOL: CMAKE
|
||||
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
|
||||
|
||||
# MSVC 2015, 32-bit x86 (nmake)
|
||||
- COMPILER: MSVC
|
||||
BUILDTOOL: NMAKE
|
||||
MSVC_SETUP_ARG: x86
|
||||
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
|
||||
|
||||
# MSVC 2015, 64-bit x86 (nmake)
|
||||
- COMPILER: MSVC
|
||||
BUILDTOOL: NMAKE
|
||||
MSVC_SETUP_ARG: x64
|
||||
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
|
||||
|
||||
# MinGW, 32-bit x86 (makefiles)
|
||||
- COMPILER: MINGW
|
||||
BUILDTOOL: MAKE
|
||||
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
|
||||
|
||||
install:
|
||||
- if "%COMPILER%" == "MINGW" rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
|
||||
|
||||
before_build:
|
||||
# Setup build environment for the selected compiler (not all compilers need to do anything here).
|
||||
# -- Visual Studio --
|
||||
- if "%COMPILER%" == "MSVC" call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG%
|
||||
|
||||
build_script:
|
||||
- if "%BUILDTOOL%" == "NMAKE" copy .\include\ares_build.h.dist .\include\ares_build.h
|
||||
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc
|
||||
- if "%BUILDTOOL%" == "CMAKE" mkdir C:\projects\build-cares
|
||||
- if "%BUILDTOOL%" == "CMAKE" cd C:\projects\build-cares
|
||||
- if "%BUILDTOOL%" == "CMAKE" cmake -GNinja -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:\projects\build-cares\test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON %CMAKE_EXTRA_OPTIONS% %APPVEYOR_BUILD_FOLDER%
|
||||
- if "%BUILDTOOL%" == "CMAKE" ninja install
|
||||
- if "%BUILDTOOL%" == "MAKE" copy .\include\ares_build.h.dist .\include\ares_build.h
|
||||
- if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 demos
|
||||
|
||||
test_script:
|
||||
# We can't use powershell for tests due to treating stderr as an error
|
||||
- if "%BUILDTOOL%" == "NMAKE" cd test
|
||||
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc vtest
|
||||
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc aresfuzz aresfuzzname dnsdump
|
||||
- if "%BUILDTOOL%" == "NMAKE" .\msvc\arestest\lib-debug\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa
|
||||
- if "%BUILDTOOL%" == "MAKE" cd test
|
||||
- if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32
|
||||
- if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 aresfuzz.exe aresfuzzname.exe dnsdump.exe
|
||||
- if "%BUILDTOOL%" == "MAKE" .\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa
|
||||
- if "%BUILDTOOL%" == "CMAKE" cd C:\projects\build-cares\bin
|
||||
- if "%BUILDTOOL%" == "CMAKE" .\adig.exe www.google.com
|
||||
- if "%BUILDTOOL%" == "CMAKE" .\acountry.exe www.google.com
|
||||
- if "%BUILDTOOL%" == "CMAKE" .\ahost.exe www.google.com
|
||||
- if "%BUILDTOOL%" == "CMAKE" .\arestest.exe -4 -v
|
||||
# Windows cant do shell expansion
|
||||
# - if "%BUILDTOOL%" == "CMAKE" .\aresfuzz.exe %APPVEYOR_BUILD_FOLDER%\test\fuzzinput\*
|
||||
# - if "%BUILDTOOL%" == "CMAKE" .\aresfuzzname.exe %APPVEYOR_BUILD_FOLDER%\test\fuzznames\*
|
||||
- if "%BUILDTOOL%" == "CMAKE" .\dnsdump.exe "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_a" "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_aaaa"
|
||||
|
||||
#on_finish:
|
||||
# - cd C:\projects\build-cares\test
|
||||
# - dir /B *.log > list.txt
|
||||
# - cmake -E tar cfv all_tests.zip --format=zip --files-from=list.txt
|
||||
# - appveyor PushArtifact all_tests.zip
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
# Force build worker to stay open after build is done, so we can RDP into it.
|
||||
|
||||
# Enable RDP connections into build worker.
|
||||
#init:
|
||||
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "*** Do not use buildconf. Instead, just use: autoreconf -fi" >&2
|
||||
exec ${AUTORECONF:-autoreconf} -fi "${@}"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
@echo off
|
||||
REM
|
||||
REM
|
||||
REM This batch file must be used to set up a git tree to build on
|
||||
REM systems where there is no autotools support (i.e. Microsoft).
|
||||
REM
|
||||
REM This file is not included nor needed for c-ares' release
|
||||
REM archives, neither for c-ares' daily snapshot archives.
|
||||
|
||||
if exist GIT-INFO goto start_doing
|
||||
ECHO ERROR: This file shall only be used with a c-ares git checkout.
|
||||
goto end_all
|
||||
:start_doing
|
||||
|
||||
if not exist include\ares_build.h.dist goto end_ares_build_h
|
||||
copy /Y include\ares_build.h.dist include\ares_build.h
|
||||
:end_ares_build_h
|
||||
|
||||
:end_all
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(c-ares_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/c-ares-config-version.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/c-ares-targets.cmake")
|
||||
|
||||
set(c-ares_LIBRARY c-ares::cares)
|
||||
|
||||
if(@CARES_SHARED@)
|
||||
add_library(c-ares::cares_shared INTERFACE IMPORTED)
|
||||
set_target_properties(c-ares::cares_shared PROPERTIES INTERFACE_LINK_LIBRARIES "c-ares::cares")
|
||||
set(c-ares_SHARED_LIBRARY c-ares::cares_shared)
|
||||
elseif(@CARES_STATIC@)
|
||||
add_library(c-ares::cares_static INTERFACE IMPORTED)
|
||||
set_target_properties(c-ares::cares_static PROPERTIES INTERFACE_LINK_LIBRARIES "c-ares::cares")
|
||||
endif()
|
||||
|
||||
if(@CARES_STATIC@)
|
||||
set(c-ares_STATIC_LIBRARY c-ares::cares_static)
|
||||
endif()
|
||||
|
|
@ -0,0 +1,938 @@
|
|||
AC_PREREQ(2.57)
|
||||
|
||||
AC_INIT([c-ares], [1.17.2],
|
||||
[c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares])
|
||||
|
||||
CARES_VERSION_INFO="6:3:4"
|
||||
dnl This flag accepts an argument of the form current[:revision[:age]]. So,
|
||||
dnl passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
|
||||
dnl 1.
|
||||
dnl
|
||||
dnl If either revision or age are omitted, they default to 0. Also note that age
|
||||
dnl must be less than or equal to the current interface number.
|
||||
dnl
|
||||
dnl Here are a set of rules to help you update your library version information:
|
||||
dnl
|
||||
dnl 1.Start with version information of 0:0:0 for each libtool library.
|
||||
dnl
|
||||
dnl 2.Update the version information only immediately before a public release of
|
||||
dnl your software. More frequent updates are unnecessary, and only guarantee
|
||||
dnl that the current interface number gets larger faster.
|
||||
dnl
|
||||
dnl 3.If the library source code has changed at all since the last update, then
|
||||
dnl increment revision (c:r+1:a)
|
||||
dnl
|
||||
dnl 4.If any interfaces have been added, removed, or changed since the last
|
||||
dnl update, increment current, and set revision to 0. (c+1:r=0:a)
|
||||
dnl
|
||||
dnl 5.If any interfaces have been added since the last public release, then
|
||||
dnl increment age. (c:r:a+1)
|
||||
dnl
|
||||
dnl 6.If any interfaces have been removed since the last public release, then
|
||||
dnl set age to 0. (c:r:a=0)
|
||||
dnl
|
||||
AC_SUBST([CARES_VERSION_INFO])
|
||||
|
||||
XC_OVR_ZZ50
|
||||
XC_OVR_ZZ60
|
||||
CARES_OVERRIDE_AUTOCONF
|
||||
|
||||
AC_CONFIG_SRCDIR([src/lib/ares_ipv6.h])
|
||||
AC_CONFIG_HEADERS([src/lib/ares_config.h include/ares_build.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AM_MAINTAINER_MODE
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
CARES_CHECK_OPTION_DEBUG
|
||||
CARES_CHECK_OPTION_OPTIMIZE
|
||||
CARES_CHECK_OPTION_WARNINGS
|
||||
CARES_CHECK_OPTION_WERROR
|
||||
CARES_CHECK_OPTION_SYMBOL_HIDING
|
||||
CARES_CHECK_OPTION_EXPOSE_STATICS
|
||||
|
||||
XC_CHECK_PATH_SEPARATOR
|
||||
|
||||
dnl SED is mandatory for configure process and libtool.
|
||||
dnl Set it now, allowing it to be changed later.
|
||||
AC_PATH_PROG([SED], [sed], [not_found],
|
||||
[$PATH:/usr/bin:/usr/local/bin])
|
||||
if test -z "$SED" || test "$SED" = "not_found"; then
|
||||
AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
|
||||
fi
|
||||
AC_SUBST([SED])
|
||||
|
||||
dnl GREP is mandatory for configure process and libtool.
|
||||
dnl Set it now, allowing it to be changed later.
|
||||
AC_PATH_PROG([GREP], [grep], [not_found],
|
||||
[$PATH:/usr/bin:/usr/local/bin])
|
||||
if test -z "$GREP" || test "$GREP" = "not_found"; then
|
||||
AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
|
||||
fi
|
||||
AC_SUBST([GREP])
|
||||
|
||||
dnl EGREP is mandatory for configure process and libtool.
|
||||
dnl Set it now, allowing it to be changed later.
|
||||
if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
|
||||
AC_MSG_CHECKING([for egrep])
|
||||
EGREP="$GREP -E"
|
||||
AC_MSG_RESULT([$EGREP])
|
||||
else
|
||||
AC_PATH_PROG([EGREP], [egrep], [not_found],
|
||||
[$PATH:/usr/bin:/usr/local/bin])
|
||||
fi
|
||||
if test -z "$EGREP" || test "$EGREP" = "not_found"; then
|
||||
AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
|
||||
fi
|
||||
AC_SUBST([EGREP])
|
||||
|
||||
dnl AR is mandatory for configure process and libtool.
|
||||
dnl This is target dependent, so check it as a tool.
|
||||
if test -z "$AR"; then
|
||||
dnl allow it to be overridden
|
||||
AC_PATH_TOOL([AR], [ar], [not_found],
|
||||
[$PATH:/usr/bin:/usr/local/bin])
|
||||
if test -z "$AR" || test "$AR" = "not_found"; then
|
||||
AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([AR])
|
||||
|
||||
AX_CODE_COVERAGE
|
||||
|
||||
|
||||
dnl
|
||||
dnl Detect the canonical host and target build environment
|
||||
dnl
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
dnl Get system canonical name
|
||||
AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
|
||||
|
||||
XC_CHECK_PROG_CC
|
||||
AX_CXX_COMPILE_STDCXX_11([noext],[optional])
|
||||
|
||||
XC_AUTOMAKE
|
||||
|
||||
dnl This defines _ALL_SOURCE for AIX
|
||||
CARES_CHECK_AIX_ALL_SOURCE
|
||||
|
||||
dnl Our configure and build reentrant settings
|
||||
CARES_CONFIGURE_THREAD_SAFE
|
||||
CARES_CONFIGURE_REENTRANT
|
||||
|
||||
dnl check for how to do large files
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
case $host_os in
|
||||
solaris*)
|
||||
AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
|
||||
;;
|
||||
esac
|
||||
|
||||
XC_LIBTOOL
|
||||
|
||||
|
||||
#
|
||||
# Automake conditionals based on libtool related checks
|
||||
#
|
||||
|
||||
AM_CONDITIONAL([CARES_LT_SHLIB_USE_VERSION_INFO],
|
||||
[test "x$xc_lt_shlib_use_version_info" = 'xyes'])
|
||||
AM_CONDITIONAL([CARES_LT_SHLIB_USE_NO_UNDEFINED],
|
||||
[test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
|
||||
AM_CONDITIONAL([CARES_LT_SHLIB_USE_MIMPURE_TEXT],
|
||||
[test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
|
||||
|
||||
#
|
||||
# Due to libtool and automake machinery limitations of not allowing
|
||||
# specifying separate CPPFLAGS or CFLAGS when compiling objects for
|
||||
# inclusion of these in shared or static libraries, we are forced to
|
||||
# build using separate configure runs for shared and static libraries
|
||||
# on systems where different CPPFLAGS or CFLAGS are mandatory in order
|
||||
# to compile objects for each kind of library. Notice that relying on
|
||||
# the '-DPIC' CFLAG that libtool provides is not valid given that the
|
||||
# user might for example choose to build static libraries with PIC.
|
||||
#
|
||||
|
||||
#
|
||||
# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
|
||||
# targeting a static library and not building its shared counterpart.
|
||||
#
|
||||
|
||||
AM_CONDITIONAL([USE_CPPFLAG_CARES_STATICLIB],
|
||||
[test "x$xc_lt_build_static_only" = 'xyes'])
|
||||
|
||||
#
|
||||
# Make staticlib CPPFLAG variable and its definition visible in output
|
||||
# files unconditionally, providing an empty definition unless strictly
|
||||
# targeting a static library and not building its shared counterpart.
|
||||
#
|
||||
|
||||
CPPFLAG_CARES_STATICLIB=
|
||||
if test "x$xc_lt_build_static_only" = 'xyes'; then
|
||||
CPPFLAG_CARES_STATICLIB='-DCARES_STATICLIB'
|
||||
fi
|
||||
AC_SUBST([CPPFLAG_CARES_STATICLIB])
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl platform/compiler/architecture specific checks/flags
|
||||
dnl **********************************************************************
|
||||
|
||||
CARES_CHECK_COMPILER
|
||||
CARES_SET_COMPILER_BASIC_OPTS
|
||||
CARES_SET_COMPILER_DEBUG_OPTS
|
||||
CARES_SET_COMPILER_OPTIMIZE_OPTS
|
||||
CARES_SET_COMPILER_WARNING_OPTS
|
||||
|
||||
if test "$compiler_id" = "INTEL_UNIX_C"; then
|
||||
#
|
||||
if test "$compiler_num" -ge "1000"; then
|
||||
dnl icc 10.X or later
|
||||
CFLAGS="$CFLAGS -shared-intel"
|
||||
elif test "$compiler_num" -ge "900"; then
|
||||
dnl icc 9.X specific
|
||||
CFLAGS="$CFLAGS -i-dynamic"
|
||||
fi
|
||||
#
|
||||
fi
|
||||
|
||||
CARES_CHECK_COMPILER_HALT_ON_ERROR
|
||||
CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
|
||||
CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH
|
||||
CARES_CHECK_COMPILER_SYMBOL_HIDING
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Compilation based checks should not be done before this point.
|
||||
dnl **********************************************************************
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
|
||||
dnl and ws2tcpip.h take precedence over any other further checks which
|
||||
dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
|
||||
dnl this specific header files. And do them before its results are used.
|
||||
dnl **********************************************************************
|
||||
|
||||
CURL_CHECK_HEADER_WINDOWS
|
||||
CURL_CHECK_NATIVE_WINDOWS
|
||||
case X-"$ac_cv_native_windows" in
|
||||
X-yes)
|
||||
CURL_CHECK_HEADER_WINSOCK
|
||||
CURL_CHECK_HEADER_WINSOCK2
|
||||
CURL_CHECK_HEADER_WS2TCPIP
|
||||
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
|
||||
;;
|
||||
*)
|
||||
ac_cv_header_winsock_h="no"
|
||||
ac_cv_header_winsock2_h="no"
|
||||
ac_cv_header_ws2tcpip_h="no"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Checks for libraries.
|
||||
dnl **********************************************************************
|
||||
|
||||
CARES_CHECK_LIB_XNET
|
||||
|
||||
dnl gethostbyname without lib or in the nsl lib?
|
||||
AC_CHECK_FUNC(gethostbyname,
|
||||
[HAVE_GETHOSTBYNAME="1"
|
||||
],
|
||||
[ AC_CHECK_LIB(nsl, gethostbyname,
|
||||
[HAVE_GETHOSTBYNAME="1"
|
||||
LIBS="$LIBS -lnsl"
|
||||
])
|
||||
])
|
||||
|
||||
if test "$HAVE_GETHOSTBYNAME" != "1"
|
||||
then
|
||||
dnl gethostbyname in the socket lib?
|
||||
AC_CHECK_LIB(socket, gethostbyname,
|
||||
[HAVE_GETHOSTBYNAME="1"
|
||||
LIBS="$LIBS -lsocket"
|
||||
])
|
||||
fi
|
||||
|
||||
dnl At least one system has been identified to require BOTH nsl and socket
|
||||
dnl libs at the same time to link properly.
|
||||
if test "$HAVE_GETHOSTBYNAME" != "1"
|
||||
then
|
||||
AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
|
||||
my_ac_save_LIBS=$LIBS
|
||||
LIBS="-lnsl -lsocket $LIBS"
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
]],[[
|
||||
gethostbyname();
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
HAVE_GETHOSTBYNAME="1"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
LIBS=$my_ac_save_LIBS
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$HAVE_GETHOSTBYNAME" != "1"
|
||||
then
|
||||
dnl This is for winsock systems
|
||||
if test "$ac_cv_header_windows_h" = "yes"; then
|
||||
if test "$ac_cv_header_winsock_h" = "yes"; then
|
||||
case $host in
|
||||
*-*-mingw32ce*)
|
||||
winsock_LIB="-lwinsock"
|
||||
;;
|
||||
*)
|
||||
winsock_LIB="-lwsock32"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test "$ac_cv_header_winsock2_h" = "yes"; then
|
||||
winsock_LIB="-lws2_32"
|
||||
fi
|
||||
if test ! -z "$winsock_LIB"; then
|
||||
my_ac_save_LIBS=$LIBS
|
||||
LIBS="$winsock_LIB $LIBS"
|
||||
AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#ifdef HAVE_WINSOCK_H
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
]],[[
|
||||
gethostbyname("www.dummysite.com");
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
HAVE_GETHOSTBYNAME="1"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
winsock_LIB=""
|
||||
LIBS=$my_ac_save_LIBS
|
||||
])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$HAVE_GETHOSTBYNAME" != "1"
|
||||
then
|
||||
dnl This is for Minix 3.1
|
||||
AC_MSG_CHECKING([for gethostbyname for Minix 3])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
/* Older Minix versions may need <net/gen/netdb.h> here instead */
|
||||
#include <netdb.h>
|
||||
]],[[
|
||||
gethostbyname("www.dummysite.com");
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
HAVE_GETHOSTBYNAME="1"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$HAVE_GETHOSTBYNAME" != "1"
|
||||
then
|
||||
dnl This is for eCos with a stubbed DNS implementation
|
||||
AC_MSG_CHECKING([for gethostbyname for eCos])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include <netdb.h>
|
||||
]],[[
|
||||
gethostbyname("www.dummysite.com");
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
HAVE_GETHOSTBYNAME="1"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$HAVE_GETHOSTBYNAME" != "1"
|
||||
then
|
||||
dnl gethostbyname in the net lib - for BeOS
|
||||
AC_CHECK_LIB(net, gethostbyname,
|
||||
[HAVE_GETHOSTBYNAME="1"
|
||||
LIBS="$LIBS -lnet"
|
||||
])
|
||||
fi
|
||||
|
||||
|
||||
if test "$HAVE_GETHOSTBYNAME" != "1"; then
|
||||
AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
|
||||
fi
|
||||
|
||||
dnl resolv lib for Apple (MacOS and iOS)
|
||||
AS_IF([test "x$host_vendor" = "xapple"], [
|
||||
AC_SEARCH_LIBS([res_servicename], [resolv], [
|
||||
AC_DEFINE([CARES_USE_LIBRESOLV], [1], [Use resolver library to configure cares])
|
||||
], [
|
||||
AC_MSG_ERROR([Unable to find libresolv which is required for iPhone targets])
|
||||
])
|
||||
])
|
||||
|
||||
dnl resolv lib for z/OS
|
||||
AS_IF([test "x$host_vendor" = "xibm" -a "x$host_os" = "xopenedition" ], [
|
||||
AC_SEARCH_LIBS([res_init], [resolv], [
|
||||
AC_DEFINE([CARES_USE_LIBRESOLV], [1], [Use resolver library to configure cares])
|
||||
], [
|
||||
AC_MSG_ERROR([Unable to find libresolv which is required for z/OS])
|
||||
])
|
||||
])
|
||||
|
||||
dnl resolve lib?
|
||||
AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
|
||||
|
||||
if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
|
||||
AC_CHECK_LIB(resolve, strcasecmp,
|
||||
[LIBS="-lresolve $LIBS"],
|
||||
,
|
||||
-lnsl)
|
||||
fi
|
||||
ac_cv_func_strcasecmp="no"
|
||||
|
||||
CARES_CHECK_LIBS_CONNECT
|
||||
|
||||
dnl iOS 10?
|
||||
AS_IF([test "x$host_vendor" = "xapple"], [
|
||||
AC_MSG_CHECKING([for iOS minimum version 10 or later])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include <TargetConditionals.h>
|
||||
]], [[
|
||||
#if TARGET_OS_IPHONE == 0 || __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
|
||||
#error Not iOS 10 or later
|
||||
#endif
|
||||
return 0;
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
ac_cv_ios_10="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
|
||||
dnl macOS 10.12?
|
||||
AS_IF([test "x$host_vendor" = "xapple"], [
|
||||
AC_MSG_CHECKING([for macOS minimum version 10.12 or later])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include <TargetConditionals.h>
|
||||
]], [[
|
||||
#ifndef MAC_OS_X_VERSION_10_12
|
||||
# define MAC_OS_X_VERSION_10_12 101200
|
||||
#endif
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
|
||||
#error Not macOS 10.12 or later
|
||||
#endif
|
||||
return 0;
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
ac_cv_macos_10_12="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl In case that function clock_gettime with monotonic timer is available,
|
||||
dnl check for additional required libraries.
|
||||
dnl **********************************************************************
|
||||
dnl Xcode 8 bug: iOS when targeting less than 10, or macOS when targeting less than 10.12 will
|
||||
dnl say clock_gettime exists, it is a weak symbol that only exists in iOS 10 or macOS 10.12 and will
|
||||
dnl cause a crash at runtime when running on older versions. Skip finding CLOCK_MONOTONIC on older
|
||||
dnl Apple OS's.
|
||||
if test "x$host_vendor" != "xapple" || test "x$ac_cv_ios_10" = "xyes" || test "x$ac_cv_macos_10_12" = "xyes"; then
|
||||
CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to use libgcc])
|
||||
AC_ARG_ENABLE(libgcc,
|
||||
AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
|
||||
[ case "$enableval" in
|
||||
yes)
|
||||
LIBS="$LIBS -lgcc"
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
*) AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
|
||||
dnl Let's hope this split URL remains working:
|
||||
dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
|
||||
dnl genprogc/thread_quick_ref.htm
|
||||
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Back to "normal" configuring
|
||||
dnl **********************************************************************
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
CURL_CHECK_HEADER_MALLOC
|
||||
CURL_CHECK_HEADER_MEMORY
|
||||
|
||||
dnl check for a few basic system headers we need
|
||||
AC_CHECK_HEADERS(
|
||||
sys/types.h \
|
||||
sys/time.h \
|
||||
sys/select.h \
|
||||
sys/socket.h \
|
||||
sys/ioctl.h \
|
||||
sys/param.h \
|
||||
sys/uio.h \
|
||||
assert.h \
|
||||
netdb.h \
|
||||
netinet/in.h \
|
||||
netinet/tcp.h \
|
||||
net/if.h \
|
||||
errno.h \
|
||||
socket.h \
|
||||
strings.h \
|
||||
stdbool.h \
|
||||
time.h \
|
||||
limits.h \
|
||||
arpa/nameser.h \
|
||||
arpa/nameser_compat.h \
|
||||
arpa/inet.h,
|
||||
dnl to do if not found
|
||||
[],
|
||||
dnl to do if found
|
||||
[],
|
||||
dnl default includes
|
||||
[
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
dnl We do this default-include simply to make sure that the nameser_compat.h
|
||||
dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
|
||||
dnl (and others?) is not designed to allow this.
|
||||
#ifdef HAVE_ARPA_NAMESER_H
|
||||
#include <arpa/nameser.h>
|
||||
#endif
|
||||
|
||||
dnl *Sigh* these are needed in order for net/if.h to get properly detected.
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
]
|
||||
)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
CURL_CHECK_STRUCT_TIMEVAL
|
||||
|
||||
AC_CHECK_TYPE(long long,
|
||||
[AC_DEFINE(HAVE_LONGLONG, 1,
|
||||
[Define to 1 if the compiler supports the 'long long' data type.])]
|
||||
longlong="yes"
|
||||
)
|
||||
|
||||
if test "xyes" = "x$longlong"; then
|
||||
AC_MSG_CHECKING([if numberLL works])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
]],[[
|
||||
long long val = 1000LL;
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
fi
|
||||
|
||||
|
||||
# check for ssize_t
|
||||
AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_t ],
|
||||
[ CARES_TYPEOF_ARES_SSIZE_T=int ])
|
||||
|
||||
AC_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SSIZE_T], ${CARES_TYPEOF_ARES_SSIZE_T},
|
||||
[the signed version of size_t])
|
||||
|
||||
|
||||
# check for bool type
|
||||
AC_CHECK_TYPE([bool],[
|
||||
AC_DEFINE(HAVE_BOOL_T, 1,
|
||||
[Define to 1 if bool is an available type.])
|
||||
], ,[
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDBOOL_H
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
])
|
||||
|
||||
CARES_CONFIGURE_ARES_SOCKLEN_T
|
||||
|
||||
TYPE_IN_ADDR_T
|
||||
|
||||
TYPE_SOCKADDR_STORAGE
|
||||
|
||||
TYPE_SIG_ATOMIC_T
|
||||
|
||||
AC_TYPE_SIGNAL
|
||||
|
||||
CURL_CHECK_FUNC_RECV
|
||||
CURL_CHECK_FUNC_RECVFROM
|
||||
CURL_CHECK_FUNC_SEND
|
||||
CURL_CHECK_MSG_NOSIGNAL
|
||||
|
||||
CARES_CHECK_FUNC_CLOSESOCKET
|
||||
CARES_CHECK_FUNC_CLOSESOCKET_CAMEL
|
||||
CARES_CHECK_FUNC_CONNECT
|
||||
CARES_CHECK_FUNC_FCNTL
|
||||
CARES_CHECK_FUNC_FREEADDRINFO
|
||||
CARES_CHECK_FUNC_GETADDRINFO
|
||||
CARES_CHECK_FUNC_GETENV
|
||||
CARES_CHECK_FUNC_GETHOSTBYADDR
|
||||
CARES_CHECK_FUNC_GETHOSTBYNAME
|
||||
CARES_CHECK_FUNC_GETHOSTNAME
|
||||
CARES_CHECK_FUNC_GETSERVBYPORT_R
|
||||
CARES_CHECK_FUNC_INET_NET_PTON
|
||||
CARES_CHECK_FUNC_INET_NTOP
|
||||
CARES_CHECK_FUNC_INET_PTON
|
||||
CARES_CHECK_FUNC_IOCTL
|
||||
CARES_CHECK_FUNC_IOCTLSOCKET
|
||||
CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL
|
||||
CARES_CHECK_FUNC_SETSOCKOPT
|
||||
CARES_CHECK_FUNC_SOCKET
|
||||
CARES_CHECK_FUNC_STRCASECMP
|
||||
CARES_CHECK_FUNC_STRCMPI
|
||||
CARES_CHECK_FUNC_STRDUP
|
||||
CARES_CHECK_FUNC_STRICMP
|
||||
CARES_CHECK_FUNC_STRNCASECMP
|
||||
CARES_CHECK_FUNC_STRNCMPI
|
||||
CARES_CHECK_FUNC_STRNICMP
|
||||
CARES_CHECK_FUNC_WRITEV
|
||||
|
||||
|
||||
dnl check for AF_INET6
|
||||
CARES_CHECK_CONSTANT(
|
||||
[
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#endif
|
||||
], [PF_INET6],
|
||||
AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
|
||||
)
|
||||
|
||||
dnl check for PF_INET6
|
||||
CARES_CHECK_CONSTANT(
|
||||
[
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#endif
|
||||
], [AF_INET6],
|
||||
AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
|
||||
)
|
||||
|
||||
|
||||
dnl check for the in6_addr structure
|
||||
CARES_CHECK_STRUCT(
|
||||
[
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#endif
|
||||
], [in6_addr],
|
||||
AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
|
||||
)
|
||||
|
||||
dnl check for the sockaddr_in6 structure
|
||||
CARES_CHECK_STRUCT(
|
||||
[
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#endif
|
||||
], [sockaddr_in6],
|
||||
AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
|
||||
[Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
|
||||
)
|
||||
|
||||
AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
|
||||
AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
|
||||
[Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
|
||||
, ,
|
||||
[
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl check for the addrinfo structure
|
||||
AC_CHECK_MEMBER(struct addrinfo.ai_flags,
|
||||
AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
|
||||
[Define to 1 if you have struct addrinfo.]),,
|
||||
[
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#endif
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
AC_CHECK_FUNCS([bitncmp \
|
||||
gettimeofday \
|
||||
if_indextoname
|
||||
],[
|
||||
],[
|
||||
func="$ac_func"
|
||||
AC_MSG_CHECKING([deeper for $func])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
]],[[
|
||||
$func ();
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
eval "ac_cv_func_$func=yes"
|
||||
AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
|
||||
[Define to 1 if you have the $func function.])
|
||||
],[
|
||||
AC_MSG_RESULT([but still no])
|
||||
])
|
||||
])
|
||||
|
||||
dnl Android. Some variants like arm64 may no longer have __system_property_get
|
||||
dnl in libc, but they are defined in the headers. Perform a link check.
|
||||
AC_CHECK_FUNC([__system_property_get], [
|
||||
AC_DEFINE([HAVE___SYSTEM_PROPERTY_GET], [1], [Define if __system_property_get exists.])
|
||||
])
|
||||
|
||||
dnl Check if the getnameinfo function is available
|
||||
dnl and get the types of five of its arguments.
|
||||
CURL_CHECK_FUNC_GETNAMEINFO
|
||||
|
||||
|
||||
AC_C_BIGENDIAN(
|
||||
[AC_DEFINE(ARES_BIG_ENDIAN, 1,
|
||||
[define this if ares is built for a big endian system])],
|
||||
,
|
||||
[AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
|
||||
)
|
||||
|
||||
dnl Check for user-specified random device
|
||||
AC_ARG_WITH(random,
|
||||
AC_HELP_STRING([--with-random=FILE],
|
||||
[read randomness from FILE (default=/dev/urandom)]),
|
||||
[ CARES_RANDOM_FILE="$withval" ],
|
||||
[
|
||||
dnl Check for random device. If we're cross compiling, we can't
|
||||
dnl check, and it's better to assume it doesn't exist than it is
|
||||
dnl to fail on AC_CHECK_FILE or later.
|
||||
if test "$cross_compiling" = "no"; then
|
||||
AC_CHECK_FILE("/dev/urandom", [ CARES_RANDOM_FILE="/dev/urandom"] )
|
||||
else
|
||||
AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
|
||||
fi
|
||||
|
||||
]
|
||||
)
|
||||
if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then
|
||||
AC_SUBST(CARES_RANDOM_FILE)
|
||||
AC_DEFINE_UNQUOTED(CARES_RANDOM_FILE, "$CARES_RANDOM_FILE",
|
||||
[a suitable file/device to read random data from])
|
||||
fi
|
||||
|
||||
CARES_CHECK_OPTION_NONBLOCKING
|
||||
CARES_CHECK_NONBLOCKING_SOCKET
|
||||
|
||||
CARES_CONFIGURE_SYMBOL_HIDING
|
||||
|
||||
CARES_PRIVATE_LIBS="$LIBS"
|
||||
AC_SUBST(CARES_PRIVATE_LIBS)
|
||||
|
||||
CARES_CFLAG_EXTRAS=""
|
||||
if test X"$want_werror" = Xyes; then
|
||||
CARES_CFLAG_EXTRAS="-Werror"
|
||||
fi
|
||||
AC_SUBST(CARES_CFLAG_EXTRAS)
|
||||
|
||||
dnl squeeze whitespace out of some variables
|
||||
|
||||
squeeze CFLAGS
|
||||
squeeze CPPFLAGS
|
||||
squeeze DEFS
|
||||
squeeze LDFLAGS
|
||||
squeeze LIBS
|
||||
|
||||
squeeze CARES_PRIVATE_LIBS
|
||||
|
||||
XC_CHECK_BUILD_FLAGS
|
||||
|
||||
AC_MSG_CHECKING([whether to build tests])
|
||||
AC_ARG_ENABLE(tests,
|
||||
AC_HELP_STRING([--enable-tests], [build test suite]),
|
||||
[ build_tests="$enableval" ],
|
||||
[ if test "x$HAVE_CXX11" = "x1" && test "x$cross_compiling" = "xno" ; then
|
||||
build_tests="yes"
|
||||
else
|
||||
build_tests="no"
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
if test "x$build_tests" = "xyes" ; then
|
||||
if test "x$HAVE_CXX11" = "0" ; then
|
||||
AC_MSG_ERROR([*** Building tests requires a CXX11 compiler])
|
||||
fi
|
||||
if test "x$cross_compiling" = "xyes" ; then
|
||||
AC_MSG_ERROR([*** Tests not supported when cross compiling])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([$build_tests])
|
||||
|
||||
|
||||
BUILD_SUBDIRS="include src docs"
|
||||
if test "x$build_tests" = "xyes" ; then
|
||||
AC_CONFIG_SUBDIRS([test])
|
||||
BUILD_SUBDIRS="${BUILD_SUBDIRS} test"
|
||||
fi
|
||||
|
||||
AC_SUBST(BUILD_SUBDIRS)
|
||||
|
||||
AC_CONFIG_FILES([Makefile \
|
||||
include/Makefile \
|
||||
src/Makefile \
|
||||
src/lib/Makefile \
|
||||
src/tools/Makefile \
|
||||
docs/Makefile \
|
||||
libcares.pc ])
|
||||
|
||||
AC_OUTPUT
|
||||
XC_AMEND_DISTCLEAN(['.'])
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#***************************************************************************
|
||||
|
||||
###########################################################################
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign subdir-objects no-dependencies
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
man_MANS = $(MANPAGES)
|
||||
|
||||
EXTRA_DIST = $(MANPAGES) ahost.1 adig.1 acountry.1 Makefile.inc CMakeLists.txt
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
MANPAGES = ares_cancel.3 \
|
||||
ares_create_query.3 \
|
||||
ares_destroy.3 \
|
||||
ares_destroy_options.3 \
|
||||
ares_dup.3 \
|
||||
ares_expand_name.3 \
|
||||
ares_expand_string.3 \
|
||||
ares_fds.3 \
|
||||
ares_free_data.3 \
|
||||
ares_free_hostent.3 \
|
||||
ares_free_string.3 \
|
||||
ares_freeaddrinfo.3 \
|
||||
ares_get_servers.3 \
|
||||
ares_get_servers_ports.3 \
|
||||
ares_getaddrinfo.3 \
|
||||
ares_gethostbyaddr.3 \
|
||||
ares_gethostbyname.3 \
|
||||
ares_gethostbyname_file.3 \
|
||||
ares_getnameinfo.3 \
|
||||
ares_getsock.3 \
|
||||
ares_inet_ntop.3 \
|
||||
ares_inet_pton.3 \
|
||||
ares_init.3 \
|
||||
ares_init_options.3 \
|
||||
ares_library_cleanup.3 \
|
||||
ares_library_init.3 \
|
||||
ares_library_init_android.3 \
|
||||
ares_library_initialized.3 \
|
||||
ares_mkquery.3 \
|
||||
ares_parse_a_reply.3 \
|
||||
ares_parse_aaaa_reply.3 \
|
||||
ares_parse_caa_reply.3 \
|
||||
ares_parse_mx_reply.3 \
|
||||
ares_parse_naptr_reply.3 \
|
||||
ares_parse_ns_reply.3 \
|
||||
ares_parse_ptr_reply.3 \
|
||||
ares_parse_soa_reply.3 \
|
||||
ares_parse_srv_reply.3 \
|
||||
ares_parse_txt_reply.3 \
|
||||
ares_process.3 \
|
||||
ares_query.3 \
|
||||
ares_save_options.3 \
|
||||
ares_search.3 \
|
||||
ares_send.3 \
|
||||
ares_set_local_dev.3 \
|
||||
ares_set_local_ip4.3 \
|
||||
ares_set_local_ip6.3 \
|
||||
ares_set_servers.3 \
|
||||
ares_set_servers_csv.3 \
|
||||
ares_set_servers_ports.3 \
|
||||
ares_set_servers_ports_csv.3 \
|
||||
ares_set_socket_callback.3 \
|
||||
ares_set_socket_configure_callback.3 \
|
||||
ares_set_socket_functions.3 \
|
||||
ares_set_sortlist.3 \
|
||||
ares_strerror.3 \
|
||||
ares_timeout.3 \
|
||||
ares_version.3
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
.TH ACOUNTRY "1" "April 2011" "c-ares utilities"
|
||||
.SH NAME
|
||||
acountry \- print the country where an IPv4 address or host is located
|
||||
.SH SYNOPSIS
|
||||
.B acountry
|
||||
[\fIOPTION\fR]... \fIHOST\fR...
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
.\" Add any additional description here
|
||||
.PP
|
||||
Print the country where HOST (an IPv4 address or hostname) is located,
|
||||
using the countries.nerd.dk DNS domain to identify the country.
|
||||
.PP
|
||||
This utility comes with the \fBc\-ares\fR asynchronous resolver library.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-d\fR
|
||||
Print some extra debugging output.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Display this help and exit.
|
||||
.TP
|
||||
\fB\-v\fR
|
||||
Be more verbose. Print extra information.
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to the c-ares mailing list:
|
||||
.br
|
||||
\fBhttps://cool.haxx.se/mailman/listinfo/c-ares\fR
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
adig(1), ahost(1).
|
||||
.PP
|
||||
The DNSBL countries.nerd.dk
|
||||
.br
|
||||
\fBhttp://countries.nerd.dk/\fR
|
||||
.SH COPYRIGHT
|
||||
This utility is based on code/ideas contained in sofware written by Greg Hudson (ares)
|
||||
carrying the following notice:
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
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.
|
||||
.br
|
||||
No further copyright claims are being made by the author(s) of this utility.
|
||||
.SH AUTHOR
|
||||
Gisle Vanem
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
.TH ADIG "1" "April 2011" "c-ares utilities"
|
||||
.SH NAME
|
||||
adig \- print information collected from Domain Name System (DNS) servers
|
||||
.SH SYNOPSIS
|
||||
.B adig
|
||||
[\fIOPTION\fR]... \fINAME\fR...
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
.\" Add any additional description here
|
||||
.PP
|
||||
Send queries to DNS servers about \fINAME\fR and print received
|
||||
information, where \fINAME\fR is a valid DNS name (e.g. www.example.com,
|
||||
1.2.3.10.in-addr.arpa).
|
||||
.PP
|
||||
This utility comes with the \fBc\-ares\fR asynchronous resolver library.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-c\fR class
|
||||
Set the query class.
|
||||
Possible values for class are
|
||||
NY, CHAOS, HS, IN (default).
|
||||
.TP
|
||||
\fB\-d\fR
|
||||
Print some extra debugging output.
|
||||
.TP
|
||||
\fB\-f\fR flag
|
||||
Add a flag.
|
||||
Possible values for flag are
|
||||
igntc, noaliases, norecurse, primary, stayopen, usevc.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Display this help and exit.
|
||||
.TP
|
||||
\fB\-T\fR port
|
||||
Use specified TCP port to connect to DNS server.
|
||||
.TP
|
||||
\fB\-s\fR server
|
||||
Connect to specified DNS server, instead of the system's default one(s).
|
||||
.TP
|
||||
\fB\-t\fR type
|
||||
Query records of specified type.
|
||||
Possible values for type are
|
||||
A (default), AAAA, AFSDB, ANY, AXFR, CNAME, GPOS, HINFO, ISDN, KEY, LOC, MAILA,
|
||||
MAILB, MB, MD, MF, MG, MINFO, MR, MX, NAPTR, NS, NSAP, NSAP_PTR, NULL,
|
||||
PTR, PX, RP, RT, SIG, SOA, SRV, TXT, WKS, X25,
|
||||
.TP
|
||||
\fB\-U\fR port
|
||||
Use specified UDP port to connect to DNS server.
|
||||
.TP
|
||||
\fB\-x\fR
|
||||
For an IPv4 \fB-t PTR a.b.c.d\fR lookup, query for
|
||||
.br
|
||||
\fBd.c.b.a.in-addr.arpa.\fR
|
||||
This more often gives correct names in the \fBANSWER\fR.
|
||||
.br
|
||||
For an IPv6 \fB-t PTR addr\fR lookup, query for \fBa.b.c....z.IP6.ARPA.\fR
|
||||
.TP
|
||||
\fB\-xx\fR
|
||||
As for \fB-x\fR and an IPv6 address, compact \fBa.b.c....z.IP6.ARPA.\fR into a RFC-2673 bit-string.
|
||||
This compacted \fBbit-string\fR form is not supported by many DNS-servers.
|
||||
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to the c-ares mailing list:
|
||||
.br
|
||||
\fBhttps://cool.haxx.se/mailman/listinfo/c-ares\fR
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
acountry(1), ahost(1).
|
||||
.SH COPYRIGHT
|
||||
This utility is based on code/ideas contained in sofware written by Greg Hudson (ares)
|
||||
carrying the following notice:
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
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.
|
||||
.br
|
||||
No further copyright claims are being made by the author(s) of this utility.
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
.TH AHOST "1" "April 2011" "c-ares utilities"
|
||||
.SH NAME
|
||||
ahost \- print the A or AAAA record associated with a hostname or IP address
|
||||
.SH SYNOPSIS
|
||||
.B ahost
|
||||
[\fIOPTION\fR]... \fIHOST\fR...
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
.\" Add any additional description here
|
||||
.PP
|
||||
Look up the DNS A or AAAA record associated with HOST (a hostname or an
|
||||
IP address).
|
||||
.PP
|
||||
This utility comes with the \fBc\-ares\fR asynchronous resolver library.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-d\fR
|
||||
Print some extra debugging output.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Display this help and exit.
|
||||
.TP
|
||||
\fB\-t\fR type
|
||||
If type is "a", print the A record (default).
|
||||
If type is "aaaa", print the AAAA record.
|
||||
If type is "u", look for either AAAA or A record (in that order).
|
||||
.TP
|
||||
\fB\-s\fR \fIdomain\fP
|
||||
Specify the \fIdomain\fP to search instead of using the default values from
|
||||
.br
|
||||
/etc/resolv.conf. This option only has an effect on platforms that use
|
||||
.br
|
||||
/etc/resolv.conf
|
||||
for DNS configuration; it has no effect on other platforms (such as Win32
|
||||
or Android).
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to the c-ares mailing list:
|
||||
.br
|
||||
\fBhttps://cool.haxx.se/mailman/listinfo/c-ares\fR
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
acountry(1), adig(1).
|
||||
.SH COPYRIGHT
|
||||
This utility is based on code/ideas contained in sofware written by Greg Hudson (ares)
|
||||
carrying the following notice:
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
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.
|
||||
.br
|
||||
No further copyright claims are being made by the author(s) of this utility.
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_CANCEL 3 "31 March 2004"
|
||||
.SH NAME
|
||||
ares_cancel \- Cancel a resolve
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
void ares_cancel(ares_channel \fIchannel\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_cancel(3)\fP function cancels all lookups/requests made on the the
|
||||
name service channel identified by \fIchannel\fP. \fBares_cancel(3)\fP
|
||||
invokes the callbacks for each pending query on the channel, passing a status
|
||||
of
|
||||
.BR ARES_ECANCELLED .
|
||||
These calls give the callbacks a chance to clean up any state which might have
|
||||
been stored in their arguments. If such a callback invocation adds a new
|
||||
request to the channel, that request will \fInot\fP be cancelled by the
|
||||
current invocation of \fBares_cancel(3)\fP.
|
||||
.SH SEE ALSO
|
||||
.BR ares_init (3)
|
||||
.BR ares_destroy (3)
|
||||
.SH NOTES
|
||||
This function was added in c-ares 1.2.0
|
||||
|
||||
c-ares 1.6.0 and earlier pass a status of
|
||||
.BR ARES_ETIMEOUT
|
||||
instead of
|
||||
.BR ARES_ECANCELLED .
|
||||
.SH AUTHOR
|
||||
Dirk Manske
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_CREATE_QUERY 3 "17 Aug 2012"
|
||||
.SH NAME
|
||||
ares_create_query \- Compose a single-question DNS query buffer
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
int ares_create_query(const char *\fIname\fP,
|
||||
int \fIdnsclass\fP,
|
||||
int \fItype\fP,
|
||||
unsigned short \fIid\fP,
|
||||
int \fIrd\fP,
|
||||
unsigned char **\fIbuf\fP,
|
||||
int *\fIbuflen\fP,
|
||||
int \fImax_udp_size\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fIares_create_query(3)\fP function composes a DNS query with a single
|
||||
question. The parameter \fIname\fP gives the query name as a NUL-terminated C
|
||||
string of period-separated labels optionally ending with a period; periods and
|
||||
backslashes within a label must be escaped with a backlash.
|
||||
|
||||
The parameters \fIdnsclass\fP and \fItype\fP give the class and type of the
|
||||
query using the values defined in \fB<arpa/nameser.h>\fP.
|
||||
|
||||
The parameter \fIid\fP gives a 16-bit identifier for the query.
|
||||
|
||||
The parameter \fIrd\fP should be nonzero if recursion is desired, zero if not.
|
||||
|
||||
The query will be placed in an allocated buffer, a pointer to which will be
|
||||
stored in the variable pointed to by \fIbuf\fP, and the length of which will
|
||||
be stored in the variable pointed to by \fIbuflen\fP.
|
||||
|
||||
It is the caller's responsibility to free this buffer using
|
||||
\fIares_free_string(3)\fP when it is no longer needed. The parameter
|
||||
\fImax_udp_size\fP should be nonzero to activate EDNS. Usage of
|
||||
\fIares_create_query(3)\fP\ with \fImax_udp_size\fP set to zero is equivalent
|
||||
to using \fIares_mkquery(3)\fP.
|
||||
.SH RETURN VALUES
|
||||
.B ares_create_query
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
Construction of the DNS query succeeded.
|
||||
.TP 15
|
||||
.B ARES_ENOTFOUND
|
||||
The query name
|
||||
.I name
|
||||
refers to a
|
||||
.I .onion
|
||||
domain name. See RFC 7686.
|
||||
.TP 15
|
||||
.B ARES_EBADNAME
|
||||
The query name
|
||||
.I name
|
||||
could not be encoded as a domain name, either because it contained a
|
||||
zero-length label or because it contained a label of more than 63
|
||||
characters.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH AVAILABILITY
|
||||
Added in c-ares 1.10.0
|
||||
.SH SEE ALSO
|
||||
.BR ares_expand_name (3),
|
||||
.BR ares_free_string (3),
|
||||
.BR ares_mkquery (3)
|
||||
.SH AUTHOR
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_DESTROY 3 "7 December 2004"
|
||||
.SH NAME
|
||||
ares_destroy \- Destroy a resolver channel
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
void ares_destroy(ares_channel \fIchannel\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_destroy(3)\fP function destroys the name service channel
|
||||
identified by \fIchannel\fP, freeing all memory and closing all sockets used
|
||||
by the channel.
|
||||
|
||||
\fBares_destroy(3)\fP invokes the callbacks for each pending query on the
|
||||
channel, passing a status of \fIARES_EDESTRUCTION\fP. These calls give the
|
||||
callbacks a chance to clean up any state which might have been stored in their
|
||||
arguments. A callback must not add new requests to a channel being destroyed.
|
||||
.SH SEE ALSO
|
||||
.BR ares_init (3),
|
||||
.BR ares_cancel (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_DESTROY_OPTIONS 3 "1 June 2007"
|
||||
.SH NAME
|
||||
ares_destroy_options \- Destroy options initialized with ares_save_options
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B void ares_destroy_options(struct ares_options *\fIoptions\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_destroy_options(3)\fP function destroys the options struct
|
||||
identified by \Ioptions\fP, freeing all memory allocated by
|
||||
\fBares_save_options(3)\fP.
|
||||
.SH SEE ALSO
|
||||
.BR ares_save_options (3),
|
||||
.BR ares_init_options (3)
|
||||
.SH AUTHOR
|
||||
Brad House
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
.\"
|
||||
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_DUP 3 "26 May 2009"
|
||||
.SH NAME
|
||||
ares_dup \- Duplicate a resolver channel
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_dup(ares_channel *\fIdest\fP, ares_channel \fIsource\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_dup(3)\fP function duplicates an existing communications channel
|
||||
for name service lookups. If it returns successfully, \fBares_dup(3)\fP will
|
||||
set the variable pointed to by \fIdest\fP to a handle used to identify the
|
||||
name service channel. The caller should invoke \fIares_destroy(3)\fP on the
|
||||
handle when the channel is no longer needed.
|
||||
.SH SEE ALSO
|
||||
.BR ares_destroy(3),
|
||||
.BR ares_init(3),
|
||||
.BR ares_library_init(3)
|
||||
.SH AVAILABILITY
|
||||
\fIares_dup(3)\fP was added in c-ares 1.6.0
|
||||
.SH AUTHOR
|
||||
Daniel Stenberg
|
||||
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_EXPAND_NAME 3 "20 Nov 2009"
|
||||
.SH NAME
|
||||
ares_expand_name \- Expand a DNS-encoded domain name
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_expand_name(const unsigned char *\fIencoded\fP,
|
||||
.B const unsigned char *\fIabuf\fP, int \fIalen\fP, char **\fIs\fP,
|
||||
.B long *\fIenclen\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_expand_name
|
||||
function converts a DNS-encoded domain name to a dot-separated C
|
||||
string. The argument
|
||||
.I encoded
|
||||
gives the beginning of the encoded domain name, and the arguments
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the containing message buffer (necessary for the processing of
|
||||
indirection pointers within the encoded domain name). The result is
|
||||
placed in a NUL-terminated allocated buffer, a pointer to which is
|
||||
stored in the variable pointed to by
|
||||
.IR s .
|
||||
The length of the encoded name is stored in the variable pointed to by
|
||||
.I enclen
|
||||
so that the caller can advance past the encoded domain name to read
|
||||
further data in the message.
|
||||
|
||||
Use \fIares_free_string(3)\fP to free the allocated hostname.
|
||||
.SH RETURN VALUES
|
||||
.B ares_expand_name
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
Expansion of the encoded name succeeded.
|
||||
.TP 15
|
||||
.B ARES_EBADNAME
|
||||
The encoded domain name was malformed and could not be expanded.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH SEE ALSO
|
||||
.BR ares_mkquery (3), ares_free_string (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_EXPAND_NAME 3 "20 Nov 2009"
|
||||
.SH NAME
|
||||
ares_expand_string \- Expand a length encoded string
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_expand_string(const unsigned char *\fIencoded\fP,
|
||||
.B const unsigned char *\fIabuf\fP, int \fIalen\fP, unsigned char **\fIs\fP,
|
||||
.B long *\fIenclen\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_expand_string
|
||||
function converts a length encoded string to a NUL-terminated C
|
||||
string. The argument
|
||||
.I encoded
|
||||
gives the beginning of the encoded string, and the arguments
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the containing message buffer (necessary for the processing of
|
||||
indirection pointers within the encoded domain name). The result is
|
||||
placed in a NUL-terminated allocated buffer, a pointer to which is
|
||||
stored in the variable pointed to by
|
||||
.IR s .
|
||||
The length of the encoded string is stored in the variable pointed to by
|
||||
.I enclen
|
||||
so that the caller can advance past the encoded string to read
|
||||
further data in the message.
|
||||
.SH RETURN VALUES
|
||||
.B ares_expand_string
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
Expansion of the encoded string succeeded.
|
||||
.TP 15
|
||||
.B ARES_EBADSTR
|
||||
The encoded string was malformed and could not be expanded.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH SEE ALSO
|
||||
.BR ares_free_string (3)
|
||||
.SH AUTHOR
|
||||
Dominick Meglio
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_FDS 3 "23 July 1998"
|
||||
.SH NAME
|
||||
ares_fds \- return file descriptors to select on
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
int ares_fds(ares_channel \fIchannel\fP,
|
||||
fd_set *\fIread_fds\fP,
|
||||
fd_set *\fIwrite_fds\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_fds(3)\fP function retrieves the set of file descriptors which the
|
||||
calling application should select on for reading and writing for the
|
||||
processing of name service queries pending on the name service channel
|
||||
identified by \fIchannel\fP.
|
||||
|
||||
File descriptors will be set in the file descriptor sets pointed to by
|
||||
\fIread_fds\fP and \fIwrite_fds\fP as appropriate. File descriptors already
|
||||
set in \fIread_fds\fP and \fIwrite_fds\fP will remain set; initialization of
|
||||
the file descriptor sets (using \fBFD_ZERO\fP) is the responsibility of the
|
||||
caller.
|
||||
.SH RETURN VALUES
|
||||
\fBares_fds(3)\fP returns a value that is one greater than the number of the
|
||||
highest socket set in either \fIread_fds\fP or \fIwrite_fds\fP. If no queries
|
||||
are active, \fBares_fds(3)\fP returns 0.
|
||||
.SH SEE ALSO
|
||||
.BR ares_timeout (3),
|
||||
.BR ares_process (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\" Copyright (C) 2004-2010 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_FREE_DATA 3 "5 March 2010"
|
||||
.SH NAME
|
||||
ares_free_data \- Free data allocated by several c-ares functions
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B void ares_free_data(void *\fIdataptr\fP)
|
||||
.PP
|
||||
.B cc file.c -lcares
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The
|
||||
.B ares_free_data(3)
|
||||
function frees one or more data structures allocated and returned
|
||||
by several c-ares functions. Specifically the data returned by the
|
||||
following list of functions must be deallocated using this function.
|
||||
.TP 5
|
||||
.B ares_get_servers(3)
|
||||
When used to free the data returned by ares_get_servers(3) this
|
||||
will free the whole linked list of ares_addr_node structures returned
|
||||
by ares_get_servers(3).
|
||||
.TP
|
||||
.B ares_parse_srv_reply(3)
|
||||
When used to free the data returned by ares_parse_srv_reply(3) this
|
||||
will free the whole linked list of ares_srv_reply structures returned
|
||||
by ares_parse_srv_reply(3), along with any additional storage
|
||||
associated with those structures.
|
||||
.TP
|
||||
.B ares_parse_mx_reply(3)
|
||||
When used to free the data returned by ares_parse_mx_reply(3) this
|
||||
will free the whole linked list of ares_mx_reply structures returned
|
||||
by ares_parse_mx_reply(3), along with any additional storage
|
||||
associated with those structures.
|
||||
.TP
|
||||
.B ares_parse_txt_reply(3)
|
||||
When used to free the data returned by ares_parse_txt_reply(3) this
|
||||
will free the whole linked list of ares_txt_reply structures returned
|
||||
by ares_parse_txt_reply(3), along with any additional storage
|
||||
associated with those structures.
|
||||
.TP
|
||||
.B ares_parse_soa_reply(3)
|
||||
When used to free the data returned by ares_parse_soa_reply(3) this
|
||||
will free the ares_soa_reply structure, along with any additional storage
|
||||
associated with those structure.
|
||||
.SH RETURN VALUE
|
||||
The ares_free_data() function does not return a value.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.7.0.
|
||||
.SH SEE ALSO
|
||||
.BR ares_get_servers(3),
|
||||
.BR ares_parse_srv_reply(3),
|
||||
.BR ares_parse_mx_reply(3),
|
||||
.BR ares_parse_txt_reply(3),
|
||||
.BR ares_parse_soa_reply(3)
|
||||
.SH AUTHOR
|
||||
Yang Tse
|
||||
.PP
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
Copyright (C) 2004-2010 by Daniel Stenberg.
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_FREE_HOSTENT 3 "23 July 1998"
|
||||
.SH NAME
|
||||
ares_free_hostent \- Free host structure allocated by ares functions
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B void ares_free_hostent(struct hostent *\fIhost\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.I ares_free_hostent
|
||||
function frees a
|
||||
.B struct hostent
|
||||
allocated by one of the functions \fIares_parse_a_reply(3)\fP,
|
||||
\fIares_parse_aaaa_reply(3)\fP, or \fIares_parse_ptr_reply(3)\fP.
|
||||
.SH NOTES
|
||||
It is not necessary (and is not correct) to free the host structure passed to
|
||||
the callback functions for \fIares_gethostbyname(3)\fP or
|
||||
\fIares_gethostbyaddr(3)\fP. c-ares will automatically free such host
|
||||
structures when the callback returns.
|
||||
.SH SEE ALSO
|
||||
.BR ares_parse_a_reply (3),
|
||||
.BR ares_parse_aaaa_reply (3),
|
||||
.BR ares_parse_ptr_reply (3),
|
||||
.BR ares_parse_ns_reply (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
.\"
|
||||
.\" Copyright 2000 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_FREE_STRING 3 "4 February 2004"
|
||||
.SH NAME
|
||||
ares_free_string \- Free strings allocated by ares functions
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B void ares_free_string(void *\fIstr\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fIares_free_string(3)\fP function frees a string allocated by an ares
|
||||
function.
|
||||
.SH SEE ALSO
|
||||
.BR ares_mkquery (3)
|
||||
.BR ares_expand_string (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 2000 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_FREEADDRINFO 3 "31 October 2018"
|
||||
.SH NAME
|
||||
ares_freeaddrinfo \- Free addrinfo structure allocated by ares functions
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
void ares_freeaddrinfo(struct ares_addrinfo *\fIai\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_freeaddrinfo
|
||||
function frees a
|
||||
.B struct ares_addrinfo
|
||||
returned in \fIresult\fP of
|
||||
.B ares_addrinfo_callback
|
||||
.SH SEE ALSO
|
||||
.BR ares_getaddrinfo (3),
|
||||
.SH AUTHOR
|
||||
Christian Ammer
|
||||
.BR
|
||||
Andrew Selivanov <andrew.selivanov@gmail.com>
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\" Copyright (C) 2008-2010 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_GET_SERVERS 3 "5 March 2010"
|
||||
.SH NAME
|
||||
ares_get_servers, ares_get_servers_ports \- Retrieve name servers from an initialized ares_channel
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_get_servers(ares_channel \fIchannel\fP, struct ares_addr_node **\fIservers\fP)
|
||||
.B int ares_get_servers_ports(ares_channel \fIchannel\fP, struct ares_addr_port_node **\fIservers\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_get_servers(3)\fP function retrieves name servers configuration
|
||||
from the
|
||||
channel data identified by
|
||||
.IR channel ,
|
||||
as a linked list of ares_addr_node structs storing a pointer to the first
|
||||
node at the address specified by
|
||||
.IR servers .
|
||||
|
||||
The \fBares_get_servers_ports(3)\fP function also retrieves any per-server
|
||||
port information that may have been previously configured, returning a linked
|
||||
list of ares_addr_port structures.
|
||||
|
||||
Function caller may traverse the returned name server linked list, or may use
|
||||
it directly as suitable input for the \fBares_set_servers(3)\fP /
|
||||
\fBares_set_servers_ports(3)\fP functions, but
|
||||
shall not shrink or extend the list on its own.
|
||||
|
||||
Each node of the name server linked list is stored in memory dynamically
|
||||
allocated and managed by c-ares. It is the caller's responsibility to free
|
||||
the resulting linked list, using \fBares_free_data(3)\fP , once the caller
|
||||
does not need it any longer.
|
||||
|
||||
This function is capable of handling IPv4 and IPv6 name server
|
||||
addresses simultaneously, rendering \fBares_save_options(3)\fP with
|
||||
optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
|
||||
IPv4-only name server usage.
|
||||
|
||||
.SH RETURN VALUES
|
||||
This function may return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The name servers configuration was successfully retrieved
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
The memory was exhausted
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The channel data identified by
|
||||
.IR channel
|
||||
was invalid.
|
||||
.SH SEE ALSO
|
||||
.BR ares_set_servers (3),
|
||||
.BR ares_init_options (3),
|
||||
.BR ares_save_options(3)
|
||||
.SH AVAILABILITY
|
||||
\fBares_get_servers(3)\fP was added in c-ares 1.7.1;
|
||||
\fBares_get_servers_ports(3)\fP was added in c-ares 1.11.0.
|
||||
.SH AUTHOR
|
||||
Implementation of this function and associated library internals are based
|
||||
on code, comments and feedback provided in November and December of 2008 by
|
||||
Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
|
||||
by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
|
||||
shuffled all the bits and this function popped out.
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
Copyright (C) 2008-2010 by Daniel Stenberg
|
||||
|
|
@ -0,0 +1 @@
|
|||
.so man3/ares_get_servers.3
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_GETADDRINFO 3 "4 November 2018"
|
||||
.SH NAME
|
||||
ares_getaddrinfo \- Initiate a host query by name and service
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef void (*ares_addrinfo_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
||||
.B int \fItimeouts\fP, struct ares_addrinfo *\fIresult\fP)
|
||||
.PP
|
||||
.B void ares_getaddrinfo(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
||||
.B const char* \fIservice\fP, const struct ares_addrinfo_hints *\fIhints\fP,
|
||||
.B ares_addrinfo_callback \fIcallback\fP, void *\fIarg\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_getaddrinfo
|
||||
function initiates a host query by name on the name service channel
|
||||
identified by
|
||||
.IR channel .
|
||||
The
|
||||
.I name
|
||||
and
|
||||
.I service
|
||||
parameters give the hostname and service as NULL-terminated C strings.
|
||||
The
|
||||
.I hints
|
||||
parameter is an
|
||||
.BR ares_addrinfo_hints
|
||||
structure:
|
||||
.PP
|
||||
.RS
|
||||
.EX
|
||||
struct ares_addrinfo_hints {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
};
|
||||
.EE
|
||||
.RE
|
||||
.TP
|
||||
.I ai_family
|
||||
Specifies desired address family. AF_UNSPEC means return both AF_INET and AF_INET6.
|
||||
.TP
|
||||
.I ai_socktype
|
||||
Specifies desired socket type, for example SOCK_STREAM or SOCK_DGRAM.
|
||||
Setting this to 0 means any type.
|
||||
.TP
|
||||
.I ai_protocol
|
||||
Setting this to 0 means any protocol.
|
||||
.TP
|
||||
.I ai_flags
|
||||
Specifies additional options, see below.
|
||||
.PP
|
||||
.TP 19
|
||||
.B ARES_AI_NUMERICSERV
|
||||
If this option is set
|
||||
.I service
|
||||
field will be treated as a numeric value.
|
||||
.TP 19
|
||||
.B ARES_AI_CANONNAME
|
||||
The ares_addrinfo structure will return a canonical names list.
|
||||
.TP 19
|
||||
.B ARES_AI_NOSORT
|
||||
Result addresses will not be sorted and no connections to resolved addresses will be attempted.
|
||||
.TP 19
|
||||
.B ARES_AI_ENVHOSTS
|
||||
Read hosts file path from the environment variable
|
||||
.I CARES_HOSTS .
|
||||
.PP
|
||||
When the query is complete or has failed, the ares library will invoke \fIcallback\fP.
|
||||
Completion or failure of the query may happen immediately, or may happen
|
||||
during a later call to \fIares_process(3)\fP, \fIares_destroy(3)\fP or
|
||||
\fIares_cancel(3)\fP.
|
||||
.PP
|
||||
The callback argument
|
||||
.I arg
|
||||
is copied from the
|
||||
.B ares_getaddrinfo
|
||||
argument
|
||||
.IR arg .
|
||||
The callback argument
|
||||
.I status
|
||||
indicates whether the query succeeded and, if not, how it failed. It
|
||||
may have any of the following values:
|
||||
.TP 19
|
||||
.B ARES_SUCCESS
|
||||
The host lookup completed successfully.
|
||||
.TP 19
|
||||
.B ARES_ENOTIMP
|
||||
The ares library does not know how to find addresses of type
|
||||
.IR family .
|
||||
.TP 19
|
||||
.B ARES_ENOTFOUND
|
||||
The
|
||||
.I name
|
||||
was not found.
|
||||
.TP 19
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.TP 19
|
||||
.B ARES_ECANCELLED
|
||||
The query was cancelled.
|
||||
.TP 19
|
||||
.B ARES_EDESTRUCTION
|
||||
The name service channel
|
||||
.I channel
|
||||
is being destroyed; the query will not be completed.
|
||||
.PP
|
||||
On successful completion of the query, the callback argument
|
||||
.I result
|
||||
points to a
|
||||
.B struct ares_addrinfo
|
||||
which contains two linked lists, one with resolved addresses and another with canonical names.
|
||||
.PP
|
||||
.RS
|
||||
.EX
|
||||
struct ares_addrinfo {
|
||||
struct ares_addrinfo_cname *cnames;
|
||||
struct ares_addrinfo_node *nodes;
|
||||
};
|
||||
.EE
|
||||
.RE
|
||||
.PP
|
||||
.I ares_addrinfo_node
|
||||
structure is similar to RFC3493 addrinfo, but without canonname and with extra ttl field.
|
||||
.RS
|
||||
.PP
|
||||
.EX
|
||||
struct ares_addrinfo_node {
|
||||
int ai_ttl;
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
ares_socklen_t ai_addrlen;
|
||||
struct sockaddr *ai_addr;
|
||||
struct ares_addrinfo_node *ai_next;
|
||||
};
|
||||
.EE
|
||||
.RE
|
||||
.PP
|
||||
.I ares_addrinfo_cname
|
||||
structure is a linked list of CNAME records where
|
||||
.I ttl
|
||||
is a time to live
|
||||
.I alias
|
||||
is a label of the resource record and
|
||||
.I name
|
||||
is a value (canonical name) of the resource record.
|
||||
See RFC2181 10.1.1. CNAME terminology.
|
||||
.RS
|
||||
.PP
|
||||
.EX
|
||||
struct ares_addrinfo_cname {
|
||||
int ttl;
|
||||
char *alias;
|
||||
char *name;
|
||||
struct ares_addrinfo_cname *next;
|
||||
};
|
||||
.EE
|
||||
.RE
|
||||
.PP
|
||||
The reserved memory has to be deleted by
|
||||
.B ares_freeaddrinfo.
|
||||
|
||||
The result is sorted according to RFC6724 except:
|
||||
- Rule 3 (Avoid deprecated addresses)
|
||||
- Rule 4 (Prefer home addresses)
|
||||
- Rule 7 (Prefer native transport)
|
||||
|
||||
Please note that the function will attempt a connection
|
||||
on each of the resolved addresses as per RFC6724.
|
||||
.SH SEE ALSO
|
||||
.BR ares_freeaddrinfo (3)
|
||||
.SH AUTHOR
|
||||
Christian Ammer
|
||||
.br
|
||||
Andrew Selivanov <andrew.selivanov@gmail.com>
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_GETHOSTBYADDR 3 "24 July 1998"
|
||||
.SH NAME
|
||||
ares_gethostbyaddr \- Initiate a host query by address
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
||||
.B int \fItimeouts\fP, struct hostent *\fIhostent\fP)
|
||||
.PP
|
||||
.B void ares_gethostbyaddr(ares_channel \fIchannel\fP, const void *\fIaddr\fP,
|
||||
.B int \fIaddrlen\fP, int \fIfamily\fP, ares_host_callback \fIcallback\fP,
|
||||
.B void *\fIarg\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_gethostbyaddr
|
||||
function initiates a host query by address on the name service channel
|
||||
identified by
|
||||
.IR channel .
|
||||
The parameters
|
||||
.I addr
|
||||
and
|
||||
.I addrlen
|
||||
give the address as a series of bytes, and
|
||||
.I family
|
||||
gives the type of address. When the query is complete or has failed, the ares
|
||||
library will invoke \fIcallback\fP. Completion or failure of the query may
|
||||
happen immediately, or may happen during a later call to
|
||||
\fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
|
||||
.PP
|
||||
The callback argument
|
||||
.I arg
|
||||
is copied from the
|
||||
.B ares_gethostbyaddr
|
||||
argument
|
||||
.IR arg .
|
||||
The callback argument
|
||||
.I status
|
||||
indicates whether the query succeeded and, if not, how it failed. It
|
||||
may have any of the following values:
|
||||
.TP 19
|
||||
.B ARES_SUCCESS
|
||||
The host lookup completed successfully.
|
||||
.TP 19
|
||||
.B ARES_ENOTIMP
|
||||
The ares library does not know how to look up addresses of type
|
||||
.IR family .
|
||||
.TP 19
|
||||
.B ARES_ENOTFOUND
|
||||
The address
|
||||
.I addr
|
||||
was not found.
|
||||
.TP 19
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.TP 19
|
||||
.B ARES_ECANCELLED
|
||||
The query was cancelled.
|
||||
.TP 19
|
||||
.B ARES_EDESTRUCTION
|
||||
The name service channel
|
||||
.I channel
|
||||
is being destroyed; the query will not be completed.
|
||||
.PP
|
||||
The callback argument
|
||||
.I timeouts
|
||||
reports how many times a query timed out during the execution of the
|
||||
given request.
|
||||
.PP
|
||||
On successful completion of the query, the callback argument
|
||||
.I hostent
|
||||
points to a
|
||||
.B struct hostent
|
||||
containing the name of the host returned by the query. The callback
|
||||
need not and should not attempt to free the memory pointed to by
|
||||
.IR hostent ;
|
||||
the ares library will free it when the callback returns. If the query
|
||||
did not complete successfully,
|
||||
.I hostent
|
||||
will be
|
||||
.BR NULL .
|
||||
.SH SEE ALSO
|
||||
.BR ares_process (3),
|
||||
.BR ares_gethostbyname (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_GETHOSTBYNAME 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_gethostbyname \- Initiate a host query by name
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
||||
.B int \fItimeouts\fP, struct hostent *\fIhostent\fP)
|
||||
.PP
|
||||
.B void ares_gethostbyname(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
||||
.B int \fIfamily\fP, ares_host_callback \fIcallback\fP, void *\fIarg\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_gethostbyname
|
||||
function initiates a host query by name on the name service channel
|
||||
identified by
|
||||
.IR channel .
|
||||
The parameter
|
||||
.I name
|
||||
gives the hostname as a NUL-terminated C string, and
|
||||
.I family
|
||||
gives the desired type of address for the resulting host entry. When the
|
||||
query is complete or has failed, the ares library will invoke \fIcallback\fP.
|
||||
Completion or failure of the query may happen immediately, or may happen
|
||||
during a later call to \fIares_process(3)\fP, \fIares_destroy(3)\fP or
|
||||
\fIares_cancel(3)\fP.
|
||||
.PP
|
||||
The callback argument
|
||||
.I arg
|
||||
is copied from the
|
||||
.B ares_gethostbyname
|
||||
argument
|
||||
.IR arg .
|
||||
The callback argument
|
||||
.I status
|
||||
indicates whether the query succeeded and, if not, how it failed. It
|
||||
may have any of the following values:
|
||||
.TP 19
|
||||
.B ARES_SUCCESS
|
||||
The host lookup completed successfully.
|
||||
.TP 19
|
||||
.B ARES_ENOTIMP
|
||||
The ares library does not know how to find addresses of type
|
||||
.IR family .
|
||||
.TP 19
|
||||
.B ARES_EBADNAME
|
||||
The hostname
|
||||
.B name
|
||||
is composed entirely of numbers and periods, but is not a valid
|
||||
representation of an Internet address.
|
||||
.TP 19
|
||||
.B ARES_ENODATA
|
||||
There was no data returned to extract a result from.
|
||||
.TP 19
|
||||
.B ARES_ENOTFOUND
|
||||
The name
|
||||
.I name
|
||||
was not found.
|
||||
.TP 19
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.TP 19
|
||||
.B ARES_ECANCELLED
|
||||
The query was cancelled.
|
||||
.TP 19
|
||||
.B ARES_EDESTRUCTION
|
||||
The name service channel
|
||||
.I channel
|
||||
is being destroyed; the query will not be completed.
|
||||
.PP
|
||||
The callback argument
|
||||
.I timeouts
|
||||
reports how many times a query timed out during the execution of the
|
||||
given request.
|
||||
.PP
|
||||
On successful completion of the query, the callback argument
|
||||
.I hostent
|
||||
points to a
|
||||
.B struct hostent
|
||||
containing the name of the host returned by the query. The callback
|
||||
need not and should not attempt to free the memory pointed to by
|
||||
.IR hostent ;
|
||||
the ares library will free it when the callback returns. If the query
|
||||
did not complete successfully,
|
||||
.I hostent
|
||||
will be
|
||||
.BR NULL .
|
||||
.SH SEE ALSO
|
||||
.BR ares_process (3),
|
||||
.BR ares_gethostbyaddr (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_GETHOSTBYNAME 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_gethostbyname_file \- Lookup a name in the system's hosts file
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_gethostbyname_file(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
||||
.B int \fIfamily\fP, struct hostent **host)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_gethostbyname_file
|
||||
function performs a host lookup by name against the system's hosts file (or equivalent local hostname database).
|
||||
The
|
||||
.IR channel
|
||||
parameter is required, but no asynchronous queries are performed. Instead, the
|
||||
lookup is done via the same mechanism used to perform 'f' lookups
|
||||
(see the
|
||||
.I lookups
|
||||
options field in \fIares_init_options(3)\fP).
|
||||
The parameter
|
||||
.I name
|
||||
gives the hostname as a NUL-terminated C string, and
|
||||
.I family
|
||||
gives the desired type of address for the resulting host entry.
|
||||
.PP
|
||||
The return value indicates whether the query succeeded and, if not, how it
|
||||
failed. It may have any of the following values:
|
||||
.TP 19
|
||||
.B ARES_SUCCESS
|
||||
The host lookup completed successfully and
|
||||
.I host
|
||||
now points to the result (and must be freed with \fIares_free_hostent(3)\fP).
|
||||
.TP 19
|
||||
.B ARES_ENOTFOUND
|
||||
The hostname
|
||||
.I name
|
||||
was not found.
|
||||
.TP 19
|
||||
.B ARES_EFILE
|
||||
There was a file I/O error while performing the lookup.
|
||||
.TP 19
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.PP
|
||||
On successful completion of the query, the pointer pointed to by
|
||||
.I host
|
||||
points to a
|
||||
.B struct hostent
|
||||
containing the address of the host returned by the lookup. The user must
|
||||
free the memory pointed to by
|
||||
.IR host
|
||||
when finished with it by calling \fIares_free_hostent(3)\fP. If the lookup did
|
||||
not complete successfully,
|
||||
.I host
|
||||
will be
|
||||
.BR NULL .
|
||||
.SH AVAILABILITY
|
||||
Added in c-ares 1.5.4
|
||||
.SH SEE ALSO
|
||||
.BR ares_gethostbyname (3),
|
||||
.BR ares_free_hostent (3),
|
||||
.BR ares_init_options (3)
|
||||
.SH AUTHOR
|
||||
Brad Spencer
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
.\"
|
||||
.\" Copyright 2005 by Dominick Meglio.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_GETNAMEINFO 3 "1 May 2009"
|
||||
.SH NAME
|
||||
ares_getnameinfo \- Address-to-nodename translation in protocol-independent manner
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef void (*ares_nameinfo_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
||||
.B int \fItimeouts\fP, char *\fInode\fP, char *\fIservice\fP)
|
||||
.PP
|
||||
.B void ares_getnameinfo(ares_channel \fIchannel\fP, const struct sockaddr *\fIsa\fP,
|
||||
.B ares_socklen_t \fIsalen\fP, int \fIflags\fP, ares_nameinfo_callback \fIcallback\fP,
|
||||
.B void *\fIarg\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_getnameinfo
|
||||
function is defined for protocol-independent address translation. The function
|
||||
is a combination of \fIares_gethostbyaddr(3)\fP and \fIgetservbyport(3)\fP. The function will
|
||||
translate the address either by executing a host query on the name service channel
|
||||
identified by
|
||||
.IR channel
|
||||
or it will attempt to resolve it locally if possible.
|
||||
The parameters
|
||||
.I sa
|
||||
and
|
||||
.I len
|
||||
give the address as a sockaddr structure, and
|
||||
.I flags
|
||||
gives the options that the function will use. Valid flags are listed below:
|
||||
.TP 19
|
||||
.B ARES_NI_NOFQDN
|
||||
Only the nodename portion of the FQDN is returned for local hosts.
|
||||
.TP 19
|
||||
.B ARES_NI_NUMERICHOST
|
||||
The numeric form of the hostname is returned rather than the name.
|
||||
.TP 19
|
||||
.B ARES_NI_NAMEREQD
|
||||
An error is returned if the hostname cannot be found in the DNS.
|
||||
.TP 19
|
||||
.B ARES_NI_NUMERICSERV
|
||||
The numeric form of the service is returned rather than the name.
|
||||
.TP 19
|
||||
.B ARES_NI_TCP
|
||||
The service name is to be looked up for the TCP protocol.
|
||||
.TP 19
|
||||
.B ARES_NI_UDP
|
||||
The service name is to be looked up for the UDP protocol.
|
||||
.TP 19
|
||||
.B ARES_NI_SCTP
|
||||
The service name is to be looked up for the SCTP protocol.
|
||||
.TP 19
|
||||
.B ARES_NI_DCCP
|
||||
The service name is to be looked up for the DCCP protocol.
|
||||
.TP 19
|
||||
.B ARES_NI_NUMERICSCOPE
|
||||
The numeric form of the scope ID is returned rather than the name.
|
||||
.TP 19
|
||||
.B ARES_NI_LOOKUPHOST
|
||||
A hostname lookup is being requested.
|
||||
.TP 19
|
||||
.B ARES_NI_LOOKUPSERVICE
|
||||
A service name lookup is being requested.
|
||||
.PP
|
||||
When the query
|
||||
is complete or has
|
||||
failed, the ares library will invoke \fIcallback\fP. Completion or failure of
|
||||
the query may happen immediately, or may happen during a later call to
|
||||
\fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
|
||||
.PP
|
||||
The callback argument
|
||||
.I arg
|
||||
is copied from the
|
||||
.B ares_getnameinfo
|
||||
argument
|
||||
.IR arg .
|
||||
The callback argument
|
||||
.I status
|
||||
indicates whether the query succeeded and, if not, how it failed. It
|
||||
may have any of the following values:
|
||||
.TP 19
|
||||
.B ARES_SUCCESS
|
||||
The host lookup completed successfully.
|
||||
.TP 19
|
||||
.B ARES_ENOTIMP
|
||||
The ares library does not know how to look up addresses of type
|
||||
.IR family .
|
||||
.TP 19
|
||||
.B ARES_ENOTFOUND
|
||||
The address
|
||||
.I addr
|
||||
was not found.
|
||||
.TP 19
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.TP 19
|
||||
.B ARES_ECANCELLED
|
||||
The query was cancelled.
|
||||
.TP 19
|
||||
.B ARES_EDESTRUCTION
|
||||
The name service channel
|
||||
.I channel
|
||||
is being destroyed; the query will not be completed.
|
||||
.TP 19
|
||||
.B ARES_EBADFLAGS
|
||||
The
|
||||
.I flags
|
||||
parameter contains an illegal value.
|
||||
.PP
|
||||
The callback argument
|
||||
.I timeouts
|
||||
reports how many times a query timed out during the execution of the
|
||||
given request.
|
||||
.PP
|
||||
On successful completion of the query, the callback argument
|
||||
.I node
|
||||
contains a string representing the hostname (assuming
|
||||
.B ARES_NI_LOOKUPHOST
|
||||
was specified). Additionally,
|
||||
.I service
|
||||
contains a string representing the service name (assuming
|
||||
.B ARES_NI_LOOKUPSERVICE
|
||||
was specified).
|
||||
If the query did not complete successfully, or one of the values
|
||||
was not requested,
|
||||
.I node
|
||||
or
|
||||
.I service
|
||||
will be
|
||||
.BR NULL .
|
||||
.SH SEE ALSO
|
||||
.BR ares_process (3),
|
||||
.SH AUTHOR
|
||||
Dominick Meglio
|
||||
.br
|
||||
Copyright 2005 by Dominick Meglio.
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_GETSOCK 3 "11 March 2010"
|
||||
.SH NAME
|
||||
ares_getsock \- get socket descriptors to wait on
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_getsock(ares_channel \fIchannel\fP, ares_socket_t *\fIsocks\fP,
|
||||
.B int \fInumsocks\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_getsock
|
||||
function retrieves the set of socket descriptors which the calling
|
||||
application should wait on for reading and/or writing for the
|
||||
processing of name service queries pending on the name service channel
|
||||
identified by
|
||||
.IR channel .
|
||||
Socket descriptors will be set in the socket descriptor array pointed to by
|
||||
\fIsocks\fP.
|
||||
\fInumsocks\fP is the size of the given array in number of ints.
|
||||
|
||||
This function can only return information about up to 16 sockets. If more are
|
||||
in use (however unlikely that is), they are simply not reported back.
|
||||
.SH RETURN VALUES
|
||||
\fBares_getsock\fP returns a bitmask for what actions to wait for on the
|
||||
different sockets. The ares.h header file provides these convenience macros to
|
||||
extract the information appropriately:
|
||||
|
||||
.nf
|
||||
#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about
|
||||
this many sockets */
|
||||
#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
|
||||
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
|
||||
ARES_GETSOCK_MAXNUM)))
|
||||
.fi
|
||||
.SH NOTES
|
||||
This function was added in c-ares 1.3.1
|
||||
.SH SEE ALSO
|
||||
.BR ares_timeout (3),
|
||||
.BR ares_fds (3),
|
||||
.BR ares_process (3)
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
.\"
|
||||
.\" Copyright (C) 2013 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_INET_NTOP 3 "17 Feb 2013"
|
||||
.SH NAME
|
||||
ares_inet_ntop \- convert a network format address to presentation format
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B const char *
|
||||
.B ares_inet_ntop(int af, const void *src, char *dst, ares_socklen_t size);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
This is a portable version with the identical functionality of the commonly
|
||||
available \fIinet_ntop\fP.
|
||||
|
||||
The ares_inet_ntop() function converts a numeric address into a text string
|
||||
suitable for presentation. The \fBaf\fP argument shall specify the family of
|
||||
the address. This can be AF_INET or AF_INET6. The \fBsrc\fP argument points
|
||||
to a buffer holding an IPv4 address if the af argument is AF_INET, or an IPv6
|
||||
address if the af argument is AF_INET6; the address must be in network byte
|
||||
order. The \fBdst\fP argument points to a buffer where the function stores the
|
||||
resulting text string; it shall not be NULL. The \fBsize\fP argument specifies
|
||||
the size of this buffer, which shall be large enough to hold the text string
|
||||
(INET_ADDRSTRLEN (16) characters for IPv4, INET6_ADDRSTRLEN (46) characters
|
||||
for IPv6).
|
||||
.SH SEE ALSO
|
||||
.BR ares_init(3),
|
||||
.BR ares_inet_pton(3)
|
||||
.SH AVAILABILITY
|
||||
made properly publicly available in c-ares for real in version 1.10.0
|
||||
.SH AUTHOR
|
||||
Daniel Stenberg
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
.\"
|
||||
.\" Copyright (C) 2013 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_INET_PTON 3 "17 Feb 2013"
|
||||
.SH NAME
|
||||
ares_inet_pton \- convert an IPv4 or IPv6 address from text to binary form
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B const char *ares_inet_pton(int af, const char *src, void *dst);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
This is a portable version with the identical functionality of the commonly
|
||||
available \fIinet_pton\fP.
|
||||
|
||||
The ares_inet_pton() function converts the address in its standard text
|
||||
presentation form into its numeric binary form. The \fBaf\fP argument shall
|
||||
specify the family of the address. The AF_INET and AF_INET6 address families
|
||||
shall be supported. The \fBsrc\fP argument points to the string being passed
|
||||
in. The \fBdst\fP argument points to a buffer into which the function stores
|
||||
the numeric address; this shall be large enough to hold the numeric address
|
||||
(32 bits for AF_INET, 128 bits for AF_INET6).
|
||||
.SH SEE ALSO
|
||||
.BR ares_init(3),
|
||||
.BR ares_inet_ntop(3)
|
||||
.SH AVAILABILITY
|
||||
made properly publicly available in c-ares for real in version 1.10.0
|
||||
.SH AUTHOR
|
||||
Daniel Stenberg
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\" Copyright (C) 2004-2010 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_INIT 3 "5 March 2010"
|
||||
.SH NAME
|
||||
ares_init \- Initialize a resolver channel
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
int ares_init(ares_channel *\fIchannelptr\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_init(3)\fP function initializes a communications channel for name
|
||||
service lookups. If it returns successfully, \fBares_init(3)\fP will set the
|
||||
variable pointed to by \fIchannelptr\fP to a handle used to identify the name
|
||||
service channel. The caller should invoke \fIares_destroy(3)\fP on the handle
|
||||
when the channel is no longer needed.
|
||||
|
||||
The \fIares_init_options(3)\fP function is provide to offer more init
|
||||
alternatives.
|
||||
.SH RETURN VALUES
|
||||
\fIares_init(3)\fP can return any of the following values:
|
||||
.TP 14
|
||||
.B ARES_SUCCESS
|
||||
Initialization succeeded.
|
||||
.TP 14
|
||||
.B ARES_EFILE
|
||||
A configuration file could not be read.
|
||||
.TP 14
|
||||
.B ARES_ENOMEM
|
||||
The process's available memory was exhausted.
|
||||
.TP 14
|
||||
.B ARES_ENOTINITIALIZED
|
||||
c-ares library initialization not yet performed.
|
||||
.SH NOTES
|
||||
When initializing from
|
||||
.B /etc/resolv.conf,
|
||||
.BR ares_init (3)
|
||||
reads the
|
||||
.I domain
|
||||
and
|
||||
.I search
|
||||
directives to allow lookups of short names relative to the domains
|
||||
specified. The
|
||||
.I domain
|
||||
and
|
||||
.I search
|
||||
directives override one another. If more that one instance of either
|
||||
.I domain
|
||||
or
|
||||
.I search
|
||||
directives is specified, the last occurrence wins. For more information,
|
||||
please see the
|
||||
.BR resolv.conf (5)
|
||||
manual page.
|
||||
.SH SEE ALSO
|
||||
.BR ares_init_options(3),
|
||||
.BR ares_destroy(3),
|
||||
.BR ares_dup(3),
|
||||
.BR ares_library_init(3),
|
||||
.BR ares_set_servers(3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
Copyright (C) 2004-2010 by Daniel Stenberg.
|
||||
|
|
@ -0,0 +1,295 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\" Copyright (C) 2004-2010 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_INIT 3 "5 March 2010"
|
||||
.SH NAME
|
||||
ares_init_options \- Initialize a resolver channel
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
struct ares_options {
|
||||
int flags;
|
||||
int timeout; /* in seconds or milliseconds, depending on options */
|
||||
int tries;
|
||||
int ndots;
|
||||
unsigned short udp_port;
|
||||
unsigned short tcp_port;
|
||||
int socket_send_buffer_size;
|
||||
int socket_receive_buffer_size;
|
||||
struct in_addr *servers;
|
||||
int nservers;
|
||||
char **domains;
|
||||
int ndomains;
|
||||
char *lookups;
|
||||
ares_sock_state_cb sock_state_cb;
|
||||
void *sock_state_cb_data;
|
||||
struct apattern *sortlist;
|
||||
int nsort;
|
||||
int ednspsz;
|
||||
char *resolvconf_path;
|
||||
};
|
||||
|
||||
int ares_init_options(ares_channel *\fIchannelptr\fP,
|
||||
struct ares_options *\fIoptions\fP,
|
||||
int \fIoptmask\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_init_options(3)\fP function initializes a communications channel
|
||||
for name service lookups. If it returns successfully,
|
||||
\fBares_init_options(3)\fP will set the variable pointed to by
|
||||
\fIchannelptr\fP to a handle used to identify the name service channel. The
|
||||
caller should invoke \fIares_destroy(3)\fP on the handle when the channel is
|
||||
no longer needed.
|
||||
|
||||
The \fIoptmask\fP parameter generally specifies which fields in the structure pointed to
|
||||
by \fIoptions\fP are set, as follows:
|
||||
.TP 18
|
||||
.B ARES_OPT_FLAGS
|
||||
.B int \fIflags\fP;
|
||||
.br
|
||||
Flags controlling the behavior of the resolver. See below for a
|
||||
description of possible flag values.
|
||||
.TP 18
|
||||
.B ARES_OPT_TIMEOUT
|
||||
.B int \fItimeout\fP;
|
||||
.br
|
||||
The number of seconds each name server is given to respond to a query on the
|
||||
first try. (After the first try, the timeout algorithm becomes more
|
||||
complicated, but scales linearly with the value of \fItimeout\fP.) The
|
||||
default is five seconds. This option is being deprecated by
|
||||
\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2.
|
||||
.TP 18
|
||||
.B ARES_OPT_TIMEOUTMS
|
||||
.B int \fItimeout\fP;
|
||||
.br
|
||||
The number of milliseconds each name server is given to respond to a query on
|
||||
the first try. (After the first try, the timeout algorithm becomes more
|
||||
complicated, but scales linearly with the value of \fItimeout\fP.) The
|
||||
default is five seconds. Note that this option is specified with the same
|
||||
struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits
|
||||
that tell c-ares how to interpret the number. This option was added in c-ares
|
||||
1.5.2.
|
||||
.TP 18
|
||||
.B ARES_OPT_TRIES
|
||||
.B int \fItries\fP;
|
||||
.br
|
||||
The number of tries the resolver will try contacting each name server
|
||||
before giving up. The default is four tries.
|
||||
.TP 18
|
||||
.B ARES_OPT_NDOTS
|
||||
.B int \fIndots\fP;
|
||||
.br
|
||||
The number of dots which must be present in a domain name for it to be
|
||||
queried for "as is" prior to querying for it with the default domain
|
||||
extensions appended. The default value is 1 unless set otherwise by
|
||||
resolv.conf or the RES_OPTIONS environment variable.
|
||||
.TP 18
|
||||
.B ARES_OPT_UDP_PORT
|
||||
.B unsigned short \fIudp_port\fP;
|
||||
.br
|
||||
The port to use for queries over UDP, in network byte order.
|
||||
The default value is 53 (in network byte order), the standard name
|
||||
service port.
|
||||
.TP 18
|
||||
.B ARES_OPT_TCP_PORT
|
||||
.B unsigned short \fItcp_port\fP;
|
||||
.br
|
||||
The port to use for queries over TCP, in network byte order.
|
||||
The default value is 53 (in network byte order), the standard name
|
||||
service port.
|
||||
.TP 18
|
||||
.B ARES_OPT_SERVERS
|
||||
.B struct in_addr *\fIservers\fP;
|
||||
.br
|
||||
.B int \fInservers\fP;
|
||||
.br
|
||||
The list of IPv4 servers to contact, instead of the servers specified in
|
||||
resolv.conf or the local named. In order to allow specification of either
|
||||
IPv4 or IPv6 name servers, the
|
||||
.BR ares_set_servers(3)
|
||||
function must be used instead.
|
||||
.TP 18
|
||||
.B ARES_OPT_DOMAINS
|
||||
.B char **\fIdomains\fP;
|
||||
.br
|
||||
.B int \fIndomains\fP;
|
||||
.br
|
||||
The domains to search, instead of the domains specified in resolv.conf
|
||||
or the domain derived from the kernel hostname variable.
|
||||
.TP 18
|
||||
.B ARES_OPT_LOOKUPS
|
||||
.B char *\fIlookups\fP;
|
||||
.br
|
||||
The lookups to perform for host queries.
|
||||
.I lookups
|
||||
should be set to a string of the characters "b" or "f", where "b"
|
||||
indicates a DNS lookup and "f" indicates a lookup in the hosts file.
|
||||
.TP 18
|
||||
.B ARES_OPT_SOCK_STATE_CB
|
||||
.B void (*\fIsock_state_cb\fP)(void *data, ares_socket_t socket_fd, int readable, int writable);
|
||||
.br
|
||||
.B void *\fIsock_state_cb_data\fP;
|
||||
.br
|
||||
A callback function to be invoked when a socket changes state.
|
||||
.I socket_fd
|
||||
will be passed the socket whose state has changed;
|
||||
.I readable
|
||||
will be set to true if the socket should listen for read events, and
|
||||
.I writable
|
||||
will be set to true if the socket should listen for write events.
|
||||
The value of
|
||||
.I sock_state_cb_data
|
||||
will be passed as the
|
||||
.I data
|
||||
argument.
|
||||
.TP 18
|
||||
.B ARES_OPT_SORTLIST
|
||||
.B struct apattern *\fIsortlist\fP;
|
||||
.br
|
||||
.B int \fInsort\fP;
|
||||
.br
|
||||
A list of IP address ranges that specifies the order of preference that
|
||||
results from \fIares_gethostbyname\fP should be returned in. Note that
|
||||
this can only be used with a sortlist retrieved via
|
||||
\fBares_save_options(3)\fP (because
|
||||
.B struct apattern
|
||||
is opaque); to set a fresh sort list, use \fBares_set_sortlist(3)\fP.
|
||||
.TP 18
|
||||
.B ARES_OPT_SOCK_SNDBUF
|
||||
.B int \fIsocket_send_buffer_size\fP;
|
||||
.br
|
||||
The send buffer size to set for the socket.
|
||||
.TP 18
|
||||
.B ARES_OPT_SOCK_RCVBUF
|
||||
.B int \fIsocket_receive_buffer_size\fP;
|
||||
.br
|
||||
The receive buffer size to set for the socket.
|
||||
.TP 18
|
||||
.B ARES_OPT_EDNSPSZ
|
||||
.B int \fIednspsz\fP;
|
||||
.br
|
||||
The message size to be advertized in EDNS; only takes effect if the
|
||||
.B ARES_FLAG_EDNS
|
||||
flag is set.
|
||||
.TP 18
|
||||
.B ARES_OPT_RESOLVCONF
|
||||
.B char *\fIresolvconf_path\fP;
|
||||
.br
|
||||
The path to use for reading the resolv.conf file. The
|
||||
.I resolvconf_path
|
||||
should be set to a path string, and will be honoured on *nix like systems. The
|
||||
default is
|
||||
.B /etc/resolv.conf
|
||||
.br
|
||||
.PP
|
||||
The \fIoptmask\fP parameter also includes options without a corresponding
|
||||
field in the
|
||||
.B ares_options
|
||||
structure, as follows:
|
||||
.TP 23
|
||||
.B ARES_OPT_ROTATE
|
||||
Perform round-robin selection of the nameservers configured for the channel
|
||||
for each resolution.
|
||||
.TP 23
|
||||
.B ARES_OPT_NOROTATE
|
||||
Do not perform round-robin nameserver selection; always use the list of
|
||||
nameservers in the same order.
|
||||
.PP
|
||||
The
|
||||
.I flags
|
||||
field should be the bitwise or of some subset of the following values:
|
||||
.TP 23
|
||||
.B ARES_FLAG_USEVC
|
||||
Always use TCP queries (the "virtual circuit") instead of UDP
|
||||
queries. Normally, TCP is only used if a UDP query yields a truncated
|
||||
result.
|
||||
.TP 23
|
||||
.B ARES_FLAG_PRIMARY
|
||||
Only query the first server in the list of servers to query.
|
||||
.TP 23
|
||||
.B ARES_FLAG_IGNTC
|
||||
If a truncated response to a UDP query is received, do not fall back
|
||||
to TCP; simply continue on with the truncated response.
|
||||
.TP 23
|
||||
.B ARES_FLAG_NORECURSE
|
||||
Do not set the "recursion desired" bit on outgoing queries, so that the name
|
||||
server being contacted will not try to fetch the answer from other servers if
|
||||
it doesn't know the answer locally. Be aware that ares will not do the
|
||||
recursion for you. Recursion must be handled by the application calling ares
|
||||
if \fIARES_FLAG_NORECURSE\fP is set.
|
||||
.TP 23
|
||||
.B ARES_FLAG_STAYOPEN
|
||||
Do not close communications sockets when the number of active queries
|
||||
drops to zero.
|
||||
.TP 23
|
||||
.B ARES_FLAG_NOSEARCH
|
||||
Do not use the default search domains; only query hostnames as-is or
|
||||
as aliases.
|
||||
.TP 23
|
||||
.B ARES_FLAG_NOALIASES
|
||||
Do not honor the HOSTALIASES environment variable, which normally
|
||||
specifies a file of hostname translations.
|
||||
.TP 23
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED
|
||||
response code or responses whose questions don't match the questions
|
||||
in the request. Primarily useful for writing clients which might be
|
||||
used to test or debug name servers.
|
||||
.TP 23
|
||||
.B ARES_FLAG_EDNS
|
||||
Include an EDNS pseudo-resource record (RFC 2671) in generated requests.
|
||||
.SH RETURN VALUES
|
||||
\fBares_init_options(3)\fP can return any of the following values:
|
||||
.TP 14
|
||||
.B ARES_SUCCESS
|
||||
Initialization succeeded.
|
||||
.TP 14
|
||||
.B ARES_EFILE
|
||||
A configuration file could not be read.
|
||||
.TP 14
|
||||
.B ARES_ENOMEM
|
||||
The process's available memory was exhausted.
|
||||
.TP 14
|
||||
.B ARES_ENOTINITIALIZED
|
||||
c-ares library initialization not yet performed.
|
||||
.SH NOTES
|
||||
When initializing from
|
||||
.B /etc/resolv.conf,
|
||||
(or, alternatively when specified by the
|
||||
.I resolvconf_path
|
||||
path location)
|
||||
\fBares_init_options(3)\fP reads the \fIdomain\fP and \fIsearch\fP directives
|
||||
to allow lookups of short names relative to the domains specified. The
|
||||
\fIdomain\fP and \fIsearch\fP directives override one another. If more that
|
||||
one instance of either \fIdomain\fP or \fIsearch\fP directives is specified,
|
||||
the last occurrence wins. For more information, please see the
|
||||
.BR resolv.conf (5)
|
||||
manual page.
|
||||
.SH SEE ALSO
|
||||
.BR ares_init(3),
|
||||
.BR ares_destroy(3),
|
||||
.BR ares_dup(3),
|
||||
.BR ares_library_init(3),
|
||||
.BR ares_save_options(3),
|
||||
.BR ares_set_servers(3),
|
||||
.BR ares_set_sortlist(3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
Copyright (C) 2004-2010 by Daniel Stenberg.
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_LIBRARY_CLEANUP 3 "19 May 2009"
|
||||
.SH NAME
|
||||
ares_library_cleanup \- c-ares library deinitialization
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
void ares_library_cleanup(void)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The
|
||||
.B ares_library_cleanup
|
||||
function uninitializes the c-ares library, freeing all resources
|
||||
previously acquired by \fIares_library_init(3)\fP when the library
|
||||
was initialized, provided there was only one single previous call to
|
||||
\fIares_library_init(3)\fP. If there was more than one previous call to
|
||||
\fIares_library_init(3)\fP, this function uninitializes the c-ares
|
||||
library only if it is the call matching the call to
|
||||
\fIares_library_init(3)\fP which initialized the library
|
||||
(usually the very first call to \fIares_library_init(3)\fP).
|
||||
Other calls to \fIares_library_cleanup(3)\fP have no effect other than
|
||||
decrementing an internal counter.
|
||||
.PP
|
||||
This function must be called when the program using c-ares will
|
||||
no longer need any c-ares function. Once the program has called
|
||||
\fIares_library_cleanup(3)\fP sufficiently often such that the
|
||||
library is uninitialised, it shall not make any further call to any
|
||||
c-ares function.
|
||||
.PP
|
||||
This function does not cancel any pending c-ares lookups or requests
|
||||
previously done. Program must use \fIares_cancel(3)\fP for this purpose.
|
||||
.PP
|
||||
.B This function is not thread safe.
|
||||
You have to call it once the program is about to terminate, but this call must
|
||||
be done once the program has terminated every single thread that it could have
|
||||
initiated. This is required to avoid potential race conditions in library
|
||||
deinitialization, and also due to the fact that \fIares_library_cleanup(3)\fP
|
||||
might call functions from other libraries that are thread unsafe, and could
|
||||
conflict with any other thread that is already using these other libraries.
|
||||
.PP
|
||||
Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from
|
||||
the DllMain function. Doing so will produce deadlocks and other problems.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.7.0 along with the
|
||||
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an
|
||||
indication of the availability of this function. Reference counting in
|
||||
\fIares_library_init()\fP and \fIares_library_cleanup()\fP, which requires
|
||||
calls to the former function to match calls to the latter, is present since
|
||||
c-ares version 1.10.0.
|
||||
Earlier versions would deinitialize the library on the first call
|
||||
to \fIares_library_cleanup()\fP.
|
||||
.PP
|
||||
Since the introduction of this function, it is absolutely mandatory to call it
|
||||
for any Win32/64 program using c-ares.
|
||||
.PP
|
||||
Non-Win32/64 systems can still use c-ares version 1.7.0 without calling
|
||||
\fIares_library_cleanup(3)\fP due to the fact that \fIcurrently\fP it is nearly
|
||||
a do-nothing function on non-Win32/64 platforms.
|
||||
.SH SEE ALSO
|
||||
.BR ares_library_init(3),
|
||||
.BR ares_cancel(3)
|
||||
.SH AUTHOR
|
||||
Yang Tse
|
||||
.PP
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
Copyright (C) 2004-2009 by Daniel Stenberg.
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_LIBRARY_INIT 3 "19 May 2009"
|
||||
.SH NAME
|
||||
ares_library_init \- c-ares library initialization
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
int ares_library_init(int \fIflags\fP)
|
||||
|
||||
int ares_library_init_mem(int \fIflags\fP,
|
||||
void *(*\fIamalloc\fP)(size_t),
|
||||
void (*\fIafree\fP)(void *ptr),
|
||||
void (*\fIarealloc\fP)(void *ptr, size_t size))
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The
|
||||
.B ares_library_init
|
||||
function performs initializations internally required by the c-ares
|
||||
library that must take place before any other function provided by
|
||||
c-ares can be used in a program.
|
||||
.PP
|
||||
This function must be called at least once within the life of a program,
|
||||
before the program actually executes any other c-ares library function.
|
||||
Initializations done by this function remain effective until a number of
|
||||
calls to \fIares_library_cleanup(3)\fP equal to the number of calls to
|
||||
this function are performed.
|
||||
.PP
|
||||
Successive calls to this function do nothing further, only the first
|
||||
call done when c-ares is in an uninitialized state is actually
|
||||
effective.
|
||||
.PP
|
||||
The
|
||||
.I flags
|
||||
parameter is a bit pattern that tells c-ares exactly which features
|
||||
should be initialized, as described below. Set the desired bits by
|
||||
ORing the values together. In normal operation you should specify
|
||||
\fIARES_LIB_INIT_ALL\fP. Don't use any other value unless you are
|
||||
familiar with it and trying to control some internal c-ares feature.
|
||||
.PP
|
||||
The
|
||||
.B ares_library_init_mem
|
||||
function allows the caller to provide memory management functions that the
|
||||
c-ares library will be use instead of \fImalloc(3)\fP, \fIfree(3)\fP and
|
||||
\fIrealloc(3)\fP.
|
||||
.PP
|
||||
.B This function is not thread safe.
|
||||
You have to call it once the program has started, but this call must be done
|
||||
before the program starts any other thread. This is required to avoid
|
||||
potential race conditions in library initialization, and also due to the fact
|
||||
that \fIares_library_init(3)\fP might call functions from other libraries that
|
||||
are thread unsafe, and could conflict with any other thread that is already
|
||||
using these other libraries.
|
||||
.PP
|
||||
On Windows platforms, the library user should ensure that \fIWSAStartup()\fP
|
||||
is called before the c-ares library is initialized and used.
|
||||
.PP
|
||||
Win32/64 application DLLs shall not call \fIares_library_init(3)\fP from the
|
||||
DllMain function. Doing so will produce deadlocks and other problems.
|
||||
.SH FLAGS
|
||||
.TP 5
|
||||
.B ARES_LIB_INIT_ALL
|
||||
Initialize everything possible. This sets all known bits.
|
||||
.TP
|
||||
.B ARES_LIB_INIT_WIN32
|
||||
Initialize Win32/64 specific libraries.
|
||||
.TP
|
||||
.B ARES_LIB_INIT_NONE
|
||||
Initialize nothing extra. This sets no bit.
|
||||
.SH RETURN VALUE
|
||||
Upon successful completion, ares_library_init() will return 0. Otherwise, a
|
||||
non-zero error number will be returned to indicate the error. Except for
|
||||
\fIares_strerror(3)\fP, you shall not call any other c-ares function upon
|
||||
\fIares_library_init(3)\fP failure.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.7.0 along with the
|
||||
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_INIT\fP as an
|
||||
indication of the availability of this function. Its recursive behavior,
|
||||
which requires a matching number of calls to \fIares_library_cleanup()\fP
|
||||
in order to deinitialize the library, is present since c-ares version
|
||||
1.10.0. Earlier versions would deinitialize the library on the first call
|
||||
to \fIares_library_cleanup()\fP.
|
||||
.PP
|
||||
Since the introduction of this function it is absolutely mandatory to
|
||||
call it for any Win32/64 program using c-ares.
|
||||
.PP
|
||||
Non-Win32/64 systems can still use c-ares version 1.7.0 without calling
|
||||
\fIares_library_init(3)\fP due to the fact that \fIcurrently\fP it is nearly
|
||||
a do-nothing function on non-Win32/64 platforms at this point.
|
||||
.SH SEE ALSO
|
||||
.BR ares_library_cleanup(3),
|
||||
.BR ares_strerror(3)
|
||||
.SH AUTHOR
|
||||
Yang Tse
|
||||
.PP
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
Copyright (C) 2004-2009 by Daniel Stenberg.
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
.\"
|
||||
.\" Copyright (C) 2017 by John Schember
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_LIBRARY_INIT_ANDROID 3 "13 Sept 2017"
|
||||
.SH NAME
|
||||
ares_library_init_android \- c-ares library Android initialization
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
int ares_library_init_android(jobject \fIconnectivity_manager\fP)
|
||||
|
||||
int ares_library_android_initialized();
|
||||
|
||||
void ares_library_init_jvm(JavaVM *\fIjvm\fP)
|
||||
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fIares_library_init_android(3)\fP function performs initializations
|
||||
internally required by the c-ares library when used on Android. This can take
|
||||
place anytime after \fIares_library_init(3)\fP. It must take place after
|
||||
\fIares_library_init_jvm\fP. ares_library_init_android must be called before
|
||||
DNS resolution will work on Android 8 (Oreo) or newer when targetSdkVersion is
|
||||
set to 26+.
|
||||
|
||||
As of Android 8 (API level 26) getting DNS server information has
|
||||
becomei more restrictive and can only be accessed using the
|
||||
Connectivity Manager. It is necessary to pass the connectivity
|
||||
manager to c-ares via JNI. Also, the ACCESS_NETWORK_STATE permission
|
||||
must be present in the Android application.
|
||||
|
||||
Android older than 8 do not need to to be initialized as they
|
||||
are less restrictive. However, this is a run time not compile time
|
||||
limitation. Proper Android initialization should take place regardless
|
||||
of the targeted Android version.
|
||||
|
||||
Deinitialization will take place though \fIares_library_cleanup(3)\fP.
|
||||
|
||||
The \fBares_library_init_jvm\fP function allows the caller to register the JVM
|
||||
with c-ares. It's meant to be called during JNI_OnLoad because you're
|
||||
guaranteed to have the JVM in that function. The JVM is required in order to
|
||||
use the Connectivty Manager registered using
|
||||
\fIares_library_init_android(3)\fP. This must be call before
|
||||
\fIares_library_init_android(3)\fP.
|
||||
|
||||
The \fBares_library_android_initialized\fP function can be used to check
|
||||
whether c-ares has been initialized for use with Android.
|
||||
.SH RETURN VALUES
|
||||
ARES_SUCCESS will be returned on success otherwise an error code will be
|
||||
returned.
|
||||
.SH THREAD SAFETY
|
||||
.B These init functions are not thread safe.
|
||||
You have to call it once the program has started, but this call must be done
|
||||
before the program starts any other thread. This is required to avoid
|
||||
potential race conditions in library initialization, and also due to the fact
|
||||
these might call functions from other libraries that
|
||||
are thread unsafe, and could conflict with any other thread that is already
|
||||
using these other libraries.
|
||||
.SH JNI
|
||||
Accessing the Connectivity Manager though Java:
|
||||
|
||||
Register the \fIares_library_android_init\fP.
|
||||
.nf
|
||||
static JNINativeMethod funcs[] = {
|
||||
{ "initialize_native", "(Landroid/net/ConnectivityManager;)I",
|
||||
(void *)&ares_library_init_android}
|
||||
};
|
||||
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
JNIEnv *env = NULL;
|
||||
jclass cls = NULL;
|
||||
jint res;
|
||||
|
||||
if ((*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_6) != JNI_OK)
|
||||
return -1;
|
||||
|
||||
cls = (*env)->FindClass(env, JNIT_CLASS);
|
||||
if (cls == NULL)
|
||||
return -1;
|
||||
|
||||
res = (*env)->RegisterNatives(env, cls, funcs, sizeof(funcs)/sizeof(funcs[0]));
|
||||
if (res != 0)
|
||||
return -1;
|
||||
|
||||
ares_library_init_jvm(vm);
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
.fi
|
||||
Calling the registered function from Java:
|
||||
.nf
|
||||
public class MyObject {
|
||||
static {
|
||||
System.loadLibrary("cares");
|
||||
}
|
||||
|
||||
private static native boolean initialize_native(ConnectivityManager
|
||||
connectivity_manager);
|
||||
|
||||
public static boolean initialize(Context context) {
|
||||
initialize_native((ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE));
|
||||
}
|
||||
}
|
||||
.fi
|
||||
Initializing the Connectivity Manager in JNI directly using an Android
|
||||
Context. It is assumed the JVM has aleady been registered through
|
||||
\fIJNI_OnLoad\fP.
|
||||
.nf
|
||||
void initialize(jobject android_context)
|
||||
{
|
||||
jclass obj_cls = jni_get_class(env, "android/content/Context");
|
||||
jmethodID obj_mid = jni_get_method_id(env, obj_cls, "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;");
|
||||
jfieldID fid = (*env)->GetStaticFieldID(env, obj_cls, "CONNECTIVITY_SERVICE", "Ljava/lang/String;");
|
||||
jstring str = (*env)->GetStaticObjectField(env, obj_cls, fid);
|
||||
connectivity_manager = (*env)->CallObjectMethod(env, android_context, obj_mid, str);
|
||||
if (connectivity_manager == NULL)
|
||||
return;
|
||||
ares_library_init_android(connectivity_manager);
|
||||
}
|
||||
.fi
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.15.0.
|
||||
.SH SEE ALSO
|
||||
.BR ares_library_init(3),
|
||||
.BR ares_library_cleanup(3),
|
||||
.SH AUTHOR
|
||||
John Schember
|
||||
.PP
|
||||
Copyright (C) 2017 by John Schember
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
.\"
|
||||
.\" Copyright (C) 2016 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_LIBRARY_INITIALIZED 3 "29 Sep 2016"
|
||||
.SH NAME
|
||||
ares_library_initialized \- get the initialization state
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
int ares_library_initialized(void)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
Returns information if c-ares needs to get initialized.
|
||||
.SH RETURN VALUE
|
||||
\fIARES_ENOTINITIALIZED\fP if not initialized and \fIARES_SUCCESS\fP if no
|
||||
initialization is needed.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.11.0
|
||||
.SH SEE ALSO
|
||||
.BR ares_library_init(3),
|
||||
.BR ares_library_cleanup(3)
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
.\"
|
||||
.\" Copyright 1998, 2000 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_MKQUERY 3 "20 Nov 2009"
|
||||
.SH NAME
|
||||
ares_mkquery \- Compose a single-question DNS query buffer
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
|
||||
.B unsigned short \fIid\fP, int \fIrd\fP, unsigned char **\fIbuf\fP,
|
||||
.B int *\fIbuflen\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
Deprecated function. See \fIares_create_query(3)\fP instead!
|
||||
|
||||
The
|
||||
.B ares_mkquery
|
||||
function composes a DNS query with a single question.
|
||||
The parameter
|
||||
.I name
|
||||
gives the query name as a NUL-terminated C string of period-separated
|
||||
labels optionally ending with a period; periods and backslashes within
|
||||
a label must be escaped with a backlash. The parameters
|
||||
.I dnsclass
|
||||
and
|
||||
.I type
|
||||
give the class and type of the query using the values defined in
|
||||
.BR <arpa/nameser.h> .
|
||||
The parameter
|
||||
.I id
|
||||
gives a 16-bit identifier for the query. The parameter
|
||||
.I rd
|
||||
should be nonzero if recursion is desired, zero if not. The query
|
||||
will be placed in an allocated buffer, a pointer to which will be
|
||||
stored in the variable pointed to by
|
||||
.IR buf ,
|
||||
and the length of which will be stored in the variable pointed to by
|
||||
.IR buflen .
|
||||
It is the caller's responsibility to free this buffer using
|
||||
\fIares_free_string(3)\fP when it is no longer needed.
|
||||
|
||||
Usage of \fIares_mkquery(3)\fP is deprecated, whereas the function is
|
||||
equivalent to \fIares_create_query(3)\fP with \fBmax_udp_size\fP set to
|
||||
0.
|
||||
|
||||
.SH RETURN VALUES
|
||||
.B ares_mkquery
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
Construction of the DNS query succeeded.
|
||||
.TP 15
|
||||
.B ARES_ENOTFOUND
|
||||
The query name
|
||||
.I name
|
||||
refers to a
|
||||
.I .onion
|
||||
domain name. See RFC 7686.
|
||||
.TP 15
|
||||
.B ARES_EBADNAME
|
||||
The query name
|
||||
.I name
|
||||
could not be encoded as a domain name, either because it contained a
|
||||
zero-length label or because it contained a label of more than 63
|
||||
characters.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH SEE ALSO
|
||||
.BR ares_expand_name (3),
|
||||
.BR ares_free_string (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998, 2000 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_A_REPLY 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_parse_a_reply \- Parse a reply to a DNS query of type A
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_a_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
||||
.B struct hostent **\fIhost\fP,
|
||||
.B struct ares_addrttl *\fIaddrttls\fP, int *\fInaddrttls\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_a_reply
|
||||
function parses the response to a query of type A into a
|
||||
.BR "struct hostent"
|
||||
and/or an array of
|
||||
.BR "struct ares_addrttls" .
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR host ,
|
||||
if host is nonnull.
|
||||
It is the caller's responsibility to free the resulting host structure
|
||||
using
|
||||
.BR ares_free_hostent (3)
|
||||
when it is no longer needed.
|
||||
.PP
|
||||
If
|
||||
.IR addrttls
|
||||
and
|
||||
.IR naddrttls
|
||||
are both nonnull,
|
||||
then up to *naddrttls
|
||||
.BR "struct ares_addrttl"
|
||||
records are stored in the array pointed to by addrttls,
|
||||
and then *naddrttls is set to the number of records so stored.
|
||||
Note that the memory for these records is supplied by the caller.
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_a_reply
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH SEE ALSO
|
||||
.BR ares_gethostbyname (3),
|
||||
.BR ares_free_hostent (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Andrew Selivanov <andrew.selivanov@gmail.com>
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
.\"
|
||||
.\" Copyright 2005 by Dominick Meglio.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_AAAA_REPLY 3 "20 Nov 2009"
|
||||
.SH NAME
|
||||
ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_aaaa_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
||||
.B struct hostent **\fIhost\fP,
|
||||
.B struct ares_addr6ttl *\fIaddrttls\fP, int *\fInaddrttls\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_aaaa_reply
|
||||
function parses the response to a query of type AAAA into a
|
||||
.BR "struct hostent"
|
||||
and/or an array of
|
||||
.BR "struct ares_addr6ttl" .
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR host ,
|
||||
if host is nonnull.
|
||||
It is the caller's responsibility to free the resulting host structure
|
||||
using
|
||||
.BR ares_free_hostent (3)
|
||||
when it is no longer needed.
|
||||
.PP
|
||||
If
|
||||
.IR addrttls
|
||||
and
|
||||
.IR naddrttls
|
||||
are both nonnull,
|
||||
then up to *naddrttls
|
||||
.BR "struct ares_addr6ttl"
|
||||
records are stored in the array pointed to by addrttls,
|
||||
and then *naddrttls is set to the number of records so stored.
|
||||
Note that the memory for these records is supplied by the caller.
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_aaaa_reply
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH SEE ALSO
|
||||
.BR ares_gethostbyname (3),
|
||||
.BR ares_free_hostent (3)
|
||||
.SH AUTHOR
|
||||
Dominick Meglio
|
||||
.br
|
||||
Copyright 2005 by Dominick Meglio.
|
||||
.BR
|
||||
Andrew Selivanov <andrew.selivanov@gmail.com>
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
.\"
|
||||
.\" Copyright 2020 Danny Sonnenschein <my.card.god@web.de>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_CAA_REPLY 3 "16 September 2020"
|
||||
.SH NAME
|
||||
ares_parse_caa_reply \- Parse a reply to a DNS query of type CAA
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
int ares_parse_caa_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
|
||||
struct ares_caa_reply **\fIcaa_out\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR "ares_parse_caa_reply"
|
||||
function parses the response to a query of type CAA into a
|
||||
linked list (one element per sub-string) of
|
||||
.IR "struct ares_caa_reply"
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR caa_out .
|
||||
It is the caller's responsibility to free the resulting
|
||||
.IR caa_out
|
||||
structure when it is no longer needed using the function
|
||||
.B ares_free_data(3)
|
||||
.PP
|
||||
The structure
|
||||
.I ares_caa_reply(3)
|
||||
contains the following fields:
|
||||
.sp
|
||||
.in +4n
|
||||
.nf
|
||||
struct ares_caa_reply {
|
||||
struct ares_caa_reply *next;
|
||||
int critical;
|
||||
unsigned char *property;
|
||||
size_t plength; /* plength excludes null */
|
||||
unsigned char *value;
|
||||
size_t length; /* length excludes null */
|
||||
};
|
||||
.fi
|
||||
.in
|
||||
.PP
|
||||
.SH RETURN VALUES
|
||||
.BR "ares_parse_caa_reply"
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH EXAMPLE
|
||||
.nf
|
||||
#include <arpa/inet.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ares.h"
|
||||
|
||||
static void dns_callback(void *arg,
|
||||
int status,
|
||||
int timeouts,
|
||||
unsigned char *abuf,
|
||||
int alen)
|
||||
{
|
||||
struct ares_caa_reply *caa_out;
|
||||
int err;
|
||||
|
||||
err = ares_parse_caa_reply (abuf, alen, &caa_out);
|
||||
if (err == ARES_SUCCESS)
|
||||
{
|
||||
struct ares_caa_reply *caa_curr;
|
||||
for (caa_curr=caa_out; caa_curr; caa_curr=caa_curr->next)
|
||||
printf ("%s. CAA %i %s \\"%s\\"\\n", arg,
|
||||
caa_curr->critical,
|
||||
caa_curr->property,
|
||||
caa_curr->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("err=%i\\n", err);
|
||||
}
|
||||
ares_free_data (caa_out);
|
||||
}
|
||||
|
||||
static void main_loop(ares_channel *channel)
|
||||
{
|
||||
int nfds, count;
|
||||
fd_set readers, writers;
|
||||
struct timeval tv, *tvp;
|
||||
while (1)
|
||||
{
|
||||
FD_ZERO (&readers);
|
||||
FD_ZERO (&writers);
|
||||
nfds = ares_fds (*channel, &readers, &writers);
|
||||
if (nfds == 0)
|
||||
break;
|
||||
tvp = ares_timeout (*channel, NULL, &tv);
|
||||
count = select (nfds, &readers, &writers, NULL, tvp);
|
||||
ares_process (*channel, &readers, &writers);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *sversion;
|
||||
int iversion;
|
||||
int err;
|
||||
|
||||
sversion = ares_version (&iversion);
|
||||
printf ("c-ares version %s\\n", sversion);
|
||||
|
||||
char *domain = "wikipedia.org";
|
||||
if (argc > 1)
|
||||
domain = argv[1];
|
||||
|
||||
ares_channel channel;
|
||||
if ((err = ares_init (&channel)) != ARES_SUCCESS)
|
||||
{
|
||||
printf ("ares_init() failed (%i)\\n", err);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ares_query (channel, domain,
|
||||
1, /* ns_c_in */
|
||||
257, /* T_CAA */
|
||||
dns_callback, domain);
|
||||
|
||||
main_loop (&channel);
|
||||
|
||||
ares_destroy (channel);
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
.fi
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.17.0.
|
||||
.SH SEE ALSO
|
||||
.BR ares_query (3)
|
||||
.BR ares_free_data (3)
|
||||
.SH AUTHOR
|
||||
Written by Danny Sonnenschein <my.card.god@web.de>, on behalf of platynum, https://platynum.ch
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_MX_REPLY 3 "4 August 2009"
|
||||
.SH NAME
|
||||
ares_parse_mx_reply \- Parse a reply to a DNS query of type MX
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_mx_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
|
||||
.B struct ares_mx_reply** \fImx_out\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_mx_reply
|
||||
function parses the response to a query of type MX into a
|
||||
linked list of
|
||||
.I struct ares_mx_reply
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR mx_out .
|
||||
It is the caller's responsibility to free the resulting
|
||||
.IR mx_out
|
||||
structure when it is no longer needed using the function
|
||||
.B ares_free_data
|
||||
.PP
|
||||
The structure
|
||||
.I ares_mx_reply
|
||||
contains the following fields:
|
||||
.sp
|
||||
.in +4n
|
||||
.nf
|
||||
struct ares_mx_reply {
|
||||
struct ares_mx_reply *next;
|
||||
char *host;
|
||||
unsigned short priority;
|
||||
};
|
||||
.fi
|
||||
.in
|
||||
.PP
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_mx_reply
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.7.2.
|
||||
.SH SEE ALSO
|
||||
.BR ares_query (3)
|
||||
.BR ares_free_data (3)
|
||||
.SH AUTHOR
|
||||
Written by Jeremy Lal <kapouer@melix.org>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_NAPTR_REPLY 3 "23 February 2012"
|
||||
.SH NAME
|
||||
ares_parse_naptr_reply \- Parse a reply to a DNS query of type NAPTR
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_naptr_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
|
||||
.B struct ares_naptr_reply** \fInaptr_out\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_naptr_reply
|
||||
function parses the response to a query of type NAPTR into a
|
||||
linked list of
|
||||
.I struct ares_naptr_reply
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR naptr_out .
|
||||
It is the caller's responsibility to free the resulting
|
||||
.IR naptr_out
|
||||
structure when it is no longer needed using the function
|
||||
.B ares_free_data
|
||||
.PP
|
||||
The structure
|
||||
.I ares_naptr_reply
|
||||
contains the following fields:
|
||||
.sp
|
||||
.in +4n
|
||||
.nf
|
||||
struct ares_naptr_reply {
|
||||
struct ares_naptr_reply *next;
|
||||
unsigned char *flags;
|
||||
unsigned char *service;
|
||||
unsigned char *regexp;
|
||||
char *replacement;
|
||||
unsigned short order;
|
||||
unsigned short preference;
|
||||
};
|
||||
.fi
|
||||
.in
|
||||
.PP
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_naptr_reply
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.7.6.
|
||||
.SH SEE ALSO
|
||||
.BR ares_query (3)
|
||||
.BR ares_free_data (3)
|
||||
.SH AUTHOR
|
||||
Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_NS_REPLY 3 "10 February 2007"
|
||||
.SH NAME
|
||||
ares_parse_ns_reply \- Parse a reply to a DNS query of type NS into a hostent
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_ns_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
||||
.B struct hostent **\fIhost\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_ns_reply
|
||||
function parses the response to a query of type NS into a
|
||||
.BR "struct hostent" .
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR host .
|
||||
The nameservers are stored into the
|
||||
.BR aliases
|
||||
field of the
|
||||
.IR host
|
||||
structure.
|
||||
It is the caller's responsibility to free the resulting host structure
|
||||
using
|
||||
.BR ares_free_hostent (3)
|
||||
when it is no longer needed.
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_ns_reply
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH SEE ALSO
|
||||
.BR ares_query (3),
|
||||
.BR ares_free_hostent (3)
|
||||
.SH AUTHOR
|
||||
Written by Vlad Dinulescu <vlad.dinulescu@avira.com>, on behalf of AVIRA Gmbh http://www.avira.com
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_PTR_REPLY 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_parse_ptr_reply \- Parse a reply to a DNS query of type PTR into a hostent
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_ptr_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
||||
.B const void *\fIaddr\fP, int \fIaddrlen\fP, int \fIfamily\fP,
|
||||
.B struct hostent **\fIhost\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_ptr_reply
|
||||
function parses the response to a query of type PTR into a
|
||||
.BR "struct hostent" .
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The parameters
|
||||
.IR addr ,
|
||||
.IR addrlen ,
|
||||
and
|
||||
.I family
|
||||
specify which address was queried for; they are not used to verify the
|
||||
response, merely used to fill in the address of the
|
||||
.BR "struct hostent" .
|
||||
The resulting
|
||||
.B struct hostent
|
||||
is stored in allocated memory and a pointer to it stored into the
|
||||
variable pointed to by
|
||||
.IR host .
|
||||
It is the caller's responsibility to free the resulting host structure
|
||||
using
|
||||
.BR ares_free_hostent (3)
|
||||
when it is no longer needed.
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_ptr_reply
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH SEE ALSO
|
||||
.BR ares_gethostbyaddr (3),
|
||||
.BR ares_free_hostent (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_SOA_REPLY 3 "29 May 2012"
|
||||
.SH NAME
|
||||
ares_parse_soa_reply \- Parse a reply to a DNS query of type SOA
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_soa_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
|
||||
.B struct ares_soa_reply** \fIsoa_out\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_soa_reply
|
||||
function parses the response to a query of type SOA into a
|
||||
.IR struct\ ares_soa_reply .
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR soa_out .
|
||||
It is the caller's responsibility to free the resulting
|
||||
.IR soa_out
|
||||
structure when it is no longer needed using the function
|
||||
.B ares_free_data
|
||||
.PP
|
||||
The structure
|
||||
.I ares_soa_reply
|
||||
contains the following fields:
|
||||
.sp
|
||||
.in +4n
|
||||
.nf
|
||||
struct ares_soa_reply {
|
||||
char *nsname;
|
||||
char *hostmaster;
|
||||
unsigned int serial;
|
||||
unsigned int refresh;
|
||||
unsigned int retry;
|
||||
unsigned int expire;
|
||||
unsigned int minttl;
|
||||
};
|
||||
.fi
|
||||
.in
|
||||
.PP
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_soa_reply
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.9.0.
|
||||
.SH SEE ALSO
|
||||
.BR ares_query (3)
|
||||
.BR ares_free_data (3)
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_SRV_REPLY 3 "4 August 2009"
|
||||
.SH NAME
|
||||
ares_parse_srv_reply \- Parse a reply to a DNS query of type SRV
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_srv_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
|
||||
.B struct ares_srv_reply** \fIsrv_out\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_srv_reply
|
||||
function parses the response to a query of type SRV into a
|
||||
linked list of
|
||||
.I struct ares_srv_reply
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR srv_out .
|
||||
It is the caller's responsibility to free the resulting
|
||||
.IR srv_out
|
||||
structure when it is no longer needed using the function
|
||||
.B ares_free_data
|
||||
.PP
|
||||
The structure
|
||||
.I ares_srv_reply
|
||||
contains the following fields:
|
||||
.sp
|
||||
.in +4n
|
||||
.nf
|
||||
struct ares_srv_reply {
|
||||
struct ares_srv_reply *next;
|
||||
unsigned short weight;
|
||||
unsigned short priority;
|
||||
unsigned short port;
|
||||
char *host;
|
||||
};
|
||||
.fi
|
||||
.in
|
||||
.PP
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_srv_reply
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.7.0.
|
||||
.SH SEE ALSO
|
||||
.BR ares_query (3)
|
||||
.BR ares_free_data (3)
|
||||
.SH AUTHOR
|
||||
Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PARSE_TXT_REPLY 3 "27 October 2009"
|
||||
.SH NAME
|
||||
ares_parse_txt_reply \- Parse a reply to a DNS query of type TXT
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_txt_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
|
||||
.B struct ares_txt_reply **\fItxt_out\fP);
|
||||
.PP
|
||||
.B int ares_parse_txt_reply_ext(const unsigned char* \fIabuf\fP, int \fIalen\fP,
|
||||
.B struct ares_txt_ext **\fItxt_out\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR "ares_parse_txt_reply" " (" "ares_parse_txt_reply_ext" ")"
|
||||
function parses the response to a query of type TXT into a
|
||||
linked list (one element per sub-string) of
|
||||
.IR "struct ares_txt_reply" " (" "struct ares_txt_ext" ")"
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR txt_out .
|
||||
It is the caller's responsibility to free the resulting
|
||||
.IR txt_out
|
||||
structure when it is no longer needed using the function
|
||||
.B ares_free_data
|
||||
.PP
|
||||
The structure
|
||||
.I ares_txt_reply
|
||||
contains the following fields:
|
||||
.sp
|
||||
.in +4n
|
||||
.nf
|
||||
struct ares_txt_reply {
|
||||
struct ares_txt_reply *next;
|
||||
unsigned int length;
|
||||
unsigned char *txt;
|
||||
};
|
||||
.fi
|
||||
.in
|
||||
.PP
|
||||
The structure
|
||||
.I ares_txt_ext
|
||||
contains the following fields:
|
||||
.sp
|
||||
.in +4n
|
||||
.nf
|
||||
struct ares_txt_ext {
|
||||
struct ares_txt_ext *next;
|
||||
unsigned int length;
|
||||
unsigned char *txt;
|
||||
unsigned char record_start;
|
||||
};
|
||||
.fi
|
||||
.in
|
||||
.PP
|
||||
The
|
||||
.I record_start
|
||||
field in
|
||||
.I struct ares_txt_ext
|
||||
is 1 if this structure is a start of a TXT record, and 0 if the structure is a
|
||||
continuation of a previous record. The linked list of the
|
||||
.I struct ares_txt_ext
|
||||
will have at least one item with
|
||||
.I record_start
|
||||
equal to 1, and may have some items with
|
||||
.I record_start
|
||||
equal to 0 between them.
|
||||
.PP
|
||||
These sequences of
|
||||
.I struct ares_txt_ext
|
||||
(starting from the item with
|
||||
.I record_start
|
||||
equal to 1, and ending right before the record start item) may be treated as
|
||||
either components of a single TXT record or as a multi-parted TXT record,
|
||||
depending on particular use case.
|
||||
.PP
|
||||
.SH RETURN VALUES
|
||||
.BR "ares_parse_txt_reply" " (" "ares_parse_txt_reply_ext" ")"
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The response was successfully parsed.
|
||||
.TP 15
|
||||
.B ARES_EBADRESP
|
||||
The response was malformatted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The response did not contain an answer to the query.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.SH AVAILABILITY
|
||||
This function was first introduced in c-ares version 1.7.0.
|
||||
.SH SEE ALSO
|
||||
.BR ares_query (3)
|
||||
.BR ares_free_data (3)
|
||||
.SH AUTHOR
|
||||
Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com
|
||||
.PP
|
||||
Amended by Fedor Indutny <fedor@indutny.com>, on behalf of PayPal, Inc https://www.paypal.com
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_PROCESS 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_process \- Process events for name resolution
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
void ares_process(ares_channel \fIchannel\fP,
|
||||
fd_set *\fIread_fds\fP,
|
||||
fd_set *\fIwrite_fds\fP)
|
||||
|
||||
void ares_process_fd(ares_channel \fIchannel\fP,
|
||||
ares_socket_t \fIread_fd\fP,
|
||||
ares_socket_t \fIwrite_fd\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_process(3)\fP function handles input/output events and timeouts
|
||||
associated with queries pending on the name service channel identified by
|
||||
.IR channel .
|
||||
The file descriptor sets pointed to by \fIread_fds\fP and \fIwrite_fds\fP
|
||||
should have file descriptors set in them according to whether the file
|
||||
descriptors specified by \fIares_fds(3)\fP are ready for reading and writing.
|
||||
(The easiest way to determine this information is to invoke \fBselect(3)\fP
|
||||
with a timeout no greater than the timeout given by \fIares_timeout(3)\fP).
|
||||
|
||||
The \fBares_process(3)\fP function will invoke callbacks for pending queries
|
||||
if they complete successfully or fail.
|
||||
|
||||
\fBares_process_fd(3)\fP works the same way but acts and operates only on the
|
||||
specific file descriptors (sockets) you pass in to the function. Use
|
||||
ARES_SOCKET_BAD for "no action". This function is provided to allow users of
|
||||
c-ares to void \fIselect(3)\fP in their applications and within c-ares.
|
||||
|
||||
To only process possible timeout conditions without a socket event occurring,
|
||||
one may pass NULL as the values for both \fIread_fds\fP and \fIwrite_fds\fP for
|
||||
\fBares_process(3)\fP, or ARES_SOCKET_BAD for both \fIread_fd\fP and
|
||||
\fIwrite_fd\fP for \fBares_process_fd(3)\fP.
|
||||
.SH EXAMPLE
|
||||
The following code fragment waits for all pending queries on a channel
|
||||
to complete:
|
||||
|
||||
.nf
|
||||
int nfds, count;
|
||||
fd_set readers, writers;
|
||||
struct timeval tv, *tvp;
|
||||
|
||||
while (1) {
|
||||
FD_ZERO(&readers);
|
||||
FD_ZERO(&writers);
|
||||
nfds = ares_fds(channel, &readers, &writers);
|
||||
if (nfds == 0)
|
||||
break;
|
||||
tvp = ares_timeout(channel, NULL, &tv);
|
||||
count = select(nfds, &readers, &writers, NULL, tvp);
|
||||
ares_process(channel, &readers, &writers);
|
||||
}
|
||||
.fi
|
||||
.SH SEE ALSO
|
||||
.BR ares_fds (3),
|
||||
.BR ares_timeout (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_QUERY 3 "24 July 1998"
|
||||
.SH NAME
|
||||
ares_query \- Initiate a single-question DNS query
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
||||
.B int \fItimeouts\fP, unsigned char *\fIabuf\fP, int \fIalen\fP)
|
||||
.PP
|
||||
.B void ares_query(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
||||
.B int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
|
||||
.B void *\fIarg\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_query
|
||||
function initiates a single-question DNS query on the name service
|
||||
channel identified by
|
||||
.IR channel .
|
||||
The parameter
|
||||
.I name
|
||||
gives the query name as a NUL-terminated C string of period-separated
|
||||
labels optionally ending with a period; periods and backslashes within
|
||||
a label must be escaped with a backslash. The parameters
|
||||
.I dnsclass
|
||||
and
|
||||
.I type
|
||||
give the class and type of the query using the values defined in
|
||||
.BR <arpa/nameser.h> .
|
||||
When the query is complete or has failed, the ares library will invoke
|
||||
.IR callback .
|
||||
Completion or failure of the query may happen immediately, or may
|
||||
happen during a later call to
|
||||
.BR ares_process (3)
|
||||
or
|
||||
.BR ares_destroy (3).
|
||||
.PP
|
||||
The callback argument
|
||||
.I arg
|
||||
is copied from the
|
||||
.B ares_query
|
||||
argument
|
||||
.IR arg .
|
||||
The callback argument
|
||||
.I status
|
||||
indicates whether the query succeeded and, if not, how it failed. It
|
||||
may have any of the following values:
|
||||
.TP 19
|
||||
.B ARES_SUCCESS
|
||||
The query completed successfully.
|
||||
.TP 19
|
||||
.B ARES_ENODATA
|
||||
The query completed but contains no answers.
|
||||
.TP 19
|
||||
.B ARES_EFORMERR
|
||||
The query completed but the server claims that the query was
|
||||
malformatted.
|
||||
.TP 19
|
||||
.B ARES_ESERVFAIL
|
||||
The query completed but the server claims to have experienced a
|
||||
failure. (This code can only occur if the
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
flag was specified at channel initialization time; otherwise, such
|
||||
responses are ignored at the
|
||||
.BR ares_send (3)
|
||||
level.)
|
||||
.TP 19
|
||||
.B ARES_ENOTFOUND
|
||||
The query completed but the queried-for domain name was not found.
|
||||
.TP 19
|
||||
.B ARES_ENOTIMP
|
||||
The query completed but the server does not implement the operation
|
||||
requested by the query. (This code can only occur if the
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
flag was specified at channel initialization time; otherwise, such
|
||||
responses are ignored at the
|
||||
.BR ares_send (3)
|
||||
level.)
|
||||
.TP 19
|
||||
.B ARES_EREFUSED
|
||||
The query completed but the server refused the query. (This code can
|
||||
only occur if the
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
flag was specified at channel initialization time; otherwise, such
|
||||
responses are ignored at the
|
||||
.BR ares_send (3)
|
||||
level.)
|
||||
.TP 19
|
||||
.B ARES_EBADNAME
|
||||
The query name
|
||||
.I name
|
||||
could not be encoded as a domain name, either because it contained a
|
||||
zero-length label or because it contained a label of more than 63
|
||||
characters.
|
||||
.TP 19
|
||||
.B ARES_ETIMEOUT
|
||||
No name servers responded within the timeout period.
|
||||
.TP 19
|
||||
.B ARES_ECONNREFUSED
|
||||
No name servers could be contacted.
|
||||
.TP 19
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.TP 19
|
||||
.B ARES_ECANCELLED
|
||||
The query was cancelled.
|
||||
.TP 19
|
||||
.B ARES_EDESTRUCTION
|
||||
The name service channel
|
||||
.I channel
|
||||
is being destroyed; the query will not be completed.
|
||||
.PP
|
||||
The callback argument
|
||||
.I timeouts
|
||||
reports how many times a query timed out during the execution of the
|
||||
given request.
|
||||
.PP
|
||||
If the query completed (even if there was something wrong with it, as
|
||||
indicated by some of the above error codes), the callback argument
|
||||
.I abuf
|
||||
points to a result buffer of length
|
||||
.IR alen .
|
||||
If the query did not complete,
|
||||
.I abuf
|
||||
will be NULL and
|
||||
.I alen
|
||||
will be 0.
|
||||
.SH SEE ALSO
|
||||
.BR ares_process (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SAVE_OPTIONS 3 "5 March 2010"
|
||||
.SH NAME
|
||||
ares_save_options \- Save configuration values obtained from initialized ares_channel
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_save_options(ares_channel \fIchannel\fP, struct ares_options *\fIoptions\fP, int *\fIoptmask\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_save_options(3)\fP function saves the channel data identified by
|
||||
.IR channel ,
|
||||
into the options struct identified by
|
||||
.IR options ,
|
||||
and saves the mask of options which are set to the integer
|
||||
pointer (passed by reference) identified by
|
||||
.IR optmask .
|
||||
|
||||
The resultant options and optmask are then able to be
|
||||
passed directly to ares_init_options. When the options
|
||||
are no longer needed, ares_destroy_options should be called
|
||||
to free any associated memory.
|
||||
.SH RETURN VALUES
|
||||
.B ares_save_options(3)
|
||||
can return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The channel data was successfully stored
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
The memory was exhausted
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The channel data identified by
|
||||
.IR channel
|
||||
were invalid.
|
||||
.SH NOTE
|
||||
Since c-ares 1.6.0 the ares_options struct has been "locked" meaning that it
|
||||
won't be extended to cover new functions. This function will remain
|
||||
functioning, but it can only return config data that can be represented in
|
||||
this config struct, which may no longer be the complete set of config
|
||||
options. \fBares_dup(3)\fP will not have that restriction.
|
||||
|
||||
The ares_options struct can not handle potential IPv6 name servers the
|
||||
ares_channel might be configured to use. The \fBares_save_options(3)\fP function
|
||||
will only return IPv4 servers, if any. In order to retrieve all name servers
|
||||
an ares_channel might be using, the \fBares_get_servers(3)\fP function must be
|
||||
used instead.
|
||||
.SH SEE ALSO
|
||||
.BR ares_destroy_options (3),
|
||||
.BR ares_init_options (3),
|
||||
.BR ares_get_servers (3),
|
||||
.BR ares_dup (3)
|
||||
.SH AVAILABILITY
|
||||
ares_save_options(3) was added in c-ares 1.4.0
|
||||
.SH AUTHOR
|
||||
Brad House
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SEARCH 3 "24 July 1998"
|
||||
.SH NAME
|
||||
ares_search \- Initiate a DNS query with domain search
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
||||
.B int \fItimeouts\fP, unsigned char *\fIabuf\fP, int \fIalen\fP)
|
||||
.PP
|
||||
.B void ares_search(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
||||
.B int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
|
||||
.B void *\fIarg\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_search
|
||||
function initiates a series of single-question DNS queries on the name
|
||||
service channel identified by
|
||||
.IR channel ,
|
||||
using the channel's search domains as well as a host alias file given
|
||||
by the HOSTALIAS environment variable. The parameter
|
||||
.I name
|
||||
gives the alias name or the base of the query name as a NUL-terminated
|
||||
C string of period-separated labels; if it ends with a period, the
|
||||
channel's search domains will not be used. Periods and backslashes
|
||||
within a label must be escaped with a backslash. The parameters
|
||||
.I dnsclass
|
||||
and
|
||||
.I type
|
||||
give the class and type of the query using the values defined in
|
||||
.BR <arpa/nameser.h> .
|
||||
When the query sequence is complete or has failed, the ares library
|
||||
will invoke
|
||||
.IR callback .
|
||||
Completion or failure of the query sequence may happen immediately, or
|
||||
may happen during a later call to
|
||||
.BR ares_process (3)
|
||||
or
|
||||
.BR ares_destroy (3).
|
||||
.PP
|
||||
The callback argument
|
||||
.I arg
|
||||
is copied from the
|
||||
.B ares_search
|
||||
argument
|
||||
.IR arg .
|
||||
The callback argument
|
||||
.I status
|
||||
indicates whether the query sequence ended with a successful query
|
||||
and, if not, how the query sequence failed. It may have any of the
|
||||
following values:
|
||||
.TP 19
|
||||
.B ARES_SUCCESS
|
||||
A query completed successfully.
|
||||
.TP 19
|
||||
.B ARES_ENODATA
|
||||
No query completed successfully; when the query was tried without a
|
||||
search domain appended, a response was returned with no answers.
|
||||
.TP 19
|
||||
.B ARES_EFORMERR
|
||||
A query completed but the server claimed that the query was
|
||||
malformatted.
|
||||
.TP 19
|
||||
.B ARES_ESERVFAIL
|
||||
No query completed successfully; when the query was tried without a
|
||||
search domain appended, the server claimed to have experienced a
|
||||
failure. (This code can only occur if the
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
flag was specified at channel initialization time; otherwise, such
|
||||
responses are ignored at the
|
||||
.BR ares_send (3)
|
||||
level.)
|
||||
.TP 19
|
||||
.B ARES_ENOTFOUND
|
||||
No query completed successfully; when the query was tried without a
|
||||
search domain appended, the server reported that the queried-for
|
||||
domain name was not found.
|
||||
.TP 19
|
||||
.B ARES_ENOTIMP
|
||||
A query completed but the server does not implement the operation
|
||||
requested by the query. (This code can only occur if the
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
flag was specified at channel initialization time; otherwise, such
|
||||
responses are ignored at the
|
||||
.BR ares_send (3)
|
||||
level.)
|
||||
.TP 19
|
||||
.B ARES_EREFUSED
|
||||
A query completed but the server refused the query. (This code can
|
||||
only occur returned if the
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
flag was specified at channel initialization time; otherwise, such
|
||||
responses are ignored at the
|
||||
.BR ares_send (3)
|
||||
level.)
|
||||
.TP 19
|
||||
.B ARES_TIMEOUT
|
||||
No name servers responded to a query within the timeout period.
|
||||
.TP 19
|
||||
.B ARES_ECONNREFUSED
|
||||
No name servers could be contacted.
|
||||
.TP 19
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.TP 19
|
||||
.B ARES_ECANCELLED
|
||||
The query was cancelled.
|
||||
.TP 19
|
||||
.B ARES_EDESTRUCTION
|
||||
The name service channel
|
||||
.I channel
|
||||
is being destroyed; the query will not be completed.
|
||||
.PP
|
||||
The callback argument
|
||||
.I timeouts
|
||||
reports how many times a query timed out during the execution of the
|
||||
given request.
|
||||
.PP
|
||||
If a query completed successfully, the callback argument
|
||||
.I abuf
|
||||
points to a result buffer of length
|
||||
.IR alen .
|
||||
If the query did not complete successfully,
|
||||
.I abuf
|
||||
will usually be NULL and
|
||||
.I alen
|
||||
will usually be 0, but in some cases an unsuccessful query result may
|
||||
be placed in
|
||||
.IR abuf .
|
||||
.SH SEE ALSO
|
||||
.BR ares_process (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SEND 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_send \- Initiate a DNS query
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
||||
.B int \fItimeouts\fP, unsigned char *\fIabuf\fP, int \fIalen\fP)
|
||||
.PP
|
||||
.B void ares_send(ares_channel \fIchannel\fP, const unsigned char *\fIqbuf\fP,
|
||||
.B int \fIqlen\fP, ares_callback \fIcallback\fP, void *\fIarg\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_send
|
||||
function initiates a DNS query on the name service channel identified
|
||||
by
|
||||
.IR channel .
|
||||
The parameters
|
||||
.I qbuf
|
||||
and
|
||||
.I qlen
|
||||
give the DNS query, which should already have been formatted according
|
||||
to the DNS protocol. When the query is complete or has failed, the
|
||||
ares library will invoke
|
||||
.IR callback .
|
||||
Completion or failure of the query may happen immediately, or may
|
||||
happen during a later call to
|
||||
.BR ares_process (3)
|
||||
or
|
||||
.BR ares_destroy (3).
|
||||
.PP
|
||||
The callback argument
|
||||
.I arg
|
||||
is copied from the
|
||||
.B ares_send
|
||||
argument
|
||||
.IR arg .
|
||||
The callback argument
|
||||
.I status
|
||||
indicates whether the query succeeded and, if not, how it failed. It
|
||||
may have any of the following values:
|
||||
.TP 19
|
||||
.B ARES_SUCCESS
|
||||
The query completed.
|
||||
.TP 19
|
||||
.B ARES_EBADQUERY
|
||||
The query buffer was poorly formed (was not long enough for a DNS
|
||||
header or was too long for TCP transmission).
|
||||
.TP 19
|
||||
.B ARES_ETIMEOUT
|
||||
No name servers responded within the timeout period.
|
||||
.TP 19
|
||||
.B ARES_ECONNREFUSED
|
||||
No name servers could be contacted.
|
||||
.TP 19
|
||||
.B ARES_ENOMEM
|
||||
Memory was exhausted.
|
||||
.TP 19
|
||||
.B ARES_ECANCELLED
|
||||
The query was cancelled.
|
||||
.TP 19
|
||||
.B ARES_EDESTRUCTION
|
||||
The name service channel
|
||||
.I channel
|
||||
is being destroyed; the query will not be completed.
|
||||
.PP
|
||||
The callback argument
|
||||
.I timeouts
|
||||
reports how many times a query timed out during the execution of the
|
||||
given request.
|
||||
.PP
|
||||
If the query completed, the callback argument
|
||||
.I abuf
|
||||
points to a result buffer of length
|
||||
.IR alen .
|
||||
If the query did not complete,
|
||||
.I abuf
|
||||
will be NULL and
|
||||
.I alen
|
||||
will be 0.
|
||||
.PP
|
||||
Unless the flag
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
was set at channel initialization time,
|
||||
.B ares_send
|
||||
will normally ignore responses whose questions do not match the
|
||||
questions in
|
||||
.IR qbuf ,
|
||||
as well as responses with reply codes of
|
||||
.BR SERVFAIL ,
|
||||
.BR NOTIMP ,
|
||||
and
|
||||
.BR REFUSED .
|
||||
Unlike other query functions in the ares library, however,
|
||||
.B ares_send
|
||||
does not inspect the header of the reply packet to determine the error
|
||||
status, so a callback status of
|
||||
.B ARES_SUCCESS
|
||||
does not reflect as much about the response as for other query
|
||||
functions.
|
||||
.SH SEE ALSO
|
||||
.BR ares_process (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
.\"
|
||||
.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SET_LOCAL_DEV 3 "30 June 2010"
|
||||
.SH NAME
|
||||
ares_set_local_dev \- Bind to a specific network device when creating sockets.
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B void ares_set_local_dev(ares_channel \fIchannel\fP, const char* \fIlocal_dev_name\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_set_local_dev\fP function causes all future sockets
|
||||
to be bound to this device with SO_BINDTODEVICE. This forces communications
|
||||
to go over a certain interface, which can be useful on multi-homed machines.
|
||||
This option is only supported on Linux, and root privileges are required
|
||||
for the option to work. If SO_BINDTODEVICE is not supported or the
|
||||
setsocktop call fails (probably because of permissions), the error is
|
||||
silently ignored.
|
||||
.SH SEE ALSO
|
||||
.BR ares_set_local_ip4 (3)
|
||||
.BR ares_set_local_ip6 (3)
|
||||
.SH NOTES
|
||||
This function was added in c-ares 1.7.4
|
||||
.SH AUTHOR
|
||||
Ben Greear
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
.\"
|
||||
.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SET_LOCAL_IP4 3 "30 June 2010"
|
||||
.SH NAME
|
||||
ares_set_local_ip4 \- Set local IPv4 address outgoing requests.
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B void ares_set_local_ip4(ares_channel \fIchannel\fP, unsigned int \fIlocal_ip\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_set_local_ip4\fP function sets the IP address for outbound
|
||||
requests. The parameter \fIlocal_ip\fP is specified in host byte order. This
|
||||
allows users to specify outbound interfaces when used on multi-homed systems.
|
||||
.SH SEE ALSO
|
||||
.BR ares_set_local_ip6 (3)
|
||||
.SH NOTES
|
||||
This function was added in c-ares 1.7.4
|
||||
.SH AUTHOR
|
||||
Ben Greear
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
.\"
|
||||
.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SET_LOCAL_IP6 3 "30 June 2010"
|
||||
.SH NAME
|
||||
ares_set_local_ip6 \- Set local IPv6 address outgoing requests.
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B void ares_set_local_ip6(ares_channel \fIchannel\fP, const unsigned char* \fIlocal_ip6\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_set_local_ip6\fP function sets the IPv6 address for outbound
|
||||
IPv6 requests. The parameter \fIlocal_ip6\fP is specified in network byte
|
||||
order. This allows users to specify outbound interfaces when used on
|
||||
multi-homed systems. The local_ip6 argument must be 16 bytes in length.
|
||||
.SH SEE ALSO
|
||||
.BR ares_set_local_ip4 (3)
|
||||
.SH NOTES
|
||||
This function was added in c-ares 1.7.4
|
||||
.SH AUTHOR
|
||||
Ben Greear
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
.\"
|
||||
.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SET_SERVERS 3 "5 March 2010"
|
||||
.SH NAME
|
||||
ares_set_servers, ares_set_servers_ports \- Initialize an ares_channel name servers configuration
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_set_servers(ares_channel \fIchannel\fP, struct ares_addr_node *\fIservers\fP)
|
||||
.B int ares_set_servers_ports(ares_channel \fIchannel\fP, struct ares_addr_port_node *\fIservers\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_set_servers(3)\fP function initializes name servers configuration
|
||||
for the channel data identified by
|
||||
.IR channel ,
|
||||
from a
|
||||
.IR servers
|
||||
pointer to a linked list of ares_addr_node structs holding name servers
|
||||
address data.
|
||||
.PP
|
||||
The name server linked list pointer argument may be the result of a previous
|
||||
call to \fBares_get_servers(3)\fP or a linked list of \fBares_addr_node\fP structs
|
||||
set up by other means.
|
||||
.PP
|
||||
The \fBares_set_servers(3)\fP function also allows the specification of UDP and
|
||||
TCP ports to be used for communication on a per-server basis. The provided
|
||||
linked list argument may be the result of a previous call to
|
||||
\fBares_get_servers_ports(3)\fP or a linked list of \fBares_addr_port_node\fP structs
|
||||
set up by other means.
|
||||
.PP
|
||||
This function replaces any potentially previously configured name servers
|
||||
with the ones given in the linked list. So, in order to configure a channel
|
||||
with more than one name server all the desired ones must be specified in a
|
||||
single list.
|
||||
.PP
|
||||
The function does not take ownership of the linked list argument.
|
||||
The caller is responsible for freeing the linked list when no longer needed.
|
||||
.PP
|
||||
This function is capable of handling IPv4 and IPv6 name server
|
||||
addresses simultaneously, rendering \fBares_init_options(3)\fP with
|
||||
optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
|
||||
IPv4-only name server usage.
|
||||
|
||||
.SH RETURN VALUES
|
||||
.B ares_set_servers(3)
|
||||
may return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The name servers configuration was successfully initialized.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
The process's available memory was exhausted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The channel data identified by
|
||||
.IR channel
|
||||
was invalid.
|
||||
.TP 15
|
||||
.B ARES_ENOTINITIALIZED
|
||||
c-ares library initialization not yet performed.
|
||||
.TP 15
|
||||
.B ARES_ENOTIMP
|
||||
Changing name servers configuration while queries are outstanding is not implemented.
|
||||
.SH SEE ALSO
|
||||
.BR ares_set_servers_csv (3),
|
||||
.BR ares_get_servers (3),
|
||||
.BR ares_init_options (3),
|
||||
.BR ares_dup(3)
|
||||
.SH AVAILABILITY
|
||||
\fBares_set_servers(3)\fP was added in c-ares 1.7.1;
|
||||
\fBares_set_servers_ports(3)\fP was added in c-ares 1.11.0.
|
||||
.SH AUTHOR
|
||||
Implementation of this function and associated library internals are based
|
||||
on code, comments and feedback provided in November and December of 2008 by
|
||||
Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
|
||||
by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
|
||||
shuffled all the bits and this function popped out.
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
Copyright (C) 2008-2010 by Daniel Stenberg
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
.\"
|
||||
.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SET_SERVERS_CSV 3 "30 June 2010"
|
||||
.SH NAME
|
||||
ares_set_servers_csv, ares_set_servers_ports_csv \- Set list of DNS servers to be used.
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_set_servers_csv(ares_channel \fIchannel\fP, const char* \fIservers\fP)
|
||||
.B int ares_set_servers_ports_csv(ares_channel \fIchannel\fP, const char* \fIservers\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_set_servers_csv\fP and \fBares_set_servers_ports_csv\fPfunctions set
|
||||
the list of DNS servers that ARES will query. The format of the servers option is:
|
||||
|
||||
host[:port][,host[:port]]...
|
||||
|
||||
For example:
|
||||
|
||||
192.168.1.100,192.168.1.101,3.4.5.6
|
||||
.PP
|
||||
The \fBares_set_servers_csv\fP function will ignore any port values specified in
|
||||
the input string, whereare the \fBares_set_servers_ports_csv\fP function will
|
||||
apply any specified port values as the UDP and TCP port to be used for that
|
||||
particular nameserver.
|
||||
|
||||
.SH RETURN VALUES
|
||||
.B ares_set_servers_csv(3)
|
||||
This function may return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The name servers configuration was successfully initialized.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
The process's available memory was exhausted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The channel data identified by
|
||||
.IR channel
|
||||
was invalid.
|
||||
.TP 15
|
||||
.B ARES_ENOTINITIALIZED
|
||||
c-ares library initialization not yet performed.
|
||||
.TP 15
|
||||
.B ARES_ENOTIMP
|
||||
Changing name servers configuration while queries are outstanding is not implemented.
|
||||
.SH SEE ALSO
|
||||
.BR ares_set_servers (3)
|
||||
.SH AVAILABILITY
|
||||
\fBares_set_servers_csv\fP was added in c-ares 1.7.2;
|
||||
\fBares_set_servers_ports_csv\fP was added in c-ares 1.11.0.
|
||||
.SH AUTHOR
|
||||
Ben Greear
|
||||
|
|
@ -0,0 +1 @@
|
|||
.so man3/ares_set_servers.3
|
||||
|
|
@ -0,0 +1 @@
|
|||
.so man3/ares_set_servers_csv.3
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
.\"
|
||||
.TH ARES_SET_SOCKET_CALLBACK 3 "20 Nov 2009"
|
||||
.SH NAME
|
||||
ares_set_socket_callback \- Set a socket creation callback
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef int (*ares_sock_create_callback)(ares_socket_t \fIsocket_fd\fP,
|
||||
int \fItype\fP,
|
||||
void *\fIuserdata\fP)
|
||||
.PP
|
||||
.B void ares_set_socket_callback(ares_channel \fIchannel\fP,
|
||||
ares_sock_create_callback \fIcallback\fP,
|
||||
void *\fIuserdata\fP)
|
||||
.PP
|
||||
.B cc file.c -lcares
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This function sets a \fIcallback\fP in the given ares channel handle. This
|
||||
callback function will be invoked after the socket has been created, and
|
||||
connected to the remote server. The callback must return ARES_SUCCESS if
|
||||
things are fine, or return -1 to signal an error. A returned error will
|
||||
abort the ares operation.
|
||||
.SH SEE ALSO
|
||||
.BR ares_init_options (3), ares_set_socket_configure_callback (3)
|
||||
.SH AVAILABILITY
|
||||
ares_set_socket_callback(3) was added in c-ares 1.6.0
|
||||
.SH AUTHOR
|
||||
Gregor Jasny
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
.\"
|
||||
.TH ARES_SET_SOCKET_CONFIGURE_CALLBACK 3 "6 Feb 2016"
|
||||
.SH NAME
|
||||
ares_set_socket_configure_callback \- Set a socket configuration callback
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B typedef int (*ares_sock_config_callback)(ares_socket_t \fIsocket_fd\fP,
|
||||
int \fItype\fP,
|
||||
void *\fIuserdata\fP)
|
||||
.PP
|
||||
.B void ares_set_socket_configure_callback(ares_channel \fIchannel\fP,
|
||||
ares_sock_config_callback \fIcallback\fP,
|
||||
void *\fIuserdata\fP)
|
||||
.PP
|
||||
.B cc file.c -lcares
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This function sets a \fIcallback\fP in the given ares channel handle. This
|
||||
callback function will be invoked after the socket has been created, but
|
||||
before it has been connected to the remote server, which is an ideal time
|
||||
to configure various socket options. The callback must return ARES_SUCCESS
|
||||
if things are fine, or return -1 to signal an error. A returned error will
|
||||
abort the ares operation.
|
||||
.SH SEE ALSO
|
||||
.BR ares_init_options (3), ares_set_socket_callback (3)
|
||||
.SH AVAILABILITY
|
||||
ares_set_socket_configure_callback(3) was added in c-ares 1.11.0
|
||||
.SH AUTHOR
|
||||
Andrew Ayer
|
||||
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
.\"
|
||||
.TH ARES_SET_SOCKET_FUNCTIONS 3 "13 Dec 2016"
|
||||
.SH NAME
|
||||
ares_set_socket_functions \- Set socket io callbacks
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B struct ares_socket_functions {
|
||||
ares_socket_t(*\fIasocket\fP)(int, int, int, void *);
|
||||
int(*\fIaclose\fP)(ares_socket_t, void *);
|
||||
int(*\fIaconnect\fP)(ares_socket_t, const struct sockaddr *, ares_socklen_t, void *);
|
||||
ares_ssize_t(*\fIarecvfrom\fP)(ares_socket_t, void *, size_t, int, struct sockaddr *, ares_socklen_t *, void *);
|
||||
ares_ssize_t(*\fIasendv\fP)(ares_socket_t, const struct iovec *, int, void *);
|
||||
};
|
||||
|
||||
.PP
|
||||
.B void ares_set_socket_functions(ares_channel \fIchannel\fP,
|
||||
const struct ares_socket_functions * \fIfunctions\fP,
|
||||
void *\fIuser_data\fP);
|
||||
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This function sets a set of callback \fIfunctions\fP in the given ares channel handle.
|
||||
These callback functions will be invoked to create/destroy socket objects and perform
|
||||
io, instead of the normal system calls. A client application can override normal network
|
||||
operation fully through this functionality, and provide its own transport layer.
|
||||
.PP
|
||||
All callback functions are expected to operate like their system equivalents, and to
|
||||
set
|
||||
.BR errno(3)
|
||||
to an appropriate error code on failure. C-ares also expects all io functions to behave
|
||||
asynchronously, i.e. as if the socket object has been set to non-blocking mode. Thus
|
||||
read/write calls (for TCP connections) are expected to often generate
|
||||
.BR EAGAIN
|
||||
or
|
||||
.BR EWOULDBLOCK.
|
||||
|
||||
.PP
|
||||
The \fIuser_data\fP value is provided to each callback function invocation to serve as
|
||||
context.
|
||||
.PP
|
||||
The
|
||||
.B ares_socket_functions
|
||||
must provide the following callbacks:
|
||||
.TP 18
|
||||
.B \fIasocket\fP
|
||||
.B ares_socket_t(*)(int \fIdomain\fP, int \fItype\fP, int \fIprotocol\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Creates an endpoint for communication and returns a descriptor. \fIdomain\fP, \fItype\fP, and \fIprotocol\fP
|
||||
each correspond to the parameters of
|
||||
.BR socket(2).
|
||||
Returns ahandle to the newly created socket, or -1 on error.
|
||||
.TP 18
|
||||
.B \fIaclose\fP
|
||||
.B int(*)(ares_socket_t \fIfd\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Closes the socket endpoint indicated by \fIfd\fP. See
|
||||
.BR close(2)
|
||||
.TP 18
|
||||
.B \fIaconnect\fP
|
||||
.B int(*)(ares_socket_t \fIfd\fP, const struct sockaddr * \fIaddr\fP, ares_socklen_t \fIaddr_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Initiate a connection to the address indicated by \fIaddr\fP on a socket. See
|
||||
.BR connect(2)
|
||||
|
||||
.TP 18
|
||||
.B \fIarecvfrom\fP
|
||||
.B ares_ssize_t(*)(ares_socket_t \fIfd\fP, void * \fIbuffer\fP, size_t \fIbuf_size\fP, int \fIflags\fP, struct sockaddr * \fIaddr\fP, ares_socklen_t * \fIaddr_len\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Receives data from remote socket endpoint, if available. If the \fIaddr\fP parameter is not NULL and the connection protocol provides the source address, the callback should fill this in. See
|
||||
.BR recvfrom(2)
|
||||
|
||||
.TP 18
|
||||
.B \fIasendv\fP
|
||||
.B ares_ssize_t(*)(ares_socket_t \fIfd\fP, const struct iovec * \fIdata\fP, int \fIlen\fP, void * \fIuser_data\fP)
|
||||
.br
|
||||
Send data, as provided by the iovec array \fIdata\fP, to the socket endpoint. See
|
||||
.BR writev(2),
|
||||
|
||||
.PP
|
||||
The
|
||||
.B ares_socket_functions
|
||||
struct provided is not copied but directly referenced,
|
||||
and must thus remain valid through out the channels and any created socket's lifetime.
|
||||
.SH AVAILABILITY
|
||||
Added in c-ares 1.13.0
|
||||
.SH SEE ALSO
|
||||
.BR ares_init_options (3),
|
||||
.BR socket(2),
|
||||
.BR close(2),
|
||||
.BR connect(2),
|
||||
.BR recv(2),
|
||||
.BR recvfrom(2),
|
||||
.BR send(2),
|
||||
.BR writev(2)
|
||||
.SH AUTHOR
|
||||
Carl Wilund
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_SET_SORTLIST 3 "23 November 2015"
|
||||
.SH NAME
|
||||
ares_set_sortlist \- Initialize an ares_channel sortlist configuration
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_set_sortlist(ares_channel \fIchannel\fP, const char *\fIsortstr\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_set_sortlist(3)\fP function initializes an address sortlist configuration
|
||||
for the channel data identified by
|
||||
.IR channel ,
|
||||
so that addresses returned by \fBares_gethostbyname(3)\fP are sorted according to the
|
||||
sortlist. The provided
|
||||
.IR sortstr
|
||||
string that holds a space separated list of IP-address-netmask pairs. The
|
||||
netmask is optional but follows the address after a slash if present. For example,
|
||||
"130.155.160.0/255.255.240.0 130.155.0.0".
|
||||
|
||||
This function replaces any potentially previously configured address sortlist
|
||||
with the ones given in the configuration string.
|
||||
|
||||
.SH RETURN VALUES
|
||||
.B ares_set_sortlist(3)
|
||||
may return any of the following values:
|
||||
.TP 15
|
||||
.B ARES_SUCCESS
|
||||
The sortlist configuration was successfully initialized.
|
||||
.TP 15
|
||||
.B ARES_ENOMEM
|
||||
The process's available memory was exhausted.
|
||||
.TP 15
|
||||
.B ARES_ENODATA
|
||||
The channel data identified by
|
||||
.IR channel
|
||||
was invalid.
|
||||
.TP 15
|
||||
.B ARES_ENOTINITIALIZED
|
||||
c-ares library initialization not yet performed.
|
||||
.SH SEE ALSO
|
||||
.BR ares_init_options (3),
|
||||
.BR ares_dup(3)
|
||||
.SH AVAILABILITY
|
||||
ares_set_sortlist(3) was added in c-ares 1.11.0
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_STRERROR 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_strerror \- Get the description of an ares library error code
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B const char *ares_strerror(int \fIcode\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_strerror
|
||||
function gets the description of the ares library error code
|
||||
.IR code ,
|
||||
returning the result as a NUL-terminated C string.
|
||||
.SH NOTES
|
||||
This function is not compatible with ares, it takes a different set of
|
||||
arguments.
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
.\"
|
||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_TIMEOUT 3 "25 July 1998"
|
||||
.SH NAME
|
||||
ares_timeout \- return maximum time to wait
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
struct timeval *ares_timeout(ares_channel \fIchannel\fP,
|
||||
struct timeval *\fImaxtv\fP,
|
||||
struct timeval *\fItv\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_timeout(3)\fP function determines the maximum time for which the
|
||||
caller should wait before invoking \fIares_process(3)\fP to process timeouts.
|
||||
The parameter \fImaxtv\fP specifies a existing maximum timeout, or \fBNULL\fP
|
||||
if the caller does not wish to apply a maximum timeout. The parameter
|
||||
\fItv\fP must point to a writable buffer of type \fBstruct timeval\fP It is
|
||||
valid for \fImaxtv\fP and \fItv\fP to have the same value.
|
||||
|
||||
If no queries have timeouts pending sooner than the given maximum timeout,
|
||||
\fBares_timeout(3)\fP returns the value of \fImaxtv\fP; otherwise
|
||||
\fBares_timeout(3)\fP stores the appropriate timeout value into the buffer
|
||||
pointed to by \fItv\fP and returns the value of \fItv\fP.
|
||||
.SH SEE ALSO
|
||||
.BR ares_fds (3),
|
||||
.BR ares_process (3),
|
||||
.BR ares_process_fd (3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
.\"
|
||||
.\" Copyright 2004 by Daniel Stenberg
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this
|
||||
.\" software and its documentation for any purpose and without
|
||||
.\" fee is hereby granted, provided that the above copyright
|
||||
.\" notice appear in all copies and that both that copyright
|
||||
.\" notice and this permission notice appear in supporting
|
||||
.\" documentation, and that the name of M.I.T. not be used in
|
||||
.\" advertising or publicity pertaining to distribution of the
|
||||
.\" software without specific, written prior permission.
|
||||
.\" M.I.T. makes no representations about the suitability of
|
||||
.\" this software for any purpose. It is provided "as is"
|
||||
.\" without express or implied warranty.
|
||||
.\"
|
||||
.TH ARES_VERSION 3 "29 January 2004"
|
||||
.SH NAME
|
||||
ares_version \- Get the version number of the library
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <ares.h>
|
||||
|
||||
const char *ares_version(int *\fIversion\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_version(3)\fP function gets the library version as a string and
|
||||
optionally as an integer stored in the \fIversion\fP argument. If you pass a
|
||||
NULL, no integer is attempted to be returned.
|
||||
|
||||
The integer is built up as 24bit number, with 8 separate bits used for major
|
||||
number, minor number and patch number. This makes a version string such as
|
||||
1.2.3 will be returned as the hexadecimal number 0x010203 (decimal 66051).
|
||||
.SH "SEE ALSO"
|
||||
.BR ares_init (3),
|
||||
.BR ares_library_init (3)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# ***************************************************************************
|
||||
# * 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-20100523.zip
|
||||
#
|
||||
BEGIN {
|
||||
while ((getline < ARGV[1]) > 0) {
|
||||
sub("\r", "") # make MSYS gawk work with CRLF header input.
|
||||
if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/))
|
||||
copyright_string = substr($0, 25, length($0)-25)
|
||||
else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/))
|
||||
version_string = substr($3, 2, length($3)-2)
|
||||
else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/))
|
||||
version_major = $3
|
||||
else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/))
|
||||
version_minor = $3
|
||||
else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/))
|
||||
version_patch = $3
|
||||
}
|
||||
print "LIBCARES_VERSION = " version_major "," version_minor "," version_patch
|
||||
print "LIBCARES_VERSION_STR = " version_string
|
||||
print "LIBCARES_COPYRIGHT_STR = " copyright_string
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# git log --pretty=fuller --no-color --date=short --decorate=full
|
||||
|
||||
my @mname = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
|
||||
|
||||
sub nicedate {
|
||||
my ($date)=$_;
|
||||
|
||||
if($date =~ /(\d\d\d\d)-(\d\d)-(\d\d)/) {
|
||||
return sprintf("%d %s %4d", $3, $mname[$2-1], $1);
|
||||
}
|
||||
return $date;
|
||||
}
|
||||
|
||||
print
|
||||
' Changelog for the c-ares project. Generated with git2changes.pl
|
||||
';
|
||||
|
||||
my $line;
|
||||
my $tag;
|
||||
while(<STDIN>) {
|
||||
my $l = $_;
|
||||
|
||||
if($l =~/^commit ([[:xdigit:]]*) ?(.*)/) {
|
||||
$co = $1;
|
||||
my $ref = $2;
|
||||
if ($ref =~ /refs\/tags\/c[-]*ares-([0-9._]*)/) {
|
||||
$tag = $1;
|
||||
$tag =~ s/_/./g;
|
||||
} else {
|
||||
$tag = '';
|
||||
}
|
||||
}
|
||||
elsif($l =~ /^Author: *(.*) +</) {
|
||||
$a = $1;
|
||||
}
|
||||
elsif($l =~ /^Commit: *(.*) +</) {
|
||||
$c = $1;
|
||||
}
|
||||
elsif($l =~ /^CommitDate: (.*)/) {
|
||||
$date = nicedate($1);
|
||||
}
|
||||
elsif($l =~ /^( )(.*)/) {
|
||||
my $extra;
|
||||
if ($tag) {
|
||||
# Version entries have a special format
|
||||
print "\nVersion " . $tag." ($date)\n";
|
||||
$oldc = "";
|
||||
$tag = "";
|
||||
}
|
||||
if($a ne $c) {
|
||||
$extra=sprintf("\n- [%s brought this change]\n\n ", $a);
|
||||
}
|
||||
else {
|
||||
$extra="\n- ";
|
||||
}
|
||||
if($co ne $oldco) {
|
||||
if($c ne $oldc) {
|
||||
print "\n$c ($date)$extra";
|
||||
}
|
||||
else {
|
||||
print "$extra";
|
||||
}
|
||||
$line =0;
|
||||
}
|
||||
|
||||
$oldco = $co;
|
||||
$oldc = $c;
|
||||
$olddate = $date;
|
||||
if($line++) {
|
||||
print " ";
|
||||
}
|
||||
print $2."\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
|
||||
ACLOCAL_AMFLAGS = -I m4 --install
|
||||
|
||||
# what headers to install on 'make install':
|
||||
include_HEADERS = ares.h ares_version.h ares_build.h ares_rules.h ares_dns.h
|
||||
|
||||
EXTRA_DIST = ares_build.h.cmake ares_build.h.in ares_build.h.dist CMakeLists.txt
|
||||
|
|
@ -0,0 +1,742 @@
|
|||
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
* Copyright (C) 2007-2013 by Daniel Stenberg
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of M.I.T. not be used in
|
||||
* advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
* M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#ifndef ARES__H
|
||||
#define ARES__H
|
||||
|
||||
#include "ares_version.h" /* c-ares version defines */
|
||||
#include "ares_build.h" /* c-ares build definitions */
|
||||
#include "ares_rules.h" /* c-ares rules enforcement */
|
||||
|
||||
/*
|
||||
* Define WIN32 when build target is Win32 API
|
||||
*/
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && \
|
||||
!defined(WIN32) && !defined(__SYMBIAN32__)
|
||||
# define WIN32
|
||||
#endif
|
||||
|
||||
#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) || \
|
||||
defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
|
||||
defined(__QNXNTO__) || defined(__MVS__)
|
||||
#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_WCE)
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <winsock.h>
|
||||
#elif defined(WIN32)
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID) || defined(__ANDROID__)
|
||||
#include <jni.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** c-ares external API function linkage decorations.
|
||||
*/
|
||||
|
||||
#ifdef CARES_STATICLIB
|
||||
# define CARES_EXTERN
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
|
||||
# if defined(CARES_BUILDING_LIBRARY)
|
||||
# define CARES_EXTERN __declspec(dllexport)
|
||||
# else
|
||||
# define CARES_EXTERN __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(CARES_BUILDING_LIBRARY) && defined(CARES_SYMBOL_HIDING)
|
||||
# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
|
||||
#else
|
||||
# define CARES_EXTERN
|
||||
#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 */
|
||||
|
||||
/* More ares_getaddrinfo error codes */
|
||||
#define ARES_ESERVICE 25 /* introduced in 1.?.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)
|
||||
#define ARES_FLAG_EDNS (1 << 8)
|
||||
|
||||
/* 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)
|
||||
#define ARES_OPT_EDNSPSZ (1 << 15)
|
||||
#define ARES_OPT_NOROTATE (1 << 16)
|
||||
#define ARES_OPT_RESOLVCONF (1 << 17)
|
||||
|
||||
/* 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)
|
||||
#define ARES_AI_NOSORT (1 << 7)
|
||||
#define ARES_AI_ENVHOSTS (1 << 8)
|
||||
/* 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;
|
||||
int ednspsz;
|
||||
char *resolvconf_path;
|
||||
};
|
||||
|
||||
struct hostent;
|
||||
struct timeval;
|
||||
struct sockaddr;
|
||||
struct ares_channeldata;
|
||||
struct ares_addrinfo;
|
||||
struct ares_addrinfo_hints;
|
||||
|
||||
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);
|
||||
|
||||
typedef int (*ares_sock_config_callback)(ares_socket_t socket_fd,
|
||||
int type,
|
||||
void *data);
|
||||
|
||||
typedef void (*ares_addrinfo_callback)(void *arg,
|
||||
int status,
|
||||
int timeouts,
|
||||
struct ares_addrinfo *res);
|
||||
|
||||
CARES_EXTERN int ares_library_init(int flags);
|
||||
|
||||
CARES_EXTERN int ares_library_init_mem(int flags,
|
||||
void *(*amalloc)(size_t size),
|
||||
void (*afree)(void *ptr),
|
||||
void *(*arealloc)(void *ptr, size_t size));
|
||||
|
||||
#if defined(ANDROID) || defined(__ANDROID__)
|
||||
CARES_EXTERN void ares_library_init_jvm(JavaVM *jvm);
|
||||
CARES_EXTERN int ares_library_init_android(jobject connectivity_manager);
|
||||
CARES_EXTERN int ares_library_android_initialized(void);
|
||||
#endif
|
||||
|
||||
CARES_EXTERN int ares_library_initialized(void);
|
||||
|
||||
CARES_EXTERN void ares_library_cleanup(void);
|
||||
|
||||
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_set_socket_configure_callback(ares_channel channel,
|
||||
ares_sock_config_callback callback,
|
||||
void *user_data);
|
||||
|
||||
CARES_EXTERN int ares_set_sortlist(ares_channel channel,
|
||||
const char *sortstr);
|
||||
|
||||
CARES_EXTERN void ares_getaddrinfo(ares_channel channel,
|
||||
const char* node,
|
||||
const char* service,
|
||||
const struct ares_addrinfo_hints* hints,
|
||||
ares_addrinfo_callback callback,
|
||||
void* arg);
|
||||
|
||||
CARES_EXTERN void ares_freeaddrinfo(struct ares_addrinfo* ai);
|
||||
|
||||
/*
|
||||
* Virtual function set to have user-managed socket IO.
|
||||
* Note that all functions need to be defined, and when
|
||||
* set, the library will not do any bind nor set any
|
||||
* socket options, assuming the client handles these
|
||||
* through either socket creation or the
|
||||
* ares_sock_config_callback call.
|
||||
*/
|
||||
struct iovec;
|
||||
struct ares_socket_functions {
|
||||
ares_socket_t(*asocket)(int, int, int, void *);
|
||||
int(*aclose)(ares_socket_t, void *);
|
||||
int(*aconnect)(ares_socket_t, const struct sockaddr *, ares_socklen_t, void *);
|
||||
ares_ssize_t(*arecvfrom)(ares_socket_t, void *, size_t, int, struct sockaddr *, ares_socklen_t *, void *);
|
||||
ares_ssize_t(*asendv)(ares_socket_t, const struct iovec *, int, void *);
|
||||
};
|
||||
|
||||
CARES_EXTERN void ares_set_socket_functions(ares_channel channel,
|
||||
const struct ares_socket_functions * funcs,
|
||||
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_create_query(const char *name,
|
||||
int dnsclass,
|
||||
int type,
|
||||
unsigned short id,
|
||||
int rd,
|
||||
unsigned char **buf,
|
||||
int *buflen,
|
||||
int max_udp_size);
|
||||
|
||||
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_caa_reply {
|
||||
struct ares_caa_reply *next;
|
||||
int critical;
|
||||
unsigned char *property;
|
||||
size_t plength; /* plength excludes null termination */
|
||||
unsigned char *value;
|
||||
size_t length; /* length excludes null termination */
|
||||
};
|
||||
|
||||
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 */
|
||||
};
|
||||
|
||||
/* NOTE: This structure is a superset of ares_txt_reply
|
||||
*/
|
||||
struct ares_txt_ext {
|
||||
struct ares_txt_ext *next;
|
||||
unsigned char *txt;
|
||||
size_t length;
|
||||
/* 1 - if start of new record
|
||||
* 0 - if a chunk in the same record */
|
||||
unsigned char record_start;
|
||||
};
|
||||
|
||||
struct ares_naptr_reply {
|
||||
struct ares_naptr_reply *next;
|
||||
unsigned char *flags;
|
||||
unsigned char *service;
|
||||
unsigned char *regexp;
|
||||
char *replacement;
|
||||
unsigned short order;
|
||||
unsigned short preference;
|
||||
};
|
||||
|
||||
struct ares_soa_reply {
|
||||
char *nsname;
|
||||
char *hostmaster;
|
||||
unsigned int serial;
|
||||
unsigned int refresh;
|
||||
unsigned int retry;
|
||||
unsigned int expire;
|
||||
unsigned int minttl;
|
||||
};
|
||||
|
||||
/*
|
||||
* Similar to addrinfo, but with extra ttl and missing canonname.
|
||||
*/
|
||||
struct ares_addrinfo_node {
|
||||
int ai_ttl;
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
ares_socklen_t ai_addrlen;
|
||||
struct sockaddr *ai_addr;
|
||||
struct ares_addrinfo_node *ai_next;
|
||||
};
|
||||
|
||||
/*
|
||||
* alias - label of the resource record.
|
||||
* name - value (canonical name) of the resource record.
|
||||
* See RFC2181 10.1.1. CNAME terminology.
|
||||
*/
|
||||
struct ares_addrinfo_cname {
|
||||
int ttl;
|
||||
char *alias;
|
||||
char *name;
|
||||
struct ares_addrinfo_cname *next;
|
||||
};
|
||||
|
||||
struct ares_addrinfo {
|
||||
struct ares_addrinfo_cname *cnames;
|
||||
struct ares_addrinfo_node *nodes;
|
||||
};
|
||||
|
||||
struct ares_addrinfo_hints {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
};
|
||||
|
||||
/*
|
||||
** 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_caa_reply(const unsigned char* abuf,
|
||||
int alen,
|
||||
struct ares_caa_reply** caa_out);
|
||||
|
||||
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 int ares_parse_txt_reply_ext(const unsigned char* abuf,
|
||||
int alen,
|
||||
struct ares_txt_ext** txt_out);
|
||||
|
||||
CARES_EXTERN int ares_parse_naptr_reply(const unsigned char* abuf,
|
||||
int alen,
|
||||
struct ares_naptr_reply** naptr_out);
|
||||
|
||||
CARES_EXTERN int ares_parse_soa_reply(const unsigned char* abuf,
|
||||
int alen,
|
||||
struct ares_soa_reply** soa_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);
|
||||
|
||||
struct ares_addr_node {
|
||||
struct ares_addr_node *next;
|
||||
int family;
|
||||
union {
|
||||
struct in_addr addr4;
|
||||
struct ares_in6_addr addr6;
|
||||
} addr;
|
||||
};
|
||||
|
||||
struct ares_addr_port_node {
|
||||
struct ares_addr_port_node *next;
|
||||
int family;
|
||||
union {
|
||||
struct in_addr addr4;
|
||||
struct ares_in6_addr addr6;
|
||||
} addr;
|
||||
int udp_port;
|
||||
int tcp_port;
|
||||
};
|
||||
|
||||
CARES_EXTERN int ares_set_servers(ares_channel channel,
|
||||
struct ares_addr_node *servers);
|
||||
CARES_EXTERN int ares_set_servers_ports(ares_channel channel,
|
||||
struct ares_addr_port_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_set_servers_ports_csv(ares_channel channel,
|
||||
const char* servers);
|
||||
|
||||
CARES_EXTERN int ares_get_servers(ares_channel channel,
|
||||
struct ares_addr_node **servers);
|
||||
CARES_EXTERN int ares_get_servers_ports(ares_channel channel,
|
||||
struct ares_addr_port_node **servers);
|
||||
|
||||
CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst,
|
||||
ares_socklen_t size);
|
||||
|
||||
CARES_EXTERN int ares_inet_pton(int af, const char *src, void *dst);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ARES__H */
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef __CARES_BUILD_H
|
||||
#define __CARES_BUILD_H
|
||||
|
||||
#define CARES_TYPEOF_ARES_SOCKLEN_T @CARES_TYPEOF_ARES_SOCKLEN_T@
|
||||
#define CARES_TYPEOF_ARES_SSIZE_T @CARES_TYPEOF_ARES_SSIZE_T@
|
||||
|
||||
/* Prefix names with CARES_ to make sure they don't conflict with other config.h
|
||||
* files. We need to include some dependent headers that may be system specific
|
||||
* for C-Ares */
|
||||
#cmakedefine CARES_HAVE_SYS_TYPES_H
|
||||
#cmakedefine CARES_HAVE_SYS_SOCKET_H
|
||||
#cmakedefine CARES_HAVE_WINDOWS_H
|
||||
#cmakedefine CARES_HAVE_WS2TCPIP_H
|
||||
#cmakedefine CARES_HAVE_WINSOCK2_H
|
||||
#cmakedefine CARES_HAVE_WINDOWS_H
|
||||
|
||||
#ifdef CARES_HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
|
||||
|
||||
#endif /* __CARES_BUILD_H */
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
#ifndef __CARES_BUILD_H
|
||||
#define __CARES_BUILD_H
|
||||
|
||||
|
||||
/* Copyright (C) 2009 - 2013 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.
|
||||
*/
|
||||
|
||||
/* ================================================================ */
|
||||
/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* NOTE 1:
|
||||
* -------
|
||||
*
|
||||
* See file ares_build.h.in, run configure, and forget that this file
|
||||
* exists it is only used for non-configure systems.
|
||||
* But you can keep reading if you want ;-)
|
||||
*
|
||||
*/
|
||||
|
||||
/* ================================================================ */
|
||||
/* NOTES FOR NON-CONFIGURE SYSTEMS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* NOTE 1:
|
||||
* -------
|
||||
*
|
||||
* Nothing in this file is intended to be modified or adjusted by the
|
||||
* c-ares library user nor by the c-ares library builder.
|
||||
*
|
||||
* If you think that something actually needs to be changed, adjusted
|
||||
* or fixed in this file, then, report it on the c-ares development
|
||||
* mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
|
||||
*
|
||||
* Try to keep one section per platform, compiler and architecture,
|
||||
* otherwise, if an existing section is reused for a different one and
|
||||
* later on the original is adjusted, probably the piggybacking one can
|
||||
* be adversely changed.
|
||||
*
|
||||
* In order to differentiate between platforms/compilers/architectures
|
||||
* use only compiler built in predefined preprocessor symbols.
|
||||
*
|
||||
* This header file shall only export symbols which are 'cares' or 'CARES'
|
||||
* prefixed, otherwise public name space would be polluted.
|
||||
*
|
||||
* NOTE 2:
|
||||
* -------
|
||||
*
|
||||
* Right now you might be staring at file ares_build.h.dist or ares_build.h,
|
||||
* this is due to the following reason: file ares_build.h.dist is renamed
|
||||
* to ares_build.h when the c-ares source code distribution archive file is
|
||||
* created.
|
||||
*
|
||||
* File ares_build.h.dist is not included in the distribution archive.
|
||||
* File ares_build.h is not present in the git tree.
|
||||
*
|
||||
* The distributed ares_build.h file is only intended to be used on systems
|
||||
* which can not run the also distributed configure script.
|
||||
*
|
||||
* 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, which is generated
|
||||
* from the ares_build.h.in template file.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ================================================================ */
|
||||
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
|
||||
/* ================================================================ */
|
||||
|
||||
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
|
||||
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
/* ================================================================ */
|
||||
/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
|
||||
/* ================================================================ */
|
||||
|
||||
#if defined(__DJGPP__) || defined(__GO32__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__SALFORDC__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__TURBOC__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__POCC__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__LCC__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
|
||||
|
||||
#elif defined(__MWERKS__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(_WIN32_WCE)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__VMS)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
|
||||
|
||||
#elif defined(__OS400__)
|
||||
# if defined(__ILEC400__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
# define CARES_PULL_SYS_TYPES_H 1
|
||||
# define CARES_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__MVS__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
# define CARES_PULL_SYS_TYPES_H 1
|
||||
# define CARES_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__370__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
# define CARES_PULL_SYS_TYPES_H 1
|
||||
# define CARES_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(TPF)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP MSVC THE PENULTIMATE ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP GENERIC GCC THE LAST ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
# define CARES_PULL_SYS_TYPES_H 1
|
||||
# define CARES_PULL_SYS_SOCKET_H 1
|
||||
|
||||
#else
|
||||
# error "Unknown non-configure build target!"
|
||||
Error Compilation_aborted_Unknown_non_configure_build_target
|
||||
#endif
|
||||
|
||||
/* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file */
|
||||
/* sys/types.h is required here to properly make type definitions below. */
|
||||
#ifdef CARES_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
|
||||
/* sys/socket.h is required here to properly make type definitions below. */
|
||||
#ifdef CARES_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* Data type definition of ares_socklen_t. */
|
||||
|
||||
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
#endif
|
||||
|
||||
/* Data type definition of ares_ssize_t. */
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN64
|
||||
# define CARES_TYPEOF_ARES_SSIZE_T __int64
|
||||
# else
|
||||
# define CARES_TYPEOF_ARES_SSIZE_T long
|
||||
# endif
|
||||
#else
|
||||
# define CARES_TYPEOF_ARES_SSIZE_T ssize_t
|
||||
#endif
|
||||
|
||||
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
|
||||
|
||||
#endif /* __CARES_BUILD_H */
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
#ifndef __CARES_BUILD_H
|
||||
#define __CARES_BUILD_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.
|
||||
*/
|
||||
|
||||
/* ================================================================ */
|
||||
/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* NOTE 1:
|
||||
* -------
|
||||
*
|
||||
* Nothing in this file is intended to be modified or adjusted by the
|
||||
* c-ares library user nor by the c-ares library builder.
|
||||
*
|
||||
* If you think that something actually needs to be changed, adjusted
|
||||
* or fixed in this file, then, report it on the c-ares development
|
||||
* mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
|
||||
*
|
||||
* This header file shall only export symbols which are 'cares' or 'CARES'
|
||||
* prefixed, otherwise public name space would be polluted.
|
||||
*
|
||||
* NOTE 2:
|
||||
* -------
|
||||
*
|
||||
* Right now you might be staring at file ares_build.h.in or ares_build.h,
|
||||
* this is due to the following reason:
|
||||
*
|
||||
* 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, which is generated
|
||||
* from the ares_build.h.in template file.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ================================================================ */
|
||||
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
|
||||
/* ================================================================ */
|
||||
|
||||
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
|
||||
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
/* ================================================================ */
|
||||
/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
|
||||
/* ================================================================ */
|
||||
|
||||
/* 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
|
||||
#ifdef CARES_PULL_WS2TCPIP_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file sys/types.h must be included by the external interface. */
|
||||
#undef CARES_PULL_SYS_TYPES_H
|
||||
#ifdef CARES_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file sys/socket.h must be included by the external interface. */
|
||||
#undef CARES_PULL_SYS_SOCKET_H
|
||||
#ifdef CARES_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* Integral data type used for ares_socklen_t. */
|
||||
#undef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
|
||||
/* Data type definition of ares_socklen_t. */
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
|
||||
/* Integral data type used for ares_ssize_t. */
|
||||
#undef CARES_TYPEOF_ARES_SSIZE_T
|
||||
|
||||
/* Data type definition of ares_ssize_t. */
|
||||
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
|
||||
|
||||
#endif /* __CARES_BUILD_H */
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
#ifndef HEADER_CARES_DNS_H
|
||||
#define HEADER_CARES_DNS_H
|
||||
|
||||
/* Copyright 1998, 2011 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE TO INTEGRATORS:
|
||||
*
|
||||
* This header is made public due to legacy projects relying on it.
|
||||
* Please do not use the macros within this header, or include this
|
||||
* header in your project as it may be removed in the future.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Macro DNS__16BIT reads a network short (16 bit) given in network
|
||||
* byte order, and returns its value as an unsigned short.
|
||||
*/
|
||||
#define DNS__16BIT(p) ((unsigned short)((unsigned int) 0xffff & \
|
||||
(((unsigned int)((unsigned char)(p)[0]) << 8U) | \
|
||||
((unsigned int)((unsigned char)(p)[1])))))
|
||||
|
||||
/*
|
||||
* Macro DNS__32BIT reads a network long (32 bit) given in network
|
||||
* byte order, and returns its value as an unsigned int.
|
||||
*/
|
||||
#define DNS__32BIT(p) ((unsigned int) \
|
||||
(((unsigned int)((unsigned char)(p)[0]) << 24U) | \
|
||||
((unsigned int)((unsigned char)(p)[1]) << 16U) | \
|
||||
((unsigned int)((unsigned char)(p)[2]) << 8U) | \
|
||||
((unsigned int)((unsigned char)(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, v) DNS__SET16BIT(r, v)
|
||||
#define DNS_RR_SET_CLASS(r, v) DNS__SET16BIT((r) + 2, v)
|
||||
#define DNS_RR_SET_TTL(r, v) DNS__SET32BIT((r) + 4, v)
|
||||
#define DNS_RR_SET_LEN(r, v) DNS__SET16BIT((r) + 8, v)
|
||||
|
||||
#endif /* HEADER_CARES_DNS_H */
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
#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_TYPEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
|
||||
Error Compilation_aborted_CARES_TYPEOF_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
|
||||
* ares_socklen_t is actually the same as the one reported
|
||||
* by sizeof() at compile time.
|
||||
*/
|
||||
|
||||
typedef char
|
||||
__cares_rule_02__
|
||||
[CareschkszEQ(ares_socklen_t, sizeof(CARES_TYPEOF_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 */
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
#ifndef ARES__VERSION_H
|
||||
#define ARES__VERSION_H
|
||||
|
||||
/* This is the global package copyright */
|
||||
#define ARES_COPYRIGHT "2004 - 2020 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
#define ARES_VERSION_MAJOR 1
|
||||
#define ARES_VERSION_MINOR 17
|
||||
#define ARES_VERSION_PATCH 0
|
||||
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
|
||||
(ARES_VERSION_MINOR<<8)|\
|
||||
(ARES_VERSION_PATCH))
|
||||
#define ARES_VERSION_STR "1.17.0"
|
||||
|
||||
#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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue