Commit e3027d39 authored by Bob Halley's avatar Bob Halley
Browse files

resolver checkpoint

parent 63d1ef9e
......@@ -27,7 +27,7 @@
ISC_LANG_BEGINDECLS
#define DNS_EVENT_FETCH (ISC_EVENTCLASS_DNS + 0)
#define DNS_EVENT_FETCHCONTROL (ISC_EVENTCLASS_DNS + 0)
#define DNS_EVENT_FETCHDONE (ISC_EVENTCLASS_DNS + 1)
#define DNS_EVENT_FIND (ISC_EVENTCLASS_DNS + 2)
#define DNS_EVENT_FINDDONE (ISC_EVENTCLASS_DNS + 3)
......
......@@ -45,39 +45,39 @@
* Drafts: <TBS>
*/
#include <isc/types.h>
#include <isc/lang.h>
#include <isc/event.h>
#include <isc/socket.h>
#include <dns/types.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/result.h>
ISC_LANG_BEGINDECLS
struct dns_fetch {
unsigned int magic;
dns_resolver_t * res;
void * private;
ISC_LINK(struct dns_fetch) link;
};
#define DNS_FETCH_MAGIC 0x46746368U /* Ftch */
#define DNS_FETCH_VALID(fetch) ((fetch) != NULL && \
(fetch)->magic == DNS_FETCH_MAGIC)
typedef struct dns_fetchdoneevent {
ISC_EVENT_COMMON(struct dns_fetchdoneevent);
typedef struct dns_fetchevent {
ISC_EVENT_COMMON(struct dns_fetchevent);
dns_result_t result;
} dns_fetchdoneevent_t;
dns_rdatatype_t qtype;
dns_db_t * db;
dns_dbnode_t * node;
dns_rdataset_t * rdataset;
dns_rdataset_t * sigrdataset;
dns_fixedname_t foundname;
} dns_fetchevent_t;
#define DNS_FETCHOPT_TCP 0x01
#define DNS_FETCHOPT_UNSHARED 0x02
#define DNS_FETCHOPT_RECURSIVE 0x04
dns_result_t
dns_resolver_create(isc_mem_t *mctx, dns_view_t *view,
dns_resolver_create(dns_view_t *view,
isc_taskmgr_t *taskmgr, unsigned int ntasks,
isc_timermgr_t *timermgr, dns_dispatch_t *dispatch,
dns_resolver_t **resp);
isc_socketmgr_t *socketmgr,
isc_timermgr_t *timermgr,
dns_dispatch_t *dispatch, dns_resolver_t **resp);
void
dns_resolver_attach(dns_resolver_t *source, dns_resolver_t **targetp);
......@@ -92,13 +92,12 @@ dns_resolver_createfetch(dns_resolver_t *res, dns_name_t *name,
dns_forwarders_t *forwarders,
unsigned int options, isc_task_t *task,
isc_taskaction_t action, void *arg,
dns_rdataset_t *rdataset,
dns_rdataset_t *sigrdataset,
dns_fetch_t **fetchp);
void
dns_resolver_destroyfetch(dns_fetch_t **fetchp, isc_task_t *task);
void
dns_resolver_getanswer(isc_event_t *event, dns_message_t **msgp);
dns_resolver_destroyfetch(dns_resolver_t *res, dns_fetch_t **fetchp);
ISC_LANG_ENDDECLS
......
......@@ -156,8 +156,10 @@ dns_view_detach(dns_view_t **viewp);
*/
isc_result_t
dns_view_createresolver(dns_view_t *view, isc_taskmgr_t *taskmgr,
unsigned int ntasks, isc_timermgr_t *timermgr,
dns_view_createresolver(dns_view_t *view,
isc_taskmgr_t *taskmgr, unsigned int ntasks,
isc_socketmgr_t *socketmgr,
isc_timermgr_t *timermgr,
dns_dispatch_t *dispatch);
/*
* Create a resolver for the view.
......@@ -169,7 +171,7 @@ dns_view_createresolver(dns_view_t *view, isc_taskmgr_t *taskmgr,
* 'view' does not have a resolver already.
*
* The requirements of dns_resolver_create() apply to 'taskmgr',
* 'ntasks', 'timermgr', and 'dispatch'.
* 'ntasks', 'socketmgr', 'timermgr', and 'dispatch'.
*
* Returns:
*
......
This diff is collapsed.
......@@ -166,8 +166,10 @@ dns_view_detach(dns_view_t **viewp) {
}
isc_result_t
dns_view_createresolver(dns_view_t *view, isc_taskmgr_t *taskmgr,
unsigned int ntasks, isc_timermgr_t *timermgr,
dns_view_createresolver(dns_view_t *view,
isc_taskmgr_t *taskmgr, unsigned int ntasks,
isc_socketmgr_t *socketmgr,
isc_timermgr_t *timermgr,
dns_dispatch_t *dispatch)
{
/*
......@@ -178,12 +180,8 @@ dns_view_createresolver(dns_view_t *view, isc_taskmgr_t *taskmgr,
REQUIRE(!view->frozen);
REQUIRE(view->resolver == NULL);
#ifdef notyet
return (dns_resolver_create(view, taskmgr, ntasks, timermgr, dispatch,
&view->resolver));
#else
return (DNS_R_NOTIMPLEMENTED);
#endif
return (dns_resolver_create(view, taskmgr, ntasks, socketmgr,
timermgr, dispatch, &view->resolver));
}
void
......@@ -309,7 +307,7 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
result == DNS_R_NXGLUE) {
if (rdataset->methods != NULL)
dns_rdataset_disassociate(rdataset);
if (sigrdataset->methods != NULL)
if (sigrdataset != NULL && sigrdataset->methods != NULL)
dns_rdataset_disassociate(sigrdataset);
if (is_zone) {
if (view->cachedb != NULL) {
......@@ -351,7 +349,8 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
version = NULL;
dns_rdataset_clone(rdataset, &zrdataset);
dns_rdataset_disassociate(rdataset);
if (sigrdataset->methods != NULL) {
if (sigrdataset != NULL &&
sigrdataset->methods != NULL) {
dns_rdataset_clone(sigrdataset, &zsigrdataset);
dns_rdataset_disassociate(sigrdataset);
}
......@@ -368,7 +367,7 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
if (result == DNS_R_NOTFOUND && use_hints && view->hints != NULL) {
if (rdataset->methods != NULL)
dns_rdataset_disassociate(rdataset);
if (sigrdataset->methods != NULL)
if (sigrdataset != NULL && sigrdataset->methods != NULL)
dns_rdataset_disassociate(sigrdataset);
dns_fixedname_init(&foundname);
result = dns_db_find(view->hints, name, NULL, type, options,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment