dlz_dlopen_driver.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2011-2014, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: dlz_dlopen_driver.c,v 1.5 2011/10/14 00:52:32 marka Exp $ */
#include <config.h>
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dns/dlz_dlopen.h>
#include <dlz/dlz_dlopen_driver.h>
#ifdef ISC_DLZ_DLOPEN
typedef struct dlopen_data {
char *dl_path;
char *dlzname;
void *dbdata;
unsigned int flags;
int version;
/* Modules can choose whether they are lock-safe or not. */
#define MAYBE_LOCK(cd) \
do { \
} while (0)
#define MAYBE_UNLOCK(cd) \
do { \
} while (0)
/*
* Log a message at the given level.
*/
{
}
/*
* SDLZ methods
*/
static isc_result_t
{
return (ISC_R_NOPERM);
}
MAYBE_LOCK(cd);
return (result);
}
static isc_result_t
const char *client)
{
return (ISC_R_NOPERM);
}
MAYBE_LOCK(cd);
return (result);
}
static isc_result_t
{
return (ISC_R_NOTIMPLEMENTED);
}
MAYBE_LOCK(cd);
return (result);
}
static isc_result_t
{
MAYBE_LOCK(cd);
return (result);
}
static isc_result_t
{
MAYBE_LOCK(cd);
return (result);
}
/*
* Load a symbol from the library
*/
static void *
"dlz_dlopen: library '%s' is missing "
}
return (ptr);
}
/*
* Called at startup for each dlopen zone in named.conf
*/
static isc_result_t
{
if (argc < 2) {
"dlz_dlopen driver for '%s' needs a path to "
"the shared library", dlzname);
return (ISC_R_FAILURE);
}
isc_mem_create(0, 0, &mctx);
return (ISC_R_NOMEMORY);
}
goto failed;
}
goto failed;
}
/* Initialize the lock */
if (result != ISC_R_SUCCESS)
goto failed;
/* Open the library */
unsigned int error = GetLastError();
"dlz_dlopen failed to open library '%s' - %u",
goto cleanup_lock;
}
/* Find the symbols */
{
/* We're missing a required symbol */
goto cleanup_lock;
}
/* Check the version of the API is the same */
{
"dlz_dlopen: %s: incorrect driver API version %d, "
"requires %d",
goto cleanup_lock;
}
/*
* Call the library's create function. Note that this is an
* 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
*/
MAYBE_LOCK(cd);
"log", dlopen_log,
"putrr", dns_sdlz_putrr,
"putnamedrr", dns_sdlz_putnamedrr,
"writeable_zone", dns_dlz_writeablezone,
NULL);
if (result != ISC_R_SUCCESS)
goto cleanup_lock;
return (ISC_R_SUCCESS);
if (triedload)
return (result);
}
/*
* Called when bind is shutting down
*/
static void
if (cd->dlz_destroy) {
MAYBE_LOCK(cd);
}
}
/*
* Called to start a transaction
*/
static isc_result_t
void **versionp)
{
return (ISC_R_NOTIMPLEMENTED);
MAYBE_LOCK(cd);
return (result);
}
/*
* Called to end a transaction
*/
static void
{
return;
}
MAYBE_LOCK(cd);
}
/*
* Called on startup to configure any writeable zones
*/
static isc_result_t
{
return (ISC_R_SUCCESS);
MAYBE_LOCK(cd);
return (result);
}
/*
* Check for authority to change a name
*/
static isc_boolean_t
{
return (ISC_FALSE);
MAYBE_LOCK(cd);
return (ret);
}
/*
* Add an rdataset
*/
static isc_result_t
{
return (ISC_R_NOTIMPLEMENTED);
MAYBE_LOCK(cd);
return (result);
}
/*
* Subtract an rdataset
*/
static isc_result_t
{
return (ISC_R_NOTIMPLEMENTED);
MAYBE_LOCK(cd);
return (result);
}
/*
delete a rdataset
*/
static isc_result_t
{
return (ISC_R_NOTIMPLEMENTED);
MAYBE_LOCK(cd);
return (result);
}
static dns_sdlzmethods_t dlz_dlopen_methods = {
};
#endif
/*
* Register driver with BIND
*/
#ifndef ISC_DLZ_DLOPEN
return (ISC_R_NOTIMPLEMENTED);
#else
mctx, &dlz_dlopen);
if (result != ISC_R_SUCCESS) {
"dns_sdlzregister() failed: %s",
}
return (result);
#endif
}
/*
* Unregister the driver
*/
void
dlz_dlopen_clear(void) {
#ifdef ISC_DLZ_DLOPEN
if (dlz_dlopen != NULL)
#endif
}