bind/bind-9.9.9-P3/lib/dns/masterdump.c
/*
 * Dump a database node into a master file.
 * XXX: this function assumes the text format.
 */
Dump a database node into a master file.
XXX: this function assumes the text format.
Dump a database node into a master file . XXX : this function assumes the text format .
isc_result_t
dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db,
			    dns_dbversion_t *version,
			    dns_dbnode_t *node, dns_name_t *name,
			    const dns_master_style_t *style,
			    FILE *f)
{
	isc_result_t result;
	isc_buffer_t buffer;
	char *bufmem;
	isc_stdtime_t now;
	dns_totext_ctx_t ctx;
	dns_rdatasetiter_t *rdsiter = NULL;
	result = totext_ctx_init(style, &ctx);
	if (result != ISC_R_SUCCESS) {
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 "could not set master file style");
		return (ISC_R_UNEXPECTED);
	}
	isc_stdtime_get(&now);
	bufmem = isc_mem_get(mctx, initial_buffer_length);
	if (bufmem == NULL)
		return (ISC_R_NOMEMORY);
	isc_buffer_init(&buffer, bufmem, initial_buffer_length);
	result = dns_db_allrdatasets(db, node, version, now, &rdsiter);
	if (result != ISC_R_SUCCESS)
		goto failure;
	result = dump_rdatasets_text(mctx, name, rdsiter, &ctx, &buffer, f);
	if (result != ISC_R_SUCCESS)
		goto failure;
	dns_rdatasetiter_destroy(&rdsiter);
	result = ISC_R_SUCCESS;
 failure:
	isc_mem_put(mctx, buffer.base, buffer.length);
	return (result);
}
isc_result_t dns_master_dumpnodetostream ( isc_mem_t * mctx , dns_db_t * db , dns_dbversion_t * version , dns_dbnode_t * node , dns_name_t * name , const dns_master_style_t * style , FILE * f ) { isc_result_t result ; isc_buffer_t buffer ; char * bufmem ; isc_stdtime_t now ; dns_totext_ctx_t ctx ; dns_rdatasetiter_t * rdsiter = NULL ; result = totext_ctx_init ( style , & ctx ) ; if ( result != ISC_R_SUCCESS ) { UNEXPECTED_ERROR ( __FILE__ , __LINE__ , " " ) ; return ( ISC_R_UNEXPECTED ) ; } isc_stdtime_get ( & now ) ; bufmem = isc_mem_get ( mctx , initial_buffer_length ) ; if ( bufmem == NULL ) return ( ISC_R_NOMEMORY ) ; isc_buffer_init ( & buffer , bufmem , initial_buffer_length ) ; result = dns_db_allrdatasets ( db , node , version , now , & rdsiter ) ; if ( result != ISC_R_SUCCESS ) goto failure ; result = dump_rdatasets_text ( mctx , name , rdsiter , & ctx , & buffer , f ) ; if ( result != ISC_R_SUCCESS ) goto failure ; dns_rdatasetiter_destroy ( & rdsiter ) ; result = ISC_R_SUCCESS ; failure : isc_mem_put ( mctx , buffer . base , buffer . length ) ; return ( result ) ; }
Dump a database node into a master file.
Dump a database node into a master file .