use enum types where possible

following API 0.387 (commit 13571e02f1)
This commit is contained in:
Willem Toorop 2014-02-09 17:46:12 +01:00
parent 0bbc6fd8b3
commit 20853601a6
15 changed files with 252 additions and 166 deletions

View File

@ -50,7 +50,8 @@
void *plain_mem_funcs_user_arg = MF_PLAIN; void *plain_mem_funcs_user_arg = MF_PLAIN;
/* Private functions */ /* 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 struct getdns_list *create_default_root_servers();
static getdns_return_t add_ip_str(struct getdns_dict *); static getdns_return_t add_ip_str(struct getdns_dict *);
static struct getdns_dict *create_ipaddr_dict_from_rdf(struct getdns_context *, 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. * Helper to get default lookup namespaces.
* TODO: Determine from OS * TODO: Determine from OS
*/ */
static uint16_t * static getdns_namespace_t*
create_default_namespaces(struct getdns_context *context) create_default_namespaces(struct getdns_context *context)
{ {
uint16_t *result = GETDNS_XMALLOC(context->my_mf, uint16_t, 2); getdns_namespace_t *result = GETDNS_XMALLOC(
result[0] = GETDNS_CONTEXT_NAMESPACE_LOCALNAMES; context->my_mf, getdns_namespace_t, 2);
result[1] = GETDNS_CONTEXT_NAMESPACE_DNS; result[0] = GETDNS_NAMESPACE_LOCALNAMES;
return result; 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->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->namespaces = create_default_namespaces(result);
result->timeout = 5000; 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->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->suffix = NULL;
result->dnssec_trust_anchors = 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_dnssec_allowed_skew(result, 0);
getdns_context_set_edns_maximum_udp_payload_size(result, 512); getdns_context_set_edns_maximum_udp_payload_size(result, 512);
getdns_context_set_dns_transport(result, 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; return GETDNS_RETURN_GOOD;
} /* getdns_context_create */ } /* getdns_context_create */
@ -451,8 +453,8 @@ getdns_context_destroy(struct getdns_context *context)
*/ */
getdns_return_t getdns_return_t
getdns_context_set_context_update_callback(struct getdns_context *context, 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); RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
context->update_callback = value; context->update_callback = value;
@ -504,10 +506,11 @@ dispatch_updated(struct getdns_context *context, uint16_t item)
* *
*/ */
getdns_return_t 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); 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; 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_return_t
getdns_context_set_namespaces(struct getdns_context *context, 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); RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
if (namespace_count == 0 || namespaces == NULL) { 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); GETDNS_FREE(context->my_mf, context->namespaces);
/** duplicate **/ /** duplicate **/
context->namespaces = GETDNS_XMALLOC(context->my_mf, uint16_t, context->namespaces = GETDNS_XMALLOC(context->my_mf, getdns_namespace_t,
namespace_count); namespace_count);
memcpy(context->namespaces, namespaces, memcpy(context->namespaces, namespaces,
namespace_count * sizeof(uint16_t)); namespace_count * sizeof(getdns_namespace_t));
dispatch_updated(context, GETDNS_CONTEXT_CODE_NAMESPACES); dispatch_updated(context, GETDNS_CONTEXT_CODE_NAMESPACES);
@ -550,19 +553,20 @@ getdns_context_set_namespaces(struct getdns_context *context,
* *
*/ */
getdns_return_t 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); RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
switch (value) { 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-udp", "yes");
set_ub_string_opt(context, "do-tcp", "yes"); set_ub_string_opt(context, "do-tcp", "yes");
break; 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-udp", "yes");
set_ub_string_opt(context, "do-tcp", "no"); set_ub_string_opt(context, "do-tcp", "no");
break; 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-udp", "no");
set_ub_string_opt(context, "do-tcp", "yes"); set_ub_string_opt(context, "do-tcp", "yes");
break; break;
@ -599,7 +603,7 @@ getdns_context_set_limit_outstanding_queries(struct getdns_context *context,
* *
*/ */
getdns_return_t 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); 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_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); RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
context->follow_redirects = value; 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); dispatch_updated(context, GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS);
return GETDNS_RETURN_GOOD; 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); getdns_list_destroy(context->dns_root_servers);
context->dns_root_servers = addresses; 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); 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_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); RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
if (value != GETDNS_CONTEXT_APPEND_NAME_ALWAYS && if (value != GETDNS_APPEND_NAME_ALWAYS &&
value != value != GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE &&
GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE value != GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE
&& value != && value != GETDNS_APPEND_NAME_NEVER) {
GETDNS_CONTEXT_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE
&& value != GETDNS_CONTEXT_DO_NOT_APPEND_NAMES) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL; 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); getdns_list_destroy(context->suffix);
context->suffix = value; 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); 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_return_t
getdns_context_set_dnssec_allowed_skew(struct getdns_context *context, getdns_context_set_dnssec_allowed_skew(struct getdns_context *context,
uint16_t value) uint32_t value)
{ {
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
set_ub_number_opt(context, "val-sig-skew-min", value); 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); getdns_list_destroy(context->upstream_list);
context->upstream_list = 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, dispatch_updated(context,
GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS); GETDNS_CONTEXT_CODE_UPSTREAM_RECURSIVE_SERVERS);
@ -1084,7 +1088,7 @@ getdns_context_prepare_for_resolution(struct getdns_context *context)
*/ */
return GETDNS_RETURN_GOOD; return GETDNS_RETURN_GOOD;
} }
if (context->resolution_type == GETDNS_CONTEXT_STUB) { if (context->resolution_type == GETDNS_RESOLUTION_STUB) {
size_t upstream_len = 0; size_t upstream_len = 0;
getdns_return_t r = getdns_return_t r =
getdns_list_get_length(context->upstream_list, getdns_list_get_length(context->upstream_list,
@ -1098,7 +1102,7 @@ getdns_context_prepare_for_resolution(struct getdns_context *context)
/* use /etc/hosts */ /* use /etc/hosts */
ub_ctx_hosts(context->unbound_ctx, NULL); 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 */ /* set recursive */
/* TODO: use the root servers via root hints file */ /* TODO: use the root servers via root hints file */
ub_ctx_set_fwd(context->unbound_ctx, NULL); ub_ctx_set_fwd(context->unbound_ctx, NULL);

View File

@ -45,17 +45,18 @@ struct ldns_rbtree_t;
struct ub_ctx; struct ub_ctx;
/** function pointer typedefs */ /** 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 { struct getdns_context {
/* Context values */ /* Context values */
uint16_t resolution_type; getdns_resolution_t resolution_type;
uint16_t *namespaces; getdns_namespace_t *namespaces;
uint16_t timeout; uint64_t timeout;
uint16_t follow_redirects; getdns_redirects_t follow_redirects;
struct getdns_list *dns_root_servers; struct getdns_list *dns_root_servers;
uint16_t append_name; getdns_append_name_t append_name;
struct getdns_list *suffix; struct getdns_list *suffix;
struct getdns_list *dnssec_trust_anchors; struct getdns_list *dnssec_trust_anchors;
struct getdns_list *upstream_list; struct getdns_list *upstream_list;

View File

@ -19,6 +19,11 @@ uint16_t regulararg;
uint16_t *regularptrarg; uint16_t *regularptrarg;
getdns_transaction_t txidarg; getdns_transaction_t txidarg;
getdns_transaction_t * txidptrarg; 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; getdns_data_type * datatypeptrarg;
struct getdns_bindata ** bindataptrarg; 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; } {UNUSED_PARAM(userarg); UNUSED_PARAM(foo); UNUSED_PARAM(bar); return NULL; }
void extendeddeallocfunctionarg(void* userarg, void* foo) void extendeddeallocfunctionarg(void* userarg, void* foo)
{UNUSED_PARAM(userarg); UNUSED_PARAM(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);} {UNUSED_PARAM(foo1);UNUSED_PARAM(foo2);}
int main() int main()
@ -222,7 +227,7 @@ retcharstar = getdns_convert_alabel_to_ulabel(
); );
retregular = getdns_validate_dnssec( retregular = getdns_validate_dnssec(
bindataarg, listarg,
listarg, listarg,
listarg listarg
); );
@ -242,18 +247,18 @@ retregular = getdns_context_set_context_update_callback(
retregular = getdns_context_set_resolution_type( retregular = getdns_context_set_resolution_type(
contextarg, contextarg,
regulararg resolutionarg
); );
retregular = getdns_context_set_namespaces( retregular = getdns_context_set_namespaces(
contextarg, contextarg,
sizetarg, sizetarg,
regularptrarg namespaceptrarg
); );
retregular = getdns_context_set_dns_transport( retregular = getdns_context_set_dns_transport(
contextarg, contextarg,
regulararg transportarg
); );
retregular = getdns_context_set_limit_outstanding_queries( retregular = getdns_context_set_limit_outstanding_queries(
@ -268,7 +273,7 @@ retregular = getdns_context_set_timeout(
retregular = getdns_context_set_follow_redirects( retregular = getdns_context_set_follow_redirects(
contextarg, contextarg,
regulararg redirectsarg
); );
retregular = getdns_context_set_dns_root_servers( retregular = getdns_context_set_dns_root_servers(
@ -278,7 +283,7 @@ retregular = getdns_context_set_dns_root_servers(
retregular = getdns_context_set_append_name( retregular = getdns_context_set_append_name(
contextarg, contextarg,
regulararg appendnamearg
); );
retregular = getdns_context_set_suffix( retregular = getdns_context_set_suffix(

View File

@ -15,7 +15,7 @@
/* Set up the callback function, which will also do the processing of the results */ /* Set up the callback function, which will also do the processing of the results */
void this_callbackfn(struct getdns_context *this_context, 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, struct getdns_dict *this_response,
void *this_userarg, void *this_userarg,
getdns_transaction_t this_transaction_id) getdns_transaction_t this_transaction_id)

View File

@ -51,7 +51,7 @@
/* Set up the callback function, which will also do the processing of the results */ /* Set up the callback function, which will also do the processing of the results */
void this_callbackfn(struct getdns_context *this_context, 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, struct getdns_dict *this_response,
void *this_userarg, void *this_userarg,
getdns_transaction_t this_transaction_id) getdns_transaction_t this_transaction_id)

View File

@ -15,7 +15,7 @@
/* Set up the callback function, which will also do the processing of the results */ /* Set up the callback function, which will also do the processing of the results */
void this_callbackfn(struct getdns_context *this_context, 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, struct getdns_dict *this_response,
void *this_userarg, void *this_userarg,
getdns_transaction_t this_transaction_id) getdns_transaction_t this_transaction_id)

View File

@ -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. #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_GOOD_TEXT "Good"
#define GETDNS_RETURN_GENERIC_ERROR 1
#define GETDNS_RETURN_GENERIC_ERROR_TEXT "Generic error" #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_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_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_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_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_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_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_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_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_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_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_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." #define GETDNS_RETURN_INVALID_PARAMETER_TEXT "A required parameter had an invalid value."
/** @} /** @}
*/ */
/** /**
* \defgroup dnssecvalues DNSSEC values * \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_INSECURE_TEXT "The record was determined to be insecure in DNSSEC"
#define GETDNS_DNSSEC_NOT_PERFORMED 404 #define GETDNS_DNSSEC_NOT_PERFORMED 404
#define GETDNS_DNSSEC_NOT_PERFORMED_TEXT "DNSSEC validation was not performed (only used for debugging)" #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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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" #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_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_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_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" #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_AXFR 252
#define GETDNS_RRTYPE_MAILB 253 #define GETDNS_RRTYPE_MAILB 253
#define GETDNS_RRTYPE_MAILA 254 #define GETDNS_RRTYPE_MAILA 254
#define GETDNS_RRTYPE_ANY 255
#define GETDNS_RRTYPE_URI 256 #define GETDNS_RRTYPE_URI 256
#define GETDNS_RRTYPE_CAA 257 #define GETDNS_RRTYPE_CAA 257
#define GETDNS_RRTYPE_TA 32768 #define GETDNS_RRTYPE_TA 32768
@ -327,7 +398,6 @@ extern "C" {
*/ */
struct getdns_context; struct getdns_context;
typedef uint16_t getdns_return_t;
typedef uint64_t getdns_transaction_t; typedef uint64_t getdns_transaction_t;
/** /**
* used to check data types within complex types (dict, list) * 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 */ /* Callback arguments */
typedef void (*getdns_callback_t) (struct getdns_context *context, typedef void (*getdns_callback_t) (struct getdns_context *context,
uint16_t callback_type, getdns_callback_type_t callback_type,
struct getdns_dict * response, struct getdns_dict * response,
void *userarg, getdns_transaction_t transaction_id); void *userarg, getdns_transaction_t transaction_id);
@ -797,36 +867,41 @@ char *getdns_display_ip_address(const struct getdns_bindata
getdns_return_t getdns_return_t
getdns_context_set_context_update_callback( getdns_context_set_context_update_callback(
struct getdns_context * context, 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)
); );
getdns_return_t 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_return_t
getdns_context_set_namespaces(struct getdns_context *context, 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_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_return_t
getdns_context_set_limit_outstanding_queries(struct getdns_context *context, getdns_context_set_limit_outstanding_queries(struct getdns_context *context,
uint16_t limit); uint16_t limit);
getdns_return_t 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_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_return_t
getdns_context_set_dns_root_servers(struct getdns_context *context, getdns_context_set_dns_root_servers(struct getdns_context *context,
struct getdns_list *addresses); struct getdns_list *addresses);
getdns_return_t 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_return_t
getdns_context_set_suffix(struct getdns_context *context, struct getdns_list *value); 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_return_t
getdns_context_set_dnssec_allowed_skew(struct getdns_context *context, getdns_context_set_dnssec_allowed_skew(struct getdns_context *context,
uint16_t value); uint32_t value);
getdns_return_t getdns_return_t
getdns_context_set_upstream_recursive_servers(struct getdns_context *context, getdns_context_set_upstream_recursive_servers(struct getdns_context *context,

View File

@ -100,7 +100,7 @@
*/ */
void cancel_callbackfn( void cancel_callbackfn(
struct getdns_context *context, struct getdns_context *context,
uint16_t callback_type, getdns_callback_type_t callback_type,
struct getdns_dict *response, struct getdns_dict *response,
void *userarg, void *userarg,
getdns_transaction_t transaction_id); getdns_transaction_t transaction_id);
@ -179,7 +179,7 @@
*/ */
void cancel_callbackfn( void cancel_callbackfn(
struct getdns_context *context, struct getdns_context *context,
uint16_t callback_type, getdns_callback_type_t callback_type,
struct getdns_dict *response, struct getdns_dict *response,
void *userarg, void *userarg,
getdns_transaction_t transaction_id); getdns_transaction_t transaction_id);
@ -259,7 +259,7 @@
*/ */
void cancel_callbackfn( void cancel_callbackfn(
struct getdns_context *context, struct getdns_context *context,
uint16_t callback_type, getdns_callback_type_t callback_type,
struct getdns_dict *response, struct getdns_dict *response,
void *userarg, void *userarg,
getdns_transaction_t transaction_id); getdns_transaction_t transaction_id);
@ -348,7 +348,7 @@
*/ */
void cancel_callbackfn( void cancel_callbackfn(
struct getdns_context *context, struct getdns_context *context,
uint16_t callback_type, getdns_callback_type_t callback_type,
struct getdns_dict *response, struct getdns_dict *response,
void *userarg, void *userarg,
getdns_transaction_t transaction_id); getdns_transaction_t transaction_id);
@ -420,7 +420,7 @@
*/ */
void cancel_callbackfn( void cancel_callbackfn(
struct getdns_context *context, struct getdns_context *context,
uint16_t callback_type, getdns_callback_type_t callback_type,
struct getdns_dict *response, struct getdns_dict *response,
void *userarg, void *userarg,
getdns_transaction_t transaction_id) getdns_transaction_t transaction_id)

View File

@ -167,7 +167,7 @@
* response that is returned. * response that is returned.
*/ */
void callbackfn(struct getdns_context *context, void callbackfn(struct getdns_context *context,
uint16_t callback_type, getdns_callback_type_t callback_type,
struct getdns_dict *response, struct getdns_dict *response,
void *userarg, void *userarg,
getdns_transaction_t transaction_id); getdns_transaction_t transaction_id);
@ -177,7 +177,7 @@
* getdns_context_set_context_update_callback tests. * getdns_context_set_context_update_callback tests.
*/ */
void update_callbackfn(struct getdns_context *context, void update_callbackfn(struct getdns_context *context,
uint16_t changed_item); getdns_context_code_t changed_item);
/* run the event loop */ /* run the event loop */
void run_event_loop(struct getdns_context *context, void* eventloop); void run_event_loop(struct getdns_context *context, void* eventloop);

View File

@ -56,7 +56,7 @@
/* /*
* Create a context by calling getdns_context_create() * 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 * 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 * expect: GETDNS_CONTEXT_CODE_RESOLUTION_TYPE
*/ */
struct getdns_context *context = NULL; struct getdns_context *context = NULL;
@ -67,7 +67,7 @@
expected_changed_item = GETDNS_CONTEXT_CODE_RESOLUTION_TYPE; 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()"); GETDNS_RETURN_GOOD, "Return code from getdns_context_set_resolution_type()");
CONTEXT_DESTROY; CONTEXT_DESTROY;
@ -84,7 +84,7 @@
* expect: GETDNS_CONTEXT_CODE_NAMESPACES * expect: GETDNS_CONTEXT_CODE_NAMESPACES
*/ */
struct getdns_context *context = NULL; 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); CONTEXT_CREATE(TRUE);
ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn), ASSERT_RC(getdns_context_set_context_update_callback(context, update_callbackfn),
@ -105,7 +105,7 @@
/* /*
* Create a context by calling getdns_context_create() * 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 * 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 * expect: GETDNS_CONTEXT_CODE_DNS_TRANSPORT
*/ */
struct getdns_context *context = NULL; struct getdns_context *context = NULL;
@ -116,7 +116,7 @@
expected_changed_item = GETDNS_CONTEXT_CODE_DNS_TRANSPORT; 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()"); GETDNS_RETURN_GOOD, "Return code from getdns_context_set_dns_transport()");
CONTEXT_DESTROY; CONTEXT_DESTROY;
@ -177,7 +177,7 @@
/* /*
* Create a context by calling getdns_context_create() * 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 * 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 * expect: GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS
*/ */
struct getdns_context *context = NULL; struct getdns_context *context = NULL;
@ -188,7 +188,7 @@
expected_changed_item = GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS; 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()"); GETDNS_RETURN_GOOD, "Return code from getdns_context_set_follow_redirects()");
CONTEXT_DESTROY; CONTEXT_DESTROY;

View File

@ -48,9 +48,9 @@
START_TEST (getdns_context_set_dns_transport_3) 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 * 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 * expect: GETDNS_CONTEXT_CODE_RESOLUTION_TYPE
*/ */
struct getdns_context *context = NULL; struct getdns_context *context = NULL;
@ -67,7 +67,7 @@
CONTEXT_CREATE(TRUE); 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()"); GETDNS_RETURN_GOOD, "Return code from getdns_context_set_dns_transport()");
@ -94,7 +94,7 @@
printf("the udp_sum is %d\n", udp_sum); printf("the udp_sum is %d\n", udp_sum);
//tcp count //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()"); GETDNS_RETURN_GOOD, "Return code from getdns_context_set_dns_transport()");

View File

@ -187,7 +187,7 @@ START_TEST (getdns_context_set_timeout_3)
* Create listener thread * Create listener thread
* Set upstream to localhost:port * 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 * expect: GETDNS_CONTEXT_CODE_RESOLUTION_TYPE
*/ */
@ -236,7 +236,7 @@ START_TEST (getdns_context_set_timeout_3)
GETDNS_RETURN_GOOD, "set rec servers"); GETDNS_RETURN_GOOD, "set rec servers");
/* stub */ /* 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()"); GETDNS_RETURN_GOOD, "Return code from getdns_context_set_resolution_type()");
EVENT_BASE_CREATE; EVENT_BASE_CREATE;

View File

@ -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 */ /* Set up the callback function, which will also do the processing of the results */
void 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, struct getdns_dict *response, void *userarg,
getdns_transaction_t transaction_id) getdns_transaction_t transaction_id)
{ {

View File

@ -49,7 +49,7 @@
/* Set up the callback function, which will also do the processing of the results */ /* Set up the callback function, which will also do the processing of the results */
void void
this_callbackfn(struct getdns_context *this_context, this_callbackfn(struct getdns_context *this_context,
uint16_t this_callback_type, getdns_callback_type_t this_callback_type,
struct getdns_dict *this_response, struct getdns_dict *this_response,
void *this_userarg, getdns_transaction_t this_transaction_id) void *this_userarg, getdns_transaction_t this_transaction_id)
{ {
@ -81,7 +81,7 @@ main(int argc, char** argv)
context_create_return); context_create_return);
return (GETDNS_RETURN_GENERIC_ERROR); 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); getdns_context_set_timeout(this_context, 5000);
/* Create an event base and put it in the context using the unknown function name */ /* Create an event base and put it in the context using the unknown function name */

View File

@ -60,7 +60,7 @@ main()
context_create_return); context_create_return);
return (GETDNS_RETURN_GENERIC_ERROR); 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; struct getdns_dict *response = NULL;
getdns_return_t ret = getdns_return_t ret =