Commit d49b3d45 authored by Lubos Slovak's avatar Lubos Slovak

Changed prefix of all dnslib functions to knot_

refs #1087
parent 26160049
...@@ -14,21 +14,21 @@ static const size_t DNSLIB_CHANGESET_RRSET_STEP = 5; ...@@ -14,21 +14,21 @@ static const size_t DNSLIB_CHANGESET_RRSET_STEP = 5;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static int dnslib_changeset_check_count(dnslib_rrset_t ***rrsets, size_t count, static int knot_changeset_check_count(knot_rrset_t ***rrsets, size_t count,
size_t *allocated) size_t *allocated)
{ {
// this should also do for the initial case (*rrsets == NULL) // this should also do for the initial case (*rrsets == NULL)
if (count == *allocated) { if (count == *allocated) {
dnslib_rrset_t **rrsets_new = (dnslib_rrset_t **)calloc( knot_rrset_t **rrsets_new = (knot_rrset_t **)calloc(
*allocated + DNSLIB_CHANGESET_RRSET_STEP, *allocated + DNSLIB_CHANGESET_RRSET_STEP,
sizeof(dnslib_rrset_t *)); sizeof(knot_rrset_t *));
if (rrsets_new == NULL) { if (rrsets_new == NULL) {
return DNSLIB_ENOMEM; return DNSLIB_ENOMEM;
} }
memcpy(rrsets_new, *rrsets, count); memcpy(rrsets_new, *rrsets, count);
dnslib_rrset_t **rrsets_old = *rrsets; knot_rrset_t **rrsets_old = *rrsets;
*rrsets = rrsets_new; *rrsets = rrsets_new;
*allocated += DNSLIB_CHANGESET_RRSET_STEP; *allocated += DNSLIB_CHANGESET_RRSET_STEP;
free(rrsets_old); free(rrsets_old);
...@@ -39,24 +39,24 @@ static int dnslib_changeset_check_count(dnslib_rrset_t ***rrsets, size_t count, ...@@ -39,24 +39,24 @@ static int dnslib_changeset_check_count(dnslib_rrset_t ***rrsets, size_t count,
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static int dnslib_changeset_rrsets_match(const dnslib_rrset_t *rrset1, static int knot_changeset_rrsets_match(const knot_rrset_t *rrset1,
const dnslib_rrset_t *rrset2) const knot_rrset_t *rrset2)
{ {
return dnslib_rrset_compare(rrset1, rrset2, DNSLIB_RRSET_COMPARE_HEADER) return knot_rrset_compare(rrset1, rrset2, DNSLIB_RRSET_COMPARE_HEADER)
&& (dnslib_rrset_type(rrset1) != DNSLIB_RRTYPE_RRSIG && (knot_rrset_type(rrset1) != DNSLIB_RRTYPE_RRSIG
|| dnslib_rdata_rrsig_type_covered( || knot_rdata_rrsig_type_covered(
dnslib_rrset_rdata(rrset1)) knot_rrset_rdata(rrset1))
== dnslib_rdata_rrsig_type_covered( == knot_rdata_rrsig_type_covered(
dnslib_rrset_rdata(rrset2))); knot_rrset_rdata(rrset2)));
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int dnslib_changeset_allocate(dnslib_changesets_t **changesets) int knot_changeset_allocate(knot_changesets_t **changesets)
{ {
// create new changesets // create new changesets
*changesets = (dnslib_changesets_t *)( *changesets = (knot_changesets_t *)(
calloc(1, sizeof(dnslib_changesets_t))); calloc(1, sizeof(knot_changesets_t)));
if (*changesets == NULL) { if (*changesets == NULL) {
return DNSLIB_ENOMEM; return DNSLIB_ENOMEM;
...@@ -66,16 +66,16 @@ int dnslib_changeset_allocate(dnslib_changesets_t **changesets) ...@@ -66,16 +66,16 @@ int dnslib_changeset_allocate(dnslib_changesets_t **changesets)
assert((*changesets)->count == 0); assert((*changesets)->count == 0);
assert((*changesets)->sets = NULL); assert((*changesets)->sets = NULL);
return dnslib_changesets_check_size(*changesets); return knot_changesets_check_size(*changesets);
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int dnslib_changeset_add_rrset(dnslib_rrset_t ***rrsets, int knot_changeset_add_rrset(knot_rrset_t ***rrsets,
size_t *count, size_t *allocated, size_t *count, size_t *allocated,
dnslib_rrset_t *rrset) knot_rrset_t *rrset)
{ {
int ret = dnslib_changeset_check_count(rrsets, *count, allocated); int ret = knot_changeset_check_count(rrsets, *count, allocated);
if (ret != DNSLIB_EOK) { if (ret != DNSLIB_EOK) {
return ret; return ret;
} }
...@@ -87,39 +87,39 @@ int dnslib_changeset_add_rrset(dnslib_rrset_t ***rrsets, ...@@ -87,39 +87,39 @@ int dnslib_changeset_add_rrset(dnslib_rrset_t ***rrsets,
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int dnslib_changeset_add_rr(dnslib_rrset_t ***rrsets, size_t *count, int knot_changeset_add_rr(knot_rrset_t ***rrsets, size_t *count,
size_t *allocated, dnslib_rrset_t *rr) size_t *allocated, knot_rrset_t *rr)
{ {
// try to find the RRSet in the list of RRSets // try to find the RRSet in the list of RRSets
int i = 0; int i = 0;
while (i < *count && !dnslib_changeset_rrsets_match((*rrsets)[i], rr)) { while (i < *count && !knot_changeset_rrsets_match((*rrsets)[i], rr)) {
++i; ++i;
} }
if (i < *count) { if (i < *count) {
// found RRSet to merge the new one into // found RRSet to merge the new one into
if (dnslib_rrset_merge((void **)&(*rrsets)[i], if (knot_rrset_merge((void **)&(*rrsets)[i],
(void **)&rr) != DNSLIB_EOK) { (void **)&rr) != DNSLIB_EOK) {
return DNSLIB_ERROR; return DNSLIB_ERROR;
} }
// remove the RR // remove the RR
dnslib_rrset_deep_free(&rr, 1, 1, 1); knot_rrset_deep_free(&rr, 1, 1, 1);
return DNSLIB_EOK; return DNSLIB_EOK;
} else { } else {
return dnslib_changeset_add_rrset(rrsets, count, allocated, rr); return knot_changeset_add_rrset(rrsets, count, allocated, rr);
} }
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int dnslib_changeset_add_new_rr(dnslib_changeset_t *changeset, int knot_changeset_add_new_rr(knot_changeset_t *changeset,
dnslib_rrset_t *rrset, knot_rrset_t *rrset,
xfrin_changeset_part_t part) xfrin_changeset_part_t part)
{ {
dnslib_rrset_t ***rrsets = NULL; knot_rrset_t ***rrsets = NULL;
size_t *count = NULL; size_t *count = NULL;
size_t *allocated = NULL; size_t *allocated = NULL;
...@@ -142,7 +142,7 @@ int dnslib_changeset_add_new_rr(dnslib_changeset_t *changeset, ...@@ -142,7 +142,7 @@ int dnslib_changeset_add_new_rr(dnslib_changeset_t *changeset,
assert(count != NULL); assert(count != NULL);
assert(allocated != NULL); assert(allocated != NULL);
int ret = dnslib_changeset_add_rr(rrsets, count, allocated, rrset); int ret = knot_changeset_add_rr(rrsets, count, allocated, rrset);
if (ret != DNSLIB_EOK) { if (ret != DNSLIB_EOK) {
return ret; return ret;
} }
...@@ -152,25 +152,25 @@ int dnslib_changeset_add_new_rr(dnslib_changeset_t *changeset, ...@@ -152,25 +152,25 @@ int dnslib_changeset_add_new_rr(dnslib_changeset_t *changeset,
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void dnslib_changeset_store_soa(dnslib_rrset_t **chg_soa, void knot_changeset_store_soa(knot_rrset_t **chg_soa,
uint32_t *chg_serial, dnslib_rrset_t *soa) uint32_t *chg_serial, knot_rrset_t *soa)
{ {
*chg_soa = soa; *chg_soa = soa;
*chg_serial = dnslib_rdata_soa_serial(dnslib_rrset_rdata(soa)); *chg_serial = knot_rdata_soa_serial(knot_rrset_rdata(soa));
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int dnslib_changeset_add_soa(dnslib_changeset_t *changeset, dnslib_rrset_t *soa, int knot_changeset_add_soa(knot_changeset_t *changeset, knot_rrset_t *soa,
xfrin_changeset_part_t part) xfrin_changeset_part_t part)
{ {
switch (part) { switch (part) {
case XFRIN_CHANGESET_ADD: case XFRIN_CHANGESET_ADD:
dnslib_changeset_store_soa(&changeset->soa_to, knot_changeset_store_soa(&changeset->soa_to,
&changeset->serial_to, soa); &changeset->serial_to, soa);
break; break;
case XFRIN_CHANGESET_REMOVE: case XFRIN_CHANGESET_REMOVE:
dnslib_changeset_store_soa(&changeset->soa_from, knot_changeset_store_soa(&changeset->soa_from,
&changeset->serial_from, soa); &changeset->serial_from, soa);
break; break;
default: default:
...@@ -183,19 +183,19 @@ int dnslib_changeset_add_soa(dnslib_changeset_t *changeset, dnslib_rrset_t *soa, ...@@ -183,19 +183,19 @@ int dnslib_changeset_add_soa(dnslib_changeset_t *changeset, dnslib_rrset_t *soa,
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int dnslib_changesets_check_size(dnslib_changesets_t *changesets) int knot_changesets_check_size(knot_changesets_t *changesets)
{ {
if (changesets->allocated == changesets->count) { if (changesets->allocated == changesets->count) {
dnslib_changeset_t *sets = (dnslib_changeset_t *)calloc( knot_changeset_t *sets = (knot_changeset_t *)calloc(
changesets->allocated + DNSLIB_CHANGESET_STEP, changesets->allocated + DNSLIB_CHANGESET_STEP,
sizeof(dnslib_changeset_t)); sizeof(knot_changeset_t));
if (sets == NULL) { if (sets == NULL) {
return DNSLIB_ENOMEM; return DNSLIB_ENOMEM;
} }
/*! \todo realloc() may be more effective. */ /*! \todo realloc() may be more effective. */
memcpy(sets, changesets->sets, changesets->count); memcpy(sets, changesets->sets, changesets->count);
dnslib_changeset_t *old_sets = changesets->sets; knot_changeset_t *old_sets = changesets->sets;
changesets->sets = sets; changesets->sets = sets;
changesets->count += DNSLIB_CHANGESET_STEP; changesets->count += DNSLIB_CHANGESET_STEP;
free(old_sets); free(old_sets);
...@@ -206,7 +206,7 @@ int dnslib_changesets_check_size(dnslib_changesets_t *changesets) ...@@ -206,7 +206,7 @@ int dnslib_changesets_check_size(dnslib_changesets_t *changesets)
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void dnslib_free_changesets(dnslib_changesets_t **changesets) void knot_free_changesets(knot_changesets_t **changesets)
{ {
if (changesets == NULL || *changesets == NULL) { if (changesets == NULL || *changesets == NULL) {
return; return;
...@@ -215,7 +215,7 @@ void dnslib_free_changesets(dnslib_changesets_t **changesets) ...@@ -215,7 +215,7 @@ void dnslib_free_changesets(dnslib_changesets_t **changesets)
assert((*changesets)->allocated >= (*changesets)->count); assert((*changesets)->allocated >= (*changesets)->count);
for (int i = 0; i < (*changesets)->count; ++i) { for (int i = 0; i < (*changesets)->count; ++i) {
dnslib_changeset_t *ch = &(*changesets)->sets[i]; knot_changeset_t *ch = &(*changesets)->sets[i];
assert(ch->add_allocated >= ch->add_count); assert(ch->add_allocated >= ch->add_count);
assert(ch->remove_allocated >= ch->remove_count); assert(ch->remove_allocated >= ch->remove_count);
...@@ -223,17 +223,17 @@ void dnslib_free_changesets(dnslib_changesets_t **changesets) ...@@ -223,17 +223,17 @@ void dnslib_free_changesets(dnslib_changesets_t **changesets)
int j; int j;
for (j = 0; i < ch->add_count; ++j) { for (j = 0; i < ch->add_count; ++j) {
dnslib_rrset_deep_free(&ch->add[j], 1, 1, 1); knot_rrset_deep_free(&ch->add[j], 1, 1, 1);
} }
free(ch->add); free(ch->add);
for (j = 0; i < ch->remove_count; ++j) { for (j = 0; i < ch->remove_count; ++j) {
dnslib_rrset_deep_free(&ch->add[j], 1, 1, 1); knot_rrset_deep_free(&ch->add[j], 1, 1, 1);
} }
free(ch->remove); free(ch->remove);
dnslib_rrset_deep_free(&ch->soa_from, 1, 1, 1); knot_rrset_deep_free(&ch->soa_from, 1, 1, 1);
dnslib_rrset_deep_free(&ch->soa_to, 1, 1, 1); knot_rrset_deep_free(&ch->soa_to, 1, 1, 1);
free(ch->data); free(ch->data);
} }
......
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
* \todo Preallocation of space for changeset. * \todo Preallocation of space for changeset.
*/ */
typedef struct { typedef struct {
dnslib_rrset_t *soa_from; knot_rrset_t *soa_from;
dnslib_rrset_t **remove; knot_rrset_t **remove;
size_t remove_count; size_t remove_count;
size_t remove_allocated; size_t remove_allocated;
dnslib_rrset_t *soa_to; knot_rrset_t *soa_to;
dnslib_rrset_t **add; knot_rrset_t **add;
size_t add_count; size_t add_count;
size_t add_allocated; size_t add_allocated;
...@@ -37,15 +37,15 @@ typedef struct { ...@@ -37,15 +37,15 @@ typedef struct {
size_t allocated; size_t allocated;
uint32_t serial_from; uint32_t serial_from;
uint32_t serial_to; uint32_t serial_to;
} dnslib_changeset_t; } knot_changeset_t;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
typedef struct { typedef struct {
dnslib_changeset_t *sets; knot_changeset_t *sets;
size_t count; size_t count;
size_t allocated; size_t allocated;
} dnslib_changesets_t; } knot_changesets_t;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
...@@ -56,28 +56,28 @@ typedef enum { ...@@ -56,28 +56,28 @@ typedef enum {
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int dnslib_changeset_allocate(dnslib_changesets_t **changesets); int knot_changeset_allocate(knot_changesets_t **changesets);
int dnslib_changeset_add_rrset(dnslib_rrset_t ***rrsets, int knot_changeset_add_rrset(knot_rrset_t ***rrsets,
size_t *count, size_t *allocated, size_t *count, size_t *allocated,
dnslib_rrset_t *rrset); knot_rrset_t *rrset);
int dnslib_changeset_add_rr(dnslib_rrset_t ***rrsets, size_t *count, int knot_changeset_add_rr(knot_rrset_t ***rrsets, size_t *count,
size_t *allocated, dnslib_rrset_t *rr); size_t *allocated, knot_rrset_t *rr);
int dnslib_changeset_add_new_rr(dnslib_changeset_t *changeset, int knot_changeset_add_new_rr(knot_changeset_t *changeset,
dnslib_rrset_t *rrset, knot_rrset_t *rrset,
xfrin_changeset_part_t part); xfrin_changeset_part_t part);
void dnslib_changeset_store_soa(dnslib_rrset_t **chg_soa, void knot_changeset_store_soa(knot_rrset_t **chg_soa,
uint32_t *chg_serial, dnslib_rrset_t *soa); uint32_t *chg_serial, knot_rrset_t *soa);
int dnslib_changeset_add_soa(dnslib_changeset_t *changeset, dnslib_rrset_t *soa, int knot_changeset_add_soa(knot_changeset_t *changeset, knot_rrset_t *soa,
xfrin_changeset_part_t part); xfrin_changeset_part_t part);
int dnslib_changesets_check_size(dnslib_changesets_t *changesets); int knot_changesets_check_size(knot_changesets_t *changesets);
void dnslib_free_changesets(dnslib_changesets_t **changesets); void knot_free_changesets(knot_changesets_t **changesets);
#endif /* _KNOT_DNSLIB_CHANGESETS_H_ */ #endif /* _KNOT_DNSLIB_CHANGESETS_H_ */
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
/* /*
* OPCODEs * OPCODEs
*/ */
typedef enum dnslib_opcode { typedef enum knot_opcode {
DNSLIB_OPCODE_QUERY = 0, /* a standard query (QUERY) */ DNSLIB_OPCODE_QUERY = 0, /* a standard query (QUERY) */
DNSLIB_OPCODE_IQUERY = 1, /* an inverse query (IQUERY) */ DNSLIB_OPCODE_IQUERY = 1, /* an inverse query (IQUERY) */
DNSLIB_OPCODE_STATUS = 2, /* a server status request (STATUS) */ DNSLIB_OPCODE_STATUS = 2, /* a server status request (STATUS) */
DNSLIB_OPCODE_NOTIFY = 4, /* NOTIFY */ DNSLIB_OPCODE_NOTIFY = 4, /* NOTIFY */
DNSLIB_OPCODE_UPDATE = 5, /* Dynamic update */ DNSLIB_OPCODE_UPDATE = 5, /* Dynamic update */
DNSLIB_OPCODE_OFFSET = 14 DNSLIB_OPCODE_OFFSET = 14
} dnslib_opcode_t; } knot_opcode_t;
/*! /*!
* \brief Query types (internal use only). * \brief Query types (internal use only).
...@@ -33,7 +33,7 @@ typedef enum dnslib_opcode { ...@@ -33,7 +33,7 @@ typedef enum dnslib_opcode {
* This type encompasses the different query types distinguished by both the * This type encompasses the different query types distinguished by both the
* OPCODE and the QTYPE. * OPCODE and the QTYPE.
*/ */
typedef enum dnslib_packet_type { typedef enum knot_packet_type {
DNSLIB_QUERY_NORMAL, /*!< Normal query. */ DNSLIB_QUERY_NORMAL, /*!< Normal query. */
DNSLIB_QUERY_AXFR, /*!< Request for AXFR transfer. */ DNSLIB_QUERY_AXFR, /*!< Request for AXFR transfer. */
DNSLIB_QUERY_IXFR, /*!< Request for IXFR transfer. */ DNSLIB_QUERY_IXFR, /*!< Request for IXFR transfer. */
...@@ -43,12 +43,12 @@ typedef enum dnslib_packet_type { ...@@ -43,12 +43,12 @@ typedef enum dnslib_packet_type {
DNSLIB_RESPONSE_AXFR, /*!< AXFR transfer response. */ DNSLIB_RESPONSE_AXFR, /*!< AXFR transfer response. */
DNSLIB_RESPONSE_IXFR, /*!< IXFR transfer response. */ DNSLIB_RESPONSE_IXFR, /*!< IXFR transfer response. */
DNSLIB_RESPONSE_NOTIFY /*!< NOTIFY response. */ DNSLIB_RESPONSE_NOTIFY /*!< NOTIFY response. */
} dnslib_packet_type_t; } knot_packet_type_t;
/* /*
* RCODEs * RCODEs
*/ */
typedef enum dnslib_rcode { typedef enum knot_rcode {
DNSLIB_RCODE_NOERROR = 0, /* No error condition */ DNSLIB_RCODE_NOERROR = 0, /* No error condition */
DNSLIB_RCODE_FORMERR = 1, /* Format error */ DNSLIB_RCODE_FORMERR = 1, /* Format error */
DNSLIB_RCODE_SERVFAIL = 2, /* Server failure */ DNSLIB_RCODE_SERVFAIL = 2, /* Server failure */
...@@ -60,27 +60,27 @@ typedef enum dnslib_rcode { ...@@ -60,27 +60,27 @@ typedef enum dnslib_rcode {
DNSLIB_RCODE_NXRRSET = 8, /* rrset does not exist */ DNSLIB_RCODE_NXRRSET = 8, /* rrset does not exist */
DNSLIB_RCODE_NOTAUTH = 9, /* server not authoritative */ DNSLIB_RCODE_NOTAUTH = 9, /* server not authoritative */
DNSLIB_RCODE_NOTZONE = 10 /* name not inside zone */ DNSLIB_RCODE_NOTZONE = 10 /* name not inside zone */
} dnslib_rcode_t; } knot_rcode_t;
/* /*
* CLASSes * CLASSes
*/ */
//typedef enum dnslib_class { //typedef enum knot_class {
// DNSLIB_CLASS_IN = 1, /* Class IN */ // DNSLIB_CLASS_IN = 1, /* Class IN */
// DNSLIB_CLASS_CS = 2, /* Class CS */ // DNSLIB_CLASS_CS = 2, /* Class CS */
// DNSLIB_CLASS_CH = 3, /* Class CHAOS */ // DNSLIB_CLASS_CH = 3, /* Class CHAOS */
// DNSLIB_CLASS_HS = 4, /* Class HS */ // DNSLIB_CLASS_HS = 4, /* Class HS */
// DNSLIB_CLASS_NONE = 254, /* Class NONE rfc2136 */ // DNSLIB_CLASS_NONE = 254, /* Class NONE rfc2136 */
// DNSLIB_CLASS_ANY = 255 /* Class ANY */ // DNSLIB_CLASS_ANY = 255 /* Class ANY */
//} dnslib_class_t; //} knot_class_t;
/* /*
* Other * Other
*/ */
typedef enum dnslib_const { typedef enum knot_const {
DNSLIB_MAX_DNAME_LENGTH = 255, DNSLIB_MAX_DNAME_LENGTH = 255,
DNSLIB_MAX_DNAME_LABELS = 127 // 1-char labels DNSLIB_MAX_DNAME_LABELS = 127 // 1-char labels
} dnslib_const_t; } knot_const_t;
#endif /* _KNOT_DNSLIB_CONSTS_H_ */ #endif /* _KNOT_DNSLIB_CONSTS_H_ */
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "dnslib/dnslib.h" #include "dnslib/dnslib.h"
#include "common/print.h" #include "common/print.h"
void dnslib_rdata_dump(dnslib_rdata_t *rdata, uint32_t type, char loaded_zone) void knot_rdata_dump(knot_rdata_t *rdata, uint32_t type, char loaded_zone)
{ {
#if defined(DNSLIB_ZONE_DEBUG) || defined(DNSLIB_RDATA_DEBUG) #if defined(DNSLIB_ZONE_DEBUG) || defined(DNSLIB_RDATA_DEBUG)
printf(" ------- RDATA -------\n"); printf(" ------- RDATA -------\n");
...@@ -18,7 +18,7 @@ void dnslib_rdata_dump(dnslib_rdata_t *rdata, uint32_t type, char loaded_zone) ...@@ -18,7 +18,7 @@ void dnslib_rdata_dump(dnslib_rdata_t *rdata, uint32_t type, char loaded_zone)
printf(" ------- RDATA -------\n"); printf(" ------- RDATA -------\n");
return; return;
} }
dnslib_rrtype_descriptor_t *desc = dnslib_rrtype_descriptor_by_type(type); knot_rrtype_descriptor_t *desc = knot_rrtype_descriptor_by_type(type);
assert(desc != NULL); assert(desc != NULL);
char *name; char *name;
...@@ -27,14 +27,14 @@ void dnslib_rdata_dump(dnslib_rdata_t *rdata, uint32_t type, char loaded_zone) ...@@ -27,14 +27,14 @@ void dnslib_rdata_dump(dnslib_rdata_t *rdata, uint32_t type, char loaded_zone)
desc->wireformat[i] == DNSLIB_RDATA_WF_UNCOMPRESSED_DNAME || desc->wireformat[i] == DNSLIB_RDATA_WF_UNCOMPRESSED_DNAME ||
desc->wireformat[i] == DNSLIB_RDATA_WF_LITERAL_DNAME ) { desc->wireformat[i] == DNSLIB_RDATA_WF_LITERAL_DNAME ) {
assert(rdata->items[i].dname != NULL); assert(rdata->items[i].dname != NULL);
name = dnslib_dname_to_str(rdata->items[i].dname); name = knot_dname_to_str(rdata->items[i].dname);
printf(" DNAME: %d: %s\n", printf(" DNAME: %d: %s\n",
i, name); i, name);
free(name); free(name);
if (loaded_zone) { if (loaded_zone) {
if (rdata->items[i].dname->node) { if (rdata->items[i].dname->node) {
name = name =
dnslib_dname_to_str(rdata->items[i].dname->node->owner); knot_dname_to_str(rdata->items[i].dname->node->owner);
printf(" Has node owner: %s\n", name); printf(" Has node owner: %s\n", name);
free(name); free(name);
} else { } else {
...@@ -59,21 +59,21 @@ void dnslib_rdata_dump(dnslib_rdata_t *rdata, uint32_t type, char loaded_zone) ...@@ -59,21 +59,21 @@ void dnslib_rdata_dump(dnslib_rdata_t *rdata, uint32_t type, char loaded_zone)
#endif #endif
} }
void dnslib_rrset_dump(dnslib_rrset_t *rrset, char loaded_zone) void knot_rrset_dump(knot_rrset_t *rrset, char loaded_zone)
{ {
#if defined(DNSLIB_ZONE_DEBUG) || defined(DNSLIB_RRSET_DEBUG) #if defined(DNSLIB_ZONE_DEBUG) || defined(DNSLIB_RRSET_DEBUG)
printf(" ------- RRSET -------\n"); printf(" ------- RRSET -------\n");
printf(" %p\n", rrset); printf(" %p\n", rrset);
char *name = dnslib_dname_to_str(rrset->owner); char *name = knot_dname_to_str(rrset->owner);
printf(" owner: %s\n", name); printf(" owner: %s\n", name);
free(name); free(name);
printf(" type: %s\n", dnslib_rrtype_to_string(rrset->type)); printf(" type: %s\n", knot_rrtype_to_string(rrset->type));
printf(" class: %d\n", rrset->rclass); printf(" class: %d\n", rrset->rclass);
printf(" ttl: %d\n", rrset->ttl); printf(" ttl: %d\n", rrset->ttl);
printf(" RRSIGs:\n"); printf(" RRSIGs:\n");
if (rrset->rrsigs != NULL) { if (rrset->rrsigs != NULL) {
dnslib_rrset_dump(rrset->rrsigs, loaded_zone); knot_rrset_dump(rrset->rrsigs, loaded_zone);
} else { } else {
printf(" none\n"); printf(" none\n");
} }
...@@ -84,48 +84,48 @@ void dnslib_rrset_dump(dnslib_rrset_t *rrset, char loaded_zone) ...@@ -84,48 +84,48 @@ void dnslib_rrset_dump(dnslib_rrset_t *rrset, char loaded_zone)
return; return;
} }
dnslib_rdata_t *tmp = rrset->rdata; knot_rdata_t *tmp = rrset->rdata;
while (tmp->next != rrset->rdata) { while (tmp->next != rrset->rdata) {
dnslib_rdata_dump(tmp, rrset->type, loaded_zone); knot_rdata_dump(tmp, rrset->type, loaded_zone);
tmp = tmp->next; tmp = tmp->next;
} }
dnslib_rdata_dump(tmp, rrset->type, loaded_zone); knot_rdata_dump(tmp, rrset->type, loaded_zone);
printf(" ------- RRSET -------\n"); printf(" ------- RRSET -------\n");
#endif #endif
} }
void dnslib_node_dump(dnslib_node_t *node, void *loaded_zone) void knot_node_dump(knot_node_t *node, void *loaded_zone)
{ {
#if defined(DNSLIB_ZONE_DEBUG) || defined(DNSLIB_NODE_DEBUG) #if defined(DNSLIB_ZONE_DEBUG) || defined(DNSLIB_NODE_DEBUG)
//char loaded_zone = *((char*) data); //char loaded_zone = *((char*) data);
char *name; char *name;
printf("------- NODE --------\n"); printf("------- NODE --------\n");
name = dnslib_dname_to_str(node->owner); name = knot_dname_to_str(node->owner);
printf("owner: %s\n", name); printf("owner: %s\n", name);
free(name); free(name);
printf("labels: "); printf("labels: ");
hex_print((char *)node->owner->labels, node->owner->label_count); hex_print((char *)node->owner->labels, node->owner->label_count);
printf("node/id: %p\n", node->owner->node); printf("node/id: %p\n", node->owner->node);
if (loaded_zone && node->prev != NULL) { if (loaded_zone && node->prev != NULL) {
name = dnslib_dname_to_str(node->prev->owner); name = knot_dname_to_str(node->prev->owner);
printf("previous node: %s\n", name);