dlz.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Portions Copyright (C) 1999-2001, 2005, 2007, 2009-2013, 2015, 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/.
*/
/*
* Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
*
* Permission to use, copy, modify, and 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 STICHTING NLNET
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* STICHTING NLNET 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.
*
* The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
* conceived and contributed by Rob Butler.
*
* Permission to use, copy, modify, and 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 ROB BUTLER
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* ROB BUTLER 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$ */
/*! \file */
/***
*** Imports
***/
#include <config.h>
#include <dns/fixedname.h>
#include <isc/commandline.h>
/***
*** Supported DLZ DB Implementations Registry
***/
static isc_rwlock_t dlz_implock;
static void
dlz_initialize(void) {
}
/*%
* Searches the dlz_implementations list for a driver matching name.
*/
static inline dns_dlzimplementation_t *
dlz_impfind(const char *name) {
return (imp);
return (NULL);
}
/***
*** Basic DLZ Methods
***/
{
/*
* Performs checks to make sure data is as we expect it to be.
*/
/*
* Find a driver in which the zone exists and transfer is supported
*/
{
/*
* if ISC_R_NOPERM, we found the right database but
* the zone may not transfer.
*/
return (result);
}
if (result == ISC_R_NOTIMPLEMENTED)
return (result);
}
{
/*
* initialize the dlz_implementations list, this is guaranteed
* to only really happen once.
*/
/*
* Performs checks to make sure data is as we expect it to be.
*/
/* write log message */
/* lock the dlz_implementations list so we can search it. */
/* search for the driver implementation */
"unsupported DLZ database driver '%s'."
" %s not loaded.",
return (ISC_R_NOTFOUND);
}
/* Allocate memory to hold the DLZ database driver */
return (ISC_R_NOMEMORY);
}
/* Make sure memory region is set to all 0's */
/* Create a new database using implementation 'drivername'. */
/* mark the DLZ driver as valid */
if (result == ISC_R_SUCCESS) {
"DLZ driver loaded successfully.");
return (ISC_R_SUCCESS);
} else {
"DLZ driver failed to load.");
}
/* impinfo->methods->create failed. */
return (result);
}
void
/* Write debugging message to log */
"Unloading DLZ driver.");
/*
* Perform checks to make sure data is as we expect it to be.
*/
/* call the drivers destroy method */
/* return memory and detach */
}
/*%
* Registers a DLZ driver. This basically just adds the dlz
* driver to the list of available drivers in the dlz_implementations list.
*/
{
/* Write debugging message to log */
"Registering DLZ driver '%s'", drivername);
/*
* Performs checks to make sure data is as we expect it to be.
*/
/*
* initialize the dlz_implementations list, this is guaranteed
* to only really happen once.
*/
/* lock the dlz_implementations list so we can modify it. */
/*
* check that another already registered driver isn't using
* the same name
*/
"DLZ Driver '%s' already registered",
return (ISC_R_EXISTS);
}
/*
* Allocate memory for a dlz_implementation object. Error if
* we cannot.
*/
return (ISC_R_NOMEMORY);
}
/* Make sure memory region is set to all 0's */
/* Store the data passed into this method */
/* attach the new dlz_implementation object to a memory context */
/*
* prepare the dlz_implementation object to be put in a list,
* and append it to the list
*/
/* Unlock the dlz_implementations list. */
/* Pass back the dlz_implementation that we created. */
return (ISC_R_SUCCESS);
}
/*%
* Tokenize the string "s" into whitespace-separated words,
* return the number of words in '*argcp' and an array
* of pointers to the words in '*argvp'. The caller
* must free the array using isc_mem_put(). The string
* is modified in-place.
*/
{
}
/*%
* Unregisters a DLZ driver. This basically just removes the dlz
* driver from the list of available drivers in the dlz_implementations list.
*/
void
/* Write debugging message to log */
"Unregistering DLZ driver.");
/*
* Performs checks to make sure data is as we expect it to be.
*/
/*
* initialize the dlz_implementations list, this is guaranteed
* to only really happen once.
*/
/* lock the dlz_implementations list so we can modify it. */
/* remove the dlz_implementation object from the list */
/*
* Return the memory back to the available memory pool and
* remove it from the memory context.
*/
/* Unlock the dlz_implementations list. */
}
/*
* Create a writeable DLZ zone. This can be called by DLZ drivers
* during configure() to create a zone that can be updated. The zone
* type is set to dns_zone_dlz, which is equivalent to a master zone
*
* This function uses a callback setup in dns_dlzconfigure() to call
* into the server zone code to setup the remaining pieces of server
* specific functionality on the zone
*/
const char *zone_name)
{
if (result != ISC_R_SUCCESS)
goto cleanup;
"DLZ %s has 'search no;', but attempted to "
"register writeable zone %s.",
goto cleanup;
}
/* See if the zone already exists */
if (result == ISC_R_SUCCESS) {
goto cleanup;
}
/* Create it */
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
}
if (result != ISC_R_SUCCESS)
goto cleanup;
return (result);
}
/*%
* Configure a DLZ driver. This is optional, and if supplied gives
* the backend an opportunity to configure parameters related to DLZ.
*/
{
return (ISC_R_SUCCESS);
return (result);
}
{
"No ssumatch method for DLZ database");
return (ISC_FALSE);
}
return (r);
}