3b7f610bec248f85e25a52a0ad7dec9894389ca5Tinderbox User * Copyright (C) 1999-2009, 2011-2017 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews#define DNS_DCTX_MAGIC ISC_MAGIC('D', 'c', 't', 'x')
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews#define DNS_DCTX_VALID(d) ISC_MAGIC_VALID(d, DNS_DCTX_MAGIC)
e63d63dc8510c669e1575b2762265842e8783822Evan Hunt dns_masterstyle_flags_t flags; /* DNS_STYLEFLAG_* */
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * The maximum length of the newline+indentation that is output
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * when inserting a line break in an RR. This effectively puts an
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * upper limits on the value of "rdata_column", because if it is
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * very large, the tabs and spaces needed to reach it will not fit.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Context structure for a masterfile dump in progress.
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson char linebreak_buf[DNS_TOTEXT_LINEBREAK_MAXLEN];
459d31fa838619cee728a90984d27d18345dc18aAndreas GustafssonLIBDNS_EXTERNAL_DATA const dns_master_style_t
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * A style suitable for dns_rdataset_totext().
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt * Similar, but indented (i.e., prepended with dns_master_indentstr).
1d761cb453c76353deb8423c78e98d00c5f86ffaEvan Hunt * Similar, but with each line commented out.
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk * YAML style
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt * Default indent string.
b66b333f59cf51ef87f973084a5023acd9317fb2Evan HuntLIBDNS_EXTERNAL_DATA const char *dns_master_indentstr = "\t";
68e4926b2262571e004b4be00b905ec776c01d9cMichael Graffstatic char tabs[N_TABS+1] = "\t\t\t\t\t\t\t\t\t\t";
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews /* dns_master_dumpinc() */
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_result_t (*dumpsets)(isc_mem_t *mctx, dns_name_t *name,
e672951ed28b2e9cc7a19c3d7fa4a258382f981cAutomatic Updater#define NXDOMAIN(x) (((x)->attributes & DNS_RDATASETATTR_NXDOMAIN) != 0)
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Output tabs and spaces to go from column '*current' to
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * column 'to', and update '*current' to reflect the new
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * current column.
42a5f9c8f535fb2a6d1cbfaa38533176e1f1667aBob Halleyindent(unsigned int *current, unsigned int to, int tabwidth,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson unsigned char *p;
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrencetotext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) {
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson dns_fixedname_init(&ctx->origin_fixname);
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * Set up the line break string if needed.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson if ((ctx->style.flags & DNS_STYLEFLAG_MULTILINE) != 0) {
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk for (i = 0; i < dns_master_indent; i++) {
1d761cb453c76353deb8423c78e98d00c5f86ffaEvan Hunt if ((ctx->style.flags & DNS_STYLEFLAG_COMMENTDATA) != 0) {
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence result = indent(&col, ctx->style.rdata_column,
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff * Do not return ISC_R_NOSPACE if the line break string
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * buffer is too small, because that would just make
47b7dfffe5d806c6a5e99ef17f07bcde812c2132Francis Dupont * dump_rdataset() retry indefinitely with ever
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * bigger target buffers. That's a different buffer,
2e715dbdc263f859c01b57a9d733c1dfbf28b90eBob Halley * so it won't help. Use DNS_R_TEXTTOOLONG as a substitute.
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk return (result); \
e482a1c91ecb5e47bc26617bf310d6b5c41fad91Andreas Gustafssonstr_totext(const char *source, isc_buffer_t *target) {
e482a1c91ecb5e47bc26617bf310d6b5c41fad91Andreas Gustafsson unsigned int l;
e482a1c91ecb5e47bc26617bf310d6b5c41fad91Andreas Gustafsson isc_buffer_availableregion(target, ®ion);
47d89fcd4fb850b066f87dc3313afe1cfe92cd99Mark Andrewsncache_summary(dns_rdataset_t *rdataset, isc_boolean_t omit_final_dot,
47d89fcd4fb850b066f87dc3313afe1cfe92cd99Mark Andrews CHECK(dns_name_totext(&name, omit_final_dot, target));
47d89fcd4fb850b066f87dc3313afe1cfe92cd99Mark Andrews CHECK(dns_rdatatype_totext(rds.covers, target));
47d89fcd4fb850b066f87dc3313afe1cfe92cd99Mark Andrews CHECK(dns_rdata_tofmttext(&rdata, dns_rootname,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Convert 'rdataset' to master file text format according to 'ctx',
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * storing the result in 'target'. If 'owner_name' is NULL, it
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * is omitted; otherwise 'owner_name' must be valid and have at least
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk unsigned int i;
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews rdataset->attributes |= DNS_RDATASETATTR_LOADORDER;
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson current_ttl_valid = ctx->current_ttl_valid;
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk for (i = 0; i < dns_master_indent; i++)
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk * YAML enumerator?
1d761cb453c76353deb8423c78e98d00c5f86ffaEvan Hunt if ((ctx->style.flags & DNS_STYLEFLAG_COMMENTDATA) != 0)
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * Owner name.
c801dd02ed98321f3ccab93c159a1dce61961c58Bob Halley ! ((ctx->style.flags & DNS_STYLEFLAG_OMIT_OWNER) != 0 &&
a8da00ef95ba37b9d071c2b8db1a0c967e060106Mark Andrews RETERR(dns_name_totext(name, omit_final_dot, target));
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews if ((ctx->style.flags & DNS_STYLEFLAG_NO_TTL) == 0 &&
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews !((ctx->style.flags & DNS_STYLEFLAG_OMIT_TTL) != 0 &&
cd750f6e7449678173e8cfe080ae0bf3dcb424cfEvan Hunt if ((ctx->style.flags & DNS_STYLEFLAG_TTL_UNITS) != 0) {
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * If the $TTL directive is not in use, the TTL we
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * just printed becomes the default for subsequent RRs.
c801dd02ed98321f3ccab93c159a1dce61961c58Bob Halley if ((ctx->style.flags & DNS_STYLEFLAG_TTL) == 0) {
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews if ((ctx->style.flags & DNS_STYLEFLAG_NO_CLASS) == 0 &&
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews ((ctx->style.flags & DNS_STYLEFLAG_OMIT_CLASS) == 0 ||
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman if ((ctx->style.flags & DNS_STYLEFLAG_UNKNOWNFORMAT) != 0)
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt if ((rdataset->attributes & DNS_RDATASETATTR_NEGATIVE) != 0) {
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt if ((rdataset->attributes & DNS_RDATASETATTR_NEGATIVE) != 0)
d6f99498d624d5c5c8ee45067df02e6a6b35a1a3Mark Andrews if ((ctx->style.flags & DNS_STYLEFLAG_KEYDATA) != 0) {
d6f99498d624d5c5c8ee45067df02e6a6b35a1a3Mark Andrews /* FALLTHROUGH */
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman if ((ctx->style.flags & DNS_STYLEFLAG_UNKNOWNFORMAT) != 0)
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman result = dns_rdatatype_tounknowntext(type, target);
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman result = dns_rdatatype_totext(type, target);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt if ((rdataset->attributes & DNS_RDATASETATTR_NEGATIVE) != 0) {
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk for (i = 0; i < dns_master_indent; i++)
47d89fcd4fb850b066f87dc3313afe1cfe92cd99Mark Andrews * Print a summary of the cached records which make
47d89fcd4fb850b066f87dc3313afe1cfe92cd99Mark Andrews * up the negative response.
47d89fcd4fb850b066f87dc3313afe1cfe92cd99Mark Andrews RETERR(ncache_summary(rdataset, omit_final_dot,
4acedf9e13783c32a48133d29ed4be128b3fb1ffMark Andrews (unsigned int)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Update the ctx state to reflect what we just printed.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * This is done last, only when we are sure we will return
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * success, because this function may be called multiple
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * times with increasing buffer sizes until it succeeds,
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * and failed attempts must not update the state prematurely.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson ctx->current_ttl_valid = current_ttl_valid;
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Print the name, type, and class of an empty rdataset,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * such as those used to represent the question section
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * of a DNS message.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson /* Owner name */
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman if ((ctx->style.flags & DNS_STYLEFLAG_UNKNOWNFORMAT) != 0)
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman result = dns_rdataclass_tounknowntext(rdataset->rdclass,
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman result = dns_rdataclass_totext(rdataset->rdclass,
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman if ((ctx->style.flags & DNS_STYLEFLAG_UNKNOWNFORMAT) != 0)
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman result = dns_rdatatype_tounknowntext(rdataset->type,
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman result = dns_rdatatype_totext(rdataset->type,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafssondns_rdataset_totext(dns_rdataset_t *rdataset,
bfe313722d5b2eff6c80336ed1f19c2f99a53de6Andreas Gustafsson result = totext_ctx_init(&dns_master_style_debug, &ctx);
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson "could not set master file style");
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * The caller might want to give us an empty owner
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * name (e.g. if they are outputting into a master
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * file and this rdataset has the same name as the
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * previous one.)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson if (dns_name_countlabels(owner_name) == 0)
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence return (question_totext(rdataset, owner_name, &ctx,
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence return (rdataset_totext(rdataset, owner_name, &ctx,
421551db8a61283420b0b6aed4ac28f9d76b9770Andreas Gustafssondns_master_rdatasettotext(dns_name_t *owner_name,
421551db8a61283420b0b6aed4ac28f9d76b9770Andreas Gustafsson "could not set master file style");
421551db8a61283420b0b6aed4ac28f9d76b9770Andreas Gustafsson return (rdataset_totext(rdataset, owner_name, &ctx,
421551db8a61283420b0b6aed4ac28f9d76b9770Andreas Gustafssondns_master_questiontotext(dns_name_t *owner_name,
bed7a352934efc8055902d83c750dca2d0cd6aaaAndreas Gustafsson "could not set master file style");
bed7a352934efc8055902d83c750dca2d0cd6aaaAndreas Gustafsson return (question_totext(rdataset, owner_name, &ctx,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Print an rdataset. 'buffer' is a scratch buffer, which must have been
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * dynamically allocated by the caller. It must be large enough to
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * hold the result from dns_ttl_totext(). If more than that is needed,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * the buffer will be grown automatically.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafssondump_rdataset(isc_mem_t *mctx, dns_name_t *name, dns_rdataset_t *rdataset,
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * Output a $TTL directive if needed.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson if ((ctx->style.flags & DNS_STYLEFLAG_TTL) != 0) {
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson if (ctx->current_ttl_valid == ISC_FALSE ||
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson if ((ctx->style.flags & DNS_STYLEFLAG_COMMENT) != 0)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson fprintf(f, "$TTL %u\t; %.*s\n", rdataset->ttl,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Generate the text representation of the rdataset into
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * the buffer. If the buffer is too small, grow it.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson result = rdataset_totext(rdataset, name, ctx,
4e57d3ff7d92abdef4b0b6aebc23a9dfae2ba040Andreas Gustafsson isc_mem_put(mctx, buffer->base, buffer->length);
d8e34837cd6c88c42b3ecdb9107a43ecf8252e79David Lawrence * Write the buffer contents to the master file.
d8e34837cd6c88c42b3ecdb9107a43ecf8252e79David Lawrence result = isc_stdio_write(r.base, 1, (size_t)r.length, f, NULL);
c0d0a59d1b665423b8a0d1829d0f0da121cb3473Andreas Gustafsson "master file write failed: %s",
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * Define the order in which rdatasets should be printed in zone
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * files. We will print SOA and NS records before others, SIGs
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * immediately following the things they sign, and order everything
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * else by RR number. This is all just for aesthetics and
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * compatibility with buggy software that expects the SOA to be first;
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * the DNS specifications allow any order.
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafssondump_order_compare(const void *a, const void *b) {
e694d4e2016c0ab1f3c2bbe493c45379770e830dDavid Lawrence return (dump_order(*((const dns_rdataset_t * const *) a)) -
e694d4e2016c0ab1f3c2bbe493c45379770e830dDavid Lawrence dump_order(*((const dns_rdataset_t * const *) b)));
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * Dump all the rdatasets of a domain name to a master file. We make
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * a "best effort" attempt to sort the RRsets in a nice order, but if
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * there are more than MAXSORT RRsets, we punt and only sort them in
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * groups of MAXSORT. This is not expected to ever happen in practice
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * since much less than 64 RR types have been registered with the
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * IANA, so far, and the output will be correct (though not
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * aesthetically pleasing) even if it does happen.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrewsdump_rdatasets_text(isc_mem_t *mctx, dns_name_t *name,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews dns_rdatasetiter_t *rdsiter, dns_totext_ctx_t *ctx,
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson itresult = dns_rdatasetiter_first(rdsiter);
692ae2fff922f1c072169d1ddda8e600cb572a9bMark Andrews if (itresult == ISC_R_SUCCESS && ctx->neworigin != NULL) {
692ae2fff922f1c072169d1ddda8e600cb572a9bMark Andrews itresult = dns_name_totext(ctx->neworigin, ISC_FALSE, buffer);
692ae2fff922f1c072169d1ddda8e600cb572a9bMark Andrews fprintf(f, "$ORIGIN %.*s\n", (int) r.length, (char *) r.base);
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson itresult == ISC_R_SUCCESS && i < MAXSORT;
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson itresult = dns_rdatasetiter_next(rdsiter), i++) {
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson dns_rdatasetiter_current(rdsiter, &rdatasets[i]);
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson qsort(sorted, n, sizeof(sorted[0]), dump_order_compare);
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson for (i = 0; i < n; i++) {
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk unsigned int j;
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk for (j = 0; j < dns_master_indent; j++)
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt if (((rds->attributes & DNS_RDATASETATTR_NEGATIVE) != 0) &&
e482a1c91ecb5e47bc26617bf310d6b5c41fad91Andreas Gustafsson (ctx->style.flags & DNS_STYLEFLAG_NCACHE) == 0) {
e482a1c91ecb5e47bc26617bf310d6b5c41fad91Andreas Gustafsson /* Omit negative cache entries */
123a3dddc94534d3a6c6f81c118a5b63dc5994c3Andreas Gustafsson if ((ctx->style.flags & DNS_STYLEFLAG_OMIT_OWNER) != 0)
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews dns_time64_totext((isc_uint64_t)rds->resign, &b);
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk unsigned int j;
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk for (j = 0; j < dns_master_indent; j++)
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * If we got more data than could be sorted at once,
593cb00bd17e5e2ab0dcb7c635a9a81082dc5d0eAndreas Gustafsson * go handle the rest.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * Dump given RRsets in the "raw" format.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrewsdump_rdataset_raw(isc_mem_t *mctx, dns_name_t *name, dns_rdataset_t *rdataset,
67dc2f0536bcbbfa0970eb2893dcbc1c6713fad4Mark Andrews rdataset->attributes |= DNS_RDATASETATTR_LOADORDER;
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * Common header and owner name (length followed by name)
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * These fields should be in a moderate length, so we assume we
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * can store all of them in the initial buffer.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews INSIST(r_hdr.length >= sizeof(dns_masterrawrdataset_t));
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_buffer_putuint32(buffer, totallen); /* XXX: leave space */
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_buffer_putuint16(buffer, rdataset->rdclass); /* 16-bit class */
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_buffer_putuint16(buffer, rdataset->type); /* 16-bit type */
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_buffer_putuint16(buffer, rdataset->covers); /* same as type */
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_buffer_putuint32(buffer, rdataset->ttl); /* 32-bit TTL */
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_buffer_putuint32(buffer, dns_rdataset_count(rdataset));
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews INSIST(totallen <= sizeof(dns_masterrawrdataset_t));
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * Copy the rdata into the buffer. If the buffer is too small,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * grow it. This should be rare, so we'll simply restart the
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * entire procedure (or should we copy the old data and
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * continue?).
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_mem_put(mctx, buffer->base, buffer->length);
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * Fill in the total length field.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * XXX: this is a bit tricky. Since we have already "used" the space
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * for the total length in the buffer, we first remember the entire
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * buffer length in the region, "rewind", and then write the value.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews INSIST(isc_buffer_usedlength(buffer) < totallen);
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * Write the buffer contents to the raw master file.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews result = isc_stdio_write(r.base, 1, (size_t)r.length, f, NULL);
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews "raw master file write failed: %s",
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrewsdump_rdatasets_raw(isc_mem_t *mctx, dns_name_t *name,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews dns_rdatasetiter_t *rdsiter, dns_totext_ctx_t *ctx,
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt if (((rdataset.attributes & DNS_RDATASETATTR_NEGATIVE) != 0) &&
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews (ctx->style.flags & DNS_STYLEFLAG_NCACHE) == 0) {
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews /* Omit negative cache entries */
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews result = dump_rdataset_raw(mctx, name, &rdataset,
c9611b45736af157e2993c6ef852e55e8e24ca83Evan Huntdump_rdatasets_map(isc_mem_t *mctx, dns_name_t *name,
c9611b45736af157e2993c6ef852e55e8e24ca83Evan Hunt dns_rdatasetiter_t *rdsiter, dns_totext_ctx_t *ctx,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Initial size of text conversion buffer. The buffer is used
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * for several purposes: converting origin names, rdatasets,
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * $DATE timestamps, and comment strings for $TTL directives.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * When converting rdatasets, it is dynamically resized, but
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * when converting origins, timestamps, etc it is not. Therefore,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * the initial size must large enough to hold the longest possible
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * text representation of any domain name (for $ORIGIN).
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews dns_db_closeversion(dctx->db, &dctx->version, ISC_FALSE);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews isc_mem_putanddetach(&dctx->mctx, dctx, sizeof(*dctx));
9aba20edee4e704433a464ae43b070b0775de506Mark Andrewsdns_dumpctx_attach(dns_dumpctx_t *source, dns_dumpctx_t **target) {
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews INSIST(source->references != 0); /* Overflow? */
d9eebc08497af272b2d44c07f4eb85153dec4253Evan Huntflushandsync(FILE *f, isc_result_t result, const char *temp) {
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews isc_boolean_t logit = ISC_TF(result == ISC_R_SUCCESS);
d9eebc08497af272b2d44c07f4eb85153dec4253Evan Hunt "dumping to master file: %s: flush: %s",
d9eebc08497af272b2d44c07f4eb85153dec4253Evan Hunt "dumping to stream: flush: %s",
d9eebc08497af272b2d44c07f4eb85153dec4253Evan Hunt "dumping to master file: %s: fsync: %s",
d9eebc08497af272b2d44c07f4eb85153dec4253Evan Hunt "dumping to stream: fsync: %s",
d9eebc08497af272b2d44c07f4eb85153dec4253Evan Huntcloseandrename(FILE *f, isc_result_t result, const char *temp, const char *file)
d9eebc08497af272b2d44c07f4eb85153dec4253Evan Hunt isc_boolean_t logit = ISC_TF(result == ISC_R_SUCCESS);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews "dumping master file: %s: fclose: %s",
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews "dumping master file: rename: %s: %s",
9aba20edee4e704433a464ae43b070b0775de506Mark Andrewsdump_quantum(isc_task_t *task, isc_event_t *event) {
4e681da26da4fff442b3ae24b0da2de1f240c43cMark Andrews if (tresult != ISC_R_SUCCESS && result == ISC_R_SUCCESS)
b7e6fb4e8464ceb4a62a8c00e3127da3c2839329Mark Andrews event = isc_event_allocate(dctx->mctx, NULL, DNS_EVENT_DUMPQUANTUM,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrewsdumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews const dns_master_style_t *style, FILE *f, dns_dumpctx_t **dctxp,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt dns_masterformat_t format, dns_masterrawheader_t *header)
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews "could not set master file style");
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews (dctx->tctx.style.flags & DNS_STYLEFLAG_REL_OWNER) != 0) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews result = dns_db_createiterator(dctx->db, options, &dctx->dbiter);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews dns_db_attachversion(dctx->db, version, &dctx->version);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews dns_db_currentversion(dctx->db, &dctx->version);
7829fad4093f2c1985b1efb7cea00287ff015d2bckb bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
7829fad4093f2c1985b1efb7cea00287ff015d2bckb isc_buffer_init(&buffer, bufmem, initial_buffer_length);
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * If the database has cache semantics, output an
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * RFC2540 $DATE directive so that the TTLs can be
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * adjusted when it is reloaded. For zones it is not
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * really needed, and it would make the file
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * incompatible with pre-RFC2540 software, so we omit
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * it in the zone case.
7829fad4093f2c1985b1efb7cea00287ff015d2bckb#if !defined(STDTIME_ON_32BITS) || (STDTIME_ON_32BITS + 0) != 1
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * We assume isc_stdtime_t is a 32-bit integer,
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * which should be the case on most platforms.
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * If it turns out to be uncommon, we'll need
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * to bump the version number and revise the
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * header format.
7829fad4093f2c1985b1efb7cea00287ff015d2bckb "dumping master file in raw "
7829fad4093f2c1985b1efb7cea00287ff015d2bckb "format: stdtime is not 32bits");
7829fad4093f2c1985b1efb7cea00287ff015d2bckb INSIST(isc_buffer_usedlength(&buffer) <= sizeof(rawheader));
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews isc_buffer_init(&buffer, bufmem, initial_buffer_length);
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * Fast format is not currently written incrementally,
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * so we make the call to dns_db_serialize() here.
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * If the database is anything other than an rbtdb,
7829fad4093f2c1985b1efb7cea00287ff015d2bckb * this should result in not implemented
37702cb83cfae78df1bb2a90cde8580091dece0bMark Andrews if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE)
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews while (result == ISC_R_SUCCESS && (dctx->nodes == 0 || nodes--)) {
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews result = dns_dbiterator_current(dctx->dbiter, &node, name);
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN)
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews dns_fixedname_name(&dctx->tctx.origin_fixname);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews result = dns_dbiterator_origin(dctx->dbiter, origin);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews result = dns_db_allrdatasets(dctx->db, node, dctx->version,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews result = (dctx->dumpsets)(dctx->mctx, name, rdsiter,
4c1817c29c78d533eae9f4bdf8c9b4d5c90ebfdbMark Andrews * Work out how many nodes can be written in the time between
4c1817c29c78d533eae9f4bdf8c9b4d5c90ebfdbMark Andrews * two requests to the nameserver. Smooth the resulting number and
4c1817c29c78d533eae9f4bdf8c9b4d5c90ebfdbMark Andrews * use it as a estimate for the number of nodes to be written in the
4c1817c29c78d533eae9f4bdf8c9b4d5c90ebfdbMark Andrews * next iteration.
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews if (dctx->nodes != 0 && result == ISC_R_SUCCESS) {
4c1817c29c78d533eae9f4bdf8c9b4d5c90ebfdbMark Andrews unsigned int pps = dns_pps; /* packets per second */
4c1817c29c78d533eae9f4bdf8c9b4d5c90ebfdbMark Andrews interval = 1000000 / pps; /* interval in usecs */
4c1817c29c78d533eae9f4bdf8c9b4d5c90ebfdbMark Andrews /* Smooth and assign. */
4c1817c29c78d533eae9f4bdf8c9b4d5c90ebfdbMark Andrews isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
a135cb62d310883601285f8b511875f1b9586417Mark Andrews "dumptostreaminc(%p) new nodes -> %d",
515ada69db06a727ca1197e2aa1f6a286d278228Tatuya JINMEI 神明達哉 RUNTIME_CHECK(dns_dbiterator_pause(dctx->dbiter) == ISC_R_SUCCESS);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews isc_mem_put(dctx->mctx, buffer.base, buffer.length);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrewsdns_master_dumptostreaminc(isc_mem_t *mctx, dns_db_t *db,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews result = dumpctx_create(mctx, db, version, style, f, &dctx,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews * Dump an entire database into a master file.
9aba20edee4e704433a464ae43b070b0775de506Mark Andrewsdns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt return (dns_master_dumptostream3(mctx, db, version, style,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrewsdns_master_dumptostream2(isc_mem_t *mctx, dns_db_t *db,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt return (dns_master_dumptostream3(mctx, db, version, style,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Huntdns_master_dumptostream3(isc_mem_t *mctx, dns_db_t *db,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt result = dumpctx_create(mctx, db, version, style, f, &dctx,
7e9d637131516486630290d36c4c0db544cb700eMark Andrewsopentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews tempname = isc_mem_allocate(mctx, tempnamelen);
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews result = isc_file_mktemplate(file, tempname, tempnamelen);
3e14b69d196a3ebeecc4662c426344dcfd7db678Andreas Gustafsson isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
b7e031d5173476224027407d8e23eaa7557fc396Andreas Gustafsson "dumping master file: %s: open: %s",
9aba20edee4e704433a464ae43b070b0775de506Mark Andrewsdns_master_dumpinc(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews const dns_master_style_t *style, const char *filename,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews isc_task_t *task, dns_dumpdonefunc_t done, void *done_arg,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt return (dns_master_dumpinc3(mctx, db, version, style, filename, task,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrewsdns_master_dumpinc2(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews const dns_master_style_t *style, const char *filename,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews isc_task_t *task, dns_dumpdonefunc_t done, void *done_arg,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews dns_dumpctx_t **dctxp, dns_masterformat_t format)
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt return (dns_master_dumpinc3(mctx, db, version, style, filename, task,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Huntdns_master_dumpinc3(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt const dns_master_style_t *style, const char *filename,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt isc_task_t *task, dns_dumpdonefunc_t done, void *done_arg,
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = opentmp(mctx, format, filename, &tempname, &f);
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt result = dumpctx_create(mctx, db, version, style, f, &dctx,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrewsdns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews const dns_master_style_t *style, const char *filename)
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt return (dns_master_dump3(mctx, db, version, style, filename,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrewsdns_master_dump2(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews const dns_master_style_t *style, const char *filename,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt return (dns_master_dump3(mctx, db, version, style, filename,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Huntdns_master_dump3(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt const dns_master_style_t *style, const char *filename,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt dns_masterformat_t format, dns_masterrawheader_t *header)
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = opentmp(mctx, format, filename, &tempname, &f);
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt result = dumpctx_create(mctx, db, version, style, f, &dctx,
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews result = closeandrename(f, result, tempname, filename);
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington * Dump a database node into a master file.
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews * XXX: this function assumes the text format.
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellingtondns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db,
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington "could not set master file style");
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington bufmem = isc_mem_get(mctx, initial_buffer_length);
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington isc_buffer_init(&buffer, bufmem, initial_buffer_length);
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington result = dns_db_allrdatasets(db, node, version, now, &rdsiter);
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews result = dump_rdatasets_text(mctx, name, rdsiter, &ctx, &buffer, f);
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington isc_mem_put(mctx, buffer.base, buffer.length);
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellingtondns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington const dns_master_style_t *style, const char *filename)
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington result = isc_stdio_open(filename, "w", &f);
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington "dumping node to file: %s: open: %s", filename,
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington result = dns_master_dumpnodetostream(mctx, db, version, node, name,
0874abad14e3e9ecfc3dc1a1a2b9969f2f027724Mark Andrews isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
19f4d25fd5b35b1375b0b9f13b66770ee4a66154Brian Wellington "dumping master file: %s: close: %s", filename,
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntdns_master_styleflags(const dns_master_style_t *style) {
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrewsdns_master_stylecreate(dns_master_style_t **stylep, unsigned int flags,
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews unsigned int ttl_column, unsigned int class_column,
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews unsigned int type_column, unsigned int rdata_column,
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews unsigned int line_length, unsigned int tab_width,
9a859983d7059a6eb9c877c1d2ac6a3a5b7170f7Evan Hunt return (dns_master_stylecreate2(stylep, flags, ttl_column,
9a859983d7059a6eb9c877c1d2ac6a3a5b7170f7Evan Huntdns_master_stylecreate2(dns_master_style_t **stylep, unsigned int flags,
0e27506ce3135f9bd49e12564ad0e15256135118Automatic Updater unsigned int ttl_column, unsigned int class_column,
0e27506ce3135f9bd49e12564ad0e15256135118Automatic Updater unsigned int type_column, unsigned int rdata_column,
0e27506ce3135f9bd49e12564ad0e15256135118Automatic Updater unsigned int line_length, unsigned int tab_width,