Commit 5e86843f authored by Jan Včelák's avatar Jan Včelák 🚀

split server dependent functions from libknot/dnssec/nsec-bitmap.h

issue #1
parent f4a82123
......@@ -180,12 +180,12 @@ src/libknot/consts.c
src/libknot/consts.h
src/libknot/dname.c
src/libknot/dname.h
src/libknot/dnssec/bitmap.h
src/libknot/dnssec/config.h
src/libknot/dnssec/crypto.c
src/libknot/dnssec/crypto.h
src/libknot/dnssec/key.c
src/libknot/dnssec/key.h
src/libknot/dnssec/nsec-bitmap.h
src/libknot/dnssec/nsec3.c
src/libknot/dnssec/nsec3.h
src/libknot/dnssec/policy.c
......
......@@ -33,6 +33,7 @@
#include "knot/zone/zone-contents.h"
#include "knot/updates/changesets.h"
#include "libknot/dnssec/bitmap.h"
/*!
* \brief Parameters to be used when fixing NSEC(3) chain.
......@@ -82,6 +83,22 @@ typedef int (*chain_finalize_cb)(chain_fix_data_t *);
typedef int (*chain_iterate_create_cb)(knot_node_t *, knot_node_t *,
nsec_chain_iterate_data_t *);
/*!
* \brief Add all RR types from a node into the bitmap.
*/
inline static void bitmap_add_node_rrsets(bitmap_t *bitmap,
const knot_node_t *node)
{
const knot_rrset_t **node_rrsets = knot_node_rrsets_no_copy(node);
for (int i = 0; i < node->rrset_count; i++) {
const knot_rrset_t *rr = node_rrsets[i];
if (rr->type != KNOT_RRTYPE_NSEC && rr->rdata_count > 0) {
bitmap_add_type(bitmap, node_rrsets[i]->type);
}
}
}
/*!
* \brief Call a function for each piece of the chain formed by sorted nodes.
*
......
......@@ -26,7 +26,7 @@
#include "knot/dnssec/nsec-chain.h"
#include "knot/dnssec/zone-sign.h"
#include "knot/dnssec/zone-nsec.h"
#include "libknot/dnssec/nsec-bitmap.h"
#include "libknot/dnssec/bitmap.h"
/* - Forward declarations --------------------------------------------------- */
......
......@@ -26,7 +26,7 @@
#include "common/hhash.h"
#include "knot/dnssec/nsec-chain.h"
#include "knot/dnssec/nsec3-chain.h"
#include "libknot/dnssec/nsec-bitmap.h"
#include "libknot/dnssec/bitmap.h"
#include "libknot/dnssec/nsec3.h"
#include "knot/dnssec/zone-nsec.h"
#include "knot/dnssec/zone-sign.h"
......
......@@ -34,7 +34,7 @@
#include "knot/zone/zone-contents.h"
#include "libknot/dnssec/policy.h"
#include "knot/dnssec/zone-keys.h"
#include "libknot/dnssec/nsec-bitmap.h"
#include "libknot/dnssec/bitmap.h"
/*!
* Check if NSEC3 is enabled for the given zone.
......
......@@ -14,7 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file nsec-bitmap.h
* \file bitmap.h
*
* \author Jan Vcelak <jan.vcelak@nic.cz>
*
......@@ -30,8 +30,6 @@
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include "knot/zone/node.h"
#include "libknot/rrset.h"
#include "common/descriptor.h"
#define BITMAP_WINDOW_SIZE 256
......@@ -76,21 +74,6 @@ inline static void bitmap_add_type(bitmap_t *bitmap, uint16_t type)
}
}
/*!
* \brief Add all RR types from a node into the bitmap.
*/
inline static void bitmap_add_node_rrsets(bitmap_t *bitmap,
const knot_node_t *node)
{
const knot_rrset_t **node_rrsets = knot_node_rrsets_no_copy(node);
for (int i = 0; i < node->rrset_count; i++) {
const knot_rrset_t *rr = node_rrsets[i];
if (rr->type != KNOT_RRTYPE_NSEC && rr->rdata_count > 0) {
bitmap_add_type(bitmap, node_rrsets[i]->type);
}
}
}
/*!
* \brief Compute the size of the bitmap in NSEC RDATA format.
*/
......
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