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.
20 This header provides a minimal set of defines and typedefs needed
21 for building an external DLZ module for bind9. When creating a new
22 external DLZ driver, please copy this header into your own source
25 typedef unsigned int isc_result_t
;
26 typedef bool isc_boolean_t
;
27 typedef uint32_t dns_ttl_t
;
29 #define DLZ_DLOPEN_VERSION 1
31 /* return this in flags to dlz_version() if thread safe */
32 #define DNS_SDLZFLAG_THREADSAFE 0x00000001U
35 #define ISC_R_SUCCESS 0
36 #define ISC_R_NOMEMORY 1
37 #define ISC_R_NOTFOUND 23
38 #define ISC_R_FAILURE 25
41 #define ISC_LOG_INFO (-1)
42 #define ISC_LOG_NOTICE (-2)
43 #define ISC_LOG_WARNING (-3)
44 #define ISC_LOG_ERROR (-4)
45 #define ISC_LOG_CRITICAL (-5)
47 /* some opaque structures */
48 typedef void *dns_sdlzlookup_t
;
49 typedef void *dns_sdlzallnodes_t
;
50 typedef void *dns_view_t
;
53 * prototypes for the functions you can include in your driver
58 * dlz_version() is required for all DLZ external drivers. It should
59 * return DLZ_DLOPEN_VERSION
61 int dlz_version(unsigned int *flags
);
64 * dlz_create() is required for all DLZ external drivers.
66 isc_result_t
dlz_create(const char *dlzname
, unsigned int argc
, char *argv
[], void **dbdata
, ...);
69 * dlz_destroy() is optional, and will be called when the driver is
70 * unloaded if supplied
72 void dlz_destroy(void *dbdata
);
75 dlz_findzonedb is required for all DLZ external drivers
77 isc_result_t
dlz_findzonedb(void *dbdata
, const char *name
);
80 dlz_lookup is required for all DLZ external drivers
82 isc_result_t
dlz_lookup(const char *zone
, const char *name
,
83 void *dbdata
, dns_sdlzlookup_t
*lookup
);
86 dlz_allowzonexfr() is optional, and should be supplied if you want
87 to support zone transfers
89 isc_result_t
dlz_allowzonexfr(void *dbdata
, const char *name
, const char *client
);
93 dlz_allnodes() is optional, but must be supplied if supply a
94 dlz_allowzonexfr() function
96 isc_result_t
dlz_allnodes(const char *zone
, void *dbdata
, dns_sdlzallnodes_t
*allnodes
);
99 dlz_newversion() is optional. It should be supplied if you want to
100 support dynamic updates.
102 isc_result_t
dlz_newversion(const char *zone
, void *dbdata
, void **versionp
);
105 dlz_closeversion() is optional, but must be supplied if you supply
106 a dlz_newversion() function
108 void dlz_closeversion(const char *zone
, isc_boolean_t commit
, void *dbdata
, void **versionp
);
111 dlz_configure() is optional, but must be supplied if you want to
112 support dynamic updates
114 isc_result_t
dlz_configure(dns_view_t
*view
, void *dbdata
);
117 dlz_ssumatch() is optional, but must be supplied if you want to
118 support dynamic updates
120 isc_boolean_t
dlz_ssumatch(const char *signer
, const char *name
, const char *tcpaddr
,
121 const char *type
, const char *key
, uint32_t keydatalen
, uint8_t *keydata
,
125 dlz_addrdataset() is optional, but must be supplied if you want to
126 support dynamic updates
128 isc_result_t
dlz_addrdataset(const char *name
, const char *rdatastr
, void *dbdata
, void *version
);
131 dlz_subrdataset() is optional, but must be supplied if you want to
132 support dynamic updates
134 isc_result_t
dlz_subrdataset(const char *name
, const char *rdatastr
, void *dbdata
, void *version
);
137 dlz_delrdataset() is optional, but must be supplied if you want to
138 support dynamic updates
140 isc_result_t
dlz_delrdataset(const char *name
, const char *type
, void *dbdata
, void *version
);