diff --git a/src/common/getdns_context.c b/src/common/getdns_context.c index 5fdd33c9..1870c483 100644 --- a/src/common/getdns_context.c +++ b/src/common/getdns_context.c @@ -141,13 +141,17 @@ getdns_context_create( bool set_from_os ) { - UNUSED_PARAM(set_from_os); getdns_context_t result = NULL; if (context == NULL) { return GETDNS_RETURN_GENERIC_ERROR; } + getdns_dict *outbound_reqs = getdns_dict_create(); + if (outbound_reqs == NULL) { + return GETDNS_RETURN_GENERIC_ERROR; + } + /** default init **/ result = malloc(sizeof(struct getdns_context_t)); result->resolution_type = GETDNS_CONTEXT_RECURSING; @@ -168,6 +172,9 @@ getdns_context_create( result->edns_version = 0; result->edns_do_bit = 0; + result->event_base = NULL; + result->outbound_reqs = outbound_reqs; + result->update_callback = NULL; result->memory_allocator = malloc; result->memory_deallocator = free; @@ -207,6 +214,8 @@ getdns_context_destroy( getdns_list_destroy(context->dnssec_trust_anchors); getdns_list_destroy(context->upstream_list); + getdns_dict_destroy(context->outbound_reqs); + free(context); return; } /* getdns_context_destroy */ diff --git a/src/common/getdns_context.h b/src/common/getdns_context.h index f716d746..2aea8e09 100644 --- a/src/common/getdns_context.h +++ b/src/common/getdns_context.h @@ -40,7 +40,8 @@ struct getdns_context_t { /* Event loop */ struct event_base* event_base; - + + getdns_dict *outbound_reqs; } ; #endif diff --git a/src/common/getdns_general.c b/src/common/getdns_general.c index 84aa39c6..9705b0da 100644 --- a/src/common/getdns_general.c +++ b/src/common/getdns_general.c @@ -28,7 +28,25 @@ * THE SOFTWARE. */ -#include +#include +#include + +/* outbound request */ +typedef struct getdns_outbound_req { + + /* stub or recursive */ + uint16_t req_type; + /* transaction id */ + getdns_transaction_t transaction_id; + /* callback */ + getdns_callback_t callback; + /* user arg to pass to callback */ + void* userarg; + /* list of servers this can send to */ + getdns_list *upstream; + + +} getdns_async_req; /* stuff to make it compile pedantically */ #define UNUSED_PARAM(x) ((void)(x)) @@ -47,13 +65,22 @@ getdns_general( getdns_callback_t callback ) { - UNUSED_PARAM(context); + /* Default to zero */ + if (transaction_id != NULL) { + *transaction_id = 0; + } + if (context->event_base == NULL || + callback == NULL) { + /* Can't do async without an event loop + * or callback + */ + return GETDNS_RETURN_GENERIC_ERROR; + } + UNUSED_PARAM(name); UNUSED_PARAM(request_type); UNUSED_PARAM(extensions); UNUSED_PARAM(userarg); - UNUSED_PARAM(transaction_id); - UNUSED_PARAM(callback); return GETDNS_RETURN_GOOD; } /* getdns_general */