2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: masterdump.h,v 1.22.2.1 2004/03/09 06:11:18 marka Exp $ */
20 #ifndef DNS_MASTERDUMP_H
21 #define DNS_MASTERDUMP_H 1
31 #include <dns/types.h>
38 * Style options for masterfile dumps. This struct is currently
39 * opaque, so applications cannot define their own style but have
40 * to choose a predefined style. A more flexible interface may
41 * be exported in the future.
44 typedef struct dns_master_style dns_master_style_t;
53 * The default master file style.
55 * This uses $TTL directives to avoid the need to dedicate a
56 * tab stop for the TTL. The class is only printed for the first
57 * rrset in the file and shares a tab stop with the RR type.
59 LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_default;
62 * A master file style that prints explicit TTL values on each
63 * record line, never using $TTL statements. The TTL has a tab
64 * stop of its own, but the class and type share one.
66 LIBDNS_EXTERNAL_DATA extern const dns_master_style_t
67 dns_master_style_explicitttl;
70 * A master style format designed for cache files. It prints explicit TTL
71 * values on each record line and never uses $ORIGIN or relative names.
73 extern const dns_master_style_t dns_master_style_cache;
76 * A master style that prints name, ttl, class, type, and value on
77 * every line. Similar to explicitttl above, but more verbose.
78 * Intended for generating master files which can be easily parsed
79 * by perl scripts and similar applications.
81 extern const dns_master_style_t dns_master_style_simple;
84 * The style used for debugging, "dig" output, etc.
86 LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_debug;
93 dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db,
94 dns_dbversion_t *version,
95 const dns_master_style_t *style, FILE *f);
97 * Dump the database 'db' to the steam 'f' in RFC1035 master
98 * file format, in the style defined by 'style'
99 * (e.g., &dns_default_master_style_default)
101 * Temporary dynamic memory may be allocated from 'mctx'.
106 * Any database or rrset iterator error.
107 * Any dns_rdata_totext() error code.
111 dns_master_dump(isc_mem_t *mctx, dns_db_t *db,
112 dns_dbversion_t *version,
113 const dns_master_style_t *style, const char *filename);
115 * Dump the database 'db' to the file 'filename' in RFC1035 master
116 * file format, in the style defined by 'style'
117 * (e.g., &dns_default_master_style_default)
119 * Temporary dynamic memory may be allocated from 'mctx'.
124 * Any database or rrset iterator error.
125 * Any dns_rdata_totext() error code.
129 dns_master_rdatasettotext(dns_name_t *owner_name,
130 dns_rdataset_t *rdataset,
131 const dns_master_style_t *style,
132 isc_buffer_t *target);
134 * Convert 'rdataset' to text format, storing the result in 'target'.
137 * The rdata cursor position will be changed.
140 * 'rdataset' is a valid non-question rdataset.
142 * 'rdataset' is not empty.
146 dns_master_questiontotext(dns_name_t *owner_name,
147 dns_rdataset_t *rdataset,
148 const dns_master_style_t *style,
149 isc_buffer_t *target);
151 * Print a text representation of 'rdataset', a pseudo-rdataset
152 * representing a questino.
155 * 'rdataset' is a valid question rdataset.
157 * 'rdataset' is not empty.
161 dns_rdataset_towire(dns_rdataset_t *rdataset,
162 dns_name_t *owner_name,
163 dns_compress_t *cctx,
164 isc_buffer_t *target,
165 unsigned int *countp);
168 dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db,
169 dns_dbversion_t *version,
170 dns_dbnode_t *node, dns_name_t *name,
171 const dns_master_style_t *style,
175 dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
176 dns_dbnode_t *node, dns_name_t *name,
177 const dns_master_style_t *style, const char *filename);
181 #endif /* DNS_MASTERDUMP_H */