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

239 Commits

Author SHA1 Message Date
David Lawrence
c5944292e9 361. [func] When the RBT find or chain functions set the name and
origin for a node that stores the root label
			the name is now set to an empty name, instead of ".",
			to simplify later use of the name and origin by
			dns_name_concatenate(), dns_name_totext() or
			dns_name_format().

 360.	[func]		dns_name_totext() and dns_name_format() now allow
			an empty name to be passed, which is formatted as "@".
2000-07-31 23:27:25 +00:00
David Lawrence
9658892dbc revert the changes to dns_name_format() back to dns_name_totext() because
dns_name_format() does not print absolute names
2000-07-31 22:34:01 +00:00
David Lawrence
15a4474541 word wrap copyright notice at column 70 2000-07-27 09:55:03 +00:00
Andreas Gustafsson
5aa7bca733 dns_rbt_printnode() formatted the node name
into a buffer of 255 char pointers, not 255 chars; changed it
to use dns_name_format()
2000-07-21 22:08:42 +00:00
David Lawrence
891a1bead8 Use new function dns_name_reset() to make a name have no data, instead
of dns_name_concatenate(NULL, NULL, name, NULL).

Define DNS_NAME_USELINE to get macroized name functions.  Removed
older FAST_COUNTLABELS and FAST_ISABSOLUTE to use standard name
interface, which are covered by DNS_NAME_USEINLINE.
2000-07-14 19:17:39 +00:00
David Lawrence
9fb4b3f08a Do not return an exact match from dns_rbt_findnode() when the exact
match does not have associated data and DNS_RBTFIND_EMPTYDATA is not set.
Return DNS_R_PARTIALMATCH instead if there is a superdomain with
data, or ISC_R_NOTFOUND if no superdomain has data.

Make dns_rbt_findname() honor DNS_RBTFIND_EMPTYDATA, per the rbt.h
documentation that has been saying it will.  It didn't.
2000-07-06 23:54:45 +00:00
David Lawrence
03052a178c dns_rbt_deletefromlevel() did not need its dns_rbt_t argument 2000-06-19 22:55:42 +00:00
David Lawrence
92ab6defb6 don't redefine DNS_RBT_ANCESTORBLOCK to a tiny size when ISC_MEM_DEBUG is
defined, as it is by default now.  huge performance hit that we would
likely have been slow to notice if not for the t_rbt chain tests
having a bug. :-)
2000-06-06 23:25:29 +00:00
David Lawrence
fccb3e6c67 When joining nodes, set parent pointers of the left and right children of
the upper node (if they exist) to point to the new node.
2000-05-19 05:58:48 +00:00
David Lawrence
092b4e5359 The deletion assertion failure reported in RT #112 has been fixed; a pointer
should have been set to NULL when the top of a level was being rotated but
instead it was set to the node which pointed down to the level of the deleted
node.

rotate_left and rotate_right no longer take a parent parameter, since they
don't need it with the existence of parent pointers.

dns_rbt_deletefromlevel now takes a pointer to the pointer of the root of
the level as a parameter so that it doesn't have to rediscover the root that
its caller (dns_rbt_deletenode) already discovered.

dns_rbt_deletefromlevel did some (minor) pointless work with the sibling of the
deleted node before the color fixup loop was entered; it does so no more.

forward function declarations changed to ISC style.
2000-05-19 04:42:08 +00:00
David Lawrence
6028d1ce03 Needs string.h for function prototypes. For some reason gcc and other
compilers do not warn about the missing str*/mem* prototypes.
2000-05-08 19:23:32 +00:00
David Lawrence
1a69a1a78c Megacommit of dozens of files.
Cleanup of redundant/useless header file inclusion.

ISC style lint, primarily for function declarations and standalone
comments -- ie, those that appear on a line without any code, which
should be written as follows:
   /*
    * This is a comment.
    */
