diff options
Diffstat (limited to 'usr.sbin/bind/lib/dns/include/dns/rbt.h')
-rw-r--r-- | usr.sbin/bind/lib/dns/include/dns/rbt.h | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/usr.sbin/bind/lib/dns/include/dns/rbt.h b/usr.sbin/bind/lib/dns/include/dns/rbt.h index 9f9c576cb58..a57cf21e5b3 100644 --- a/usr.sbin/bind/lib/dns/include/dns/rbt.h +++ b/usr.sbin/bind/lib/dns/include/dns/rbt.h @@ -1,26 +1,27 @@ /* - * Copyright (C) 1999-2001 Internet Software Consortium. + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: rbt.h,v 1.55 2001/06/01 03:07:54 halley Exp $ */ +/* $ISC: rbt.h,v 1.55.12.5 2004/03/08 09:04:38 marka Exp $ */ #ifndef DNS_RBT_H #define DNS_RBT_H 1 #include <isc/lang.h> +#include <isc/magic.h> #include <dns/types.h> @@ -43,6 +44,13 @@ ISC_LANG_BEGINDECLS #define DNS_RBT_LOCKLENGTH 10 #define DNS_RBT_REFLENGTH 20 +#define DNS_RBTNODE_MAGIC ISC_MAGIC('R','B','N','O') +#if DNS_RBT_USEMAGIC +#define DNS_RBTNODE_VALID(n) ISC_MAGIC_VALID(n, DNS_RBTNODE_MAGIC) +#else +#define DNS_RBTNODE_VALID(n) ISC_TRUE +#endif + /* * This is the structure that is used for each node in the red/black * tree of trees. NOTE WELL: the implementation manages this as a variable @@ -51,6 +59,9 @@ ISC_LANG_BEGINDECLS * multiple dns_rbtnode structures will not work. */ typedef struct dns_rbtnode { +#if DNS_RBT_USEMAGIC + unsigned int magic; +#endif struct dns_rbtnode *parent; struct dns_rbtnode *left; struct dns_rbtnode *right; @@ -137,7 +148,8 @@ typedef isc_result_t (*dns_rbtfindcallback_t)(dns_rbtnode_t *node, * definition of "@" as the current origin. * * dns_rbtnodechain_current is similar to the _first, _last, _prev and _next - * functions but additionally can provide the node to which the chain points. */ + * functions but additionally can provide the node to which the chain points. + */ /* * The number of level blocks to allocate at a time. Currently the maximum @@ -588,8 +600,13 @@ dns_rbt_nodecount(dns_rbt_t *rbt); void dns_rbt_destroy(dns_rbt_t **rbtp); +isc_result_t +dns_rbt_destroy2(dns_rbt_t **rbtp, unsigned int quantum); /* - * Stop working with a red-black tree of trees. + * Stop working with a red-black tree of trees. Once dns_rbt_destroy2() + * has been called on a 'rbt' only dns_rbt_destroy() or dns_rbt_destroy2() + * may be used on the tree. If 'quantum' is zero then the entire tree will + * be destroyed. * * Requires: * *rbt is a valid rbt manager. @@ -598,6 +615,10 @@ dns_rbt_destroy(dns_rbt_t **rbtp); * All space allocated by the RBT library has been returned. * * *rbt is invalidated as an rbt manager. + * + * Returns: + * ISC_R_SUCCESS + * ISC_R_QUOTA if 'quantum' nodes have been destroyed. */ void |