diff --git a/lib/dns/include/dns/rdata.h b/lib/dns/include/dns/rdata.h index b56228a60e..200466fe72 100644 --- a/lib/dns/include/dns/rdata.h +++ b/lib/dns/include/dns/rdata.h @@ -127,7 +127,7 @@ struct dns_rdata { }; /* - * Context structure for dns_rdata_totext(). Defines + * Context structure for the totext_ functions. Defines * the way the rdata part of a master file line is * formatted. */ @@ -323,7 +323,7 @@ dns_result_t dns_rdata_fromtext(dns_rdata_t *rdata, * Resource Limit: Not enough space */ -dns_result_t dns_rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, +dns_result_t dns_rdata_totext(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target); /* * Convert 'rdata' into text format, storing the result in 'target'. diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index 8637cf76a2..da35a75d1a 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -43,6 +43,11 @@ #include #include +/* XXX */ +dns_result_t +__dns_rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, + isc_buffer_t *target); + #define RETERR(x) do { \ dns_result_t __r = (x); \ if (__r != DNS_R_SUCCESS) \ @@ -159,6 +164,8 @@ char spaces[N_SPACES] = " "; #define N_TABS 10 char tabs[N_TABS] = "\t\t\t\t\t\t\t\t\t\t"; + + /* * Output tabs and spaces to go from column '*current' to * column 'to', and update '*current' to reflect the new @@ -396,7 +403,7 @@ rdataset_totext(dns_rdataset_t *rdataset, INDENT_TO(rdata_column); dns_rdataset_current(rdataset, &rdata); - RETERR(dns_rdata_totext(&rdata, &ctx->rdata_ctx, target)); + RETERR(__dns_rdata_totext(&rdata, &ctx->rdata_ctx, target)); isc_buffer_available(target, &r); if (r.length < 1) diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 8f89788f1d..b410322567 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: rdata.c,v 1.48 1999/06/08 10:35:06 gson Exp $ */ + /* $Id: rdata.c,v 1.49 1999/06/08 20:46:43 gson Exp $ */ #include @@ -88,6 +88,10 @@ static void fromtext_error(void (*callback)(dns_rdatacallbacks_t *, isc_token_t *token, dns_result_t result); +/* XXX */ +dns_result_t __dns_rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, + isc_buffer_t *target); + static const char hexdigits[] = "0123456789abcdef"; static const char decdigits[] = "0123456789"; static const char octdigits[] = "01234567"; @@ -413,8 +417,8 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t class, } dns_result_t -dns_rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, - isc_buffer_t *target) +__dns_rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, + isc_buffer_t *target) { dns_result_t result = DNS_R_NOTIMPLEMENTED; isc_boolean_t use_default = ISC_FALSE; @@ -432,6 +436,19 @@ dns_rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, return (result); } +dns_result_t +dns_rdata_totext(dns_rdata_t *rdata, dns_name_t *origin, + isc_buffer_t *target) +{ + /* Set up formatting options for single-line output. */ + dns_rdata_textctx_t tctx; + tctx.origin = origin; + tctx.flags = 0; + tctx.width = 60; + tctx.linebreak = " "; + return (__dns_rdata_totext(rdata, &tctx, target)); +} + dns_result_t dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t class, dns_rdatatype_t type, void *source,