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 #if defined (BIND_VERSION_9_8)
27 # define DLZ_DLOPEN_VERSION 1
28 #elif defined (BIND_VERSION_9_9)
29 # define DLZ_DLOPEN_VERSION 2
30 # define DNS_CLIENTINFO_VERSION 1
31 #elif defined (BIND_VERSION_9_10)
32 # define DLZ_DLOPEN_VERSION 3
33 # define DNS_CLIENTINFO_VERSION 1
34 #elif defined (BIND_VERSION_9_11)
35 # define DLZ_DLOPEN_VERSION 3
36 # define DNS_CLIENTINFO_VERSION 2
38 # error Unsupported BIND version
41 #if DLZ_DLOPEN_VERSION > 1
42 # define DLZ_DLOPEN_AGE 0
45 typedef unsigned int isc_result_t
;
46 #if DLZ_DLOPEN_VERSION == 1
47 typedef bool isc_boolean_t
;
49 typedef int isc_boolean_t
;
51 typedef uint32_t dns_ttl_t
;
53 /* return these in flags from dlz_version() */
54 #define DNS_SDLZFLAG_THREADSAFE 0x00000001U
55 #define DNS_SDLZFLAG_RELATIVEOWNER 0x00000002U
56 #define DNS_SDLZFLAG_RELATIVERDATA 0x00000004U
59 #define ISC_R_SUCCESS 0
60 #define ISC_R_NOMEMORY 1
61 #define ISC_R_NOPERM 6
62 #define ISC_R_NOSPACE 19
63 #define ISC_R_NOTFOUND 23
64 #define ISC_R_FAILURE 25
65 #define ISC_R_NOTIMPLEMENTED 27
66 #define ISC_R_NOMORE 29
67 #define ISC_R_INVALIDFILE 30
68 #define ISC_R_UNEXPECTED 34
69 #define ISC_R_FILENOTFOUND 38
76 #define ISC_LOG_INFO (-1)
77 #define ISC_LOG_NOTICE (-2)
78 #define ISC_LOG_WARNING (-3)
79 #define ISC_LOG_ERROR (-4)
80 #define ISC_LOG_CRITICAL (-5)
81 #define ISC_LOG_DEBUG(level) (level)
83 /* opaque structures */
84 typedef void *dns_sdlzlookup_t
;
85 typedef void *dns_sdlzallnodes_t
;
86 typedef void *dns_view_t
;
87 typedef void *dns_dlzdb_t
;
89 #if DLZ_DLOPEN_VERSION > 1
91 * Method and type definitions needed for retrieval of client info
94 typedef struct isc_sockaddr
{
97 struct sockaddr_in sin
;
98 struct sockaddr_in6 sin6
;
99 struct sockaddr_un sunix
;
105 #if DNS_CLIENTINFO_VERSION == 1
107 typedef struct dns_clientinfo
{
112 typedef isc_result_t (*dns_clientinfo_sourceip_t
)(dns_clientinfo_t
*client
,
113 isc_sockaddr_t
**addrp
);
115 #define DNS_CLIENTINFOMETHODS_VERSION 1
116 #define DNS_CLIENTINFOMETHODS_AGE 0
118 typedef struct dns_clientinfomethods
{
121 dns_clientinfo_sourceip_t sourceip
;
122 } dns_clientinfomethods_t
;
124 #elif DNS_CLIENTINFO_VERSION == 2
126 typedef struct dns_clientinfo
{
132 typedef isc_result_t (*dns_clientinfo_sourceip_t
)(dns_clientinfo_t
*client
,
133 isc_sockaddr_t
**addrp
);
135 typedef isc_result_t (*dns_clientinfo_version_t
)(dns_clientinfo_t
*client
,
138 #define DNS_CLIENTINFOMETHODS_VERSION 2
139 #define DNS_CLIENTINFOMETHODS_AGE 1
141 typedef struct dns_clientinfomethods
{
144 dns_clientinfo_sourceip_t sourceip
;
145 dns_clientinfo_version_t dbversion
;
146 } dns_clientinfomethods_t
;
148 #endif /* DNS_CLIENTINFO_VERSION */
150 #endif /* DLZ_DLOPEN_VERSION > 1 */
153 * Method definitions for callbacks provided by the dlopen driver
156 typedef void log_t(int level
, const char *fmt
, ...);
158 typedef isc_result_t
dns_sdlz_putrr_t(dns_sdlzlookup_t
*lookup
,
163 typedef isc_result_t
dns_sdlz_putnamedrr_t(dns_sdlzallnodes_t
*allnodes
,
169 #if DLZ_DLOPEN_VERSION < 3
170 typedef isc_result_t
dns_dlz_writeablezone_t(dns_view_t
*view
,
171 const char *zone_name
);
172 #else /* DLZ_DLOPEN_VERSION >= 3 */
173 typedef isc_result_t
dns_dlz_writeablezone_t(dns_view_t
*view
,
175 const char *zone_name
);
176 #endif /* DLZ_DLOPEN_VERSION */
179 * prototypes for the functions you can include in your module
183 * dlz_version() is required for all DLZ external drivers. It should
184 * return DLZ_DLOPEN_VERSION. 'flags' is updated to indicate capabilities
185 * of the module. In particular, if the module is thread-safe then it
186 * sets 'flags' to include DNS_SDLZFLAG_THREADSAFE. Other capability
187 * flags may be added in the future.
190 dlz_version(unsigned int *flags
);
193 * dlz_create() is required for all DLZ external drivers.
196 dlz_create(const char *dlzname
, unsigned int argc
, const char *argv
[],
200 * dlz_destroy() is optional, and will be called when the driver is
201 * unloaded if supplied
204 dlz_destroy(void *dbdata
);
207 * dlz_findzonedb is required for all DLZ external drivers
209 #if DLZ_DLOPEN_VERSION < 3
211 dlz_findzonedb(void *dbdata
, const char *name
);
212 #else /* DLZ_DLOPEN_VERSION >= 3 */
214 dlz_findzonedb(void *dbdata
, const char *name
,
215 dns_clientinfomethods_t
*methods
,
216 dns_clientinfo_t
*clientinfo
);
217 #endif /* DLZ_DLOPEN_VERSION */
220 * dlz_lookup is required for all DLZ external drivers
222 #if DLZ_DLOPEN_VERSION == 1
224 dlz_lookup(const char *zone
, const char *name
, void *dbdata
,
225 dns_sdlzlookup_t
*lookup
);
226 #else /* DLZ_DLOPEN_VERSION > 1 */
228 dlz_lookup(const char *zone
, const char *name
, void *dbdata
,
229 dns_sdlzlookup_t
*lookup
,
230 dns_clientinfomethods_t
*methods
,
231 dns_clientinfo_t
*clientinfo
);
232 #endif /* DLZ_DLOPEN_VERSION */
235 * dlz_authority() is optional if dlz_lookup() supplies
236 * authority information (i.e., SOA, NS) for the dns record
239 dlz_authority(const char *zone
, void *dbdata
, dns_sdlzlookup_t
*lookup
);
242 * dlz_allowzonexfr() is optional, and should be supplied if you want to
243 * support zone transfers
246 dlz_allowzonexfr(void *dbdata
, const char *name
, const char *client
);
249 * dlz_allnodes() is optional, but must be supplied if supply a
250 * dlz_allowzonexfr() function
253 dlz_allnodes(const char *zone
, void *dbdata
, dns_sdlzallnodes_t
*allnodes
);
256 * dlz_newversion() is optional. It should be supplied if you want to
257 * support dynamic updates.
260 dlz_newversion(const char *zone
, void *dbdata
, void **versionp
);
263 * dlz_closeversion() is optional, but must be supplied if you supply a
264 * dlz_newversion() function
267 dlz_closeversion(const char *zone
, isc_boolean_t commit
, void *dbdata
,
271 * dlz_configure() is optional, but must be supplied if you want to support
274 #if DLZ_DLOPEN_VERSION < 3
276 dlz_configure(dns_view_t
*view
, void *dbdata
);
277 #else /* DLZ_DLOPEN_VERSION >= 3 */
279 dlz_configure(dns_view_t
*view
, dns_dlzdb_t
*dlzdb
, void *dbdata
);
280 #endif /* DLZ_DLOPEN_VERSION */
283 * dlz_ssumatch() is optional, but must be supplied if you want to support
287 dlz_ssumatch(const char *signer
, const char *name
, const char *tcpaddr
,
288 const char *type
, const char *key
, uint32_t keydatalen
,
289 uint8_t *keydata
, void *dbdata
);
292 * dlz_addrdataset() is optional, but must be supplied if you want to
293 * support dynamic updates
296 dlz_addrdataset(const char *name
, const char *rdatastr
, void *dbdata
,
300 * dlz_subrdataset() is optional, but must be supplied if you want to
301 * support dynamic updates
304 dlz_subrdataset(const char *name
, const char *rdatastr
, void *dbdata
,
308 * dlz_delrdataset() is optional, but must be supplied if you want to
309 * support dynamic updates
312 dlz_delrdataset(const char *name
, const char *type
, void *dbdata
,
315 #endif /* DLZ_MINIMAL_H */