mirror of https://github.com/getdnsapi/getdns.git
Merge branch 'develop' of github.com:verisign/getdns into develop
This commit is contained in:
commit
65b420b520
21
Makefile.in
21
Makefile.in
|
@ -20,9 +20,20 @@ default:
|
||||||
|
|
||||||
all : default
|
all : default
|
||||||
|
|
||||||
|
install: all
|
||||||
|
cd src && $(MAKE) $@
|
||||||
|
cd doc && $(MAKE) $@
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
cd src && $(MAKE) $@
|
||||||
|
cd doc && $(MAKE) $@
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
cd doc && $(MAKE) $@
|
cd doc && $(MAKE) $@
|
||||||
|
|
||||||
|
test:
|
||||||
|
cd src && $(MAKE) $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cd src && $(MAKE) $@
|
cd src && $(MAKE) $@
|
||||||
cd doc && $(MAKE) $@
|
cd doc && $(MAKE) $@
|
||||||
|
@ -44,21 +55,27 @@ $(distdir):
|
||||||
mkdir -p $(distdir)/src/getdns
|
mkdir -p $(distdir)/src/getdns
|
||||||
mkdir -p $(distdir)/src/test
|
mkdir -p $(distdir)/src/test
|
||||||
mkdir -p $(distdir)/src/example
|
mkdir -p $(distdir)/src/example
|
||||||
|
mkdir -p $(distdir)/doc
|
||||||
cp $(srcdir)/configure.ac $(distdir)
|
cp $(srcdir)/configure.ac $(distdir)
|
||||||
cp $(srcdir)/configure $(distdir)
|
cp $(srcdir)/configure $(distdir)
|
||||||
cp $(srcdir)/Makefile.in $(distdir)
|
cp $(srcdir)/Makefile.in $(distdir)
|
||||||
cp $(srcdir)/install-sh $(distdir)
|
cp $(srcdir)/install-sh $(distdir)
|
||||||
cp $(srcdir)/config.sub $(distdir)
|
cp $(srcdir)/config.sub $(distdir)
|
||||||
cp $(srcdir)/config.guess $(distdir)
|
cp $(srcdir)/config.guess $(distdir)
|
||||||
cp $(srcdir)/src/Makefile.in $(distdir)/src
|
cp $(srcdir)/ltmain.sh $(distdir)
|
||||||
|
cp $(srcdir)/src/*.in $(distdir)/src
|
||||||
cp $(srcdir)/src/*.[ch] $(distdir)/src
|
cp $(srcdir)/src/*.[ch] $(distdir)/src
|
||||||
cp $(srcdir)/src/getdns/*.in $(distdir)/src/getdns
|
cp $(srcdir)/src/getdns/*.in $(distdir)/src/getdns
|
||||||
cp $(srcdir)/src/getdns/*.h $(distdir)/src/getdns
|
cp $(srcdir)/src/getdns/*.h $(distdir)/src/getdns
|
||||||
cp $(srcdir)/src/test/Makefile.in $(distdir)/src/test
|
cp $(srcdir)/src/test/Makefile.in $(distdir)/src/test
|
||||||
cp $(srcdir)/src/test/*.[ch] $(distdir)/src/test
|
cp $(srcdir)/src/test/*.[ch] $(distdir)/src/test
|
||||||
|
cp $(srcdir)/src/test/*.sh $(distdir)/src/test
|
||||||
|
cp $(srcdir)/src/test/*.good $(distdir)/src/test
|
||||||
cp $(srcdir)/src/test/*.can $(distdir)/src/test
|
cp $(srcdir)/src/test/*.can $(distdir)/src/test
|
||||||
cp $(srcdir)/src/example/Makefile.in $(distdir)/src/example
|
cp $(srcdir)/src/example/Makefile.in $(distdir)/src/example
|
||||||
cp $(srcdir)/src/example/*.c $(distdir)/src/example
|
cp $(srcdir)/src/example/*.c $(distdir)/src/example
|
||||||
|
cp $(srcdir)/doc/Makefile.in $(distdir)/doc
|
||||||
|
cp $(srcdir)/doc/*.in $(distdir)/doc
|
||||||
|
|
||||||
distcheck: $(distdir).tar.gz
|
distcheck: $(distdir).tar.gz
|
||||||
gzip -cd $(distdir).tar.gz | tar xvf -
|
gzip -cd $(distdir).tar.gz | tar xvf -
|
||||||
|
@ -82,4 +99,4 @@ Makefile: Makefile.in config.status
|
||||||
configure.status: configure
|
configure.status: configure
|
||||||
./config.status --recheck
|
./config.status --recheck
|
||||||
|
|
||||||
.PHONY: all distclean clean default doc
|
.PHONY: all distclean clean default doc test
|
||||||
|
|
13
README.md
13
README.md
|
@ -49,18 +49,25 @@ External Dependencies
|
||||||
External dependencies are linked outside the getdns API build tree (we rely on configure to find them). We would like to keep the dependency tree short.
|
External dependencies are linked outside the getdns API build tree (we rely on configure to find them). We would like to keep the dependency tree short.
|
||||||
|
|
||||||
* [libevent](http://libevent.org) version 2.0.21 stable
|
* [libevent](http://libevent.org) version 2.0.21 stable
|
||||||
|
Sometimes called libevent2
|
||||||
* [libldns from NL](https://www.nlnetlabs.nl/projects/ldns/) version 1.6.16 (ldns may require openssl headers and libraries)
|
* [libldns from NL](https://www.nlnetlabs.nl/projects/ldns/) version 1.6.16 (ldns may require openssl headers and libraries)
|
||||||
* [libunbound from NL](http://www.nlnetlabs.nl/projects/unbound/) svn revision 3012, configure must be run with the --with-libevent option (recommended to also use --with-libunbound-only).
|
* [libunbound from NL](http://www.nlnetlabs.nl/projects/unbound/) svn revision 3012, configure must be run with the --with-libevent option (recommended to also use --with-libunbound-only).
|
||||||
|
* [libexpat](http://expat.sourceforge.net/) for libunbound.
|
||||||
* [libidn from the FSF](http://www.gnu.org/software/libidn/) version 1.
|
* [libidn from the FSF](http://www.gnu.org/software/libidn/) version 1.
|
||||||
* Doxygen is used to generate documentation, while this is not technically necessary for the build it makes things a lot more pleasant.
|
* Doxygen is used to generate documentation, while this is not technically necessary for the build it makes things a lot more pleasant.
|
||||||
|
|
||||||
Assuming that the getdns sources are in a diretory named getdns in your home directory, to build libunbound (note that the svn checkout may take a while):
|
You have to install the library and also the library-devel (or -dev) for your
|
||||||
|
package management system to install the compile time files. If you checked
|
||||||
|
out our git; the configure script is built with autoreconf --install.
|
||||||
|
|
||||||
|
Assuming that the getdns sources are in a diretory named getdns in your home directory, to build libunbound:
|
||||||
```
|
```
|
||||||
# mkdir unbound
|
# mkdir unbound
|
||||||
# cd unbound
|
# cd unbound
|
||||||
# svn checkout -r 3012 http://unbound.nlnetlabs.nl/svn
|
# svn export -r 3012 http://unbound.nlnetlabs.nl/svn/trunk
|
||||||
# cd svn/trunk
|
# cd trunk
|
||||||
# ./configure --with-libevent --with-libunbound-only
|
# ./configure --with-libevent --with-libunbound-only
|
||||||
|
### add --disable-gost --disable-ecdsa if elliptic curves are disabled for you.
|
||||||
# make
|
# make
|
||||||
# make install
|
# make install
|
||||||
```
|
```
|
||||||
|
|
102
configure.ac
102
configure.ac
|
@ -5,13 +5,16 @@
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
#
|
#
|
||||||
|
|
||||||
AC_PREREQ([2.68])
|
AC_PREREQ([2.56])
|
||||||
AC_INIT([getdns], [0.1.0], [melinda.shore@nomountain.net])
|
AC_INIT([getdns], [0.1.0], [melinda.shore@nomountain.net])
|
||||||
AC_CONFIG_SRCDIR([src/getdns/getdns.h])
|
AC_CONFIG_SRCDIR([src/getdns/getdns.h])
|
||||||
# AM_INIT_AUTOMAKE
|
# AM_INIT_AUTOMAKE
|
||||||
# LT_INIT
|
# LT_INIT
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_CPP
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
|
@ -21,13 +24,99 @@ case "$host_os" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_PROG_CC
|
# always use ./libtool unless override from commandline (libtool=mylibtool)
|
||||||
AC_PROG_CPP
|
if test -z "$libtool"; then
|
||||||
|
libtool="`pwd`/libtool"
|
||||||
|
fi
|
||||||
|
AC_SUBST(libtool)
|
||||||
|
AC_PROG_LIBTOOL
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
dnl Add option to disable the evil rpath. Check whether to use rpath or not.
|
||||||
|
dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool.
|
||||||
|
AC_DEFUN([ACX_ARG_RPATH],
|
||||||
|
[
|
||||||
|
AC_ARG_ENABLE(rpath,
|
||||||
|
[ --disable-rpath disable hardcoded rpath (default=enabled)],
|
||||||
|
enable_rpath=$enableval, enable_rpath=yes)
|
||||||
|
if test "x$enable_rpath" = xno; then
|
||||||
|
dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.])
|
||||||
|
AC_CONFIG_COMMANDS([disable-rpath], [
|
||||||
|
sed < libtool > libtool-2 \
|
||||||
|
's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/'
|
||||||
|
mv libtool-2 libtool
|
||||||
|
chmod 755 libtool
|
||||||
|
libtool="./libtool"
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
ACX_ARG_RPATH
|
||||||
|
|
||||||
|
# search to set include and library paths right
|
||||||
|
# find libidn
|
||||||
|
AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=pathname],
|
||||||
|
[path to libidn (default: search /usr/local ..)]),
|
||||||
|
[], [withval="yes"])
|
||||||
|
if test x_$withval = x_yes; then
|
||||||
|
for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
|
||||||
|
if test -f "$dir/include/idna.h"; then
|
||||||
|
CFLAGS="$CFLAGS -I$dir/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$dir/lib"
|
||||||
|
AC_MSG_NOTICE([Found libidn in $dir])
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if test x_$withval != x_no; then
|
||||||
|
CFLAGS="$CFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# find libldns
|
||||||
|
AC_ARG_WITH(libldns, AC_HELP_STRING([--with-libldns=pathname],
|
||||||
|
[path to libldns (default: search /usr/local ..)]),
|
||||||
|
[], [withval="yes"])
|
||||||
|
if test x_$withval = x_yes; then
|
||||||
|
for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
|
||||||
|
if test -f "$dir/include/ldns/ldns.h"; then
|
||||||
|
CFLAGS="$CFLAGS -I$dir/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$dir/lib"
|
||||||
|
AC_MSG_NOTICE([Found libldns in $dir])
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if test x_$withval != x_no; then
|
||||||
|
CFLAGS="$CFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# find libunbound
|
||||||
|
AC_ARG_WITH(libunbound, AC_HELP_STRING([--with-libunbound=pathname],
|
||||||
|
[path to libunbound (default: search /usr/local ..)]),
|
||||||
|
[], [withval="yes"])
|
||||||
|
if test x_$withval = x_yes; then
|
||||||
|
for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
|
||||||
|
if test -f "$dir/include/unbound.h"; then
|
||||||
|
CFLAGS="$CFLAGS -I$dir/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$dir/lib"
|
||||||
|
AC_MSG_NOTICE([Found libunbound in $dir])
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if test x_$withval != x_no; then
|
||||||
|
CFLAGS="$CFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
found_all_libs=1
|
found_all_libs=1
|
||||||
AC_MSG_NOTICE([Checking for dependencies libevent, ldns])
|
AC_MSG_NOTICE([Checking for dependencies libevent, ldns])
|
||||||
AC_CHECK_LIB([event_core], [event_base_new], [], [found_all_libs=0])
|
AC_SEARCH_LIBS([event_base_new], [event_core event], [], [found_all_libs=0])
|
||||||
AC_CHECK_LIB([ldns], [ldns_dname_new_frm_str], [], [found_all_libs=0])
|
AC_CHECK_LIB([ldns], [ldns_dname_new_frm_str], [], [found_all_libs=0])
|
||||||
AC_CHECK_LIB([idn], [idna_to_ascii_8z], [], [found_all_libs=0])
|
AC_CHECK_LIB([idn], [idna_to_ascii_8z], [], [found_all_libs=0])
|
||||||
|
|
||||||
|
@ -52,7 +141,7 @@ if test -z "$DOXYGEN";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([inttypes.h netinet/in.h stdint.h stdlib.h string.h])
|
AC_CHECK_HEADERS([inttypes.h netinet/in.h stdint.h stdlib.h string.h event2/event.h])
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_HEADER_STDBOOL
|
AC_HEADER_STDBOOL
|
||||||
|
@ -66,6 +155,5 @@ AC_CONFIG_FILES([Makefile src/Makefile src/getdns/Makefile src/example/Makefile
|
||||||
if [ test -n "$DOXYGEN" ]
|
if [ test -n "$DOXYGEN" ]
|
||||||
then AC_CONFIG_FILES([src/Doxyfile])
|
then AC_CONFIG_FILES([src/Doxyfile])
|
||||||
fi
|
fi
|
||||||
|
AC_CONFIG_HEADER([src/config.h])
|
||||||
AC_CONFIG_SUBDIRS([src/ src/getdns/ src/example/ src/test/ doc/])
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
|
@ -10,21 +10,42 @@ distdir = $(tarname)-$(version)
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
|
# datarootdir is here to please some checkers
|
||||||
|
datarootdir=@datarootdir@
|
||||||
|
mandir = @mandir@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
|
||||||
DOCDIRS = html latex man
|
DOCDIRS = html latex man
|
||||||
|
MANPAGES = libgetdns.3 getdns_address.3
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
all: doc
|
all: doc
|
||||||
|
|
||||||
doc:
|
doc: $(MANPAGES)
|
||||||
cd ../src && doxygen
|
cd ../src && doxygen
|
||||||
|
|
||||||
|
libgetdns.3: libgetdns.3.in
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
|
getdns_address.3: getdns_address.3.in
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
|
install: $(MANPAGES)
|
||||||
|
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)
|
||||||
|
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3
|
||||||
|
$(INSTALL) -m 644 libgetdns.3 $(DESTDIR)$(mandir)/man3
|
||||||
|
$(INSTALL) -m 644 getdns_address.3 $(DESTDIR)$(mandir)/man3
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(mandir)/man3/libgetdns.3
|
||||||
|
rm -f $(DESTDIR)$(mandir)/man3/getdns_address.3
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(DOCDIRS)
|
rm -rf $(DOCDIRS) $(MANPAGES)
|
||||||
|
|
||||||
distclean : clean
|
distclean : clean
|
||||||
rm -f Makefile config.status config.log
|
rm -f Makefile config.status config.log
|
||||||
|
|
|
@ -7,37 +7,71 @@ version = @PACKAGE_VERSION@
|
||||||
tarname = @PACKAGE_TARNAME@
|
tarname = @PACKAGE_TARNAME@
|
||||||
distdir = $(tarname)-$(version)
|
distdir = $(tarname)-$(version)
|
||||||
|
|
||||||
|
# current:revision:age
|
||||||
|
# (binary-api-number):(which-binary-api-version):(how-many-nrs-backwardscompat)
|
||||||
|
# if api unchanged: no changes
|
||||||
|
# if api broken: current++ ; revision = 0; age = 0
|
||||||
|
# if programs compiled against existing library work and link with new
|
||||||
|
# version of library with new binary api: revision++; age++
|
||||||
|
libversion = 0:0:0
|
||||||
|
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
|
libdir = @libdir@
|
||||||
|
includedir = @includedir@
|
||||||
|
# datarootdir is here to please some checkers
|
||||||
|
datarootdir=@datarootdir@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
LIBTOOL = @libtool@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=@CFLAGS@ -Wall -g -fPIC -I$(srcdir)/ -I/usr/local/include -std=c99
|
CFLAGS=@CFLAGS@ -Wall -fPIC -I$(srcdir)/ -I/usr/local/include -std=c99
|
||||||
LDFLAGS=@LDFLAGS@ -levent_core -lldns -lunbound -lidn
|
LDFLAGS=@LDFLAGS@ @LIBS@
|
||||||
# PROGRAMS=example-simple-answers example-tree example-all-functions example-synchronous
|
GETDNS_OBJ=sync.lo context.lo list.lo dict.lo convert.lo general.lo \
|
||||||
|
hostname.lo service.lo request-internal.lo validate_dnssec.lo \
|
||||||
|
util-internal.lo getdns_error.lo
|
||||||
|
|
||||||
.SUFFIXES: .c .o .a .lo .h
|
.SUFFIXES: .c .o .a .lo .h
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
.c.lo:
|
||||||
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
all: libgetdns.so
|
all: libgetdns.la
|
||||||
cd test && $(MAKE) $@
|
cd test && $(MAKE) $@
|
||||||
cd example && $(MAKE) $@
|
cd example && $(MAKE) $@
|
||||||
|
|
||||||
libgetdns.so: sync.o context.o list.o dict.o convert.o general.o hostname.o service.o request-internal.o \
|
install: libgetdns.la
|
||||||
validate_dnssec.o util-internal.o getdns_error.o
|
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
|
||||||
$(CC) $(CFLAGS) -shared -o $@ $? $(LDFLAGS)
|
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)/getdns
|
||||||
|
$(INSTALL) -m 644 $(srcdir)/getdns/getdns.h $(DESTDIR)$(includedir)/getdns/getdns.h
|
||||||
|
$(INSTALL) -m 755 -d $(DESTDIR)$(libdir)
|
||||||
|
$(LIBTOOL) --mode=install cp libgetdns.la $(DESTDIR)$(libdir)
|
||||||
|
$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(includedir)/getdns/getdns.h
|
||||||
|
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libgetdns.la
|
||||||
|
|
||||||
|
libgetdns.la: $(GETDNS_OBJ)
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ $(GETDNS_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined
|
||||||
|
|
||||||
|
test: libgetdns.la
|
||||||
|
cd test && $(MAKE) $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cd test && $(MAKE) $@
|
cd test && $(MAKE) $@
|
||||||
cd example && $(MAKE) $@
|
cd example && $(MAKE) $@
|
||||||
rm -f *.o $(PROGRAMS) libgetdns.so
|
rm -f *.o *.lo $(PROGRAMS) libgetdns.la
|
||||||
|
rm -rf .libs
|
||||||
|
|
||||||
distclean : clean
|
distclean : clean
|
||||||
cd test && $(MAKE) $@
|
cd test && $(MAKE) $@
|
||||||
|
@ -74,4 +108,4 @@ Makefile: Makefile.in ../config.status
|
||||||
configure.status: configure
|
configure.status: configure
|
||||||
cd .. && ./config.status --recheck
|
cd .. && ./config.status --recheck
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean test
|
||||||
|
|
|
@ -28,9 +28,13 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_EVENT2_EVENT_H
|
||||||
|
# include <event2/event.h>
|
||||||
|
#else
|
||||||
|
# include <event.h>
|
||||||
|
#endif
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include <event2/event.h>
|
|
||||||
#include <ldns/ldns.h>
|
#include <ldns/ldns.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -10,14 +10,15 @@ distdir = $(tarname)-$(version)
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
|
LIBTOOL = @libtool@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=@CFLAGS@ -Wall -g -fPIC -I$(srcdir)/ -I$(srcdir)/../ -I/usr/local/include -std=c99
|
CFLAGS=@CFLAGS@ -Wall -g -fPIC -I$(srcdir)/ -I$(srcdir)/../ -I/usr/local/include -std=c99
|
||||||
LDFLAGS=@LDFLAGS@ -L. -L$(srcdir)/.. -L/usr/local/lib
|
LDFLAGS=@LDFLAGS@ -L. -L.. -L/usr/local/lib
|
||||||
LDLIBS=-lgetdns -lldns -levent_core -lunbound
|
LDLIBS=-lgetdns @LIBS@
|
||||||
PROGRAMS=example_simple_answers example_tree example_all_functions example_synchronous
|
PROGRAMS=example_simple_answers example_tree example_all_functions example_synchronous
|
||||||
|
|
||||||
.SUFFIXES: .c .o .a .lo .h
|
.SUFFIXES: .c .o .a .lo .h
|
||||||
|
@ -29,8 +30,21 @@ default: all
|
||||||
|
|
||||||
all: $(PROGRAMS)
|
all: $(PROGRAMS)
|
||||||
|
|
||||||
|
example_simple_answers: example_simple_answers.o
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example_simple_answers.o
|
||||||
|
|
||||||
|
example_tree: example_tree.o
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example_tree.o
|
||||||
|
|
||||||
|
example_all_functions: example_all_functions.o
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example_all_functions.o
|
||||||
|
|
||||||
|
example_synchronous: example_synchronous.o
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example_synchronous.o
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(PROGRAMS)
|
rm -f *.o $(PROGRAMS)
|
||||||
|
rm -rf .libs
|
||||||
|
|
||||||
distclean : clean
|
distclean : clean
|
||||||
rm -f Makefile config.status config.log
|
rm -f Makefile config.status config.log
|
||||||
|
|
|
@ -26,13 +26,18 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <getdns/getdns.h>
|
#include <getdns/getdns.h>
|
||||||
#include <event2/event.h>
|
#ifdef HAVE_EVENT2_EVENT_H
|
||||||
|
# include <event2/event.h>
|
||||||
|
#else
|
||||||
|
# include <event.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define UNUSED_PARAM(x) ((void)(x))
|
#define UNUSED_PARAM(x) ((void)(x))
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
|
#include "../config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <getdns/getdns.h>
|
#include <getdns/getdns.h>
|
||||||
#include <event2/event.h>
|
#ifdef HAVE_EVENT2_EVENT_H
|
||||||
|
# include <event2/event.h>
|
||||||
|
#else
|
||||||
|
# include <event.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define UNUSED_PARAM(x) ((void)(x))
|
#define UNUSED_PARAM(x) ((void)(x))
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,18 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_EVENT2_EVENT_H
|
||||||
|
# include <event2/event.h>
|
||||||
|
#else
|
||||||
|
# include <event.h>
|
||||||
|
# define evutil_socket_t int
|
||||||
|
# define event_free free
|
||||||
|
# define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unbound.h>
|
#include <unbound.h>
|
||||||
#include <unbound-event.h>
|
#include <unbound-event.h>
|
||||||
#include <event2/event.h>
|
|
||||||
#include <ldns/ldns.h>
|
#include <ldns/ldns.h>
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "types-internal.h"
|
#include "types-internal.h"
|
||||||
|
@ -67,6 +75,18 @@ typedef struct netreq_cb_data
|
||||||
char *bogus;
|
char *bogus;
|
||||||
} netreq_cb_data;
|
} netreq_cb_data;
|
||||||
|
|
||||||
|
#ifndef HAVE_EVENT2_EVENT_H
|
||||||
|
static struct event *
|
||||||
|
event_new(struct event_base *b, evutil_socket_t fd, short ev, void* cb, void *arg)
|
||||||
|
{
|
||||||
|
struct event* e = (struct event*)calloc(1, sizeof(struct event));
|
||||||
|
if(!e) return NULL;
|
||||||
|
event_set(e, fd, ev, cb, arg);
|
||||||
|
event_base_set(b, e);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
#endif /* no event2 */
|
||||||
|
|
||||||
/* cancel, cleanup and send timeout to callback */
|
/* cancel, cleanup and send timeout to callback */
|
||||||
static void
|
static void
|
||||||
ub_resolve_timeout(evutil_socket_t fd, short what, void *arg)
|
ub_resolve_timeout(evutil_socket_t fd, short what, void *arg)
|
||||||
|
|
|
@ -33,10 +33,16 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_EVENT2_EVENT_H
|
||||||
|
# include <event2/event.h>
|
||||||
|
#else
|
||||||
|
# include <event.h>
|
||||||
|
# define event_free free
|
||||||
|
#endif
|
||||||
#include "types-internal.h"
|
#include "types-internal.h"
|
||||||
#include "util-internal.h"
|
#include "util-internal.h"
|
||||||
#include <unbound.h>
|
#include <unbound.h>
|
||||||
#include <event2/event.h>
|
|
||||||
|
|
||||||
/* useful macros */
|
/* useful macros */
|
||||||
#define gd_malloc(sz) context->malloc(sz)
|
#define gd_malloc(sz) context->malloc(sz)
|
||||||
|
|
|
@ -33,8 +33,13 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_EVENT2_EVENT_H
|
||||||
|
# include <event2/event.h>
|
||||||
|
#else
|
||||||
|
# include <event.h>
|
||||||
|
#endif
|
||||||
#include <getdns/getdns.h>
|
#include <getdns/getdns.h>
|
||||||
#include <event2/event.h>
|
|
||||||
#include <unbound-event.h>
|
#include <unbound-event.h>
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
|
@ -10,14 +10,15 @@ distdir = $(tarname)-$(version)
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
|
LIBTOOL = @libtool@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=@CFLAGS@ -Wall -g -fPIC -I$(srcdir)/ -I$(srcdir)/../ -I/usr/local/include -std=c99 $(cflags)
|
CFLAGS=@CFLAGS@ -Wall -g -fPIC -I$(srcdir)/ -I$(srcdir)/../ -I/usr/local/include -std=c99 $(cflags)
|
||||||
LDFLAGS=@LDFLAGS@ -L. -L$(srcdir)/.. -L/usr/local/lib
|
LDFLAGS=@LDFLAGS@ -L. -L.. -L/usr/local/lib
|
||||||
LDLIBS=-lgetdns -lldns -levent_core -lunbound
|
LDLIBS=-lgetdns @LIBS@
|
||||||
PROGRAMS=tests_dict tests_list tests_stub_async tests_stub_sync
|
PROGRAMS=tests_dict tests_list tests_stub_async tests_stub_sync
|
||||||
|
|
||||||
.SUFFIXES: .c .o .a .lo .h
|
.SUFFIXES: .c .o .a .lo .h
|
||||||
|
@ -30,15 +31,24 @@ default: all
|
||||||
all: $(PROGRAMS)
|
all: $(PROGRAMS)
|
||||||
|
|
||||||
tests_dict: tests_dict.o testmessages.o
|
tests_dict: tests_dict.o testmessages.o
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_dict.o testmessages.o
|
||||||
|
|
||||||
tests_list: tests_list.o testmessages.o
|
tests_list: tests_list.o testmessages.o
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_list.o testmessages.o
|
||||||
|
|
||||||
tests_stub_async: tests_stub_async.o testmessages.o
|
tests_stub_async: tests_stub_async.o testmessages.o
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_async.o testmessages.o
|
||||||
|
|
||||||
tests_stub_sync: tests_stub_sync.o
|
tests_stub_sync: tests_stub_sync.o
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.o
|
||||||
|
|
||||||
|
test: all
|
||||||
|
./testscript.sh
|
||||||
|
@echo "All tests OK"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(PROGRAMS)
|
rm -f *.o $(PROGRAMS)
|
||||||
|
rm -rf .libs
|
||||||
|
|
||||||
distclean : clean
|
distclean : clean
|
||||||
rm -f Makefile config.status config.log
|
rm -f Makefile config.status config.log
|
||||||
|
@ -73,4 +83,4 @@ Makefile: Makefile.in ../../config.status
|
||||||
configure.status: configure
|
configure.status: configure
|
||||||
cd ../.. && ./config.status --recheck
|
cd ../.. && ./config.status --recheck
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean test
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
TESTPROG tests_dict START
|
||||||
|
TESTCASE tests_dict:tst_create BEGIN
|
||||||
|
tests_dict:tst_create: getdns_dict_create
|
||||||
|
tests_dict:tst_create: getdns_dict_destroy(dict)
|
||||||
|
tests_dict:tst_create: getdns_dict_destroy(NULL)
|
||||||
|
TESTCASE tests_dict:tst_create END
|
||||||
|
TESTCASE tests_dict:tst_bindatasetget BEGIN
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_get_bindata() empty dict
|
||||||
|
tests_dict:tst_bindatasetget: line 63: getdns_dict_get_bindata(NULL, key, &ans_bdata),retval = 305
|
||||||
|
tests_dict:tst_bindatasetget: line 69: getdns_dict_get_bindata(dict, key, NULL),retval = 305
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_get_bindata(dict, NULL, &ans_bindata)
|
||||||
|
tests_dict:tst_bindatasetget: line 74: getdns_dict_get_bindata,retval = 305
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_get_bindata(dict, key, &ans_bdata)
|
||||||
|
tests_dict:tst_bindatasetget: line 80: getdns_list_get_bindata,retval = 306
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_set_bindata(dict, key, bindata)
|
||||||
|
tests_dict:tst_bindatasetget: line 101: getdns_dict_set_bindata,retval=0,key=foo
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_get_bindata(dict, key, &ans_bdata)
|
||||||
|
tests_dict:tst_bindatasetget: line 108: getdns_dict_get_bindata,retval=0,key=foo,data=foobar
|
||||||
|
TESTCASE tests_dict:tst_bindatasetget END
|
||||||
|
TESTCASE tests_dict:tst_dictsetget BEGIN
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_get_dict() empty dict
|
||||||
|
tests_dict:tst_dictsetget: line 148: getdns_dict_get_dict(NULL, key, &ansdict),retval = 305
|
||||||
|
tests_dict:tst_dictsetget: line 154: getdns_dict_get_dict(dict, key, NULL),retval = 305
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_get_dict(dict, NULL, &ansdict)
|
||||||
|
tests_dict:tst_dictsetget: line 159: getdns_dict_get_dict,retval = 305
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_get_dict(dict, key, &ansdict)
|
||||||
|
tests_dict:tst_dictsetget: line 165: getdns_list_get_dict,retval = 305
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_set_dict(dict, key, newdict)
|
||||||
|
tests_dict:tst_dictsetget: line 185: getdns_dict_set_dict,retval=0,key=foo
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_get_dict(dict, key, &ansdict)
|
||||||
|
tests_dict:tst_dictsetget: line 195: getdns_dict_get_dict,retval=0,key=foo,int1=42,int2=52
|
||||||
|
TESTCASE tests_dict:tst_dictsetget END
|
||||||
|
TESTCASE tests_dict:tst_intsetget BEGIN
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int() empty dict
|
||||||
|
tests_dict:tst_intsetget: line 410: getdns_dict_get_int(NULL, key, &ans_int),retval = 305
|
||||||
|
tests_dict:tst_intsetget: line 416: getdns_dict_get_int(dict, key, NULL),retval = 305
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int(dict, NULL, &ans_int)
|
||||||
|
tests_dict:tst_intsetget: line 421: getdns_dict_get_int,retval = 305
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int(dict, key, &ans_int)
|
||||||
|
tests_dict:tst_intsetget: line 427: getdns_list_get_int,retval = 306
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_set_int(dict, key, newint)
|
||||||
|
tests_dict:tst_intsetget: line 445: getdns_dict_set_int,retval=0,key=foo,int=42
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int(dict, key, &ans_int)
|
||||||
|
tests_dict:tst_intsetget: line 451: getdns_dict_get_int,retval=0,key=foo,int=42
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_set_int(dict, key, newint)
|
||||||
|
tests_dict:tst_intsetget: line 459: getdns_dict_set_int,retval=0,key=bar,int=52
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int(dict, key, &ans_int)
|
||||||
|
tests_dict:tst_intsetget: line 465: getdns_dict_get_int,retval=0,key=bar,int=52
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_data_type(dict, key, &dtype)
|
||||||
|
tests_dict:tst_intsetget: line 472: getdns_dict_get_data_type,retval=0,key=bar,dtype=2
|
||||||
|
TESTCASE tests_dict:tst_intsetget END
|
||||||
|
TESTCASE tests_dict:tst_listsetget BEGIN
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_get_list() empty dict
|
||||||
|
tests_dict:tst_listsetget: line 324: getdns_dict_get_list(NULL, key, &anslist),retval = 305
|
||||||
|
tests_dict:tst_listsetget: line 330: getdns_dict_get_list(dict, key, NULL),retval = 305
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_get_list(dict, NULL, &anslist)
|
||||||
|
tests_dict:tst_listsetget: line 335: getdns_dict_get_list,retval = 305
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_get_list(dict, key, &anslist)
|
||||||
|
tests_dict:tst_listsetget: line 341: getdns_list_get_list,retval = 306
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_set_list(dict, key, newlist)
|
||||||
|
tests_dict:tst_listsetget: line 363: getdns_dict_set_list,retval=0,key=foo
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_get_list(dict, key, &anslist)
|
||||||
|
tests_dict:tst_listsetget: line 373: getdns_dict_get_list,retval=0,key=foo,int1=42,int2=52
|
||||||
|
TESTCASE tests_dict:tst_listsetget END
|
||||||
|
TESTCASE tests_dict:tst_getnames BEGIN
|
||||||
|
tests_dict:tst_getnames: getdns_dict_get_names(NULL, &list)
|
||||||
|
tests_dict:tst_getnames: getdns_dict_get_names(dict, NULL)
|
||||||
|
tests_dict:tst_getnames: getdns_dict_get_names(dict, &list), empty dictionary
|
||||||
|
list item 0: NOTIMPLEMENTED list item 1: NOTIMPLEMENTED list item 2: NOTIMPLEMENTED list item 3: NOTIMPLEMENTEDTESTCASE tests_dict:tst_getnames END
|
||||||
|
TESTCASE tests_dict:tst_copy BEGIN
|
||||||
|
tests_dict:tst_copy: empty list cases
|
||||||
|
tests_dict:tst_copy: dict1 populate
|
||||||
|
{
|
||||||
|
"bar": 52,
|
||||||
|
"foo": 42,
|
||||||
|
"quz": 62
|
||||||
|
}
|
||||||
|
tests_dict:tst_copy: getdns_dict_copy(dict1, &dict2)
|
||||||
|
{
|
||||||
|
"bar": 52,
|
||||||
|
"foo": 42,
|
||||||
|
"quz": 62
|
||||||
|
}
|
||||||
|
TESTCASE tests_dict:tst_copy END
|
||||||
|
TESTPROG tests_dict END
|
|
@ -0,0 +1,78 @@
|
||||||
|
TESTPROG tests_list START
|
||||||
|
TESTCASE tests_list:tst_create BEGIN
|
||||||
|
tests_list:tst_create: getdns_list_create
|
||||||
|
tests_list:tst_create: getdns_list_destroy(list)
|
||||||
|
tests_list:tst_create: getdns_list_destroy(NULL)
|
||||||
|
tests_list:tst_create: getdns_add_item(list) past block size
|
||||||
|
tests_list:tst_create: getdns_list_get_length(list)
|
||||||
|
tests_list:tst_create: list length = 12
|
||||||
|
tests_list:tst_create: getdns_list_get_length()
|
||||||
|
tests_list:tst_create: NUll, 12, retval = 304
|
||||||
|
tests_list:tst_create: NUll, NULL, retval = 304
|
||||||
|
tests_list:tst_create: list, NULL, retval = 304
|
||||||
|
TESTCASE tests_list:tst_create END
|
||||||
|
TESTCASE tests_list:tst_bindatasetget BEGIN
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata() empty list
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata(NULL, index, &ans_bindata),retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata(list, index, NULL),retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata(list, 0, &ans_bindata)
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata,retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata(list, 1, &ans_bindata)
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata,retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata() empty list
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata(NULL, index, ans_bindata),retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata(list, 0, ans_bindata)
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata,retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata(list, 1, ans_bindata)
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata,retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set/get_bindata,retval = 0, bindata->data = 7,foobar
|
||||||
|
TESTCASE tests_list:tst_bindatasetget END
|
||||||
|
TESTCASE tests_list:tst_dictsetget BEGIN
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict() empty list
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict(NULL, index, &dict),retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict(list, index, NULL),retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict(list, 0, &dict)
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict,retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict(list, 1, &dict)
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict,retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict() empty list
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict(NULL, index, dict),retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict(list, 0, dict)
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict,retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict(list, 1, dict)
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict,retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set/get_dict,retval=0, ans=42
|
||||||
|
TESTCASE tests_list:tst_dictsetget END
|
||||||
|
TESTCASE tests_list:tst_intsetget BEGIN
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int() empty list
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int(NULL, index, &ans_int),retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int(list, index, NULL),retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int(list, 0, &ans_int)
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int,retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int(list, 1, &ans_int)
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int,retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int() empty list
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int(NULL, index, ans_int),retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int(list, 0, ans_int)
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int,retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int(list, 1, ans_int)
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int,retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_set/get_int,retval = 0, ans = 42
|
||||||
|
TESTCASE tests_list:tst_intsetget END
|
||||||
|
TESTCASE tests_list:tst_listsetget BEGIN
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list() empty list
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list(NULL, index, &ans_list),retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list(list, index, NULL),retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list(list, 0, &ans_list)
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list,retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list(list, 1, &ans_list)
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list,retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list() empty list
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list(NULL, index, ans_list),retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list(list, 0, ans_list)
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list,retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list(list, 1, ans_list)
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list,retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_set/get_list,retval = 0, ans[0] = 42
|
||||||
|
TESTCASE tests_list:tst_listsetget END
|
||||||
|
TESTPROG tests_list END
|
|
@ -26,12 +26,17 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_EVENT2_EVENT_H
|
||||||
|
# include <event2/event.h>
|
||||||
|
#else
|
||||||
|
# include <event.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "testmessages.h"
|
#include "testmessages.h"
|
||||||
#include <getdns/getdns.h>
|
#include <getdns/getdns.h>
|
||||||
#include <event2/event.h>
|
|
||||||
|
|
||||||
/* Set up the callback function, which will also do the processing of the results */
|
/* Set up the callback function, which will also do the processing of the results */
|
||||||
void
|
void
|
||||||
|
@ -42,7 +47,7 @@ this_callbackfn(struct getdns_context_t *this_context,
|
||||||
{
|
{
|
||||||
if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
|
if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
|
||||||
char *res = getdns_pretty_print_dict(this_response);
|
char *res = getdns_pretty_print_dict(this_response);
|
||||||
fprintf(stdout, "%s", res);
|
fprintf(stdout, "%s\n", res);
|
||||||
getdns_dict_destroy(this_response);
|
getdns_dict_destroy(this_response);
|
||||||
free(res);
|
free(res);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
"answer_type": 800,
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"just_address_answers":
|
||||||
|
[
|
||||||
|
<bindata of 0x4a7de413>,
|
||||||
|
<bindata of 0x4a7de412>,
|
||||||
|
<bindata of 0x4a7de410>
|
||||||
|
],
|
||||||
|
"replies_full":
|
||||||
|
[
|
||||||
|
<bindata of 0x00008180000100050000000103777777...>
|
||||||
|
],
|
||||||
|
"replies_tree":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"additional": [],
|
||||||
|
"answer":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de413>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de413>
|
||||||
|
},
|
||||||
|
"ttl": 300,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de412>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de412>
|
||||||
|
},
|
||||||
|
"ttl": 300,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de410>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de410>
|
||||||
|
},
|
||||||
|
"ttl": 300,
|
||||||
|
"type": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"answer_type": 800,
|
||||||
|
"authority": [],
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"header":
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"opcode": 0,
|
||||||
|
"qr": 1
|
||||||
|
},
|
||||||
|
"question":
|
||||||
|
{
|
||||||
|
"qclass": 1,
|
||||||
|
"qname": <bindata for "www.google.com.">,
|
||||||
|
"qtype": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": 900
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
The packet {
|
||||||
|
"answer_type": 800,
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"just_address_answers":
|
||||||
|
[
|
||||||
|
<bindata of 0x4a7de473>,
|
||||||
|
<bindata of 0x4a7de470>,
|
||||||
|
<bindata of 0x4a7de474>
|
||||||
|
],
|
||||||
|
"replies_full":
|
||||||
|
[
|
||||||
|
<bindata of 0x00008180000100050000000103777777...>
|
||||||
|
],
|
||||||
|
"replies_tree":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"additional": [],
|
||||||
|
"answer":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de473>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de473>
|
||||||
|
},
|
||||||
|
"ttl": 264,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de470>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de470>
|
||||||
|
},
|
||||||
|
"ttl": 264,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de474>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de474>
|
||||||
|
},
|
||||||
|
"ttl": 264,
|
||||||
|
"type": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"answer_type": 800,
|
||||||
|
"authority": [],
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"header":
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"opcode": 0,
|
||||||
|
"qr": 1
|
||||||
|
},
|
||||||
|
"question":
|
||||||
|
{
|
||||||
|
"qclass": 1,
|
||||||
|
"qname": <bindata for "www.google.com.">,
|
||||||
|
"qtype": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": 900
|
||||||
|
}
|
||||||
|
The packet {
|
||||||
|
"answer_type": 800,
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"just_address_answers": [],
|
||||||
|
"replies_full":
|
||||||
|
[
|
||||||
|
<bindata of 0x00008180000100000001000103777777...>
|
||||||
|
],
|
||||||
|
"replies_tree":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"additional": [],
|
||||||
|
"answer": [],
|
||||||
|
"answer_type": 800,
|
||||||
|
"authority":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"rdata_raw": <bindata of 0x036e733106676f6f676c6503636f6d00>
|
||||||
|
},
|
||||||
|
"ttl": 40,
|
||||||
|
"type": 6
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"header":
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"opcode": 0,
|
||||||
|
"qr": 1
|
||||||
|
},
|
||||||
|
"question":
|
||||||
|
{
|
||||||
|
"qclass": 1,
|
||||||
|
"qname": <bindata for "www.google.com.">,
|
||||||
|
"qtype": 33
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": 900
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# run $1 > $2 and exit on failure to execute
|
||||||
|
runit () {
|
||||||
|
echo -n "Test $1:"
|
||||||
|
./$1 > $2
|
||||||
|
if test $? -ne 0; then
|
||||||
|
echo " failed (execution failed)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# check output files $1 and $2, exit on failure
|
||||||
|
diffit () {
|
||||||
|
if diff $1 $2; then
|
||||||
|
echo " OK"
|
||||||
|
else
|
||||||
|
echo " failed (differences above)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# check output of program $1, known_good must be in $1.good
|
||||||
|
checkoutput () {
|
||||||
|
runit $1 output
|
||||||
|
diffit output $1.good
|
||||||
|
}
|
||||||
|
|
||||||
|
# filter out TTL and bindata stuff from $1 to $2
|
||||||
|
filterout () {
|
||||||
|
sed -e '/"ttl"/d' -e '/"ipv4_address"/d' -e '/"ipv6_address"/d' -e '/"rdata_raw"/d' -e '/<bindata/d' <$1 >$2
|
||||||
|
}
|
||||||
|
|
||||||
|
# like checkoutput but removes addresses and TTLs and bindata
|
||||||
|
# this makes the test almost useless, but it tests runtime lookup
|
||||||
|
# and the structure of the answer format, against the live internet.
|
||||||
|
checkpacket () {
|
||||||
|
runit $1 output
|
||||||
|
cp $1.good output.good
|
||||||
|
filterout output output2
|
||||||
|
filterout output.good output2.good
|
||||||
|
diffit output2 output2.good
|
||||||
|
}
|
||||||
|
|
||||||
|
checkoutput tests_dict
|
||||||
|
checkoutput tests_list
|
||||||
|
checkpacket tests_stub_async
|
||||||
|
checkpacket tests_stub_sync
|
||||||
|
|
||||||
|
rm -f output output.good output2 output2.good
|
||||||
|
exit 0
|
Loading…
Reference in New Issue