2000-05-08 14:38:29 +00:00
Bob Halley
82a1986c04 include isc/util.h; LOCK to LOCKNUM 2000-04-28 01:08:52 +00:00
David Lawrence
6e49e91bd0 103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
                                isc_buffer_base(b)          (pointer)
                                isc_buffer_current(b)       (pointer)
                                isc_buffer_active(b)        (pointer)
                                isc_buffer_used(b)          (pointer)
                                isc_buffer_length(b)            (int)
                                isc_buffer_usedlength(b)        (int)
                                isc_buffer_consumedlength(b)    (int)
                                isc_buffer_remaininglength(b)   (int)
                                isc_buffer_activelength(b)      (int)
                                isc_buffer_availablelength(b)   (int)
                        Removed:
                                ISC_BUFFER_USEDCOUNT(b)
                                ISC_BUFFER_AVAILABLECOUNT(b)
                                isc_buffer_type(b)
                        Changed names:
                                isc_buffer_used(b, r) ->
                                        isc_buffer_usedregion(b, r)
                                isc_buffer_available(b, r) ->
                                        isc_buffer_available_region(b, r)
                                isc_buffer_consumed(b, r) ->
                                        isc_buffer_consumedregion(b, r)
                                isc_buffer_active(b, r) ->
                                        isc_buffer_activeregion(b, r)
                                isc_buffer_remaining(b, r) ->
                                        isc_buffer_remainingregion(b, r)

                        Buffer types were removed, so the ISC_BUFFERTYPE_*
                        macros are no more, and the type argument to
                        isc_buffer_init and isc_buffer_allocate were removed.
                        isc_buffer_putstr is now void (instead of isc_result_t)
                        and requires that the caller ensure that there
                        is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
David Lawrence
d7197f2ab0 Add DNS_RBTFIND_NOPREDECESSOR to specify that the predecessor searching code
of dns_rbt_findnode should be skipped.  Nothing external uses it yet, but
when the chain option is NULL, this option is set internally as predecessor
searching is irrelevant.  (It was skipped before now, but via a different
mechanism.)

Add DNS_RBTFIND_NOOPTIONS to make it clear what the options parameter of
dns_rbt_find* is when no options are passed, and use it in dns_rbt_deletename.

REQUIRE that DNS_RBTFIND_NOEXACT and DNS_RBTFIND_NOPREDECESSOR are mutually
exclusive to dns_rbt_findnode.
2000-04-24 21:18:16 +00:00
Bob Halley
0a09237aa0 add noexact matching option 2000-04-19 18:21:24 +00:00
David Lawrence
c80dde0676 Comments about enhancements that could be made now that parent pointers exist. 2000-04-12 21:38:04 +00:00
David Lawrence
510f4bdcb6 static zapnode_and_fixlevels renamed to public dns_rbt_deletenode.
deletion no long requires a valid chain.  chain gook removed from all
of the deletion functions.

Minor unrelated doc & code convention cleanups.
2000-04-12 21:31:02 +00:00
David Lawrence
5d4f11b265 The RBT now maintains a parent pointer at each node. 2000-04-06 18:47:07 +00:00
Bob Halley
7d32c065c7 update copyright 2000-02-03 23:50:32 +00:00
Michael Graff
3ddd814a97 dns_result_t is no more. s/dns_result_t/isc_result_t/ -- more later, when I need a break. 1999-12-23 00:09:04 +00:00
Mark Andrews
19c5c23ef6 fix compiler warning: While loop condition is always non-zero.
nxt_30.c enforce type range to 1..127. DNS_R_RANGE otherwise.
1999-11-03 01:07:02 +00:00
David Lawrence
00a2ffb4ee fluff: compare a pointer to NULL 1999-11-03 00:17:11 +00:00
David Lawrence
0262a14d94 style fluff: "if (parent != NULL)" not "if (parent)" 1999-10-31 15:25:11 +00:00
Mark Andrews
acf87ed0b5 suppress ambigious else messages even when they are not. 1999-10-25 17:01:30 +00:00
David Lawrence
401fc772b1 Major:
deletion bug fixed that could orphan a large section of the tree.  the
  "parent" argument to rotate_left or rotate_right was sometimes not
  really the parent of the rotation vertex, because the parent's parent
  was not correctly reidentified after a rotation done on the parent.

