masterdump.c revision 47b7dfffe5d806c6a5e99ef17f07bcde812c2132
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
761d135ed686601f36fe3d0d4aaa6bf41287bb0fEvan Hunt * 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
761d135ed686601f36fe3d0d4aaa6bf41287bb0fEvan Hunt * copyright notice and this permission notice appear in all copies.
761d135ed686601f36fe3d0d4aaa6bf41287bb0fEvan Hunt * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
761d135ed686601f36fe3d0d4aaa6bf41287bb0fEvan Hunt * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
761d135ed686601f36fe3d0d4aaa6bf41287bb0fEvan Hunt * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
761d135ed686601f36fe3d0d4aaa6bf41287bb0fEvan Hunt * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
761d135ed686601f36fe3d0d4aaa6bf41287bb0fEvan Hunt * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
/* $Id: masterdump.c,v 1.96 2009/01/17 14:33:54 fdupont Exp $ */
#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;
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;
column = 0;
!first))
target));
isc_region_t r;
unsigned int length;
return (ISC_R_NOSPACE);
unsigned int class_start;
target);
return (result);
unsigned int type_start;
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 const char *trustnames[] = {
static isc_result_t
isc_region_t r;
sizeof(trustnames[0])));
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);
static isc_result_t
if (need_destroy)
dns_db_t *
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);
return (ISC_R_UNEXPECTED);
return (result);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);