Commit b03b67a6 authored by Bob Halley's avatar Bob Halley
Browse files

add base, dns_db_load

parent f305d866
...@@ -27,15 +27,15 @@ ...@@ -27,15 +27,15 @@
#include "rbtdb.h" #include "rbtdb.h"
dns_result_t dns_result_t
dns_db_create(isc_mem_t *mctx, char *db_type, isc_boolean_t cache, dns_db_create(isc_mem_t *mctx, char *db_type, dns_name_t *base,
dns_rdataclass_t class, isc_boolean_t cache, dns_rdataclass_t class,
unsigned int argc, char *argv[], dns_db_t **dbp) unsigned int argc, char *argv[], dns_db_t **dbp)
{ {
/* find the create method for 'db_type', and call it. */ /* find the create method for 'db_type', and call it. */
/* Temporary minor hack... */ /* Temporary minor hack... */
if (strcasecmp(db_type, "rbt") == 0) if (strcasecmp(db_type, "rbt") == 0)
return (dns_rbtdb_create(mctx, cache, class, argc, argv, return (dns_rbtdb_create(mctx, base, cache, class, argc, argv,
dbp)); dbp));
return (DNS_R_NOTIMPLEMENTED); return (DNS_R_NOTIMPLEMENTED);
...@@ -97,6 +97,14 @@ dns_db_iszone(dns_db_t *db) { ...@@ -97,6 +97,14 @@ dns_db_iszone(dns_db_t *db) {
return (!db->cache); return (!db->cache);
} }
dns_result_t
dns_db_load(dns_db_t *db, char *filename) {
REQUIRE(DNS_DB_VALID(db));
return (db->methods->load(db, filename));
}
/* /*
* Version Operations. * Version Operations.
*/ */
......
...@@ -53,11 +53,13 @@ ...@@ -53,11 +53,13 @@
#include <dns/types.h> #include <dns/types.h>
#include <dns/result.h> #include <dns/result.h>
#include <dns/name.h>
typedef struct dns_dbmethods { typedef struct dns_dbmethods {
void (*attach)(dns_db_t *source, dns_db_t **targetp); void (*attach)(dns_db_t *source, dns_db_t **targetp);
void (*detach)(dns_db_t **dbp); void (*detach)(dns_db_t **dbp);
void (*shutdown)(dns_db_t *db); void (*shutdown)(dns_db_t *db);
dns_result_t (*load)(dns_db_t *db, char *filename);
void (*currentversion)(dns_db_t *db, void (*currentversion)(dns_db_t *db,
dns_dbversion_t **versionp); dns_dbversion_t **versionp);
dns_result_t (*newversion)(dns_db_t *db, dns_result_t (*newversion)(dns_db_t *db,
...@@ -103,11 +105,13 @@ struct dns_db { ...@@ -103,11 +105,13 @@ struct dns_db {
dns_dbmethods_t * methods; dns_dbmethods_t * methods;
isc_boolean_t cache; isc_boolean_t cache;
dns_rdataclass_t class; dns_rdataclass_t class;
dns_name_t base;
isc_mem_t * mctx;
}; };
dns_result_t dns_result_t
dns_db_create(isc_mem_t *mctx, char *db_type, isc_boolean_t cache, dns_db_create(isc_mem_t *mctx, char *db_type, dns_name_t *base,
dns_rdataclass_t class, isc_boolean_t cache, dns_rdataclass_t class,
unsigned int argc, char *argv[], dns_db_t **dbp); unsigned int argc, char *argv[], dns_db_t **dbp);
void void
...@@ -128,6 +132,9 @@ dns_db_iscache(dns_db_t *db); ...@@ -128,6 +132,9 @@ dns_db_iscache(dns_db_t *db);
isc_boolean_t isc_boolean_t
dns_db_iszone(dns_db_t *db); dns_db_iszone(dns_db_t *db);
dns_result_t
dns_db_load(dns_db_t *db, char *filename);
void void
dns_db_currentversion(dns_db_t *db, dns_dbversion_t **versionp); dns_db_currentversion(dns_db_t *db, dns_dbversion_t **versionp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment