2 * Copyright (C) 2010 Andrew Tridgell
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
10 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
11 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
12 * THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
13 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
14 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
16 * USE OR PERFORMANCE OF THIS SOFTWARE.
19 /* This header is updated based on BIND 9.10.1 source.
20 * contrib/dlz/modules/include/dlz_minimal.h
24 #define DLZ_MINIMAL_H 1
26 #ifdef BIND_VERSION_9_8
27 #define DLZ_DLOPEN_VERSION 1
28 #elif BIND_VERSION_9_9
29 #define DLZ_DLOPEN_VERSION 2
30 #elif BIND_VERSION_9_10
31 #define DLZ_DLOPEN_VERSION 3
32 #define DLZ_DLOPEN_AGE 0
34 #error Unsupported BIND version
37 typedef unsigned int isc_result_t
;
38 #if DLZ_DLOPEN_VERSION == 1
39 typedef bool isc_boolean_t
;
41 typedef int isc_boolean_t
;
43 typedef uint32_t dns_ttl_t
;
45 /* return these in flags from dlz_version() */
46 #define DNS_SDLZFLAG_THREADSAFE 0x00000001U
47 #define DNS_SDLZFLAG_RELATIVEOWNER 0x00000002U
48 #define DNS_SDLZFLAG_RELATIVERDATA 0x00000004U
51 #define ISC_R_SUCCESS 0
52 #define ISC_R_NOMEMORY 1
53 #define ISC_R_NOPERM 6
54 #define ISC_R_NOSPACE 19
55 #define ISC_R_NOTFOUND 23
56 #define ISC_R_FAILURE 25
57 #define ISC_R_NOTIMPLEMENTED 27
58 #define ISC_R_NOMORE 29
59 #define ISC_R_INVALIDFILE 30
60 #define ISC_R_UNEXPECTED 34
61 #define ISC_R_FILENOTFOUND 38
68 #define ISC_LOG_INFO (-1)
69 #define ISC_LOG_NOTICE (-2)
70 #define ISC_LOG_WARNING (-3)
71 #define ISC_LOG_ERROR (-4)
72 #define ISC_LOG_CRITICAL (-5)
73 #define ISC_LOG_DEBUG(level) (level)
75 /* opaque structures */
76 typedef void *dns_sdlzlookup_t
;
77 typedef void *dns_sdlzallnodes_t
;
78 typedef void *dns_view_t
;
79 typedef void *dns_dlzdb_t
;
81 #if DLZ_DLOPEN_VERSION > 1
83 * Method and type definitions needed for retrieval of client info
86 typedef struct isc_sockaddr
{
89 struct sockaddr_in sin
;
90 struct sockaddr_in6 sin6
;
91 struct sockaddr_un sunix
;
97 #define DNS_CLIENTINFO_VERSION 1
98 typedef struct dns_clientinfo
{
103 typedef isc_result_t (*dns_clientinfo_sourceip_t
)(dns_clientinfo_t
*client
,
104 isc_sockaddr_t
**addrp
);
106 #define DNS_CLIENTINFOMETHODS_VERSION 1
107 #define DNS_CLIENTINFOMETHODS_AGE 0
109 typedef struct dns_clientinfomethods
{
112 dns_clientinfo_sourceip_t sourceip
;
113 } dns_clientinfomethods_t
;
114 #endif /* DLZ_DLOPEN_VERSION > 1 */
117 * Method definitions for callbacks provided by the dlopen driver
120 typedef void log_t(int level
, const char *fmt
, ...);
122 typedef isc_result_t
dns_sdlz_putrr_t(dns_sdlzlookup_t
*lookup
,
127 typedef isc_result_t
dns_sdlz_putnamedrr_t(dns_sdlzallnodes_t
*allnodes
,
133 #if DLZ_DLOPEN_VERSION < 3
134 typedef isc_result_t
dns_dlz_writeablezone_t(dns_view_t
*view
,
135 const char *zone_name
);
136 #else /* DLZ_DLOPEN_VERSION >= 3 */
137 typedef isc_result_t
dns_dlz_writeablezone_t(dns_view_t
*view
,
139 const char *zone_name
);
140 #endif /* DLZ_DLOPEN_VERSION */
143 * prototypes for the functions you can include in your module
147 * dlz_version() is required for all DLZ external drivers. It should
148 * return DLZ_DLOPEN_VERSION. 'flags' is updated to indicate capabilities
149 * of the module. In particular, if the module is thread-safe then it
150 * sets 'flags' to include DNS_SDLZFLAG_THREADSAFE. Other capability
151 * flags may be added in the future.
154 dlz_version(unsigned int *flags
);
157 * dlz_create() is required for all DLZ external drivers.
160 dlz_create(const char *dlzname
, unsigned int argc
, const char *argv
[],
164 * dlz_destroy() is optional, and will be called when the driver is
165 * unloaded if supplied
168 dlz_destroy(void *dbdata
);
171 * dlz_findzonedb is required for all DLZ external drivers
173 #if DLZ_DLOPEN_VERSION < 3
175 dlz_findzonedb(void *dbdata
, const char *name
);
176 #else /* DLZ_DLOPEN_VERSION >= 3 */
178 dlz_findzonedb(void *dbdata
, const char *name
,
179 dns_clientinfomethods_t
*methods
,
180 dns_clientinfo_t
*clientinfo
);
181 #endif /* DLZ_DLOPEN_VERSION */
184 * dlz_lookup is required for all DLZ external drivers
186 #if DLZ_DLOPEN_VERSION == 1
188 dlz_lookup(const char *zone
, const char *name
, void *dbdata
,
189 dns_sdlzlookup_t
*lookup
);
190 #else /* DLZ_DLOPEN_VERSION > 1 */
192 dlz_lookup(const char *zone
, const char *name
, void *dbdata
,
193 dns_sdlzlookup_t
*lookup
,
194 dns_clientinfomethods_t
*methods
,
195 dns_clientinfo_t
*clientinfo
);
196 #endif /* DLZ_DLOPEN_VERSION */
199 * dlz_authority() is optional if dlz_lookup() supplies
200 * authority information (i.e., SOA, NS) for the dns record
203 dlz_authority(const char *zone
, void *dbdata
, dns_sdlzlookup_t
*lookup
);
206 * dlz_allowzonexfr() is optional, and should be supplied if you want to
207 * support zone transfers
210 dlz_allowzonexfr(void *dbdata
, const char *name
, const char *client
);
213 * dlz_allnodes() is optional, but must be supplied if supply a
214 * dlz_allowzonexfr() function
217 dlz_allnodes(const char *zone
, void *dbdata
, dns_sdlzallnodes_t
*allnodes
);
220 * dlz_newversion() is optional. It should be supplied if you want to
221 * support dynamic updates.
224 dlz_newversion(const char *zone
, void *dbdata
, void **versionp
);
227 * dlz_closeversion() is optional, but must be supplied if you supply a
228 * dlz_newversion() function
231 dlz_closeversion(const char *zone
, isc_boolean_t commit
, void *dbdata
,
235 * dlz_configure() is optional, but must be supplied if you want to support
238 #if DLZ_DLOPEN_VERSION < 3
240 dlz_configure(dns_view_t
*view
, void *dbdata
);
241 #else /* DLZ_DLOPEN_VERSION >= 3 */
243 dlz_configure(dns_view_t
*view
, dns_dlzdb_t
*dlzdb
, void *dbdata
);
244 #endif /* DLZ_DLOPEN_VERSION */
247 * dlz_ssumatch() is optional, but must be supplied if you want to support
251 dlz_ssumatch(const char *signer
, const char *name
, const char *tcpaddr
,
252 const char *type
, const char *key
, uint32_t keydatalen
,
253 uint8_t *keydata
, void *dbdata
);
256 * dlz_addrdataset() is optional, but must be supplied if you want to
257 * support dynamic updates
260 dlz_addrdataset(const char *name
, const char *rdatastr
, void *dbdata
,
264 * dlz_subrdataset() is optional, but must be supplied if you want to
265 * support dynamic updates
268 dlz_subrdataset(const char *name
, const char *rdatastr
, void *dbdata
,
272 * dlz_delrdataset() is optional, but must be supplied if you want to
273 * support dynamic updates
276 dlz_delrdataset(const char *name
, const char *type
, void *dbdata
,
279 #endif /* DLZ_MINIMAL_H */