db_test.c revision ff9104607ce6ff8f9a70215efc0c434851c66782
/*
* Copyright (C) 1999 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM 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.
*/
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> /* XXX Naughty. */
#include <isc/assertions.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/compress.h>
static void
char b[255];
}
static void
isc_region_t r;
dns_name_toregion(name, &r);
}
int
char s[1000];
char t[1000];
char b[255];
isc_region_t r;
char basetext[1000];
char dbtype[128];
int ch;
int i, rcount = 0, v;
switch (ch) {
case 'z':
break;
case 'd':
break;
case 't':
break;
case 'p':
break;
case 'v':
break;
}
}
if (argc < 1) {
exit(1);
}
&db);
if (result != DNS_R_SUCCESS) {
printf("dns_db_create(), DB type '%s', failed: %s\n",
exit(1);
}
if (result != DNS_R_SUCCESS) {
printf("couldn't load master file: %s\n",
exit(1);
}
printf("loaded\n");
for (i = 0; i < 100; i++)
if (verbose) {
for (i = 0; i < rcount; i++)
printf("open version %d (%p)\n", i,
rversions[i]);
}
if (strcmp(s, "!R") == 0) {
if (rcount == 100) {
printf("too many open versions\n");
continue;
}
rcount++;
continue;
} else if (strcmp(s, "!W") == 0) {
printf("using existing future version\n");
continue;
}
if (result != DNS_R_SUCCESS)
else
printf("newversion\n");
continue;
} else if (strcmp(s, "!C") == 0) {
continue;
printf("closing future version\n");
} else {
for (i = 0; i < rcount; i++) {
printf("closing open version %d\n",
i);
break;
}
}
}
continue;
} else if (strcmp(s, "!X") == 0) {
continue;
printf("aborting future version\n");
} else {
for (i = 0; i < rcount; i++) {
printf("closing open version %d\n",
i);
break;
}
}
}
continue;
} else if (strcmp(s, "!A") == 0) {
if (addmode)
else
continue;
} else if (strcmp(s, "!D") == 0) {
if (delmode)
else
continue;
} else if (strstr(s, "!V") == s) {
v = atoi(&s[2]);
if (v >= rcount) {
printf("unknown open version %d\n", v);
continue;
printf("version %d is not open\n", v);
continue;
}
printf("switching to open version %d\n", v);
continue;
}
&target);
if (result != DNS_R_SUCCESS) {
continue;
}
if (result == DNS_R_NOTFOUND)
printf("not found\n");
else if (result != DNS_R_SUCCESS)
else {
printf("success\n");
if (printnode)
&rdataset);
if (result == DNS_R_NOTFOUND)
else if (result != DNS_R_SUCCESS)
else {
isc_buffer_init(&text, t, sizeof t,
&name,
&text);
isc_buffer_used(&text, &r);
if (result == DNS_R_SUCCESS)
(char *)r.base);
else
printf("%s\n",
if (addmode) {
node,
&rdataset);
if (result != DNS_R_SUCCESS)
printf("%s\n",
} else if (delmode) {
node,
type);
if (result != DNS_R_SUCCESS)
printf("%s\n",
}
}
}
}
dns_db_detach(&db);
return (0);
}