diff --git a/ChangeLog b/ChangeLog index da0c2623..ec108fa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,8 @@ * New context update callback function to also return a user given argument along with the context and which item was changed. Thanks Scott Hollenbeck. + * Demotivate use of getdns_strerror and expose getdns_get_errorstr_by_id. + Thanks Scott Hollenbeck. * 2015-01-16: Version 0.1.6 * Fix: linking against libev on FreeBSD diff --git a/src/Makefile.in b/src/Makefile.in index 7a7f3791..9c73c04f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -64,8 +64,8 @@ EXTENSION_LIBUV_LDFLAGS=@EXTENSION_LIBUV_LDFLAGS@ C99COMPATFLAGS=@C99COMPATFLAGS@ GETDNS_OBJ=const-info.lo convert.lo dict.lo dnssec.lo general.lo \ - getdns_error.lo list.lo request-internal.lo \ - rr-dict.lo rr-iter.lo stub.lo sync.lo util-internal.lo + list.lo request-internal.lo rr-dict.lo rr-iter.lo stub.lo sync.lo \ + util-internal.lo GLDNS_OBJ=keyraw.lo gbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo \ str2wire.lo @@ -221,55 +221,62 @@ const-info.lo const-info.o: $(srcdir)/const-info.c getdns/getdns.h $(srcdir)/con context.lo context.o: $(srcdir)/context.c config.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/context.h \ getdns/getdns.h $(srcdir)/getdns/getdns_extra.h getdns/getdns.h $(srcdir)/types-internal.h \ $(srcdir)/util/rbtree.h $(srcdir)/extension/libmini_event.h config.h $(srcdir)/util/mini_event.h \ - $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/list.h -convert.lo convert.o: $(srcdir)/convert.c getdns/getdns.h $(srcdir)/util-internal.h $(srcdir)/context.h \ - $(srcdir)/getdns/getdns_extra.h getdns/getdns.h config.h $(srcdir)/types-internal.h \ + $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ + $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/gbuffer.h $(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/list.h +convert.lo convert.o: $(srcdir)/convert.c getdns/getdns.h $(srcdir)/getdns/getdns_extra.h \ + getdns/getdns.h $(srcdir)/util-internal.h $(srcdir)/context.h config.h $(srcdir)/types-internal.h \ $(srcdir)/util/rbtree.h $(srcdir)/extension/libmini_event.h config.h $(srcdir)/util/mini_event.h \ - $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/getdns_error.h $(srcdir)/gldns/wire2str.h \ - $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h + $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h \ + $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h dict.lo dict.o: $(srcdir)/dict.c $(srcdir)/types-internal.h getdns/getdns.h $(srcdir)/getdns/getdns_extra.h \ getdns/getdns.h $(srcdir)/util/rbtree.h $(srcdir)/util-internal.h $(srcdir)/context.h config.h \ $(srcdir)/extension/libmini_event.h config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ - $(srcdir)/types-internal.h $(srcdir)/dict.h $(srcdir)/rr-dict.h $(srcdir)/const-info.h $(srcdir)/gldns/gbuffer.h + $(srcdir)/types-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/gbuffer.h \ + $(srcdir)/dict.h $(srcdir)/const-info.h $(srcdir)/gldns/wire2str.h dnssec.lo dnssec.o: $(srcdir)/dnssec.c getdns/getdns.h config.h $(srcdir)/context.h \ $(srcdir)/getdns/getdns_extra.h getdns/getdns.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h \ $(srcdir)/extension/libmini_event.h config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ - $(srcdir)/types-internal.h $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/rr-dict.h + $(srcdir)/types-internal.h $(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h \ + $(srcdir)/gldns/gbuffer.h $(srcdir)/dnssec.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h \ + $(srcdir)/general.h general.lo general.o: $(srcdir)/general.c config.h $(srcdir)/context.h getdns/getdns.h \ $(srcdir)/getdns/getdns_extra.h getdns/getdns.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h \ $(srcdir)/extension/libmini_event.h config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ - $(srcdir)/types-internal.h $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/stub.h -getdns_error.lo getdns_error.o: $(srcdir)/getdns_error.c getdns/getdns.h $(srcdir)/const-info.h + $(srcdir)/types-internal.h $(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h \ + $(srcdir)/gldns/gbuffer.h $(srcdir)/dnssec.h $(srcdir)/stub.h list.lo list.o: $(srcdir)/list.c $(srcdir)/types-internal.h getdns/getdns.h $(srcdir)/getdns/getdns_extra.h \ getdns/getdns.h $(srcdir)/util/rbtree.h $(srcdir)/util-internal.h $(srcdir)/context.h config.h \ $(srcdir)/extension/libmini_event.h config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ - $(srcdir)/types-internal.h $(srcdir)/list.h + $(srcdir)/types-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/gbuffer.h \ + $(srcdir)/list.h request-internal.lo request-internal.o: $(srcdir)/request-internal.c config.h $(srcdir)/types-internal.h \ getdns/getdns.h $(srcdir)/getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h \ $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/extension/libmini_event.h config.h \ - $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/gldns/rrdef.h \ - $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h + $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ + $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h \ + $(srcdir)/gldns/rrdef.h rr-dict.lo rr-dict.o: $(srcdir)/rr-dict.c $(srcdir)/rr-dict.h getdns/getdns.h $(srcdir)/gldns/gbuffer.h \ $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/getdns/getdns_extra.h getdns/getdns.h config.h \ $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/extension/libmini_event.h config.h \ - $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/dict.h + $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/rr-iter.h \ + $(srcdir)/gldns/pkthdr.h $(srcdir)/dict.h rr-iter.lo rr-iter.o: $(srcdir)/rr-iter.c $(srcdir)/rr-iter.h getdns/getdns.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h \ $(srcdir)/gldns/gbuffer.h config.h stub.lo stub.o: $(srcdir)/stub.c config.h $(srcdir)/stub.h getdns/getdns.h $(srcdir)/types-internal.h \ $(srcdir)/getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h $(srcdir)/gldns/gbuffer.h \ $(srcdir)/gldns/pkthdr.h $(srcdir)/context.h $(srcdir)/extension/libmini_event.h config.h \ $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/util-internal.h \ - $(srcdir)/general.h + $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/general.h sync.lo sync.o: $(srcdir)/sync.c getdns/getdns.h config.h $(srcdir)/context.h $(srcdir)/getdns/getdns_extra.h \ getdns/getdns.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/extension/libmini_event.h \ config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/general.h \ - $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/gldns/wire2str.h + $(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/gbuffer.h \ + $(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/gldns/wire2str.h util-internal.lo util-internal.o: $(srcdir)/util-internal.c getdns/getdns.h $(srcdir)/dict.h $(srcdir)/util/rbtree.h \ $(srcdir)/types-internal.h $(srcdir)/getdns/getdns_extra.h getdns/getdns.h $(srcdir)/list.h \ $(srcdir)/util-internal.h $(srcdir)/context.h config.h $(srcdir)/extension/libmini_event.h config.h \ - $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/rr-iter.h + $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ + $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/str2wire.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 \ @@ -281,6 +288,15 @@ str2wire.lo str2wire.o: $(srcdir)/gldns/str2wire.c config.h $(srcdir)/gldns/str2 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 +sha512.lo sha512.o: $(srcdir)/compat/sha512.c config.h strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c config.h mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/fptr_wlist.h @@ -296,9 +312,10 @@ libmini_event.lo libmini_event.o: $(srcdir)/extension/libmini_event.c $(srcdir)/ config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h \ getdns/getdns.h $(srcdir)/getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h \ $(srcdir)/context.h config.h $(srcdir)/types-internal.h $(srcdir)/extension/libmini_event.h \ - $(srcdir)/util-internal.h $(srcdir)/context.h + $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h \ + $(srcdir)/gldns/gbuffer.h libuv.lo libuv.o: $(srcdir)/extension/libuv.c config.h $(srcdir)/getdns/getdns_ext_libuv.h \ getdns/getdns.h $(srcdir)/getdns/getdns_extra.h $(srcdir)/util-internal.h $(srcdir)/context.h \ getdns/getdns.h $(srcdir)/getdns/getdns_extra.h config.h $(srcdir)/types-internal.h \ $(srcdir)/util/rbtree.h $(srcdir)/extension/libmini_event.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ - $(srcdir)/types-internal.h + $(srcdir)/types-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/gbuffer.h diff --git a/src/const-info.c b/src/const-info.c index 16b0b8cb..d759765e 100644 --- a/src/const-info.c +++ b/src/const-info.c @@ -94,3 +94,15 @@ priv_getdns_get_const_info(int value) return consts_info; } +const char * +getdns_get_errorstr_by_id(uint16_t err) +{ + struct const_info key = { (int)err, "", "" }; + struct const_info *i = bsearch(&key, consts_info, + sizeof(consts_info) / sizeof(struct const_info), + sizeof(struct const_info), const_info_cmp); + if (i) + return i->text; + else + return NULL; +} diff --git a/src/convert.c b/src/convert.c index 1cfd6525..7d728495 100644 --- a/src/convert.c +++ b/src/convert.c @@ -39,8 +39,8 @@ #include #include #include "getdns/getdns.h" +#include "getdns/getdns_extra.h" #include "util-internal.h" -#include "getdns_error.h" #include "gldns/wire2str.h" #include "gldns/str2wire.h" @@ -200,16 +200,12 @@ getdns_display_ip_address(const struct getdns_bindata getdns_return_t getdns_strerror(getdns_return_t err, char *buf, size_t buflen) { - getdns_return_t retval = GETDNS_RETURN_GOOD; - const char *err_str = getdns_get_errorstr_by_id(err); - if (!err_str) { - return GETDNS_RETURN_GENERIC_ERROR; - } - snprintf(buf, buflen, "%s", err_str); + (void) snprintf(buf, buflen, "%s", + err_str ? error_str : "/* */"); - return retval; + return GETDNS_RETURN_GOOD; } /* getdns_strerror */ /* convert.c */ diff --git a/src/getdns/getdns.h.in b/src/getdns/getdns.h.in index c9aca6e6..d69139cc 100644 --- a/src/getdns/getdns.h.in +++ b/src/getdns/getdns.h.in @@ -482,16 +482,6 @@ typedef struct getdns_dict getdns_dict; */ typedef struct getdns_list getdns_list; -/** - * translate an error code to a string value, not in the original api description - * but seems like a nice thing to have - * @param err return code from GETDNS_RETURN_* defines - * @param buf buffer to which to copy the error string - * @param buflen length of buf - * @return GETDNS_RETURN_GOOD on success - */ -getdns_return_t getdns_strerror(getdns_return_t err, char *buf, size_t buflen); - /** * get the length of the specified list (returned in *answer) * @param this_list list of any of the supported data types diff --git a/src/getdns/getdns_extra.h b/src/getdns/getdns_extra.h index 8f2322a8..b7dec5aa 100644 --- a/src/getdns/getdns_extra.h +++ b/src/getdns/getdns_extra.h @@ -215,6 +215,16 @@ getdns_return_t getdns_context_set_update_callback(getdns_context *context, void *userarg, void (*value) (getdns_context *, getdns_context_code_t, void *)); +const char *getdns_get_errorstr_by_id(uint16_t err); + +/* WARNING! Function getdns_strerror is not in the API specification and + * is likely to be removed from future versions of our implementation, to be + * replaced by getdns_get_errorstr_by_id or something similar. + * Please use getdns_get_errorstr_by_id instead of getdns_strerror. + */ +getdns_return_t getdns_strerror(getdns_return_t err, char *buf, size_t buflen); + + #ifdef __cplusplus } #endif diff --git a/src/getdns_error.c b/src/getdns_error.c deleted file mode 100644 index 4c2fdfe5..00000000 --- a/src/getdns_error.c +++ /dev/null @@ -1,50 +0,0 @@ -/** - * \file getdns_error.c - * @brief getdns error code to string function - * - */ - -/* - * Copyright (c) 2013, 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 "getdns/getdns.h" -#include "const-info.h" - -/*---------------------------------------- getdns_get_errorstr_by_id() */ -/** - * return error string from getdns return - * @param err getdns_return_t - * @return string containing error message - */ - -const char * -getdns_get_errorstr_by_id(uint16_t err) -{ - return priv_getdns_get_const_info(err)->text; -} - -/* getdns_error.c */ diff --git a/src/getdns_error.h b/src/getdns_error.h deleted file mode 100644 index ef9bf114..00000000 --- a/src/getdns_error.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * \file - * @brief defines and data structure for getdns_error_str_by_id() - * - * This source was taken from the original pseudo-implementation by - * Paul Hoffman. - */ -/* - * Copyright (c) 2013, 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 GETDNS_ERROR_H -#define GETDNS_ERROR_H - -#include "getdns/getdns.h" - -const char *getdns_get_errorstr_by_id(uint16_t err); - -/** @} - */ - -#endif /* GETDNS_ERROR_H */ diff --git a/src/libgetdns.symbols b/src/libgetdns.symbols index 3a5a2eb4..e75fe44d 100644 --- a/src/libgetdns.symbols +++ b/src/libgetdns.symbols @@ -15,7 +15,6 @@ getdns_context_set_append_name getdns_context_set_append_name getdns_context_set_append_name getdns_context_set_append_name -getdns_strerror getdns_list_get_length getdns_list_get_data_type getdns_list_get_dict @@ -120,5 +119,8 @@ getdns_print_json_dict getdns_snprint_json_dict getdns_print_json_list getdns_snprint_json_list +getdns_context_set_update_callback +getdns_get_errorstr_by_id +getdns_strerror plain_mem_funcs_user_arg priv_getdns_context_mf diff --git a/src/mk-const-info.c.sh b/src/mk-const-info.c.sh index 9256d305..e9804193 100755 --- a/src/mk-const-info.c.sh +++ b/src/mk-const-info.c.sh @@ -31,6 +31,16 @@ priv_getdns_get_const_info(int value) return consts_info; } +const char * +getdns_get_errorstr_by_id(uint16_t err) +{ + struct const_info key = { (int)err, "", "" }; + struct const_info *i = bsearch(&key, consts_info, + sizeof(consts_info) / sizeof(struct const_info), + sizeof(struct const_info), const_info_cmp); + if (i) + return i->text; + else + return NULL; +} END_OF_TAIL - -