From: W.C.A. Wijngaards Date: Mon, 29 Nov 2021 15:10:45 +0000 (+0100) Subject: - Fix #576: [FR] UB_* error codes in unbound.h X-Git-Tag: release-1.14.0rc1~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b5dbb0282e702846c3fd30b2215fd026d97b4de1;p=thirdparty%2Funbound.git - Fix #576: [FR] UB_* error codes in unbound.h --- diff --git a/doc/Changelog b/doc/Changelog index e1bbb6a7e..04c495e97 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,7 @@ - Fix #574: unbound-checkconf reports fatal error if interface names are used as value for interfaces: - Fix #574: Review fixes for it. + - Fix #576: [FR] UB_* error codes in unbound.h 15 November 2021: Tom - Improve EDNS option handling, now also works for synthesised diff --git a/libunbound/context.h b/libunbound/context.h index 78f8731e2..c0c86fb52 100644 --- a/libunbound/context.h +++ b/libunbound/context.h @@ -176,35 +176,6 @@ struct ctx_query { struct ub_result* res; }; -/** - * The error constants - */ -enum ub_ctx_err { - /** no error */ - UB_NOERROR = 0, - /** socket operation. Set to -1, so that if an error from _fd() is - * passed (-1) it gives a socket error. */ - UB_SOCKET = -1, - /** alloc failure */ - UB_NOMEM = -2, - /** syntax error */ - UB_SYNTAX = -3, - /** DNS service failed */ - UB_SERVFAIL = -4, - /** fork() failed */ - UB_FORKFAIL = -5, - /** cfg change after finalize() */ - UB_AFTERFINAL = -6, - /** initialization failed (bad settings) */ - UB_INITFAIL = -7, - /** error in pipe communication with async bg worker */ - UB_PIPE = -8, - /** error reading from file (resolv.conf) */ - UB_READFILE = -9, - /** error async_id does not exist or result already been delivered */ - UB_NOID = -10 -}; - /** * Command codes for libunbound pipe. * diff --git a/libunbound/unbound.h b/libunbound/unbound.h index 2a12511bd..ee8558759 100644 --- a/libunbound/unbound.h +++ b/libunbound/unbound.h @@ -232,6 +232,35 @@ struct ub_result { */ typedef void (*ub_callback_type)(void*, int, struct ub_result*); +/** + * The error constants + */ +enum ub_ctx_err { + /** no error */ + UB_NOERROR = 0, + /** socket operation. Set to -1, so that if an error from _fd() is + * passed (-1) it gives a socket error. */ + UB_SOCKET = -1, + /** alloc failure */ + UB_NOMEM = -2, + /** syntax error */ + UB_SYNTAX = -3, + /** DNS service failed */ + UB_SERVFAIL = -4, + /** fork() failed */ + UB_FORKFAIL = -5, + /** cfg change after finalize() */ + UB_AFTERFINAL = -6, + /** initialization failed (bad settings) */ + UB_INITFAIL = -7, + /** error in pipe communication with async bg worker */ + UB_PIPE = -8, + /** error reading from file (resolv.conf) */ + UB_READFILE = -9, + /** error async_id does not exist or result already been delivered */ + UB_NOID = -10 +}; + /** * Create a resolving and validation context. * The information from /etc/resolv.conf and /etc/hosts is not utilised by @@ -563,6 +592,7 @@ void ub_resolve_free(struct ub_result* result); /** * Convert error value to a human readable string. * @param err: error code from one of the libunbound functions. + * The error codes are from the type enum ub_ctx_err. * @return pointer to constant text string, zero terminated. */ const char* ub_strerror(int err);