📄 db.h
字号:
* * Ensures: * * *dbloadp == NULL * * Returns: * * ISC_R_SUCCESS * ISC_R_NOMEMORY * * Other results are possible, depending upon the database * implementation used, syntax errors in the master file, etc. */isc_result_tdns_db_load(dns_db_t *db, const char *filename);/* * Load master file 'filename' into 'db'. * * Notes: * This routine is equivalent to calling * * dns_db_beginload(); * dns_master_loadfile(); * dns_db_endload(); * * Requires: * * 'db' is a valid database. * * This is the first attempt to load 'db'. * * Returns: * * ISC_R_SUCCESS * ISC_R_NOMEMORY * * Other results are possible, depending upon the database * implementation used, syntax errors in the master file, etc. */isc_result_tdns_db_dump(dns_db_t *db, dns_dbversion_t *version, const char *filename);/* * Dump version 'version' of 'db' to master file 'filename'. * * Requires: * * 'db' is a valid database. * * 'version' is a valid version. * * Returns: * * ISC_R_SUCCESS * ISC_R_NOMEMORY * * Other results are possible, depending upon the database * implementation used, OS file errors, etc. *//*** *** Version Methods ***/voiddns_db_currentversion(dns_db_t *db, dns_dbversion_t **versionp);/* * Open the current version for reading. * * Requires: * * 'db' is a valid database with zone semantics. * * versionp != NULL && *verisonp == NULL * * Ensures: * * On success, '*versionp' is attached to the current version. * */isc_result_tdns_db_newversion(dns_db_t *db, dns_dbversion_t **versionp);/* * Open a new version for reading and writing. * * Requires: * * 'db' is a valid database with zone semantics. * * versionp != NULL && *verisonp == NULL * * Ensures: * * On success, '*versionp' is attached to the current version. * * Returns: * * ISC_R_SUCCESS * ISC_R_NOMEMORY * * Other results are possible, depending upon the database * implementation used. */voiddns_db_attachversion(dns_db_t *db, dns_dbversion_t *source, dns_dbversion_t **targetp);/* * Attach '*targetp' to 'source'. * * Requires: * * 'db' is a valid database with zone semantics. * * source is a valid open version * * targetp != NULL && *targetp == NULL * * Ensures: * * '*targetp' is attached to source. */voiddns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit);/* * Close version '*versionp'. * * Note: if '*versionp' is a read-write version and 'commit' is ISC_TRUE, * then all changes made in the version will take effect, otherwise they * will be rolled back. The value if 'commit' is ignored for read-only * versions. * * Requires: * * 'db' is a valid database with zone semantics. * * '*versionp' refers to a valid version. * * If committing a writable version, then there must be no other * outstanding references to the version (e.g. an active rdataset * iterator). * * Ensures: * * *versionp == NULL * * If *versionp is a read-write version, and commit is ISC_TRUE, then * the version will become the current version. If !commit, then all * changes made in the version will be undone, and the version will * not become the current version. *//*** *** Node Methods ***/isc_result_tdns_db_findnode(dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep);/* * Find the node with name 'name'. * * Notes: * If 'create' is ISC_TRUE and no node with name 'name' exists, then * such a node will be created. * * This routine is for finding or creating a node with the specified * name. There are no partial matches. It is not suitable for use * in building responses to ordinary DNS queries; clients which wish * to do that should use dns_db_find() instead. * * Requires: * * 'db' is a valid database. * * 'name' is a valid, non-empty, absolute name. * * nodep != NULL && *nodep == NULL * * Ensures: * * On success, *nodep is attached to the node with name 'name'. * * Returns: * * ISC_R_SUCCESS * ISC_R_NOTFOUND If !create and name not found. * ISC_R_NOMEMORY Can only happen if create is ISC_TRUE. * * Other results are possible, depending upon the database * implementation used. */isc_result_tdns_db_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);/* * Find the best match for 'name' and 'type' in version 'version' of 'db'. * * Notes: * * If type == dns_rdataset_any, then rdataset will not be bound. * * If 'options' does not have DNS_DBFIND_GLUEOK set, then no glue will * be returned. For zone databases, glue is as defined in RFC 2181. * For cache databases, glue is any rdataset with a trust of * dns_trust_glue. * * If 'options' does not have DNS_DBFIND_PENDINGOK set, then no * pending data will be returned. This option is only meaningful for * cache databases. * * If the DNS_DBFIND_NOWILD option is set, then wildcard matching will * be disabled. This option is only meaningful for zone databases. * * If the DNS_DBFIND_FORCENSEC option is set, the database is assumed to * have NSEC records, and these will be returned when appropriate. This * is only necessary when querying a database that was not secure * when created. * * If the DNS_DBFIND_COVERINGNSEC option is set, then look for a * NSEC record that potentially covers 'name' if a answer cannot * be found. Note the returned NSEC needs to be checked to ensure * that it is correct. This only affects answers returned from the * cache. * * To respond to a query for SIG records, the caller should create a * rdataset iterator and extract the signatures from each rdataset. * * Making queries of type ANY with DNS_DBFIND_GLUEOK is not recommended, * because the burden of determining whether a given rdataset is valid * glue or not falls upon the caller. * * The 'now' field is ignored if 'db' is a zone database. If 'db' is a * cache database, an rdataset will not be found unless it expires after * 'now'. Any ANY query will not match unless at least one rdataset at * the node expires after 'now'. If 'now' is zero, then the current time * will be used. * * Requires: * * 'db' is a valid database. * * 'type' is not SIG, or a meta-RR type other than 'ANY' (e.g. 'OPT'). * * 'nodep' is NULL, or nodep is a valid pointer and *nodep == NULL. * * 'foundname' is a valid name with a dedicated buffer. * * 'rdataset' is NULL, or is a valid unassociated rdataset. * * Ensures: * On a non-error completion: * * If nodep != NULL, then it is bound to the found node. * * If foundname != NULL, then it contains the full name of the * found node. * * If rdataset != NULL and type != dns_rdatatype_any, then * rdataset is bound to the found rdataset. * * Returns: * * Non-error results are: * * ISC_R_SUCCESS The desired node and type were * found. * * DNS_R_WILDCARD The desired node and type were * found after performing * wildcard matching. This is * only returned if the * DNS_DBFIND_INDICATEWILD * option is set; otherwise * ISC_R_SUCCESS is returned. * * DNS_R_GLUE The desired node and type were * found, but are glue. This * result can only occur if * the DNS_DBFIND_GLUEOK option * is set. This result can only * occur if 'db' is a zone * database. If type == * dns_rdatatype_any, then the * node returned may contain, or * consist entirely of invalid * glue (i.e. data occluded by a * zone cut). The caller must * take care not to return invalid * glue to a client. * * DNS_R_DELEGATION The data requested is beneath * a zone cut. node, foundname, * and rdataset reference the * NS RRset of the zone cut. * If 'db' is a cache database, * then this is the deepest known * delegation. * * DNS_R_ZONECUT type == dns_rdatatype_any, and * the desired node is a zonecut. * The caller must take care not * to return inappropriate glue * to a client. This result can * only occur if 'db' is a zone * database and DNS_DBFIND_GLUEOK * is set. * * DNS_R_DNAME The data requested is beneath * a DNAME. node, foundname, * and rdataset reference the * DNAME RRset. * * DNS_R_CNAME The rdataset requested was not * found, but there is a CNAME * at the desired name. node, * foundname, and rdataset * reference the CNAME RRset. * * DNS_R_NXDOMAIN The desired name does not * exist. * * DNS_R_NXRRSET The desired name exists, but * the desired type does not. * * ISC_R_NOTFOUND The desired name does not * exist, and no delegation could * be found. This result can only * occur if 'db' is a cache * database. The caller should * use its nameserver(s) of last * resort (e.g. root hints). * * DNS_R_NCACHENXDOMAIN The desired name does not * exist. 'node' is bound to the * cache node with the desired * name, and 'rdataset' contains * the negative caching proof. * * DNS_R_NCACHENXRRSET The desired type does not * exist. 'node' is bound to the * cache node with the desired * name, and 'rdataset' contains * the negative caching proof. * * DNS_R_EMPTYNAME The name exists but there is * no data at the name. * * DNS_R_COVERINGNSEC The returned data is a NSEC * that potentially covers 'name'. * * Error results: * * ISC_R_NOMEMORY * * DNS_R_BADDB Data that is required to be * present in the DB, e.g. an NSEC * record in a secure zone, is not * present. * * Other results are possible, and should all be treated as * errors. */isc_result_tdns_db_findzonecut(dns_db_t *db, dns_name_t *name, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);/* * Find the deepest known zonecut which encloses 'name' in 'db'. * * Notes: * * If the DNS_DBFIND_NOEXACT option is set, then the zonecut returned * (if any) will be the deepest known ancestor of 'name'. * * If 'now' is zero, then the current time will be used. * * Requires: * * 'db' is a valid database with cache semantics. * * 'nodep' is NULL, or nodep is a valid pointer and *nodep == NULL. * * 'foundname' is a valid name with a dedicated buffer. * * 'rdataset' is NULL, or is a valid unassociated rdataset. * * Ensures: * On a non-error completion: * * If nodep != NULL, then it is bound to the found node. * * If foundname != NULL, then it contains the full name of the * found node. * * If rdataset != NULL and type != dns_rdatatype_any, then * rdataset is bound to the found rdataset. * * Returns: * * Non-error results are: * * ISC_R_SUCCESS * * ISC_R_NOTFOUND * * Other results are possible, and should all be treated as * errors. */voiddns_db_attachnode(dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp);/* * Attach *targetp to source. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -