s3: VFS: vfs_syncops. Implement renameat().
[Samba.git] / source4 / dns_server / dlz_minimal.h
blob193904f4b2c6997a5182e9d699e9cb73cbfe2066
1 /*
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
7 * copies.
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
23 #ifndef 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
37 #elif defined (BIND_VERSION_9_12)
38 # define DLZ_DLOPEN_VERSION 3
39 # define DNS_CLIENTINFO_VERSION 2
40 #else
41 # error Unsupported BIND version
42 #endif
44 #if DLZ_DLOPEN_VERSION > 1
45 # define DLZ_DLOPEN_AGE 0
46 #endif
48 typedef unsigned int isc_result_t;
49 #if DLZ_DLOPEN_VERSION == 1
50 typedef bool isc_boolean_t;
51 #else
52 typedef int isc_boolean_t;
53 #endif
54 typedef uint32_t dns_ttl_t;
56 /* return these in flags from dlz_version() */
57 #define DNS_SDLZFLAG_THREADSAFE 0x00000001U
58 #define DNS_SDLZFLAG_RELATIVEOWNER 0x00000002U
59 #define DNS_SDLZFLAG_RELATIVERDATA 0x00000004U
61 /* result codes */
62 #define ISC_R_SUCCESS 0
63 #define ISC_R_NOMEMORY 1
64 #define ISC_R_NOPERM 6
65 #define ISC_R_NOSPACE 19
66 #define ISC_R_NOTFOUND 23
67 #define ISC_R_FAILURE 25
68 #define ISC_R_NOTIMPLEMENTED 27
69 #define ISC_R_NOMORE 29
70 #define ISC_R_INVALIDFILE 30
71 #define ISC_R_UNEXPECTED 34
72 #define ISC_R_FILENOTFOUND 38
74 /* boolean values */
75 #define ISC_TRUE 1
76 #define ISC_FALSE 0
78 /* log levels */
79 #define ISC_LOG_INFO (-1)
80 #define ISC_LOG_NOTICE (-2)
81 #define ISC_LOG_WARNING (-3)
82 #define ISC_LOG_ERROR (-4)
83 #define ISC_LOG_CRITICAL (-5)
84 #define ISC_LOG_DEBUG(level) (level)
86 /* opaque structures */
87 typedef void *dns_sdlzlookup_t;
88 typedef void *dns_sdlzallnodes_t;
89 typedef void *dns_view_t;
90 typedef void *dns_dlzdb_t;
92 #if DLZ_DLOPEN_VERSION > 1
94 * Method and type definitions needed for retrieval of client info
95 * from the caller.
97 typedef struct isc_sockaddr {
98 union {
99 struct sockaddr sa;
100 struct sockaddr_in sin;
101 struct sockaddr_in6 sin6;
102 struct sockaddr_un sunix;
103 } type;
104 unsigned int length;
105 void * link;
106 } isc_sockaddr_t;
108 #if DNS_CLIENTINFO_VERSION == 1
110 typedef struct dns_clientinfo {
111 uint16_t version;
112 void *data;
113 } dns_clientinfo_t;
115 typedef isc_result_t (*dns_clientinfo_sourceip_t)(dns_clientinfo_t *client,
116 isc_sockaddr_t **addrp);
118 #define DNS_CLIENTINFOMETHODS_VERSION 1
119 #define DNS_CLIENTINFOMETHODS_AGE 0
121 typedef struct dns_clientinfomethods {
122 uint16_t version;
123 uint16_t age;
124 dns_clientinfo_sourceip_t sourceip;
125 } dns_clientinfomethods_t;
127 #elif DNS_CLIENTINFO_VERSION == 2
129 typedef struct dns_clientinfo {
130 uint16_t version;
131 void *data;
132 void *dbversion;
133 } dns_clientinfo_t;
135 typedef isc_result_t (*dns_clientinfo_sourceip_t)(dns_clientinfo_t *client,
136 isc_sockaddr_t **addrp);
138 typedef isc_result_t (*dns_clientinfo_version_t)(dns_clientinfo_t *client,
139 void **addrp);
141 #define DNS_CLIENTINFOMETHODS_VERSION 2
142 #define DNS_CLIENTINFOMETHODS_AGE 1
144 typedef struct dns_clientinfomethods {
145 uint16_t version;
146 uint16_t age;
147 dns_clientinfo_sourceip_t sourceip;
148 dns_clientinfo_version_t dbversion;
149 } dns_clientinfomethods_t;
151 #endif /* DNS_CLIENTINFO_VERSION */
153 #endif /* DLZ_DLOPEN_VERSION > 1 */
156 * Method definitions for callbacks provided by the dlopen driver
159 typedef void log_t(int level, const char *fmt, ...);
161 typedef isc_result_t dns_sdlz_putrr_t(dns_sdlzlookup_t *lookup,
162 const char *type,
163 dns_ttl_t ttl,
164 const char *data);
166 typedef isc_result_t dns_sdlz_putnamedrr_t(dns_sdlzallnodes_t *allnodes,
167 const char *name,
168 const char *type,
169 dns_ttl_t ttl,
170 const char *data);
172 #if DLZ_DLOPEN_VERSION < 3
173 typedef isc_result_t dns_dlz_writeablezone_t(dns_view_t *view,
174 const char *zone_name);
175 #else /* DLZ_DLOPEN_VERSION >= 3 */
176 typedef isc_result_t dns_dlz_writeablezone_t(dns_view_t *view,
177 dns_dlzdb_t *dlzdb,
178 const char *zone_name);
179 #endif /* DLZ_DLOPEN_VERSION */
182 * prototypes for the functions you can include in your module
186 * dlz_version() is required for all DLZ external drivers. It should
187 * return DLZ_DLOPEN_VERSION. 'flags' is updated to indicate capabilities
188 * of the module. In particular, if the module is thread-safe then it
189 * sets 'flags' to include DNS_SDLZFLAG_THREADSAFE. Other capability
190 * flags may be added in the future.
193 dlz_version(unsigned int *flags);
196 * dlz_create() is required for all DLZ external drivers.
198 isc_result_t
199 dlz_create(const char *dlzname, unsigned int argc, const char *argv[],
200 void **dbdata, ...);
203 * dlz_destroy() is optional, and will be called when the driver is
204 * unloaded if supplied
206 void
207 dlz_destroy(void *dbdata);
210 * dlz_findzonedb is required for all DLZ external drivers
212 #if DLZ_DLOPEN_VERSION < 3
213 isc_result_t
214 dlz_findzonedb(void *dbdata, const char *name);
215 #else /* DLZ_DLOPEN_VERSION >= 3 */
216 isc_result_t
217 dlz_findzonedb(void *dbdata, const char *name,
218 dns_clientinfomethods_t *methods,
219 dns_clientinfo_t *clientinfo);
220 #endif /* DLZ_DLOPEN_VERSION */
223 * dlz_lookup is required for all DLZ external drivers
225 #if DLZ_DLOPEN_VERSION == 1
226 isc_result_t
227 dlz_lookup(const char *zone, const char *name, void *dbdata,
228 dns_sdlzlookup_t *lookup);
229 #else /* DLZ_DLOPEN_VERSION > 1 */
230 isc_result_t
231 dlz_lookup(const char *zone, const char *name, void *dbdata,
232 dns_sdlzlookup_t *lookup,
233 dns_clientinfomethods_t *methods,
234 dns_clientinfo_t *clientinfo);
235 #endif /* DLZ_DLOPEN_VERSION */
238 * dlz_authority() is optional if dlz_lookup() supplies
239 * authority information (i.e., SOA, NS) for the dns record
241 isc_result_t
242 dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup);
245 * dlz_allowzonexfr() is optional, and should be supplied if you want to
246 * support zone transfers
248 isc_result_t
249 dlz_allowzonexfr(void *dbdata, const char *name, const char *client);
252 * dlz_allnodes() is optional, but must be supplied if supply a
253 * dlz_allowzonexfr() function
255 isc_result_t
256 dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes);
259 * dlz_newversion() is optional. It should be supplied if you want to
260 * support dynamic updates.
262 isc_result_t
263 dlz_newversion(const char *zone, void *dbdata, void **versionp);
266 * dlz_closeversion() is optional, but must be supplied if you supply a
267 * dlz_newversion() function
269 void
270 dlz_closeversion(const char *zone, isc_boolean_t commit, void *dbdata,
271 void **versionp);
274 * dlz_configure() is optional, but must be supplied if you want to support
275 * dynamic updates
277 #if DLZ_DLOPEN_VERSION < 3
278 isc_result_t
279 dlz_configure(dns_view_t *view, void *dbdata);
280 #else /* DLZ_DLOPEN_VERSION >= 3 */
281 isc_result_t
282 dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata);
283 #endif /* DLZ_DLOPEN_VERSION */
286 * dlz_ssumatch() is optional, but must be supplied if you want to support
287 * dynamic updates
289 isc_boolean_t
290 dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
291 const char *type, const char *key, uint32_t keydatalen,
292 uint8_t *keydata, void *dbdata);
295 * dlz_addrdataset() is optional, but must be supplied if you want to
296 * support dynamic updates
298 isc_result_t
299 dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata,
300 void *version);
303 * dlz_subrdataset() is optional, but must be supplied if you want to
304 * support dynamic updates
306 isc_result_t
307 dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata,
308 void *version);
311 * dlz_delrdataset() is optional, but must be supplied if you want to
312 * support dynamic updates
314 isc_result_t
315 dlz_delrdataset(const char *name, const char *type, void *dbdata,
316 void *version);
318 #endif /* DLZ_MINIMAL_H */