mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Added dns_keytable_finddeepestmatch()
This commit is contained in:
parent
605b13c0dc
commit
2e8e76e547
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user