db_test.c revision b6b21d80450f81d873d7e8cd21e7b72fdf512507
13faa91230bde46da937bf33010b9accc5bdeb59sd * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
13faa91230bde46da937bf33010b9accc5bdeb59sd * Copyright (C) 1999-2001 Internet Software Consortium.
13faa91230bde46da937bf33010b9accc5bdeb59sd * Permission to use, copy, modify, and distribute this software for any
13faa91230bde46da937bf33010b9accc5bdeb59sd * purpose with or without fee is hereby granted, provided that the above
13faa91230bde46da937bf33010b9accc5bdeb59sd * copyright notice and this permission notice appear in all copies.
13faa91230bde46da937bf33010b9accc5bdeb59sd * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
13faa91230bde46da937bf33010b9accc5bdeb59sd * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13faa91230bde46da937bf33010b9accc5bdeb59sd * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13faa91230bde46da937bf33010b9accc5bdeb59sd * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13faa91230bde46da937bf33010b9accc5bdeb59sd * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13faa91230bde46da937bf33010b9accc5bdeb59sd * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13faa91230bde46da937bf33010b9accc5bdeb59sd * PERFORMANCE OF THIS SOFTWARE.
13faa91230bde46da937bf33010b9accc5bdeb59sd/* $Id: db_test.c,v 1.60 2005/03/16 22:22:27 marka Exp $ */
13faa91230bde46da937bf33010b9accc5bdeb59sd * Principal Author: Bob Halley
13faa91230bde46da937bf33010b9accc5bdeb59sdtypedef struct dbinfo {
13faa91230bde46da937bf33010b9accc5bdeb59sdstatic int pause_every = 0;
13faa91230bde46da937bf33010b9accc5bdeb59sdstatic void
13faa91230bde46da937bf33010b9accc5bdeb59sd printf("%s%sresult %08x: %s\n", message, (len == 0U) ? "" : " ",
13faa91230bde46da937bf33010b9accc5bdeb59sdstatic void
13faa91230bde46da937bf33010b9accc5bdeb59sdprint_rdataset(dns_name_t *name, dns_rdataset_t *rdataset) {
13faa91230bde46da937bf33010b9accc5bdeb59sd char t[1000];
13faa91230bde46da937bf33010b9accc5bdeb59sd result = dns_rdataset_totext(rdataset, name, ISC_FALSE, ISC_FALSE,
13faa91230bde46da937bf33010b9accc5bdeb59sdstatic void
25351652d920ae27c5a56c199da581033ce763f6Vuong Nguyenprint_rdatasets(dns_name_t *name, dns_rdatasetiter_t *rdsiter) {
13faa91230bde46da937bf33010b9accc5bdeb59sd result = dns_name_fromtext(origin, &source, dns_rootname, ISC_FALSE,
13faa91230bde46da937bf33010b9accc5bdeb59sd if (dns_name_compare(dns_db_origin(dbi->db), origin) == 0)
13faa91230bde46da937bf33010b9accc5bdeb59sdstatic void
186d582bd9dbcd38e0aeea49036d47d3426a3536Surya Prakki dns_db_currentversion(dbi->db, &dbi->iversion);
13faa91230bde46da937bf33010b9accc5bdeb59sd result = dns_dbiterator_current(dbi->dbiterator, &node, name);
13faa91230bde46da937bf33010b9accc5bdeb59sd if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN)
13faa91230bde46da937bf33010b9accc5bdeb59sd result = dns_db_allrdatasets(dbi->db, node, dbi->iversion, 0,
13faa91230bde46da937bf33010b9accc5bdeb59sdload(const char *filename, const char *origintext, isc_boolean_t cache) {
13faa91230bde46da937bf33010b9accc5bdeb59sd unsigned int i;
13faa91230bde46da937bf33010b9accc5bdeb59sd for (i = 0; i < MAXVERSIONS; i++)
13faa91230bde46da937bf33010b9accc5bdeb59sd for (i = 0; i < MAXHOLD; i++)
13faa91230bde46da937bf33010b9accc5bdeb59sd result = dns_name_fromtext(origin, &source, dns_rootname, ISC_FALSE,
13faa91230bde46da937bf33010b9accc5bdeb59sd if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
13faa91230bde46da937bf33010b9accc5bdeb59sd if (dns_dbtable_add(dbtable, dbi->db) != ISC_R_SUCCESS) {
13faa91230bde46da937bf33010b9accc5bdeb59sdstatic void
13faa91230bde46da937bf33010b9accc5bdeb59sd for (dbi = ISC_LIST_HEAD(dbs); dbi != NULL; dbi = dbi_next) {
13faa91230bde46da937bf33010b9accc5bdeb59sd continue; \
13faa91230bde46da937bf33010b9accc5bdeb59sd char s[1000];
13faa91230bde46da937bf33010b9accc5bdeb59sd char b[255];
13faa91230bde46da937bf33010b9accc5bdeb59sd unsigned int addopts;
13faa91230bde46da937bf33010b9accc5bdeb59sd RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
13faa91230bde46da937bf33010b9accc5bdeb59sd RUNTIME_CHECK(dns_dbtable_create(mctx, dns_rdataclass_in, &dbtable) ==
13faa91230bde46da937bf33010b9accc5bdeb59sd while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:Q:glpqvT"))
13faa91230bde46da937bf33010b9accc5bdeb59sd switch (ch) {
b64bfe7dc77dc5c5561cdcd10c80b0b550701a24Trang Do result = load(isc_commandline_argument, origintext,
13faa91230bde46da937bf33010b9accc5bdeb59sd * Some final initialization...
13faa91230bde46da937bf33010b9accc5bdeb59sd while (!done) {
25351652d920ae27c5a56c199da581033ce763f6Vuong Nguyen dns_db_closeversion(dbi->db, &dbi->version, ISC_TRUE);
if (addmode)
if (delmode)
if (holdmode)
if (printnode)
if (find_zonecut)
if (noexact_zonecut)
zcoptions = 0;
if (noexact_zonecut)
&db);
if (!quiet) {
&tb1);
if (noexact_zonecut)
if (!quiet) {
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_GLUE:
case DNS_R_CNAME:
case DNS_R_ZONECUT:
case DNS_R_DNAME:
case DNS_R_DELEGATION:
case DNS_R_NXRRSET:
if (holdmode) {
MAXHOLD);
node;
case DNS_R_NXDOMAIN:
if (quiet)
if (printnode)
&rdsiter);
if (!quiet)
if (!quiet)
if (!quiet)
addopts = 0;
0, &rdataset,
if (printnode)
if (printnode)
if (holdmode) {
if (time_lookups) {
unload_all();
if (!quiet)