Commit Graph
4222 Commits
Author SHA1 Message Date
Bob Halley c1737c417d db iterator support 1999-04-17 01:36:42 +00:00
Bob Halley 6bb7b678f5 do not pass the version to dns_db_createiterator() 1999-04-16 21:28:00 +00:00
Bob Halley a8166bf1be versions are no longer part of dbiterators 1999-04-16 21:27:26 +00:00
Bob Halley 828870c41a lint 1999-04-16 21:26:41 +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
Bob Halley 066ae48be3 include string.h to get memset() prototype 1999-04-14 17:40:22 +00:00
David Lawrence 6d74580f08 Documentation for chains. 1999-04-14 14:39: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 dafabe62df Changed a goto into a conditional block that works the same way. 1999-04-14 12:29:39 +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
Mark Andrews a2b97d054f Convert compress_find to use PARTIAL_MATCH result. 1999-04-14 06:03:15 +00:00
Bob Halley 405a4d66d7 Always lock the dbtable when operating on it.
Attach and detach from the db.
Simplify the API by not requiring the name to be specfied for add and remove,
and by not requiring the db to be specified for removedefault.
Calls to dns_rbt_findname were failing because stored_data was not initialized
to NULL.
1999-04-14 02:37:08 +00:00
Bob Halley 8259b7b150 API simplification 1999-04-14 02:33:19 +00:00
Mark Andrews 95f78a208a Bring local compression into line with draft 04.
'dns_rootname' should be marked read_only.
	Supply 'dns_rootname' with offsets.
1999-04-13 05:50:12 +00:00
Bob Halley f2fbcd9195 Version locking fixes:
The commit_ok and changed_list were sometimes being accessed without
	holding the lock.
	Comments in structure.
Do not allow an rdataset to be added to a non-writer version.
Do not allow closeversion() to commit a writer version unless the ref count
is one.
We were not incrementing the version ref count when creating an rdataset
iterator.
1999-04-13 01:58:17 +00:00
Bob Halley c9a8413dcb Require that only the last reference of a writable version may be committed. 1999-04-13 01:54:02 +00:00
Bob Halley a3e2ec2dfe dns_db_deleterdataset() needed the same REQUIRE fix as dns_db_addrdataset() 1999-04-13 01:52:58 +00:00
Bob Halley 46d74dd316 fix typo 1999-04-10 00:34: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
Bob Halley 063a4a82f6 Since rollback_node() no longer frees rdatasets, we must mark the node as
dirty if anything was rolled back, because otherwise the node cleaning
routine will not run when the node reference count becomes 0.
1999-04-09 19:25:55 +00:00
Bob Halley 88c2d3ad0d Eliminate the "prev" pointer in the rdataset header.
rollback_node() incorrectly required that node->references == 0.  We cannot
assume that a node has no references when an update is rolled back.  We now
mark any rolled back rdatasets with the RDATASET_ATTR_IGNORE attribute.  When
the node eventually has a zero reference count, IGNOREd rdatasets will be
cleaned up.  In the meantime, they will be ignored.
1999-04-09 19:18:04 +00:00
Bob Halley 5c6d49484b fix incorrect REQUIRE statement in dns_db_addrdataset() 1999-04-09 19:14:06 +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
Bob Halley 0370190a68 REQUIRE that target is a valid name in dns_name_getlabelsequence() 1999-04-09 01:27:54 +00:00
Bob Halley 0b1f55d73f Pass time to routines which add or create rdatasets.
Add TTL aging and removal of stale rdatasets (cache databases only).
1999-04-09 01:12:30 +00:00
Bob Halley 63e6086ef9 pass time to routines which add or create rdatasets 1999-04-09 01:10:19 +00:00
Bob Halley aa9f70c1e1 add now 1999-04-09 01:09:23 +00:00
Michael Graff a6a0f27083 msg.h -> message.h, and dns_msg* to dns_message* 1999-04-08 21:13:31 +00:00
Bob Halley 3c11c87769 update comments 1999-04-06 04:15:49 +00:00
Bob Halley 95e0ab8284 add glue validation 1999-04-06 04:15:29 +00:00
Michael Graff 68221c823d add msg functions 1999-04-06 02:18:08 +00:00
Bob Halley 0990426ddf fix some locking problems 1999-04-05 23:59:26 +00:00
Bob Halley fd03e61541 In zone_find(), deal with the ickiness when the desired name is a delegation
point.  Specifically, we return a delegation in this case, except if glue is
OK, or if the caller is looking for NXT or KEY records.
SIG records are going to be a special case, so do not deal with them in the
zone find routine.
1999-04-05 20:51:50 +00:00
Bob Halley e7e2e948e3 add REQUIRE statements for dns_db_find() 1999-04-05 20:47:20 +00:00
Bob Halley b4055b9666 preliminary dns_db_find() comments 1999-04-05 20:39:50 +00:00
Bob Halley 6e077ae73c add DNS_R_ZONECUT 1999-04-05 20:11:30 +00:00
Bob Halley 10e905959e When searching a cache db, we did not look for an NS record at the node, so we
sometimes did not find the deepest zone cut.  E.g. If you look for A records at
"com." then you should get a delegation for "com." and not one for ".".
In the various rdataset find routines, we sometimes attempted to bind the
rdataset even if the rdataset pointer was NULL.
Remove inline from a few functions.  Add inline to a few others.
1999-04-02 03:37:24 +00:00
David Lawrence da1eb108c6 rbtnode's callback member renamed find_callback. 1999-04-01 15:57:48 +00:00
Bob Halley 1b90a27c4d Implement zone and cache versions of dns_db_find().
Add incomplete and not-yet-working dbiterator implementation.
Improve node reference count handling.
Opening and closing the current version more than once was breaking
due to incorrect garbage collection.
Some rbtdb values had not been getting initialized.
Improvements to add procedure.
1999-04-01 04:11:33 +00:00
Bob Halley 9e2fa382e8 remove unneeded include 1999-04-01 04:03:56 +00:00
Bob Halley ced5499494 add dns_db_find 1999-04-01 04:03:22 +00:00
Bob Halley d176cbca5b checkpoint 1999-04-01 04:02:33 +00:00
Bob Halley 0180ccf72c require non-NULL methods on accessors 1999-04-01 04:01:30 +00:00
Bob Halley 5bfea18ff8 add dns_rdataslab_merge 1999-04-01 04:00:39 +00:00
Bob Halley e7b724c23e result types for database searches 1999-04-01 03:59:49 +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