Commit 2e8e76e5 authored by Brian Wellington's avatar Brian Wellington
Browse files

Added dns_keytable_finddeepestmatch()

parent 605b13c0
......@@ -156,6 +156,28 @@ dns_keytable_findkeynode(dns_keytable_t *keytable, dns_name_t *name,
* Any other result indicates an error.
*/
isc_result_t
dns_keytable_finddeepestmatch(dns_keytable_t *keytable, dns_name_t *name,
dns_name_t *foundname);
/*
* Search for the deepest match of 'name' in 'keytable'.
*
* Requires:
*
* 'keytable' is a valid keytable.
*
* 'name' is a valid absolute name.
*
* 'foundname' is a name with a dedicated buffer.
*
* Returns:
*
* ISC_R_SUCCESS
* ISC_R_NOTFOUND
*
* Any other result indicates an error.
*/
void
dns_keytable_detachkeynode(dns_keytable_t *keytable,
dns_keynode_t **keynodep);
......
......@@ -285,6 +285,36 @@ dns_keytable_findkeynode(dns_keytable_t *keytable, dns_name_t *name,
return (result);
}
isc_result_t
dns_keytable_finddeepestmatch(dns_keytable_t *keytable, dns_name_t *name,
dns_name_t *foundname)
{
isc_result_t result;
dns_keynode_t *knode;
void *data;
/*
* Search for the deepest match in 'keytable'.
*/
REQUIRE(VALID_KEYTABLE(keytable));
REQUIRE(dns_name_isabsolute(name));
REQUIRE(foundname != NULL);
RWLOCK(&keytable->rwlock, isc_rwlocktype_read);
knode = NULL;
data = NULL;
result = dns_rbt_findname(keytable->table, name, foundname, &data);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH)
result = ISC_R_SUCCESS;
RWUNLOCK(&keytable->rwlock, isc_rwlocktype_read);
return (result);
}
void
dns_keytable_detachkeynode(dns_keytable_t *keytable,
dns_keynode_t **keynodep)
......
Supports Markdown
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