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

262 Commits

Author SHA1 Message Date
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
David Lawrence
ec80744ad6 The ADD_ANCESTOR macro now checks for the required memory, since it is used
in a lot of places now.  It _returns_ if it fails to get the necessary memory,
so any function using it should be returning a dns_result_t.

chain_name moved toward start of file, for inlining by findnode.

move_chain_to_last broke out some functionality of dns_rbtnodechain_last
(which now calls it), also for the benefit of findnode.

dns_rbtnodechain_init on the chain used by addnode.

All of the new_foundname concatenation gook was removed from findnode,
which now just sets foundname by using chain_name.

The chain set up by findnode points to the predecessor when the searched
for name is not found.

nodechain_current was changed to take name, origin and node parameters while
returning a dns_result_t.  This allows the chain returned by findnode to
be named.

The nodechain_{first,last,prev} use nodechain_current to set their
names and origins.  nodechain_next does not need it because it will never
have to do the "set the origin to '.' and remove '.' from names in the
root level" bit.  The root level will never be more than one name, and
everything in the megatree is a successor to that node, so 'next' never
reaches the root level.
1999-04-16 16:12:15 +00:00
David Lawrence
40526b8cbe Oops, untested change of removing DNS_NAMEATTR_ABSOLUTE from names
in top level tree during chain moves didn't actually compile as written.
Surprise.
1999-04-14 14:12:34 +00:00
David Lawrence
1adfd0a911 Top level tree always has an origin of "." and all names are relative to "."
in it.

chain _first and _last now work.

Other stuff I can't recall.  Lots of little fiddling with chains.
1999-04-14 12:03:18 +00:00
David Lawrence
675f7c879a Do not return the full name when chain iterating, just relative to the origin. 1999-04-09 22:55:20 +00:00
David Lawrence
c9eae31249 That last checkin was dain-bramaged, because I was thinking solely of
what happens at ".".  For most origins, they do NOT include themself in
a zone file ... that is, the record for "rc" appears in the $ORIGIN for
".vix.com."
1999-04-09 22:49:46 +00:00
David Lawrence
93a0e33450 Include the origin node in it its own cut. IE, when coming through
ab.rc.vix.com, bb.rc.vix.com, ... back to rc.vix.com, don't declare
a new origin until _after_ rc.vix.com has been returned.
1999-04-09 15:27:58 +00:00
David Lawrence
33950f0a02 Preliminary work on iterators. 1999-04-09 15:21:15 +00:00
David Lawrence
da1eb108c6 rbtnode's callback member renamed find_callback. 1999-04-01 15:57:48 +00:00
David Lawrence
5f50687f61 Changes from Bob, best described in his own barely-edited words:
I added support for the full search algorithm to the RBT database
  code.  The database has some special needs in searching, in particular
  certain nodes need to be examined before the DOWN pointer is followed.

  I solved this problem by adding a 'callback' bit to the node structure.
  When findnode is called, the caller can supply a callback.  Before we go
  DOWN at a node, we call the callback if the callback bit is set at the
  node.  If the callback returns DNS_R_CONTINUE, we proceed.  Otherwise, we
  will stop right there and return what the caller said to return.  I
  added an 'empty_data_ok' flag to findnode as well, so that nodes with
  empty data can be made candidates for partial match status.

  I also wanted to make dns_rbtnodechain_t public, so that a chain could
  be allocated on the stack by the caller.  I added two routines,
  dns_rbtnodechain_init() and dns_rbtnodechain_reset() to work with them.
  The latter routine frees any dynamically allocated memory associated with
  the chain.  The chain structure now contains the memory context.  I also
  moved get_ancestor_mem() and put_ancestor_mem() up in the file, so that
  inlining could be more effective.

  In the nits department, you wrote

                  *node = result == DNS_R_SUCCESS ? current : NULL;

  In the future, please write this instead (the patch has this change in it):

                  if (result == DNS_R_SUCCESS)
                          *node = current;
                  else
                          *node = NULL;
