From 20853601a69da993b73ba218359583b4a5063e73 Mon Sep 17 00:00:00 2001 From: Willem Toorop <willem@nlnetlabs.nl> Date: Sun, 9 Feb 2014 17:46:12 +0100 Subject: [PATCH] use enum types where possible following API 0.387 (commit 13571e02f1560a6acf43593161a61fd9bf986d10) --- src/context.c | 78 +++--- src/context.h | 15 +- src/example/example-all-functions.c | 19 +- src/example/example-reverse.c | 2 +- src/example/example-simple-answers.c | 2 +- src/example/example-tree.c | 2 +- src/getdns/getdns.h | 251 ++++++++++++------ src/test/check_getdns_cancel_callback.h | 10 +- src/test/check_getdns_common.h | 4 +- ...tdns_context_set_context_update_callback.h | 14 +- .../check_getdns_context_set_dns_transport.h | 8 +- src/test/check_getdns_context_set_timeout.c | 4 +- src/test/tests_dnssec.c | 3 +- src/test/tests_stub_async.c | 4 +- src/test/tests_stub_sync.c | 2 +- 15 files changed, 252 insertions(+), 166 deletions(-) diff --git a/src/context.c b/src/context.c index cbd85b84..acc6581c 100644 --- a/src/context.c +++ b/src/context.c @@ -50,7 +50,8 @@ void *plain_mem_funcs_user_arg = MF_PLAIN; /* Private functions */ -static uint16_t *create_default_namespaces(struct getdns_context *context); +static getdns_namespace_t *create_default_namespaces( + struct getdns_context *context); static struct getdns_list *create_default_root_servers(); static getdns_return_t add_ip_str(struct getdns_dict *); static struct getdns_dict *create_ipaddr_dict_from_rdf(struct getdns_context *, @@ -75,13 +76,14 @@ static void cancel_outstanding_requests(struct getdns_context*, int); * Helper to get default lookup namespaces. * TODO: Determine from OS */ -static uint16_t * +static getdns_namespace_t* create_default_namespaces(struct getdns_context *context) { - uint16_t *result = GETDNS_XMALLOC(context->my_mf, uint16_t, 2); - result[0] = GETDNS_CONTEXT_NAMESPACE_LOCALNAMES; - result[1] = GETDNS_CONTEXT_NAMESPACE_DNS; - return result; + getdns_namespace_t *result = GETDNS_XMALLOC( + context->my_mf, getdns_namespace_t, 2); + result[0] = GETDNS_NAMESPACE_LOCALNAMES; + result[1] = GETDNS_NAMESPACE_DNS; + return result; } /** @@ -337,13 +339,13 @@ getdns_context_create_with_extended_memory_functions( result->outbound_requests = ldns_rbtree_create(transaction_id_cmp); - result->resolution_type = GETDNS_CONTEXT_RECURSING; + result->resolution_type = GETDNS_RESOLUTION_RECURSING; result->namespaces = create_default_namespaces(result); result->timeout = 5000; - result->follow_redirects = GETDNS_CONTEXT_FOLLOW_REDIRECTS; + result->follow_redirects = GETDNS_REDIRECTS_FOLLOW; result->dns_root_servers = create_default_root_servers(); - result->append_name = GETDNS_CONTEXT_APPEND_NAME_ALWAYS; + result->append_name = GETDNS_APPEND_NAME_ALWAYS; result->suffix = NULL; result->dnssec_trust_anchors = NULL; @@ -371,7 +373,7 @@ getdns_context_create_with_extended_memory_functions( getdns_context_set_dnssec_allowed_skew(result, 0); getdns_context_set_edns_maximum_udp_payload_size(result, 512); getdns_context_set_dns_transport(result, - GETDNS_CONTEXT_UDP_FIRST_AND_FALL_BACK_TO_TCP); + GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP); return GETDNS_RETURN_GOOD; } /* getdns_context_create */ @@ -451,8 +453,8 @@ getdns_context_destroy(struct getdns_context *context) */ getdns_return_t getdns_context_set_context_update_callback(struct getdns_context *context, - void (*value) (struct getdns_context *context, uint16_t changed_item) - ) + void (*value) (struct getdns_context *context, + getdns_context_code_t changed_item)) { RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); context->update_callback = value; @@ -504,10 +506,11 @@ dispatch_updated(struct getdns_context *context, uint16_t item) * */ getdns_return_t -getdns_context_set_resolution_type(struct getdns_context *context, uint16_t value) +getdns_context_set_resolution_type(struct getdns_context *context, + getdns_resolution_t value) { RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); - if (value != GETDNS_CONTEXT_STUB && value != GETDNS_CONTEXT_RECURSING) { + if (value != GETDNS_RESOLUTION_STUB && value != GETDNS_RESOLUTION_RECURSING) { return GETDNS_RETURN_CONTEXT_UPDATE_FAIL; } @@ -524,7 +527,7 @@ getdns_context_set_resolution_type(struct getdns_context *context, uint16_t valu */ getdns_return_t getdns_context_set_namespaces(struct getdns_context *context, - size_t namespace_count, uint16_t * namespaces) + size_t namespace_count, getdns_namespace_t *namespaces) { RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); if (namespace_count == 0 || namespaces == NULL) { @@ -535,10 +538,10 @@ getdns_context_set_namespaces(struct getdns_context *context, GETDNS_FREE(context->my_mf, context->namespaces); /** duplicate **/ - context->namespaces = GETDNS_XMALLOC(context->my_mf, uint16_t, + context->namespaces = GETDNS_XMALLOC(context->my_mf, getdns_namespace_t, namespace_count); memcpy(context->namespaces, namespaces, - namespace_count * sizeof(uint16_t)); + namespace_count * sizeof(getdns_namespace_t)); dispatch_updated(context, GETDNS_CONTEXT_CODE_NAMESPACES); @@ -550,19 +553,20 @@ getdns_context_set_namespaces(struct getdns_context *context, * */ getdns_return_t -getdns_context_set_dns_transport(struct getdns_context *context, uint16_t value) +getdns_context_set_dns_transport(struct getdns_context *context, + getdns_transport_t value) { RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); switch (value) { - case GETDNS_CONTEXT_UDP_FIRST_AND_FALL_BACK_TO_TCP: + case GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP: set_ub_string_opt(context, "do-udp", "yes"); set_ub_string_opt(context, "do-tcp", "yes"); break; - case GETDNS_CONTEXT_UDP_ONLY: + case GETDNS_TRANSPORT_UDP_ONLY: set_ub_string_opt(context, "do-udp", "yes"); set_ub_string_opt(context, "do-tcp", "no"); break; - case GETDNS_CONTEXT_TCP_ONLY: + case GETDNS_TRANSPORT_TCP_ONLY: set_ub_string_opt(context, "do-udp", "no"); set_ub_string_opt(context, "do-tcp", "yes"); break; @@ -599,7 +603,7 @@ getdns_context_set_limit_outstanding_queries(struct getdns_context *context, * */ getdns_return_t -getdns_context_set_timeout(struct getdns_context *context, uint16_t timeout) +getdns_context_set_timeout(struct getdns_context *context, uint64_t timeout) { RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); @@ -619,12 +623,13 @@ getdns_context_set_timeout(struct getdns_context *context, uint16_t timeout) * */ getdns_return_t -getdns_context_set_follow_redirects(struct getdns_context *context, uint16_t value) +getdns_context_set_follow_redirects(struct getdns_context *context, + getdns_redirects_t value) { RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); context->follow_redirects = value; - clear_resolution_type_set_flag(context, GETDNS_CONTEXT_RECURSING); + clear_resolution_type_set_flag(context, GETDNS_RESOLUTION_RECURSING); dispatch_updated(context, GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS); return GETDNS_RETURN_GOOD; @@ -672,7 +677,7 @@ getdns_context_set_dns_root_servers(struct getdns_context *context, getdns_list_destroy(context->dns_root_servers); context->dns_root_servers = addresses; - clear_resolution_type_set_flag(context, GETDNS_CONTEXT_RECURSING); + clear_resolution_type_set_flag(context, GETDNS_RESOLUTION_RECURSING); dispatch_updated(context, GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS); @@ -684,15 +689,14 @@ getdns_context_set_dns_root_servers(struct getdns_context *context, * */ getdns_return_t -getdns_context_set_append_name(struct getdns_context *context, uint16_t value) +getdns_context_set_append_name(struct getdns_context *context, + getdns_append_name_t value) { RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); - if (value != GETDNS_CONTEXT_APPEND_NAME_ALWAYS && - value != - GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE - && value != - GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE - && value != GETDNS_CONTEXT_DO_NOT_APPEND_NAMES) { + if (value != GETDNS_APPEND_NAME_ALWAYS && + value != GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE && + value != GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE + && value != GETDNS_APPEND_NAME_NEVER) { return GETDNS_RETURN_CONTEXT_UPDATE_FAIL; } @@ -721,7 +725,7 @@ getdns_context_set_suffix(struct getdns_context *context, struct getdns_list * v getdns_list_destroy(context->suffix); context->suffix = value; - clear_resolution_type_set_flag(context, GETDNS_CONTEXT_STUB); + clear_resolution_type_set_flag(context, GETDNS_RESOLUTION_STUB); dispatch_updated(context, GETDNS_CONTEXT_CODE_SUFFIX); @@ -758,7 +762,7 @@ getdns_context_set_dnssec_trust_anchors(struct getdns_context *context, */ getdns_return_t getdns_context_set_dnssec_allowed_skew(struct getdns_context *context, - uint16_t value) + uint32_t value) { RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); set_ub_number_opt(context, "val-sig-skew-min", value); @@ -806,7 +810,7 @@ getdns_context_set_upstream_recursive_servers(struct getdns_context *context, getdns_list_destroy(context->upstream_list); context->upstream_list = upstream_list; - clear_resolution_type_set_flag(context, GETDNS_CONTEXT_STUB); + clear_resolution_type_set_flag(context, GETDNS_RESOLUTION_STUB); dispatch_updated(context, GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS); @@ -1084,7 +1088,7 @@ getdns_context_prepare_for_resolution(struct getdns_context *context) */ return GETDNS_RETURN_GOOD; } - if (context->resolution_type == GETDNS_CONTEXT_STUB) { + if (context->resolution_type == GETDNS_RESOLUTION_STUB) { size_t upstream_len = 0; getdns_return_t r = getdns_list_get_length(context->upstream_list, @@ -1098,7 +1102,7 @@ getdns_context_prepare_for_resolution(struct getdns_context *context) /* use /etc/hosts */ ub_ctx_hosts(context->unbound_ctx, NULL); - } else if (context->resolution_type == GETDNS_CONTEXT_RECURSING) { + } else if (context->resolution_type == GETDNS_RESOLUTION_RECURSING) { /* set recursive */ /* TODO: use the root servers via root hints file */ ub_ctx_set_fwd(context->unbound_ctx, NULL); diff --git a/src/context.h b/src/context.h index e34d555f..d51cae2f 100644 --- a/src/context.h +++ b/src/context.h @@ -45,17 +45,18 @@ struct ldns_rbtree_t; struct ub_ctx; /** function pointer typedefs */ -typedef void (*getdns_update_callback) (struct getdns_context *, uint16_t); +typedef void (*getdns_update_callback) (struct getdns_context *, + getdns_context_code_t); struct getdns_context { /* Context values */ - uint16_t resolution_type; - uint16_t *namespaces; - uint16_t timeout; - uint16_t follow_redirects; - struct getdns_list *dns_root_servers; - uint16_t append_name; + getdns_resolution_t resolution_type; + getdns_namespace_t *namespaces; + uint64_t timeout; + getdns_redirects_t follow_redirects; + struct getdns_list *dns_root_servers; + getdns_append_name_t append_name; struct getdns_list *suffix; struct getdns_list *dnssec_trust_anchors; struct getdns_list *upstream_list; diff --git a/src/example/example-all-functions.c b/src/example/example-all-functions.c index ed046cee..75abaaad 100644 --- a/src/example/example-all-functions.c +++ b/src/example/example-all-functions.c @@ -19,6 +19,11 @@ uint16_t regulararg; uint16_t *regularptrarg; getdns_transaction_t txidarg; getdns_transaction_t * txidptrarg; +getdns_namespace_t *namespaceptrarg; +getdns_resolution_t resolutionarg; +getdns_redirects_t redirectsarg; +getdns_transport_t transportarg; +getdns_append_name_t appendnamearg; getdns_data_type * datatypeptrarg; struct getdns_bindata ** bindataptrarg; @@ -49,7 +54,7 @@ void * extendedreallocfunctionarg(void* userarg, void* foo, size_t bar) {UNUSED_PARAM(userarg); UNUSED_PARAM(foo); UNUSED_PARAM(bar); return NULL; } void extendeddeallocfunctionarg(void* userarg, void* foo) {UNUSED_PARAM(userarg); UNUSED_PARAM(foo);} -void setcallbackfunctionarg(struct getdns_context *foo1, uint16_t foo2) +void setcallbackfunctionarg(struct getdns_context *foo1, getdns_context_code_t foo2) {UNUSED_PARAM(foo1);UNUSED_PARAM(foo2);} int main() @@ -222,7 +227,7 @@ retcharstar = getdns_convert_alabel_to_ulabel( ); retregular = getdns_validate_dnssec( - bindataarg, + listarg, listarg, listarg ); @@ -242,18 +247,18 @@ retregular = getdns_context_set_context_update_callback( retregular = getdns_context_set_resolution_type( contextarg, - regulararg + resolutionarg ); retregular = getdns_context_set_namespaces( contextarg, sizetarg, - regularptrarg + namespaceptrarg ); retregular = getdns_context_set_dns_transport( contextarg, - regulararg + transportarg ); retregular = getdns_context_set_limit_outstanding_queries( @@ -268,7 +273,7 @@ retregular = getdns_context_set_timeout( retregular = getdns_context_set_follow_redirects( contextarg, - regulararg + redirectsarg ); retregular = getdns_context_set_dns_root_servers( @@ -278,7 +283,7 @@ retregular = getdns_context_set_dns_root_servers( retregular = getdns_context_set_append_name( contextarg, - regulararg + appendnamearg ); retregular = getdns_context_set_suffix( diff --git a/src/example/example-reverse.c b/src/example/example-reverse.c index c62adf86..b380b925 100644 --- a/src/example/example-reverse.c +++ b/src/example/example-reverse.c @@ -15,7 +15,7 @@ /* Set up the callback function, which will also do the processing of the results */ void this_callbackfn(struct getdns_context *this_context, - uint16_t this_callback_type, + getdns_callback_type_t this_callback_type, struct getdns_dict *this_response, void *this_userarg, getdns_transaction_t this_transaction_id) diff --git a/src/example/example-simple-answers.c b/src/example/example-simple-answers.c index 2f3efd04..722c3c5a 100644 --- a/src/example/example-simple-answers.c +++ b/src/example/example-simple-answers.c @@ -51,7 +51,7 @@ /* Set up the callback function, which will also do the processing of the results */ void this_callbackfn(struct getdns_context *this_context, - uint16_t this_callback_type, + getdns_callback_type_t this_callback_type, struct getdns_dict *this_response, void *this_userarg, getdns_transaction_t this_transaction_id) diff --git a/src/example/example-tree.c b/src/example/example-tree.c index c10d635d..a765393b 100644 --- a/src/example/example-tree.c +++ b/src/example/example-tree.c @@ -15,7 +15,7 @@ /* Set up the callback function, which will also do the processing of the results */ void this_callbackfn(struct getdns_context *this_context, - getdns_return_t this_callback_type, + getdns_callback_type_t this_callback_type, struct getdns_dict *this_response, void *this_userarg, getdns_transaction_t this_transaction_id) diff --git a/src/getdns/getdns.h b/src/getdns/getdns.h index 68cc0695..1e99f774 100644 --- a/src/getdns/getdns.h +++ b/src/getdns/getdns.h @@ -45,41 +45,46 @@ extern "C" { #define GETDNS_COMPILATION_COMMENT The API implementation should fill in something here, such as a compilation version string and date, and change it each time the API is compiled. +/* Return values */ +typedef enum getdns_return_t { + GETDNS_RETURN_GOOD = 0, + GETDNS_RETURN_GENERIC_ERROR = 1, + GETDNS_RETURN_BAD_DOMAIN_NAME = 300, + GETDNS_RETURN_BAD_CONTEXT = 301, + GETDNS_RETURN_CONTEXT_UPDATE_FAIL = 302, + GETDNS_RETURN_UNKNOWN_TRANSACTION = 303, + GETDNS_RETURN_NO_SUCH_LIST_ITEM = 304, + GETDNS_RETURN_NO_SUCH_DICT_NAME = 305, + GETDNS_RETURN_WRONG_TYPE_REQUESTED = 306, + GETDNS_RETURN_NO_SUCH_EXTENSION = 307, + GETDNS_RETURN_EXTENSION_MISFORMAT = 308, + GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED = 309, + GETDNS_RETURN_MEMORY_ERROR = 310, + GETDNS_RETURN_INVALID_PARAMETER = 311 +} getdns_return_t; + /** - * \defgroup returnvalues return values + * \defgroup Return values texts * @{ */ -#define GETDNS_RETURN_GOOD 0 #define GETDNS_RETURN_GOOD_TEXT "Good" -#define GETDNS_RETURN_GENERIC_ERROR 1 #define GETDNS_RETURN_GENERIC_ERROR_TEXT "Generic error" -#define GETDNS_RETURN_BAD_DOMAIN_NAME 300 #define GETDNS_RETURN_BAD_DOMAIN_NAME_TEXT "Badly-formed domain name in first argument" -#define GETDNS_RETURN_BAD_CONTEXT 301 #define GETDNS_RETURN_BAD_CONTEXT_TEXT "Bad value for a context type" -#define GETDNS_RETURN_CONTEXT_UPDATE_FAIL 302 #define GETDNS_RETURN_CONTEXT_UPDATE_FAIL_TEXT "Did not update the context" -#define GETDNS_RETURN_UNKNOWN_TRANSACTION 303 #define GETDNS_RETURN_UNKNOWN_TRANSACTION_TEXT "An attempt was made to cancel a callback with a transaction_id that is not recognized" -#define GETDNS_RETURN_NO_SUCH_LIST_ITEM 304 #define GETDNS_RETURN_NO_SUCH_LIST_ITEM_TEXT "A helper function for lists had an index argument that was too high." -#define GETDNS_RETURN_NO_SUCH_DICT_NAME 305 #define GETDNS_RETURN_NO_SUCH_DICT_NAME_TEXT "A helper function for dicts had a name argument that for a name that is not in the dict." -#define GETDNS_RETURN_WRONG_TYPE_REQUESTED 306 #define GETDNS_RETURN_WRONG_TYPE_REQUESTED_TEXT "A helper function was supposed to return a certain type for an item, but the wrong type was given." -#define GETDNS_RETURN_NO_SUCH_EXTENSION 307 #define GETDNS_RETURN_NO_SUCH_EXTENSION_TEXT "A name in the extensions dict is not a valid extension." -#define GETDNS_RETURN_EXTENSION_MISFORMAT 308 #define GETDNS_RETURN_EXTENSION_MISFORMAT_TEXT "One or more of the extensions have a bad format." -#define GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED 309 #define GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED_TEXT "A query was made with a context that is using stub resolution and a DNSSEC extension specified." -#define GETDNS_RETURN_MEMORY_ERROR 310 #define GETDNS_RETURN_MEMORY_ERROR_TEXT "Unable to allocate the memory required." -#define GETDNS_RETURN_INVALID_PARAMETER 311 #define GETDNS_RETURN_INVALID_PARAMETER_TEXT "A required parameter had an invalid value." /** @} */ + /** * \defgroup dnssecvalues DNSSEC values * @{ @@ -94,100 +99,165 @@ extern "C" { #define GETDNS_DNSSEC_INSECURE_TEXT "The record was determined to be insecure in DNSSEC" #define GETDNS_DNSSEC_NOT_PERFORMED 404 #define GETDNS_DNSSEC_NOT_PERFORMED_TEXT "DNSSEC validation was not performed (only used for debugging)" - -/** - * \defgroup contextvars Context variables - * @{ - */ -#define GETDNS_CONTEXT_NAMESPACE_DNS 500 -#define GETDNS_CONTEXT_NAMESPACE_DNS_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_CONTEXT_NAMESPACE_LOCALNAMES 501 -#define GETDNS_CONTEXT_NAMESPACE_LOCALNAMES_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_CONTEXT_NAMESPACE_NETBIOS 502 -#define GETDNS_CONTEXT_NAMESPACE_NETBIOS_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_CONTEXT_NAMESPACE_MDNS 503 -#define GETDNS_CONTEXT_NAMESPACE_MDNS_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_CONTEXT_NAMESPACE_NIS 504 -#define GETDNS_CONTEXT_NAMESPACE_NIS_TEXT "See getdns_context_set_namespaces()" -#define GETDNS_CONTEXT_STUB 505 -#define GETDNS_CONTEXT_STUB_TEXT "See getdns_context_set_resolution_type()" -#define GETDNS_CONTEXT_RECURSING 506 -#define GETDNS_CONTEXT_RECURSING_TEXT "See getdns_context_set_resolution_type()" -#define GETDNS_CONTEXT_FOLLOW_REDIRECTS 507 -#define GETDNS_CONTEXT_FOLLOW_REDIRECTS_TEXT "See getdns_context_set_follow_redirects()" -#define GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS 508 -#define GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS_TEXT "See getdns_context_set_follow_redirects()" -#define GETDNS_CONTEXT_UDP_FIRST_AND_FALL_BACK_TO_TCP 509 -#define GETDNS_CONTEXT_UDP_FIRST_AND_FALL_BACK_TO_TCP_TEXT "See getdns_context_set_dns_transport()" -#define GETDNS_CONTEXT_UDP_ONLY 510 -#define GETDNS_CONTEXT_UDP_ONLY_TEXT "See getdns_context_set_dns_transport()" -#define GETDNS_CONTEXT_TCP_ONLY 511 -#define GETDNS_CONTEXT_TCP_ONLY_TEXT "See getdns_context_set_dns_transport()" -#define GETDNS_CONTEXT_TCP_ONLY_KEEP_CONNECTIONS_OPEN 512 -#define GETDNS_CONTEXT_TCP_ONLY_KEEP_CONNECTIONS_OPEN_TEXT "See getdns_context_set_dns_transport()" -#define GETDNS_CONTEXT_APPEND_NAME_ALWAYS 513 -#define GETDNS_CONTEXT_APPEND_NAME_ALWAYS_TEXT "See getdns_context_set_append_name()" -#define GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE 514 -#define GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()" -#define GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE 515 -#define GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()" -#define GETDNS_CONTEXT_DO_NOT_APPEND_NAMES 516 -#define GETDNS_CONTEXT_DO_NOT_APPEND_NAMES_TEXT "See getdns_context_set_append_name()" /** @} */ + +/* Namespace types */ +typedef enum getdns_namespace_t { + GETDNS_NAMESPACE_DNS = 500, + GETDNS_NAMESPACE_LOCALNAMES = 501, + GETDNS_NAMESPACE_NETBIOS = 502, + GETDNS_NAMESPACE_MDNS = 503, + GETDNS_NAMESPACE_NIS = 504 +} getdns_namespace_t; + /** - * \defgroup contextcodes Context codes for getdns_context_set_context_update_callback() + * \defgroup Namespace types texts + * @{ + */ +#define GETDNS_NAMESPACE_DNS_TEXT "See getdns_context_set_namespaces()" +#define GETDNS_NAMESPACE_LOCALNAMES_TEXT "See getdns_context_set_namespaces()" +#define GETDNS_NAMESPACE_NETBIOS_TEXT "See getdns_context_set_namespaces()" +#define GETDNS_NAMESPACE_MDNS_TEXT "See getdns_context_set_namespaces()" +#define GETDNS_NAMESPACE_NIS_TEXT "See getdns_context_set_namespaces()" +/** @} + */ + + +/* Resolution types */ +typedef enum getdns_resolution_t { + GETDNS_RESOLUTION_STUB = 520, + GETDNS_RESOLUTION_RECURSING = 521 +} getdns_resolution_t; + +/** + * \defgroup Resolution types texts + * @{ + */ +#define GETDNS_RESOLUTION_STUB_TEXT "See getdns_context_set_resolution_type()" +#define GETDNS_RESOLUTION_RECURSING_TEXT "See getdns_context_set_resolution_type()" +/** @} + */ + + +/* Redirect policies */ +typedef enum getdns_redirects_t { + GETDNS_REDIRECTS_FOLLOW = 530, + GETDNS_REDIRECTS_DO_NOT_FOLLOW = 531 +} getdns_redirects_t; + +/** + * \defgroup Redirect policies texts + * @{ + */ +#define GETDNS_REDIRECTS_FOLLOW_TEXT "See getdns_context_set_follow_redirects()" +#define GETDNS_REDIRECTS_DO_NOT_FOLLOW_TEXT "See getdns_context_set_follow_redirects()" +/** @} + */ + + +/* Transport arrangements */ +typedef enum getdns_transport_t { + GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP = 540, + GETDNS_TRANSPORT_UDP_ONLY = 541, + GETDNS_TRANSPORT_TCP_ONLY = 542, + GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN = 543 +} getdns_transport_t; + +/** + * \defgroup Transport arrangements texts + * @{ + */ +#define GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP_TEXT "See getdns_context_set_dns_transport()" +#define GETDNS_TRANSPORT_UDP_ONLY_TEXT "See getdns_context_set_dns_transport()" +#define GETDNS_TRANSPORT_TCP_ONLY_TEXT "See getdns_context_set_dns_transport()" +#define GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN_TEXT "See getdns_context_set_dns_transport()" +/** @} + */ + + +/* Suffix appending methods */ +typedef enum getdns_append_name_t { + GETDNS_APPEND_NAME_ALWAYS = 550, + GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE = 551, + GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE = 552, + GETDNS_APPEND_NAME_NEVER = 553 +} getdns_append_name_t; + +/** + * \defgroup Suffix appending methods texts + * @{ + */ +#define GETDNS_APPEND_NAME_ALWAYS_TEXT "See getdns_context_set_append_name()" +#define GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()" +#define GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE_TEXT "See getdns_context_set_append_name()" +#define GETDNS_APPEND_NAME_NEVER_TEXT "See getdns_context_set_append_name()" +/** @} + */ + + +/* Context codes */ +typedef enum getdns_context_code_t { + GETDNS_CONTEXT_CODE_NAMESPACES = 600, + GETDNS_CONTEXT_CODE_RESOLUTION_TYPE = 601, + GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS = 602, + GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS = 603, + GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS = 604, + GETDNS_CONTEXT_CODE_DNS_TRANSPORT = 605, + GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES = 606, + GETDNS_CONTEXT_CODE_APPEND_NAME = 607, + GETDNS_CONTEXT_CODE_SUFFIX = 608, + GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS = 609, + GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE = 610, + GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE = 611, + GETDNS_CONTEXT_CODE_EDNS_VERSION = 612, + GETDNS_CONTEXT_CODE_EDNS_DO_BIT = 613, + GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW = 614, + GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS = 615, + GETDNS_CONTEXT_CODE_TIMEOUT = 616 +} getdns_context_code_t; + +/** + * \defgroup Context codes texts * @{ */ -#define GETDNS_CONTEXT_CODE_NAMESPACES 600 #define GETDNS_CONTEXT_CODE_NAMESPACES_TEXT "Change related to getdns_context_set_namespaces" -#define GETDNS_CONTEXT_CODE_RESOLUTION_TYPE 601 #define GETDNS_CONTEXT_CODE_RESOLUTION_TYPE_TEXT "Change related to getdns_context_set_resolution_type" -#define GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS 602 #define GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS_TEXT "Change related to getdns_context_set_follow_redirects" -#define GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS 603 #define GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS_TEXT "Change related to getdns_context_set_upstream_recursive_servers" -#define GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS 604 #define GETDNS_CONTEXT_CODE_DNS_ROOT_SERVERS_TEXT "Change related to getdns_context_set_dns_root_servers" -#define GETDNS_CONTEXT_CODE_DNS_TRANSPORT 605 #define GETDNS_CONTEXT_CODE_DNS_TRANSPORT_TEXT "Change related to getdns_context_set_dns_transport" -#define GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES 606 #define GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES_TEXT "Change related to getdns_context_set_limit_outstanding_queries" -#define GETDNS_CONTEXT_CODE_APPEND_NAME 607 #define GETDNS_CONTEXT_CODE_APPEND_NAME_TEXT "Change related to getdns_context_set_append_name" -#define GETDNS_CONTEXT_CODE_SUFFIX 608 #define GETDNS_CONTEXT_CODE_SUFFIX_TEXT "Change related to getdns_context_set_suffix" -#define GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS 609 #define GETDNS_CONTEXT_CODE_DNSSEC_TRUST_ANCHORS_TEXT "Change related to getdns_context_set_dnssec_trust_anchors" -#define GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE 610 #define GETDNS_CONTEXT_CODE_EDNS_MAXIMUM_UDP_PAYLOAD_SIZE_TEXT "Change related to getdns_context_set_edns_maximum_udp_payload_size" -#define GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE 611 #define GETDNS_CONTEXT_CODE_EDNS_EXTENDED_RCODE_TEXT "Change related to getdns_context_set_edns_extended_rcode" -#define GETDNS_CONTEXT_CODE_EDNS_VERSION 612 #define GETDNS_CONTEXT_CODE_EDNS_VERSION_TEXT "Change related to getdns_context_set_edns_version" -#define GETDNS_CONTEXT_CODE_EDNS_DO_BIT 613 #define GETDNS_CONTEXT_CODE_EDNS_DO_BIT_TEXT "Change related to getdns_context_set_edns_do_bit" -#define GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW 614 #define GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW_TEXT "Change related to getdns_context_set_dnssec_allowed_skew" -#define GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS 615 #define GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS_TEXT "Change related to getdns_context_set_memory_functions" -#define GETDNS_CONTEXT_CODE_TIMEOUT 616 #define GETDNS_CONTEXT_CODE_TIMEOUT_TEXT "Change related to getdns_context_set_timeout" /** @} */ + +/* Callback Type Variables */ +typedef enum getdns_callback_type_t { + GETDNS_CALLBACK_COMPLETE = 700, + GETDNS_CALLBACK_CANCEL = 701, + GETDNS_CALLBACK_TIMEOUT = 702, + GETDNS_CALLBACK_ERROR = 703 +} getdns_callback_type_t; + /** - * \defgroup callbacktypes Callback Type Variables + * \defgroup Callback type variables texts * @{ */ -#define GETDNS_CALLBACK_COMPLETE 700 #define GETDNS_CALLBACK_COMPLETE_TEXT "The response has the requested data in it" -#define GETDNS_CALLBACK_CANCEL 701 #define GETDNS_CALLBACK_CANCEL_TEXT "The calling program cancelled the callback; response is NULL" -#define GETDNS_CALLBACK_TIMEOUT 702 #define GETDNS_CALLBACK_TIMEOUT_TEXT "The requested action timed out; response is NULL" -#define GETDNS_CALLBACK_ERROR 703 #define GETDNS_CALLBACK_ERROR_TEXT "The requested action had an error; response is NULL" /** @} */ @@ -319,6 +389,7 @@ extern "C" { #define GETDNS_RRTYPE_AXFR 252 #define GETDNS_RRTYPE_MAILB 253 #define GETDNS_RRTYPE_MAILA 254 +#define GETDNS_RRTYPE_ANY 255 #define GETDNS_RRTYPE_URI 256 #define GETDNS_RRTYPE_CAA 257 #define GETDNS_RRTYPE_TA 32768 @@ -327,7 +398,6 @@ extern "C" { */ struct getdns_context; -typedef uint16_t getdns_return_t; typedef uint64_t getdns_transaction_t; /** * used to check data types within complex types (dict, list) @@ -639,7 +709,7 @@ getdns_return_t getdns_dict_remove_name(struct getdns_dict *this_dict, const cha /* Callback arguments */ typedef void (*getdns_callback_t) (struct getdns_context *context, - uint16_t callback_type, + getdns_callback_type_t callback_type, struct getdns_dict * response, void *userarg, getdns_transaction_t transaction_id); @@ -797,36 +867,41 @@ char *getdns_display_ip_address(const struct getdns_bindata getdns_return_t getdns_context_set_context_update_callback( - struct getdns_context * context, - void (*value)(struct getdns_context *context, uint16_t changed_item) + struct getdns_context *context, + void (*value)(struct getdns_context *context, + getdns_context_code_t changed_item) ); getdns_return_t -getdns_context_set_resolution_type(struct getdns_context *context, uint16_t value); +getdns_context_set_resolution_type(struct getdns_context *context, + getdns_resolution_t value); getdns_return_t getdns_context_set_namespaces(struct getdns_context *context, - size_t namespace_count, uint16_t * namespaces); + size_t namespace_count, getdns_namespace_t *namespaces); getdns_return_t -getdns_context_set_dns_transport(struct getdns_context *context, uint16_t value); +getdns_context_set_dns_transport(struct getdns_context *context, + getdns_transport_t value); getdns_return_t getdns_context_set_limit_outstanding_queries(struct getdns_context *context, uint16_t limit); getdns_return_t -getdns_context_set_timeout(struct getdns_context *context, uint16_t timeout); +getdns_context_set_timeout(struct getdns_context *context, uint64_t timeout); getdns_return_t -getdns_context_set_follow_redirects(struct getdns_context *context, uint16_t value); +getdns_context_set_follow_redirects(struct getdns_context *context, + getdns_redirects_t value); getdns_return_t getdns_context_set_dns_root_servers(struct getdns_context *context, struct getdns_list *addresses); getdns_return_t -getdns_context_set_append_name(struct getdns_context *context, uint16_t value); +getdns_context_set_append_name(struct getdns_context *context, + getdns_append_name_t value); getdns_return_t getdns_context_set_suffix(struct getdns_context *context, struct getdns_list *value); @@ -837,7 +912,7 @@ getdns_context_set_dnssec_trust_anchors(struct getdns_context *context, getdns_return_t getdns_context_set_dnssec_allowed_skew(struct getdns_context *context, - uint16_t value); + uint32_t value); getdns_return_t getdns_context_set_upstream_recursive_servers(struct getdns_context *context, diff --git a/src/test/check_getdns_cancel_callback.h b/src/test/check_getdns_cancel_callback.h index 9fe217b2..e7987f38 100644 --- a/src/test/check_getdns_cancel_callback.h +++ b/src/test/check_getdns_cancel_callback.h @@ -100,7 +100,7 @@ */ void cancel_callbackfn( struct getdns_context *context, - uint16_t callback_type, + getdns_callback_type_t callback_type, struct getdns_dict *response, void *userarg, getdns_transaction_t transaction_id); @@ -179,7 +179,7 @@ */ void cancel_callbackfn( struct getdns_context *context, - uint16_t callback_type, + getdns_callback_type_t callback_type, struct getdns_dict *response, void *userarg, getdns_transaction_t transaction_id); @@ -259,7 +259,7 @@ */ void cancel_callbackfn( struct getdns_context *context, - uint16_t callback_type, + getdns_callback_type_t callback_type, struct getdns_dict *response, void *userarg, getdns_transaction_t transaction_id); @@ -348,7 +348,7 @@ */ void cancel_callbackfn( struct getdns_context *context, - uint16_t callback_type, + getdns_callback_type_t callback_type, struct getdns_dict *response, void *userarg, getdns_transaction_t transaction_id); @@ -420,7 +420,7 @@ */ void cancel_callbackfn( struct getdns_context *context, - uint16_t callback_type, + getdns_callback_type_t callback_type, struct getdns_dict *response, void *userarg, getdns_transaction_t transaction_id) diff --git a/src/test/check_getdns_common.h b/src/test/check_getdns_common.h index 3b0b2a49..c1e498c9 100644 --- a/src/test/check_getdns_common.h +++ b/src/test/check_getdns_common.h @@ -167,7 +167,7 @@ * response that is returned. */ void callbackfn(struct getdns_context *context, - uint16_t callback_type, + getdns_callback_type_t callback_type, struct getdns_dict *response, void *userarg, getdns_transaction_t transaction_id); @@ -177,7 +177,7 @@ * getdns_context_set_context_update_callback tests. */ void update_callbackfn(struct getdns_context *context, - uint16_t changed_item); + getdns_context_code_t changed_item); /* run the event loop */ void run_event_loop(struct getdns_context *context, void* eventloop); diff --git a/src/test/check_getdns_context_set_context_update_callback.h b/src/test/check_getdns_context_set_context_update_callback.h index d4e48934..2fb0db86 100644 --- a/src/test/check_getdns_context_set_context_update_callback.h +++ b/src/test/check_getdns_context_set_context_update_callback.h @@ -56,7 +56,7 @@ /* * Create a context by calling getdns_context_create() * Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes - * getdns_context_set_resolution_type() to GETDNS_CONTEXT_STUB + * getdns_context_set_resolution_type() to GETDNS_RESOLUTION_STUB * expect: GETDNS_CONTEXT_CODE_RESOLUTION_TYPE */ struct getdns_context *context = NULL; @@ -67,7 +67,7 @@ expected_changed_item = GETDNS_CONTEXT_CODE_RESOLUTION_TYPE; - ASSERT_RC(getdns_context_set_resolution_type(context, GETDNS_CONTEXT_STUB), + ASSERT_RC(getdns_context_set_resolution_type(context, GETDNS_RESOLUTION_STUB), GETDNS_RETURN_GOOD, "Return code from getdns_context_set_resolution_type()"); CONTEXT_DESTROY; @@ -84,7 +84,7 @@ * expect: GETDNS_CONTEXT_CODE_NAMESPACES */ struct getdns_context *context = NULL; - uint16_t namespace_arr[2] = {GETDNS_CONTEXT_NAMESPACE_DNS, GETDNS_CONTEXT_NAMESPACE_LOCALNAMES}; + getdns_namespace_t namespace_arr[2] = {GETDNS_NAMESPACE_DNS, GETDNS_NAMESPACE_LOCALNAMES}; CONTEXT_CREATE(TRUE); ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn), @@ -105,7 +105,7 @@ /* * Create a context by calling getdns_context_create() * Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes - * Call getdns_context_set_dns_transport() to GETDNS_CONTEXT_UDP_ONLY + * Call getdns_context_set_dns_transport() to GETDNS_TRANSPORT_UDP_ONLY * expect: GETDNS_CONTEXT_CODE_DNS_TRANSPORT */ struct getdns_context *context = NULL; @@ -116,7 +116,7 @@ expected_changed_item = GETDNS_CONTEXT_CODE_DNS_TRANSPORT; - ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_CONTEXT_UDP_ONLY), + ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_TRANSPORT_UDP_ONLY), GETDNS_RETURN_GOOD, "Return code from getdns_context_set_dns_transport()"); CONTEXT_DESTROY; @@ -177,7 +177,7 @@ /* * Create a context by calling getdns_context_create() * Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes - * Call getdns_context_set_follow_redirects() to GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS + * Call getdns_context_set_follow_redirects() to GETDNS_REDIRECTS_DO_NOT_FOLLOW * expect: GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS */ struct getdns_context *context = NULL; @@ -188,7 +188,7 @@ expected_changed_item = GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS; - ASSERT_RC(getdns_context_set_follow_redirects(context, GETDNS_CONTEXT_DO_NOT_FOLLOW_REDIRECTS), + ASSERT_RC(getdns_context_set_follow_redirects(context, GETDNS_REDIRECTS_DO_NOT_FOLLOW), GETDNS_RETURN_GOOD, "Return code from getdns_context_set_follow_redirects()"); CONTEXT_DESTROY; diff --git a/src/test/check_getdns_context_set_dns_transport.h b/src/test/check_getdns_context_set_dns_transport.h index c7c1e0e6..25d3eff4 100644 --- a/src/test/check_getdns_context_set_dns_transport.h +++ b/src/test/check_getdns_context_set_dns_transport.h @@ -48,9 +48,9 @@ START_TEST (getdns_context_set_dns_transport_3) { /* - * Call getdns_context_set_dns_transport() with value = GETDNS_CONTEXT_UDP_ONLY + * Call getdns_context_set_dns_transport() with value = GETDNS_TRANSPORT_UDP_ONLY * Define a callback routine for context changes and call getdns_context_set_context_update_callback() so that it gets called when there are context changes - * getdns_context_set_resolution_type() to GETDNS_CONTEXT_STUB + * getdns_context_set_resolution_type() to GETDNS_RESOLUTION_STUB * expect: GETDNS_CONTEXT_CODE_RESOLUTION_TYPE */ struct getdns_context *context = NULL; @@ -67,7 +67,7 @@ CONTEXT_CREATE(TRUE); - ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_CONTEXT_UDP_ONLY), + ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_TRANSPORT_UDP_ONLY), GETDNS_RETURN_GOOD, "Return code from getdns_context_set_dns_transport()"); @@ -94,7 +94,7 @@ printf("the udp_sum is %d\n", udp_sum); //tcp count - ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_CONTEXT_TCP_ONLY), + ASSERT_RC(getdns_context_set_dns_transport(context, GETDNS_TRANSPORT_TCP_ONLY), GETDNS_RETURN_GOOD, "Return code from getdns_context_set_dns_transport()"); diff --git a/src/test/check_getdns_context_set_timeout.c b/src/test/check_getdns_context_set_timeout.c index c86a875a..01e15984 100644 --- a/src/test/check_getdns_context_set_timeout.c +++ b/src/test/check_getdns_context_set_timeout.c @@ -187,7 +187,7 @@ START_TEST (getdns_context_set_timeout_3) * Create listener thread * Set upstream to localhost:port * - * getdns_context_set_resolution_type() to GETDNS_CONTEXT_STUB + * getdns_context_set_resolution_type() to GETDNS_RESOLUTION_STUB * expect: GETDNS_CONTEXT_CODE_RESOLUTION_TYPE */ @@ -236,7 +236,7 @@ START_TEST (getdns_context_set_timeout_3) GETDNS_RETURN_GOOD, "set rec servers"); /* stub */ - ASSERT_RC(getdns_context_set_resolution_type(context, GETDNS_CONTEXT_STUB), + ASSERT_RC(getdns_context_set_resolution_type(context, GETDNS_RESOLUTION_STUB), GETDNS_RETURN_GOOD, "Return code from getdns_context_set_resolution_type()"); EVENT_BASE_CREATE; diff --git a/src/test/tests_dnssec.c b/src/test/tests_dnssec.c index 1ecbad7c..ef843fd2 100644 --- a/src/test/tests_dnssec.c +++ b/src/test/tests_dnssec.c @@ -127,7 +127,8 @@ getdns_return_t create_root_trustanchor_list(struct getdns_list **tas) /* Set up the callback function, which will also do the processing of the results */ void -this_callbackfn(struct getdns_context *context, uint16_t callback_type, +this_callbackfn(struct getdns_context *context, + getdns_callback_type_t callback_type, struct getdns_dict *response, void *userarg, getdns_transaction_t transaction_id) { diff --git a/src/test/tests_stub_async.c b/src/test/tests_stub_async.c index ee347d13..5abd8c36 100644 --- a/src/test/tests_stub_async.c +++ b/src/test/tests_stub_async.c @@ -49,7 +49,7 @@ /* Set up the callback function, which will also do the processing of the results */ void this_callbackfn(struct getdns_context *this_context, - uint16_t this_callback_type, + getdns_callback_type_t this_callback_type, struct getdns_dict *this_response, void *this_userarg, getdns_transaction_t this_transaction_id) { @@ -81,7 +81,7 @@ main(int argc, char** argv) context_create_return); return (GETDNS_RETURN_GENERIC_ERROR); } - getdns_context_set_resolution_type(this_context, GETDNS_CONTEXT_STUB); + getdns_context_set_resolution_type(this_context, GETDNS_RESOLUTION_STUB); getdns_context_set_timeout(this_context, 5000); /* Create an event base and put it in the context using the unknown function name */ diff --git a/src/test/tests_stub_sync.c b/src/test/tests_stub_sync.c index 4877177a..fce7f722 100644 --- a/src/test/tests_stub_sync.c +++ b/src/test/tests_stub_sync.c @@ -60,7 +60,7 @@ main() context_create_return); return (GETDNS_RETURN_GENERIC_ERROR); } - getdns_context_set_resolution_type(this_context, GETDNS_CONTEXT_STUB); + getdns_context_set_resolution_type(this_context, GETDNS_RESOLUTION_STUB); struct getdns_dict *response = NULL; getdns_return_t ret =