From c38842e702fd391978e7badadc83daf4c0cd292c Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Thu, 17 Mar 2011 09:41:07 +0000 Subject: [PATCH] silent compiler warnings for DLZ exernal driver support and example --- bin/named/include/dlz/dlz_dlopen_driver.h | 5 +- bin/named/unix/dlz_dlopen_driver.c | 99 +++++++------ bin/named/win32/dlz_dlopen_driver.c | 101 +++++++------- bin/tests/system/dlzexternal/driver.c | 32 ++--- bin/tests/system/dlzexternal/driver.h | 147 +++----------------- lib/dns/include/dns/dlz.h | 8 +- lib/dns/include/dns/dlz_dlopen.h | 160 ++++++++++++++++++++++ lib/dns/include/dns/sdlz.h | 36 +++-- 8 files changed, 319 insertions(+), 269 deletions(-) create mode 100644 lib/dns/include/dns/dlz_dlopen.h diff --git a/bin/named/include/dlz/dlz_dlopen_driver.h b/bin/named/include/dlz/dlz_dlopen_driver.h index 2b019eb5b0..7af325a13b 100644 --- a/bin/named/include/dlz/dlz_dlopen_driver.h +++ b/bin/named/include/dlz/dlz_dlopen_driver.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dlz_dlopen_driver.h,v 1.1.4.3 2011/03/10 23:47:26 tbox Exp $ */ +/* $Id: dlz_dlopen_driver.h,v 1.1.4.4 2011/03/17 09:41:06 fdupont Exp $ */ #ifndef DLZ_DLOPEN_DRIVER_H #define DLZ_DLOPEN_DRIVER_H @@ -24,7 +24,4 @@ dlz_dlopen_init(isc_mem_t *mctx); void dlz_dlopen_clear(void); - -#define DLZ_DLOPEN_VERSION 1 - #endif diff --git a/bin/named/unix/dlz_dlopen_driver.c b/bin/named/unix/dlz_dlopen_driver.c index 3a968b36b6..56ee512d96 100644 --- a/bin/named/unix/dlz_dlopen_driver.c +++ b/bin/named/unix/dlz_dlopen_driver.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dlz_dlopen_driver.c,v 1.1.4.3 2011/03/10 23:47:26 tbox Exp $ */ +/* $Id: dlz_dlopen_driver.c,v 1.1.4.4 2011/03/17 09:41:06 fdupont Exp $ */ #include @@ -24,8 +24,8 @@ #include #include -#include #include +#include #include #include @@ -51,35 +51,21 @@ typedef struct dlopen_data { int version; isc_boolean_t in_configure; - int (*dlz_version)(unsigned int *flags); - isc_result_t (*dlz_create)(const char *dlzname, - unsigned int argc, char *argv[], - void **dbdata, ...); - isc_result_t (*dlz_findzonedb)(void *dbdata, const char *name); - isc_result_t (*dlz_lookup)(const char *zone, const char *name, - void *dbdata, dns_sdlzlookup_t *lookup); - isc_result_t (*dlz_authority)(const char *zone, void *dbdata, - dns_sdlzlookup_t *lookup); - isc_result_t (*dlz_allnodes)(const char *zone, void *dbdata, - dns_sdlzallnodes_t *allnodes); - isc_result_t (*dlz_allowzonexfr)(void *dbdata, const char *name, - const char *client); - isc_result_t (*dlz_newversion)(const char *zone, void *dbdata, - void **versionp); - void (*dlz_closeversion)(const char *zone, isc_boolean_t commit, - void *dbdata, void **versionp); - isc_result_t (*dlz_configure)(dns_view_t *view, void *dbdata); - isc_boolean_t (*dlz_ssumatch)(const char *signer, const char *name, - const char *tcpaddr, const char *type, - const char *key, isc_uint32_t keydatalen, - unsigned char *keydata, void *dbdata); - isc_result_t (*dlz_addrdataset)(const char *name, const char *rdatastr, - void *dbdata, void *version); - isc_result_t (*dlz_subrdataset)(const char *name, const char *rdatastr, - void *dbdata, void *version); - isc_result_t (*dlz_delrdataset)(const char *name, const char *type, - void *dbdata, void *version); - void (*dlz_destroy)(void *dbdata); + dlz_dlopen_version_t *dlz_version; + dlz_dlopen_create_t *dlz_create; + dlz_dlopen_findzonedb_t *dlz_findzonedb; + dlz_dlopen_lookup_t *dlz_lookup; + dlz_dlopen_authority_t *dlz_authority; + dlz_dlopen_allnodes_t *dlz_allnodes; + dlz_dlopen_allowzonexfr_t *dlz_allowzonexfr; + dlz_dlopen_newversion_t *dlz_newversion; + dlz_dlopen_closeversion_t *dlz_closeversion; + dlz_dlopen_configure_t *dlz_configure; + dlz_dlopen_ssumatch_t *dlz_ssumatch; + dlz_dlopen_addrdataset_t *dlz_addrdataset; + dlz_dlopen_subrdataset_t *dlz_subrdataset; + dlz_dlopen_delrdataset_t *dlz_delrdataset; + dlz_dlopen_destroy_t *dlz_destroy; } dlopen_data_t; /* Modules can choose whether they are lock-safe or not. */ @@ -288,10 +274,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], } /* Find the symbols */ - cd->dlz_version = dl_load_symbol(cd, "dlz_version", ISC_TRUE); - cd->dlz_create = dl_load_symbol(cd, "dlz_create", ISC_TRUE); - cd->dlz_lookup = dl_load_symbol(cd, "dlz_lookup", ISC_TRUE); - cd->dlz_findzonedb = dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE); + cd->dlz_version = (dlz_dlopen_version_t *) + dl_load_symbol(cd, "dlz_version", ISC_TRUE); + cd->dlz_create = (dlz_dlopen_create_t *) + dl_load_symbol(cd, "dlz_create", ISC_TRUE); + cd->dlz_lookup = (dlz_dlopen_lookup_t *) + dl_load_symbol(cd, "dlz_lookup", ISC_TRUE); + cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *) + dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE); if (cd->dlz_create == NULL || cd->dlz_lookup == NULL || @@ -301,19 +291,28 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], goto failed; } - cd->dlz_allowzonexfr = dl_load_symbol(cd, "dlz_allowzonexfr", - ISC_FALSE); - cd->dlz_allnodes = dl_load_symbol(cd, "dlz_allnodes", - ISC_TF(cd->dlz_allowzonexfr != NULL)); - cd->dlz_authority = dl_load_symbol(cd, "dlz_authority", ISC_FALSE); - cd->dlz_newversion = dl_load_symbol(cd, "dlz_newversion", ISC_FALSE); - cd->dlz_closeversion = dl_load_symbol(cd, "dlz_closeversion", - ISC_TF(cd->dlz_newversion != NULL)); - cd->dlz_configure = dl_load_symbol(cd, "dlz_configure", ISC_FALSE); - cd->dlz_ssumatch = dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE); - cd->dlz_addrdataset = dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE); - cd->dlz_subrdataset = dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE); - cd->dlz_delrdataset = dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE); + cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *) + dl_load_symbol(cd, "dlz_allowzonexfr", ISC_FALSE); + cd->dlz_allnodes = (dlz_dlopen_allnodes_t *) + dl_load_symbol(cd, "dlz_allnodes", + ISC_TF(cd->dlz_allowzonexfr != NULL)); + cd->dlz_authority = (dlz_dlopen_authority_t *) + dl_load_symbol(cd, "dlz_authority", ISC_FALSE); + cd->dlz_newversion = (dlz_dlopen_newversion_t *) + dl_load_symbol(cd, "dlz_newversion", ISC_FALSE); + cd->dlz_closeversion = (dlz_dlopen_closeversion_t *) + dl_load_symbol(cd, "dlz_closeversion", + ISC_TF(cd->dlz_newversion != NULL)); + cd->dlz_configure = (dlz_dlopen_configure_t *) + dl_load_symbol(cd, "dlz_configure", ISC_FALSE); + cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *) + dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE); + cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *) + dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE); + cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *) + dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE); + cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *) + dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE); /* Check the version of the API is the same */ cd->version = cd->dlz_version(&cd->flags); @@ -355,7 +354,7 @@ failed: if (cd->dlzname) isc_mem_free(mctx, cd->dlzname); if (dlopen_flags) - isc_mutex_destroy(&cd->lock); + (void) isc_mutex_destroy(&cd->lock); #ifdef HAVE_DLCLOSE if (cd->dl_handle) dlclose(cd->dl_handle); @@ -392,7 +391,7 @@ dlopen_dlz_destroy(void *driverarg, void *dbdata) { dlclose(cd->dl_handle); #endif - isc_mutex_destroy(&cd->lock); + (void) isc_mutex_destroy(&cd->lock); mctx = cd->mctx; isc_mem_put(mctx, cd, sizeof(*cd)); diff --git a/bin/named/win32/dlz_dlopen_driver.c b/bin/named/win32/dlz_dlopen_driver.c index 7b17e049f7..52292b5b31 100644 --- a/bin/named/win32/dlz_dlopen_driver.c +++ b/bin/named/win32/dlz_dlopen_driver.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dlz_dlopen_driver.c,v 1.4.2.2 2011/03/17 09:40:08 fdupont Exp $ */ +/* $Id: dlz_dlopen_driver.c,v 1.4.2.3 2011/03/17 09:41:07 fdupont Exp $ */ #include @@ -25,8 +25,8 @@ #include #include -#include #include +#include #include #include @@ -52,35 +52,21 @@ typedef struct dlopen_data { int version; isc_boolean_t in_configure; - int (*dlz_version)(unsigned int *flags); - isc_result_t (*dlz_create)(const char *dlzname, - unsigned int argc, char *argv[], - void **dbdata, ...); - isc_result_t (*dlz_findzonedb)(void *dbdata, const char *name); - isc_result_t (*dlz_lookup)(const char *zone, const char *name, - void *dbdata, dns_sdlzlookup_t *lookup); - isc_result_t (*dlz_authority)(const char *zone, void *dbdata, - dns_sdlzlookup_t *lookup); - isc_result_t (*dlz_allnodes)(const char *zone, void *dbdata, - dns_sdlzallnodes_t *allnodes); - isc_result_t (*dlz_allowzonexfr)(void *dbdata, const char *name, - const char *client); - isc_result_t (*dlz_newversion)(const char *zone, void *dbdata, - void **versionp); - void (*dlz_closeversion)(const char *zone, isc_boolean_t commit, - void *dbdata, void **versionp); - isc_result_t (*dlz_configure)(dns_view_t *view, void *dbdata); - isc_boolean_t (*dlz_ssumatch)(const char *signer, const char *name, - const char *tcpaddr, const char *type, - const char *key, isc_uint32_t keydatalen, - unsigned char *keydata, void *dbdata); - isc_result_t (*dlz_addrdataset)(const char *name, const char *rdatastr, - void *dbdata, void *version); - isc_result_t (*dlz_subrdataset)(const char *name, const char *rdatastr, - void *dbdata, void *version); - isc_result_t (*dlz_delrdataset)(const char *name, const char *type, - void *dbdata, void *version); - void (*dlz_destroy)(void *dbdata); + dlz_dlopen_version_t *dlz_version; + dlz_dlopen_create_t *dlz_create; + dlz_dlopen_findzonedb_t *dlz_findzonedb; + dlz_dlopen_lookup_t *dlz_lookup; + dlz_dlopen_authority_t *dlz_authority; + dlz_dlopen_allnodes_t *dlz_allnodes; + dlz_dlopen_allowzonexfr_t *dlz_allowzonexfr; + dlz_dlopen_newversion_t *dlz_newversion; + dlz_dlopen_closeversion_t *dlz_closeversion; + dlz_dlopen_configure_t *dlz_configure; + dlz_dlopen_ssumatch_t *dlz_ssumatch; + dlz_dlopen_addrdataset_t *dlz_addrdataset; + dlz_dlopen_subrdataset_t *dlz_subrdataset; + dlz_dlopen_delrdataset_t *dlz_delrdataset; + dlz_dlopen_destroy_t *dlz_destroy; } dlopen_data_t; /* Modules can choose whether they are lock-safe or not. */ @@ -278,10 +264,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], } /* Find the symbols */ - cd->dlz_version = dl_load_symbol(cd, "dlz_version", ISC_TRUE); - cd->dlz_create = dl_load_symbol(cd, "dlz_create", ISC_TRUE); - cd->dlz_lookup = dl_load_symbol(cd, "dlz_lookup", ISC_TRUE); - cd->dlz_findzonedb = dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE); + cd->dlz_version = (dlz_dlopen_version_t *) + dl_load_symbol(cd, "dlz_version", ISC_TRUE); + cd->dlz_create = (dlz_dlopen_create_t *) + dl_load_symbol(cd, "dlz_create", ISC_TRUE); + cd->dlz_lookup = (dlz_dlopen_lookup_t *) + dl_load_symbol(cd, "dlz_lookup", ISC_TRUE); + cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *) + dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE); if (cd->dlz_create == NULL || cd->dlz_lookup == NULL || @@ -291,19 +281,28 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], goto failed; } - cd->dlz_allowzonexfr = dl_load_symbol(cd, "dlz_allowzonexfr", - ISC_FALSE); - cd->dlz_allnodes = dl_load_symbol(cd, "dlz_allnodes", - ISC_TF(cd->dlz_allowzonexfr != NULL)); - cd->dlz_authority = dl_load_symbol(cd, "dlz_authority", ISC_FALSE); - cd->dlz_newversion = dl_load_symbol(cd, "dlz_newversion", ISC_FALSE); - cd->dlz_closeversion = dl_load_symbol(cd, "dlz_closeversion", - ISC_TF(cd->dlz_newversion != NULL)); - cd->dlz_configure = dl_load_symbol(cd, "dlz_configure", ISC_FALSE); - cd->dlz_ssumatch = dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE); - cd->dlz_addrdataset = dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE); - cd->dlz_subrdataset = dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE); - cd->dlz_delrdataset = dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE); + cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *) + dl_load_symbol(cd, "dlz_allowzonexfr", ISC_FALSE); + cd->dlz_allnodes = (dlz_dlopen_allnodes_t *) + dl_load_symbol(cd, "dlz_allnodes", + ISC_TF(cd->dlz_allowzonexfr != NULL)); + cd->dlz_authority = (dlz_dlopen_authority_t *) + dl_load_symbol(cd, "dlz_authority", ISC_FALSE); + cd->dlz_newversion = (dlz_dlopen_newversion_t *) + dl_load_symbol(cd, "dlz_newversion", ISC_FALSE); + cd->dlz_closeversion = (dlz_dlopen_closeversion_t *) + dl_load_symbol(cd, "dlz_closeversion", + ISC_TF(cd->dlz_newversion != NULL)); + cd->dlz_configure = (dlz_dlopen_configure_t *) + dl_load_symbol(cd, "dlz_configure", ISC_FALSE); + cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *) + dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE); + cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *) + dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE); + cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *) + dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE); + cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *) + dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE); /* Check the version of the API is the same */ cd->version = cd->dlz_version(&cd->flags); @@ -320,7 +319,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], * extended version of dlz create, with the addition of * named function pointers for helper functions that the * driver will need. This avoids the need for the backend to - * link the bind9 libraries + * link the BIND9 libraries */ MAYBE_LOCK(cd); result = cd->dlz_create(dlzname, argc-1, argv+1, @@ -345,7 +344,7 @@ failed: if (cd->dlzname) isc_mem_free(mctx, cd->dlzname); if (triedload) - isc_mutex_destroy(&cd->lock); + (void) isc_mutex_destroy(&cd->lock); if (cd->dl_handle) FreeLibrary(cd->dl_handle); isc_mem_put(mctx, cd, sizeof(*cd)); @@ -378,7 +377,7 @@ dlopen_dlz_destroy(void *driverarg, void *dbdata) { if (cd->dl_handle) FreeLibrary(cd->dl_handle); - isc_mutex_destroy(&cd->lock); + (void) isc_mutex_destroy(&cd->lock); mctx = cd->mctx; isc_mem_put(mctx, cd, sizeof(*cd)); diff --git a/bin/tests/system/dlzexternal/driver.c b/bin/tests/system/dlzexternal/driver.c index e4c3c42254..dde142ef82 100644 --- a/bin/tests/system/dlzexternal/driver.c +++ b/bin/tests/system/dlzexternal/driver.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: driver.c,v 1.1.4.3 2011/03/10 23:47:26 tbox Exp $ */ +/* $Id: driver.c,v 1.1.4.4 2011/03/17 09:41:07 fdupont Exp $ */ /* * This provides a very simple example of an external loadable DLZ @@ -34,6 +34,7 @@ #include #include +#include #include "driver.h" @@ -51,6 +52,8 @@ struct record { #define MAX_RECORDS 100 +typedef void log_t(int level, const char *fmt, ...); + struct dlz_example_data { char *zone_name; @@ -62,13 +65,10 @@ struct dlz_example_data { isc_boolean_t transaction_started; /* Helper functions from the dlz_dlopen driver */ - void (*log)(int level, const char *fmt, ...); - isc_result_t (*putrr)(dns_sdlzlookup_t *handle, const char *type, - dns_ttl_t ttl, const char *data); - isc_result_t (*putnamedrr)(dns_sdlzlookup_t *handle, const char *name, - const char *type, dns_ttl_t ttl, - const char *data); - isc_result_t (*writeable_zone)(dns_view_t *view, const char *zone_name); + log_t *log; + dns_sdlz_putrr_t *putrr; + dns_sdlz_putnamedrr_t *putnamedrr; + dns_dlz_writeablezone_t *writeable_zone; }; static isc_boolean_t @@ -96,7 +96,7 @@ add_name(struct dlz_example_data *state, struct record *list, int first_empty = -1; for (i = 0; i < MAX_RECORDS; i++) { - if (first_empty == -1 && strlen(list[i].name) == 0) { + if (first_empty == -1 && strlen(list[i].name) == 0U) { first_empty = i; } if (strcasecmp(list[i].name, name) != 0) @@ -167,13 +167,13 @@ b9_add_helper(struct dlz_example_data *state, const char *helper_name, void *ptr) { if (strcmp(helper_name, "log") == 0) - state->log = ptr; + state->log = (log_t *)ptr; if (strcmp(helper_name, "putrr") == 0) - state->putrr = ptr; + state->putrr = (dns_sdlz_putrr_t *)ptr; if (strcmp(helper_name, "putnamedrr") == 0) - state->putnamedrr = ptr; + state->putnamedrr = (dns_sdlz_putnamedrr_t *)ptr; if (strcmp(helper_name, "writeable_zone") == 0) - state->writeable_zone = ptr; + state->writeable_zone = (dns_dlz_writeablezone_t *)ptr; } @@ -319,7 +319,7 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) { for (i = 0; i < MAX_RECORDS; i++) { isc_result_t result; - if (strlen(state->current[i].name) == 0) { + if (strlen(state->current[i].name) == 0U) { continue; } result = state->putnamedrr(allnodes, state->current[i].name, @@ -381,7 +381,7 @@ dlz_closeversion(const char *zone, isc_boolean_t commit, "dlz_example: committing transaction on zone %s", zone); for (i = 0; i < MAX_RECORDS; i++) { - if (strlen(state->adds[i].name) > 0) { + if (strlen(state->adds[i].name) > 0U) { add_name(state, &state->current[0], state->adds[i].name, state->adds[i].type, @@ -390,7 +390,7 @@ dlz_closeversion(const char *zone, isc_boolean_t commit, } } for (i = 0; i < MAX_RECORDS; i++) { - if (strlen(state->deletes[i].name) > 0) { + if (strlen(state->deletes[i].name) > 0U) { del_name(state, &state->current[0], state->deletes[i].name, state->deletes[i].type, diff --git a/bin/tests/system/dlzexternal/driver.h b/bin/tests/system/dlzexternal/driver.h index a8456dd468..832aedfb15 100644 --- a/bin/tests/system/dlzexternal/driver.h +++ b/bin/tests/system/dlzexternal/driver.h @@ -14,138 +14,23 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: driver.h,v 1.1.4.3 2011/03/10 23:47:29 tbox Exp $ */ +/* $Id: driver.h,v 1.1.4.4 2011/03/17 09:41:07 fdupont Exp $ */ /* - * This header provides a minimal set of defines and typedefs needed - * for building an external DLZ module for bind9. When creating a new - * external DLZ driver, please copy this header into your own source - * tree. + * This header includes the declarations of entry points. */ -#define DLZ_DLOPEN_VERSION 1 - -/* Return this in flags to dlz_version() if thread safe */ -#define DNS_SDLZFLAG_THREADSAFE 0x00000001U - -#if 0 -/* Result codes */ -#define ISC_R_SUCCESS 0 -#define ISC_R_NOMEMORY 1 -#define ISC_R_NOTFOUND 23 -#define ISC_R_FAILURE 25 - -/* Log levels */ -#define ISC_LOG_INFO (-1) -#define ISC_LOG_NOTICE (-2) -#define ISC_LOG_WARNING (-3) -#define ISC_LOG_ERROR (-4) -#define ISC_LOG_CRITICAL (-5) -#endif - -/* Some opaque structures */ -typedef void *dns_sdlzlookup_t; -typedef void *dns_sdlzallnodes_t; - -/* - * dlz_version() is required for all DLZ external drivers. It should - * return DLZ_DLOPEN_VERSION - */ -int -dlz_version(unsigned int *flags); - -/* - * dlz_create() is required for all DLZ external drivers. - */ -isc_result_t -dlz_create(const char *dlzname, unsigned int argc, - char *argv[], void **dbdata, ...); - -/* - * dlz_destroy() is optional, and will be called when the driver is - * unloaded if supplied - */ -void -dlz_destroy(void *dbdata); - -/* - * dlz_findzonedb is required for all DLZ external drivers - */ -isc_result_t -dlz_findzonedb(void *dbdata, const char *name); - -/* - * dlz_lookup is required for all DLZ external drivers - */ -isc_result_t -dlz_lookup(const char *zone, const char *name, - void *dbdata, dns_sdlzlookup_t *lookup); - -/* - * dlz_allowzonexfr() is optional, and should be supplied if you want - * to support zone transfers - */ -isc_result_t -dlz_allowzonexfr(void *dbdata, const char *name, const char *client); - -/* - * dlz_allnodes() is optional, but must be supplied if supply a - * dlz_allowzonexfr() function - */ -isc_result_t -dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes); - -/* - * dlz_newversion() is optional. It should be supplied if you want to - * support dynamic updates. - */ -isc_result_t -dlz_newversion(const char *zone, void *dbdata, void **versionp); - -/* - * dlz_closeversion() is optional, but must be supplied if you supply - * a dlz_newversion() function - */ -void -dlz_closeversion(const char *zone, isc_boolean_t commit, - void *dbdata, void **versionp); - -/* - * dlz_configure() is optional, but must be supplied if you want to - * support dynamic updates - */ -isc_result_t -dlz_configure(dns_view_t *view, void *dbdata); - -/* - * dlz_ssumatch() is optional, but must be supplied if you want to - * support dynamic updates - */ -isc_boolean_t -dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, - const char *type, const char *key, isc_uint32_t keydatalen, - unsigned char *keydata, void *dbdata); - -/* - * dlz_addrdataset() is optional, but must be supplied if you want to - * support dynamic updates - */ -isc_result_t -dlz_addrdataset(const char *name, const char *rdatastr, - void *dbdata, void *version); - -/* - * dlz_subrdataset() is optional, but must be supplied if you want to - * support dynamic updates - */ -isc_result_t -dlz_subrdataset(const char *name, const char *rdatastr, - void *dbdata, void *version); - -/* - * dlz_delrdataset() is optional, but must be supplied if you want to - * support dynamic updates - */ -isc_result_t -dlz_delrdataset(const char *name, const char *type, - void *dbdata, void *version); +dlz_dlopen_version_t dlz_version; +dlz_dlopen_create_t dlz_create; +dlz_dlopen_destroy_t dlz_destroy; +dlz_dlopen_findzonedb_t dlz_findzonedb; +dlz_dlopen_lookup_t dlz_lookup; +dlz_dlopen_allowzonexfr_t dlz_allowzonexfr; +dlz_dlopen_allnodes_t dlz_allnodes; +dlz_dlopen_newversion_t dlz_newversion; +dlz_dlopen_closeversion_t dlz_closeversion; +dlz_dlopen_configure_t dlz_configure; +dlz_dlopen_ssumatch_t dlz_ssumatch; +dlz_dlopen_addrdataset_t dlz_addrdataset; +dlz_dlopen_subrdataset_t dlz_subrdataset; +dlz_dlopen_delrdataset_t dlz_delrdataset; diff --git a/lib/dns/include/dns/dlz.h b/lib/dns/include/dns/dlz.h index c9ac1d871f..79c8f0cf2b 100644 --- a/lib/dns/include/dns/dlz.h +++ b/lib/dns/include/dns/dlz.h @@ -50,7 +50,7 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dlz.h,v 1.12 2010/12/20 23:47:21 tbox Exp $ */ +/* $Id: dlz.h,v 1.12.14.1 2011/03/17 09:41:07 fdupont Exp $ */ /*! \file dns/dlz.h */ @@ -318,9 +318,9 @@ dns_dlzunregister(dns_dlzimplementation_t **dlzimp); */ -isc_result_t -dns_dlz_writeablezone(dns_view_t *view, const char *zone_name); - +typedef isc_result_t dns_dlz_writeablezone_t(dns_view_t *view, + const char *zone_name); +dns_dlz_writeablezone_t dns_dlz_writeablezone; /*%< * creates a writeable DLZ zone. Must be called from within the * configure() method of a DLZ driver. diff --git a/lib/dns/include/dns/dlz_dlopen.h b/lib/dns/include/dns/dlz_dlopen.h new file mode 100644 index 0000000000..2dbecc7ad5 --- /dev/null +++ b/lib/dns/include/dns/dlz_dlopen.h @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: dlz_dlopen.h,v 1.2.2.2 2011/03/17 09:41:07 fdupont Exp $ */ + +/*! \file dns/dlz_open.h */ + +#ifndef DLZ_DLOPEN_H +#define DLZ_DLOPEN_H + +#include + +ISC_LANG_BEGINDECLS + +/* + * This header provides a minimal set of defines and typedefs needed + * for the entry points of an external DLZ module for bind9. + */ + +#define DLZ_DLOPEN_VERSION 1 + +/* + * dlz_dlopen_version() is required for all DLZ external drivers. It + * should return DLZ_DLOPEN_VERSION + */ +typedef int dlz_dlopen_version_t (unsigned int *flags); + +/* + * dlz_dlopen_create() is required for all DLZ external drivers. + */ +typedef isc_result_t dlz_dlopen_create_t (const char *dlzname, + unsigned int argc, + char *argv[], + void **dbdata, + ...); + +/* + * dlz_dlopen_destroy() is optional, and will be called when the + * driver is unloaded if supplied + */ +typedef void dlz_dlopen_destroy_t (void *dbdata); + +/* + * dlz_dlopen_findzonedb() is required for all DLZ external drivers + */ +typedef isc_result_t dlz_dlopen_findzonedb_t (void *dbdata, + const char *name); + +/* + * dlz_dlopen_lookup() is required for all DLZ external drivers + */ +typedef isc_result_t dlz_dlopen_lookup_t (const char *zone, + const char *name, + void *dbdata, + dns_sdlzlookup_t *lookup); + +/* + * dlz_dlopen_authority is optional() if dlz_dlopen_lookup() + * supplies authority information for the dns record + */ +typedef isc_result_t dlz_dlopen_authority_t (const char *zone, + void *dbdata, + dns_sdlzlookup_t *lookup); + +/* + * dlz_dlopen_allowzonexfr() is optional, and should be supplied if + * you want to support zone transfers + */ +typedef isc_result_t dlz_dlopen_allowzonexfr_t (void *dbdata, + const char *name, + const char *client); + +/* + * dlz_dlopen_allnodes() is optional, but must be supplied if supply a + * dlz_dlopen_allowzonexfr() function + */ +typedef isc_result_t dlz_dlopen_allnodes_t (const char *zone, + void *dbdata, + dns_sdlzallnodes_t *allnodes); + +/* + * dlz_dlopen_newversion() is optional. It should be supplied if you + * want to support dynamic updates. + */ +typedef isc_result_t dlz_dlopen_newversion_t (const char *zone, + void *dbdata, + void **versionp); + +/* + * dlz_closeversion() is optional, but must be supplied if you supply + * a dlz_newversion() function + */ +typedef void dlz_dlopen_closeversion_t (const char *zone, + isc_boolean_t commit, + void *dbdata, + void **versionp); + +/* + * dlz_dlopen_configure() is optional, but must be supplied if you + * want to support dynamic updates + */ +typedef isc_result_t dlz_dlopen_configure_t (dns_view_t *view, + void *dbdata); + +/* + * dlz_dlopen_ssumatch() is optional, but must be supplied if you want + * to support dynamic updates + */ +typedef isc_boolean_t dlz_dlopen_ssumatch_t (const char *signer, + const char *name, + const char *tcpaddr, + const char *type, + const char *key, + isc_uint32_t keydatalen, + unsigned char *keydata, + void *dbdata); + +/* + * dlz_dlopen_addrdataset() is optional, but must be supplied if you + * want to support dynamic updates + */ +typedef isc_result_t dlz_dlopen_addrdataset_t (const char *name, + const char *rdatastr, + void *dbdata, + void *version); + +/* + * dlz_dlopen_subrdataset() is optional, but must be supplied if you + * want to support dynamic updates + */ +typedef isc_result_t dlz_dlopen_subrdataset_t (const char *name, + const char *rdatastr, + void *dbdata, + void *version); + +/* + * dlz_dlopen_delrdataset() is optional, but must be supplied if you + * want to support dynamic updates + */ +typedef isc_result_t dlz_dlopen_delrdataset_t (const char *name, + const char *type, + void *dbdata, + void *version); + +ISC_LANG_ENDDECLS + +#endif diff --git a/lib/dns/include/dns/sdlz.h b/lib/dns/include/dns/sdlz.h index ddf42a6834..ab8742d7eb 100644 --- a/lib/dns/include/dns/sdlz.h +++ b/lib/dns/include/dns/sdlz.h @@ -50,7 +50,7 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sdlz.h,v 1.14 2011/01/13 08:50:29 tbox Exp $ */ +/* $Id: sdlz.h,v 1.14.8.1 2011/03/17 09:41:07 fdupont Exp $ */ /*! \file dns/sdlz.h */ @@ -317,25 +317,33 @@ dns_sdlzunregister(dns_sdlzimplementation_t **sdlzimp); * function is called. */ -isc_result_t -dns_sdlz_putnamedrr(dns_sdlzallnodes_t *allnodes, const char *name, - const char *type, dns_ttl_t ttl, const char *data); +typedef isc_result_t dns_sdlz_putnamedrr_t(dns_sdlzallnodes_t *allnodes, + const char *name, + const char *type, + dns_ttl_t ttl, + const char *data); +dns_sdlz_putnamedrr_t dns_sdlz_putnamedrr; + /*%< * Add a single resource record to the allnodes structure to be later * parsed into a zone transfer response. */ -isc_result_t -dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl, - const char *data); +typedef isc_result_t dns_sdlz_putrr_t(dns_sdlzlookup_t *lookup, + const char *type, + dns_ttl_t ttl, + const char *data); +dns_sdlz_putrr_t dns_sdlz_putrr; /*%< * Add a single resource record to the lookup structure to be later * parsed into a query response. */ -isc_result_t -dns_sdlz_putsoa(dns_sdlzlookup_t *lookup, const char *mname, const char *rname, - isc_uint32_t serial); +typedef isc_result_t dns_sdlz_putsoa_t(dns_sdlzlookup_t *lookup, + const char *mname, + const char *rname, + isc_uint32_t serial); +dns_sdlz_putsoa_t dns_sdlz_putsoa; /*%< * This function may optionally be called from the 'authority' * callback to simplify construction of the SOA record for 'zone'. It @@ -347,9 +355,11 @@ dns_sdlz_putsoa(dns_sdlzlookup_t *lookup, const char *mname, const char *rname, */ -isc_result_t -dns_sdlz_setdb(dns_dlzdb_t *dlzdatabase, dns_rdataclass_t rdclass, - dns_name_t *name, dns_db_t **dbp); +typedef isc_result_t dns_sdlz_setdb_t(dns_dlzdb_t *dlzdatabase, + dns_rdataclass_t rdclass, + dns_name_t *name, + dns_db_t **dbp); +dns_sdlz_setdb_t dns_sdlz_setdb; /*%< * Create the database pointers for a writeable SDLZ zone */