db.c revision 982e072a5000bfc072aee8b34f64112cf54369a5
/*
* Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* 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 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: db.c,v 1.80 2005/10/13 01:58:31 marka Exp $ */
/*! \file */
/***
*** Imports
***/
#include <config.h>
#include <dns/callbacks.h>
#include <dns/rdataset.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?
*/
}
/*
* Is 'db' persistent?
*/
}
/*
* The origin of the database.
*/
}
/*
* The class of the database.
*/
}
dns_dbload_t **dbloadp) {
/*
* Begin loading 'db'.
*/
}
/*
* Finish loading 'db'.
*/
}
}
unsigned int options = 0;
/*
* 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);
}
}
/*
* 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'.
*/
}
{
/*
* Find the best match for 'name' and 'type' in version 'version'
* of 'db'.
*/
}
{
/*
* Find the deepest known zonecut which encloses 'name' in 'db'.
*/
}
void
/*
* Attach *targetp to source.
*/
}
void
/*
* Detach *nodep from its node.
*/
}
/*
* 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
***/
{
/*
* Search for an rdataset of type 'type' at 'node' that are in version
* 'version' of 'db'. If found, make 'rdataset' refer to it.
*/
}
{
/*
* 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
}
void
}
{
return (ISC_R_EXISTS);
}
return (ISC_R_NOMEMORY);
}
return (ISC_R_SUCCESS);
}
void
}
return (ISC_R_NOTFOUND);
}