REQUIRE(VALID_FWDTABLE(fwdtable));
dns_qpmulti_query(fwdtable->table, &qpr);
- result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL,
- NULL, &pval, NULL);
+ result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
+ &pval, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
dns_forwarders_t *fwdrs = pval;
*forwardersp = fwdrs;
isc_result_t
dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
- dns_namespace_t space, dns_qpiter_t *iter,
- dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r);
+ dns_namespace_t space, dns_qpiter_t *iter, dns_qpchain_t *chain,
+ void **pval_r, uint32_t *ival_r);
/*%<
* Look up a leaf in a qp-trie that is equal to, or an ancestor domain of,
* 'name' in the namespace 'space'.
* \li ISC_R_NOMORE otherwise
*/
-
isc_result_t
dns_qpiter_current(dns_qpiter_t *qpi, void **pval_r, uint32_t *ival_r);
/*%<
* at a leaf node
*/
-
void
dns_qpchain_init(dns_qpreadable_t qpr, dns_qpchain_t *chain);
/*%<
*/
void
-dns_qpchain_node(dns_qpchain_t *chain, unsigned int level,
- void **pval_r, uint32_t *ival_r);
+dns_qpchain_node(dns_qpchain_t *chain, unsigned int level, void **pval_r,
+ uint32_t *ival_r);
/*%<
* Sets 'name' to the name of the leaf referenced at `chain->stack[level]`.
*
REQUIRE(foundname != NULL);
dns_qpmulti_query(keytable->table, &qpr);
- result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL,
- NULL, &pval, NULL);
+ result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
+ &pval, NULL);
keynode = pval;
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
REQUIRE(dns_name_isabsolute(name));
dns_qpmulti_query(keytable->table, &qpr);
- result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL,
- NULL, &pval, NULL);
+ result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
+ &pval, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
keynode = pval;
if (foundname != NULL) {
REQUIRE(VALID_NAMETREE(nametree));
dns_qpmulti_query(nametree->table, &qpr);
- result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL,
- NULL, (void **)&node, NULL);
+ result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
+ (void **)&node, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
if (found != NULL) {
dns_name_copy(&node->name, found);
RWLOCK(&ntatable->rwlock, isc_rwlocktype_read);
dns_qpmulti_query(ntatable->table, &qpr);
- result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL,
- NULL, &pval, NULL);
+ result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
+ &pval, NULL);
nta = pval;
switch (result) {
}
void
-dns_qpchain_node(dns_qpchain_t *chain, unsigned int level,
- void **pval_r, uint32_t *ival_r) {
+dns_qpchain_node(dns_qpchain_t *chain, unsigned int level, void **pval_r,
+ uint32_t *ival_r) {
dns_qpnode_t *node = NULL;
REQUIRE(QPCHAIN_VALID(chain));
return iterate(false, qpi, pval_r, ival_r);
}
-
-
isc_result_t
dns_qpiter_current(dns_qpiter_t *qpi, void **pval_r, uint32_t *ival_r) {
dns_qpnode_t *node = NULL;
return ISC_R_SUCCESS;
}
-
/***********************************************************************
*
* search
isc_result_t
dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
- dns_namespace_t space, dns_qpiter_t *iter,
- dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r) {
+ dns_namespace_t space, dns_qpiter_t *iter, dns_qpchain_t *chain,
+ void **pval_r, uint32_t *ival_r) {
dns_qpreader_t *qp = dns_qpreader(qpr);
dns_qpkey_t search, found;
size_t searchlen, foundlen;
/**********************************************************************/
-
void
dns__qp_initialize(void);
void
isc_result_t zcresult;
qpcnode_t *encloser = NULL;
- dns_qpchain_node(&search.chain, i, (void **)&encloser,
- NULL);
+ dns_qpchain_node(&search.chain, i, (void **)&encloser, NULL);
zcresult = check_zonecut(encloser,
(void *)&search DNS__DB_FLARG_PASS);
INSIST(len >= 2);
node = NULL;
- dns_qpchain_node(&search.chain, len - 2,
- (void **)&node, NULL);
+ dns_qpchain_node(&search.chain, len - 2, (void **)&node,
+ NULL);
search.chain.len = len - 1;
}
if (continuing && qpdbiter->node != NULL) {
isc_result_t result;
result = dns_qp_lookup(qpdb->tree, qpdbiter->name,
- DNS_DBNAMESPACE_NORMAL,
- &qpdbiter->iter, NULL, NULL, NULL);
+ DNS_DBNAMESPACE_NORMAL, &qpdbiter->iter,
+ NULL, NULL, NULL);
INSIST(result == ISC_R_SUCCESS);
}
dereference_iter_node(qpdbiter DNS__DB_FLARG_PASS);
dns_qpiter_init(qpdb->tree, &qpdbiter->iter);
- result = dns_qpiter_next(&qpdbiter->iter,
- (void **)&qpdbiter->node, NULL);
+ result = dns_qpiter_next(&qpdbiter->iter, (void **)&qpdbiter->node,
+ NULL);
if (result == ISC_R_SUCCESS &&
qpdbiter->node->nspace == DNS_DBNAMESPACE_NORMAL)
dereference_iter_node(qpdbiter DNS__DB_FLARG_PASS);
- result = dns_qpiter_next(&qpdbiter->iter,
- (void **)&qpdbiter->node, NULL);
+ result = dns_qpiter_next(&qpdbiter->iter, (void **)&qpdbiter->node,
+ NULL);
if (result == ISC_R_SUCCESS &&
qpdbiter->node->nspace == DNS_DBNAMESPACE_NORMAL)
}
result = dns_qp_lookup(&search->qpr, wname, nspace,
- &wit, NULL,
- (void **)&wnode, NULL);
+ &wit, NULL, (void **)&wnode,
+ NULL);
if (result == ISC_R_SUCCESS) {
/*
* We have found the wildcard node. If it
* NSEC record; we want the previous node
* in the NSEC tree.
*/
- result = dns_qpiter_prev(nit, (void **)&node, NULL);
+ result = dns_qpiter_prev(nit, (void **)&node,
+ NULL);
if (result == ISC_R_SUCCESS) {
dns_name_copy(&node->name, name);
}
* node in the NSEC namespace, which is
* what we want.
*/
- isc_result_t iresult = dns_qpiter_current(nit, (void **)&node, NULL);
+ isc_result_t iresult = dns_qpiter_current(
+ nit, (void **)&node, NULL);
if (iresult == ISC_R_SUCCESS) {
dns_name_copy(&node->name, name);
}
}
*nodep = NULL;
- result = dns_qp_lookup(
- &search->qpr, name, DNS_DBNAMESPACE_NORMAL,
- &search->iter, &search->chain, (void **)nodep, NULL);
+ result = dns_qp_lookup(&search->qpr, name,
+ DNS_DBNAMESPACE_NORMAL, &search->iter,
+ &search->chain, (void **)nodep, NULL);
if (result == ISC_R_SUCCESS) {
break;
}
} while (empty_node && result == ISC_R_SUCCESS);
if (result == ISC_R_NOMORE && wraps) {
- result = dns_qpiter_prev(&search->iter, (void **)&node,
- NULL);
+ result = dns_qpiter_prev(&search->iter, (void **)&node, NULL);
if (result == ISC_R_SUCCESS) {
dns_name_copy(&node->name, name);
wraps = false;
dereference_iter_node(qpdbiter DNS__DB_FLARG_PASS);
dns_qpiter_init(qpdbiter->snap, &qpdbiter->iter);
- result = dns_qpiter_next(&qpdbiter->iter,
- (void **)&qpdbiter->node, NULL);
+ result = dns_qpiter_next(&qpdbiter->iter, (void **)&qpdbiter->node,
+ NULL);
switch (qpdbiter->nsec3mode) {
case nonsec3:
* origin node.
*/
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
- DNS_DBNAMESPACE_NSEC3,
- &qpdbiter->iter, NULL,
- (void **)&qpdbiter->node, NULL);
+ DNS_DBNAMESPACE_NSEC3, &qpdbiter->iter,
+ NULL, (void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS ||
QPDBITER_NSEC3_ORIGIN_NODE(qpdb, qpdbiter))
{
dereference_iter_node(qpdbiter DNS__DB_FLARG_PASS);
dns_qpiter_init(qpdbiter->snap, &qpdbiter->iter);
- result = dns_qpiter_prev(&qpdbiter->iter,
- (void **)&qpdbiter->node, NULL);
+ result = dns_qpiter_prev(&qpdbiter->iter, (void **)&qpdbiter->node,
+ NULL);
switch (qpdbiter->nsec3mode) {
case nsec3only:
* The final non-nsec node is before the the NSEC origin node.
*/
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
- DNS_DBNAMESPACE_NSEC,
- &qpdbiter->iter, NULL,
- (void **)&qpdbiter->node, NULL);
+ DNS_DBNAMESPACE_NSEC, &qpdbiter->iter,
+ NULL, (void **)&qpdbiter->node, NULL);
if (result == ISC_R_SUCCESS) {
INSIST(QPDBITER_NSEC_ORIGIN_NODE(qpdb, qpdbiter));
/* skip the NSEC origin node */
switch (qpdbiter->nsec3mode) {
case nsec3only:
- result = dns_qp_lookup(
- qpdbiter->snap, name, DNS_DBNAMESPACE_NSEC3,
- &qpdbiter->iter, NULL, (void **)&qpdbiter->node, NULL);
+ result = dns_qp_lookup(qpdbiter->snap, name,
+ DNS_DBNAMESPACE_NSEC3, &qpdbiter->iter,
+ NULL, (void **)&qpdbiter->node, NULL);
break;
case nonsec3:
- result = dns_qp_lookup(
- qpdbiter->snap, name, DNS_DBNAMESPACE_NORMAL,
- &qpdbiter->iter, NULL, (void **)&qpdbiter->node, NULL);
+ result = dns_qp_lookup(qpdbiter->snap, name,
+ DNS_DBNAMESPACE_NORMAL, &qpdbiter->iter,
+ NULL, (void **)&qpdbiter->node, NULL);
break;
case full:
- result = dns_qp_lookup(
- qpdbiter->snap, name, DNS_DBNAMESPACE_NORMAL,
- &qpdbiter->iter, NULL, (void **)&qpdbiter->node, NULL);
+ result = dns_qp_lookup(qpdbiter->snap, name,
+ DNS_DBNAMESPACE_NORMAL, &qpdbiter->iter,
+ NULL, (void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS) {
tresult = dns_qp_lookup(qpdbiter->snap, name,
DNS_DBNAMESPACE_NSEC3,
node = qpdbiter->node;
qpdbiter->node = NULL;
- result = dns_qpiter_prev(&qpdbiter->iter,
- (void **)&qpdbiter->node, NULL);
+ result = dns_qpiter_prev(&qpdbiter->iter, (void **)&qpdbiter->node,
+ NULL);
switch (qpdbiter->nsec3mode) {
case nsec3only:
INSIST(qpdbiter->node->nspace == DNS_DBNAMESPACE_NSEC);
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
- DNS_DBNAMESPACE_NSEC,
- &qpdbiter->iter, NULL,
- (void **)&qpdbiter->node, NULL);
+ DNS_DBNAMESPACE_NSEC, &qpdbiter->iter,
+ NULL, (void **)&qpdbiter->node, NULL);
if (result == ISC_R_SUCCESS) {
INSIST(QPDBITER_NSEC_ORIGIN_NODE(qpdb, qpdbiter));
node = qpdbiter->node;
qpdbiter->node = NULL;
- result = dns_qpiter_next(&qpdbiter->iter,
- (void **)&qpdbiter->node, NULL);
+ result = dns_qpiter_next(&qpdbiter->iter, (void **)&qpdbiter->node,
+ NULL);
switch (qpdbiter->nsec3mode) {
case nonsec3:
INSIST(qpdbiter->node->nspace == DNS_DBNAMESPACE_NSEC);
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
- DNS_DBNAMESPACE_NSEC3,
- &qpdbiter->iter, NULL,
- (void **)&qpdbiter->node, NULL);
+ DNS_DBNAMESPACE_NSEC3, &qpdbiter->iter,
+ NULL, (void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS ||
QPDBITER_NSEC3_ORIGIN_NODE(qpdb, qpdbiter))
{
* seek the NSEC3 origin node.
*/
result = dns_qp_lookup(iter->snap, &qpdb->common.origin,
- DNS_DBNAMESPACE_NSEC3, &iter->iter,
- NULL, NULL, NULL);
+ DNS_DBNAMESPACE_NSEC3, &iter->iter, NULL,
+ NULL, NULL);
INSIST(result == ISC_R_SUCCESS);
break;
default:
dns_qpmulti_query(rpzs->table, &qpr);
dns_qpchain_init(&qpr, &chain);
- result = dns_qp_lookup(&qpr, trig_name, DNS_DBNAMESPACE_NORMAL,
- NULL, &chain, (void **)&data, NULL);
+ result = dns_qp_lookup(&qpr, trig_name, DNS_DBNAMESPACE_NORMAL, NULL,
+ &chain, (void **)&data, NULL);
switch (result) {
case ISC_R_SUCCESS:
INSIST(data != NULL);
result = dns_qp_getname(&qpr, name, DNS_DBNAMESPACE_NORMAL,
&pval, NULL);
} else {
- result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL,
- NULL, &chain, &pval, NULL);
+ result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL,
+ &chain, &pval, NULL);
if (exactopts == DNS_ZTFIND_NOEXACT && result == ISC_R_SUCCESS)
{
/* get pval from the previous chain link */
int len = dns_qpchain_length(&chain);
if (len >= 2) {
- dns_qpchain_node(&chain, len - 2, &pval,
- NULL);
+ dns_qpchain_node(&chain, len - 2, &pval, NULL);
result = DNS_R_PARTIALMATCH;
} else {
result = ISC_R_NOTFOUND;
start = isc_time_monotonic();
for (i = 0; i < n; i++) {
name = dns_fixedname_name(&items[i]);
- dns_qp_lookup(qp, name, DNS_DBNAMESPACE_NORMAL, NULL,
- NULL, NULL, NULL);
+ dns_qp_lookup(qp, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
+ NULL, NULL);
}
stop = isc_time_monotonic();
++search->ndata[1];
}
- dns_qp_lookup(qp, search, DNS_DBNAMESPACE_NORMAL, NULL,
- NULL, NULL, NULL);
+ dns_qp_lookup(qp, search, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
+ NULL, NULL);
}
stop = isc_time_monotonic();
static isc_result_t
qpiter_current_with_name(dns_qpiter_t *qpi, dns_name_t *name, void **pval_r,
- uint32_t *ival_r) {
+ uint32_t *ival_r) {
isc_result_t result;
void *pval = NULL;
uint32_t ival = 0;
/* check that we see only valid items in the correct order */
uint32_t prev = 0;
dns_qpiter_init(qp, &qpi);
- while (dns_qpiter_next(&qpi, &pval, &ival) ==
- ISC_R_SUCCESS)
- {
+ while (dns_qpiter_next(&qpi, &pval, &ival) == ISC_R_SUCCESS) {
assert_in_range(ival, prev + 1, ITER_ITEMS - 1);
assert_int_equal(ival, item[ival]);
assert_ptr_equal(pval, &item[ival]);
/* now iterate backward and check correctness */
n = inserted;
- while (dns_qpiter_prev(&qpi, NULL, &ival) ==
- ISC_R_SUCCESS)
- {
+ while (dns_qpiter_prev(&qpi, NULL, &ival) == ISC_R_SUCCESS) {
--n;
assert_int_equal(ival, order[n]);
assert_int_equal(n, 0);
/* ...and forward again */
- while (dns_qpiter_next(&qpi, NULL, &ival) ==
- ISC_R_SUCCESS)
- {
+ while (dns_qpiter_next(&qpi, NULL, &ival) == ISC_R_SUCCESS) {
assert_int_equal(ival, order[n]);
/* and check current iterator value as well */
* to confirm we can change directions while iterating.
*/
if (inserted > 3) {
- assert_int_equal(
- dns_qpiter_next(&qpi, NULL, &ival),
- ISC_R_SUCCESS);
+ assert_int_equal(dns_qpiter_next(&qpi, NULL, &ival),
+ ISC_R_SUCCESS);
assert_int_equal(ival, order[0]);
- assert_int_equal(
- dns_qpiter_next(&qpi, NULL, &ival),
- ISC_R_SUCCESS);
+ assert_int_equal(dns_qpiter_next(&qpi, NULL, &ival),
+ ISC_R_SUCCESS);
assert_int_equal(ival, order[1]);
- assert_int_equal(
- dns_qpiter_prev(&qpi, NULL, &ival),
- ISC_R_SUCCESS);
+ assert_int_equal(dns_qpiter_prev(&qpi, NULL, &ival),
+ ISC_R_SUCCESS);
assert_int_equal(ival, order[0]);
- assert_int_equal(
- dns_qpiter_next(&qpi, NULL, &ival),
- ISC_R_SUCCESS);
+ assert_int_equal(dns_qpiter_next(&qpi, NULL, &ival),
+ ISC_R_SUCCESS);
assert_int_equal(ival, order[1]);
- assert_int_equal(
- dns_qpiter_prev(&qpi, NULL, &ival),
- ISC_R_SUCCESS);
+ assert_int_equal(dns_qpiter_prev(&qpi, NULL, &ival),
+ ISC_R_SUCCESS);
assert_int_equal(ival, order[0]);
- assert_int_equal(
- dns_qpiter_prev(&qpi, NULL, &ival),
- ISC_R_NOMORE);
+ assert_int_equal(dns_qpiter_prev(&qpi, NULL, &ival),
+ ISC_R_NOMORE);
}
}
dns_test_namefromstring(check[i].query, &fn1);
dns_qpchain_init(qp, &chain);
- result = dns_qp_lookup(qp, name, space, NULL,
- &chain, &pval, NULL);
+ result = dns_qp_lookup(qp, name, space, NULL, &chain, &pval,
+ NULL);
/* Extract the found name if we found something */
if ((result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) &&
dns_qpchain_init(qp, &chain);
dns_test_namefromstring(check[i].query, &fn1);
- result = dns_qp_lookup(qp, name, check[i].space, iter,
- &chain, NULL, NULL);
+ result = dns_qp_lookup(qp, name, check[i].space, iter, &chain,
+ NULL, NULL);
#if 0
fprintf(stderr,
"%s %s (expected %s), "
result = dns_name_tostring(expred, &predstr, isc_g_mctx);
assert_int_equal(result, ISC_R_SUCCESS);
- result = dns_qp_lookup(qp, name, check[i].space, &it,
- chain, NULL, NULL);
+ result = dns_qp_lookup(qp, name, check[i].space, &it, chain,
+ NULL, NULL);
#if 0
fprintf(stderr, "%s %s: expected %s got %s\n", check[i].query,
check[i].space == DNS_DBNAMESPACE_NSEC3
result = qpiter_prev_with_name(&it, pred, NULL, &ival);
if (result == ISC_R_NOMORE) {
result = qpiter_prev_with_name(&it, pred, NULL,
- &ival);
+ &ival);
}
} else {
/*
* we didn't find a match, so the iterator should
* already be pointed at the predecessor node.
*/
- result = qpiter_current_with_name(&it, pred, NULL, &ival);
+ result = qpiter_current_with_name(&it, pred, NULL,
+ &ival);
}
assert_int_equal(result, ISC_R_SUCCESS);
isc_mem_free(isc_g_mctx, predstr);
int j = 0;
- while (qpiter_next_with_name(&it, name, NULL, NULL) == ISC_R_SUCCESS)
+ while (qpiter_next_with_name(&it, name, NULL, NULL) ==
+ ISC_R_SUCCESS)
{
#if 0
result = dns_name_tostring(name, &namestr, isc_g_mctx);