1999-04-01 03:15:54 +00:00
David Lawrence
84f8cc7e22 Initialize the node's attributes with the name's attributes. This
is currently fine, because there are only two attribute flags a name
can have, one of which the node definitely needs to have set, and the
other of which is functionally irrelevant (because it happens to be set
by the NODENAME macro, namely the read-only flag).  This might not
be the right thing to do in the future when more name attributes get
added, but we'll cross that bridge if we get to it.  (_Some_ change was
necessary because the node's attributes was not properly initialized when
created, and under certain circumstances this ended up triggering an
exception in the dns_name_* functions.

Watch for level overflow during dns_rbt_addnode().  Returns DNS_R_NOSPACE,
which is probably not the right thing.

Comment cleanups.
1999-03-30 01:56:01 +00:00
David Lawrence
d737609b91 Allow space for 255 levels in rbtnodechain because of bitlabels. 1999-03-18 21:32:51 +00:00
David Lawrence
d09197467b Principle Authors: DCL 1999-03-18 21:21:31 +00:00
David Lawrence
9f1a1007e0 Converted @@@ to XXX in comments about unresolved issues. 1999-03-18 20:30:28 +00:00
David Lawrence
f39a760ab0 formatting fixups (a few lines were over 79 char). 1999-03-16 22:57:32 +00:00
David Lawrence
194f54f4da New parameter to dns_rbt_find{name,node} will return the full dns_name_t
of the node that is found.

Avoids doing any memory allocation when building ancestor chain in 99%
of the cases.
1999-03-16 16:10:36 +00:00
David Lawrence
bd1190c84b no more need for mem_failure in rbt_nodechain_t, since findnode now
returns a dns_result_t.

dns_rbt_created requires deleter_arg NULL if deleter is NULL.

dns_rbt_addnode always returns DNS_R_EXISTS if the node is found, regardless
of if it has data.

dns_rbt_addname will add the data and return SUCCESS if addnode says
EXISTS but there is no data at the node.

make sure memory is freed even when get_ancestor_mem to reallocate fails.

partialmatch returned by findnode must have data associated with it.

fixed up deletename; prematurely exited without freeing chain memory if
the node was not found.  made deletename responsible for identifying whether
a node could be removed rather than zapnode.

turned a few of the print support functions static.
1999-03-12 05:00:32 +00:00
David Lawrence
62f178f499 Preserve the storage location of the down node of a pair of joined nodes
when deleting, where possible.
1999-03-11 22:04:24 +00:00
David Lawrence
6a0cb547d4 When splitting a node, increment PADBYTES by the amount that is truncated,
instead of just setting PADBYTES to that amount (this affects when a node
is split twice.)
1999-03-11 20:07:49 +00:00
David Lawrence
f036af2c71 rbtnode struct adapted with more bitfields to represent color,
name attributes, name length, offset length, and number of bytes
of "padding" that are left over when a node is split.

adjusted node splitting algorithm to preserve the original location
of the lower portion of the split node (eg, when a node has "a.b" as
its name and is split into "a" and "b", "a" retains the same address
space as "a.b".)
1999-03-11 18:54:31 +00:00
David Lawrence
587fc7b519 Revised dns_rbt_findname and dns_rbt_findnode to find the closest match
when an exact match cannot be found.  This changed the calling interface,
which necessitated changes to rbtdb.c and compress.c.
1999-03-04 21:03:29 +00:00
David Lawrence
6735f1e886 arguments for common_labels and common_bits to dns_name_fullcompare
are unsigned ints
1999-03-04 02:35:04 +00:00
David Lawrence
005c7ad70f Use dns_name_fullcompare() and remove internal comparison functions.
Allow root label to be in its own level (and thus have data associated with it.)

Avoid retraversal of level in dns_rbt_addonlevel().
1999-03-03 20:01:49 +00:00
Mark Andrews
52637f592f Add wire compression. 1999-02-22 07:24:05 +00:00
Michael Graff
882350d11c Clean up many compiler warnings. 1999-02-11 06:38:12 +00:00
Bob Halley
1630fce031 performance enhancements, deleter arg 1999-02-06 01:27:35 +00:00
Bob Halley
1bf0b455b6 add XXXRTH comments 1999-02-06 00:00:41 +00:00
Bob Halley
fe47f41b13 eliminate compiler warnings (signed vs. unsigned) 1999-02-02 01:18:51 +00:00