renamed dns_view_dumpcachetostream() to dns_view_dumpdbtostream()

and changed header comments to make it clear that it is for debugging/analysis purposes and may
dump other stuff in addition to the cache in the future.  Also changed the dump style to the
'explict TTL' one, which makes more sense than usin  when dumping cache files since the TTLs
tend to be different in each rrset, and added a comment banner at the top of each cache dump
containing the view name.
This commit is contained in:
Andreas Gustafsson
2000-12-15 21:11:38 +00:00
parent acea06c80c
commit 113b8ef973
3 changed files with 40 additions and 16 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.275 2000/12/15 19:38:07 gson Exp $ */
/* $Id: server.c,v 1.276 2000/12/15 21:11:38 gson Exp $ */
#include <config.h>
@@ -2414,8 +2414,8 @@ ns_server_dumpdb(ns_server_t *server) {
view = ISC_LIST_NEXT(view, link))
{
if (view->cachedb != NULL)
CHECKM(dns_view_dumpcachetostream(view, fp),
"could not dump cache");
CHECKM(dns_view_dumpdbtostream(view, fp),
"could not dump view databases");
}
cleanup:
if (fp != NULL)

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.h,v 1.58 2000/12/13 21:28:38 bwelling Exp $ */
/* $Id: view.h,v 1.59 2000/12/15 21:11:36 gson Exp $ */
#ifndef DNS_VIEW_H
#define DNS_VIEW_H 1
@@ -631,20 +631,37 @@ dns_view_dialup(dns_view_t *view);
isc_result_t
dns_view_dumpcache(dns_view_t *view);
isc_result_t
dns_view_dumpcachetostream(dns_view_t *view, FILE *fp);
/*
* Dump the cache to the specified cache file (if there is one) or stream.
* Dump the view's cache to the the view's cache file.
*
* Requires:
*
* 'view' is valid.
*
* 'fp' is an open file.
* Returns:
* ISC_R_SUCCESS The cache was successfully dumped.
* ISC_R_IGNORE No cachefile was specified.
* others An error occurred (see dns_master_dump)
*/
isc_result_t
dns_view_dumpdbtostream(dns_view_t *view, FILE *fp);
/*
* Dump the current state of the view 'view' to the stream 'fp'
* for purposes of analysis or debugging.
*
* Currently the dumped state includes the view's cache; in the future
* it may also include other state such as the address database.
* It will not not include authoritative data since it is voluminous and
* easily obtainable by other means.
*
* Requires:
*
* 'view' is valid.
*
* 'fp' refers to a file open for writing.
*
* Returns:
*
* ISC_R_SUCCESS The cache was successfully dumped.
* ISC_R_IGNORE No cachefile was specified.
* others An error occurred (see dns_master_dump)

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.c,v 1.86 2000/12/12 21:33:14 bwelling Exp $ */
/* $Id: view.c,v 1.87 2000/12/15 21:11:35 gson Exp $ */
#include <config.h>
@@ -1068,11 +1068,18 @@ dns_view_dumpcache(dns_view_t *view) {
}
isc_result_t
dns_view_dumpcachetostream(dns_view_t *view, FILE *fp) {
dns_view_dumpdbtostream(dns_view_t *view, FILE *fp) {
isc_result_t result;
REQUIRE(DNS_VIEW_VALID(view));
return (dns_master_dumptostream(view->mctx, view->cachedb, NULL,
&dns_master_style_default, fp));
(void)fprintf(fp, ";\n; Cache dump of view '%s'\n;\n", view->name);
result = dns_master_dumptostream(view->mctx, view->cachedb, NULL,
&dns_master_style_explicitttl, fp);
if (result != ISC_R_SUCCESS)
return (result);
#ifdef notyet /* clean up adb dump format first */
dns_adb_dump(view->adb, fp);
#endif
return (ISC_R_SUCCESS);
}