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

📄 zone.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: zone.h,v 1.106.2.7.4.15 2004/10/26 02:08:43 marka Exp $ */#ifndef DNS_ZONE_H#define DNS_ZONE_H 1/*** ***	Imports ***/#include <stdio.h>#include <isc/formatcheck.h>#include <isc/lang.h>#include <isc/rwlock.h>#include <dns/types.h>typedef enum {	dns_zone_none,	dns_zone_master,	dns_zone_slave,	dns_zone_stub} dns_zonetype_t;#define DNS_ZONEOPT_SERVERS	  0x00000001U	/* perform server checks */#define DNS_ZONEOPT_PARENTS	  0x00000002U	/* perform parent checks */#define DNS_ZONEOPT_CHILDREN	  0x00000004U	/* perform child checks */#define DNS_ZONEOPT_NOTIFY	  0x00000008U	/* perform NOTIFY */#define DNS_ZONEOPT_MANYERRORS	  0x00000010U	/* return many errors on load */#define DNS_ZONEOPT_IXFRFROMDIFFS 0x00000020U	/* calculate differences */#define DNS_ZONEOPT_NOMERGE	  0x00000040U	/* don't merge journal */#define DNS_ZONEOPT_CHECKNS	  0x00000080U	/* check if NS's are addresses */#define DNS_ZONEOPT_FATALNS	  0x00000100U	/* DNS_ZONEOPT_CHECKNS is fatal */#define DNS_ZONEOPT_MULTIMASTER	  0x00000200U	/* this zone has multiple masters */#define DNS_ZONEOPT_USEALTXFRSRC  0x00000400U	/* use alternate transfer sources */#define DNS_ZONEOPT_CHECKNAMES	  0x00000800U	/* check-names */#define DNS_ZONEOPT_CHECKNAMESFAIL 0x00001000U	/* fatal check-name failures */#ifndef NOMINUM_PUBLIC/* * Nominum specific options build down. */#define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U	/* forward notify to master */#endif /* NOMINUM_PUBLIC */#ifndef DNS_ZONE_MINREFRESH#define DNS_ZONE_MINREFRESH		    300	/* 5 minutes */#endif#ifndef DNS_ZONE_MAXREFRESH#define DNS_ZONE_MAXREFRESH		2419200	/* 4 weeks */#endif#ifndef DNS_ZONE_DEFAULTREFRESH#define DNS_ZONE_DEFAULTREFRESH		   3600	/* 1 hour */#endif#ifndef DNS_ZONE_MINRETRY#define DNS_ZONE_MINRETRY		    300	/* 5 minutes */#endif#ifndef DNS_ZONE_MAXRETRY#define DNS_ZONE_MAXRETRY		1209600	/* 2 weeks */#endif#ifndef DNS_ZONE_DEFAULTRETRY#define DNS_ZONE_DEFAULTRETRY		     60	/* 1 minute, subject to						   exponential backoff */#endif#define DNS_ZONESTATE_XFERRUNNING	1#define DNS_ZONESTATE_XFERDEFERRED	2#define DNS_ZONESTATE_SOAQUERY		3#define DNS_ZONESTATE_ANY		4ISC_LANG_BEGINDECLS/*** ***	Functions ***/isc_result_tdns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx);/* *	Creates a new empty zone and attach '*zonep' to it. * * Requires: *	'zonep' to point to a NULL pointer. *	'mctx' to be a valid memory context. * * Ensures: *	'*zonep' refers to a valid zone. * * Returns: *	ISC_R_SUCCESS *	ISC_R_NOMEMORY *	ISC_R_UNEXPECTED */voiddns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass);/* *	Sets the class of a zone.  This operation can only be performed *	once on a zone. * * Require: *	'zone' to be a valid zone. *	dns_zone_setclass() not to have been called since the zone was *	created. *	'rdclass' != dns_rdataclass_none. */dns_rdataclass_tdns_zone_getclass(dns_zone_t *zone);/* *	Returns the current zone class. * * Requires: *	'zone' to be a valid zone. */voiddns_zone_settype(dns_zone_t *zone, dns_zonetype_t type);/* *	Sets the zone type. This operation can only be performed once on *	a zone. * * Requires: *	'zone' to be a valid zone. *	dns_zone_settype() not to have been called since the zone was *	created. *	'type' != dns_zone_none */voiddns_zone_setview(dns_zone_t *zone, dns_view_t *view);/* *	Associate the zone with a view. * * Require: *	'zone' to be a valid zone. */dns_view_t *dns_zone_getview(dns_zone_t *zone);/* *	Returns the zone's associated view. * * Requires: *	'zone' to be a valid zone. */isc_result_tdns_zone_setorigin(dns_zone_t *zone, dns_name_t *origin);/* *	Sets the zones origin to 'origin'. * * Require: *	'zone' to be a valid zone. *	'origin' to be non NULL. * * Returns: *	ISC_R_SUCCESS * 	ISC_R_NOMEMORY */dns_name_t *dns_zone_getorigin(dns_zone_t *zone);/* *	Returns the value of the origin. * * Require: *	'zone' to be a valid zone. */isc_result_tdns_zone_setfile(dns_zone_t *zone, const char *file);/* *	Sets the name of the master file from which the zone *	loads its database to 'file'.  For zones that have *	no associated master file, 'file' will be NULL. * *	For zones with persistent databases, the file name *	setting is ignored. * * Require: *	'zone' to be a valid zone. * * Returns: *	ISC_R_NOMEMORY *	ISC_R_SUCCESS */const char *dns_zone_getfile(dns_zone_t *zone);/* * 	Gets the name of the zone's master file, if any. * * Requires: *	'zone' to be valid initialised zone. * * Returns: *	Pointer to null-terminated file name, or NULL. */isc_result_tdns_zone_load(dns_zone_t *zone);isc_result_tdns_zone_loadnew(dns_zone_t *zone);/* *	Cause the database to be loaded from its backing store. *	Confirm that the minimum requirements for the zone type are *	met, otherwise DNS_R_BADZONE is returned. * *	dns_zone_loadnew() only loads zones that are not yet loaded. *	dns_zone_load() also loads zones that are already loaded and *	and whose master file has changed since the last load. * * Require: *	'zone' to be a valid zone. * * Returns: *	ISC_R_UNEXPECTED *	ISC_R_SUCCESS *	DNS_R_CONTINUE	  Incremental load has been queued. *	DNS_R_UPTODATE	  The zone has already been loaded based on *			  file system timestamps. *	DNS_R_BADZONE *	Any result value from dns_db_load(). */voiddns_zone_attach(dns_zone_t *source, dns_zone_t **target);/* *	Attach '*target' to 'source' incrementing its external * 	reference count. * * Require: *	'zone' to be a valid zone. *	'target' to be non NULL and '*target' to be NULL. */voiddns_zone_detach(dns_zone_t **zonep);/* *	Detach from a zone decrementing its external reference count. *	If this was the last external reference to the zone it will be * 	shut down and eventually freed. * * Require: *	'zonep' to point to a valid zone. */voiddns_zone_iattach(dns_zone_t *source, dns_zone_t **target);/* *	Attach '*target' to 'source' incrementing its internal * 	reference count.  This is intended for use by operations * 	such as zone transfers that need to prevent the zone * 	object from being freed but not from shutting down. * * Require: *	The caller is running in the context of the zone's task. *	'zone' to be a valid zone. *	'target' to be non NULL and '*target' to be NULL. */voiddns_zone_idetach(dns_zone_t **zonep);/* *	Detach from a zone decrementing its internal reference count. *	If there are no more internal or external references to the * 	zone, it will be freed. * * Require: *	The caller is running in the context of the zone's task. *	'zonep' to point to a valid zone. */voiddns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value);/* *	Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE') *	zone flags.  Valid flag bits are DNS_ZONE_F_*. * * Requires *	'zone' to be a valid zone. */isc_result_tdns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp);/* * 	Attach '*dbp' to the database to if it exists otherwise *	return DNS_R_NOTLOADED. * * Require: *	'zone' to be a valid zone. *	'dbp' to be != NULL && '*dbp' == NULL. * * Returns: *	ISC_R_SUCCESS *	DNS_R_NOTLOADED */isc_result_tdns_zone_setdbtype(dns_zone_t *zone,		   unsigned int dbargc, const char * const *dbargv);/* *	Sets the database type to dbargv[0] and database arguments *	to subsequent dbargv elements. *	'db_type' is not checked to see if it is a valid database type. * * Require: *	'zone' to be a valid zone. *	'database' to be non NULL. *	'dbargc' to be >= 1 *	'dbargv' to point to dbargc NULL-terminated strings * * Returns: *	ISC_R_NOMEMORY *	ISC_R_SUCCESS */voiddns_zone_markdirty(dns_zone_t *zone);/* *	Mark a zone as 'dirty'. * * Require: *	'zone' to be a valid zone. */voiddns_zone_expire(dns_zone_t *zone);/* *	Mark the zone as expired.  If the zone requires dumping cause it to *	be initiated.  Set the refresh and retry intervals to there default *	values and unload the zone. * * Require *	'zone' to be a valid zone. */voiddns_zone_refresh(dns_zone_t *zone);/* *	Initiate zone up to date checks.  The zone must already be being *	managed. * * Require *	'zone' to be a valid zone. */isc_result_tdns_zone_flush(dns_zone_t *zone);/* *	Write the zone to database if there are uncommited changes. * * Require: *	'zone' to be a valid zone. */isc_result_tdns_zone_dump(dns_zone_t *zone);/* *	Write the zone to database. * * Require: *	'zone' to be a valid zone. */isc_result_tdns_zone_dumptostream(dns_zone_t *zone, FILE *fd);/* *	Write the zone to stream 'fd'. * * Require: *	'zone' to be a valid zone. *	'fd' to be a stream open for writing. */isc_result_tdns_zone_fulldumptostream(dns_zone_t *zone, FILE *fd);/* *	The same as dns_zone_dumptostream, but dumps the zone with *	different dump settings (dns_master_style_full). * * Require: *	'zone' to be a valid zone. *	'fd' to be a stream open for writing. */voiddns_zone_maintenance(dns_zone_t *zone);/* *	Perform regular maintenace on the zone.  This is called as a *	result of a zone being managed. * * Require *	'zone' to be a valid zone. */isc_result_tdns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,		    isc_uint32_t count);isc_result_tdns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,			    dns_name_t **keynames, isc_uint32_t count);/* *	Set the list of master servers for the zone. * * Require: *	'zone' to be a valid zone. *	'masters' array of isc_sockaddr_t with port set or NULL. *	'count' the number of masters. *      'keynames' array of dns_name_t's for tsig keys or NULL. * *      dns_zone_setmasters() is just a wrapper to setmasterswithkeys(), *      passing NULL in the keynames field. * * 	If 'masters' is NULL then 'count' must be zero. * * Returns: *	ISC_R_SUCCESS *	ISC_R_NOMEMORY *      Any result dns_name_dup() can return, if keynames!=NULL */isc_result_tdns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,		       isc_uint32_t count);/* *	Set the list of additional servers to be notified when *	a zone changes.	 To clear the list use 'count = 0'. * * Require: *	'zone' to be a valid zone. *	'notify' to be non-NULL if count != 0. *	'count' to be the number of notifyees. * * Returns: *	ISC_R_SUCCESS *	ISC_R_NOMEMORY */voiddns_zone_unload(dns_zone_t *zone);/* *	detach the database from the zone structure. * * Require: *	'zone' to be a valid zone. */voiddns_zone_setoption(dns_zone_t *zone, unsigned int option, isc_boolean_t value);/* *	Set given options on ('value' == ISC_TRUE) or off ('value' == *	ISC_FALSE). * * Require: *	'zone' to be a valid zone. */unsigned intdns_zone_getoptions(dns_zone_t *zone);/*

⌨️ 快捷键说明

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