Commit a933557a authored by Daniel Salzman's avatar Daniel Salzman

src: remove some unused functions + code cleanup

parent 420fe249
......@@ -209,6 +209,8 @@ libknotd_la_SOURCES = \
knot/conf/extra.h \
knot/conf/includes.c \
knot/conf/includes.h \
knot/ctl/estimator.c \
knot/ctl/estimator.h \
knot/ctl/process.c \
knot/ctl/process.h \
knot/ctl/remote.c \
......@@ -285,8 +287,6 @@ libknotd_la_SOURCES = \
knot/worker/queue.h \
knot/zone/contents.c \
knot/zone/contents.h \
knot/zone/estimator.c \
knot/zone/estimator.h \
knot/zone/events.c \
knot/zone/events.h \
knot/zone/node.c \
......
......@@ -16,7 +16,7 @@
#include <assert.h>
#include "knot/zone/estimator.h"
#include "knot/ctl/estimator.h"
#include "libknot/dname.h"
#include "common/lists.h"
#include "knot/zone/node.h"
......
......@@ -34,7 +34,7 @@
#include "knot/zone/zone-load.h"
#include "knot/server/tcp-handler.h"
#include "libknot/packet/wire.h"
#include "knot/zone/estimator.h"
#include "knot/ctl/estimator.h"
/*! \brief Controller flags. */
enum knotc_flag_t {
......
......@@ -19,9 +19,8 @@
#include "knot/server/udp-handler.h"
/* State-less packet capture, only incoming data is accepted. */
static int noop(knot_pkt_t *pkt, knot_process_t *ctx) { return NS_PROC_NOOP; }
static int reset(knot_process_t *ctx) { return NS_PROC_MORE; }
static int finish(knot_process_t *ctx) { return NS_PROC_NOOP; }
static int reset(knot_process_t *ctx) { return NS_PROC_MORE; }
static int finish(knot_process_t *ctx) { return NS_PROC_NOOP; }
/* Set capture parameters (sink). */
static int begin(knot_process_t *ctx, void *module_param)
......@@ -49,8 +48,8 @@ static const knot_process_module_t PROCESS_CAPTURE_MODULE = {
&reset,
&finish,
&capture,
&noop, /* No output. */
&noop /* No error processing. */
&knot_process_noop, /* No output. */
&knot_process_noop /* No error processing. */
};
const knot_process_module_t *proc_capture_get_module(void)
......
......@@ -20,11 +20,6 @@
#include "knot/nameserver/ixfr.h"
#include "knot/nameserver/axfr.h"
static int noop(knot_pkt_t *pkt, knot_process_t *ctx)
{
return NS_PROC_NOOP;
}
/*! \brief Accessor to query-specific data. */
#define ANSWER_DATA(ctx) ((struct answer_data *)(ctx)->data)
......@@ -155,8 +150,8 @@ static const knot_process_module_t PROCESS_ANSWER_MODULE = {
&process_answer_reset,
&process_answer_finish,
&process_answer,
&noop, /* No output. */
&noop /* No error processing. */
&knot_process_noop, /* No output. */
&knot_process_noop /* No error processing. */
};
const knot_process_module_t *process_answer_get_module(void)
......
......@@ -105,11 +105,6 @@ void zone_free(zone_t **zone_ptr)
*zone_ptr = NULL;
}
changeset_t *zone_change_prepare(changesets_t *chset)
{
return changesets_create_changeset(chset);
}
int zone_change_commit(zone_contents_t *contents, changesets_t *chset)
{
assert(contents);
......
......@@ -93,7 +93,6 @@ void zone_free(zone_t **zone_ptr);
* \note Zone change API below, subject to change.
* \ref #223 New zone API
*/
changeset_t *zone_change_prepare(changesets_t *chset);
int zone_change_commit(zone_contents_t *contents, changesets_t *chset);
int zone_change_store(zone_t *zone, changesets_t *chset);
/*! \note @mvavrusa Moved from zones.c, this needs a common API. */
......
......@@ -116,22 +116,6 @@ size_t knot_tsig_digest_length(const uint8_t algorithm)
}
}
size_t knot_ds_digest_length(const uint8_t algorithm)
{
switch (algorithm) {
case KNOT_DS_ALG_SHA1:
return KNOT_DS_DIGEST_LEN_SHA1;
case KNOT_DS_ALG_SHA256:
return KNOT_DS_DIGEST_LEN_SHA256;
case KNOT_DS_ALG_GOST:
return KNOT_DS_DIGEST_LEN_GOST;
case KNOT_DS_ALG_SHA384:
return KNOT_DS_DIGEST_LEN_SHA384;
default:
return 0;
}
}
bool knot_dnssec_algorithm_is_zonesign(uint8_t algorithm, bool nsec3_enabled)
{
switch (algorithm) {
......
......@@ -220,15 +220,6 @@ extern knot_lookup_table_t knot_dnssec_alg_names[];
*/
size_t knot_tsig_digest_length(const uint8_t algorithm);
/*!
* \brief Returns length of DS digest for given algorithm.
*
* \param algorithm Algorithm code to be used.
*
* \retval Digest length for given algorithm.
*/
size_t knot_ds_digest_length(const uint8_t algorithm);
/*!
* \brief Check if algorithm is supported for zone signing.
*
......
......@@ -31,7 +31,8 @@ static const char* _state_table[] = {
};
#endif /* KNOT_NS_DEBUG */
int knot_process_begin(knot_process_t *ctx, void *module_param, const knot_process_module_t *module)
int knot_process_begin(knot_process_t *ctx, void *module_param,
const knot_process_module_t *module)
{
/* Only in inoperable state. */
if (ctx->state != NS_PROC_NOOP) {
......
......@@ -69,6 +69,14 @@ typedef struct knot_process_module {
int (*err)(knot_pkt_t *pkt, knot_process_t *ctx);
} knot_process_module_t;
/*!
* \brief Universal noop process function.
*/
static int knot_process_noop(knot_pkt_t *pkt, knot_process_t *ctx)
{
return NS_PROC_NOOP;
}
/*!
* \brief Initialize packet processing context.
*
......@@ -79,7 +87,8 @@ typedef struct knot_process_module {
* \param module Module API.
* \return (module specific state)
*/
int knot_process_begin(knot_process_t *ctx, void *module_param, const knot_process_module_t *module);
int knot_process_begin(knot_process_t *ctx, void *module_param,
const knot_process_module_t *module);
/*!
* \brief Reset current packet processing context.
......
......@@ -443,29 +443,6 @@ size_t tsig_wire_maxsize(const knot_tsig_key_t *key)
6* sizeof(uint8_t); /* uint48_t in case of BADTIME RCODE */
}
size_t tsig_wire_actsize(const knot_rrset_t *tsig)
{
if (tsig == NULL) {
return 0;
}
/*! \todo Used fixed size as a base. */
return knot_dname_size(tsig->owner) +
sizeof(uint16_t) + /* TYPE */
sizeof(uint16_t) + /* CLASS */
sizeof(uint32_t) + /* TTL */
sizeof(uint16_t) + /* RDLENGTH */
knot_dname_size(tsig_rdata_alg_name(tsig)) +
6 * sizeof(uint8_t) + /* Time signed */
sizeof(uint16_t) + /* Fudge */
sizeof(uint16_t) + /* MAC size */
tsig_rdata_mac_length(tsig) +
sizeof(uint16_t) + /* Original ID */
sizeof(uint16_t) + /* Error */
sizeof(uint16_t) + /* Other len */
tsig_rdata_other_data_length(tsig);
}
int tsig_rdata_is_ok(const knot_rrset_t *tsig)
{
/*! \todo Check size, needs to check variable-length fields. */
......
......@@ -134,7 +134,6 @@ const knot_dname_t* tsig_alg_to_dname(knot_tsig_algorithm_t alg);
* \return RRSET wire size.
*/
size_t tsig_wire_maxsize(const knot_tsig_key_t *key);
size_t tsig_wire_actsize(const knot_rrset_t *tsig);
int tsig_rdata_is_ok(const knot_rrset_t *tsig);
......
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