From 31a07752f07161ea460b1a568791f63aac95daeb Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 21 Oct 2015 17:02:50 +0200 Subject: [PATCH] New non API functions + consts in getdns_extra.h --- src/const-info.c | 2 ++ src/getdns/getdns.h.in | 25 +------------------------ src/getdns/getdns_extra.h.in | 22 ++++++++++++++++++++++ src/mk-const-info.c.sh | 5 +++-- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/const-info.c b/src/const-info.c index 7555c156..8cdb212a 100644 --- a/src/const-info.c +++ b/src/const-info.c @@ -3,6 +3,7 @@ */ #include #include "getdns/getdns.h" +#include "getdns/getdns_extra.h" #include "const-info.h" static struct const_info consts_info[] = { @@ -64,6 +65,7 @@ static struct const_info consts_info[] = { { 615, "GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS", GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS_TEXT }, { 616, "GETDNS_CONTEXT_CODE_TIMEOUT", GETDNS_CONTEXT_CODE_TIMEOUT_TEXT }, { 617, "GETDNS_CONTEXT_CODE_IDLE_TIMEOUT", GETDNS_CONTEXT_CODE_IDLE_TIMEOUT_TEXT }, + { 618, "GETDNS_CONTEXT_CODE_TLS_AUTHENTICATION", GETDNS_CONTEXT_CODE_TLS_AUTHENTICATION_TEXT }, { 700, "GETDNS_CALLBACK_COMPLETE", GETDNS_CALLBACK_COMPLETE_TEXT }, { 701, "GETDNS_CALLBACK_CANCEL", GETDNS_CALLBACK_CANCEL_TEXT }, { 702, "GETDNS_CALLBACK_TIMEOUT", GETDNS_CALLBACK_TIMEOUT_TEXT }, diff --git a/src/getdns/getdns.h.in b/src/getdns/getdns.h.in index d75fb00a..40539c06 100644 --- a/src/getdns/getdns.h.in +++ b/src/getdns/getdns.h.in @@ -208,23 +208,6 @@ typedef enum getdns_transport_list_t { */ -/* Authentication options used when doing TLS */ -typedef enum getdns_tls_authentication_t { - GETDNS_AUTHENTICATION_NONE = 1300, - GETDNS_AUTHENTICATION_HOSTNAME = 1301, -} getdns_tls_authentication_t; - -/** -* \defgroup Base authentication texts -* @{ -*/ -#define GETDNS_AUTHENTICATION_NONE_TEXT "See getdns_context_set_tls_authentication()" -#define GETDNS_AUTHENTICATION_HOSTNAME_TEXT "See getdns_context_set_tls_authentication()" -/** @} -*/ - - - /* Suffix appending methods */ typedef enum getdns_append_name_t { GETDNS_APPEND_NAME_ALWAYS = 550, @@ -264,8 +247,7 @@ typedef enum getdns_context_code_t { GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW = 614, GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS = 615, GETDNS_CONTEXT_CODE_TIMEOUT = 616, - GETDNS_CONTEXT_CODE_IDLE_TIMEOUT = 617, - GETDNS_CONTEXT_CODE_TLS_AUTHENTICATION = 618 + GETDNS_CONTEXT_CODE_IDLE_TIMEOUT = 617 } getdns_context_code_t; /** @@ -290,7 +272,6 @@ typedef enum getdns_context_code_t { #define GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS_TEXT "Change related to getdns_context_set_memory_functions" #define GETDNS_CONTEXT_CODE_TIMEOUT_TEXT "Change related to getdns_context_set_timeout" #define GETDNS_CONTEXT_CODE_IDLE_TIMEOUT_TEXT "Change related to getdns_context_set_idle_timeout" -#define GETDNS_CONTEXT_CODE_TLS_AUTHENTICATION_TEXT "Change related to getdns_context_set_tls_authentication" /** @} */ @@ -995,10 +976,6 @@ getdns_return_t getdns_context_set_dns_transport_list(getdns_context *context, size_t transport_count, getdns_transport_list_t *transports); -getdns_return_t -getdns_context_set_tls_authentication(getdns_context *context, - getdns_tls_authentication_t value); - getdns_return_t getdns_context_set_idle_timeout(getdns_context *context, uint64_t timeout); diff --git a/src/getdns/getdns_extra.h.in b/src/getdns/getdns_extra.h.in index 55c71254..6d335bd4 100644 --- a/src/getdns/getdns_extra.h.in +++ b/src/getdns/getdns_extra.h.in @@ -349,6 +349,28 @@ uint32_t getdns_get_version_number(void); const char *getdns_get_api_version(void); uint32_t getdns_get_api_version_number(void); +/* Authentication options used when doing TLS */ +typedef enum getdns_tls_authentication_t { + GETDNS_AUTHENTICATION_NONE = 1300, + GETDNS_AUTHENTICATION_HOSTNAME = 1301, +} getdns_tls_authentication_t; + +/** + * \defgroup Base authentication texts + * @{ + */ +#define GETDNS_AUTHENTICATION_NONE_TEXT "See getdns_context_set_tls_authentication()" +#define GETDNS_AUTHENTICATION_HOSTNAME_TEXT "See getdns_context_set_tls_authentication()" +/** @} + */ + +#define GETDNS_CONTEXT_CODE_TLS_AUTHENTICATION 618 +#define GETDNS_CONTEXT_CODE_TLS_AUTHENTICATION_TEXT "Change related to getdns_context_set_tls_authentication" + +getdns_return_t +getdns_context_set_tls_authentication( + getdns_context *context, getdns_tls_authentication_t value); + #ifdef __cplusplus } #endif diff --git a/src/mk-const-info.c.sh b/src/mk-const-info.c.sh index e9804193..dd5d35a8 100755 --- a/src/mk-const-info.c.sh +++ b/src/mk-const-info.c.sh @@ -6,12 +6,13 @@ cat > const-info.c << END_OF_HEAD */ #include #include "getdns/getdns.h" +#include "getdns/getdns_extra.h" #include "const-info.h" static struct const_info consts_info[] = { { -1, NULL, "/* */" }, END_OF_HEAD -awk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ print "\t{ "$3", \""$1"\", "$1"_TEXT }," }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/^#define GETDNS_RRCLASS/ && !/^#define GETDNS_OPCODE/ && !/^#define GETDNS_RCODE/ && !/_TEXT/{ print "\t{ "$3", \""$2"\", "$2"_TEXT },"}' getdns/getdns.h.in | sed 's/,,/,/g' >> const-info.c +gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ consts[$3] = $1; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/^#define GETDNS_RRCLASS/ && !/^#define GETDNS_OPCODE/ && !/^#define GETDNS_RCODE/ && !/_TEXT/{ consts[$3] = $2; }END{ n = asorti(consts, const_vals, "@ind_num_asc"); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ "val", \""name"\", "name"_TEXT },"}}' getdns/getdns.h.in getdns/getdns_extra.h.in | sed 's/,,/,/g' >> const-info.c cat >> const-info.c << END_OF_TAIL }; @@ -20,7 +21,7 @@ static int const_info_cmp(const void *a, const void *b) return ((struct const_info *) a)->code - ((struct const_info *) b)->code; } struct const_info * -priv_getdns_get_const_info(int value) +_getdns_get_const_info(int value) { struct const_info key = { value, "", "" }; struct const_info *i = bsearch(&key, consts_info,