1 /*
2  * Copyright (C) 2011, 2012  Internet Systems Consortium, Inc. ("ISC")
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14  * PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /* $Id$ */
18 
19 /*! \file dns/dlz_open.h */
20 
21 #ifndef DLZ_DLOPEN_H
22 #define DLZ_DLOPEN_H
23 
24 #include <dns/sdlz.h>
25 
26 ISC_LANG_BEGINDECLS
27 
28 /*
29  * This header provides a minimal set of defines and typedefs needed
30  * for the entry points of an external DLZ module for bind9.
31  */
32 
33 #define DLZ_DLOPEN_VERSION 2
34 
35 /*
36  * dlz_dlopen_version() is required for all DLZ external drivers. It
37  * should return DLZ_DLOPEN_VERSION
38  */
39 typedef int dlz_dlopen_version_t (unsigned int *flags);
40 
41 /*
42  * dlz_dlopen_create() is required for all DLZ external drivers.
43  */
44 typedef isc_result_t dlz_dlopen_create_t (const char *dlzname,
45 					  unsigned int argc,
46 					  char *argv[],
47 					  void **dbdata,
48 					  ...);
49 
50 /*
51  * dlz_dlopen_destroy() is optional, and will be called when the
52  * driver is unloaded if supplied
53  */
54 typedef void dlz_dlopen_destroy_t (void *dbdata);
55 
56 /*
57  * dlz_dlopen_findzonedb() is required for all DLZ external drivers
58  */
59 typedef isc_result_t dlz_dlopen_findzonedb_t (void *dbdata,
60 					      const char *name);
61 
62 /*
63  * dlz_dlopen_lookup() is required for all DLZ external drivers
64  */
65 typedef isc_result_t dlz_dlopen_lookup_t (const char *zone,
66 					  const char *name,
67 					  void *dbdata,
68 					  dns_sdlzlookup_t *lookup,
69 					  dns_clientinfomethods_t *methods,
70 					  dns_clientinfo_t *clientinfo);
71 
72 /*
73  * dlz_dlopen_authority is optional() if dlz_dlopen_lookup()
74  * supplies authority information for the dns record
75  */
76 typedef isc_result_t dlz_dlopen_authority_t (const char *zone,
77 					     void *dbdata,
78 					     dns_sdlzlookup_t *lookup);
79 
80 /*
81  * dlz_dlopen_allowzonexfr() is optional, and should be supplied if
82  * you want to support zone transfers
83  */
84 typedef isc_result_t dlz_dlopen_allowzonexfr_t (void *dbdata,
85 						const char *name,
86 						const char *client);
87 
88 /*
89  * dlz_dlopen_allnodes() is optional, but must be supplied if supply a
90  * dlz_dlopen_allowzonexfr() function
91  */
92 typedef isc_result_t dlz_dlopen_allnodes_t (const char *zone,
93 					    void *dbdata,
94 					    dns_sdlzallnodes_t *allnodes);
95 
96 /*
97  * dlz_dlopen_newversion() is optional. It should be supplied if you
98  * want to support dynamic updates.
99  */
100 typedef isc_result_t dlz_dlopen_newversion_t (const char *zone,
101 					      void *dbdata,
102 					      void **versionp);
103 
104 /*
105  * dlz_closeversion() is optional, but must be supplied if you supply
106  * a dlz_newversion() function
107  */
108 typedef void dlz_dlopen_closeversion_t (const char *zone,
109 					isc_boolean_t commit,
110 					void *dbdata,
111 					void **versionp);
112 
113 /*
114  * dlz_dlopen_configure() is optional, but must be supplied if you
115  * want to support dynamic updates
116  */
117 typedef isc_result_t dlz_dlopen_configure_t (dns_view_t *view,
118 					     void *dbdata);
119 
120 /*
121  * dlz_dlopen_setclientcallback() is optional, but must be supplied if you
122  * want to retrieve information about the client (e.g., source address)
123  * before sending a replay.
124  */
125 typedef isc_result_t dlz_dlopen_setclientcallback_t (dns_view_t *view,
126 						     void *dbdata);
127 
128 
129 /*
130  * dlz_dlopen_ssumatch() is optional, but must be supplied if you want
131  * to support dynamic updates
132  */
133 typedef isc_boolean_t dlz_dlopen_ssumatch_t (const char *signer,
134 					     const char *name,
135 					     const char *tcpaddr,
136 					     const char *type,
137 					     const char *key,
138 					     isc_uint32_t keydatalen,
139 					     unsigned char *keydata,
140 					     void *dbdata);
141 
142 /*
143  * dlz_dlopen_addrdataset() is optional, but must be supplied if you
144  * want to support dynamic updates
145  */
146 typedef isc_result_t dlz_dlopen_addrdataset_t (const char *name,
147 					       const char *rdatastr,
148 					       void *dbdata,
149 					       void *version);
150 
151 /*
152  * dlz_dlopen_subrdataset() is optional, but must be supplied if you
153  * want to support dynamic updates
154  */
155 typedef isc_result_t dlz_dlopen_subrdataset_t (const char *name,
156 					       const char *rdatastr,
157 					       void *dbdata,
158 					       void *version);
159 
160 /*
161  * dlz_dlopen_delrdataset() is optional, but must be supplied if you
162  * want to support dynamic updates
163  */
164 typedef isc_result_t dlz_dlopen_delrdataset_t (const char *name,
165 					       const char *type,
166 					       void *dbdata,
167 					       void *version);
168 
169 ISC_LANG_ENDDECLS
170 
171 #endif
172