⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 db.h

📁 package of develop dns
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003  Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. *//* $Id: db.h,v 1.67.12.8 2004/05/14 05:06:41 marka Exp $ */#ifndef DNS_DB_H#define DNS_DB_H 1/***** ***** Module Info *****//* * DNS DB * * The DNS DB interface allows named rdatasets to be stored and retrieved. * * The dns_db_t type is like a "virtual class".  To actually use * DBs, an implementation of the class is required. * * XXX <more> XXX * * MP: *	The module ensures appropriate synchronization of data structures it *	creates and manipulates. * * Reliability: *	No anticipated impact. * * Resources: *	<TBS> * * Security: *	No anticipated impact. * * Standards: *	None. *//***** ***** Imports *****/#include <isc/lang.h>#include <isc/magic.h>#include <isc/ondestroy.h>#include <isc/stdtime.h>#include <dns/name.h>#include <dns/types.h>ISC_LANG_BEGINDECLS/***** ***** Types *****/typedef struct dns_dbmethods {	void		(*attach)(dns_db_t *source, dns_db_t **targetp);	void		(*detach)(dns_db_t **dbp);	isc_result_t	(*beginload)(dns_db_t *db, dns_addrdatasetfunc_t *addp,				     dns_dbload_t **dbloadp);	isc_result_t	(*endload)(dns_db_t *db, dns_dbload_t **dbloadp);	isc_result_t	(*dump)(dns_db_t *db, dns_dbversion_t *version,				const char *filename);	void		(*currentversion)(dns_db_t *db,					  dns_dbversion_t **versionp);	isc_result_t	(*newversion)(dns_db_t *db,				      dns_dbversion_t **versionp);	void		(*attachversion)(dns_db_t *db, dns_dbversion_t *source,					 dns_dbversion_t **targetp);	void		(*closeversion)(dns_db_t *db,					dns_dbversion_t **versionp,					isc_boolean_t commit);	isc_result_t	(*findnode)(dns_db_t *db, dns_name_t *name,				    isc_boolean_t create,				    dns_dbnode_t **nodep);	isc_result_t	(*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);	isc_result_t	(*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);	void		(*attachnode)(dns_db_t *db,				      dns_dbnode_t *source,				      dns_dbnode_t **targetp);	void		(*detachnode)(dns_db_t *db,				      dns_dbnode_t **targetp);	isc_result_t	(*expirenode)(dns_db_t *db, dns_dbnode_t *node,				      isc_stdtime_t now);	void		(*printnode)(dns_db_t *db, dns_dbnode_t *node,				     FILE *out);	isc_result_t 	(*createiterator)(dns_db_t *db,					  isc_boolean_t relative_names,					  dns_dbiterator_t **iteratorp);	isc_result_t	(*findrdataset)(dns_db_t *db, dns_dbnode_t *node,					dns_dbversion_t *version,					dns_rdatatype_t type,					dns_rdatatype_t covers,					isc_stdtime_t now,					dns_rdataset_t *rdataset,					dns_rdataset_t *sigrdataset);	isc_result_t	(*allrdatasets)(dns_db_t *db, dns_dbnode_t *node,					dns_dbversion_t *version,					isc_stdtime_t now,					dns_rdatasetiter_t **iteratorp);	isc_result_t	(*addrdataset)(dns_db_t *db, dns_dbnode_t *node,				       dns_dbversion_t *version,				       isc_stdtime_t now,				       dns_rdataset_t *rdataset,				       unsigned int options,				       dns_rdataset_t *addedrdataset);	isc_result_t	(*subtractrdataset)(dns_db_t *db, dns_dbnode_t *node,					    dns_dbversion_t *version,					    dns_rdataset_t *rdataset,					    unsigned int options,					    dns_rdataset_t *newrdataset);	isc_result_t	(*deleterdataset)(dns_db_t *db, dns_dbnode_t *node,					  dns_dbversion_t *version,					  dns_rdatatype_t type,					  dns_rdatatype_t covers);	isc_boolean_t	(*issecure)(dns_db_t *db);	unsigned int	(*nodecount)(dns_db_t *db);	isc_boolean_t	(*ispersistent)(dns_db_t *db);	void		(*overmem)(dns_db_t *db, isc_boolean_t overmem);	void		(*settask)(dns_db_t *db, isc_task_t *);} dns_dbmethods_t;typedef isc_result_t(*dns_dbcreatefunc_t)(isc_mem_t *mctx, dns_name_t *name,		      dns_dbtype_t type, dns_rdataclass_t rdclass,		      unsigned int argc, char *argv[], void *driverarg,		      dns_db_t **dbp);					#define DNS_DB_MAGIC		ISC_MAGIC('D','N','S','D')#define DNS_DB_VALID(db)	ISC_MAGIC_VALID(db, DNS_DB_MAGIC)/* * This structure is actually just the common prefix of a DNS db * implementation's version of a dns_db_t. * * Direct use of this structure by clients is forbidden.  DB implementations * may change the structure.  'magic' must be DNS_DB_MAGIC for any of the * dns_db_ routines to work.  DB implementations must maintain all DB * invariants. */struct dns_db {	unsigned int			magic;	unsigned int			impmagic;	dns_dbmethods_t *		methods;	isc_uint16_t			attributes;	dns_rdataclass_t		rdclass;	dns_name_t			origin;	isc_ondestroy_t			ondest;	isc_mem_t *			mctx;};#define DNS_DBATTR_CACHE		0x01#define DNS_DBATTR_STUB			0x02/* * Options that can be specified for dns_db_find(). */#define DNS_DBFIND_GLUEOK		0x01#define DNS_DBFIND_VALIDATEGLUE		0x02#define DNS_DBFIND_NOWILD		0x04#define DNS_DBFIND_PENDINGOK		0x08#define DNS_DBFIND_NOEXACT		0x10#define DNS_DBFIND_FORCENSEC		0x20#define DNS_DBFIND_COVERINGNSEC		0x40/* * Options that can be specified for dns_db_addrdataset(). */#define DNS_DBADD_MERGE			0x01#define DNS_DBADD_FORCE			0x02#define DNS_DBADD_EXACT			0x04#define DNS_DBADD_EXACTTTL		0x08/* * Options that can be specified for dns_db_subtractrdataset(). */#define DNS_DBSUB_EXACT			0x01/***** ***** Methods *****//*** *** Basic DB Methods ***/isc_result_tdns_db_create(isc_mem_t *mctx, const char *db_type, dns_name_t *origin,	      dns_dbtype_t type, dns_rdataclass_t rdclass,	      unsigned int argc, char *argv[], dns_db_t **dbp);/* * Create a new database using implementation 'db_type'. * * Notes: *	All names in the database must be subdomains of 'origin' and in class *	'rdclass'.  The database makes its own copy of the origin, so the *	caller may do whatever they like with 'origin' and its storage once the *	call returns. * *	DB implementation-specific parameters are passed using argc and argv. * * Requires: * *	dbp != NULL and *dbp == NULL * *	'origin' is a valid absolute domain name. * *	mctx is a valid memory context * * Ensures: * *	A copy of 'origin' has been made for the databases use, and the *	caller is free to do whatever they want with the name and storage *	associated with 'origin'. * * Returns: * *	ISC_R_SUCCESS *	ISC_R_NOMEMORY *	ISC_R_NOTFOUND				db_type not found * *	Many other errors are possible, depending on what db_type was *	specified. */voiddns_db_attach(dns_db_t *source, dns_db_t **targetp);/* * Attach *targetp to source. * * Requires: * *	'source' is a valid database. * *	'targetp' points to a NULL dns_db_t *. * * Ensures: * *	*targetp is attached to source. */voiddns_db_detach(dns_db_t **dbp);/* * Detach *dbp from its database. * * Requires: * *	'dbp' points to a valid database. * * Ensures: * *	*dbp is NULL. * *	If '*dbp' is the last reference to the database, * *		All resources used by the database will be freed */isc_result_tdns_db_ondestroy(dns_db_t *db, isc_task_t *task, isc_event_t **eventp);/* * Causes 'eventp' to be sent to be sent to 'task' when the database is * destroyed. * * Note; ownership of the eventp is taken from the caller (and *eventp is * set to NULL). The sender field of the event is set to 'db' before it is * sent to the task. */isc_boolean_tdns_db_iscache(dns_db_t *db);/* * Does 'db' have cache semantics? * * Requires: * *	'db' is a valid database. * * Returns: *	ISC_TRUE	'db' has cache semantics *	ISC_FALSE	otherwise */isc_boolean_tdns_db_iszone(dns_db_t *db);/* * Does 'db' have zone semantics? * * Requires: * *	'db' is a valid database. * * Returns: *	ISC_TRUE	'db' has zone semantics *	ISC_FALSE	otherwise */isc_boolean_tdns_db_isstub(dns_db_t *db);/* * Does 'db' have stub semantics? * * Requires: * *	'db' is a valid database. * * Returns: *	ISC_TRUE	'db' has zone semantics *	ISC_FALSE	otherwise */isc_boolean_tdns_db_issecure(dns_db_t *db);/* * Is 'db' secure? * * Requires: * *	'db' is a valid database with zone semantics. * * Returns: *	ISC_TRUE	'db' is secure. *	ISC_FALSE	'db' is not secure. */dns_name_t *dns_db_origin(dns_db_t *db);/* * The origin of the database. * * Note: caller must not try to change this name. * * Requires: * *	'db' is a valid database. * * Returns: * *	The origin of the database. */dns_rdataclass_tdns_db_class(dns_db_t *db);/* * The class of the database. * * Requires: * *	'db' is a valid database. * * Returns: * *	The class of the database. */isc_result_tdns_db_beginload(dns_db_t *db, dns_addrdatasetfunc_t *addp,		 dns_dbload_t **dbloadp);/* * Begin loading 'db'. * * Requires: * *	'db' is a valid database. * *	This is the first attempt to load 'db'. * *	addp != NULL && *addp == NULL * *	dbloadp != NULL && *dbloadp == NULL * * Ensures: * *	On success, *addp will be a valid dns_addrdatasetfunc_t suitable *	for loading 'db'.  *dbloadp will be a valid DB load context which *	should be used as 'arg' when *addp is called. * * 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_endload(dns_db_t *db, dns_dbload_t **dbloadp);/* * Finish loading 'db'. * * Requires: * *	'db' is a valid database that is being loaded. * *	dbloadp != NULL and *dbloadp is a valid database load context.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -