diff --git a/bin/tests/adb_test.c b/bin/tests/adb_test.c index 3167bbb171..46206db3b3 100644 --- a/bin/tests/adb_test.c +++ b/bin/tests/adb_test.c @@ -44,7 +44,7 @@ typedef struct client client_t; struct client { dns_name_t name; ISC_LINK(client_t) link; - dns_adbhandle_t *handle; + dns_adbfind_t *handle; }; isc_mem_t *mctx; diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 5bfbd0ed41..6279f2c6c4 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -111,7 +111,7 @@ struct dns_adb { isc_mempool_t *nhmp; /* dns_adbnamehook_t */ isc_mempool_t *zimp; /* dns_adbzoneinfo_t */ isc_mempool_t *emp; /* dns_adbentry_t */ - isc_mempool_t *ahmp; /* dns_adbhandle_t */ + isc_mempool_t *ahmp; /* dns_adbfind_t */ isc_mempool_t *aimp; /* dns_adbaddrinfo_t */ isc_mempool_t *afmp; /* dns_adbfetch_t */ @@ -152,7 +152,7 @@ struct dns_adbname { dns_adbnamehooklist_t v4; dns_adbnamehooklist_t v6; ISC_LIST(dns_adbfetch_t) fetches; - ISC_LIST(dns_adbhandle_t) handles; + ISC_LIST(dns_adbfind_t) handles; ISC_LINK(dns_adbname_t) plink; }; @@ -226,8 +226,8 @@ static inline dns_adbzoneinfo_t *new_adbzoneinfo(dns_adb_t *, dns_name_t *); static inline void free_adbzoneinfo(dns_adb_t *, dns_adbzoneinfo_t **); static inline dns_adbentry_t *new_adbentry(dns_adb_t *); static inline void free_adbentry(dns_adb_t *, dns_adbentry_t **); -static inline dns_adbhandle_t *new_adbhandle(dns_adb_t *); -static inline void free_adbhandle(dns_adb_t *, dns_adbhandle_t **); +static inline dns_adbfind_t *new_adbhandle(dns_adb_t *); +static inline void free_adbhandle(dns_adb_t *, dns_adbfind_t **); static inline dns_adbaddrinfo_t *new_adbaddrinfo(dns_adb_t *, dns_adbentry_t *); static inline dns_adbfetch_t *new_adbfetch(dns_adb_t *); @@ -255,7 +255,7 @@ static void clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_handles_at_name(dns_adbname_t *, isc_eventtype_t); static void check_expire_namehooks(dns_adbname_t *, isc_stdtime_t); static void cancel_fetches_at_name(dns_adb_t *, dns_adbname_t *); -static isc_result_t dbfind_name_v4(dns_adbhandle_t *, dns_name_t *, +static isc_result_t dbfind_name_v4(dns_adbfind_t *, dns_name_t *, dns_adbname_t *, int, isc_stdtime_t); static isc_result_t fetch_name_v4(dns_adbname_t *, isc_stdtime_t now); static inline void check_exit(dns_adb_t *); @@ -593,11 +593,11 @@ clean_namehooks(dns_adb_t *adb, dns_adbnamehooklist_t *namehooks) static void event_free(isc_event_t *event) { - dns_adbhandle_t *handle; + dns_adbfind_t *handle; INSIST(event != NULL); handle = event->destroy_arg; - INSIST(DNS_ADBHANDLE_VALID(handle)); + INSIST(DNS_ADBFIND_VALID(handle)); LOCK(&handle->lock); handle->flags |= HANDLE_EVENT_FREED; @@ -613,7 +613,7 @@ clean_handles_at_name(dns_adbname_t *name, isc_eventtype_t evtype) { isc_event_t *ev; isc_task_t *task; - dns_adbhandle_t *handle; + dns_adbfind_t *handle; handle = ISC_LIST_HEAD(name->handles); while (handle != NULL) { @@ -931,10 +931,10 @@ free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) isc_mempool_put(adb->emp, e); } -static inline dns_adbhandle_t * +static inline dns_adbfind_t * new_adbhandle(dns_adb_t *adb) { - dns_adbhandle_t *h; + dns_adbfind_t *h; isc_result_t result; h = isc_mempool_get(adb->ahmp); @@ -970,7 +970,7 @@ new_adbhandle(dns_adb_t *adb) ISC_EVENT_INIT(&h->event, sizeof (isc_event_t), 0, 0, 0, NULL, NULL, NULL, NULL, h); - h->magic = DNS_ADBHANDLE_MAGIC; + h->magic = DNS_ADBFIND_MAGIC; return (h); } @@ -1037,11 +1037,11 @@ free_adbfetch(dns_adb_t *adb, dns_adbfetch_t **fetch) } static inline void -free_adbhandle(dns_adb_t *adb, dns_adbhandle_t **handlep) +free_adbhandle(dns_adb_t *adb, dns_adbfind_t **handlep) { - dns_adbhandle_t *handle; + dns_adbfind_t *handle; - INSIST(handlep != NULL && DNS_ADBHANDLE_VALID(*handlep)); + INSIST(handlep != NULL && DNS_ADBFIND_VALID(*handlep)); handle = *handlep; *handlep = NULL; @@ -1217,7 +1217,7 @@ entry_is_bad_for_zone(dns_adb_t *adb, dns_adbentry_t *entry, dns_name_t *zone, } static void -copy_namehook_lists(dns_adb_t *adb, dns_adbhandle_t *handle, +copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *handle, dns_adbname_t *name, dns_name_t *zone, isc_stdtime_t now) { dns_adbnamehook_t *namehook; @@ -1466,7 +1466,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, MPINIT(dns_adbnamehook_t, adb->nhmp, ISC_TRUE, "adbnamehook"); MPINIT(dns_adbzoneinfo_t, adb->zimp, ISC_TRUE, "adbzoneinfo"); MPINIT(dns_adbentry_t, adb->emp, ISC_TRUE, "adbentry"); - MPINIT(dns_adbhandle_t, adb->ahmp, ISC_TRUE, "adbhandle"); + MPINIT(dns_adbfind_t, adb->ahmp, ISC_TRUE, "adbhandle"); MPINIT(dns_adbaddrinfo_t, adb->aimp, ISC_TRUE, "adbaddrinfo"); MPINIT(dns_adbfetch_t, adb->afmp, ISC_TRUE, "adbfetch"); @@ -1554,9 +1554,9 @@ isc_result_t dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, void *arg, dns_name_t *name, dns_name_t *zone, unsigned int options, isc_stdtime_t now, - dns_adbhandle_t **handlep) + dns_adbfind_t **handlep) { - dns_adbhandle_t *handle; + dns_adbfind_t *handle; dns_adbname_t *adbname; int bucket; isc_result_t result; @@ -1901,15 +1901,15 @@ dns_adb_insert(dns_adb_t *adb, dns_name_t *host, isc_sockaddr_t *addr, } void -dns_adb_destroyfind(dns_adbhandle_t **handlep) +dns_adb_destroyfind(dns_adbfind_t **handlep) { - dns_adbhandle_t *handle; + dns_adbfind_t *handle; dns_adbentry_t *entry; dns_adbaddrinfo_t *ai; int bucket; dns_adb_t *adb; - REQUIRE(handlep != NULL && DNS_ADBHANDLE_VALID(*handlep)); + REQUIRE(handlep != NULL && DNS_ADBFIND_VALID(*handlep)); handle = *handlep; *handlep = NULL; @@ -1958,7 +1958,7 @@ dns_adb_destroyfind(dns_adbhandle_t **handlep) } void -dns_adb_cancelfind(dns_adbhandle_t *handle) +dns_adb_cancelfind(dns_adbfind_t *handle) { isc_event_t *ev; isc_task_t *task; @@ -2129,7 +2129,7 @@ dump_adb(dns_adb_t *adb, FILE *f) } void -dns_adb_dumphandle(dns_adbhandle_t *handle, FILE *f) +dns_adb_dumphandle(dns_adbfind_t *handle, FILE *f) { char tmp[512]; const char *tmpp; @@ -2223,7 +2223,7 @@ print_fetch_list(FILE *f, dns_adbname_t *n) static void print_handle_list(FILE *f, dns_adbname_t *name) { - dns_adbhandle_t *handle; + dns_adbfind_t *handle; handle = ISC_LIST_HEAD(name->handles); while (handle != NULL) { @@ -2242,7 +2242,7 @@ print_handle_list(FILE *f, dns_adbname_t *name) * perhaps some fetches have been started. */ static isc_result_t -dbfind_name_v4(dns_adbhandle_t *handle, dns_name_t *zone, +dbfind_name_v4(dns_adbfind_t *handle, dns_name_t *zone, dns_adbname_t *adbname, int bucket, isc_stdtime_t now) { isc_result_t result; @@ -2250,7 +2250,7 @@ dbfind_name_v4(dns_adbhandle_t *handle, dns_name_t *zone, dns_rdataset_t rdataset; dns_adb_t *adb; - INSIST(DNS_ADBHANDLE_VALID(handle)); + INSIST(DNS_ADBFIND_VALID(handle)); INSIST(DNS_ADBNAME_VALID(adbname)); adb = adbname->adb; INSIST(DNS_ADB_VALID(adb)); diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h index e2e8d45a50..fafcecef6b 100644 --- a/lib/dns/include/dns/adb.h +++ b/lib/dns/include/dns/adb.h @@ -95,8 +95,8 @@ ISC_LANG_BEGINDECLS *** Magic number checks ***/ -#define DNS_ADBHANDLE_MAGIC 0x61646248 /* adbH. */ -#define DNS_ADBHANDLE_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBHANDLE_MAGIC) +#define DNS_ADBFIND_MAGIC 0x61646248 /* adbH. */ +#define DNS_ADBFIND_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBFIND_MAGIC) #define DNS_ADBADDRINFO_MAGIC 0x61644149 /* adAI. */ #define DNS_ADBADDRINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBADDRINFO_MAGIC) @@ -105,7 +105,9 @@ ISC_LANG_BEGINDECLS *** TYPES ***/ -/* dns_adbhandle_t +typedef struct dns_adbname dns_adbname_t; + +/* dns_adbfind_t * * The handle into our internal state of what is going on, where, when... * This is returned to the user as a handle, so requests can be canceled, @@ -115,14 +117,14 @@ ISC_LANG_BEGINDECLS * Items may not be _deleted_ from this list, however, or added to it * other than by using the dns_adb_*() API. */ -struct dns_adbhandle { +struct dns_adbfind { /* Public */ unsigned int magic; /* RO: magic */ ISC_LIST(dns_adbaddrinfo_t) list; /* RO: list of addrs */ unsigned int query_pending; /* RO: partial list */ unsigned int partial_result; /* RO: addrs missing */ unsigned int options; /* RO: options */ - ISC_LINK(dns_adbhandle_t) publink; /* RW: client use */ + ISC_LINK(dns_adbfind_t) publink; /* RW: client use */ /* Private */ isc_mutex_t lock; /* locks all below */ @@ -131,7 +133,7 @@ struct dns_adbhandle { dns_adbname_t *adbname; dns_adb_t *adb; isc_event_t event; - ISC_LINK(dns_adbhandle_t) plink; + ISC_LINK(dns_adbfind_t) plink; }; #define DNS_ADBFIND_INET 0x00000001 @@ -162,7 +164,7 @@ struct dns_adbaddrinfo { * to indicate that another address resolved, or all partially resolved * addresses have failed to resolve. * - * "sender" is the dns_adbhandle_t used to issue this query. + * "sender" is the dns_adbfind_t used to issue this query. * * This is simply a standard event, with the "type" set to: * @@ -225,7 +227,7 @@ isc_result_t dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, void *arg, dns_name_t *name, dns_name_t *zone, unsigned int families, isc_stdtime_t now, - dns_adbhandle_t **handle); + dns_adbfind_t **handle); /* * Main interface for clients. The adb will look up the name given in * "name" and will build up a list of found addresses, and perhaps start @@ -233,7 +235,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, * * If other addresses resolve after this call completes, an event will * be sent to the with the sender of that event - * set to a pointer to the dns_adbhandle_t returned by this function. + * set to a pointer to the dns_adbfind_t returned by this function. * * The list of addresses returned is unordered. The caller must impose * any ordering required. The list will not contain "known bad" addresses, @@ -327,7 +329,7 @@ dns_adb_insert(dns_adb_t *adb, dns_name_t *host, isc_sockaddr_t *addr, */ void -dns_adb_cancelfind(dns_adbhandle_t *handle); +dns_adb_cancelfind(dns_adbfind_t *handle); /* * Cancels the find, and sends the event off to the caller. * @@ -336,7 +338,7 @@ dns_adb_cancelfind(dns_adbhandle_t *handle); * * Requires: * - * 'handle' be a valid dns_adbhandle_t pointer. + * 'handle' be a valid dns_adbfind_t pointer. * * events would have been posted to the task. This can be checked * with (handle->options & DNS_ADBFIND_WANTEVENT). @@ -354,13 +356,13 @@ dns_adb_cancelfind(dns_adbhandle_t *handle); */ void -dns_adb_destroyfind(dns_adbhandle_t **handle); +dns_adb_destroyfind(dns_adbfind_t **handle); /* * Destroys the handle reference. * * Requires: * - * 'handle' != NULL and *handle be valid dns_adbhandle_t pointer. + * 'handle' != NULL and *handle be valid dns_adbfind_t pointer. * * Ensures: * @@ -388,7 +390,7 @@ dns_adb_dump(dns_adb_t *adb, FILE *f); */ void -dns_adb_dumphandle(dns_adbhandle_t *handle, FILE *f); +dns_adb_dumphandle(dns_adbfind_t *handle, FILE *f); /* * Dump the data associated with a handle. * diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index 68e52c7b06..6d3eda3114 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -67,8 +67,7 @@ typedef struct dns_fetch dns_fetch_t; typedef struct dns_adb dns_adb_t; typedef struct dns_adbentry dns_adbentry_t; typedef struct dns_adbaddrinfo dns_adbaddrinfo_t; -typedef struct dns_adbhandle dns_adbhandle_t; -typedef struct dns_adbname dns_adbname_t; +typedef struct dns_adbfind dns_adbfind_t; typedef struct dns_forwarders dns_forwarders_t; typedef struct dns_message dns_message_t; typedef isc_uint16_t dns_messageid_t;