db.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1999-2001, 2003-2005, 2007-2009, 2011-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/.
*/
/*! \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);
}
/**
* Attach a notify-on-update function the database
*/
void *fn_arg)
{
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
}
void *fn_arg)
{
{
{
sizeof(dns_dbonupdatelistener_t));
return (ISC_R_SUCCESS);
}
}
return (ISC_R_NOTFOUND);
}