Release 1.12.0
This commit is contained in:
parent
55e2af978d
commit
2811e30d49
14
AUTHORS
14
AUTHORS
|
@ -2,6 +2,8 @@ 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
|
||||
|
@ -15,6 +17,7 @@ BogDan Vatra
|
|||
Brad House
|
||||
Brad Spencer
|
||||
Bram Matthys
|
||||
Chris Araman
|
||||
Dan Fandrich
|
||||
Daniel Johnson
|
||||
Daniel Stenberg
|
||||
|
@ -31,6 +34,7 @@ Eino Tuominen
|
|||
Erik Kline
|
||||
Fedor Indutny
|
||||
Frederic Germain
|
||||
Geert Uytterhoeven
|
||||
George Neill
|
||||
Gisle Vanem
|
||||
Gregor Jasny
|
||||
|
@ -41,6 +45,7 @@ Henrik Stoerner
|
|||
Jakub Hrozek
|
||||
James Bursa
|
||||
Jérémy Lal
|
||||
Keith Shaw
|
||||
Lei Shi
|
||||
Marko Kreen
|
||||
Michael Wallner
|
||||
|
@ -48,12 +53,17 @@ 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
|
||||
|
@ -62,7 +72,11 @@ 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
|
||||
|
|
2
INSTALL
2
INSTALL
|
@ -321,7 +321,7 @@ PORTS
|
|||
Useful URLs
|
||||
===========
|
||||
|
||||
c-ares http://c-ares.haxx.se/
|
||||
c-ares https://c-ares.haxx.se/
|
||||
|
||||
MingW http://www.mingw.org/
|
||||
MinGW-w64 http://mingw-w64.sourceforge.net/
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# c-ares license
|
||||
|
||||
Copyright (c) 2007 - 2016, 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.
|
|
@ -56,7 +56,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
|
|||
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
|
||||
TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \
|
||||
$(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL \
|
||||
README.md
|
||||
README.md LICENSE.md
|
||||
|
||||
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
|
||||
|
||||
|
@ -67,7 +67,7 @@ DIST_SUBDIRS = test
|
|||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libcares.pc
|
||||
|
||||
CARES_VERSION_INFO = -version-info 3:0:1
|
||||
CARES_VERSION_INFO = -version-info 4:0:2
|
||||
# This flag accepts an argument of the form current[:revision[:age]]. So,
|
||||
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
|
||||
# 1.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# c-ares Makefile for djgpp/gcc/Watt-32.
|
||||
# By Gisle Vanem <gvanem@broadpark.no> 2004.
|
||||
# By Gisle Vanem <gvanem@yahoo.no> 2004.
|
||||
#
|
||||
|
||||
|
||||
|
|
|
@ -1,68 +1,53 @@
|
|||
LIB = libcares.a
|
||||
AR = m68k-amigaos-ar
|
||||
CC = m68k-amigaos-gcc
|
||||
LD = m68k-amigaos-gcc
|
||||
RANLIB = m68k-amigaos-ranlib
|
||||
RM = rm -f
|
||||
CP = cp -afv
|
||||
CFLAGS = -O2 -Wall -I. -Iinclude -DHAVE_CONFIG_H -DCARES_STATICLIB -DAOS3
|
||||
CFLAGS = -O2 -Wall -I. -Iinclude -DHAVE_CONFIG_H -DCARES_STATICLIB -DAMIGA -DAOS3
|
||||
LDFLAGS = -noixemul -s
|
||||
LIBS = -lm
|
||||
|
||||
LIB = libcares.a
|
||||
LIBH = ares.h ares_build.h ares_rules.h
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
|
||||
|
||||
all: $(LIB) dig host country doc
|
||||
|
||||
dig: adig.o ares_getopt.o $(LIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o dig adig.o ares_getopt.o $(LIB) $(LIBS)
|
||||
|
||||
host: ahost.o ares_getopt.o $(LIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o host ahost.o ares_getopt.o $(LIB) $(LIBS)
|
||||
|
||||
country: acountry.o ares_getopt.o $(LIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o country acountry.o ares_getopt.o $(LIB) $(LIBS)
|
||||
|
||||
$(LIB): $(OBJLIB)
|
||||
$(AR) cru $@ $^
|
||||
$(RANLIB) $@
|
||||
|
||||
all: $(LIB) demos doc
|
||||
|
||||
doc:
|
||||
./workman1 adig.1 >adig.txt
|
||||
./workman2 adig.1 >adig.help
|
||||
./workman1 ahost.1 >ahost.txt
|
||||
./workman2 ahost.1 >ahost.help
|
||||
./workman1 acountry.1 >acountry.txt
|
||||
./workman2 acountry.1 >acountry.help
|
||||
|
||||
demos: adig.exe ahost.exe acountry.exe
|
||||
./workman1 adig.1 >dig.txt
|
||||
./workman2 adig.1 >dig.help
|
||||
./workman1 ahost.1 >host.txt
|
||||
./workman2 ahost.1 >host.help
|
||||
./workman1 acountry.1 >country.txt
|
||||
./workman2 acountry.1 >country.help
|
||||
|
||||
tags:
|
||||
etags *.[ch]
|
||||
|
||||
%.exe: %.o ares_getopt.o $(LIB)
|
||||
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
$(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
ares_build.h:
|
||||
$(CP) ares_build.h.dist 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}/ares.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/ares_build.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/ares_rules.h ${DESTDIR}${includedir}
|
||||
(for man in $(MANPAGES); do \
|
||||
${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
|
||||
done)
|
||||
|
||||
clean:
|
||||
$(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe adig.txt adig.help ahost.txt ahost.help acountry.txt acountry.help
|
||||
$(RM) adig.o ahost.o acountry.o ares_getopt.o $(OBJLIB) $(LIB) dig host country dig.txt dig.help host.txt host.help country.txt country.help
|
||||
|
||||
distclean: clean
|
||||
$(RM) config.cache config.log config.status Makefile
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
# 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.
|
||||
#
|
||||
|
@ -71,74 +71,10 @@ RTLIBD = /MTd
|
|||
|
||||
USE_WATT32 = 0
|
||||
|
||||
# -------------------------------------------
|
||||
# Detect NMAKE version deducing MSVC version
|
||||
# -------------------------------------------
|
||||
|
||||
!IFNDEF _NMAKE_VER
|
||||
! MESSAGE Macro _NMAKE_VER not defined.
|
||||
! MESSAGE Use MSVC's NMAKE to process this makefile.
|
||||
! ERROR See previous message.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(_NMAKE_VER)" == "6.00.8168.0"
|
||||
CC_VERS_NUM = 60
|
||||
!ELSEIF "$(_NMAKE_VER)" == "6.00.9782.0"
|
||||
CC_VERS_NUM = 60
|
||||
!ELSEIF "$(_NMAKE_VER)" == "7.00.8882"
|
||||
CC_VERS_NUM = 70
|
||||
!ELSEIF "$(_NMAKE_VER)" == "7.00.9466"
|
||||
CC_VERS_NUM = 70
|
||||
!ELSEIF "$(_NMAKE_VER)" == "7.00.9955"
|
||||
CC_VERS_NUM = 70
|
||||
!ELSEIF "$(_NMAKE_VER)" == "7.10.2240.8"
|
||||
CC_VERS_NUM = 71
|
||||
!ELSEIF "$(_NMAKE_VER)" == "7.10.3077"
|
||||
CC_VERS_NUM = 71
|
||||
!ELSEIF "$(_NMAKE_VER)" == "8.00.40607.16"
|
||||
CC_VERS_NUM = 80
|
||||
!ELSEIF "$(_NMAKE_VER)" == "8.00.50727.42"
|
||||
CC_VERS_NUM = 80
|
||||
!ELSEIF "$(_NMAKE_VER)" == "8.00.50727.762"
|
||||
CC_VERS_NUM = 80
|
||||
!ELSEIF "$(_NMAKE_VER)" == "9.00.20706.01"
|
||||
CC_VERS_NUM = 90
|
||||
!ELSEIF "$(_NMAKE_VER)" == "9.00.21022.08"
|
||||
CC_VERS_NUM = 90
|
||||
!ELSEIF "$(_NMAKE_VER)" == "9.00.30729.01"
|
||||
CC_VERS_NUM = 90
|
||||
!ELSEIF "$(_NMAKE_VER)" == "10.00.20506.01"
|
||||
CC_VERS_NUM = 100
|
||||
!ELSEIF "$(_NMAKE_VER)" == "10.00.21003.01"
|
||||
CC_VERS_NUM = 100
|
||||
!ELSEIF "$(_NMAKE_VER)" == "10.00.30128.01"
|
||||
CC_VERS_NUM = 100
|
||||
!ELSEIF "$(_NMAKE_VER)" == "10.00.30319.01"
|
||||
CC_VERS_NUM = 100
|
||||
!ELSEIF "$(_NMAKE_VER)" == "10.00.40219.01"
|
||||
CC_VERS_NUM = 100
|
||||
!ELSEIF "$(_NMAKE_VER)" == "11.00.50522.1"
|
||||
CC_VERS_NUM = 110
|
||||
!ELSEIF "$(_NMAKE_VER)" == "11.00.50727.1"
|
||||
CC_VERS_NUM = 110
|
||||
!ELSEIF "$(_NMAKE_VER)" == "11.00.51106.1"
|
||||
CC_VERS_NUM = 110
|
||||
!ELSEIF "$(_NMAKE_VER)" == "11.00.60315.1"
|
||||
CC_VERS_NUM = 110
|
||||
!ELSEIF "$(_NMAKE_VER)" == "11.00.61030.0"
|
||||
CC_VERS_NUM = 110
|
||||
!ELSEIF "$(_NMAKE_VER)" == "12.00.21005.1"
|
||||
CC_VERS_NUM = 120
|
||||
!ELSEIF "$(_NMAKE_VER)" == "14.00.23026.0"
|
||||
CC_VERS_NUM = 140
|
||||
!ELSE
|
||||
! MESSAGE Unknown value for _NMAKE_VER macro: "$(_NMAKE_VER)"
|
||||
! MESSAGE Please, report this condition on the c-ares development
|
||||
! MESSAGE mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
|
||||
! ERROR See previous message.
|
||||
!ENDIF
|
||||
|
||||
CC_VERS_STR = msvc$(CC_VERS_NUM)
|
||||
# --------------------------------------------------------
|
||||
# Detect compiler version.
|
||||
# --------------------------------------------------------
|
||||
!INCLUDE .\msvc_ver.inc
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Verify that current subdir is the c-ares source one
|
||||
|
|
|
@ -306,7 +306,6 @@ ifeq ($(LIBARCH),CLIB)
|
|||
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
||||
|
@ -349,8 +348,6 @@ else
|
|||
@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) >> $@
|
||||
@echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
|
||||
|
@ -397,9 +394,6 @@ endif
|
|||
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@
|
||||
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_INT 4$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
|
||||
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
|
||||
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
|
||||
ifdef NW_WINSOCK
|
||||
|
@ -431,11 +425,8 @@ ares_build.h: Makefile.netware FORCE
|
|||
@echo $(DL)#define __CARES_BUILD_H$(DL) >> $@
|
||||
ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T int$(DL) >> $@
|
||||
@echo $(DL)#define CARES_SIZEOF_ARES_SOCKLEN_T 4$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int$(DL) >> $@
|
||||
@echo $(DL)#define CARES_SIZEOF_ARES_SOCKLEN_T 4$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)#define CARES_SIZEOF_LONG 4$(DL) >> $@
|
||||
@echo $(DL)typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;$(DL) >> $@
|
||||
@echo $(DL)#endif /* __CARES_BUILD_H */$(DL) >> $@
|
||||
|
|
|
@ -12,4 +12,4 @@ 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:
|
||||
http://c-ares.haxx.se/download/ares-1.1.1.tar.gz
|
||||
https://c-ares.haxx.se/download/ares-1.1.1.tar.gz
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
c-ares
|
||||
======
|
||||
|
||||
[![Build Status](https://travis-ci.org/c-ares/c-ares.svg?branch=master)](https://travis-ci.org/c-ares/c-ares)
|
||||
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/03i7151772eq3wn3/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares)
|
||||
[![Coverage Status](https://coveralls.io/repos/c-ares/c-ares/badge.svg?branch=master&service=github)](https://coveralls.io/github/c-ares/c-ares?branch=master)
|
||||
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/291/badge)](https://bestpractices.coreinfrastructure.org/projects/291)
|
||||
|
||||
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
|
||||
|
@ -18,7 +23,7 @@ c-ares is of course distributed under the same MIT-style license as the
|
|||
original ares.
|
||||
|
||||
You'll find all c-ares details and news here:
|
||||
http://c-ares.haxx.se/
|
||||
https://c-ares.haxx.se/
|
||||
|
||||
|
||||
Notes for c-ares hackers
|
||||
|
|
|
@ -1,15 +1,46 @@
|
|||
c-ares version 1.11.1
|
||||
c-ares version 1.12.0
|
||||
|
||||
Changes:
|
||||
|
||||
o
|
||||
o api: add ARES_OPT_NOROTATE optmask value
|
||||
|
||||
Bug fixes:
|
||||
|
||||
o
|
||||
o CVE-2016-5180: ares_create_query single byte out of buffer write [4]
|
||||
o configure: acknowledge --disable-tests [1]
|
||||
o man pages: fix typos detected by Lintian
|
||||
o test: add missing #includes for dns-proto.cc
|
||||
o test: avoid in6addr_* constants
|
||||
o test: Build with MinGW on AppVeyor
|
||||
o Makefile.m32: add support for extra flags
|
||||
o Makefile.m32: add support for CROSSPREFIX
|
||||
o configure: check if tests can get built before enabled
|
||||
o ares_library_cleanup: reset ares_realloc too
|
||||
o ahost.c: add cast to fix C++ compile
|
||||
o test: Only pass unused args to GoogleTest
|
||||
o build: commonize MSVC version detection
|
||||
o msvc_ver.inc: support Visual Studio 2015 Update 1, 2, 3
|
||||
o test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record
|
||||
o ares_getnameinfo: explicitly clear struct servent before use
|
||||
o test: Update fuzzing function prototype
|
||||
o init: fix nsort initialization
|
||||
o test: add fuzzing check script to tests
|
||||
o web: http => https
|
||||
o read_tcp_data: remove superfluous NULL check
|
||||
o LICENSE.md: add a stand-alone license file
|
||||
o SECURITY.md: suggested "security process" for the project
|
||||
o ares_init_options: only propagate init failures from options [2]
|
||||
o headers: remove checks for and defines of variable sizes
|
||||
o test: fix gMock to work with gcc >= 6.x [3]
|
||||
|
||||
Thanks go to these friendly people for their efforts and contributions:
|
||||
|
||||
Alexander Drachevskiy, Brad House, Chris Araman, Daniel Stenberg,
|
||||
David Drysdale, Gregor Jasny, Svante Karlsson, Viktor Szakats
|
||||
|
||||
References to bug reports and discussions on issues:
|
||||
|
||||
Have fun!
|
||||
[1] = https://github.com/c-ares/c-ares/issues/44
|
||||
[2] = https://github.com/c-ares/c-ares/issues/60
|
||||
[3] = https://github.com/google/googletest/issues/705#issuecomment-235067917
|
||||
[4] = https://c-ares.haxx.se/adv_20160929.html
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
.TH ACOUNTRY "1" "April 2011" "c-ares utilities"
|
||||
.TH COUNTRY "1" "April 2011" "c-ares utilities"
|
||||
.SH NAME
|
||||
acountry \- print the country where an IPv4 address or host is located
|
||||
country \- print the country where an IPv4 address or host is located
|
||||
.SH SYNOPSIS
|
||||
.B acountry
|
||||
.B country
|
||||
[\fIOPTION\fR]... \fIHOST\fR...
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
|
|
17
acountry.c
17
acountry.c
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
* Ref: http://countries.nerd.dk/more.html
|
||||
*
|
||||
* Written by G. Vanem <gvanem@broadpark.no> 2006, 2007
|
||||
* Written by G. Vanem <gvanem@yahoo.no> 2006, 2007
|
||||
*
|
||||
* NB! This program may not be big-endian aware.
|
||||
*
|
||||
|
@ -69,7 +69,18 @@
|
|||
#define INADDR_NONE 0xffffffff
|
||||
#endif
|
||||
|
||||
static const char *usage = "acountry [-vh?] {host|addr} ...\n";
|
||||
const char *vers = "\0$VER: country 1.12 (29.09.2016) c-ares " ARES_VERSION_STR;
|
||||
|
||||
static const char *usage =
|
||||
#ifdef ANSI_CONSOLE
|
||||
"\33[33mcountry version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\33[31m\n"
|
||||
#else
|
||||
"country version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\n"
|
||||
#endif
|
||||
"Usage: country [options] { host | addr } ...\n"
|
||||
"\t-v: Be more verbose. Print extra information\n"
|
||||
"\t-h: Display this help and exit\n";
|
||||
|
||||
static const char nerd_fmt[] = "%u.%u.%u.%u.zz.countries.nerd.dk";
|
||||
static const char *nerd_ver1 = nerd_fmt + 14; /* .countries.nerd.dk */
|
||||
static const char *nerd_ver2 = nerd_fmt + 11; /* .zz.countries.nerd.dk */
|
||||
|
@ -94,8 +105,6 @@ static void Abort(const char *fmt, ...)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
const char *vers = "\0$VER: acountry 1.11 (01.03.2016) c-ares 1.11.0";
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ares_channel channel;
|
||||
|
|
6
adig.1
6
adig.1
|
@ -1,8 +1,8 @@
|
|||
.TH ADIG "1" "April 2011" "c-ares utilities"
|
||||
.TH DIG "1" "April 2011" "c-ares utilities"
|
||||
.SH NAME
|
||||
adig \- print information collected from Domain Name System (DNS) servers
|
||||
dig \- print information collected from Domain Name System (DNS) servers
|
||||
.SH SYNOPSIS
|
||||
.B adig
|
||||
.B dig
|
||||
[\fIOPTION\fR]... \fINAME\fR...
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
|
|
23
adig.c
23
adig.c
|
@ -178,7 +178,7 @@ static void destroy_addr_list(struct ares_addr_node *head);
|
|||
static void append_addr_list(struct ares_addr_node **head,
|
||||
struct ares_addr_node *node);
|
||||
|
||||
const char *vers = "\0$VER: adig 1.11 (01.03.2016) c-ares 1.11.0";
|
||||
const char *vers = "\0$VER: dig 1.12 (29.09.2016) c-ares " ARES_VERSION_STR;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -799,9 +799,24 @@ static const char *class_name(int dnsclass)
|
|||
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: adig [-f flag] [-s server] [-c class] "
|
||||
"[-t type] [-p port] name ...\n");
|
||||
exit(1);
|
||||
fprintf(stderr,
|
||||
#ifdef ANSI_CONSOLE
|
||||
"\33[33mdig version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\33[31m\n"
|
||||
#else
|
||||
"dig version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\n"
|
||||
#endif
|
||||
"Usage: dig [options] name\n"
|
||||
"\t-s <server>: connect to specified DNS server. Default is 8.8.8.8.\n"
|
||||
"\t-f <class>: set the query class: NY, CHAOS, HS, IN (default)\n"
|
||||
"\t-f <flag>: add a flag: igntc, noaliases, norecurse, primary, stayopen, usevc\n"
|
||||
"\t-t <type>: query records of specified type, default is A. Possible values:\n"
|
||||
"\t AAAA, AFSDB, ANY, AXFR, CNAME, GPOS, HINFO, ISDN, KEY,LOC,\n"
|
||||
"\t MAILA, MAILB, MB, MD, MF, MG, MINFO, MR, MX, NAPTR, NS, NSAP\n"
|
||||
"\t NSAP_PTR, NULL, PTR, PX, RP, RT, SIG, SOA, SRV, TXT, WKS, X25\n"
|
||||
"\t-p <port>: use specified TCP port to connect to DNS server\n"
|
||||
"\t-U <port>: use specified UDP port to connect to DNS server\n"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void destroy_addr_list(struct ares_addr_node *head)
|
||||
|
|
6
ahost.1
6
ahost.1
|
@ -1,8 +1,8 @@
|
|||
.TH AHOST "1" "April 2011" "c-ares utilities"
|
||||
.TH HOST "1" "April 2011" "c-ares utilities"
|
||||
.SH NAME
|
||||
ahost \- print the A or AAAA record associated with a hostname or IP address
|
||||
host \- print the A or AAAA record associated with a hostname or IP address
|
||||
.SH SYNOPSIS
|
||||
.B ahost
|
||||
.B host
|
||||
[\fIOPTION\fR]... \fIHOST\fR...
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
|
|
20
ahost.c
20
ahost.c
|
@ -50,7 +50,7 @@
|
|||
static void callback(void *arg, int status, int timeouts, struct hostent *host);
|
||||
static void usage(void);
|
||||
|
||||
const char *vers = "\0$VER: ahost 1.11 (01.03.2016) c-ares 1.11.0";
|
||||
const char *vers = "\0$VER: host 1.12 (29.09.2016) c-ares " ARES_VERSION_STR;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -92,8 +92,8 @@ int main(int argc, char **argv)
|
|||
case 's':
|
||||
optmask |= ARES_OPT_DOMAINS;
|
||||
options.ndomains++;
|
||||
options.domains = realloc(options.domains,
|
||||
options.ndomains * sizeof(char *));
|
||||
options.domains = (char **)realloc(options.domains,
|
||||
options.ndomains * sizeof(char *));
|
||||
options.domains[options.ndomains - 1] = strdup(optarg);
|
||||
break;
|
||||
case 't':
|
||||
|
@ -205,6 +205,16 @@ static void callback(void *arg, int status, int timeouts, struct hostent *host)
|
|||
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: ahost [-t {a|aaaa|u}] {host|addr} ...\n");
|
||||
exit(1);
|
||||
fprintf(stderr,
|
||||
#ifdef ANSI_CONSOLE
|
||||
"\33[33mhost version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\33[31m\n"
|
||||
#else
|
||||
"host version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\n"
|
||||
#endif
|
||||
"Usage: host [-t type] { host | addr } ...\n"
|
||||
"\t-ta: print the A record (default)\n"
|
||||
"\t-tu: look for either AAAA or A record\n"
|
||||
"\t-taaaa: print the AAAA record\n"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
|
18
amiga_port.c
18
amiga_port.c
|
@ -1,7 +1,6 @@
|
|||
#include "ares_setup.h"
|
||||
#if defined(AOS3) || defined(AROS)
|
||||
|
||||
|
||||
/*
|
||||
* Written by Carsten Larsen.
|
||||
* Public domain.
|
||||
|
@ -13,7 +12,6 @@
|
|||
#include <clib/timer_protos.h>
|
||||
#include <clib/utility_protos.h>
|
||||
#include <clib/alib_protos.h>
|
||||
#include <devices/timer.h>
|
||||
|
||||
#define OPEN_ERROR "Cannot open %s.\n"
|
||||
#define OPEN_VER_ERROR "Cannot open %s (%d.0)\n"
|
||||
|
@ -31,11 +29,8 @@
|
|||
int h_errno;
|
||||
#endif
|
||||
|
||||
struct Library* DOSBase = NULL;
|
||||
struct Library* SocketBase = NULL;
|
||||
struct Library* UtilityBase = NULL;
|
||||
struct Device* TimerBase = NULL;
|
||||
struct timerequest* TimeRequest = NULL;
|
||||
struct Library* DOSBase = NULL;
|
||||
struct Library* SocketBase = NULL;
|
||||
|
||||
char *prog;
|
||||
|
||||
|
@ -64,14 +59,12 @@ void ares_amiga_cleanup()
|
|||
|
||||
int ares_amiga_init()
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
if(!(DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV))) {
|
||||
if((DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV)) == NULL) {
|
||||
amiga_open_lib_error(DOSLIB_NAME, DOSLIB_REV);
|
||||
return LIB_ERROR;
|
||||
}
|
||||
|
||||
if(!(SocketBase = OpenLibrary((STRPTR)BSDLIB_NAME, BSDLIB_REV))) {
|
||||
if((SocketBase = OpenLibrary((STRPTR)BSDLIB_NAME, BSDLIB_REV)) == NULL) {
|
||||
amiga_open_lib_error(BSDLIB_NAME, BSDLIB_REV);
|
||||
return LIB_ERROR;
|
||||
} else {
|
||||
|
@ -81,9 +74,6 @@ int ares_amiga_init()
|
|||
SBTM_SETVAL(SBTC_LOGTAGPTR), (IPTR) &prog,
|
||||
TAG_DONE );
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
srand(tv.tv_sec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
1
ares.h
1
ares.h
|
@ -158,6 +158,7 @@ extern "C" {
|
|||
#define ARES_OPT_TIMEOUTMS (1 << 13)
|
||||
#define ARES_OPT_ROTATE (1 << 14)
|
||||
#define ARES_OPT_EDNSPSZ (1 << 15)
|
||||
#define ARES_OPT_NOROTATE (1 << 16)
|
||||
|
||||
/* Nameinfo flag values */
|
||||
#define ARES_NI_NOFQDN (1 << 0)
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/* ares_build.h. Generated from ares_build.h.in by configure. */
|
||||
#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. */
|
||||
#define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
/* Data type definition of ares_socklen_t. */
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
|
||||
#endif /* __CARES_BUILD_H */
|
|
@ -50,21 +50,11 @@
|
|||
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
|
||||
/* ================================================================ */
|
||||
|
||||
#ifdef CARES_SIZEOF_LONG
|
||||
# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
|
||||
Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#ifdef CARES_SIZEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
|
||||
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
/* ================================================================ */
|
||||
/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
|
||||
/* ================================================================ */
|
||||
|
@ -95,15 +85,9 @@
|
|||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#undef CARES_SIZEOF_LONG
|
||||
|
||||
/* Integral data type used for ares_socklen_t. */
|
||||
#undef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
|
||||
/* The size of `ares_socklen_t', as computed by sizeof. */
|
||||
#undef CARES_SIZEOF_ARES_SOCKLEN_T
|
||||
|
||||
/* Data type definition of ares_socklen_t. */
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
|
||||
|
|
|
@ -23,14 +23,15 @@ ares_cancel \- Cancel a resolve
|
|||
.B void ares_cancel(ares_channel \fIchannel\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_cancel\fP function cancels all lookups/requests made on the the
|
||||
name service channel identified by \fIchannel\fP. \fBares_cancel\fP invokes
|
||||
the callbacks for each pending query on the channel, passing a status of
|
||||
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\fP.
|
||||
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)
|
||||
|
|
|
@ -0,0 +1,502 @@
|
|||
/* ares_config.h. Generated from ares_config.h.in by configure. */
|
||||
/* ares_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */
|
||||
|
||||
/* define this if ares is built for a big endian system */
|
||||
#define ARES_BIG_ENDIAN 1
|
||||
|
||||
/* when building as static part of libcurl */
|
||||
/* #undef BUILDING_LIBCURL */
|
||||
|
||||
/* Defined for build that exposes internal static functions for testing. */
|
||||
/* #undef CARES_EXPOSE_STATICS */
|
||||
|
||||
/* Defined for build with symbol hiding. */
|
||||
/* #undef CARES_SYMBOL_HIDING */
|
||||
|
||||
/* Definition to make a library symbol externally visible. */
|
||||
/* #undef CARES_SYMBOL_SCOPE_EXTERN */
|
||||
|
||||
/* Use resolver library to configure cares */
|
||||
/* #undef CARES_USE_LIBRESOLV */
|
||||
|
||||
/* if a /etc/inet dir is being used */
|
||||
/* #undef ETC_INET */
|
||||
|
||||
/* Define to the type of arg 2 for gethostname. */
|
||||
#define GETHOSTNAME_TYPE_ARG2 int
|
||||
|
||||
/* Define to the type qualifier of arg 1 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_QUAL_ARG1 */
|
||||
|
||||
/* Define to the type of arg 1 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_TYPE_ARG1 */
|
||||
|
||||
/* Define to the type of arg 2 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_TYPE_ARG2 */
|
||||
|
||||
/* Define to the type of args 4 and 6 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_TYPE_ARG46 */
|
||||
|
||||
/* Define to the type of arg 7 for getnameinfo. */
|
||||
/* #undef GETNAMEINFO_TYPE_ARG7 */
|
||||
|
||||
/* Specifies the number of arguments to getservbyport_r */
|
||||
/* #undef GETSERVBYPORT_R_ARGS */
|
||||
|
||||
/* Specifies the size of the buffer to pass to getservbyport_r */
|
||||
/* #undef GETSERVBYPORT_R_BUFSIZE */
|
||||
|
||||
/* Define to 1 if you have AF_INET6. */
|
||||
/* #undef HAVE_AF_INET6 */
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */
|
||||
/* #undef HAVE_ARPA_NAMESER_COMPAT_H */
|
||||
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */
|
||||
#define HAVE_ARPA_NAMESER_H 1
|
||||
|
||||
/* Define to 1 if you have the <assert.h> header file. */
|
||||
#define HAVE_ASSERT_H 1
|
||||
|
||||
/* Define to 1 if you have the `bitncmp' function. */
|
||||
/* #undef HAVE_BITNCMP */
|
||||
|
||||
/* Define to 1 if bool is an available type. */
|
||||
#define HAVE_BOOL_T 1
|
||||
|
||||
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
|
||||
/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */
|
||||
|
||||
/* Define to 1 if you have the closesocket function. */
|
||||
/* #undef HAVE_CLOSESOCKET */
|
||||
|
||||
/* Define to 1 if you have the CloseSocket camel case function. */
|
||||
/* #undef HAVE_CLOSESOCKET_CAMEL */
|
||||
|
||||
/* Define to 1 if you have the connect function. */
|
||||
#define HAVE_CONNECT 1
|
||||
|
||||
/* define if the compiler supports basic C++11 syntax */
|
||||
/* #undef HAVE_CXX11 */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define to 1 if you have the fcntl function. */
|
||||
/* #undef HAVE_FCNTL */
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
|
||||
/* #undef HAVE_FCNTL_O_NONBLOCK */
|
||||
|
||||
/* Define to 1 if you have the freeaddrinfo function. */
|
||||
/* #undef HAVE_FREEADDRINFO */
|
||||
|
||||
/* Define to 1 if you have a working getaddrinfo function. */
|
||||
/* #undef HAVE_GETADDRINFO */
|
||||
|
||||
/* Define to 1 if the getaddrinfo function is threadsafe. */
|
||||
/* #undef HAVE_GETADDRINFO_THREADSAFE */
|
||||
|
||||
/* Define to 1 if you have the getenv function. */
|
||||
#define HAVE_GETENV 1
|
||||
|
||||
/* Define to 1 if you have the gethostbyaddr function. */
|
||||
#define HAVE_GETHOSTBYADDR 1
|
||||
|
||||
/* Define to 1 if you have the gethostbyname function. */
|
||||
#define HAVE_GETHOSTBYNAME 1
|
||||
|
||||
/* Define to 1 if you have the gethostname function. */
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
|
||||
/* Define to 1 if you have the getnameinfo function. */
|
||||
/* #undef HAVE_GETNAMEINFO */
|
||||
|
||||
/* Define to 1 if you have the getservbyport_r function. */
|
||||
/* #undef HAVE_GETSERVBYPORT_R */
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the `if_indextoname' function. */
|
||||
/* #undef HAVE_IF_INDEXTONAME */
|
||||
|
||||
/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */
|
||||
/* #undef HAVE_INET_NET_PTON */
|
||||
|
||||
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
|
||||
/* #undef HAVE_INET_NTOP */
|
||||
|
||||
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
|
||||
/* #undef HAVE_INET_PTON */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
/* #undef HAVE_INTTYPES_H */
|
||||
|
||||
/* Define to 1 if you have the ioctl function. */
|
||||
#define HAVE_IOCTL 1
|
||||
|
||||
/* Define to 1 if you have the ioctlsocket function. */
|
||||
/* #undef HAVE_IOCTLSOCKET */
|
||||
|
||||
/* Define to 1 if you have the IoctlSocket camel case function. */
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL */
|
||||
|
||||
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
|
||||
*/
|
||||
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */
|
||||
|
||||
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */
|
||||
/* #undef HAVE_IOCTLSOCKET_FIONBIO */
|
||||
|
||||
/* Define to 1 if you have a working ioctl FIONBIO function. */
|
||||
#define HAVE_IOCTL_FIONBIO 1
|
||||
|
||||
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */
|
||||
#define HAVE_IOCTL_SIOCGIFADDR 1
|
||||
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */
|
||||
/* #undef HAVE_LIBRESOLVE */
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* if your compiler supports LL */
|
||||
#define HAVE_LL 1
|
||||
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */
|
||||
#define HAVE_LONGLONG 1
|
||||
|
||||
/* Define to 1 if you have the malloc.h header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the memory.h header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the MSG_NOSIGNAL flag. */
|
||||
/* #undef HAVE_MSG_NOSIGNAL */
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#define HAVE_NETDB_H 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
||||
#define HAVE_NETINET_TCP_H 1
|
||||
|
||||
/* Define to 1 if you have the <net/if.h> header file. */
|
||||
#define HAVE_NET_IF_H 1
|
||||
|
||||
/* Define to 1 if you have PF_INET6. */
|
||||
/* #undef HAVE_PF_INET6 */
|
||||
|
||||
/* Define to 1 if you have the recv function. */
|
||||
#define HAVE_RECV 1
|
||||
|
||||
/* Define to 1 if you have the recvfrom function. */
|
||||
#define HAVE_RECVFROM 1
|
||||
|
||||
/* Define to 1 if you have the send function. */
|
||||
#define HAVE_SEND 1
|
||||
|
||||
/* Define to 1 if you have the setsockopt function. */
|
||||
#define HAVE_SETSOCKOPT 1
|
||||
|
||||
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
|
||||
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define to 1 if sig_atomic_t is an available typedef. */
|
||||
#define HAVE_SIG_ATOMIC_T 1
|
||||
|
||||
/* Define to 1 if sig_atomic_t is already defined as volatile. */
|
||||
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */
|
||||
|
||||
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */
|
||||
/* #undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID */
|
||||
|
||||
/* Define to 1 if you have the socket function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define to 1 if you have the <socket.h> header file. */
|
||||
/* #undef HAVE_SOCKET_H */
|
||||
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||
#define HAVE_STDBOOL_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
/* #undef HAVE_STDINT_H */
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the strcasecmp function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the strcmpi function. */
|
||||
/* #undef HAVE_STRCMPI */
|
||||
|
||||
/* Define to 1 if you have the strdup function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the stricmp function. */
|
||||
#define HAVE_STRICMP 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the strncasecmp function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the strncmpi function. */
|
||||
/* #undef HAVE_STRNCMPI */
|
||||
|
||||
/* Define to 1 if you have the strnicmp function. */
|
||||
/* #undef HAVE_STRNICMP */
|
||||
|
||||
/* Define to 1 if you have the <stropts.h> header file. */
|
||||
/* #undef HAVE_STROPTS_H */
|
||||
|
||||
/* Define to 1 if you have struct addrinfo. */
|
||||
/* #undef HAVE_STRUCT_ADDRINFO */
|
||||
|
||||
/* Define to 1 if you have struct in6_addr. */
|
||||
/* #undef HAVE_STRUCT_IN6_ADDR */
|
||||
|
||||
/* Define to 1 if you have struct sockaddr_in6. */
|
||||
/* #undef HAVE_STRUCT_SOCKADDR_IN6 */
|
||||
|
||||
/* if struct sockaddr_storage is defined */
|
||||
/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */
|
||||
|
||||
/* Define to 1 if you have the timeval struct. */
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||
//#define HAVE_SYS_UIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the windows.h header file. */
|
||||
/* #undef HAVE_WINDOWS_H */
|
||||
|
||||
/* Define to 1 if you have the winsock2.h header file. */
|
||||
/* #undef HAVE_WINSOCK2_H */
|
||||
|
||||
/* Define to 1 if you have the winsock.h header file. */
|
||||
/* #undef HAVE_WINSOCK_H */
|
||||
|
||||
/* Define to 1 if you have the writev function. */
|
||||
/* #undef HAVE_WRITEV */
|
||||
|
||||
/* Define to 1 if you have the ws2tcpip.h header file. */
|
||||
/* #undef HAVE_WS2TCPIP_H */
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */
|
||||
/* #undef NEED_MALLOC_H */
|
||||
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */
|
||||
/* #undef NEED_MEMORY_H */
|
||||
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
|
||||
/* #undef NEED_REENTRANT */
|
||||
|
||||
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */
|
||||
/* #undef NEED_THREAD_SAFE */
|
||||
|
||||
/* cpu-machine-OS */
|
||||
#define OS "m68k-unknown-amigaos"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "c-ares"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "c-ares"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "c-ares 1.12.0"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "c-ares"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.12.0"
|
||||
|
||||
/* a suitable file/device to read random data from */
|
||||
/* #undef RANDOM_FILE */
|
||||
|
||||
/* Define to the type qualifier pointed by arg 5 for recvfrom. */
|
||||
#define RECVFROM_QUAL_ARG5
|
||||
|
||||
/* Define to the type of arg 1 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG1 int
|
||||
|
||||
/* Define to the type pointed by arg 2 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG2 void
|
||||
|
||||
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */
|
||||
#define RECVFROM_TYPE_ARG2_IS_VOID 1
|
||||
|
||||
/* Define to the type of arg 3 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG3 size_t
|
||||
|
||||
/* Define to the type of arg 4 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG4 int
|
||||
|
||||
/* Define to the type pointed by arg 5 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG5 struct sockaddr
|
||||
|
||||
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */
|
||||
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */
|
||||
|
||||
/* Define to the type pointed by arg 6 for recvfrom. */
|
||||
#define RECVFROM_TYPE_ARG6 int
|
||||
|
||||
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */
|
||||
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */
|
||||
|
||||
/* Define to the function return type for recvfrom. */
|
||||
#define RECVFROM_TYPE_RETV int
|
||||
|
||||
/* Define to the type of arg 1 for recv. */
|
||||
#define RECV_TYPE_ARG1 int
|
||||
|
||||
/* Define to the type of arg 2 for recv. */
|
||||
#define RECV_TYPE_ARG2 void *
|
||||
|
||||
/* Define to the type of arg 3 for recv. */
|
||||
#define RECV_TYPE_ARG3 size_t
|
||||
|
||||
/* Define to the type of arg 4 for recv. */
|
||||
#define RECV_TYPE_ARG4 int
|
||||
|
||||
/* Define to the function return type for recv. */
|
||||
#define RECV_TYPE_RETV int
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define to the type qualifier of arg 2 for send. */
|
||||
#define SEND_QUAL_ARG2 const
|
||||
|
||||
/* Define to the type of arg 1 for send. */
|
||||
#define SEND_TYPE_ARG1 int
|
||||
|
||||
/* Define to the type of arg 2 for send. */
|
||||
#define SEND_TYPE_ARG2 void *
|
||||
|
||||
/* Define to the type of arg 3 for send. */
|
||||
#define SEND_TYPE_ARG3 size_t
|
||||
|
||||
/* Define to the type of arg 4 for send. */
|
||||
#define SEND_TYPE_ARG4 int
|
||||
|
||||
/* Define to the function return type for send. */
|
||||
#define SEND_TYPE_RETV int
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define to disable non-blocking sockets. */
|
||||
#define USE_BLOCKING_SOCKETS 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.12.0"
|
||||
|
||||
/* Define to avoid automatic inclusion of winsock.h */
|
||||
/* #undef WIN32_LEAN_AND_MEAN */
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define to 1 if OS is AIX. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* # undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Enable large inode numbers on Mac OS X 10.5. */
|
||||
#ifndef _DARWIN_USE_64_BIT_INODE
|
||||
# define _DARWIN_USE_64_BIT_INODE 1
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* #undef _FILE_OFFSET_BITS */
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Type to use in place of in_addr_t when system does not provide it. */
|
||||
#define in_addr_t unsigned long
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* the signed version of size_t */
|
||||
/* #undef ssize_t */
|
|
@ -18,45 +18,39 @@
|
|||
ares_create_query \- Compose a single-question DNS query buffer
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_create_query(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, int \fImax_udp_size\fP)
|
||||
#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
|
||||
.B ares_create_query
|
||||
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 .
|
||||
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
|
||||
.I max_udp_size
|
||||
should be nonzero to activate EDNS. Usage of \fIares_create_query(3)\fP\ with
|
||||
.I max_udp_size
|
||||
set to zero is equivalent to \fIares_mkquery(3)\fP.
|
||||
\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:
|
||||
|
@ -77,5 +71,6 @@ Memory was exhausted.
|
|||
Added in c-ares 1.10.0
|
||||
.SH SEE ALSO
|
||||
.BR ares_expand_name (3),
|
||||
.BR ares_free_string (3)
|
||||
.BR ares_free_string (3),
|
||||
.BR ares_mkquery (3)
|
||||
.SH AUTHOR
|
||||
|
|
|
@ -85,57 +85,31 @@
|
|||
*/
|
||||
|
||||
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)
|
||||
unsigned short id, int rd, unsigned char **bufp,
|
||||
int *buflenp, int max_udp_size)
|
||||
{
|
||||
int len;
|
||||
size_t len;
|
||||
unsigned char *q;
|
||||
const char *p;
|
||||
size_t buflen;
|
||||
unsigned char *buf;
|
||||
|
||||
/* Set our results early, in case we bail out early with an error. */
|
||||
*buflen = 0;
|
||||
*buf = NULL;
|
||||
*buflenp = 0;
|
||||
*bufp = NULL;
|
||||
|
||||
/* Compute the length of the encoded name so we can check buflen.
|
||||
* Start counting at 1 for the zero-length label at the end. */
|
||||
len = 1;
|
||||
for (p = name; *p; p++)
|
||||
{
|
||||
if (*p == '\\' && *(p + 1) != 0)
|
||||
p++;
|
||||
len++;
|
||||
}
|
||||
/* If there are n periods in the name, there are n + 1 labels, and
|
||||
* thus n + 1 length fields, unless the name is empty or ends with a
|
||||
* period. So add 1 unless name is empty or ends with a period.
|
||||
/* Allocate a memory area for the maximum size this packet might need. +2
|
||||
* is for the length byte and zero termination if no dots or ecscaping is
|
||||
* used.
|
||||
*/
|
||||
if (*name && *(p - 1) != '.')
|
||||
len++;
|
||||
|
||||
/* Immediately reject names that are longer than the maximum of 255
|
||||
* bytes that's specified in RFC 1035 ("To simplify implementations,
|
||||
* the total length of a domain name (i.e., label octets and label
|
||||
* length octets) is restricted to 255 octets or less."). We aren't
|
||||
* doing this just to be a stickler about RFCs. For names that are
|
||||
* too long, 'dnscache' closes its TCP connection to us immediately
|
||||
* (when using TCP) and ignores the request when using UDP, and
|
||||
* BIND's named returns ServFail (TCP or UDP). Sending a request
|
||||
* that we know will cause 'dnscache' to close the TCP connection is
|
||||
* painful, since that makes any other outstanding requests on that
|
||||
* connection fail. And sending a UDP request that we know
|
||||
* 'dnscache' will ignore is bad because resources will be tied up
|
||||
* until we time-out the request.
|
||||
*/
|
||||
if (len > MAXCDNAME)
|
||||
return ARES_EBADNAME;
|
||||
|
||||
*buflen = len + HFIXEDSZ + QFIXEDSZ + (max_udp_size ? EDNSFIXEDSZ : 0);
|
||||
*buf = ares_malloc(*buflen);
|
||||
if (!*buf)
|
||||
return ARES_ENOMEM;
|
||||
len = strlen(name) + 2 + HFIXEDSZ + QFIXEDSZ +
|
||||
(max_udp_size ? EDNSFIXEDSZ : 0);
|
||||
buf = ares_malloc(len);
|
||||
if (!buf)
|
||||
return ARES_ENOMEM;
|
||||
|
||||
/* Set up the header. */
|
||||
q = *buf;
|
||||
q = buf;
|
||||
memset(q, 0, HFIXEDSZ);
|
||||
DNS_HEADER_SET_QID(q, id);
|
||||
DNS_HEADER_SET_OPCODE(q, QUERY);
|
||||
|
@ -159,8 +133,10 @@ int ares_create_query(const char *name, int dnsclass, int type,
|
|||
q += HFIXEDSZ;
|
||||
while (*name)
|
||||
{
|
||||
if (*name == '.')
|
||||
if (*name == '.') {
|
||||
free (buf);
|
||||
return ARES_EBADNAME;
|
||||
}
|
||||
|
||||
/* Count the number of bytes in this label. */
|
||||
len = 0;
|
||||
|
@ -170,8 +146,10 @@ int ares_create_query(const char *name, int dnsclass, int type,
|
|||
p++;
|
||||
len++;
|
||||
}
|
||||
if (len > MAXLABEL)
|
||||
if (len > MAXLABEL) {
|
||||
free (buf);
|
||||
return ARES_EBADNAME;
|
||||
}
|
||||
|
||||
/* Encode the length and copy the data. */
|
||||
*q++ = (unsigned char)len;
|
||||
|
@ -195,14 +173,30 @@ int ares_create_query(const char *name, int dnsclass, int type,
|
|||
DNS_QUESTION_SET_TYPE(q, type);
|
||||
DNS_QUESTION_SET_CLASS(q, dnsclass);
|
||||
|
||||
q += QFIXEDSZ;
|
||||
if (max_udp_size)
|
||||
{
|
||||
q += QFIXEDSZ;
|
||||
memset(q, 0, EDNSFIXEDSZ);
|
||||
q++;
|
||||
DNS_RR_SET_TYPE(q, T_OPT);
|
||||
DNS_RR_SET_CLASS(q, max_udp_size);
|
||||
q += (EDNSFIXEDSZ-1);
|
||||
}
|
||||
buflen = (q - buf);
|
||||
|
||||
/* Reject names that are longer than the maximum of 255 bytes that's
|
||||
* specified in RFC 1035 ("To simplify implementations, the total length of
|
||||
* a domain name (i.e., label octets and label length octets) is restricted
|
||||
* to 255 octets or less."). */
|
||||
if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ +
|
||||
(max_udp_size ? EDNSFIXEDSZ : 0))) {
|
||||
free (buf);
|
||||
return ARES_EBADNAME;
|
||||
}
|
||||
|
||||
/* we know this fits in an int at this point */
|
||||
*buflenp = (int) buflen;
|
||||
*bufp = buf;
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -23,18 +23,14 @@ ares_destroy \- Destroy a resolver channel
|
|||
.B void ares_destroy(ares_channel \fIchannel\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_destroy
|
||||
function destroys the name service channel identified by
|
||||
.IR channel ,
|
||||
freeing all memory and closing all sockets used by the channel.
|
||||
.B ares_destroy
|
||||
invokes the callbacks for each pending query on the channel, passing a
|
||||
status of
|
||||
.BR ARES_EDESTRUCTION .
|
||||
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.
|
||||
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 \IARES_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)
|
||||
|
|
|
@ -23,12 +23,9 @@ ares_destroy_options \- Destroy options initialized with ares_save_options
|
|||
.B void ares_destroy_options(struct ares_options *\fIoptions\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_destroy_options
|
||||
function destroys the options struct identified by
|
||||
.IR options ,
|
||||
freeing all memory allocated by ares_save_options.
|
||||
|
||||
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)
|
||||
|
|
|
@ -45,18 +45,15 @@
|
|||
((p)[3] = (unsigned char)((v) & 0xff)))
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
/* we cannot use this approach on systems where we can't access 16/32 bit
|
||||
data on un-aligned addresses */
|
||||
// align recieve buffer with memcpy instead
|
||||
#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
|
||||
|
||||
|
||||
/* use use this approach on systems where we can't access 16/32 bit
|
||||
data on un-aligned addresses */
|
||||
#ifdef ARES_BIG_ENDIAN
|
||||
|
@ -71,7 +68,6 @@
|
|||
#define DNS__SET32BIT(p, v) le32enc
|
||||
#endif
|
||||
|
||||
|
||||
/* Macros for parsing a DNS header */
|
||||
#define DNS_HEADER_QID(h) DNS__16BIT(h)
|
||||
#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1)
|
||||
|
|
|
@ -33,7 +33,7 @@ handle when the channel is no longer needed.
|
|||
.BR ares_init(3),
|
||||
.BR ares_library_init(3)
|
||||
.SH AVAILABILITY
|
||||
ares_dup(3) was added in c-ares 1.6.0
|
||||
\fIares_dup(3)\fP was added in c-ares 1.6.0
|
||||
.SH AUTHOR
|
||||
Daniel Stenberg
|
||||
|
||||
|
|
|
@ -23,9 +23,8 @@ ares_free_string \- Free strings allocated by ares functions
|
|||
.B void ares_free_string(void *\fIstr\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.I ares_free_string
|
||||
function frees a string allocated by an ares function.
|
||||
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)
|
||||
|
|
|
@ -299,6 +299,7 @@ static char *lookup_service(unsigned short port, int flags,
|
|||
else
|
||||
proto = "tcp";
|
||||
#ifdef HAVE_GETSERVBYPORT_R
|
||||
memset(&se, 0, sizeof(se));
|
||||
sep = &se;
|
||||
memset(tmpbuf, 0, sizeof(tmpbuf));
|
||||
#if GETSERVBYPORT_R_ARGS == 6
|
||||
|
|
168
ares_init.3
168
ares_init.3
|
@ -16,167 +16,24 @@
|
|||
.\"
|
||||
.TH ARES_INIT 3 "5 March 2010"
|
||||
.SH NAME
|
||||
ares_init, ares_init_options \- Initialize a resolver channel
|
||||
ares_init \- Initialize a resolver channel
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_init(ares_channel *\fIchannelptr\fP)
|
||||
.B int ares_init_options(ares_channel *\fIchannelptr\fP,
|
||||
.B struct ares_options *\fIoptions\fP, int \fIoptmask\fP)
|
||||
.PP
|
||||
.B cc file.c -lcares
|
||||
#include <ares.h>
|
||||
|
||||
int ares_init(ares_channel *\fIchannelptr\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_init\fP function initializes a communications channel for name
|
||||
service lookups. If it returns successfully, \fBares_init\fP will set the
|
||||
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
|
||||
.BR ares_destroy (3)
|
||||
on the handle when the channel is no longer needed.
|
||||
.PP
|
||||
The \fBares_init_options\fP function also initializes a name service channel,
|
||||
with additional options useful for applications requiring more control over
|
||||
name service configuration. The \fIoptmask\fP parameter 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_PORT
|
||||
.B unsigned short \fIport\fP;
|
||||
.br
|
||||
The port to use for queries (both TCP and UDP), in network byte order.
|
||||
The default value is 53 (in network byte order), the standard name
|
||||
service port.
|
||||
.TP 18
|
||||
.B ARES_OPT_SERVERS
|
||||
.B struct in_addr *\fIservers\fP;
|
||||
.br
|
||||
.B int \fInservers\fP;
|
||||
.br
|
||||
The list of IPv4 servers to contact, instead of the servers specified in
|
||||
resolv.conf or the local named. In order to allow specification of either
|
||||
IPv4 or IPv6 name servers, the
|
||||
.BR ares_set_servers(3)
|
||||
function must be used instead.
|
||||
.TP 18
|
||||
.B ARES_OPT_DOMAINS
|
||||
.B char **\fIdomains\fP;
|
||||
.br
|
||||
.B int \fIndomains\fP;
|
||||
.br
|
||||
The domains to search, instead of the domains specified in resolv.conf
|
||||
or the domain derived from the kernel hostname variable.
|
||||
.TP 18
|
||||
.B ARES_OPT_LOOKUPS
|
||||
.B char *\fIlookups\fP;
|
||||
.br
|
||||
The lookups to perform for host queries.
|
||||
.I lookups
|
||||
should be set to a string of the characters "b" or "f", where "b"
|
||||
indicates a DNS lookup and "f" indicates a lookup in the hosts file.
|
||||
.TP 18
|
||||
.B ARES_OPT_SOCK_STATE_CB
|
||||
.B void (*\fIsock_state_cb\fP)(void *data, int s, int read, int write);
|
||||
.br
|
||||
.B void *\fIsock_state_cb_data\fP;
|
||||
.br
|
||||
A callback function to be invoked when a socket changes state.
|
||||
.I s
|
||||
will be passed the socket whose state has changed;
|
||||
.I read
|
||||
will be set to true if the socket should listen for read events, and
|
||||
.I write
|
||||
will be set to true if the socket should listen for write events.
|
||||
The value of
|
||||
.I sock_state_cb_data
|
||||
will be passed as the
|
||||
.I data
|
||||
argument.
|
||||
.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.
|
||||
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
|
||||
.I ares_init
|
||||
or
|
||||
.I ares_init_options
|
||||
can return any of the following values:
|
||||
\fIares_init(3)\fP can return any of the following values:
|
||||
.TP 14
|
||||
.B ARES_SUCCESS
|
||||
Initialization succeeded.
|
||||
|
@ -211,6 +68,7 @@ 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),
|
||||
|
|
53
ares_init.c
53
ares_init.c
|
@ -112,7 +112,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
|||
ares_channel channel;
|
||||
int i;
|
||||
int status = ARES_SUCCESS;
|
||||
int status2;
|
||||
struct timeval now;
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
|
@ -190,18 +189,17 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
|||
* precedence to lowest.
|
||||
*/
|
||||
|
||||
if (status == ARES_SUCCESS) {
|
||||
status = init_by_options(channel, options, optmask);
|
||||
if (status != ARES_SUCCESS)
|
||||
DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
}
|
||||
if (status == ARES_SUCCESS) {
|
||||
status = init_by_environment(channel);
|
||||
if (status != ARES_SUCCESS)
|
||||
DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
status = init_by_options(channel, options, optmask);
|
||||
if (status != ARES_SUCCESS) {
|
||||
DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
/* If we fail to apply user-specified options, fail the whole init process */
|
||||
goto done;
|
||||
}
|
||||
status = init_by_environment(channel);
|
||||
if (status != ARES_SUCCESS)
|
||||
DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
if (status == ARES_SUCCESS) {
|
||||
status = init_by_resolv_conf(channel);
|
||||
if (status != ARES_SUCCESS)
|
||||
|
@ -213,13 +211,10 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
|||
* No matter what failed or succeeded, seed defaults to provide
|
||||
* useful behavior for things that we missed.
|
||||
*/
|
||||
status2 = init_by_defaults(channel);
|
||||
if (status2 != ARES_SUCCESS) {
|
||||
status = init_by_defaults(channel);
|
||||
if (status != ARES_SUCCESS)
|
||||
DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
if (status == ARES_SUCCESS)
|
||||
status = status2;
|
||||
}
|
||||
|
||||
/* Generate random key */
|
||||
|
||||
|
@ -232,6 +227,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
|||
ares_strerror(status)));
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != ARES_SUCCESS)
|
||||
{
|
||||
/* Something failed; clean up memory we may have allocated. */
|
||||
|
@ -350,8 +346,8 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
|
|||
(*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS|
|
||||
ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB|
|
||||
ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS|
|
||||
ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS) |
|
||||
(channel->optmask & ARES_OPT_ROTATE);
|
||||
ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS);
|
||||
(*optmask) |= (channel->rotate ? ARES_OPT_ROTATE : ARES_OPT_NOROTATE);
|
||||
|
||||
/* Copy easy stuff */
|
||||
options->flags = channel->flags;
|
||||
|
@ -447,6 +443,8 @@ static int init_by_options(ares_channel channel,
|
|||
channel->ndots = options->ndots;
|
||||
if ((optmask & ARES_OPT_ROTATE) && channel->rotate == -1)
|
||||
channel->rotate = 1;
|
||||
if ((optmask & ARES_OPT_NOROTATE) && channel->rotate == -1)
|
||||
channel->rotate = 0;
|
||||
if ((optmask & ARES_OPT_UDP_PORT) && channel->udp_port == -1)
|
||||
channel->udp_port = htons(options->udp_port);
|
||||
if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1)
|
||||
|
@ -520,13 +518,14 @@ static int init_by_options(ares_channel channel,
|
|||
}
|
||||
|
||||
/* copy sortlist */
|
||||
if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1) &&
|
||||
(options->nsort>0)) {
|
||||
channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern));
|
||||
if (!channel->sortlist)
|
||||
return ARES_ENOMEM;
|
||||
for (i = 0; i < options->nsort; i++)
|
||||
channel->sortlist[i] = options->sortlist[i];
|
||||
if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1)) {
|
||||
if (options->nsort > 0) {
|
||||
channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern));
|
||||
if (!channel->sortlist)
|
||||
return ARES_ENOMEM;
|
||||
for (i = 0; i < options->nsort; i++)
|
||||
channel->sortlist[i] = options->sortlist[i];
|
||||
}
|
||||
channel->nsort = options->nsort;
|
||||
}
|
||||
|
||||
|
@ -1625,7 +1624,7 @@ static int config_lookup(ares_channel channel, const char *str,
|
|||
channel->lookups = ares_strdup(lookups);
|
||||
return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM;
|
||||
}
|
||||
#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ */
|
||||
#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ & !CARES_USE_LIBRESOLV */
|
||||
|
||||
#ifndef WATT32
|
||||
static int config_nameserver(struct server_state **servers, int *nservers,
|
||||
|
|
|
@ -1 +1,262 @@
|
|||
.so man3/ares_init.3
|
||||
.\"
|
||||
.\" 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>
|
||||
|
||||
int ares_init_options(ares_channel *\fIchannelptr\fP,
|
||||
struct ares_options *\fIoptions\fP,
|
||||
int \fIoptmask\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBares_init_options(3)\fP function initializes a communications channel
|
||||
for name service lookups. If it returns successfully,
|
||||
\fBares_init_options(3)\fP will set the variable pointed to by
|
||||
\fIchannelptr\fP to a handle used to identify the name service channel. The
|
||||
caller should invoke \fIares_destroy(3)\fP on the handle when the channel is
|
||||
no longer needed.
|
||||
|
||||
The \fIoptmask\fP parameter generally specifies which fields in the structure pointed to
|
||||
by \fIoptions\fP are set, as follows:
|
||||
.TP 18
|
||||
.B ARES_OPT_FLAGS
|
||||
.B int \fIflags\fP;
|
||||
.br
|
||||
Flags controlling the behavior of the resolver. See below for a
|
||||
description of possible flag values.
|
||||
.TP 18
|
||||
.B ARES_OPT_TIMEOUT
|
||||
.B int \fItimeout\fP;
|
||||
.br
|
||||
The number of seconds each name server is given to respond to a query on the
|
||||
first try. (After the first try, the timeout algorithm becomes more
|
||||
complicated, but scales linearly with the value of \fItimeout\fP.) The
|
||||
default is five seconds. This option is being deprecated by
|
||||
\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2.
|
||||
.TP 18
|
||||
.B ARES_OPT_TIMEOUTMS
|
||||
.B int \fItimeout\fP;
|
||||
.br
|
||||
The number of milliseconds each name server is given to respond to a query on
|
||||
the first try. (After the first try, the timeout algorithm becomes more
|
||||
complicated, but scales linearly with the value of \fItimeout\fP.) The
|
||||
default is five seconds. Note that this option is specified with the same
|
||||
struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits
|
||||
that tell c-ares how to interpret the number. This option was added in c-ares
|
||||
1.5.2.
|
||||
.TP 18
|
||||
.B ARES_OPT_TRIES
|
||||
.B int \fItries\fP;
|
||||
.br
|
||||
The number of tries the resolver will try contacting each name server
|
||||
before giving up. The default is four tries.
|
||||
.TP 18
|
||||
.B ARES_OPT_NDOTS
|
||||
.B int \fIndots\fP;
|
||||
.br
|
||||
The number of dots which must be present in a domain name for it to be
|
||||
queried for "as is" prior to querying for it with the default domain
|
||||
extensions appended. The default value is 1 unless set otherwise by
|
||||
resolv.conf or the RES_OPTIONS environment variable.
|
||||
.TP 18
|
||||
.B ARES_OPT_UDP_PORT
|
||||
.B unsigned short \fIudp_port\fP;
|
||||
.br
|
||||
The port to use for queries over UDP, in network byte order.
|
||||
The default value is 53 (in network byte order), the standard name
|
||||
service port.
|
||||
.TP 18
|
||||
.B ARES_OPT_TCP_PORT
|
||||
.B unsigned short \fItcp_port\fP;
|
||||
.br
|
||||
The port to use for queries over TCP, in network byte order.
|
||||
The default value is 53 (in network byte order), the standard name
|
||||
service port.
|
||||
.TP 18
|
||||
.B ARES_OPT_SERVERS
|
||||
.B struct in_addr *\fIservers\fP;
|
||||
.br
|
||||
.B int \fInservers\fP;
|
||||
.br
|
||||
The list of IPv4 servers to contact, instead of the servers specified in
|
||||
resolv.conf or the local named. In order to allow specification of either
|
||||
IPv4 or IPv6 name servers, the
|
||||
.BR ares_set_servers(3)
|
||||
function must be used instead.
|
||||
.TP 18
|
||||
.B ARES_OPT_DOMAINS
|
||||
.B char **\fIdomains\fP;
|
||||
.br
|
||||
.B int \fIndomains\fP;
|
||||
.br
|
||||
The domains to search, instead of the domains specified in resolv.conf
|
||||
or the domain derived from the kernel hostname variable.
|
||||
.TP 18
|
||||
.B ARES_OPT_LOOKUPS
|
||||
.B char *\fIlookups\fP;
|
||||
.br
|
||||
The lookups to perform for host queries.
|
||||
.I lookups
|
||||
should be set to a string of the characters "b" or "f", where "b"
|
||||
indicates a DNS lookup and "f" indicates a lookup in the hosts file.
|
||||
.TP 18
|
||||
.B ARES_OPT_SOCK_STATE_CB
|
||||
.B void (*\fIsock_state_cb\fP)(void *data, int s, int read, int write);
|
||||
.br
|
||||
.B void *\fIsock_state_cb_data\fP;
|
||||
.br
|
||||
A callback function to be invoked when a socket changes state.
|
||||
.I s
|
||||
will be passed the socket whose state has changed;
|
||||
.I read
|
||||
will be set to true if the socket should listen for read events, and
|
||||
.I write
|
||||
will be set to true if the socket should listen for write events.
|
||||
The value of
|
||||
.I sock_state_cb_data
|
||||
will be passed as the
|
||||
.I data
|
||||
argument.
|
||||
.TP 18
|
||||
.B ARES_OPT_SORTLIST
|
||||
.B struct apattern *\fIsortlist\fP;
|
||||
.br
|
||||
.B int \fInsort\fP;
|
||||
.br
|
||||
A list of IP address ranges that specifies the order of preference that
|
||||
results from \fIares_gethostbyname\fP should be returned in. Note that
|
||||
this can only be used with a sortlist retrieved via
|
||||
\fBares_save_options(3)\fP (because
|
||||
.B struct apattern
|
||||
is opaque); to set a fresh sort list, use \fBares_set_sortlist(3)\fP.
|
||||
.TP 18
|
||||
.B ARES_OPT_SOCK_SNDBUF
|
||||
.B int \fIsocket_send_buffer_size\fP;
|
||||
.br
|
||||
The send buffer size to set for the socket.
|
||||
.TP 18
|
||||
.B ARES_OPT_SOCK_RCVBUF
|
||||
.B int \fIsocket_receive_buffer_size\fP;
|
||||
.br
|
||||
The receive buffer size to set for the socket.
|
||||
.TP 18
|
||||
.B ARES_OPT_EDNSPSZ
|
||||
.B int \fIednspsz\fP;
|
||||
.br
|
||||
The message size to be advertized in EDNS; only takes effect if the
|
||||
.B ARES_FLAG_EDNS
|
||||
flag is set.
|
||||
.br
|
||||
.PP
|
||||
The \fIoptmask\fP parameter also includes options without a corresponding
|
||||
field in the
|
||||
.B ares_options
|
||||
structure, as follows:
|
||||
.TP 23
|
||||
.B ARES_OPT_ROTATE
|
||||
Perform round-robin selection of the nameservers configured for the channel
|
||||
for each resolution.
|
||||
.TP 23
|
||||
.B ARES_OPT_NOROTATE
|
||||
Do not perform round-robin nameserver selection; always use the list of
|
||||
nameservers in the same order.
|
||||
.PP
|
||||
The
|
||||
.I flags
|
||||
field should be the bitwise or of some subset of the following values:
|
||||
.TP 23
|
||||
.B ARES_FLAG_USEVC
|
||||
Always use TCP queries (the "virtual circuit") instead of UDP
|
||||
queries. Normally, TCP is only used if a UDP query yields a truncated
|
||||
result.
|
||||
.TP 23
|
||||
.B ARES_FLAG_PRIMARY
|
||||
Only query the first server in the list of servers to query.
|
||||
.TP 23
|
||||
.B ARES_FLAG_IGNTC
|
||||
If a truncated response to a UDP query is received, do not fall back
|
||||
to TCP; simply continue on with the truncated response.
|
||||
.TP 23
|
||||
.B ARES_FLAG_NORECURSE
|
||||
Do not set the "recursion desired" bit on outgoing queries, so that the name
|
||||
server being contacted will not try to fetch the answer from other servers if
|
||||
it doesn't know the answer locally. Be aware that ares will not do the
|
||||
recursion for you. Recursion must be handled by the application calling ares
|
||||
if \fIARES_FLAG_NORECURSE\fP is set.
|
||||
.TP 23
|
||||
.B ARES_FLAG_STAYOPEN
|
||||
Do not close communications sockets when the number of active queries
|
||||
drops to zero.
|
||||
.TP 23
|
||||
.B ARES_FLAG_NOSEARCH
|
||||
Do not use the default search domains; only query hostnames as-is or
|
||||
as aliases.
|
||||
.TP 23
|
||||
.B ARES_FLAG_NOALIASES
|
||||
Do not honor the HOSTALIASES environment variable, which normally
|
||||
specifies a file of hostname translations.
|
||||
.TP 23
|
||||
.B ARES_FLAG_NOCHECKRESP
|
||||
Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED
|
||||
response code or responses whose questions don't match the questions
|
||||
in the request. Primarily useful for writing clients which might be
|
||||
used to test or debug name servers.
|
||||
.TP 23
|
||||
.B ARES_FLAG_EDNS
|
||||
Include an EDNS pseudo-resource record (RFC 2671) in generated requests.
|
||||
.SH RETURN VALUES
|
||||
\fBares_init_options(3)\fP can return any of the following values:
|
||||
.TP 14
|
||||
.B ARES_SUCCESS
|
||||
Initialization succeeded.
|
||||
.TP 14
|
||||
.B ARES_EFILE
|
||||
A configuration file could not be read.
|
||||
.TP 14
|
||||
.B ARES_ENOMEM
|
||||
The process's available memory was exhausted.
|
||||
.TP 14
|
||||
.B ARES_ENOTINITIALIZED
|
||||
c-ares library initialization not yet performed.
|
||||
.SH NOTES
|
||||
When initializing from
|
||||
.B /etc/resolv.conf,
|
||||
\fBares_init_options(3)\fP reads the \fIdomain\fP and \fIsearch\fP directives
|
||||
to allow lookups of short names relative to the domains specified. The
|
||||
\fIdomain\fP and \fIsearch\fP directives override one another. If more that
|
||||
one instance of either \fIdomain\fP or \fIsearch\fP directives is specified,
|
||||
the last occurrence wins. For more information, please see the
|
||||
.BR resolv.conf (5)
|
||||
manual page.
|
||||
.SH SEE ALSO
|
||||
.BR ares_init(3),
|
||||
.BR ares_destroy(3),
|
||||
.BR ares_dup(3),
|
||||
.BR ares_library_init(3),
|
||||
.BR ares_save_options(3),
|
||||
.BR ares_set_servers(3),
|
||||
.BR ares_set_sortlist(3)
|
||||
.SH AUTHOR
|
||||
Greg Hudson, MIT Information Systems
|
||||
.br
|
||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
.br
|
||||
Copyright (C) 2004-2010 by Daniel Stenberg.
|
||||
|
||||
|
|
|
@ -47,16 +47,16 @@ struct addrinfo
|
|||
#endif
|
||||
|
||||
#ifndef NS_IN6ADDRSZ
|
||||
#if SIZEOF_STRUCT_IN6_ADDR == 0
|
||||
#ifndef HAVE_STRUCT_IN6_ADDR
|
||||
/* We cannot have it set to zero, so we pick a fixed value here */
|
||||
#define NS_IN6ADDRSZ 16
|
||||
#else
|
||||
#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR
|
||||
#define NS_IN6ADDRSZ sizeof(struct in6_addr)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NS_INADDRSZ
|
||||
#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR
|
||||
#define NS_INADDRSZ sizeof(struct in_addr)
|
||||
#endif
|
||||
|
||||
#ifndef NS_INT16SZ
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
ares_library_init \- c-ares library initialization
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_library_init(int \fIflags\fP)
|
||||
.B int ares_library_init_mem(int \fIflags\fP, void *(*\fIamalloc\fP)(size_t), void (*\fIafree\fP)(void *))
|
||||
.PP
|
||||
.B cc file.c -lcares
|
||||
#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
|
||||
|
@ -54,9 +56,9 @@ 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 and
|
||||
\fIfree(3)\fP.
|
||||
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
|
||||
|
|
|
@ -111,7 +111,14 @@ int ares_library_init(int flags)
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
ares_initialized++;
|
||||
|
||||
|
||||
if (flags & ARES_LIB_INIT_AMIGA)
|
||||
{
|
||||
res = ares_amiga_init();
|
||||
if (res != ARES_SUCCESS)
|
||||
return res;
|
||||
}
|
||||
|
||||
if (flags & ARES_LIB_INIT_WIN32)
|
||||
{
|
||||
res = ares_win32_init();
|
||||
|
@ -119,13 +126,6 @@ int ares_library_init(int flags)
|
|||
return res; /* LCOV_EXCL_LINE: can't test Win32 init failure */
|
||||
}
|
||||
|
||||
if (flags & ARES_LIB_INIT_AMIGA)
|
||||
{
|
||||
res = ares_amiga_init();
|
||||
if (res != ARES_SUCCESS)
|
||||
return res;
|
||||
}
|
||||
|
||||
ares_init_flags = flags;
|
||||
|
||||
return ARES_SUCCESS;
|
||||
|
@ -157,11 +157,12 @@ void ares_library_cleanup(void)
|
|||
if (ares_init_flags & ARES_LIB_INIT_WIN32)
|
||||
ares_win32_cleanup();
|
||||
|
||||
if (ares_init_flags & ARES_LIB_INIT_WIN32)
|
||||
if (ares_init_flags & ARES_LIB_INIT_AMIGA)
|
||||
ares_amiga_cleanup();
|
||||
|
||||
ares_init_flags = ARES_LIB_INIT_NONE;
|
||||
ares_malloc = malloc;
|
||||
ares_realloc = realloc;
|
||||
ares_free = free;
|
||||
}
|
||||
|
||||
|
@ -178,5 +179,3 @@ int ares_library_initialized(void)
|
|||
#endif
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,42 +40,22 @@
|
|||
|
||||
#include "ares_nowarn.h"
|
||||
|
||||
#if (SIZEOF_SHORT == 2)
|
||||
#ifndef HAVE_LIMITS_H
|
||||
/* systems without <limits.h> we guess have 16 bit shorts, 32bit ints and
|
||||
32bit longs */
|
||||
# define CARES_MASK_SSHORT 0x7FFF
|
||||
# define CARES_MASK_USHORT 0xFFFF
|
||||
#elif (SIZEOF_SHORT == 4)
|
||||
# define CARES_MASK_SSHORT 0x7FFFFFFF
|
||||
# define CARES_MASK_USHORT 0xFFFFFFFF
|
||||
#elif (SIZEOF_SHORT == 8)
|
||||
# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF
|
||||
# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF
|
||||
# define CARES_MASK_SINT 0x7FFFFFFF
|
||||
# define CARES_MASK_UINT 0xFFFFFFFF
|
||||
# define CARES_MASK_SLONG 0x7FFFFFFFL
|
||||
# define CARES_MASK_ULONG 0xFFFFFFFFUL
|
||||
#else
|
||||
# error "SIZEOF_SHORT not defined"
|
||||
#endif
|
||||
|
||||
#if (SIZEOF_INT == 2)
|
||||
# define CARES_MASK_SINT 0x7FFF
|
||||
# define CARES_MASK_UINT 0xFFFF
|
||||
#elif (SIZEOF_INT == 4)
|
||||
# define CARES_MASK_SINT 0x7FFFFFFF
|
||||
# define CARES_MASK_UINT 0xFFFFFFFF
|
||||
#elif (SIZEOF_INT == 8)
|
||||
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF
|
||||
# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF
|
||||
#elif (SIZEOF_INT == 16)
|
||||
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
#else
|
||||
# error "SIZEOF_INT not defined"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIMITS_H
|
||||
/* systems without <limits.h> we guess have 32 bit longs */
|
||||
#define CARES_MASK_SLONG 0x7FFFFFFFL
|
||||
#define CARES_MASK_ULONG 0xFFFFFFFFUL
|
||||
#else
|
||||
#define CARES_MASK_ULONG ULONG_MAX
|
||||
#define CARES_MASK_SLONG LONG_MAX
|
||||
# define CARES_MASK_SSHORT SHRT_MAX
|
||||
# define CARES_MASK_USHORT USHRT_MAX
|
||||
# define CARES_MASK_SINT INT_MAX
|
||||
# define CARES_MASK_UINT UINT_MAX
|
||||
# define CARES_MASK_SLONG LONG_MAX
|
||||
# define CARES_MASK_ULONG ULONG_MAX
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -391,8 +391,7 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds,
|
|||
*/
|
||||
process_answer(channel, server->tcp_buffer, server->tcp_length,
|
||||
i, 1, now);
|
||||
if (server->tcp_buffer)
|
||||
ares_free(server->tcp_buffer);
|
||||
ares_free(server->tcp_buffer);
|
||||
server->tcp_buffer = NULL;
|
||||
server->tcp_lenbuf_pos = 0;
|
||||
server->tcp_buffer_pos = 0;
|
||||
|
|
|
@ -73,11 +73,6 @@
|
|||
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CARES_SIZEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!"
|
||||
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros private to this header file.
|
||||
*/
|
||||
|
@ -94,7 +89,7 @@
|
|||
|
||||
typedef char
|
||||
__cares_rule_02__
|
||||
[CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)];
|
||||
[CareschkszEQ(ares_socklen_t, sizeof(CARES_TYPEOF_ARES_SOCKLEN_T))];
|
||||
|
||||
/*
|
||||
* Verify at compile time that the size of ares_socklen_t as reported
|
||||
|
|
14
ares_setup.h
14
ares_setup.h
|
@ -28,16 +28,6 @@
|
|||
* configuration file for platforms which lack config tool.
|
||||
*/
|
||||
|
||||
/* amiga */
|
||||
#ifdef AOS3
|
||||
#include <clib/amitcp_protos.h>
|
||||
#include <amitcp/socketbasetags.h>
|
||||
int ares_amiga_init(void);
|
||||
void ares_amiga_cleanup(void);
|
||||
extern struct Library *SocketBase;
|
||||
extern char *prog;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "ares_config.h"
|
||||
#else
|
||||
|
@ -48,6 +38,10 @@ extern char *prog;
|
|||
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#ifdef AMIGA
|
||||
#include "config-amiga.h"
|
||||
#endif
|
||||
|
||||
/* ================================================================ */
|
||||
/* Definition of preprocessor macros/symbols which modify compiler */
|
||||
/* behaviour or generated code characteristics must be done here, */
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
#define ARES_COPYRIGHT "2004 - 2016 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
#define ARES_VERSION_MAJOR 1
|
||||
#define ARES_VERSION_MINOR 11
|
||||
#define ARES_VERSION_PATCH 1
|
||||
#define ARES_VERSION_MINOR 12
|
||||
#define ARES_VERSION_PATCH 0
|
||||
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
|
||||
(ARES_VERSION_MINOR<<8)|\
|
||||
(ARES_VERSION_PATCH))
|
||||
#define ARES_VERSION_STR "1.11.1-DEV"
|
||||
#define ARES_VERSION_STR "1.12.0"
|
||||
|
||||
#if (ARES_VERSION >= 0x010700)
|
||||
# define CARES_HAVE_ARES_LIBRARY_INIT 1
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
Short: Asynchronous DNS resolver library (src)
|
||||
Author: Daniel Stenberg, Greg Hudson and others
|
||||
Uploader: Carsten Larsen (carsten larsen mail com)
|
||||
Type: dev/gcc
|
||||
Version: 1.12.0
|
||||
Architecture: generic
|
||||
URL: http://c-ares.haxx.se/
|
||||
|
||||
|
||||
ABOUT
|
||||
|
||||
Source code for c-ares asynchronous resolver library.
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
c-ares is 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.
|
||||
|
||||
BUGS
|
||||
|
||||
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.
|
||||
|
||||
c-ares is of course distributed under the same MIT-style license as the
|
||||
original ares.
|
6
cares.rc
6
cares.rc
|
@ -1,5 +1,5 @@
|
|||
|
||||
/* Copyright (C) 2009 by Daniel Stenberg
|
||||
/* Copyright (C) 2009-2016 by Daniel Stenberg
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
|
@ -39,7 +39,7 @@ BEGIN
|
|||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "The c-ares library, http://c-ares.haxx.se/\0"
|
||||
VALUE "CompanyName", "The c-ares library, https://c-ares.haxx.se/\0"
|
||||
#if defined(DEBUGBUILD) || defined(_DEBUG)
|
||||
VALUE "FileDescription", "c-ares Debug Shared Library\0"
|
||||
VALUE "FileVersion", ARES_VERSION_STR "\0"
|
||||
|
@ -54,7 +54,7 @@ BEGIN
|
|||
VALUE "ProductName", "The c-ares library\0"
|
||||
VALUE "ProductVersion", ARES_VERSION_STR "\0"
|
||||
VALUE "LegalCopyright", "© " ARES_COPYRIGHT "\0"
|
||||
VALUE "License", "http://c-ares.haxx.se/license.html\0"
|
||||
VALUE "License", "https://c-ares.haxx.se/license.html\0"
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef HEADER_CARES_CONFIG_AMIGA_H
|
||||
#define HEADER_CARES_CONFIG_AMIGA_H
|
||||
|
||||
#ifdef AOS3
|
||||
#include <clib/amitcp_protos.h>
|
||||
#include <amitcp/socketbasetags.h>
|
||||
#define ANSI_CONSOLE
|
||||
int ares_amiga_init(void);
|
||||
void ares_amiga_cleanup(void);
|
||||
extern struct Library *SocketBase;
|
||||
extern char *prog;
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -32,9 +32,6 @@
|
|||
#define NEED_MALLOC_H 1
|
||||
|
||||
#define RETSIGTYPE void
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_SHORT 2
|
||||
#define SIZEOF_SIZE_T 4
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */
|
||||
|
|
|
@ -234,19 +234,6 @@
|
|||
/* TYPE SIZES */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define to the size of `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* Define to the size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* Define to the size of `size_t', as computed by sizeof. */
|
||||
#if defined(_WIN64)
|
||||
# define SIZEOF_SIZE_T 8
|
||||
#else
|
||||
# define SIZEOF_SIZE_T 4
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* STRUCT RELATED */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
|
106
configure.ac
106
configure.ac
|
@ -1,7 +1,7 @@
|
|||
AC_PREREQ(2.57)
|
||||
|
||||
dnl Version not hardcoded here. Fetched later from ares_version.h
|
||||
AC_INIT([c-ares], [-],
|
||||
AC_INIT([c-ares], [1.12.0],
|
||||
[c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares])
|
||||
|
||||
XC_OVR_ZZ50
|
||||
|
@ -82,6 +82,7 @@ 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
|
||||
|
||||
|
@ -481,12 +482,6 @@ AC_TYPE_SIZE_T
|
|||
AC_HEADER_TIME
|
||||
CURL_CHECK_STRUCT_TIMEVAL
|
||||
|
||||
AC_CHECK_SIZEOF(size_t)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(time_t)
|
||||
|
||||
AC_CHECK_TYPE(long long,
|
||||
[AC_DEFINE(HAVE_LONGLONG, 1,
|
||||
[Define to 1 if the compiler supports the 'long long' data type.])]
|
||||
|
@ -759,63 +754,6 @@ AC_CHECK_FUNCS([bitncmp \
|
|||
])
|
||||
|
||||
|
||||
AC_CHECK_SIZEOF(struct in6_addr, ,
|
||||
[
|
||||
#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_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#endif
|
||||
]
|
||||
)
|
||||
|
||||
AC_CHECK_SIZEOF(struct in_addr, ,
|
||||
[
|
||||
#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_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#endif
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
dnl Check if the getnameinfo function is available
|
||||
dnl and get the types of five of its arguments.
|
||||
CURL_CHECK_FUNC_GETNAMEINFO
|
||||
|
@ -877,28 +815,30 @@ squeeze CARES_PRIVATE_LIBS
|
|||
|
||||
XC_CHECK_BUILD_FLAGS
|
||||
|
||||
BUILDTESTS="yes"
|
||||
AC_MSG_CHECKING([whether to build the tests])
|
||||
AC_MSG_CHECKING([whether to build tests])
|
||||
AC_ARG_ENABLE(tests,
|
||||
AC_HELP_STRING([--disable-tests],[skip building the tests]),
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
BUILDTESTS="no"
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(yes)
|
||||
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 "$BUILDTESTS" = "yes"; then
|
||||
if test "x$cross_compiling" = "xno"; then
|
||||
AC_CONFIG_SUBDIRS([test])
|
||||
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])
|
||||
|
||||
if test "x$build_tests" = "xyes" ; then
|
||||
AC_CONFIG_SUBDIRS([test])
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile libcares.pc])
|
||||
|
|
|
@ -1,29 +1,3 @@
|
|||
/*
|
||||
* Copyright (c) 2015 Carsten Larsen
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SOCKET_AMITCP_H
|
||||
#define _SOCKET_AMITCP_H
|
||||
//--------------------------------------------------------------------------//
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* Automatically generated header! Do not edit! */
|
||||
|
||||
#ifndef _INLINE_AMITCP_H
|
||||
#define _INLINE_AMITCP_H
|
||||
|
||||
|
|
49
setup_once.h
49
setup_once.h
|
@ -521,6 +521,55 @@ typedef int sig_atomic_t;
|
|||
#define EREMOTE WSAEREMOTE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compatibility
|
||||
*/
|
||||
|
||||
#ifndef HFIXEDSZ
|
||||
#define HFIXEDSZ 12
|
||||
#endif
|
||||
#ifndef T_TXT
|
||||
#define T_TXT 16
|
||||
#endif
|
||||
#ifndef T_RP
|
||||
#define T_RP 17
|
||||
#endif
|
||||
#ifndef T_AFSDB
|
||||
#define T_AFSDB 18
|
||||
#endif
|
||||
#ifndef T_X25
|
||||
#define T_X25 19
|
||||
#endif
|
||||
#ifndef T_ISDN
|
||||
#define T_ISDN 20
|
||||
#endif
|
||||
#ifndef T_RT
|
||||
#define T_RT 21
|
||||
#endif
|
||||
#ifndef T_NSAP
|
||||
#define T_NSAP 22
|
||||
#endif
|
||||
#ifndef T_NSAP_PTR
|
||||
#define T_NSAP_PTR 23
|
||||
#endif
|
||||
#ifndef T_SIG
|
||||
#define T_SIG 24
|
||||
#endif
|
||||
#ifndef T_KEY
|
||||
#define T_KEY 25
|
||||
#endif
|
||||
#ifndef T_PX
|
||||
#define T_PX 26
|
||||
#endif
|
||||
#ifndef T_GPOS
|
||||
#define T_GPOS 27
|
||||
#endif
|
||||
#ifndef T_AAAA
|
||||
#define T_AAAA 28
|
||||
#endif
|
||||
#ifndef T_LOC
|
||||
#define T_LOC 29
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid()
|
||||
|
|
|
@ -13,9 +13,9 @@ CXXFLAGS += -Wall $(PTHREAD_CFLAGS)
|
|||
# Makefile.inc provides the TESTSOURCES, TESTHEADERS and FUZZSOURCES defines
|
||||
include Makefile.inc
|
||||
|
||||
TESTS = arestest
|
||||
TESTS = arestest fuzzcheck.sh
|
||||
|
||||
noinst_PROGRAMS = arestest aresfuzz
|
||||
noinst_PROGRAMS = arestest aresfuzz dnsdump
|
||||
arestest_SOURCES = $(TESTSOURCES) $(TESTHEADERS)
|
||||
arestest_LDADD = libgmock.la libgtest.la $(ARES_BLD_DIR)/libcares.la $(PTHREAD_LIBS)
|
||||
|
||||
|
@ -33,4 +33,7 @@ libgtest_la_CPPFLAGS = -isystem $(GTEST_DIR)/include -I$(GTEST_DIR) -isystem $(G
|
|||
aresfuzz_SOURCES = $(FUZZSOURCES)
|
||||
aresfuzz_LDADD = $(ARES_BLD_DIR)/libcares.la
|
||||
|
||||
dnsdump_SOURCES = $(DUMPSOURCES)
|
||||
dnsdump_LDADD = $(ARES_BLD_DIR)/libcares.la
|
||||
|
||||
test: check
|
||||
|
|
|
@ -22,5 +22,8 @@ TESTSOURCES = ares-test-main.cc \
|
|||
TESTHEADERS = ares-test.h \
|
||||
dns-proto.h
|
||||
|
||||
FUZZSOURCES = ares-test-fuzz.cc \
|
||||
ares-fuzz.cc
|
||||
FUZZSOURCES = ares-test-fuzz.c \
|
||||
ares-fuzz.c
|
||||
|
||||
DUMPSOURCES = dns-proto.cc \
|
||||
dns-dump.cc
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* General driver to allow command-line fuzzer (i.e. afl) to
|
||||
* exercise the libFuzzer entrypoint.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define kMaxAflInputSize (1 << 20)
|
||||
static unsigned char afl_buffer[kMaxAflInputSize];
|
||||
|
||||
#ifdef __AFL_LOOP
|
||||
/* If we are built with afl-clang-fast, use persistent mode */
|
||||
#define KEEP_FUZZING(count) __AFL_LOOP(1000)
|
||||
#else
|
||||
/* If we are built with afl-clang, execute each input once */
|
||||
#define KEEP_FUZZING(count) ((count) < 1)
|
||||
#endif
|
||||
|
||||
/* In ares-test-fuzz.c: */
|
||||
int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size);
|
||||
|
||||
static void ProcessFile(int fd) {
|
||||
ssize_t count = read(fd, afl_buffer, kMaxAflInputSize);
|
||||
/*
|
||||
* Make a copy of the data so that it's not part of a larger
|
||||
* buffer (where buffer overflows would go unnoticed).
|
||||
*/
|
||||
unsigned char *copied_data = (unsigned char *)malloc(count);
|
||||
LLVMFuzzerTestOneInput(copied_data, count);
|
||||
free(copied_data);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc == 1) {
|
||||
int count = 0;
|
||||
while (KEEP_FUZZING(count)) {
|
||||
ProcessFile(fileno(stdin));
|
||||
count++;
|
||||
}
|
||||
} else {
|
||||
int ii;
|
||||
for (ii = 1; ii < argc; ++ii) {
|
||||
int fd = open(argv[ii], O_RDONLY);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Failed to open '%s'\n", argv[ii]);
|
||||
continue;
|
||||
}
|
||||
ProcessFile(fd);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
#include <stddef.h>
|
||||
|
||||
#include "ares.h"
|
||||
|
||||
// Entrypoint for Clang's libfuzzer
|
||||
int LLVMFuzzerTestOneInput(const unsigned char *data,
|
||||
unsigned long size) {
|
||||
// Feed the data into each of the ares_parse_*_reply functions.
|
||||
struct hostent *host = NULL;
|
||||
struct ares_addrttl info[5];
|
||||
int count = 5;
|
||||
ares_parse_a_reply(data, size, &host, info, &count);
|
||||
if (host) ares_free_hostent(host);
|
||||
|
||||
host = NULL;
|
||||
struct ares_addr6ttl info6[5];
|
||||
count = 5;
|
||||
ares_parse_aaaa_reply(data, size, &host, info6, &count);
|
||||
if (host) ares_free_hostent(host);
|
||||
|
||||
host = NULL;
|
||||
unsigned char addrv4[4] = {0x10, 0x20, 0x30, 0x40};
|
||||
ares_parse_ptr_reply(data, size, addrv4, sizeof(addrv4), AF_INET, &host);
|
||||
if (host) ares_free_hostent(host);
|
||||
|
||||
host = NULL;
|
||||
ares_parse_ns_reply(data, size, &host);
|
||||
if (host) ares_free_hostent(host);
|
||||
|
||||
struct ares_srv_reply* srv = NULL;
|
||||
ares_parse_srv_reply(data, size, &srv);
|
||||
if (srv) ares_free_data(srv);
|
||||
|
||||
struct ares_mx_reply* mx = NULL;
|
||||
ares_parse_mx_reply(data, size, &mx);
|
||||
if (mx) ares_free_data(mx);
|
||||
|
||||
struct ares_txt_reply* txt = NULL;
|
||||
ares_parse_txt_reply(data, size, &txt);
|
||||
if (txt) ares_free_data(txt);
|
||||
|
||||
struct ares_soa_reply* soa = NULL;
|
||||
ares_parse_soa_reply(data, size, &soa);
|
||||
if (soa) ares_free_data(soa);
|
||||
return 0;
|
||||
}
|
|
@ -354,6 +354,26 @@ CONTAINED_TEST_F(LibraryTest, ContainerChannelInit,
|
|||
return HasFailure();
|
||||
}
|
||||
|
||||
CONTAINED_TEST_F(LibraryTest, ContainerSortlistOptionInit,
|
||||
"myhostname", "mydomainname.org", filelist) {
|
||||
ares_channel channel = nullptr;
|
||||
struct ares_options opts = {0};
|
||||
int optmask = 0;
|
||||
optmask |= ARES_OPT_SORTLIST;
|
||||
opts.nsort = 0;
|
||||
// Explicitly specifying an empty sortlist in the options should override the
|
||||
// environment.
|
||||
EXPECT_EQ(ARES_SUCCESS, ares_init_options(&channel, &opts, optmask));
|
||||
ares_save_options(channel, &opts, &optmask);
|
||||
EXPECT_EQ(0, opts.nsort);
|
||||
EXPECT_EQ(nullptr, opts.sortlist);
|
||||
EXPECT_EQ(ARES_OPT_SORTLIST, (optmask & ARES_OPT_SORTLIST));
|
||||
ares_destroy_options(&opts);
|
||||
|
||||
ares_destroy(channel);
|
||||
return HasFailure();
|
||||
}
|
||||
|
||||
NameContentList fullresolv = {
|
||||
{"/etc/resolv.conf", " nameserver 1.2.3.4 \n"
|
||||
"search first.com second.com\n"
|
||||
|
@ -431,8 +451,8 @@ CONTAINED_TEST_F(LibraryTest, ContainerResolvConfNotReadable,
|
|||
"myhostname", "mydomainname.org", filelist) {
|
||||
ares_channel channel = nullptr;
|
||||
MakeUnreadable hide("/etc/resolv.conf");
|
||||
// Unavailable /etc/resolv.conf fails initialization.
|
||||
EXPECT_EQ(ARES_EFILE, ares_init(&channel));
|
||||
// Unavailable /etc/resolv.conf falls back to defaults
|
||||
EXPECT_EQ(ARES_SUCCESS, ares_init(&channel));
|
||||
return HasFailure();
|
||||
}
|
||||
CONTAINED_TEST_F(LibraryTest, ContainerNsswitchConfNotReadable,
|
||||
|
@ -470,6 +490,41 @@ CONTAINED_TEST_F(LibraryTest, ContainerSvcConfNotReadable,
|
|||
return HasFailure();
|
||||
}
|
||||
|
||||
NameContentList rotateenv = {
|
||||
{"/etc/resolv.conf", "nameserver 1.2.3.4\n"
|
||||
"search first.com second.com\n"
|
||||
"options rotate\n"}};
|
||||
CONTAINED_TEST_F(LibraryTest, ContainerRotateInit,
|
||||
"myhostname", "mydomainname.org", rotateenv) {
|
||||
ares_channel channel = nullptr;
|
||||
EXPECT_EQ(ARES_SUCCESS, ares_init(&channel));
|
||||
|
||||
struct ares_options opts;
|
||||
int optmask = 0;
|
||||
ares_save_options(channel, &opts, &optmask);
|
||||
EXPECT_EQ(ARES_OPT_ROTATE, (optmask & ARES_OPT_ROTATE));
|
||||
ares_destroy_options(&opts);
|
||||
|
||||
ares_destroy(channel);
|
||||
return HasFailure();
|
||||
}
|
||||
|
||||
CONTAINED_TEST_F(LibraryTest, ContainerRotateOverride,
|
||||
"myhostname", "mydomainname.org", rotateenv) {
|
||||
ares_channel channel = nullptr;
|
||||
struct ares_options opts = {0};
|
||||
int optmask = ARES_OPT_NOROTATE;
|
||||
EXPECT_EQ(ARES_SUCCESS, ares_init_options(&channel, &opts, optmask));
|
||||
|
||||
optmask = 0;
|
||||
ares_save_options(channel, &opts, &optmask);
|
||||
EXPECT_EQ(ARES_OPT_NOROTATE, (optmask & ARES_OPT_NOROTATE));
|
||||
ares_destroy_options(&opts);
|
||||
|
||||
ares_destroy(channel);
|
||||
return HasFailure();
|
||||
}
|
||||
|
||||
NameContentList multiresolv = {
|
||||
{"/etc/resolv.conf", " nameserver 1::2 ; ;;\n"
|
||||
" domain first.com\n"},
|
||||
|
|
|
@ -205,7 +205,7 @@ INSTANTIATE_TEST_CASE_P(Modes, DefaultChannelModeTest,
|
|||
|
||||
TEST_F(DefaultChannelTest, LiveSearchA) {
|
||||
SearchResult result;
|
||||
ares_search(channel_, "www.facebook.com.", ns_c_in, ns_t_a,
|
||||
ares_search(channel_, "www.youtube.com.", ns_c_in, ns_t_a,
|
||||
SearchCallback, &result);
|
||||
Process();
|
||||
EXPECT_TRUE(result.done_);
|
||||
|
|
|
@ -4,15 +4,20 @@
|
|||
#include "ares-test.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
std::vector<char*> gtest_argv = {argv[0]};
|
||||
for (int ii = 1; ii < argc; ii++) {
|
||||
if (strcmp(argv[ii], "-v") == 0) {
|
||||
ares::test::verbose = true;
|
||||
} else if ((strcmp(argv[ii], "-p") == 0) && (ii + 1 < argc)) {
|
||||
ii++;
|
||||
ares::test::mock_port = atoi(argv[ii]);
|
||||
} else {
|
||||
gtest_argv.push_back(argv[ii]);
|
||||
}
|
||||
}
|
||||
int gtest_argc = gtest_argv.size();
|
||||
gtest_argv.push_back(nullptr);
|
||||
::testing::InitGoogleTest(>est_argc, gtest_argv.data());
|
||||
|
||||
#ifdef WIN32
|
||||
WORD wVersionRequested = MAKEWORD(2, 2);
|
||||
|
|
|
@ -193,6 +193,19 @@ TEST_F(LibraryTest, CreateQuery) {
|
|||
EXPECT_EQ(expected, actual);
|
||||
}
|
||||
|
||||
TEST_F(LibraryTest, CreateQueryTrailingEscapedDot) {
|
||||
byte* p;
|
||||
int len;
|
||||
EXPECT_EQ(ARES_SUCCESS,
|
||||
ares_create_query("example.com\\.", ns_c_in, ns_t_a, 0x1234, 0,
|
||||
&p, &len, 0));
|
||||
std::vector<byte> data(p, p + len);
|
||||
ares_free_string(p);
|
||||
|
||||
std::string actual = PacketToString(data);
|
||||
EXPECT_EQ("REQ QRY Q:{'example.com\\.' IN A}", actual);
|
||||
}
|
||||
|
||||
TEST_F(LibraryTest, CreateQueryFailures) {
|
||||
byte* p;
|
||||
int len;
|
||||
|
|
|
@ -647,17 +647,17 @@ TEST_P(MockChannelTest, UnspecifiedFamilyV6) {
|
|||
}
|
||||
|
||||
TEST_P(MockChannelTest, UnspecifiedFamilyV4) {
|
||||
DNSPacket rsp6;
|
||||
rsp6.set_response().set_aa()
|
||||
.add_question(new DNSQuestion("example.com", ns_t_aaaa));
|
||||
ON_CALL(server_, OnRequest("example.com", ns_t_aaaa))
|
||||
.WillByDefault(SetReply(&server_, &rsp6));
|
||||
DNSPacket rsp4;
|
||||
rsp4.set_response().set_aa()
|
||||
.add_question(new DNSQuestion("example.com", ns_t_a))
|
||||
.add_answer(new DNSARR("example.com", 100, {2, 3, 4, 5}));
|
||||
ON_CALL(server_, OnRequest("example.com", ns_t_a))
|
||||
.WillByDefault(SetReply(&server_, &rsp4));
|
||||
DNSPacket rsp6;
|
||||
rsp6.set_response().set_aa()
|
||||
.add_question(new DNSQuestion("example.com", ns_t_aaaa));
|
||||
ON_CALL(server_, OnRequest("example.com", ns_t_aaaa))
|
||||
.WillByDefault(SetReply(&server_, &rsp6));
|
||||
|
||||
HostResult result;
|
||||
ares_gethostbyname(channel_, "example.com.", AF_UNSPEC, HostCallback, &result);
|
||||
|
@ -669,17 +669,17 @@ TEST_P(MockChannelTest, UnspecifiedFamilyV4) {
|
|||
}
|
||||
|
||||
TEST_P(MockChannelTest, UnspecifiedFamilyNoData) {
|
||||
DNSPacket rsp4;
|
||||
rsp4.set_response().set_aa()
|
||||
.add_question(new DNSQuestion("example.com", ns_t_a));
|
||||
ON_CALL(server_, OnRequest("example.com", ns_t_a))
|
||||
.WillByDefault(SetReply(&server_, &rsp4));
|
||||
DNSPacket rsp6;
|
||||
rsp6.set_response().set_aa()
|
||||
.add_question(new DNSQuestion("example.com", ns_t_aaaa))
|
||||
.add_answer(new DNSCnameRR("example.com", 100, "elsewhere.com"));
|
||||
ON_CALL(server_, OnRequest("example.com", ns_t_aaaa))
|
||||
.WillByDefault(SetReply(&server_, &rsp6));
|
||||
DNSPacket rsp4;
|
||||
rsp4.set_response().set_aa()
|
||||
.add_question(new DNSQuestion("example.com", ns_t_a));
|
||||
ON_CALL(server_, OnRequest("example.com", ns_t_a))
|
||||
.WillByDefault(SetReply(&server_, &rsp4));
|
||||
|
||||
HostResult result;
|
||||
ares_gethostbyname(channel_, "example.com.", AF_UNSPEC, HostCallback, &result);
|
||||
|
@ -690,6 +690,29 @@ TEST_P(MockChannelTest, UnspecifiedFamilyNoData) {
|
|||
EXPECT_EQ("{'' aliases=[] addrs=[]}", ss.str());
|
||||
}
|
||||
|
||||
TEST_P(MockChannelTest, UnspecifiedFamilyCname6A4) {
|
||||
DNSPacket rsp6;
|
||||
rsp6.set_response().set_aa()
|
||||
.add_question(new DNSQuestion("example.com", ns_t_aaaa))
|
||||
.add_answer(new DNSCnameRR("example.com", 100, "elsewhere.com"));
|
||||
ON_CALL(server_, OnRequest("example.com", ns_t_aaaa))
|
||||
.WillByDefault(SetReply(&server_, &rsp6));
|
||||
DNSPacket rsp4;
|
||||
rsp4.set_response().set_aa()
|
||||
.add_question(new DNSQuestion("example.com", ns_t_a))
|
||||
.add_answer(new DNSARR("example.com", 100, {1, 2, 3, 4}));
|
||||
ON_CALL(server_, OnRequest("example.com", ns_t_a))
|
||||
.WillByDefault(SetReply(&server_, &rsp4));
|
||||
|
||||
HostResult result;
|
||||
ares_gethostbyname(channel_, "example.com.", AF_UNSPEC, HostCallback, &result);
|
||||
Process();
|
||||
EXPECT_TRUE(result.done_);
|
||||
std::stringstream ss;
|
||||
ss << result.host_;
|
||||
EXPECT_EQ("{'example.com' aliases=[] addrs=[1.2.3.4]}", ss.str());
|
||||
}
|
||||
|
||||
TEST_P(MockChannelTest, ExplicitIP) {
|
||||
HostResult result;
|
||||
ares_gethostbyname(channel_, "1.2.3.4", AF_INET, HostCallback, &result);
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "dns-proto.h"
|
||||
|
||||
namespace ares {
|
||||
|
||||
static void ShowFile(const char* filename) {
|
||||
int fd = open(filename, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
std::cerr << "Failed to open '" << filename << "'" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::vector<unsigned char> contents;
|
||||
while (true) {
|
||||
unsigned char buffer[1024];
|
||||
int len = read(fd, buffer, sizeof(buffer));
|
||||
if (len <= 0) break;
|
||||
contents.insert(contents.end(), buffer, buffer + len);
|
||||
}
|
||||
std::cout << PacketToString(contents) << std::endl;
|
||||
}
|
||||
|
||||
} // namespace ares
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
for (int ii = 1; ii < argc; ++ii) {
|
||||
ares::ShowFile(argv[ii]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,11 @@
|
|||
#! /bin/sh
|
||||
|
||||
# This file is in the public domain, so clarified as of
|
||||
# 2009-05-17 by Arthur David Olson.
|
||||
# Taken from the tz distribution.
|
||||
|
||||
# Tell groff not to emit SGR escape sequences (ANSI color escapes).
|
||||
GROFF_NO_SGR=1
|
||||
export GROFF_NO_SGR
|
||||
|
||||
# Tell groff to emit SGR escape sequences (ANSI color escapes).
|
||||
#GROFF_SGR=1
|
||||
#export GROFF_SGR
|
||||
|
||||
echo ".am TH
|
||||
.hy 0
|
||||
.na
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
#! /bin/sh
|
||||
|
||||
# This file is in the public domain, so clarified as of
|
||||
# 2009-05-17 by Arthur David Olson.
|
||||
|
||||
# Tell groff not to emit SGR escape sequences (ANSI color escapes).
|
||||
#GROFF_NO_SGR=1
|
||||
#export GROFF_NO_SGR
|
||||
# Taken from the tz distribution.
|
||||
|
||||
# Tell groff to emit SGR escape sequences (ANSI color escapes).
|
||||
GROFF_SGR=1
|
||||
|
|
Loading…
Reference in New Issue