Commit 20475e16 authored by Karel Slaný's avatar Karel Slaný Committed by Ondřej Surý

Merged lib/cookies/control.c into modules/cookies/cookiectl.c .

parent a0b66f4d
/* Copyright (C) 2016 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 <string.h>
#include "lib/cookies/control.h"
void kr_cookie_ctx_init(struct kr_cookie_ctx *ctx)
{
if (!ctx) {
return;
}
memset(ctx, 0, sizeof(*ctx));
ctx->clnt.current.alg_id = ctx->clnt.recent.alg_id = -1;
ctx->srvr.current.alg_id = ctx->srvr.recent.alg_id = -1;
}
......@@ -47,10 +47,3 @@ struct kr_cookie_ctx {
struct kr_cookie_settings clnt; /**< Client settings. */
struct kr_cookie_settings srvr; /**< Server settings. */
};
/**
* @brief Initialises cookie control context.
* @param ctx cookie control context
*/
KR_EXPORT
void kr_cookie_ctx_init(struct kr_cookie_ctx *ctx);
......@@ -48,7 +48,6 @@ ifeq ($(HAS_nettle),yes)
libkres_SOURCES += \
lib/cookies/alg_containers.c \
lib/cookies/alg_sha.c \
lib/cookies/control.c \
lib/cookies/helper.c \
lib/cookies/lru_cache.c \
lib/cookies/nonce.c
......
......@@ -34,6 +34,22 @@
#define NAME_SERVER_COOKIE_ALG "server_cookie_alg"
#define NAME_AVAILABLE_SERVER_COOKIE_ALGS "available_server_cookie_algs"
/**
* @brief Initialises cookie control context.
* @param ctx cookie control context
*/
static void kr_cookie_ctx_init(struct kr_cookie_ctx *ctx)
{
if (!ctx) {
return;
}
memset(ctx, 0, sizeof(*ctx));
ctx->clnt.current.alg_id = ctx->clnt.recent.alg_id = -1;
ctx->srvr.current.alg_id = ctx->srvr.recent.alg_id = -1;
}
static bool aply_enabled(bool *enabled, const JsonNode *node)
{
assert(enabled && node);
......
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