Minor:
  forward static declaration of dns_rbt_printnodename, useful in debugging.

  level_matches set correctly for exact match in dns_rbt_findnode (it was
  one too few, but this was minor because as yet level_matches is only
  used by other code when a partial match was made.

  insist 'node' is a child of 'parent' in rotate_left and rotate_right

  compare a pointer explicitly to NULL that was just "if (pointer)"

  "would would" in a comment changed to just one "would".
1999-10-16 19:44:54 +00:00
Bob Halley
a6aa36b513 make findnode work on a completely empty tree 1999-10-15 01:35:23 +00:00
David Lawrence
cd1169c09a Do not try to set level_count and level_matches to negative values.
dns_rbtnodechain_last no longer requires name and origin parameters
to be non-null.
1999-10-14 20:19:54 +00:00
Mark Andrews
af16f35cf9 dns_rbtnodechain_first() no longer requires name and origin
to be passed.
	dns_rbtnodechain_next() no longer fails if name is not passed.
1999-10-13 22:50:39 +00:00
David Lawrence
fe7ce2204b set level_matches when both an exact match and no match at all is found,
not just for partial matches, for consistency.

set level_matches even when not forming foundname, since level_matches
is an aspect of the chain, not of whether the caller wanted the
name formed by dns_rbt_findnode().

comment updates.
1999-10-12 14:19:47 +00:00
Bob Halley
61c22c272f Set level_matches consistently. It now is the number of levels
above the partial match node.
1999-10-11 19:16:56 +00:00
David Lawrence
cec7a04adc rename CALLBACK to FINDCALLBACK to avoid conflict with windefs.h
definition of CALLBACK.
1999-10-08 23:39:14 +00:00
Brian Wellington
9e6de65c57 removed an extraneous character at the start of the file 1999-09-23 21:58:03 +00:00
David Lawrence
df1e2d496e Shut up a signed/unsigned compiler warning from MSVC++ by converting
newlength and oldlength from signed to unsigned in join_nodes().

Use dns_name_clone for minor efficiency gain in dns_rbt_addnode.

Use fixed names in dns_rbt_findnode() for minor efficiency gain.
1999-09-23 17:53:03 +00:00
Bob Halley
422e7d007d lint 1999-08-26 07:14:25 +00:00
Bob Halley
593d951248 add RBTDB wild bit 1999-08-12 07:47:21 +00:00
David Lawrence
bee0bb2b68 In join_nodes, when using the space of the down node, it needs to get
the attributes of the joined name to correctly identify whether it
is absolute.  (IE, when the first level is joined with the top level,
the node struct being used is from the first level, which is not
absolute, but the new name is absolute so the struct needs to be updated.)
1999-05-07 12:13:25 +00:00
David Lawrence
3c5de27363 Shoulda left the >= as >=, not >, in join_nodes. D'oh. 1999-05-07 02:47:35 +00:00
David Lawrence
56b657bfe8 update the number of PADBYTES after in join_nodes(). 1999-05-07 02:42:50 +00:00
Bob Halley
3ff8d68793 Make it clear which 'if' an 'else' belongs to. 1999-04-30 02:04:11 +00:00
Bob Halley
f53facef17 fix search_name initialization problems 1999-04-24 02:03:25 +00:00
David Lawrence
93b01c7295 Support for bitstring labels. 1999-04-23 04:59:41 +00:00
David Lawrence
55f6206532 a better fix than the last for dns_rbtnodechain_next 1999-04-22 14:36:30 +00:00
David Lawrence
2292bceadf tried to ascend a level in dns_rbtnodechain_next when at top level 1999-04-22 14:16:52 +00:00
David Lawrence
acab2c8094 Fixed a bug that resulted when a callback said to halt a search; the
level_count was decremented below zero because the found node had not
been put in the level history before the callback broke out of the search.

Added a bunch of INSISTS()s to try to catch something like that in the future.
1999-04-20 22:01:00 +00:00
David Lawrence
9efc87f857 Added level_matches to chains for rbtdb support. 1999-04-20 18:11:07 +00:00
David Lawrence
f8dd2e939e Make sure chain_name and dns_rbtnodechain_current do not try to do
NODENAME() on a NULL chain->end (such as after the chain has been reset.)
1999-04-17 15:43:10 +00:00
David Lawrence
c234ac00b8 The _real_ fix for the callback_name generation problem in findnode.
It wasn't that chain->end was being included (it should have been) but
that the chain had already been expanded to point down a level before
the call to chain_name that needed the state of things before the
descent.
1999-04-17 15:19:45 +00:00
David Lawrence
678bd7ab4b Fixed handling of the name generation for callbacks in findnode. 1999-04-16 21:01:58 +00:00
David Lawrence
c40654ee44 Made addnode and findnode aware of the case where the result of the
comparison is "subdomain" but the full name at the existing node is
not in common with the input name -- when the last label is a bitstring
with some common bits.
1999-04-16 18:30:03 +00:00