Merge branch 'vendor/EXPAT'
[dragonfly.git] / contrib / bind / bin / named / include / named / lwresd.h
1 /*
2  * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 2000, 2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  * PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 /* $Id: lwresd.h,v 1.19 2007/06/19 23:46:59 tbox Exp $ */
19
20 #ifndef NAMED_LWRESD_H
21 #define NAMED_LWRESD_H 1
22
23 /*! \file */
24
25 #include <isc/types.h>
26 #include <isc/sockaddr.h>
27
28 #include <isccfg/cfg.h>
29
30 #include <dns/types.h>
31
32 struct ns_lwresd {
33         unsigned int magic;
34
35         isc_mutex_t lock;
36         dns_view_t *view;
37         ns_lwsearchlist_t *search;
38         unsigned int ndots;
39         isc_mem_t *mctx;
40         isc_boolean_t shutting_down;
41         unsigned int refs;
42 };
43
44 struct ns_lwreslistener {
45         unsigned int magic;
46
47         isc_mutex_t lock;
48         isc_mem_t *mctx;
49         isc_sockaddr_t address;
50         ns_lwresd_t *manager;
51         isc_socket_t *sock;
52         unsigned int refs;
53         ISC_LIST(ns_lwdclientmgr_t) cmgrs;
54         ISC_LINK(ns_lwreslistener_t) link;
55 };
56
57 /*%
58  * Configure lwresd.
59  */
60 isc_result_t
61 ns_lwresd_configure(isc_mem_t *mctx, const cfg_obj_t *config);
62
63 isc_result_t
64 ns_lwresd_parseeresolvconf(isc_mem_t *mctx, cfg_parser_t *pctx,
65                            cfg_obj_t **configp);
66
67 /*%
68  * Trigger shutdown.
69  */
70 void
71 ns_lwresd_shutdown(void);
72
73 /*
74  * Manager functions
75  */
76 /*% create manager */
77 isc_result_t
78 ns_lwdmanager_create(isc_mem_t *mctx, const cfg_obj_t *lwres,
79                       ns_lwresd_t **lwresdp);
80
81 /*% attach to manager */
82 void
83 ns_lwdmanager_attach(ns_lwresd_t *source, ns_lwresd_t **targetp);
84
85 /*% detach from manager */
86 void
87 ns_lwdmanager_detach(ns_lwresd_t **lwresdp);
88
89 /*
90  * Listener functions
91  */
92 /*% attach to listener */
93 void
94 ns_lwreslistener_attach(ns_lwreslistener_t *source,
95                         ns_lwreslistener_t **targetp);
96
97 /*% detach from lister */
98 void
99 ns_lwreslistener_detach(ns_lwreslistener_t **listenerp);
100
101 /*% link client manager */
102 void
103 ns_lwreslistener_unlinkcm(ns_lwreslistener_t *listener, ns_lwdclientmgr_t *cm);
104
105 /*% unlink client manager */
106 void
107 ns_lwreslistener_linkcm(ns_lwreslistener_t *listener, ns_lwdclientmgr_t *cm);
108
109
110
111
112 /*
113  * INTERNAL FUNCTIONS.
114  */
115 void *
116 ns__lwresd_memalloc(void *arg, size_t size);
117
118 void
119 ns__lwresd_memfree(void *arg, void *mem, size_t size);
120
121 #endif /* NAMED_LWRESD_H */