2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

add a test method to print QP keys

add a method qp_test_printkey() to print the name encoded in a QP key.
This commit is contained in:
Evan Hunt 2024-04-30 01:22:39 -07:00
parent 539518bfba
commit a0bd1e67cd
2 changed files with 18 additions and 0 deletions

View File

@ -84,3 +84,9 @@ qp_test_dumptrie(dns_qpreadable_t qp);
*/
void
qp_test_dumpdot(dns_qp_t *qp);
/*
* Print the name encoded in a QP key.
*/
void
qp_test_printkey(const dns_qpkey_t key, size_t keylen);

View File

@ -23,6 +23,7 @@
#include <isc/urcu.h>
#include <isc/util.h>
#include <dns/fixedname.h>
#include <dns/name.h>
#include <dns/qp.h>
#include <dns/types.h>
@ -338,4 +339,15 @@ qp_test_dumpdot(dns_qp_t *qp) {
printf("}\n");
}
void
qp_test_printkey(const dns_qpkey_t key, size_t keylen) {
dns_fixedname_t fn;
dns_name_t *n = dns_fixedname_initname(&fn);
char txt[DNS_NAME_FORMATSIZE];
dns_qpkey_toname(key, keylen, n);
dns_name_format(n, txt, sizeof(txt));
printf("%s%s\n", txt, dns_name_isabsolute(n) ? "." : "");
}
/**********************************************************************/