server.h 2.47 KB
Newer Older
Bob Halley's avatar
add    
Bob Halley committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright (C) 1999  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 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
23
#include <isc/types.h>
#include <isc/quota.h>
Bob Halley's avatar
add    
Bob Halley committed
24

25
26
#include <dns/types.h>

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

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

37
38
	isc_task_t *		task;
	
39
40
41
42
43
44
45
	/* 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;
46
47
48
	isc_quota_t		xfroutquota;
	isc_quota_t		tcpquota;
	isc_quota_t		recursionquota;
49
50

	/* Server data structures. */
51
52
	dns_zonemgr_t *		zonemgr;
	ns_clientmgr_t *	clientmgr;
53
54
	dns_viewlist_t		viewlist;
	isc_rwlock_t		viewlock;
55
	ns_interfacemgr_t *	interfacemgr;
56
	dns_db_t *		roothints;
57
	dns_tkey_ctx_t *	tkeyctx;
58
59
60

	isc_mutex_t		reload_event_lock;
	isc_event_t *		reload_event;
61
62
63
64
65
66
};

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

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

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

void
82
83
84
85
86
87
88
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
89
90

#endif /* NS_SERVER_H */