server.h 2.63 KB
Newer Older
Bob Halley's avatar
add  
Bob Halley committed
1
/*
Bob Halley's avatar
Bob Halley committed
2
 * Copyright (C) 1999, 2000  Internet Software Consortium.
Bob Halley's avatar
add  
Bob Halley committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * 
 * 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
 * CONSORTIUM 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.
 */

#ifndef NS_SERVER_H
#define NS_SERVER_H 1

Bob Halley's avatar
Bob Halley committed
21
#include <isc/log.h>
22
#include <isc/sockaddr.h>
23 24
#include <isc/types.h>
#include <isc/quota.h>
Bob Halley's avatar
add  
Bob Halley committed
25

26 27
#include <dns/types.h>

28 29 30
#define NS_EVENTCLASS		ISC_EVENTCLASS(0x4E43)
#define NS_EVENT_RELOAD		(NS_EVENTCLASS + 0)

31 32 33 34 35 36 37
/*
 * Name server state.  Better here than in lots of separate global variables.
 */
struct ns_server {
	isc_uint32_t		magic;
	isc_mem_t *		mctx;

38
	isc_task_t *		task;
39 40 41

	/* Common rwlock for the server's configurable data. */
	isc_rwlock_t		conflock;
42
	
43 44 45 46 47 48 49
	/* Configurable data. */
	isc_boolean_t		recursion;
	isc_boolean_t		auth_nxdomain;
	dns_transfer_format_t	transfer_format;
	dns_acl_t *		queryacl;
	dns_acl_t *		recursionacl;
	dns_acl_t *		transferacl;
50 51 52
	isc_quota_t		xfroutquota;
	isc_quota_t		tcpquota;
	isc_quota_t		recursionquota;
53 54

	/* Server data structures. */
55 56
	dns_zonemgr_t *		zonemgr;
	ns_clientmgr_t *	clientmgr;
57
	dns_viewlist_t		viewlist;
58
	ns_interfacemgr_t *	interfacemgr;
59
	dns_db_t *		roothints;
60
	dns_tkey_ctx_t *	tkeyctx;
61 62
	isc_sockaddr_t		querysrc_address;
	dns_dispatch_t *	querysrc_dispatch;
63 64 65

	isc_mutex_t		reload_event_lock;
	isc_event_t *		reload_event;
66 67 68 69 70 71
};

#define NS_SERVER_MAGIC			0x53564552	/* SVER */
#define NS_SERVER_VALID(s)		((s) != NULL && \
					 (s)->magic == NS_SERVER_MAGIC)

72
void
73 74 75
ns_server_create(isc_mem_t *mctx, ns_server_t **serverp);
/*
 * Create a server object with default settings.
76 77
 * This function either succeeds or causes the program to exit
 * with a fatal error.
78 79 80 81 82 83 84
 */

void
ns_server_destroy(ns_server_t **serverp);
/*
 * Destroy a server object, freeing its memory.
 */
Bob Halley's avatar
Bob Halley committed
85 86

void
87 88 89 90 91 92 93
ns_server_reloadwanted(ns_server_t *server);
/*
 * Inform a server that a reload is wanted.  This function
 * may be called asynchronously, from outside the server's task.
 * If a reload is already scheduled or in progress, the call
 * is ignored.
 */
Bob Halley's avatar
add  
Bob Halley committed
94

95

Bob Halley's avatar
add  
Bob Halley committed
96
#endif /* NS_SERVER_H */