Skip to content
Snippets Groups Projects
Commit 42ffda25 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Removed deprecated wildcard node list from packet.

parent 54e8d248
No related branches found
No related tags found
1 merge request!147Packet Api Rewrite
......@@ -876,44 +876,6 @@ int knot_pkt_parse_payload(knot_pkt_t *pkt, unsigned flags)
/*** <<< #10 DEPRECATED */
/*----------------------------------------------------------------------------*/
/*!
* \brief Reallocate space for Wildcard nodes.
*
* \retval KNOT_EOK
* \retval KNOT_ENOMEM
*/
static int knot_response_realloc_wc_nodes(const knot_node_t ***nodes,
const knot_dname_t ***snames,
short *max_count,
mm_ctx_t *mm)
{
short new_max_count = *max_count + 8;
const knot_node_t **new_nodes = mm->alloc(mm->ctx,
new_max_count * sizeof(knot_node_t *));
CHECK_ALLOC_LOG(new_nodes, KNOT_ENOMEM);
const knot_dname_t **new_snames = mm->alloc(mm->ctx,
new_max_count * sizeof(knot_dname_t *));
if (new_snames == NULL) {
mm->free(new_nodes);
return KNOT_ENOMEM;
}
memcpy(new_nodes, *nodes, (*max_count) * sizeof(knot_node_t *));
memcpy(new_snames, *snames, (*max_count) * sizeof(knot_dname_t *));
mm->free(*nodes);
mm->free(*snames);
*nodes = new_nodes;
*snames = new_snames;
*max_count = new_max_count;
return KNOT_EOK;
}
int knot_pkt_add_opt(knot_pkt_t *resp,
const knot_opt_rr_t *opt_rr,
int add_nsid)
......@@ -967,32 +929,5 @@ int knot_pkt_add_opt(knot_pkt_t *resp,
return KNOT_EOK;
}
int knot_pkt_add_wildcard_node(knot_pkt_t *response,
const knot_node_t *node,
const knot_dname_t *sname)
{
if (response == NULL || node == NULL || sname == NULL) {
return KNOT_EINVAL;
}
if (response->wildcard_nodes.count == response->wildcard_nodes.max
&& knot_response_realloc_wc_nodes(&response->wildcard_nodes.nodes,
&response->wildcard_nodes.snames,
&response->wildcard_nodes.max,
&response->mm) != KNOT_EOK) {
return KNOT_ENOMEM;
}
response->wildcard_nodes.nodes[response->wildcard_nodes.count] = node;
response->wildcard_nodes.snames[response->wildcard_nodes.count] = sname;
++response->wildcard_nodes.count;
dbg_response_verb("Current wildcard nodes count: %d, max count: %d\n",
response->wildcard_nodes.count,
response->wildcard_nodes.max);
return KNOT_EOK;
}
/*** >>> #10 DEPRECATED */
/*----------------------------------------------------------------------------*/
......@@ -42,15 +42,6 @@
/*** <<< #10 DEPRECATED */
/*----------------------------------------------------------------------------*/
struct knot_wildcard_nodes {
const knot_node_t **nodes; /*!< Wildcard nodes from CNAME processing. */
const knot_dname_t **snames; /*!< SNAMEs related to the nodes. */
short count; /*!< Count of items in the previous arrays. */
short max; /*!< Capacity of the structure (allocated). */
};
typedef struct knot_wildcard_nodes knot_wildcard_nodes_t;
#define KNOT_PKT_IN_AN(pkt) ((pkt)->current == KNOT_ANSWER)
#define KNOT_PKT_IN_NS(pkt) ((pkt)->current == KNOT_AUTHORITY)
#define KNOT_PKT_IN_AR(pkt) ((pkt)->current == KNOT_ADDITIONAL)
......@@ -106,9 +97,6 @@ typedef struct knot_pkt {
/* #10 <<< SHOULD BE IN ANSWERING CONTEXT */
const knot_tsig_key_t *tsig_key;
const struct knot_pkt *query; /*!< Associated query. */
/*! \brief Wildcard nodes to be processed for NSEC/NSEC3. */
knot_wildcard_nodes_t wildcard_nodes;
/* #10 >>> SHOULD BE IN ANSWERING CONTEXT */
knot_section_t current;
......@@ -204,11 +192,6 @@ int knot_pkt_add_opt(knot_pkt_t *resp,
const knot_opt_rr_t *opt_rr,
int add_nsid);
int knot_pkt_add_wildcard_node(knot_pkt_t *response,
const knot_node_t *node,
const knot_dname_t *sname);
/*----------------------------------------------------------------------------*/
/*** >>> #10 DEPRECATED */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment