wscript: drop checks for setnetgrent/endnetgrent/getnetgrent
[Samba.git] / source4 / dns_server / dlz_minimal.h
blob89ada7a6fdb03a64bdb36720252b58a028e5b047
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 #else
38 # error Unsupported BIND version
39 #endif
41 #if DLZ_DLOPEN_VERSION > 1
42 # define DLZ_DLOPEN_AGE 0
43 #endif
45 typedef unsigned int isc_result_t;
46 #if DLZ_DLOPEN_VERSION == 1
47 typedef bool isc_boolean_t;
48 #else
49 typedef int isc_boolean_t;
50 #endif
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
58 /* result codes */
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
71 /* boolean values */
72 #define ISC_TRUE 1
73 #define ISC_FALSE 0
75 /* log levels */
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
92 * from the caller.
94 typedef struct isc_sockaddr {
95 union {
96 struct sockaddr sa;
97 struct sockaddr_in sin;
98 struct sockaddr_in6 sin6;
99 struct sockaddr_un sunix;
100 } type;
101 unsigned int length;
102 void * link;
103 } isc_sockaddr_t;
105 #if DNS_CLIENTINFO_VERSION == 1
107 typedef struct dns_clientinfo {
108 uint16_t version;
109 void *data;
110 } dns_clientinfo_t;
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 {
119 uint16_t version;
120 uint16_t age;
121 dns_clientinfo_sourceip_t sourceip;
122 } dns_clientinfomethods_t;
124 #elif DNS_CLIENTINFO_VERSION == 2
126 typedef struct dns_clientinfo {
127 uint16_t version;
128 void *data;
129 void *dbversion;
130 } dns_clientinfo_t;
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,
136 void **addrp);
138 #define DNS_CLIENTINFOMETHODS_VERSION 2
139 #define DNS_CLIENTINFOMETHODS_AGE 1
141 typedef struct dns_clientinfomethods {
142 uint16_t version;
143 uint16_t age;
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,
159 const char *type,
160 dns_ttl_t ttl,
161 const char *data);
163 typedef isc_result_t dns_sdlz_putnamedrr_t(dns_sdlzallnodes_t *allnodes,
164 const char *name,
165 const char *type,
166 dns_ttl_t ttl,
167 const char *data);
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,
174 dns_dlzdb_t *dlzdb,
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.
195 isc_result_t
196 dlz_create(const char *dlzname, unsigned int argc, const char *argv[],
197 void **dbdata, ...);
200 * dlz_destroy() is optional, and will be called when the driver is
201 * unloaded if supplied
203 void
204 dlz_destroy(void *dbdata);
207 * dlz_findzonedb is required for all DLZ external drivers
209 #if DLZ_DLOPEN_VERSION < 3
210 isc_result_t
211 dlz_findzonedb(void *dbdata, const char *name);
212 #else /* DLZ_DLOPEN_VERSION >= 3 */
213 isc_result_t
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
223 isc_result_t
224 dlz_lookup(const char *zone, const char *name, void *dbdata,
225 dns_sdlzlookup_t *lookup);
226 #else /* DLZ_DLOPEN_VERSION > 1 */
227 isc_result_t
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
238 isc_result_t
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
245 isc_result_t
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
252 isc_result_t
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.
259 isc_result_t
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
266 void
267 dlz_closeversion(const char *zone, isc_boolean_t commit, void *dbdata,
268 void **versionp);
271 * dlz_configure() is optional, but must be supplied if you want to support
272 * dynamic updates
274 #if DLZ_DLOPEN_VERSION < 3
275 isc_result_t
276 dlz_configure(dns_view_t *view, void *dbdata);
277 #else /* DLZ_DLOPEN_VERSION >= 3 */
278 isc_result_t
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
284 * dynamic updates
286 isc_boolean_t
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
295 isc_result_t
296 dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata,
297 void *version);
300 * dlz_subrdataset() is optional, but must be supplied if you want to
301 * support dynamic updates
303 isc_result_t
304 dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata,
305 void *version);
308 * dlz_delrdataset() is optional, but must be supplied if you want to
309 * support dynamic updates
311 isc_result_t
312 dlz_delrdataset(const char *name, const char *type, void *dbdata,
313 void *version);
315 #endif /* DLZ_MINIMAL_H */