masterdump.c revision d9eebc08497af272b2d44c07f4eb85153dec4253
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2004-2009, 2011 Internet Systems Consortium, Inc. ("ISC")
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * Copyright (C) 1999-2003 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and/or distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * copyright notice and this permission notice appear in all copies.
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier * PERFORMANCE OF THIS SOFTWARE.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews/* $Id: masterdump.c,v 1.110 2011/11/07 23:16:31 each Exp $ */
#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;
#ifdef BIND9
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);
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);
#ifdef BIND9
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
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:
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;
unsigned int nodes;
return (ISC_R_NOMEMORY);
case dns_masterformat_text:
case dns_masterformat_raw:
now32 = 0;
sizeof(rawheader));
return (result);
INSIST(0);
goto fail;
goto fail;
unsigned int interval;
if (interval == 0)
if (usecs == 0) {
if (nodes == 0)
fail:
return (result);
return (result);
return (DNS_R_CONTINUE);
return (result);
FILE *f)
dns_masterformat_text, 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);