silent compiler warnings for DLZ exernal driver support and example
This commit is contained in:
@@ -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 <isc/util.h>
|
||||
|
||||
#include <dns/types.h>
|
||||
#include <dns/dlz_dlopen.h>
|
||||
|
||||
#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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user