db.c revision 5d79b60fc5e4dad4f04da39570517d20a2425f8b
/*
* Copyright (C) 2004, 2005, 2007-2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* 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$ */
/*! \file */
/***
*** Imports
***/
#include <config.h>
#include <dns/callbacks.h>
#include <dns/clientinfo.h>
#include <dns/dbiterator.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
/***
*** Private Types
***/
struct dns_dbimplementation {
const char * name;
void * driverarg;
};
/***
*** Supported DB Implementations Registry
***/
/*
* Built in database implementations are registered here.
*/
#include "rbtdb.h"
#include "rbtdb64.h"
static isc_rwlock_t implock;
static dns_dbimplementation_t rbtimp;
static dns_dbimplementation_t rbt64imp;
static void
initialize(void) {
}
static inline dns_dbimplementation_t *
return (imp);
return (NULL);
}
/***
*** Basic DB Methods
***/
{
/*
* Create a new database using implementation 'db_type'.
*/
return (result);
}
"unsupported database type '%s'", db_type);
return (ISC_R_NOTFOUND);
}
void
/*
* Attach *targetp to source.
*/
}
void
/*
* Detach *dbp from its database.
*/
}
{
}
/*
* Does 'db' have cache semantics?
*/
return (ISC_TRUE);
return (ISC_FALSE);
}
/*
* Does 'db' have zone semantics?
*/
return (ISC_TRUE);
return (ISC_FALSE);
}
/*
* Does 'db' have stub semantics?
*/
return (ISC_TRUE);
return (ISC_FALSE);
}
/*
* Is 'db' secure or partially secure?
*/
}
/*
* Is 'db' secure?
*/
}
/*
* Is 'db' persistent?
*/
}
/*
* The origin of the database.
*/
}
/*
* The class of the database.
*/
}
/*
* Begin loading 'db'.
*/
}
/*
* Finish loading 'db'.
*/
}
}
}
unsigned int options) {
/*
* Load master file 'filename' into 'db'.
*/
if (result != ISC_R_SUCCESS)
return (result);
/*
* We always call dns_db_endload(), but we only want to return its
* result if dns_master_loadfile() succeeded. If dns_master_loadfile()
* failed, we want to return the result code it gave us.
*/
if (eresult != ISC_R_SUCCESS &&
return (result);
}
return (ISC_R_NOTIMPLEMENTED);
}
}
/*
* Dump 'db' into master file 'filename' in the 'masterformat' format.
* XXXJT: is it okay to modify the interface to the existing "dump"
* method?
*/
}
/***
*** Version Methods
***/
void
/*
* Open the current version for reading.
*/
}
/*
* Open a new version for reading and writing.
*/
}
void
{
/*
* Attach '*targetp' to 'source'.
*/
}
void
{
/*
* Close version '*versionp'.
*/
}
/***
*** Node Methods
***/
{
/*
* Find the node with name 'name'.
*/
else
}
{
/*
* Find the node with name 'name', passing 'arg' to the database
* implementation.
*/
else
}
{
/*
* Find the node with name 'name'.
*/
}
{
/*
* Find the best match for 'name' and 'type' in version 'version'
* of 'db'.
*/
rdataset, sigrdataset));
else
rdataset, sigrdataset));
}
{
/*
* Find the best match for 'name' and 'type' in version 'version'
* of 'db', passing in 'arg'.
*/
rdataset, sigrdataset));
else
rdataset, sigrdataset));
}
{
/*
* Find the deepest known zonecut which encloses 'name' in 'db'.
*/
}
void
/*
* Attach *targetp to source.
*/
}
void
/*
* Detach *nodep from its node.
*/
}
void
{
/*
* This doesn't check the implementation magic. If we find that
* we need such checks in future then this will be done in the
* method.
*/
} else
}
/*
* Mark as stale all records at 'node' which expire at or before 'now'.
*/
}
void
/*
* Print a textual representation of the contents of the node to
* 'out'.
*/
}
/***
*** DB Iterator Creation
***/
{
/*
* Create an iterator for version 'version' of 'db'.
*/
}
/***
*** Rdataset Methods
***/
{
sigrdataset));
}
{
/*
* Make '*iteratorp' an rdataset iteratator for all rdatasets at
* 'node' in version 'version' of 'db'.
*/
iteratorp));
}
{
/*
* Add 'rdataset' to 'node' in version 'version' of 'db'.
*/
(options & DNS_DBADD_MERGE) != 0);
options, addedrdataset));
}
{
/*
* Remove any rdata in 'rdataset' from 'node' in version 'version' of
* 'db'.
*/
options, newrdataset));
}
{
/*
* Make it so that no rdataset of type 'type' exists at 'node' in
* version version 'version' of 'db'.
*/
}
void
}
{
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS)
goto freenode;
if (result != ISC_R_SUCCESS)
goto freerdataset;
return (result);
}
unsigned int
}
return (0);
}
void
}
{
return (ISC_R_EXISTS);
}
return (ISC_R_NOMEMORY);
}
return (ISC_R_SUCCESS);
}
void
}
return (ISC_R_NOTFOUND);
}
return (NULL);
}
return (ISC_R_NOTIMPLEMENTED);
}
{
salt, salt_length));
return (ISC_R_NOTFOUND);
}
{
return (ISC_R_NOTIMPLEMENTED);
}
{
return (ISC_R_NOTFOUND);
}
void
{
}
/*
* Attach a database to policy zone databases.
* This should only happen when the caller has already ensured that
* it is dealing with a database that understands response policy zones.
*/
void
}
/*
* Finish loading a response policy zone.
*/
return (ISC_R_SUCCESS);
}