From bf2e08e2df2f6dd07df8e163abb710f0b2672c78 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 27 Sep 2017 12:45:13 +0200 Subject: [PATCH] Move yaml config handling to Stubby --- Makefile.in | 4 +- configure.ac | 185 ++++++----- spec/example/Makefile.in | 24 +- src/Makefile.in | 322 +------------------ src/convert.c | 8 +- src/getdns/getdns_extra.h.in | 22 -- src/mk-symfiles.sh | 1 + src/test/Makefile.in | 71 ++--- src/tools/Makefile.in | 7 +- src/tools/getdns_query.c | 4 + src/yaml/convert_yaml_to_json.c | 550 -------------------------------- src/yaml/convert_yaml_to_json.h | 51 --- stubby | 2 +- 13 files changed, 163 insertions(+), 1088 deletions(-) delete mode 100644 src/yaml/convert_yaml_to_json.c delete mode 100644 src/yaml/convert_yaml_to_json.h diff --git a/Makefile.in b/Makefile.in index 7313454a..dfb1899b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -210,6 +210,7 @@ $(distdir): mkdir -p $(distdir)/spec/example mkdir -p $(distdir)/stubby mkdir -p $(distdir)/stubby/src + mkdir -p $(distdir)/stubby/src/yaml cp $(srcdir)/configure.ac $(distdir) cp $(srcdir)/configure $(distdir) cp $(srcdir)/AUTHORS $(distdir) @@ -254,7 +255,8 @@ $(distdir): cp $(srcdir)/src/tools/*.[ch] $(distdir)/src/tools cp $(srcdir)/stubby/stubby.yml.example $(distdir)/stubby cp $(srcdir)/stubby/stubby-setdns-macos.sh $(distdir)/stubby - cp $(srcdir)/stubby/src/stubby.c $(distdir)/stubby/src + cp $(srcdir)/stubby/src/*.[ch] $(distdir)/stubby/src + cp $(srcdir)/stubby/yaml/*.[ch] $(distdir)/stubby/src/yaml cp $(srcdir)/stubby/COPYING $(distdir)/stubby cp $(srcdir)/stubby/README.md $(distdir)/stubby cp $(srcdir)/src/jsmn/*.[ch] $(distdir)/src/jsmn diff --git a/configure.ac b/configure.ac index 11ac5e06..3fe7b5fe 100644 --- a/configure.ac +++ b/configure.ac @@ -322,6 +322,34 @@ AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])]) AC_CHECK_HEADERS([windows.h winsock.h stdio.h winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) ACX_CHECK_GETADDRINFO_WITH_INCLUDES +AC_ARG_WITH(fd-setsize, AS_HELP_STRING([--with-fd-setsize=size], + [Set maximum file descriptor number that can be used by select]), + [], [withval="no"]) +case "$withval" in +no) + ;; +*) + AC_DEFINE_UNQUOTED([FD_SETSIZE], [$withval], [Alternate value for the FD_SETSIZE]) + my_enable_unbound_event_api=1 + ;; +esac + +#---- check for pthreads library +AC_ARG_WITH(libpthread, AS_HELP_STRING([--without-libpthread], + [Disable libpthread (default is autodetect)]), + [], [withval="yes"]) + +case "$withval" in +yes) + AC_SEARCH_LIBS([pthread_mutex_init],[pthread], [ + AC_DEFINE([HAVE_PTHREAD], [1], [Have pthreads library]) + LIBS="-lpthread $LIBS" + ], [AC_MSG_WARN([pthreads not available])]) + ;; +*) + ;; +esac + USE_NSS="no" # openssl if test $USE_NSS = "no"; then @@ -614,16 +642,21 @@ case "$enable_stub_only" in ;; esac -my_with_yaml=1 -AC_ARG_ENABLE(yaml-config, AC_HELP_STRING([--disable-yaml-config], [Remove support for YAML configuration. Removes the libyaml dependency.])) +my_with_yaml=0 +AC_ARG_ENABLE(yaml-config,) case "$enable_yaml_config" in - no) - my_with_yaml=0 - ;; - yes|*) + yes) AC_DEFINE_UNQUOTED([USE_YAML_CONFIG], [1], [Define this to enable YAML config support.]) + AC_DEFINE_UNQUOTED([HAVE_GETDNS_YAML2DICT], [1], [Define this to enable getdns_yaml2dict function.]) + + GETDNS_XTRA_OBJS="convert_yaml_to_json.lo" + my_with_yaml=1 + ;; + no|*) + GETDNS_XTRA_OBJS="" ;; esac +AC_SUBST(GETDNS_XTRA_OBJS) if test "$USE_WINSOCK" = 1; then AC_MSG_NOTICE([ Building on Windows ... YES! ]) @@ -688,30 +721,6 @@ else fi fi -if test $my_with_yaml = 1 -then - AC_ARG_WITH(libyaml, AS_HELP_STRING([--with-libyaml=pathname], - [path to libyaml (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/yaml.h"; then - CFLAGS="$CFLAGS -I$dir/include" - LDFLAGS="$LDFLAGS -L$dir/lib" - AC_MSG_NOTICE([Found libyaml in $dir]) - break - fi - done - else - if test x_$withval != x_no; then - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - else - my_with_yaml=0 - fi - fi -fi - if test $my_with_libunbound = 1 then # find libunbound @@ -752,16 +761,6 @@ then ]) fi -if test $my_with_yaml = 1 -then - AC_MSG_NOTICE([Checking for dependency libyaml]) - AC_CHECK_LIB([yaml], [yaml_parser_parse], [], [ - MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libyaml" - MISSING_SEP=", " - found_all_libs=0 - ]) -fi - AC_ARG_ENABLE(unbound-event-api, AC_HELP_STRING([--disable-unbound-event-api], [Disable usage of libunbounds event API])) case "$enable_unbound_event_api" in no) @@ -795,11 +794,6 @@ then ]) fi -if test $found_all_libs = 0 -then - AC_MSG_ERROR([Missing dependencies: $MISSING_DEPS]) -fi - AC_PATH_PROG([DOXYGEN], [doxygen]) if test -z "$DOXYGEN"; then AC_MSG_WARN([doxygen not found, continuing without]) @@ -1114,6 +1108,7 @@ AC_SUBST(GETDNS_QUERY) AC_SUBST(INSTALL_GETDNS_QUERY) AC_SUBST(UNINSTALL_GETDNS_QUERY) +stubby_with_yaml=0 AC_ARG_WITH(stubby, AS_HELP_STRING([--with-stubby], [Compile and install stubby, the (stub) resolver daemon]), [], [withval="no"]) @@ -1121,49 +1116,89 @@ if test x_$withval = x_yes; then STUBBY="stubby" INSTALL_STUBBY="install-stubby" UNINSTALL_STUBBY="uninstall-stubby" + if test $my_with_yaml = 0 + then + STUBBY_XTRA_OBJS="convert_yaml_to_json.lo gbuffer.lo" + stubby_with_yaml=1 + my_with_yaml=1 + fi else STUBBY="" INSTALL_STUBBY="" UNINSTALL_STUBBY="" + STUBBY_XTRA_OBJS="" fi AC_SUBST(STUBBY) AC_SUBST(INSTALL_STUBBY) AC_SUBST(UNINSTALL_STUBBY) +AC_SUBST(STUBBY_XTRA_OBJS) -AC_ARG_WITH(fd-setsize, AS_HELP_STRING([--with-fd-setsize=size], - [Set maximum file descriptor number that can be used by select]), - [], [withval="no"]) -case "$withval" in - no) - ;; - *) - AC_DEFINE_UNQUOTED([FD_SETSIZE], [$withval], [Alternate value for the FD_SETSIZE]) - my_enable_unbound_event_api=1 - ;; -esac +STUBBY_LDFLAGS="" +STUBBY_LIBS="" + +if test $my_with_yaml = 1 +then + if test $stubby_with_yaml = 1 + then + getdns_LIBS="$LIBS" + getdns_LDFLAGS="$LDFLAGS" + LIBS="" + LDFLAGS="" + fi + AC_ARG_WITH(libyaml, AS_HELP_STRING([--with-libyaml=pathname], + [path to libyaml (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/yaml.h"; then + CFLAGS="$CFLAGS -I$dir/include" + LDFLAGS="$LDFLAGS -L$dir/lib" + AC_MSG_NOTICE([Found libyaml in $dir]) + break + fi + done + else + if test x_$withval != x_no; then + CFLAGS="$CFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + else + if test $stubby_with_yaml = 1 + then + AC_MSG_ERROR([libyaml required for building Stubby]) + fi + my_with_yaml=0 + fi + fi + if test $my_with_yaml = 1 + then + AC_MSG_NOTICE([Checking for dependency libyaml]) + AC_CHECK_LIB([yaml], [yaml_parser_parse], [], [ + MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libyaml" + MISSING_SEP=", " + found_all_libs=0 + ]) + fi + if test $stubby_with_yaml = 1 + then + STUBBY_LDFLAGS="$LDFLAGS" + STUBBY_LIBS="$LIBS" + LIBS="$getdns_LIBS" + LDFLAGS="$getdns_LDFLAGS" + fi +fi +AC_SUBST(STUBBY_LDFLAGS) +AC_SUBST(STUBBY_LIBS) + +if test $found_all_libs = 0 +then + AC_MSG_ERROR([Missing dependencies: $MISSING_DEPS]) +fi AC_CONFIG_FILES([Makefile src/Makefile src/version.c src/getdns/getdns.h src/getdns/getdns_extra.h spec/example/Makefile src/test/Makefile src/tools/Makefile doc/Makefile getdns.pc getdns_ext_event.pc]) if [ test -n "$DOXYGEN" ] then AC_CONFIG_FILES([src/Doxyfile]) fi - -#---- check for pthreads library -AC_ARG_WITH(libpthread, AS_HELP_STRING([--without-libpthread], - [Disable libpthread (default is autodetect)]), - [], [withval="yes"]) - -case "$withval" in - yes) - AC_SEARCH_LIBS([pthread_mutex_init],[pthread], [ - AC_DEFINE([HAVE_PTHREAD], [1], [Have pthreads library]) - LIBS="-lpthread $LIBS" - ], [AC_MSG_WARN([pthreads not available])]) - ;; - *) - ;; -esac - AC_MSG_CHECKING([whether the C compiler (${CC-cc}) supports the __func__ variable]) AC_LANG_PUSH(C) AC_COMPILE_IFELSE( @@ -1301,14 +1336,14 @@ AH_BOTTOM([ # ifndef FD_SETSIZE # define FD_SETSIZE 1024 # endif -# define PRIsz "%Iu" +# define PRIsz "Iu" /* Windows wants us to use _strdup instead of strdup */ # ifndef strdup # define strdup _strdup # endif #else -# define PRIsz "%zu" +# define PRIsz "zu" #endif #include diff --git a/spec/example/Makefile.in b/spec/example/Makefile.in index 8ff7f2d1..7bf5e016 100644 --- a/spec/example/Makefile.in +++ b/spec/example/Makefile.in @@ -149,24 +149,16 @@ depend: # Dependencies for the examples example-all-functions.lo example-all-functions.o: $(srcdir)/example-all-functions.c $(srcdir)/getdns_libevent.h \ - ../../src/config.h \ - ../../src/getdns/getdns.h \ - $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ - ../../src/getdns/getdns_extra.h -example-reverse.lo example-reverse.o: $(srcdir)/example-reverse.c $(srcdir)/getdns_libevent.h \ - ../../src/config.h \ - ../../src/getdns/getdns.h \ - $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ + ../../src/config.h ../../src/getdns/getdns.h \ + $(srcdir)/../../src/getdns/getdns_ext_libevent.h ../../src/getdns/getdns_extra.h +example-reverse.lo example-reverse.o: $(srcdir)/example-reverse.c $(srcdir)/getdns_libevent.h ../../src/config.h \ + ../../src/getdns/getdns.h $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ ../../src/getdns/getdns_extra.h example-simple-answers.lo example-simple-answers.o: $(srcdir)/example-simple-answers.c $(srcdir)/getdns_libevent.h \ - ../../src/config.h \ - ../../src/getdns/getdns.h \ - $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ - ../../src/getdns/getdns_extra.h + ../../src/config.h ../../src/getdns/getdns.h \ + $(srcdir)/../../src/getdns/getdns_ext_libevent.h ../../src/getdns/getdns_extra.h example-synchronous.lo example-synchronous.o: $(srcdir)/example-synchronous.c $(srcdir)/getdns_core_only.h \ ../../src/getdns/getdns.h -example-tree.lo example-tree.o: $(srcdir)/example-tree.c $(srcdir)/getdns_libevent.h \ - ../../src/config.h \ - ../../src/getdns/getdns.h \ - $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ +example-tree.lo example-tree.o: $(srcdir)/example-tree.c $(srcdir)/getdns_libevent.h ../../src/config.h \ + ../../src/getdns/getdns.h $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ ../../src/getdns/getdns_extra.h diff --git a/src/Makefile.in b/src/Makefile.in index b4193cbe..b1a2d108 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -55,11 +55,13 @@ stubbysrcdir = $(srcdir)/../stubby LIBTOOL = ../libtool CC=@CC@ -CFLAGS=-I$(srcdir) -I. -I$(srcdir)/util/auxiliary @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS) +CFLAGS=-I$(srcdir) -I. -I$(srcdir)/util/auxiliary -I$(stubbysrcdir)/src @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS) WPEDANTICFLAG=@WPEDANTICFLAG@ WNOERRORFLAG=@WNOERRORFLAG@ LDFLAGS=@LDFLAGS@ @LIBS@ +STUBBY_LDFLAGS=@STUBBY_LDFLAGS@ @STUBBY_LIBS@ + EXTENSION_LIBEVENT_LIB=@EXTENSION_LIBEVENT_LIB@ EXTENSION_LIBEVENT_EXT_LIBS=@EXTENSION_LIBEVENT_EXT_LIBS@ EXTENSION_LIBEVENT_LDFLAGS=@EXTENSION_LIBEVENT_LDFLAGS@ @@ -94,6 +96,8 @@ JSMN_OBJ=jsmn.lo YXML_OBJ=yxml.lo YAML_OBJ=convert_yaml_to_json.lo +GETDNS_XTRA_OBJS=@GETDNS_XTRA_OBJS@ +STUBBY_XTRA_OBJS=@STUBBY_XTRA_OBJS@ EXTENSION_OBJ=$(DEFAULT_EVENTLOOP_OBJ) libevent.lo libev.lo @@ -127,7 +131,7 @@ $(JSMN_OBJ): $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -DJSMN_GETDNS -c $(srcdir)/jsmn/$(@:.lo=.c) -o $@ $(YAML_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/yaml/$(@:.lo=.c) -o $@ + $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(stubbysrcdir)/src/yaml/$(@:.lo=.c) -o $@ $(YXML_OBJ): $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -I$(srcdir)/yxml -DYXML_GETDNS -Wno-unused-parameter -c $(srcdir)/yxml/$(@:.lo=.c) -o $@ @@ -184,8 +188,8 @@ libgetdns_ext_uv.la: libgetdns.la libuv.lo libgetdns_ext_ev.la: libgetdns.la libev.lo $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libev.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libev.symbols -libgetdns.la: $(GETDNS_OBJ) version.lo context.lo anchor.lo $(DEFAULT_EVENTLOOP_OBJ) $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ) $(YXML_OBJ) $(YAML_OBJ) - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(GETDNS_OBJ) version.lo context.lo anchor.lo $(DEFAULT_EVENTLOOP_OBJ) $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ) $(YXML_OBJ) $(YAML_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/libgetdns.symbols +libgetdns.la: $(GETDNS_OBJ) version.lo context.lo anchor.lo $(DEFAULT_EVENTLOOP_OBJ) $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ) $(YXML_OBJ) $(GETDNS_XTRA_OBJS) + $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(GETDNS_OBJ) version.lo context.lo anchor.lo $(DEFAULT_EVENTLOOP_OBJ) $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ) $(YXML_OBJ) $(GETDNS_XTRA_OBJS) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/libgetdns.symbols test: default cd test && $(MAKE) $@ @@ -196,8 +200,8 @@ getdns_query: default stubby.lo: $(stubbysrcdir)/src/stubby.c $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -DSTUBBYCONFDIR=\"$(sysconfdir)/stubby\" -DRUNSTATEDIR=\"$(runstatedir)\" -c $< -o $@ -stubby: stubby.lo libgetdns.la - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ stubby.lo $(LDFLAGS) libgetdns.la +stubby: stubby.lo libgetdns.la $(STUBBY_XTRA_OBJS) + $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ stubby.lo $(STUBBY_XTRA_OBJS) $(STUBBY_LDFLAGS) libgetdns.la install-stubby: stubby $(stubbysrcdir)/stubby.yml.example $(stubbysrcdir)/stubby-setdns-macos.sh $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) @@ -265,309 +269,3 @@ depend: FORCE: # Dependencies for gldns, utils, the extensions and compat functions -anchor.lo anchor.o: $(srcdir)/anchor.c \ - config.h \ - $(srcdir)/debug.h $(srcdir)/anchor.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/types-internal.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/context.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h $(srcdir)/yxml/yxml.h \ - $(srcdir)/gldns/parseutil.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h \ - $(srcdir)/gldns/keyraw.h $(srcdir)/general.h $(srcdir)/util-internal.h -const-info.lo const-info.o: $(srcdir)/const-info.c \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/const-info.h -context.lo context.o: $(srcdir)/context.c \ - config.h \ - $(srcdir)/anchor.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/debug.h \ - $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/context.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h \ - $(srcdir)/stub.h $(srcdir)/list.h $(srcdir)/dict.h $(srcdir)/pubkey-pinning.h -convert.lo convert.o: $(srcdir)/convert.c \ - config.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h \ - $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h \ - $(srcdir)/util/lruhash.h $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/orig-headers/locks.h $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h \ - $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/gldns/wire2str.h \ - $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/parseutil.h $(srcdir)/const-info.h $(srcdir)/dict.h \ - $(srcdir)/list.h $(srcdir)/jsmn/jsmn.h $(srcdir)/yaml/convert_yaml_to_json.h $(srcdir)/convert.h -dict.lo dict.o: $(srcdir)/dict.c \ - config.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/util-internal.h $(srcdir)/context.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/const-info.h $(srcdir)/gldns/wire2str.h \ - $(srcdir)/gldns/parseutil.h -dnssec.lo dnssec.o: $(srcdir)/dnssec.c \ - config.h \ - $(srcdir)/debug.h \ - getdns/getdns.h \ - $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h \ - $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/keyraw.h \ - $(srcdir)/gldns/parseutil.h $(srcdir)/general.h $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/util/val_secalgo.h \ - $(srcdir)/util/orig-headers/val_secalgo.h -general.lo general.o: $(srcdir)/general.c \ - config.h \ - $(srcdir)/general.h \ - getdns/getdns.h \ - $(srcdir)/types-internal.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/ub_loop.h $(srcdir)/debug.h \ - $(srcdir)/gldns/wire2str.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h $(srcdir)/stub.h \ - $(srcdir)/dict.h $(srcdir)/mdns.h -list.lo list.o: $(srcdir)/list.c $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/util-internal.h \ - config.h \ - $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/list.h $(srcdir)/dict.h -mdns.lo mdns.o: $(srcdir)/mdns.c \ - config.h \ - $(srcdir)/debug.h $(srcdir)/context.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/general.h $(srcdir)/gldns/rrdef.h $(srcdir)/util-internal.h $(srcdir)/mdns.h \ - $(srcdir)/util/auxiliary/util/fptr_wlist.h $(srcdir)/util/lookup3.h \ - $(srcdir)/util/orig-headers/lookup3.h -pubkey-pinning.lo pubkey-pinning.o: $(srcdir)/pubkey-pinning.c \ - config.h \ - $(srcdir)/debug.h \ - getdns/getdns.h \ - $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/util-internal.h -request-internal.lo request-internal.o: $(srcdir)/request-internal.c \ - config.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/util-internal.h $(srcdir)/context.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h \ - $(srcdir)/dict.h $(srcdir)/convert.h $(srcdir)/general.h -rr-dict.lo rr-dict.o: $(srcdir)/rr-dict.c $(srcdir)/rr-dict.h \ - config.h \ - getdns/getdns.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/util-internal.h $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h \ - $(srcdir)/dict.h -rr-iter.lo rr-iter.o: $(srcdir)/rr-iter.c $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - config.h \ - getdns/getdns.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/rrdef.h -server.lo server.o: $(srcdir)/server.c \ - config.h \ - getdns/getdns_extra.h \ - getdns/getdns.h \ - $(srcdir)/context.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h -stub.lo stub.o: $(srcdir)/stub.c \ - config.h \ - $(srcdir)/debug.h $(srcdir)/stub.h \ - getdns/getdns.h \ - $(srcdir)/types-internal.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/rr-iter.h \ - $(srcdir)/rr-dict.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h \ - $(srcdir)/util/lruhash.h $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/orig-headers/locks.h $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/anchor.h \ - $(srcdir)/util-internal.h $(srcdir)/general.h $(srcdir)/pubkey-pinning.h -sync.lo sync.o: $(srcdir)/sync.c \ - getdns/getdns.h \ - config.h \ - $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/general.h $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h \ - $(srcdir)/stub.h $(srcdir)/gldns/wire2str.h -ub_loop.lo ub_loop.o: $(srcdir)/ub_loop.c $(srcdir)/ub_loop.h \ - config.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/debug.h -util-internal.lo util-internal.o: $(srcdir)/util-internal.c \ - config.h \ - getdns/getdns.h \ - $(srcdir)/dict.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/types-internal.h \ - getdns/getdns_extra.h \ - $(srcdir)/list.h $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h \ - $(srcdir)/util/lruhash.h $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/orig-headers/locks.h $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/rr-iter.h \ - $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/gldns/str2wire.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h -gbuffer.lo gbuffer.o: $(srcdir)/gldns/gbuffer.c \ - config.h \ - $(srcdir)/gldns/gbuffer.h -keyraw.lo keyraw.o: $(srcdir)/gldns/keyraw.c \ - config.h \ - $(srcdir)/gldns/keyraw.h $(srcdir)/gldns/rrdef.h -parse.lo parse.o: $(srcdir)/gldns/parse.c \ - config.h \ - $(srcdir)/gldns/parse.h $(srcdir)/gldns/parseutil.h $(srcdir)/gldns/gbuffer.h -parseutil.lo parseutil.o: $(srcdir)/gldns/parseutil.c \ - config.h \ - $(srcdir)/gldns/parseutil.h -rrdef.lo rrdef.o: $(srcdir)/gldns/rrdef.c \ - config.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/parseutil.h -str2wire.lo str2wire.o: $(srcdir)/gldns/str2wire.c \ - config.h \ - $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/parse.h $(srcdir)/gldns/parseutil.h -wire2str.lo wire2str.o: $(srcdir)/gldns/wire2str.c \ - config.h \ - $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/pkthdr.h \ - $(srcdir)/gldns/parseutil.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/keyraw.h -arc4_lock.lo arc4_lock.o: $(srcdir)/compat/arc4_lock.c \ - config.h -arc4random.lo arc4random.o: $(srcdir)/compat/arc4random.c \ - config.h \ - $(srcdir)/compat/chacha_private.h -arc4random_uniform.lo arc4random_uniform.o: $(srcdir)/compat/arc4random_uniform.c \ - config.h -explicit_bzero.lo explicit_bzero.o: $(srcdir)/compat/explicit_bzero.c \ - config.h -getentropy_linux.lo getentropy_linux.o: $(srcdir)/compat/getentropy_linux.c \ - config.h -getentropy_osx.lo getentropy_osx.o: $(srcdir)/compat/getentropy_osx.c \ - config.h -getentropy_solaris.lo getentropy_solaris.o: $(srcdir)/compat/getentropy_solaris.c \ - config.h -getentropy_win.lo getentropy_win.o: $(srcdir)/compat/getentropy_win.c -gettimeofday.lo gettimeofday.o: $(srcdir)/compat/gettimeofday.c \ - config.h -inet_ntop.lo inet_ntop.o: $(srcdir)/compat/inet_ntop.c \ - config.h -inet_pton.lo inet_pton.o: $(srcdir)/compat/inet_pton.c \ - config.h -sha512.lo sha512.o: $(srcdir)/compat/sha512.c \ - config.h -strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c \ - config.h -strptime.lo strptime.o: $(srcdir)/compat/strptime.c \ - config.h -locks.lo locks.o: $(srcdir)/util/locks.c \ - config.h \ - $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h -lookup3.lo lookup3.o: $(srcdir)/util/lookup3.c \ - config.h \ - $(srcdir)/util/auxiliary/util/storage/lookup3.h $(srcdir)/util/lookup3.h \ - $(srcdir)/util/orig-headers/lookup3.h -lruhash.lo lruhash.o: $(srcdir)/util/lruhash.c \ - config.h \ - $(srcdir)/util/auxiliary/util/storage/lruhash.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/util/auxiliary/util/fptr_wlist.h -rbtree.lo rbtree.o: $(srcdir)/util/rbtree.c \ - config.h \ - $(srcdir)/util/auxiliary/log.h $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h \ - $(srcdir)/util/auxiliary/fptr_wlist.h $(srcdir)/util/auxiliary/util/fptr_wlist.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h -val_secalgo.lo val_secalgo.o: $(srcdir)/util/val_secalgo.c \ - config.h \ - $(srcdir)/util/auxiliary/util/data/packed_rrset.h \ - $(srcdir)/util/auxiliary/validator/val_secalgo.h $(srcdir)/util/val_secalgo.h \ - $(srcdir)/util/orig-headers/val_secalgo.h $(srcdir)/util/auxiliary/validator/val_nsec3.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/util/auxiliary/sldns/rrdef.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/util/auxiliary/sldns/keyraw.h $(srcdir)/gldns/keyraw.h \ - $(srcdir)/util/auxiliary/sldns/sbuffer.h $(srcdir)/gldns/gbuffer.h -jsmn.lo jsmn.o: $(srcdir)/jsmn/jsmn.c $(srcdir)/jsmn/jsmn.h -yxml.lo yxml.o: $(srcdir)/yxml/yxml.c $(srcdir)/yxml/yxml.h -convert_yaml_to_json.lo convert_yaml_to_json.o: $(srcdir)/yaml/convert_yaml_to_json.c \ - config.h \ - $(srcdir)/yaml/../gldns/gbuffer.h $(srcdir)/yaml/convert_yaml_to_json.h -libev.lo libev.o: $(srcdir)/extension/libev.c \ - config.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/getdns/getdns_ext_libev.h -libevent.lo libevent.o: $(srcdir)/extension/libevent.c \ - config.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/getdns/getdns_ext_libevent.h -libuv.lo libuv.o: $(srcdir)/extension/libuv.c \ - config.h \ - $(srcdir)/debug.h $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/getdns/getdns_ext_libuv.h -poll_eventloop.lo poll_eventloop.o: $(srcdir)/extension/poll_eventloop.c \ - config.h \ - $(srcdir)/extension/poll_eventloop.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/debug.h -select_eventloop.lo select_eventloop.o: $(srcdir)/extension/select_eventloop.c \ - config.h \ - $(srcdir)/debug.h $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/extension/select_eventloop.h diff --git a/src/convert.c b/src/convert.c index deb0762c..d6289ecf 100644 --- a/src/convert.c +++ b/src/convert.c @@ -1803,10 +1803,10 @@ getdns_str2int(const char *str, uint32_t *value) return GETDNS_RETURN_GOOD; } +#ifdef USE_YAML_CONFIG getdns_return_t getdns_yaml2dict(const char *str, getdns_dict **dict) { -#ifdef USE_YAML_CONFIG char *jsonstr; if (!str || !dict) @@ -1820,12 +1820,8 @@ getdns_yaml2dict(const char *str, getdns_dict **dict) } else { return GETDNS_RETURN_GENERIC_ERROR; } -#else /* USE_YAML_CONFIG */ - (void) str; - (void) dict; - return GETDNS_RETURN_NOT_IMPLEMENTED; -#endif /* USE_YAML_CONFIG */ } +#endif /* USE_YAML_CONFIG */ /* WT: I am not certain about the value of yaml2list... * I don't see how yaml2bindata and yaml2int would be different from diff --git a/src/getdns/getdns_extra.h.in b/src/getdns/getdns_extra.h.in index 2ef7133d..ca62b2fb 100644 --- a/src/getdns/getdns_extra.h.in +++ b/src/getdns/getdns_extra.h.in @@ -1829,28 +1829,6 @@ getdns_msg_dict2str_scan( * @{ */ -/** - * Convert YAML text to a getdns_dict. - * - * @param str A textual representation of a getdns_dict. - * The format is similar, but not precisely YAML. - * - When str contains an IP or IPv6 address, it is converted - * to an getdns dict representation of that address. This may contain - * a port, tls_port, tsig spec or tls authentication name in the same - * way as may be given with the `getdns_query` tool. For example: - * `185.49.140.67:80#443` will result in the following getdns_dict: - * - * { address_type: "IPv4" - * , address_data: "185.49.140.67" - * , port: 80 - * , tls_port: 443 - * } - * @param dict The returned getdns_dict. - * @return GETDNS_RETURN_GOOD on success or an error code on failure. - */ -getdns_return_t -getdns_yaml2dict(const char *str, getdns_dict **dict); - /** * Convert string text to a getdns_dict. * diff --git a/src/mk-symfiles.sh b/src/mk-symfiles.sh index 597657b7..fff7176b 100755 --- a/src/mk-symfiles.sh +++ b/src/mk-symfiles.sh @@ -8,6 +8,7 @@ write_symbols() { } write_symbols libgetdns.symbols getdns/getdns.h.in getdns/getdns_extra.h.in +echo getdns_yaml2dict >> libgetdns.symbols echo plain_mem_funcs_user_arg >> libgetdns.symbols echo priv_getdns_context_mf >> libgetdns.symbols write_symbols extension/libevent.symbols getdns/getdns_ext_libevent.h diff --git a/src/test/Makefile.in b/src/test/Makefile.in index 9d4dad00..00211237 100644 --- a/src/test/Makefile.in +++ b/src/test/Makefile.in @@ -231,13 +231,10 @@ depend: .PHONY: clean test # Dependencies for the unit tests -check_getdns.lo check_getdns.o: $(srcdir)/check_getdns.c \ - ../getdns/getdns.h \ - $(srcdir)/check_getdns_common.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_address.h $(srcdir)/check_getdns_address_sync.h \ - $(srcdir)/check_getdns_cancel_callback.h $(srcdir)/check_getdns_context_create.h \ - $(srcdir)/check_getdns_context_destroy.h \ +check_getdns.lo check_getdns.o: $(srcdir)/check_getdns.c ../getdns/getdns.h $(srcdir)/check_getdns_common.h \ + ../getdns/getdns_extra.h $(srcdir)/check_getdns_address.h \ + $(srcdir)/check_getdns_address_sync.h $(srcdir)/check_getdns_cancel_callback.h \ + $(srcdir)/check_getdns_context_create.h $(srcdir)/check_getdns_context_destroy.h \ $(srcdir)/check_getdns_context_set_context_update_callback.h \ $(srcdir)/check_getdns_context_set_dns_transport.h \ $(srcdir)/check_getdns_context_set_timeout.h \ @@ -257,58 +254,34 @@ check_getdns.lo check_getdns.o: $(srcdir)/check_getdns.c \ $(srcdir)/check_getdns_list_get_list.h $(srcdir)/check_getdns_pretty_print_dict.h \ $(srcdir)/check_getdns_service.h $(srcdir)/check_getdns_service_sync.h \ $(srcdir)/check_getdns_transport.h -check_getdns_common.lo check_getdns_common.o: $(srcdir)/check_getdns_common.c \ - ../getdns/getdns.h \ - ../config.h \ - $(srcdir)/check_getdns_common.h \ - ../getdns/getdns_extra.h \ +check_getdns_common.lo check_getdns_common.o: $(srcdir)/check_getdns_common.c ../getdns/getdns.h \ + ../config.h $(srcdir)/check_getdns_common.h ../getdns/getdns_extra.h \ $(srcdir)/check_getdns_eventloop.h check_getdns_context_set_timeout.lo check_getdns_context_set_timeout.o: $(srcdir)/check_getdns_context_set_timeout.c \ $(srcdir)/check_getdns_context_set_timeout.h $(srcdir)/check_getdns_common.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h + ../getdns/getdns.h ../getdns/getdns_extra.h check_getdns_libev.lo check_getdns_libev.o: $(srcdir)/check_getdns_libev.c $(srcdir)/check_getdns_eventloop.h \ - ../config.h \ - ../getdns/getdns.h \ - $(srcdir)/../getdns/getdns_ext_libev.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_common.h + ../config.h ../getdns/getdns.h $(srcdir)/../getdns/getdns_ext_libev.h \ + ../getdns/getdns_extra.h $(srcdir)/check_getdns_common.h check_getdns_libevent.lo check_getdns_libevent.o: $(srcdir)/check_getdns_libevent.c $(srcdir)/check_getdns_eventloop.h \ - ../config.h \ - ../getdns/getdns.h \ - $(srcdir)/../getdns/getdns_ext_libevent.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_libevent.h $(srcdir)/check_getdns_common.h + ../config.h ../getdns/getdns.h $(srcdir)/../getdns/getdns_ext_libevent.h \ + ../getdns/getdns_extra.h $(srcdir)/check_getdns_libevent.h $(srcdir)/check_getdns_common.h check_getdns_libuv.lo check_getdns_libuv.o: $(srcdir)/check_getdns_libuv.c $(srcdir)/check_getdns_eventloop.h \ - ../config.h \ - ../getdns/getdns.h \ - $(srcdir)/../getdns/getdns_ext_libuv.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_common.h + ../config.h ../getdns/getdns.h $(srcdir)/../getdns/getdns_ext_libuv.h \ + ../getdns/getdns_extra.h $(srcdir)/check_getdns_common.h check_getdns_selectloop.lo check_getdns_selectloop.o: $(srcdir)/check_getdns_selectloop.c \ - $(srcdir)/check_getdns_eventloop.h \ - ../config.h \ - ../getdns/getdns.h \ + $(srcdir)/check_getdns_eventloop.h ../config.h ../getdns/getdns.h \ ../getdns/getdns_extra.h check_getdns_transport.lo check_getdns_transport.o: $(srcdir)/check_getdns_transport.c \ - $(srcdir)/check_getdns_transport.h $(srcdir)/check_getdns_common.h \ - ../getdns/getdns.h \ + $(srcdir)/check_getdns_transport.h $(srcdir)/check_getdns_common.h ../getdns/getdns.h \ ../getdns/getdns_extra.h -scratchpad.template.lo scratchpad.template.o: scratchpad.template.c \ - ../getdns/getdns.h \ +scratchpad.template.lo scratchpad.template.o: scratchpad.template.c ../getdns/getdns.h \ ../getdns/getdns_extra.h testmessages.lo testmessages.o: $(srcdir)/testmessages.c $(srcdir)/testmessages.h -tests_dict.lo tests_dict.o: $(srcdir)/tests_dict.c $(srcdir)/testmessages.h \ - ../getdns/getdns.h -tests_list.lo tests_list.o: $(srcdir)/tests_list.c $(srcdir)/testmessages.h \ - ../getdns/getdns.h -tests_namespaces.lo tests_namespaces.o: $(srcdir)/tests_namespaces.c $(srcdir)/testmessages.h \ - ../getdns/getdns.h -tests_stub_async.lo tests_stub_async.o: $(srcdir)/tests_stub_async.c \ - ../config.h \ - $(srcdir)/testmessages.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h -tests_stub_sync.lo tests_stub_sync.o: $(srcdir)/tests_stub_sync.c $(srcdir)/testmessages.h \ - ../getdns/getdns.h \ +tests_dict.lo tests_dict.o: $(srcdir)/tests_dict.c $(srcdir)/testmessages.h ../getdns/getdns.h +tests_list.lo tests_list.o: $(srcdir)/tests_list.c $(srcdir)/testmessages.h ../getdns/getdns.h +tests_namespaces.lo tests_namespaces.o: $(srcdir)/tests_namespaces.c $(srcdir)/testmessages.h ../getdns/getdns.h +tests_stub_async.lo tests_stub_async.o: $(srcdir)/tests_stub_async.c ../config.h $(srcdir)/testmessages.h \ + ../getdns/getdns.h ../getdns/getdns_extra.h +tests_stub_sync.lo tests_stub_sync.o: $(srcdir)/tests_stub_sync.c $(srcdir)/testmessages.h ../getdns/getdns.h \ ../getdns/getdns_extra.h diff --git a/src/tools/Makefile.in b/src/tools/Makefile.in index 3cba9659..2049229a 100644 --- a/src/tools/Makefile.in +++ b/src/tools/Makefile.in @@ -112,8 +112,5 @@ depend: .PHONY: clean test # Dependencies for getdns_query -getdns_query.lo getdns_query.o: $(srcdir)/getdns_query.c \ - ../config.h \ - $(srcdir)/../debug.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h +getdns_query.lo getdns_query.o: $(srcdir)/getdns_query.c ../config.h $(srcdir)/../debug.h ../config.h \ + ../getdns/getdns.h ../getdns/getdns_extra.h diff --git a/src/tools/getdns_query.c b/src/tools/getdns_query.c index 9ab55b19..ce64a679 100644 --- a/src/tools/getdns_query.c +++ b/src/tools/getdns_query.c @@ -46,6 +46,10 @@ typedef unsigned short in_port_t; #include #endif +#ifdef HAVE_GETDNS_YAML2DICT +getdns_return_t getdns_yaml2dict(const char *, getdns_dict **dict); +#endif + #define EXAMPLE_PIN "pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\"" static int verbosity = 0; diff --git a/src/yaml/convert_yaml_to_json.c b/src/yaml/convert_yaml_to_json.c deleted file mode 100644 index be04725d..00000000 --- a/src/yaml/convert_yaml_to_json.c +++ /dev/null @@ -1,550 +0,0 @@ -/* - * Copyright (c) 2017, NLNet Labs, Verisign, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the names of the copyright holders nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. 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. - */ - -#include -#include -#include - -#include "config.h" - -#ifdef USE_YAML_CONFIG - -#include - -#include "../gldns/gbuffer.h" -#include "convert_yaml_to_json.h" - -static int process_yaml_stream(yaml_parser_t *, yaml_event_t *, gldns_buffer *); - -static int process_yaml_document(yaml_parser_t *, yaml_event_t *, gldns_buffer *); - -static int process_yaml_mapping(yaml_parser_t *, yaml_event_t *, gldns_buffer *); - -static int process_yaml_sequence(yaml_parser_t *, yaml_event_t *, gldns_buffer *); - -static int process_yaml_value(yaml_parser_t *, yaml_event_t *, gldns_buffer *); - -static int output_scalar(yaml_event_t *, gldns_buffer *); - -static void report_parser_error(yaml_parser_t *); - -static char* event_type_string(yaml_event_type_t); - -/* public functions */ - -char * -yaml_string_to_json_string(const char *instr) -{ - assert(instr); - - gldns_buffer *buf; - char* json = NULL; - - buf = gldns_buffer_new(8192); - if (!buf) { - fprintf(stderr, "Could not assign buffer for json output"); - return NULL; - } - - yaml_parser_t parser; - yaml_event_t event; - - memset(&parser, 0, sizeof(parser)); - memset(&event, 0, sizeof(event)); - - if (!yaml_parser_initialize(&parser)) { - fprintf(stderr, "Could not initialize the parser object\n"); - goto return_error; - } - - /* Set the parser parameters. */ - yaml_parser_set_input_string(&parser, (const unsigned char *) instr, strlen(instr)); - - /* Get the first event. */ - if (!yaml_parser_parse(&parser, &event)) { - report_parser_error(&parser); - goto return_error; - } - - /* First event should be stream start. */ - if (event.type != YAML_STREAM_START_EVENT) { - fprintf(stderr, "Event error: wrong type of event: %d\n", event.type); - goto return_error; - } - - if (process_yaml_stream(&parser, &event, buf) != 0) { - goto return_error; - } - - yaml_event_delete(&event); - yaml_parser_delete(&parser); - - /* - * gldns_buffer_export() returns a pointer to the data and - * sets a flag to prevent it from being deleted by - * gldns_buffer_free() - */ - json = (char *) gldns_buffer_export(buf); - gldns_buffer_free(buf); - - return json; - -return_error: - - yaml_event_delete(&event); - yaml_parser_delete(&parser); - gldns_buffer_free(buf); - - return NULL; -} - -/* local functions */ - -int -process_yaml_stream(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) -{ - assert(parser); - assert(event); - assert(buf); - - int done = 0; - - while (!done) - { - /* Delete the event that brought us here */ - yaml_event_delete(event); - - /* Get the next event. */ - if (!yaml_parser_parse(parser, event)) { - report_parser_error(parser); - return -1; - } - - switch (event->type) { - case YAML_STREAM_END_EVENT: - - done = 1; - break; - - case YAML_DOCUMENT_START_EVENT: - - if (process_yaml_document(parser, event, buf) != 0) { - return -1; - } - break; - - case YAML_STREAM_START_EVENT: - case YAML_DOCUMENT_END_EVENT: - case YAML_ALIAS_EVENT: - case YAML_SCALAR_EVENT: - case YAML_SEQUENCE_START_EVENT: - case YAML_SEQUENCE_END_EVENT: - case YAML_MAPPING_START_EVENT: - case YAML_MAPPING_END_EVENT: - - fprintf(stderr, - "Event error: %s. Expected YAML_DOCUMENT_START_EVENT or YAML_STREAM_END_EVENT.\n", - event_type_string(event->type)); - return -1; - - default: - /* NOTREACHED */ - break; - } - } - return 0; -} - -int -process_yaml_document(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) -{ - assert(parser); - assert(event); - assert(buf); - - int done = 0; - - while (!done) - { - /* Delete the event that brought us here */ - yaml_event_delete(event); - - /* Get the next event. */ - if (!yaml_parser_parse(parser, event)) { - report_parser_error(parser); - return -1; - } - - switch (event->type) { - case YAML_DOCUMENT_END_EVENT: - - done = 1; - break; - - case YAML_MAPPING_START_EVENT: - - if (process_yaml_mapping(parser, event, buf) != 0) { - return -1; - } - break; - - case YAML_SEQUENCE_START_EVENT: - - if (process_yaml_sequence(parser, event, buf) != 0) { - return -1; - } - break; - - case YAML_SCALAR_EVENT: - - if (output_scalar(event, buf) != 0) { - fprintf(stderr, "Value error: Error outputting scalar\n"); - return -1; - } - break; - - case YAML_STREAM_START_EVENT: - case YAML_STREAM_END_EVENT: - case YAML_DOCUMENT_START_EVENT: - case YAML_ALIAS_EVENT: - case YAML_SEQUENCE_END_EVENT: - case YAML_MAPPING_END_EVENT: - - fprintf(stderr, - "Event error: %s. Expected YAML_MAPPING_START_EVENT or YAML_DOCUMENT_END_EVENT.\n", - event_type_string(event->type)); - return -1; - - default: - /* NOTREACHED */ - break; - } - } - return 0; -} - -int -process_yaml_mapping(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) -{ - assert(parser); - assert(event); - assert(buf); - - int done = 0; - int members = 0; - - if ( gldns_buffer_printf(buf, "{ ") == -1 ) - return -1; - - while (!done) - { - /* Delete the event that brought us here */ - yaml_event_delete(event); - - /* Get the next event. */ - if (!yaml_parser_parse(parser, event)) { - report_parser_error(parser); - return -1; - } - - if (event->type == YAML_SCALAR_EVENT) { - if (members) - if (gldns_buffer_printf(buf, ", ") == -1) - return -1; - - if (output_scalar(event, buf) != 0) { - fprintf(stderr, "Mapping error: Error outputting key\n"); - return -1; - } - if (gldns_buffer_printf(buf, ": ") == -1) - return -1; - - members = 1; - } else if (event->type == YAML_MAPPING_END_EVENT) { - if (gldns_buffer_printf(buf, " }") == -1) - return -1; - done = 1; - continue; - } else { - fprintf(stderr, - "Event error: %s. Expected YAML_SCALAR_EVENT or YAML_MAPPING_END_EVENT.\n", - event_type_string(event->type)); - return -1; - } - - /* Delete the event that brought us here */ - yaml_event_delete(event); - - /* Get the next event. */ - if (!yaml_parser_parse(parser, event)) { - report_parser_error(parser); - return -1; - } - - switch (event->type) { - case YAML_SCALAR_EVENT: - case YAML_SEQUENCE_START_EVENT: - case YAML_MAPPING_START_EVENT: - if (process_yaml_value(parser, event, buf) != 0) { - return -1; - } - break; - - case YAML_STREAM_START_EVENT: - case YAML_STREAM_END_EVENT: - case YAML_DOCUMENT_START_EVENT: - case YAML_DOCUMENT_END_EVENT: - case YAML_ALIAS_EVENT: - case YAML_SEQUENCE_END_EVENT: - case YAML_MAPPING_END_EVENT: - fprintf(stderr, - "Event error: %s. Expected YAML_MAPPING_START_EVENT, YAML_SEQUENCE_START_EVENT or YAML_SCALAR_EVENT.\n", - event_type_string(event->type)); - return -1; - - default: - /* NOTREACHED */ - break; - } - } - return 0; -} - -int -process_yaml_sequence(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) -{ - assert(parser); - assert(event); - assert(buf); - - int done = 0; - int elements = 0; - - if ( gldns_buffer_printf(buf, "[ ") == -1 ) - return -1; - - while (!done) - { - /* Delete the event that brought us here */ - yaml_event_delete(event); - - /* Get the next event. */ - if (!yaml_parser_parse(parser, event)) { - report_parser_error(parser); - return -1; - } - - switch (event->type) { - case YAML_SCALAR_EVENT: - case YAML_SEQUENCE_START_EVENT: - case YAML_MAPPING_START_EVENT: - - if (elements) - if (gldns_buffer_printf(buf, ", ") == -1) - return -1; - - if (process_yaml_value(parser, event, buf) != 0) - return -1; - - elements = 1; - break; - - case YAML_SEQUENCE_END_EVENT: - if (gldns_buffer_printf(buf, " ]") == -1) - return -1; - done = 1; - break; - - case YAML_STREAM_START_EVENT: - case YAML_STREAM_END_EVENT: - case YAML_DOCUMENT_START_EVENT: - case YAML_DOCUMENT_END_EVENT: - case YAML_ALIAS_EVENT: - case YAML_MAPPING_END_EVENT: - fprintf(stderr, - "Event error: %s. Expected YAML_MAPPING_START_EVENT, YAML_SEQUENCE_START_EVENT, YAML_SCALAR_EVENT or YAML_SEQUENCE_END_EVENT.\n", - event_type_string(event->type)); - return -1; - - default: - /* NOTREACHED */ - break; - } - } - return 0; -} - -int -process_yaml_value(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) -{ - assert(parser); - assert(event); - assert(buf); - - switch (event->type) { - case YAML_SCALAR_EVENT: - if (output_scalar(event, buf) != 0) { - fprintf(stderr, "Value error: Error outputting scalar\n"); - return -1; - } - break; - - case YAML_SEQUENCE_START_EVENT: - if (process_yaml_sequence(parser, event, buf) != 0) { - return -1; - } - break; - - case YAML_MAPPING_START_EVENT: - if (process_yaml_mapping(parser, event, buf) != 0) { - return -1; - } - break; - - default: - fprintf(stderr, "Bug: calling process_yaml_value() in the wrong context"); - return -1; - } - return 0; -} - -int -output_scalar(yaml_event_t *event, gldns_buffer *buf) -{ - const char *fmt = "%s"; - - assert(event); - assert(buf); - assert(event->data.scalar.length > 0); - - if (event->data.scalar.style != YAML_PLAIN_SCALAR_STYLE) - fmt = "\"%s\""; - - if ( gldns_buffer_printf(buf, fmt, event->data.scalar.value) == -1 ) - return -1; - return 0; -} - -void report_parser_error(yaml_parser_t *parser) -{ - assert(parser); - - /* Display a parser error message. */ - switch (parser->error) { - case YAML_MEMORY_ERROR: - fprintf(stderr, "Memory error: Not enough memory for parsing\n"); - break; - - case YAML_READER_ERROR: - if (parser->problem_value != -1) { - fprintf(stderr, "Reader error: %s: #%X at %zu\n", parser->problem, - parser->problem_value, parser->problem_offset); - } else { - fprintf(stderr, "Reader error: %s at %zu\n", parser->problem, - parser->problem_offset); - } - break; - - case YAML_SCANNER_ERROR: - if (parser->context) { - fprintf(stderr, "Scanner error: %s at line "PRIsz", column "PRIsz"\n" - "%s at line "PRIsz", column "PRIsz"\n", parser->context, - parser->context_mark.line+1, parser->context_mark.column+1, - parser->problem, parser->problem_mark.line+1, - parser->problem_mark.column+1); - } else { - fprintf(stderr, "Scanner error: %s at line "PRIsz", column "PRIsz"\n", - parser->problem, parser->problem_mark.line+1, - parser->problem_mark.column+1); - } - break; - - case YAML_PARSER_ERROR: - if (parser->context) { - fprintf(stderr, "Parser error: %s at line "PRIsz", column "PRIsz"\n" - "%s at line "PRIsz", column "PRIsz"\n", parser->context, - parser->context_mark.line+1, parser->context_mark.column+1, - parser->problem, parser->problem_mark.line+1, - parser->problem_mark.column+1); - } else { - fprintf(stderr, "Parser error: %s at line "PRIsz", column "PRIsz"\n", - parser->problem, parser->problem_mark.line+1, - parser->problem_mark.column+1); - } - break; - - default: - /* Couldn't happen. */ - fprintf(stderr, "Internal error\n"); - break; - } - return; -} - -/* TODO - improve this */ -char* -event_type_string(yaml_event_type_t type) -{ - switch (type) { - case YAML_STREAM_START_EVENT: - return "YAML_STREAM_START_EVENT"; - - case YAML_STREAM_END_EVENT: - return "YAML_STREAM_END_EVENT"; - - case YAML_DOCUMENT_START_EVENT: - return "YAML_DOCUMENT_START_EVENT"; - - case YAML_DOCUMENT_END_EVENT: - return "YAML_DOCUMENT_END_EVENT"; - - case YAML_ALIAS_EVENT: - return "YAML_ALIAS_EVENT"; - - case YAML_SCALAR_EVENT: - return "YAML_SCALAR_EVENT"; - - case YAML_SEQUENCE_START_EVENT: - return "YAML_SEQUENCE_START_EVENT"; - - case YAML_SEQUENCE_END_EVENT: - return "YAML_SEQUENCE_END_EVENT"; - - case YAML_MAPPING_START_EVENT: - return "YAML_MAPPING_START_EVENT"; - - case YAML_MAPPING_END_EVENT: - return "YAML_MAPPING_END_EVENT"; - - default: - /* NOTREACHED */ - return NULL; - } - return NULL; -} - -#endif /* USE_YAML_CONFIG */ diff --git a/src/yaml/convert_yaml_to_json.h b/src/yaml/convert_yaml_to_json.h deleted file mode 100644 index 75b652f6..00000000 --- a/src/yaml/convert_yaml_to_json.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2017, NLNet Labs, Verisign, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the names of the copyright holders nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. 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 _CONVERT_YAML_TO_JSON_H -#define _CONVERT_YAML_TO_JSON_H - -#include - -/** - * read yaml-syntax data from the string and convert to json-syntax - * yaml syntax resitrictions imposed for getdns: - * the outer-most data structure must be a yaml mapping - * mapping keys must be yaml scalars - * plain scalars are output to the json string unchanged - * non-plain scalars (quoted, double-quoted, wrapped) are output double-quoted - * TODO Test on yaml data containing yaml tags (these are ignored at present) - * The code has only been tested on yaml data using indentation style, so it - * should be tested on other styles as well. - * @param instr the string carrying data in yaml syntax - * @return a string of data in json syntax on success - * @return NULL if there is a yaml syntax violation - * the outer-most structure in not a mapping - * a mapping key is complex (a mapping or sequence) - */ -char * yaml_string_to_json_string(const char *instr); - -#endif //_CONVERT_YAML_TO_JSON_H diff --git a/stubby b/stubby index a6c6ae69..efdd6fb3 160000 --- a/stubby +++ b/stubby @@ -1 +1 @@ -Subproject commit a6c6ae696cd4c6b1f8650011adaf69c39316e0ea +Subproject commit efdd6fb31abb05f03309720e97167c632e5fe381