2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001, 2003 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: db.h,v 1.67.2.4 2004/03/09 06:11:14 marka Exp $ */
30 * The DNS DB interface allows named rdatasets to be stored and retrieved.
32 * The dns_db_t type is like a "virtual class". To actually use
33 * DBs, an implementation of the class is required.
38 * The module ensures appropriate synchronization of data structures it
39 * creates and manipulates.
42 * No anticipated impact.
48 * No anticipated impact.
59 #include <isc/magic.h>
60 #include <isc/ondestroy.h>
61 #include <isc/stdtime.h>
64 #include <dns/types.h>
72 typedef struct dns_dbmethods {
73 void (*attach)(dns_db_t *source, dns_db_t **targetp);
74 void (*detach)(dns_db_t **dbp);
75 isc_result_t (*beginload)(dns_db_t *db, dns_addrdatasetfunc_t *addp,
76 dns_dbload_t **dbloadp);
77 isc_result_t (*endload)(dns_db_t *db, dns_dbload_t **dbloadp);
78 isc_result_t (*dump)(dns_db_t *db, dns_dbversion_t *version,
79 const char *filename);
80 void (*currentversion)(dns_db_t *db,
81 dns_dbversion_t **versionp);
82 isc_result_t (*newversion)(dns_db_t *db,
83 dns_dbversion_t **versionp);
84 void (*attachversion)(dns_db_t *db, dns_dbversion_t *source,
85 dns_dbversion_t **targetp);
86 void (*closeversion)(dns_db_t *db,
87 dns_dbversion_t **versionp,
88 isc_boolean_t commit);
89 isc_result_t (*findnode)(dns_db_t *db, dns_name_t *name,
91 dns_dbnode_t **nodep);
92 isc_result_t (*find)(dns_db_t *db, dns_name_t *name,
93 dns_dbversion_t *version,
94 dns_rdatatype_t type, unsigned int options,
96 dns_dbnode_t **nodep, dns_name_t *foundname,
97 dns_rdataset_t *rdataset,
98 dns_rdataset_t *sigrdataset);
99 isc_result_t (*findzonecut)(dns_db_t *db, dns_name_t *name,
100 unsigned int options, isc_stdtime_t now,
101 dns_dbnode_t **nodep,
102 dns_name_t *foundname,
103 dns_rdataset_t *rdataset,
104 dns_rdataset_t *sigrdataset);
105 void (*attachnode)(dns_db_t *db,
106 dns_dbnode_t *source,
107 dns_dbnode_t **targetp);
108 void (*detachnode)(dns_db_t *db,
109 dns_dbnode_t **targetp);
110 isc_result_t (*expirenode)(dns_db_t *db, dns_dbnode_t *node,
112 void (*printnode)(dns_db_t *db, dns_dbnode_t *node,
114 isc_result_t (*createiterator)(dns_db_t *db,
115 isc_boolean_t relative_names,
116 dns_dbiterator_t **iteratorp);
117 isc_result_t (*findrdataset)(dns_db_t *db, dns_dbnode_t *node,
118 dns_dbversion_t *version,
119 dns_rdatatype_t type,
120 dns_rdatatype_t covers,
122 dns_rdataset_t *rdataset,
123 dns_rdataset_t *sigrdataset);
124 isc_result_t (*allrdatasets)(dns_db_t *db, dns_dbnode_t *node,
125 dns_dbversion_t *version,
127 dns_rdatasetiter_t **iteratorp);
128 isc_result_t (*addrdataset)(dns_db_t *db, dns_dbnode_t *node,
129 dns_dbversion_t *version,
131 dns_rdataset_t *rdataset,
132 unsigned int options,
133 dns_rdataset_t *addedrdataset);
134 isc_result_t (*subtractrdataset)(dns_db_t *db, dns_dbnode_t *node,
135 dns_dbversion_t *version,
136 dns_rdataset_t *rdataset,
137 unsigned int options,
138 dns_rdataset_t *newrdataset);
139 isc_result_t (*deleterdataset)(dns_db_t *db, dns_dbnode_t *node,
140 dns_dbversion_t *version,
141 dns_rdatatype_t type,
142 dns_rdatatype_t covers);
143 isc_boolean_t (*issecure)(dns_db_t *db);
144 unsigned int (*nodecount)(dns_db_t *db);
145 isc_boolean_t (*ispersistent)(dns_db_t *db);
146 void (*overmem)(dns_db_t *db, isc_boolean_t overmem);
147 void (*settask)(dns_db_t *db, isc_task_t *);
151 (*dns_dbcreatefunc_t)(isc_mem_t *mctx, dns_name_t *name,
152 dns_dbtype_t type, dns_rdataclass_t rdclass,
153 unsigned int argc, char *argv[], void *driverarg,
156 #define DNS_DB_MAGIC ISC_MAGIC('D','N','S','D')
157 #define DNS_DB_VALID(db) ISC_MAGIC_VALID(db, DNS_DB_MAGIC)
160 * This structure is actually just the common prefix of a DNS db
161 * implementation's version of a dns_db_t.
163 * Direct use of this structure by clients is forbidden. DB implementations
164 * may change the structure. 'magic' must be DNS_DB_MAGIC for any of the
165 * dns_db_ routines to work. DB implementations must maintain all DB
170 unsigned int impmagic;
171 dns_dbmethods_t * methods;
172 isc_uint16_t attributes;
173 dns_rdataclass_t rdclass;
175 isc_ondestroy_t ondest;
179 #define DNS_DBATTR_CACHE 0x01
180 #define DNS_DBATTR_STUB 0x02
183 * Options that can be specified for dns_db_find().
185 #define DNS_DBFIND_GLUEOK 0x01
186 #define DNS_DBFIND_VALIDATEGLUE 0x02
187 #define DNS_DBFIND_NOWILD 0x04
188 #define DNS_DBFIND_PENDINGOK 0x08
189 #define DNS_DBFIND_NOEXACT 0x10
192 * Options that can be specified for dns_db_addrdataset().
194 #define DNS_DBADD_MERGE 0x01
195 #define DNS_DBADD_FORCE 0x02
196 #define DNS_DBADD_EXACT 0x04
197 #define DNS_DBADD_EXACTTTL 0x08
200 * Options that can be specified for dns_db_subtractrdataset().
202 #define DNS_DBSUB_EXACT 0x01
213 dns_db_create(isc_mem_t *mctx, const char *db_type, dns_name_t *origin,
214 dns_dbtype_t type, dns_rdataclass_t rdclass,
215 unsigned int argc, char *argv[], dns_db_t **dbp);
217 * Create a new database using implementation 'db_type'.
220 * All names in the database must be subdomains of 'origin' and in class
221 * 'rdclass'. The database makes its own copy of the origin, so the
222 * caller may do whatever they like with 'origin' and its storage once the
225 * DB implementation-specific parameters are passed using argc and argv.
229 * dbp != NULL and *dbp == NULL
231 * 'origin' is a valid absolute domain name.
233 * mctx is a valid memory context
237 * A copy of 'origin' has been made for the databases use, and the
238 * caller is free to do whatever they want with the name and storage
239 * associated with 'origin'.
245 * ISC_R_NOTFOUND db_type not found
247 * Many other errors are possible, depending on what db_type was
252 dns_db_attach(dns_db_t *source, dns_db_t **targetp);
254 * Attach *targetp to source.
258 * 'source' is a valid database.
260 * 'targetp' points to a NULL dns_db_t *.
264 * *targetp is attached to source.
268 dns_db_detach(dns_db_t **dbp);
270 * Detach *dbp from its database.
274 * 'dbp' points to a valid database.
280 * If '*dbp' is the last reference to the database,
282 * All resources used by the database will be freed
286 dns_db_ondestroy(dns_db_t *db, isc_task_t *task, isc_event_t **eventp);
288 * Causes 'eventp' to be sent to be sent to 'task' when the database is
291 * Note; ownrship of the eventp is taken from the caller (and *eventp is
292 * set to NULL). The sender field of the event is set to 'db' before it is
297 dns_db_iscache(dns_db_t *db);
299 * Does 'db' have cache semantics?
303 * 'db' is a valid database.
306 * ISC_TRUE 'db' has cache semantics
307 * ISC_FALSE otherwise
311 dns_db_iszone(dns_db_t *db);
313 * Does 'db' have zone semantics?
317 * 'db' is a valid database.
320 * ISC_TRUE 'db' has zone semantics
321 * ISC_FALSE otherwise
325 dns_db_isstub(dns_db_t *db);
327 * Does 'db' have stub semantics?
331 * 'db' is a valid database.
334 * ISC_TRUE 'db' has zone semantics
335 * ISC_FALSE otherwise
339 dns_db_issecure(dns_db_t *db);
345 * 'db' is a valid database with zone semantics.
348 * ISC_TRUE 'db' is secure.
349 * ISC_FALSE 'db' is not secure.
353 dns_db_origin(dns_db_t *db);
355 * The origin of the database.
357 * Note: caller must not try to change this name.
361 * 'db' is a valid database.
365 * The origin of the database.
369 dns_db_class(dns_db_t *db);
371 * The class of the database.
375 * 'db' is a valid database.
379 * The class of the database.
383 dns_db_beginload(dns_db_t *db, dns_addrdatasetfunc_t *addp,
384 dns_dbload_t **dbloadp);
386 * Begin loading 'db'.
390 * 'db' is a valid database.
392 * This is the first attempt to load 'db'.
394 * addp != NULL && *addp == NULL
396 * dbloadp != NULL && *dbloadp == NULL
400 * On success, *addp will be a valid dns_addrdatasetfunc_t suitable
401 * for loading 'db'. *dbloadp will be a valid DB load context which
402 * should be used as 'arg' when *addp is called.
409 * Other results are possible, depending upon the database
410 * implementation used, syntax errors in the master file, etc.
414 dns_db_endload(dns_db_t *db, dns_dbload_t **dbloadp);
416 * Finish loading 'db'.
420 * 'db' is a valid database that is being loaded.
422 * dbloadp != NULL and *dbloadp is a valid database load context.
433 * Other results are possible, depending upon the database
434 * implementation used, syntax errors in the master file, etc.
438 dns_db_load(dns_db_t *db, const char *filename);
440 * Load master file 'filename' into 'db'.
443 * This routine is equivalent to calling
445 * dns_db_beginload();
446 * dns_master_loadfile();
451 * 'db' is a valid database.
453 * This is the first attempt to load 'db'.
460 * Other results are possible, depending upon the database
461 * implementation used, syntax errors in the master file, etc.
465 dns_db_dump(dns_db_t *db, dns_dbversion_t *version, const char *filename);
467 * Dump version 'version' of 'db' to master file 'filename'.
471 * 'db' is a valid database.
473 * 'version' is a valid version.
480 * Other results are possible, depending upon the database
481 * implementation used, OS file errors, etc.
489 dns_db_currentversion(dns_db_t *db, dns_dbversion_t **versionp);
491 * Open the current version for reading.
495 * 'db' is a valid database with zone semantics.
497 * versionp != NULL && *verisonp == NULL
501 * On success, '*versionp' is attached to the current version.
506 dns_db_newversion(dns_db_t *db, dns_dbversion_t **versionp);
508 * Open a new version for reading and writing.
512 * 'db' is a valid database with zone semantics.
514 * versionp != NULL && *verisonp == NULL
518 * On success, '*versionp' is attached to the current version.
525 * Other results are possible, depending upon the database
526 * implementation used.
530 dns_db_attachversion(dns_db_t *db, dns_dbversion_t *source,
531 dns_dbversion_t **targetp);
533 * Attach '*targetp' to 'source'.
537 * 'db' is a valid database with zone semantics.
539 * source is a valid open version
541 * targetp != NULL && *targetp == NULL
545 * '*targetp' is attached to source.
549 dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp,
550 isc_boolean_t commit);
552 * Close version '*versionp'.
554 * Note: if '*versionp' is a read-write version and 'commit' is ISC_TRUE,
555 * then all changes made in the version will take effect, otherwise they
556 * will be rolled back. The value if 'commit' is ignored for read-only
561 * 'db' is a valid database with zone semantics.
563 * '*versionp' refers to a valid version.
565 * If committing a writable version, then there must be no other
566 * outstanding references to the version (e.g. an active rdataset
573 * If *versionp is a read-write version, and commit is ISC_TRUE, then
574 * the version will become the current version. If !commit, then all
575 * changes made in the version will be undone, and the version will
576 * not become the current version.
584 dns_db_findnode(dns_db_t *db, dns_name_t *name, isc_boolean_t create,
585 dns_dbnode_t **nodep);
587 * Find the node with name 'name'.
590 * If 'create' is ISC_TRUE and no node with name 'name' exists, then
591 * such a node will be created.
593 * This routine is for finding or creating a node with the specified
594 * name. There are no partial matches. It is not suitable for use
595 * in building responses to ordinary DNS queries; clients which wish
596 * to do that should use dns_db_find() instead.
600 * 'db' is a valid database.
602 * 'name' is a valid, non-empty, absolute name.
604 * nodep != NULL && *nodep == NULL
608 * On success, *nodep is attached to the node with name 'name'.
613 * ISC_R_NOTFOUND If !create and name not found.
614 * ISC_R_NOMEMORY Can only happen if create is ISC_TRUE.
616 * Other results are possible, depending upon the database
617 * implementation used.
621 dns_db_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
622 dns_rdatatype_t type, unsigned int options, isc_stdtime_t now,
623 dns_dbnode_t **nodep, dns_name_t *foundname,
624 dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
626 * Find the best match for 'name' and 'type' in version 'version' of 'db'.
630 * If type == dns_rdataset_any, then rdataset will not be bound.
632 * If 'options' does not have DNS_DBFIND_GLUEOK set, then no glue will
633 * be returned. For zone databases, glue is as defined in RFC 2181.
634 * For cache databases, glue is any rdataset with a trust of
637 * If 'options' does not have DNS_DBFIND_PENDINGOK set, then no
638 * pending data will be returned. This option is only meaningful for
641 * If the DNS_DBFIND_NOWILD option is set, then wildcard matching will
642 * be disabled. This option is only meaningful for zone databases.
644 * To respond to a query for SIG records, the caller should create a
645 * rdataset iterator and extract the signatures from each rdataset.
647 * Making queries of type ANY with DNS_DBFIND_GLUEOK is not recommended,
648 * because the burden of determining whether a given rdataset is valid
649 * glue or not falls upon the caller.
651 * The 'now' field is ignored if 'db' is a zone database. If 'db' is a
652 * cache database, an rdataset will not be found unless it expires after
653 * 'now'. Any ANY query will not match unless at least one rdataset at
654 * the node expires after 'now'. If 'now' is zero, then the current time
659 * 'db' is a valid database.
661 * 'type' is not SIG, or a meta-RR type other than 'ANY' (e.g. 'OPT').
663 * 'nodep' is NULL, or nodep is a valid pointer and *nodep == NULL.
665 * 'foundname' is a valid name with a dedicated buffer.
667 * 'rdataset' is NULL, or is a valid unassociated rdataset.
670 * On a non-error completion:
672 * If nodep != NULL, then it is bound to the found node.
674 * If foundname != NULL, then it contains the full name of the
677 * If rdataset != NULL and type != dns_rdatatype_any, then
678 * rdataset is bound to the found rdataset.
682 * Non-error results are:
684 * ISC_R_SUCCESS The desired node and type were
687 * DNS_R_GLUE The desired node and type were
688 * found, but are glue. This
689 * result can only occur if
690 * the DNS_DBFIND_GLUEOK option
691 * is set. This result can only
692 * occur if 'db' is a zone
693 * database. If type ==
694 * dns_rdatatype_any, then the
695 * node returned may contain, or
696 * consist entirely of invalid
697 * glue (i.e. data occluded by a
698 * zone cut). The caller must
699 * take care not to return invalid
702 * DNS_R_DELEGATION The data requested is beneath
703 * a zone cut. node, foundname,
704 * and rdataset reference the
705 * NS RRset of the zone cut.
706 * If 'db' is a cache database,
707 * then this is the deepest known
710 * DNS_R_ZONECUT type == dns_rdatatype_any, and
711 * the desired node is a zonecut.
712 * The caller must take care not
713 * to return inappropriate glue
714 * to a client. This result can
715 * only occur if 'db' is a zone
716 * database and DNS_DBFIND_GLUEOK
719 * DNS_R_DNAME The data requested is beneath
720 * a DNAME. node, foundname,
721 * and rdataset reference the
724 * DNS_R_CNAME The rdataset requested was not
725 * found, but there is a CNAME
726 * at the desired name. node,
727 * foundname, and rdataset
728 * reference the CNAME RRset.
730 * DNS_R_NXDOMAIN The desired name does not
733 * DNS_R_NXRRSET The desired name exists, but
734 * the desired type does not.
736 * ISC_R_NOTFOUND The desired name does not
737 * exist, and no delegation could
738 * be found. This result can only
739 * occur if 'db' is a cache
740 * database. The caller should
741 * use its nameserver(s) of last
742 * resort (e.g. root hints).
744 * DNS_R_NCACHENXDOMAIN The desired name does not
745 * exist. 'node' is bound to the
746 * cache node with the desired
747 * name, and 'rdataset' contains
748 * the negative caching proof.
750 * DNS_R_NCACHENXRRSET The desired type does not
751 * exist. 'node' is bound to the
752 * cache node with the desired
753 * name, and 'rdataset' contains
754 * the negative caching proof.
760 * DNS_R_BADDB Data that is required to be
761 * present in the DB, e.g. an NXT
762 * record in a secure zone, is not
765 * Other results are possible, and should all be treated as
770 dns_db_findzonecut(dns_db_t *db, dns_name_t *name,
771 unsigned int options, isc_stdtime_t now,
772 dns_dbnode_t **nodep, dns_name_t *foundname,
773 dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
775 * Find the deepest known zonecut which encloses 'name' in 'db'.
779 * If the DNS_DBFIND_NOEXACT option is set, then the zonecut returned
780 * (if any) will be the deepest known ancestor of 'name'.
782 * If 'now' is zero, then the current time will be used.
786 * 'db' is a valid database with cache semantics.
788 * 'nodep' is NULL, or nodep is a valid pointer and *nodep == NULL.
790 * 'foundname' is a valid name with a dedicated buffer.
792 * 'rdataset' is NULL, or is a valid unassociated rdataset.
795 * On a non-error completion:
797 * If nodep != NULL, then it is bound to the found node.
799 * If foundname != NULL, then it contains the full name of the
802 * If rdataset != NULL and type != dns_rdatatype_any, then
803 * rdataset is bound to the found rdataset.
807 * Non-error results are:
813 * Other results are possible, and should all be treated as
818 dns_db_attachnode(dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp);
820 * Attach *targetp to source.
824 * 'db' is a valid database.
826 * 'source' is a valid node.
828 * 'targetp' points to a NULL dns_node_t *.
832 * *targetp is attached to source.
836 dns_db_detachnode(dns_db_t *db, dns_dbnode_t **nodep);
838 * Detach *nodep from its node.
842 * 'db' is a valid database.
844 * 'nodep' points to a valid node.
852 dns_db_expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now);
854 * Mark as stale all records at 'node' which expire at or before 'now'.
856 * Note: if 'now' is zero, then the current time will be used.
860 * 'db' is a valid cache database.
862 * 'node' is a valid node.
866 dns_db_printnode(dns_db_t *db, dns_dbnode_t *node, FILE *out);
868 * Print a textual representation of the contents of the node to
871 * Note: this function is intended for debugging, not general use.
875 * 'db' is a valid database.
877 * 'node' is a valid node.
881 *** DB Iterator Creation
885 dns_db_createiterator(dns_db_t *db, isc_boolean_t relative_names,
886 dns_dbiterator_t **iteratorp);
888 * Create an iterator for version 'version' of 'db'.
892 * If 'relative_names' is ISC_TRUE, then node names returned by the
893 * iterator will be relative to the iterator's current origin. If
894 * ISC_FALSE, then the node names will be absolute.
898 * 'db' is a valid database.
900 * iteratorp != NULL && *iteratorp == NULL
904 * On success, *iteratorp will be a valid database iterator.
917 * XXXRTH Should we check for glue and pending data in dns_db_findrdataset()?
921 dns_db_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
922 dns_rdatatype_t type, dns_rdatatype_t covers,
923 isc_stdtime_t now, dns_rdataset_t *rdataset,
924 dns_rdataset_t *sigrdataset);
926 * Search for an rdataset of type 'type' at 'node' that are in version
927 * 'version' of 'db'. If found, make 'rdataset' refer to it.
931 * If 'version' is NULL, then the current version will be used.
933 * Care must be used when using this routine to build a DNS response:
934 * 'node' should have been found with dns_db_find(), not
935 * dns_db_findnode(). No glue checking is done. No checking for
936 * pending data is done.
938 * The 'now' field is ignored if 'db' is a zone database. If 'db' is a
939 * cache database, an rdataset will not be found unless it expires after
940 * 'now'. If 'now' is zero, then the current time will be used.
944 * 'db' is a valid database.
946 * 'node' is a valid node.
948 * 'rdataset' is a valid, disassociated rdataset.
950 * 'sigrdataset' is a valid, disassociated rdataset, or it is NULL.
952 * If 'covers' != 0, 'type' must be SIG.
954 * 'type' is not a meta-RR type such as 'ANY' or 'OPT'.
958 * On success, 'rdataset' is associated with the found rdataset.
965 * Other results are possible, depending upon the database
966 * implementation used.
970 dns_db_allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
971 isc_stdtime_t now, dns_rdatasetiter_t **iteratorp);
973 * Make '*iteratorp' an rdataset iteratator for all rdatasets at 'node' in
974 * version 'version' of 'db'.
978 * If 'version' is NULL, then the current version will be used.
980 * The 'now' field is ignored if 'db' is a zone database. If 'db' is a
981 * cache database, an rdataset will not be found unless it expires after
982 * 'now'. Any ANY query will not match unless at least one rdataset at
983 * the node expires after 'now'. If 'now' is zero, then the current time
988 * 'db' is a valid database.
990 * 'node' is a valid node.
992 * iteratorp != NULL && *iteratorp == NULL
996 * On success, '*iteratorp' is a valid rdataset iterator.
1003 * Other results are possible, depending upon the database
1004 * implementation used.
1008 dns_db_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
1009 isc_stdtime_t now, dns_rdataset_t *rdataset,
1010 unsigned int options, dns_rdataset_t *addedrdataset);
1012 * Add 'rdataset' to 'node' in version 'version' of 'db'.
1016 * If the database has zone semantics, the DNS_DBADD_MERGE option is set,
1017 * and an rdataset of the same type as 'rdataset' already exists at
1018 * 'node' then the contents of 'rdataset' will be merged with the existing
1019 * rdataset. If the option is not set, then rdataset will replace any
1020 * existing rdataset of the same type. If not merging and the
1021 * DNS_DBADD_FORCE option is set, then the data will update the database
1022 * without regard to trust levels. If not forcing the data, then the
1023 * rdataset will only be added if its trust level is >= the trust level of
1024 * any existing rdataset. Forcing is only meaningful for cache databases.
1025 * If DNS_DBADD_EXACT is set then there must be no rdata in common between
1026 * the old and new rdata sets. If DNS_DBADD_EXACTTTL is set then both
1027 * the old and new rdata sets must have the same ttl.
1029 * The 'now' field is ignored if 'db' is a zone database. If 'db' is
1030 * a cache database, then the added rdataset will expire no later than
1031 * now + rdataset->ttl.
1033 * If 'addedrdataset' is not NULL, then it will be attached to the
1034 * resulting new rdataset in the database, or to the existing data if
1035 * the existing data was better.
1039 * 'db' is a valid database.
1041 * 'node' is a valid node.
1043 * 'rdataset' is a valid, associated rdataset with the same class
1046 * 'addedrdataset' is NULL, or a valid, unassociated rdataset.
1048 * The database has zone semantics and 'version' is a valid
1049 * read-write version, or the database has cache semantics
1050 * and version is NULL.
1052 * If the database has cache semantics, the DNS_DBADD_MERGE option must
1058 * DNS_R_UNCHANGED The operation did not change anything.
1062 * Other results are possible, depending upon the database
1063 * implementation used.
1067 dns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node,
1068 dns_dbversion_t *version, dns_rdataset_t *rdataset,
1069 unsigned int options, dns_rdataset_t *newrdataset);
1071 * Remove any rdata in 'rdataset' from 'node' in version 'version' of
1076 * If 'newrdataset' is not NULL, then it will be attached to the
1077 * resulting new rdataset in the database, unless the rdataset has
1078 * become nonexistent. If DNS_DBSUB_EXACT is set then all elements
1079 * of 'rdataset' must exist at 'node'.
1083 * 'db' is a valid database.
1085 * 'node' is a valid node.
1087 * 'rdataset' is a valid, associated rdataset with the same class
1090 * 'newrdataset' is NULL, or a valid, unassociated rdataset.
1092 * The database has zone semantics and 'version' is a valid
1093 * read-write version.
1098 * DNS_R_UNCHANGED The operation did not change anything.
1099 * DNS_R_NXRRSET All rdata of the same type as those
1100 * in 'rdataset' have been deleted.
1101 * DNS_R_NOTEXACT Some part of 'rdataset' did not
1102 * exist and DNS_DBSUB_EXACT was set.
1104 * Other results are possible, depending upon the database
1105 * implementation used.
1109 dns_db_deleterdataset(dns_db_t *db, dns_dbnode_t *node,
1110 dns_dbversion_t *version, dns_rdatatype_t type,
1111 dns_rdatatype_t covers);
1113 * Make it so that no rdataset of type 'type' exists at 'node' in version
1114 * version 'version' of 'db'.
1118 * If 'type' is dns_rdatatype_any, then no rdatasets will exist in
1119 * 'version' (provided that the dns_db_deleterdataset() isn't followed
1120 * by one or more dns_db_addrdataset() calls).
1124 * 'db' is a valid database.
1126 * 'node' is a valid node.
1128 * The database has zone semantics and 'version' is a valid
1129 * read-write version, or the database has cache semantics
1130 * and version is NULL.
1132 * 'type' is not a meta-RR type, except for dns_rdatatype_any, which is
1135 * If 'covers' != 0, 'type' must be SIG.
1140 * DNS_R_UNCHANGED No rdatasets of 'type' existed before
1141 * the operation was attempted.
1143 * Other results are possible, depending upon the database
1144 * implementation used.
1148 dns_db_getsoaserial(dns_db_t *db, dns_dbversion_t *ver, isc_uint32_t *serialp);
1150 * Get the current SOA serial number from a zone database.
1153 * 'db' is a valid database with zone semantics.
1154 * 'ver' is a valid version.
1158 dns_db_overmem(dns_db_t *db, isc_boolean_t overmem);
1160 * Enable / disable agressive cache cleaning.
1164 dns_db_nodecount(dns_db_t *db);
1166 * Count the number of nodes in 'db'.
1170 * 'db' is a valid database.
1173 * The number of nodes in the database
1177 dns_db_settask(dns_db_t *db, isc_task_t *task);
1179 * If task is set then the final detach maybe performed asynchronously.
1182 * 'db' is a valid database.
1183 * 'task' to be valid or NULL.
1187 dns_db_ispersistent(dns_db_t *db);
1189 * Is 'db' persistent? A persistent database does not need to be loaded
1190 * from disk or written to disk.
1194 * 'db' is a valid database.
1197 * ISC_TRUE 'db' is persistent.
1198 * ISC_FALSE 'db' is not persistent.
1202 dns_db_register(const char *name, dns_dbcreatefunc_t create, void *driverarg,
1203 isc_mem_t *mctx, dns_dbimplementation_t **dbimp);
1206 * Register a new database implementation and add it to the list of
1207 * supported implementations.
1211 * 'name' is not NULL
1212 * 'order' is a valid function pointer
1213 * 'mctx' is a valid memory context
1214 * dbimp != NULL && *dbimp == NULL
1217 * ISC_R_SUCCESS The registration succeeded
1218 * ISC_R_NOMEMORY Out of memory
1219 * ISC_R_EXISTS A database implementation with the same name exists
1223 * *dbimp points to an opaque structure which must be passed to
1224 * dns_db_unregister().
1228 dns_db_unregister(dns_dbimplementation_t **dbimp);
1230 * Remove a database implementation from the the list of supported
1231 * implementations. No databases of this type can be active when this
1235 * dbimp != NULL && *dbimp == NULL
1239 * Any memory allocated in *dbimp will be freed.
1244 #endif /* DNS_DB_H */