1/* 2 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 13 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 * PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17#ifndef DNS_MASTERDUMP_H 18#define DNS_MASTERDUMP_H 1 19 20/*! \file dns/masterdump.h */ 21 22/*** 23 *** Imports 24 ***/ 25 26#include <stdio.h> 27 28#include <dns/types.h> 29 30/*** 31 *** Types 32 ***/ 33 34typedef struct dns_master_style dns_master_style_t; 35 36/*** 37 *** Definitions 38 ***/ 39 40/* 41 * Flags affecting master file formatting. Flags 0x0000FFFF 42 * define the formatting of the rdata part and are defined in 43 * rdata.h. 44 */ 45 46/*% Omit the owner name when possible. */ 47#define DNS_STYLEFLAG_OMIT_OWNER 0x000010000ULL 48 49/*% 50 * Omit the TTL when possible. If DNS_STYLEFLAG_TTL is 51 * also set, this means no TTLs are ever printed 52 * because $TTL directives are generated before every 53 * change in the TTL. In this case, no columns need to 54 * be reserved for the TTL. Master files generated with 55 * these options will be rejected by BIND 4.x because it 56 * does not recognize the $TTL directive. 57 * 58 * If DNS_STYLEFLAG_TTL is not also set, the TTL will be 59 * omitted when it is equal to the previous TTL. 60 * This is correct according to RFC1035, but the 61 * TTLs may be silently misinterpreted by older 62 * versions of BIND which use the SOA MINTTL as a 63 * default TTL value. 64 */ 65#define DNS_STYLEFLAG_OMIT_TTL 0x000020000ULL 66 67/*% Omit the class when possible. */ 68#define DNS_STYLEFLAG_OMIT_CLASS 0x000040000ULL 69 70/*% Output $TTL directives. */ 71#define DNS_STYLEFLAG_TTL 0x000080000ULL 72 73/*% 74 * Output $ORIGIN directives and print owner names relative to 75 * the origin when possible. 76 */ 77#define DNS_STYLEFLAG_REL_OWNER 0x000100000ULL 78 79/*% Print domain names in RR data in relative form when possible. 80 For this to take effect, DNS_STYLEFLAG_REL_OWNER must also be set. */ 81#define DNS_STYLEFLAG_REL_DATA 0x000200000ULL 82 83/*% Print the trust level of each rdataset. */ 84#define DNS_STYLEFLAG_TRUST 0x000400000ULL 85 86/*% Print negative caching entries. */ 87#define DNS_STYLEFLAG_NCACHE 0x000800000ULL 88 89/*% Never print the TTL. */ 90#define DNS_STYLEFLAG_NO_TTL 0x001000000ULL 91 92/*% Never print the CLASS. */ 93#define DNS_STYLEFLAG_NO_CLASS 0x002000000ULL 94 95/*% Report re-signing time. */ 96#define DNS_STYLEFLAG_RESIGN 0x004000000ULL 97 98/*% Don't printout the cryptographic parts of DNSSEC records. */ 99#define DNS_STYLEFLAG_NOCRYPTO 0x008000000ULL 100 101/*% Comment out data by prepending with ";" */ 102#define DNS_STYLEFLAG_COMMENTDATA 0x010000000ULL 103 104/*** 105 *** Constants 106 ***/ 107 108/*% 109 * The style used for debugging, "dig" output, etc. 110 */ 111extern const dns_master_style_t dns_master_style_debug; 112 113/*** 114 *** Functions 115 ***/ 116 117isc_result_t 118dns_master_rdatasettotext(dns_name_t *owner_name, 119 dns_rdataset_t *rdataset, 120 const dns_master_style_t *style, 121 isc_buffer_t *target); 122/*%< 123 * Convert 'rdataset' to text format, storing the result in 'target'. 124 * 125 * Notes: 126 *\li The rdata cursor position will be changed. 127 * 128 * Requires: 129 *\li 'rdataset' is a valid non-question rdataset. 130 * 131 *\li 'rdataset' is not empty. 132 */ 133 134isc_result_t 135dns_master_questiontotext(dns_name_t *owner_name, 136 dns_rdataset_t *rdataset, 137 const dns_master_style_t *style, 138 isc_buffer_t *target); 139 140isc_result_t 141dns_master_stylecreate2(dns_master_style_t **style, unsigned int flags, 142 unsigned int ttl_column, unsigned int class_column, 143 unsigned int type_column, unsigned int rdata_column, 144 unsigned int line_length, unsigned int tab_width, 145 unsigned int split_width); 146void 147dns_master_styledestroy(dns_master_style_t **style); 148 149#endif /* DNS_MASTERDUMP_H */ 150