masterdump.c revision d6f99498d624d5c5c8ee45067df02e6a6b35a1a3
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * Copyright (C) 2004-2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC")
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * Copyright (C) 1999-2003 Internet Software Consortium.
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * Permission to use, copy, modify, and/or distribute this software for any
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * purpose with or without fee is hereby granted, provided that the above
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * copyright notice and this permission notice appear in all copies.
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
fa342c624a5e7df0d10ef34586f8cfffbcd92c69Brian Wellington * PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <stdlib.h>
#define RETERR(x) do { \
return (_r); \
#define CHECK(x) do { \
if ((x) != ISC_R_SUCCESS) \
goto cleanup; \
struct dns_master_style {
unsigned int ttl_column;
unsigned int class_column;
unsigned int type_column;
unsigned int rdata_column;
unsigned int line_length;
unsigned int tab_width;
unsigned int split_width;
typedef struct dns_totext_ctx {
char * linebreak;
struct dns_dumpctx {
unsigned int magic;
unsigned int references;
FILE *f;
void *done_arg;
unsigned int nodes;
char *file;
char *tmpfile;
static isc_result_t
isc_region_t r;
unsigned int from;
if (ntabs < 0)
ntabs = 0;
if (ntabs > 0) {
return (ISC_R_NOSPACE);
p = r.base;
t = ntabs;
if (n > N_TABS)
n = N_TABS;
return (ISC_R_NOSPACE);
p = r.base;
t = nspaces;
if (n > N_SPACES)
n = N_SPACES;
return (ISC_R_SUCCESS);
static isc_result_t
isc_region_t r;
unsigned int col = 0;
return (DNS_R_TEXTTOOLONG);
return (DNS_R_TEXTTOOLONG);
return (result);
return (DNS_R_TEXTTOOLONG);
return (ISC_R_SUCCESS);
!= ISC_R_SUCCESS) \
return (result); \
static isc_result_t
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
static isc_result_t
unsigned int column;
unsigned int type_start;
column = 0;
!first))
target));
isc_region_t r;
unsigned int length;
return (ISC_R_NOSPACE);
unsigned int class_start;
target);
return (result);
switch (type) {
case dns_rdatatype_keydata:
return (ISC_R_NOSPACE);
return (result);
target));
isc_region_t r;
target));
return (ISC_R_NOSPACE);
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int column;
isc_region_t r;
column = 0;
target));
unsigned int class_start;
return (result);
unsigned int type_start;
return (result);
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
return (ISC_R_UNEXPECTED);
if (question)
return (ISC_R_UNEXPECTED);
return (ISC_R_UNEXPECTED);
static isc_result_t
isc_region_t r;
int newlength;
void *newmem;
return (ISC_R_NOMEMORY);
return (result);
return (result);
return (ISC_R_SUCCESS);
int sig;
sig = 0;
case dns_rdatatype_soa:
case dns_rdatatype_ns:
dump_order_compare(const void *a, const void *b) {
static isc_result_t
isc_region_t r;
buffer, f);
isc_buffer_t b;
return (dumpresult);
goto again;
return (itresult);
static isc_result_t
totallen = 0;
isc_region_t r;
int newlength;
void *newmem;
return (ISC_R_NOMEMORY);
goto restart;
return (result);
return (result);
return (result);
static isc_result_t
buffer, f);
return (result);
return (result);
static isc_result_t
UNUSED(f);
return (ISC_R_NOTIMPLEMENTED);
static isc_result_t
if (need_destroy)
dns_db_t *
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int options;
return (ISC_R_NOMEMORY);
dctx->f = f;
switch (format) {
case dns_masterformat_text:
case dns_masterformat_raw:
case dns_masterformat_map:
INSIST(0);
goto cleanup;
options = 0;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
char *bufmem;
isc_region_t r;
return (ISC_R_NOMEMORY);
case dns_masterformat_text:
case dns_masterformat_raw:
case dns_masterformat_map:
now32 = 0;
rawversion = 0;
INSIST(0);
return (result);
static isc_result_t
char *bufmem;
unsigned int nodes;
return (ISC_R_NOMEMORY);
dctx->f);
goto cleanup;
goto cleanup;
DNS_STYLEFLAG_REL_DATA) != 0)
goto cleanup;
goto cleanup;
unsigned int interval;
if (interval == 0)
if (usecs == 0) {
if (nodes == 0)
return (result);
return (result);
return (DNS_R_CONTINUE);
return (result);
FILE *f)
return (result);
return (result);
static isc_result_t
int tempnamelen;
return (ISC_R_NOMEMORY);
goto cleanup;
goto cleanup;
*fp = f;
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_NOMEMORY);
goto cleanup;
(void)isc_stdio_close(f);
goto cleanup;
return (DNS_R_CONTINUE);
return (result);
char *tempname;
return (result);
goto cleanup;
return (result);
FILE *f)
char *bufmem;
return (ISC_R_UNEXPECTED);
return (ISC_R_NOMEMORY);
goto failure;
goto failure;
return (result);
return (ISC_R_UNEXPECTED);
style, f);
(void)isc_stdio_close(f);
return (ISC_R_UNEXPECTED);
return (ISC_R_UNEXPECTED);
return (result);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);