Commit 53c9342d authored by Jan Včelák's avatar Jan Včelák 🚀

remove debugging depending on knotd from libknot (in addition, it was unused)

issue #1
parent d182f90b
......@@ -214,7 +214,6 @@ src/libknot/tsig-op.c
src/libknot/tsig-op.h
src/libknot/tsig.c
src/libknot/tsig.h
src/libknot/util/debug.c
src/libknot/util/debug.h
src/libknot/util/endian.h
src/libknot/util/tolower.c
......
......@@ -103,7 +103,6 @@ libknot_la_SOURCES = \
libknot/consts.h \
libknot/consts.c \
libknot/util/utils.c \
libknot/util/debug.c \
libknot/util/debug.h \
libknot/util/utils.h \
libknot/util/tolower.h \
......
......@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "knot/zone/zone-tree.h"
#include "knot/zone/node.h"
#include "libknot/util/debug.h"
#include "common/hattrie/hat-trie.h"
......
......@@ -20,6 +20,8 @@
#include <stdbool.h>
#include <inttypes.h>
#include "common/errcode.h"
#include "common/mempattern.h"
#include "libknot/common.h"
#include "libknot/dname.h"
#include "libknot/consts.h"
#include "libknot/dnssec/nsec3.h"
......
......@@ -15,6 +15,7 @@
*/
#include <assert.h>
#include "common/errcode.h"
#include "libknot/packet/compr.h"
#include "libknot/packet/pkt.h"
#include "libknot/util/debug.h"
......
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <stdlib.h>
#include "libknot/util/utils.h"
#include "libknot/util/debug.h"
#include "libknot/rrset.h"
#include "common/descriptor.h"
#include "common/print.h"
#if defined(KNOT_ZONE_DEBUG)
static int knot_node_dump_from_tree(knot_node_t *node, void *data)
{
UNUSED(data);
knot_node_dump(node);
return KNOT_EOK;
}
#endif
void knot_node_dump(knot_node_t *node)
{
#if defined(KNOT_ZONE_DEBUG) || defined(KNOT_NODE_DEBUG)
dbg_node_detail("------- NODE --------\n");
char *name = knot_dname_to_str(node->owner);
dbg_node_detail("owner: %s\n", name);
free(name);
dbg_node_detail("node: %p\n", node);
if (knot_node_is_deleg_point(node)) {
dbg_node_detail("delegation point\n");
}
if (knot_node_is_non_auth(node)) {
dbg_node_detail("non-authoritative node\n");
}
if (node->parent != NULL) {
/*! \todo This causes segfault when parent was free'd,
* e.g. when applying changesets.
*/
name = knot_dname_to_str(node->parent->owner);
dbg_node_detail("parent: %s\n", name);
free(name);
} else {
dbg_node_detail("no parent\n");
}
if (node->prev != NULL) {
dbg_node_detail("previous node: %p\n", node->prev);
/*! \todo This causes segfault when prev was free'd,
* e.g. when applying changesets.
*/
name = knot_dname_to_str(node->prev->owner);
dbg_node_detail("previous node: %s\n", name);
free(name);
} else {
dbg_node_detail("previous node: none\n");
}
knot_rrset_t **rrsets = knot_node_get_rrsets(node);
dbg_node_detail("Wildcard child: ");
if (node->wildcard_child != NULL) {
/*! \todo This causes segfault when wildcard child was free'd,
* e.g. when applying changesets.
*/
name = knot_dname_to_str(node->wildcard_child->owner);
dbg_node_detail("%s\n", name);
free(name);
} else {
dbg_node_detail("none\n");
}
dbg_node_detail("NSEC3 node: ");
if (node->nsec3_node != NULL) {
/*! \todo This causes segfault when n sec3_node was free'd,
* e.g. when applying changesets.
*/
name = knot_dname_to_str(node->nsec3_node->owner);
dbg_node_detail("%s\n", name);
free(name);
} else {
dbg_node_detail("none\n");
}
dbg_node_detail("RRSet count: %d\n", node->rrset_count);
for (int i = 0; i < node->rrset_count; i++) {
knot_rrset_dump(rrsets[i]);
}
free(rrsets);
dbg_node_detail("------- NODE --------\n");
#else
UNUSED(node);
#endif
}
void knot_zone_contents_dump(knot_zone_contents_t *zone)
{
#if defined(KNOT_ZONE_DEBUG)
if (!zone) {
dbg_zone_detail("------- STUB ZONE --------\n");
return;
}
dbg_zone_detail("------- ZONE --------\n");
knot_zone_contents_tree_apply_inorder(zone, knot_node_dump_from_tree,
NULL);
dbg_zone_detail("------- ZONE --------\n");
dbg_zone_detail("------- NSEC 3 tree -\n");
knot_zone_contents_nsec3_apply_inorder(zone, knot_node_dump_from_tree,
NULL);
dbg_zone_detail("------- NSEC 3 tree -\n");
#else
UNUSED(zone);
#endif
}
......@@ -33,6 +33,9 @@
#include <stdio.h>
#include "common/log.h"
#include "common/print.h"
#include "libknot/rrset.h"
#include "libknot/util/utils.h"
/*
* Debug macros
......@@ -63,35 +66,6 @@
#define KNOT_DDNS_DEBUG
#endif
#include "libknot/rrset.h"
#include "knot/zone/node.h"
#include "knot/zone/zone.h"
#include "libknot/util/utils.h"
#include "common/print.h"
/*!
* \brief Dumps zone node.
*
* This function is empty if neither KNOT_ZONE_DEBUG nor KNOT_NODE_DEBUG
* is defined.
*
* \param node Node to dump.
* \param loaded_zone Set to <> 0 if the node is part of a zone loaded into
* the server. Set to 0 otherwise.
*/
void knot_node_dump(knot_node_t *node);
/*!
* \brief Dumps the whole zone.
*
* This function is empty if KNOT_ZONE_DEBUG is not defined.
*
* \param zone Zone to dump.
* \param loaded_zone Set to <> 0 if the node is part of a zone loaded into
* the server. Set to 0 otherwise.
*/
void knot_zone_contents_dump(knot_zone_contents_t *zone);
/******************************************************************************/
#ifdef KNOT_NS_DEBUG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment