Skip to content

add an iterator argument to dns_qp_lookup()

Evan Hunt requested to merge each-qp-lookup-iterator into main

the 'predecessor' argument to dns_qp_lookup() turns out not to be sufficient for our needs: the predecessor node in a QP database may have become empty because of an update or data expiring, in which case we would have to iterate more than one step back to find the predecessor node we want.

also, it may be necessary for the caller to iterate forward, in order to determine whether a node has children.

for both of these reasons, we now replace the 'predecessor' argument with an 'iter' argument, which, if set, points to a dns_qpiter object. when an exact match is found by the lookup, the iterator will be pointing to the matching node, and if not, it will be pointing to the predecessor node.

the dns_qpiter_current() method has been added for examining the current value of the iterator without moving it in either direction.

Merge request reports