2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: rbt.h,v 1.55.2.2 2004/03/09 06:11:19 marka Exp $ */
25 #include <dns/types.h>
29 #define DNS_RBT_USEHASH 1
32 * Option values for dns_rbt_findnode() and dns_rbt_findname().
33 * These are used to form a bitmask.
35 #define DNS_RBTFIND_NOOPTIONS 0x00
36 #define DNS_RBTFIND_EMPTYDATA 0x01
37 #define DNS_RBTFIND_NOEXACT 0x02
38 #define DNS_RBTFIND_NOPREDECESSOR 0x04
41 * These should add up to 30.
43 #define DNS_RBT_LOCKLENGTH 10
44 #define DNS_RBT_REFLENGTH 20
47 * This is the structure that is used for each node in the red/black
48 * tree of trees. NOTE WELL: the implementation manages this as a variable
49 * length structure, with the actual wire-format name and other data
50 * appended to this structure. Allocating a contiguous block of memory for
51 * multiple dns_rbtnode structures will not work.
53 typedef struct dns_rbtnode {
54 struct dns_rbtnode *parent;
55 struct dns_rbtnode *left;
56 struct dns_rbtnode *right;
57 struct dns_rbtnode *down;
58 #ifdef DNS_RBT_USEHASH
59 struct dns_rbtnode *hashnext;
62 * The following bitfields add up to a total bitwidth of 32.
63 * The range of values necessary for each item is indicated,
64 * but in the case of "attributes" the field is wider to accomodate
65 * possible future expansion. "offsetlen" could be one bit
66 * narrower by always adjusting its value by 1 to find the real
67 * offsetlen, but doing so does not gain anything (except perhaps
68 * another bit for "attributes", which doesn't yet need any more).
70 * In each case below the "range" indicated is what's _necessary_ for
71 * the bitfield to hold, not what it actually _can_ hold.
73 unsigned int is_root : 1; /* range is 0..1 */
74 unsigned int color : 1; /* range is 0..1 */
75 unsigned int find_callback : 1; /* range is 0..1 */
76 unsigned int attributes : 4; /* range is 0..2 */
77 unsigned int namelen : 8; /* range is 1..255 */
78 unsigned int offsetlen : 8; /* range is 1..128 */
79 unsigned int padbytes : 9; /* range is 0..380 */
81 #ifdef DNS_RBT_USEHASH
86 * These values are used in the RBT DB implementation. The appropriate
87 * node lock must be held before accessing them.
92 unsigned int locknum:DNS_RBT_LOCKLENGTH;
93 unsigned int references:DNS_RBT_REFLENGTH;
96 typedef isc_result_t (*dns_rbtfindcallback_t)(dns_rbtnode_t *node,
105 * A chain is used to keep track of the sequence of nodes to reach any given
106 * node from the root of the tree. Originally nodes did not have parent
107 * pointers in them (for memory usage reasons) so there was no way to find
108 * the path back to the root from any given node. Now that nodes have parent
109 * pointers, chains might be going away in a future release, though the
110 * movement functionality would remain.
112 * In any event, parent information, whether via parent pointers or chains, is
113 * necessary information for iterating through the tree or for basic internal
114 * tree maintenance issues (ie, the rotations that are done to rebalance the
115 * tree when a node is added). The obvious implication of this is that for a
116 * chain to remain valid, the tree has to be locked down against writes for the
117 * duration of the useful life of the chain, because additions or removals can
118 * change the path from the root to the node the chain has targetted.
120 * The dns_rbtnodechain_ functions _first, _last, _prev and _next all take
121 * dns_name_t parameters for the name and the origin, which can be NULL. If
122 * non-NULL, 'name' will end up pointing to the name data and offsets that are
123 * stored at the node (and thus it will be read-only), so it should be a
124 * regular dns_name_t that has been initialized with dns_name_init. When
125 * 'origin' is non-NULL, it will get the name of the origin stored in it, so it
126 * needs to have its own buffer space and offsets, which is most easily
127 * accomplished with a dns_fixedname_t. It is _not_ necessary to reinitialize
128 * either 'name' or 'origin' between calls to the chain functions.
130 * NOTE WELL: even though the name data at the root of the tree of trees will
131 * be absolute (typically just "."), it will will be made into a relative name
132 * with an origin of "." -- an empty name when the node is ".". This is
133 * because a common on operation on 'name' and 'origin' is to use
134 * dns_name_concatenate() on them to generate the complete name. An empty name
135 * can be detected when dns_name_countlabels == 0, and is printed by
136 * dns_name_totext()/dns_name_format() as "@", consistent with RFC1035's
137 * definition of "@" as the current origin.
139 * dns_rbtnodechain_current is similar to the _first, _last, _prev and _next
140 * functions but additionally can provide the node to which the chain points. */
143 * The number of level blocks to allocate at a time. Currently the maximum
144 * number of levels is allocated directly in the structure, but future
145 * revisions of this code might have a static initial block with dynamic
146 * growth. Allocating space for 256 levels when the tree is almost never that
147 * deep is wasteful, but it's not clear that it matters, since the waste is
148 * only 2MB for 1000 concurrently active chains on a system with 64-bit
151 #define DNS_RBT_LEVELBLOCK 254
153 typedef struct dns_rbtnodechain {
157 * The terminal node of the chain. It is not in levels[].
158 * This is ostensibly private ... but in a pinch it could be
159 * used tell that the chain points nowhere without needing to
160 * call dns_rbtnodechain_current().
164 * The maximum number of labels in a name is 128; bitstrings mean
165 * a conceptually very large number (which I have not bothered to
166 * compute) of logical levels because splitting can potentially occur
167 * at each bit. However, DNSSEC restricts the number of "logical"
168 * labels in a name to 255, meaning only 254 pointers are needed
171 dns_rbtnode_t * levels[DNS_RBT_LEVELBLOCK];
173 * level_count indicates how deep the chain points into the
174 * tree of trees, and is the index into the levels[] array.
175 * Thus, levels[level_count - 1] is the last level node stored.
176 * A chain that points to the top level of the tree of trees has
177 * a level_count of 0, the first level has a level_count of 1, and
180 unsigned int level_count;
182 * level_matches tells how many levels matched above the node
183 * returned by dns_rbt_findnode(). A match (partial or exact) found
184 * in the first level thus results in level_matches being set to 1.
185 * This is used by the rbtdb to set the start point for a recursive
186 * search of superdomains until the RR it is looking for is found.
188 unsigned int level_matches;
189 } dns_rbtnodechain_t;
192 ***** Public interfaces.
196 dns_rbt_create(isc_mem_t *mctx, void (*deleter)(void *, void *),
197 void *deleter_arg, dns_rbt_t **rbtp);
199 * Initialize a red-black tree of trees.
202 * The deleter argument, if non-null, points to a function that is
203 * responsible for cleaning up any memory associated with the data
204 * pointer of a node when the node is deleted. It is passed the
205 * deleted node's data pointer as its first argument and deleter_arg
206 * as its second argument.
209 * mctx is a pointer to a valid memory context.
210 * rbtp != NULL && *rbtp == NULL
211 * arg == NULL iff deleter == NULL
214 * If result is ISC_R_SUCCESS:
215 * *rbtp points to a valid red-black tree manager
217 * If result is failure:
218 * *rbtp does not point to a valid red-black tree manager.
221 * ISC_R_SUCCESS Success
222 * ISC_R_NOMEMORY Resource limit: Out of Memory
226 dns_rbt_addname(dns_rbt_t *rbt, dns_name_t *name, void *data);
228 * Add 'name' to the tree of trees, associated with 'data'.
231 * 'data' is never required to be non-NULL, but specifying it
232 * when the name is added is faster than searching for 'name'
233 * again and then setting the data pointer. The lack of a data pointer
234 * for a node also has other ramifications regarding whether
235 * dns_rbt_findname considers a node to exist, or dns_rbt_deletename
239 * rbt is a valid rbt manager.
240 * dns_name_isabsolute(name) == TRUE
243 * 'name' is not altered in any way.
245 * Any external references to nodes in the tree are unaffected by
246 * node splits that are necessary to insert the new name.
248 * If result is ISC_R_SUCCESS:
249 * 'name' is findable in the red/black tree of trees in O(log N).
251 * The data pointer of the node for 'name' is set to 'data'.
253 * If result is ISC_R_EXISTS or ISC_R_NOSPACE:
254 * The tree of trees is unaltered.
256 * If result is ISC_R_NOMEMORY:
260 * ISC_R_SUCCESS Success
261 * ISC_R_EXISTS The name already exists with associated data.
262 * ISC_R_NOSPACE The name had more logical labels than are allowed.
263 * ISC_R_NOMEMORY Resource Limit: Out of Memory
267 dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep);
270 * Just like dns_rbt_addname, but returns the address of the node.
273 * rbt is a valid rbt structure.
274 * dns_name_isabsolute(name) == TRUE
275 * nodep != NULL && *nodep == NULL
278 * 'name' is not altered in any way.
280 * Any external references to nodes in the tree are unaffected by
281 * node splits that are necessary to insert the new name.
283 * If result is ISC_R_SUCCESS:
284 * 'name' is findable in the red/black tree of trees in O(log N).
286 * *nodep is the node that was added for 'name'.
288 * If result is ISC_R_EXISTS:
289 * The tree of trees is unaltered.
291 * *nodep is the existing node for 'name'.
293 * If result is ISC_R_NOMEMORY:
297 * ISC_R_SUCCESS Success
298 * ISC_R_EXISTS The name already exists, possibly without data.
299 * ISC_R_NOMEMORY Resource Limit: Out of Memory
303 dns_rbt_findname(dns_rbt_t *rbt, dns_name_t *name, unsigned int options,
304 dns_name_t *foundname, void **data);
306 * Get the data pointer associated with 'name'.
309 * When DNS_RBTFIND_NOEXACT is set, the closest matching superdomain is
310 * returned (also subject to DNS_RBTFIND_EMPTYDATA), even when there is
311 * an exact match in the tree.
313 * A node that has no data is considered not to exist for this function,
314 * unless the DNS_RBTFIND_EMPTYDATA option is set.
317 * rbt is a valid rbt manager.
318 * dns_name_isabsolute(name) == TRUE
319 * data != NULL && *data == NULL
322 * 'name' and the tree are not altered in any way.
324 * If result is ISC_R_SUCCESS:
325 * *data is the data associated with 'name'.
327 * If result is DNS_R_PARTIALMATCH:
328 * *data is the data associated with the deepest superdomain
329 * of 'name' which has data.
331 * If result is ISC_R_NOTFOUND:
332 * Neither the name nor a superdomain was found with data.
335 * ISC_R_SUCCESS Success
336 * DNS_R_PARTIALMATCH Superdomain found with data
337 * ISC_R_NOTFOUND No match
338 * ISC_R_NOSPACE Concatenating nodes to form foundname failed
342 dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
343 dns_rbtnode_t **node, dns_rbtnodechain_t *chain,
344 unsigned int options, dns_rbtfindcallback_t callback,
347 * Find the node for 'name'.
350 * A node that has no data is considered not to exist for this function,
351 * unless the DNS_RBTFIND_EMPTYDATA option is set. This applies to both
352 * exact matches and partial matches.
354 * If the chain parameter is non-NULL, then the path through the tree
355 * to the DNSSEC predecessor of the searched for name is maintained,
356 * unless the DNS_RBTFIND_NOPREDECESSOR or DNS_RBTFIND_NOEXACT option
357 * is used. (For more details on those options, see below.)
359 * If there is no predecessor, then the chain will point to nowhere, as
360 * indicated by chain->end being NULL or dns_rbtnodechain_current
361 * returning ISC_R_NOTFOUND. Note that in a normal Internet DNS RBT
362 * there will always be a predecessor for all names except the root
363 * name, because '.' will exist and '.' is the predecessor of
364 * everything. But you can certainly construct a trivial tree and a
365 * search for it that has no predecessor.
367 * Within the chain structure, the 'levels' member of the structure holds
368 * the root node of each level except the first.
370 * The 'level_count' of the chain indicates how deep the chain to the
371 * predecessor name is, as an index into the 'levels[]' array. It does
372 * not count name elements, per se, but only levels of the tree of trees,
373 * the distinction arrising because multiple labels from a name can be
374 * stored on only one level. It is also does not include the level
375 * that has the node, since that level is not stored in levels[].
377 * The chain's 'level_matches' is not directly related to the predecessor.
378 * It is the number of levels above the level of the found 'node',
379 * regardless of whether it was a partial match or exact match. When
380 * the node is found in the top level tree, or no node is found at all,
381 * level_matches is 0.
383 * When DNS_RBTFIND_NOEXACT is set, the closest matching superdomain is
384 * returned (also subject to DNS_RBTFIND_EMPTYDATA), even when
385 * there is an exact match in the tree. In this case, the chain
386 * will not point to the DNSSEC predecessor, but will instead point
387 * to the exact match, if there was any. Thus the preceding paragraphs
388 * should have "exact match" substituted for "predecessor" to describe
389 * how the various elements of the chain are set. This was done to
390 * ensure that the chain's state was sane, and to prevent problems that
391 * occurred when running the predecessor location code under conditions
392 * it was not designed for. It is not clear *where* the chain should
393 * point when DNS_RBTFIND_NOEXACT is set, so if you end up using a chain
394 * with this option because you want a particular node, let us know
395 * where you want the chain pointed, so this can be made more firm.
398 * rbt is a valid rbt manager.
399 * dns_name_isabsolute(name) == TRUE.
400 * node != NULL && *node == NULL.
401 * DNS_RBTFIND_NOEXACT and DNS_RBTFIND_NOPREDECESSOR are mutally
405 * 'name' and the tree are not altered in any way.
407 * If result is ISC_R_SUCCESS:
408 * *node is the terminal node for 'name'.
410 * 'foundname' and 'name' represent the same name (though not
413 * 'chain' points to the DNSSEC predecessor, if any, of 'name'.
415 * chain->level_matches and chain->level_count are equal.
417 * If result is DNS_R_PARTIALMATCH:
418 * *node is the data associated with the deepest superdomain
419 * of 'name' which has data.
421 * 'foundname' is the name of deepest superdomain (which has
422 * data, unless the DNS_RBTFIND_EMPTYDATA option is set).
424 * 'chain' points to the DNSSEC predecessor, if any, of 'name'.
426 * If result is ISC_R_NOTFOUND:
427 * Neither the name nor a superdomain was found. *node is NULL.
429 * 'chain' points to the DNSSEC predecessor, if any, of 'name'.
431 * chain->level_matches is 0.
434 * ISC_R_SUCCESS Success
435 * DNS_R_PARTIALMATCH Superdomain found with data
436 * ISC_R_NOTFOUND No match, or superdomain with no data
437 * ISC_R_NOSPACE Concatenating nodes to form foundname failed
441 dns_rbt_deletename(dns_rbt_t *rbt, dns_name_t *name, isc_boolean_t recurse);
443 * Delete 'name' from the tree of trees.
446 * When 'name' is removed, if recurse is ISC_TRUE then all of its
447 * subnames are removed too.
450 * rbt is a valid rbt manager.
451 * dns_name_isabsolute(name) == TRUE
454 * 'name' is not altered in any way.
456 * Does NOT ensure that any external references to nodes in the tree
457 * are unaffected by node joins.
459 * If result is ISC_R_SUCCESS:
460 * 'name' does not appear in the tree with data; however,
461 * the node for the name might still exist which can be
462 * found with dns_rbt_findnode (but not dns_rbt_findname).
464 * If result is ISC_R_NOTFOUND:
465 * 'name' does not appear in the tree with data, because
466 * it did not appear in the tree before the function was called.
468 * If result is something else:
469 * See result codes for dns_rbt_findnode (if it fails, the
470 * node is not deleted) or dns_rbt_deletenode (if it fails,
471 * the node is deleted, but the tree is not optimized when
472 * it could have been).
475 * ISC_R_SUCCESS Success
476 * ISC_R_NOTFOUND No match
477 * something_else Any return code from dns_rbt_findnode except
478 * DNS_R_PARTIALMATCH (which causes ISC_R_NOTFOUND
479 * to be returned instead), and any code from
480 * dns_rbt_deletenode.
484 dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, isc_boolean_t recurse);
486 * Delete 'node' from the tree of trees.
489 * When 'node' is removed, if recurse is ISC_TRUE then all nodes
490 * in levels down from it are removed too.
493 * rbt is a valid rbt manager.
497 * Does NOT ensure that any external references to nodes in the tree
498 * are unaffected by node joins.
500 * If result is ISC_R_SUCCESS:
501 * 'node' does not appear in the tree with data; however,
502 * the node might still exist if it serves as a pointer to
503 * a lower tree level as long as 'recurse' was false, hence
504 * the node could can be found with dns_rbt_findnode whem
505 * that function's empty_data_ok parameter is true.
507 * If result is ISC_R_NOMEMORY or ISC_R_NOSPACE:
508 * The node was deleted, but the tree structure was not
512 * ISC_R_SUCCESS Success
513 * ISC_R_NOMEMORY Resource Limit: Out of Memory when joining nodes.
514 * ISC_R_NOSPACE dns_name_concatenate failed when joining nodes.
518 dns_rbt_namefromnode(dns_rbtnode_t *node, dns_name_t *name);
520 * Convert the sequence of labels stored at 'node' into a 'name'.
523 * This function does not return the full name, from the root, but
524 * just the labels at the indicated node.
526 * The name data pointed to by 'name' is the information stored
527 * in the node, not a copy. Altering the data at this pointer
528 * will likely cause grief.
531 * name->offsets == NULL
534 * 'name' is DNS_NAMEATTR_READONLY.
536 * 'name' will point directly to the labels stored after the
537 * dns_rbtnode_t struct.
539 * 'name' will have offsets that also point to the information stored
540 * as part of the node.
544 dns_rbt_fullnamefromnode(dns_rbtnode_t *node, dns_name_t *name);
546 * Like dns_rbt_namefromnode, but returns the full name from the root.
549 * Unlike dns_rbt_namefromnode, the name will not point directly
550 * to node data. Rather, dns_name_concatenate will be used to copy
551 * the name data from each node into the 'name' argument.
555 * name has a dedicated buffer.
559 * ISC_R_NOSPACE (possible via dns_name_concatenate)
560 * DNS_R_NAMETOOLONG (possible via dns_name_concatenate)
564 dns_rbt_formatnodename(dns_rbtnode_t *node, char *printname,
567 * Format the full name of a node for printing, using dns_name_format().
570 * 'size' is the length of the printname buffer. This should be
571 * DNS_NAME_FORMATSIZE or larger.
574 * node and printname are not NULL.
577 * The 'printname' pointer.
581 dns_rbt_nodecount(dns_rbt_t *rbt);
583 * Obtain the number of nodes in the tree of trees.
586 * rbt is a valid rbt manager.
590 dns_rbt_destroy(dns_rbt_t **rbtp);
592 dns_rbt_destroy2(dns_rbt_t **rbtp, unsigned int quantum);
594 * Stop working with a red-black tree of trees. Once dns_rbt_destroy2()
595 * has been called on a 'rbt' only dns_rbt_destroy() or dns_rbt_destroy2()
596 * may be used on the tree. If 'quantum' is zero then the entire tree will
600 * *rbt is a valid rbt manager.
603 * All space allocated by the RBT library has been returned.
605 * *rbt is invalidated as an rbt manager.
609 * ISC_R_QUOTA if 'quantum' nodes have been destroyed.
613 dns_rbt_printall(dns_rbt_t *rbt);
615 * Print an ASCII representation of the internal structure of the red-black
619 * The name stored at each node, along with the node's color, is printed.
620 * Then the down pointer, left and right pointers are displayed
621 * recursively in turn. NULL down pointers are silently omitted;
622 * NULL left and right pointers are printed.
626 ***** Chain Functions
630 dns_rbtnodechain_init(dns_rbtnodechain_t *chain, isc_mem_t *mctx);
632 * Initialize 'chain'.
635 * 'chain' is a valid pointer.
637 * 'mctx' is a valid memory context.
640 * 'chain' is suitable for use.
644 dns_rbtnodechain_reset(dns_rbtnodechain_t *chain);
646 * Free any dynamic storage associated with 'chain', and then reinitialize
650 * 'chain' is a valid pointer.
653 * 'chain' is suitable for use, and uses no dynamic storage.
657 dns_rbtnodechain_invalidate(dns_rbtnodechain_t *chain);
659 * Free any dynamic storage associated with 'chain', and then invalidates it.
662 * Future calls to any dns_rbtnodechain_ function will need to call
663 * dns_rbtnodechain_init on the chain first (except, of course,
664 * dns_rbtnodechain_init itself).
667 * 'chain' is a valid chain.
670 * 'chain' is no longer suitable for use, and uses no dynamic storage.
674 dns_rbtnodechain_current(dns_rbtnodechain_t *chain, dns_name_t *name,
675 dns_name_t *origin, dns_rbtnode_t **node);
677 * Provide the name, origin and node to which the chain is currently pointed.
680 * The tree need not have be locked against additions for the chain
681 * to remain valid, however there are no guarantees if any deletion
682 * has been made since the chain was established.
685 * 'chain' is a valid chain.
688 * 'node', if non-NULL, is the node to which the chain was pointed
689 * by dns_rbt_findnode, dns_rbtnodechain_first or dns_rbtnodechain_last.
690 * If none were called for the chain since it was initialized or reset,
691 * or if the was no predecessor to the name searched for with
692 * dns_rbt_findnode, then '*node' is NULL and ISC_R_NOTFOUND is returned.
694 * 'name', if non-NULL, is the name stored at the terminal level of
695 * the chain. This is typically a single label, like the "www" of
696 * "www.isc.org", but need not be so. At the root of the tree of trees,
697 * if the node is "." then 'name' is ".", otherwise it is relative to ".".
698 * (Minimalist and atypical case: if the tree has just the name
699 * "isc.org." then the root node's stored name is "isc.org." but 'name'
700 * will be "isc.org".)
702 * 'origin', if non-NULL, is the sequence of labels in the levels
703 * above the terminal level, such as "isc.org." in the above example.
704 * 'origin' is always "." for the root node.
708 * ISC_R_SUCCESS name, origin & node were successfully set.
709 * ISC_R_NOTFOUND The chain does not point to any node.
710 * <something_else> Any error return from dns_name_concatenate.
714 dns_rbtnodechain_first(dns_rbtnodechain_t *chain, dns_rbt_t *rbt,
715 dns_name_t *name, dns_name_t *origin);
717 * Set the chain to the lexically first node in the tree of trees.
720 * By the definition of ordering for DNS names, the root of the tree of
721 * trees is the very first node, since everything else in the megatree
722 * uses it as a common suffix.
725 * 'chain' is a valid chain.
726 * 'rbt' is a valid rbt manager.
729 * The chain points to the very first node of the tree.
731 * 'name' and 'origin', if non-NULL, are set as described for
732 * dns_rbtnodechain_current. Thus 'origin' will always be ".".
735 * DNS_R_NEWORIGIN The name & origin were successfully set.
736 * <something_else> Any error result from dns_rbtnodechain_current.
740 dns_rbtnodechain_last(dns_rbtnodechain_t *chain, dns_rbt_t *rbt,
741 dns_name_t *name, dns_name_t *origin);
743 * Set the chain to the lexically last node in the tree of trees.
746 * 'chain' is a valid chain.
747 * 'rbt' is a valid rbt manager.
750 * The chain points to the very last node of the tree.
752 * 'name' and 'origin', if non-NULL, are set as described for
753 * dns_rbtnodechain_current.
756 * DNS_R_NEWORIGIN The name & origin were successfully set.
757 * ISC_R_NOMEMORY Resource Limit: Out of Memory building chain.
758 * <something_else> Any error result from dns_name_concatenate.
762 dns_rbtnodechain_prev(dns_rbtnodechain_t *chain, dns_name_t *name,
765 * Adjusts chain to point the DNSSEC predecessor of the name to which it
766 * is currently pointed.
769 * 'chain' is a valid chain.
770 * 'chain' has been pointed somewhere in the tree with dns_rbt_findnode,
771 * dns_rbtnodechain_first or dns_rbtnodechain_last -- and remember that
772 * dns_rbt_findnode is not guaranteed to point the chain somewhere,
773 * since there may have been no predecessor to the searched for name.
776 * The chain is pointed to the predecessor of its current target.
778 * 'name' and 'origin', if non-NULL, are set as described for
779 * dns_rbtnodechain_current.
781 * 'origin' is only if a new origin was found.
784 * ISC_R_SUCCESS The predecessor was found and 'name' was set.
785 * DNS_R_NEWORIGIN The predecessor was found with a different
786 * origin and 'name' and 'origin' were set.
787 * ISC_R_NOMORE There was no predecessor.
788 * <something_else> Any error result from dns_rbtnodechain_current.
792 dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name,
795 * Adjusts chain to point the DNSSEC successor of the name to which it
796 * is currently pointed.
799 * 'chain' is a valid chain.
800 * 'chain' has been pointed somewhere in the tree with dns_rbt_findnode,
801 * dns_rbtnodechain_first or dns_rbtnodechain_last -- and remember that
802 * dns_rbt_findnode is not guaranteed to point the chain somewhere,
803 * since there may have been no predecessor to the searched for name.
806 * The chain is pointed to the successor of its current target.
808 * 'name' and 'origin', if non-NULL, are set as described for
809 * dns_rbtnodechain_current.
811 * 'origin' is only if a new origin was found.
814 * ISC_R_SUCCESS The successor was found and 'name' was set.
815 * DNS_R_NEWORIGIN The successor was found with a different
816 * origin and 'name' and 'origin' were set.
817 * ISC_R_NOMORE There was no successor.
818 * <something_else> Any error result from dns_name_concatenate.
823 #endif /* DNS_RBT_H */