mirror of https://github.com/getdnsapi/getdns.git
Some updates. Need to think about how to not rewrite what ldns and libevent have already done
This commit is contained in:
parent
7975c98c3f
commit
bf92cb6bb4
|
@ -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 */
|
||||
|
|
|
@ -40,7 +40,8 @@ struct getdns_context_t {
|
|||
|
||||
/* Event loop */
|
||||
struct event_base* event_base;
|
||||
|
||||
|
||||
getdns_dict *outbound_reqs;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,25 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <getdns_core_only.h>
|
||||
#include <getdns_context.h>
|
||||
#include <ldns/ldns.h>
|
||||
|
||||
/* 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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue