lwresd.h revision 135446
1/*
2 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001  Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and 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.12.208.1 2004/03/06 10:21:25 marka Exp $ */
19
20#ifndef NAMED_LWRESD_H
21#define NAMED_LWRESD_H 1
22
23#include <isc/types.h>
24#include <isc/sockaddr.h>
25
26#include <isccfg/cfg.h>
27
28#include <dns/types.h>
29
30struct ns_lwresd {
31	unsigned int magic;
32
33	isc_mutex_t lock;
34	dns_view_t *view;
35	ns_lwsearchlist_t *search;
36	unsigned int ndots;
37	isc_mem_t *mctx;
38	isc_boolean_t shutting_down;
39	unsigned int refs;
40};
41
42struct ns_lwreslistener {
43	unsigned int magic;
44
45	isc_mutex_t lock;
46	isc_mem_t *mctx;
47	isc_sockaddr_t address;
48	ns_lwresd_t *manager;
49	isc_socket_t *sock;
50	unsigned int refs;
51	ISC_LIST(ns_lwdclientmgr_t) cmgrs;
52	ISC_LINK(ns_lwreslistener_t) link;
53};
54
55/*
56 * Configure lwresd.
57 */
58isc_result_t
59ns_lwresd_configure(isc_mem_t *mctx, cfg_obj_t *config);
60
61isc_result_t
62ns_lwresd_parseeresolvconf(isc_mem_t *mctx, cfg_parser_t *pctx,
63			   cfg_obj_t **configp);
64
65/*
66 * Trigger shutdown.
67 */
68void
69ns_lwresd_shutdown(void);
70
71/*
72 * Manager functions
73 */
74isc_result_t
75ns_lwdmanager_create(isc_mem_t *mctx, cfg_obj_t *lwres, ns_lwresd_t **lwresdp);
76
77void
78ns_lwdmanager_attach(ns_lwresd_t *source, ns_lwresd_t **targetp);
79
80void
81ns_lwdmanager_detach(ns_lwresd_t **lwresdp);
82
83/*
84 * Listener functions
85 */
86void
87ns_lwreslistener_attach(ns_lwreslistener_t *source,
88			ns_lwreslistener_t **targetp);
89
90void
91ns_lwreslistener_detach(ns_lwreslistener_t **listenerp);
92
93void
94ns_lwreslistener_unlinkcm(ns_lwreslistener_t *listener, ns_lwdclientmgr_t *cm);
95
96void
97ns_lwreslistener_linkcm(ns_lwreslistener_t *listener, ns_lwdclientmgr_t *cm);
98
99
100
101
102/*
103 * INTERNAL FUNCTIONS.
104 */
105void *
106ns__lwresd_memalloc(void *arg, size_t size);
107
108void
109ns__lwresd_memfree(void *arg, void *mem, size_t size);
110
111#endif /* NAMED_LWRESD_H */
112