Skip to content
Snippets Groups Projects
Commit e48c1fb4 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

renamed to rose

parent d71311b3
Branches
Tags
No related merge requests found
......@@ -113,13 +113,13 @@ src/knot/dnssec/zone-sign.c
src/knot/dnssec/zone-sign.h
src/knot/knot.h
src/knot/main.c
src/knot/modules/dcudb.c
src/knot/modules/dcudb.h
src/knot/modules/dcudb_tool.c
src/knot/modules/dnsproxy.c
src/knot/modules/dnsproxy.h
src/knot/modules/dnstap.c
src/knot/modules/dnstap.h
src/knot/modules/rosedb.c
src/knot/modules/rosedb.h
src/knot/modules/rosedb_tool.c
src/knot/modules/synth_record.c
src/knot/modules/synth_record.h
src/knot/nameserver/axfr.c
......
......@@ -352,14 +352,14 @@ endif
if HAVE_LMDB
libknotd_la_SOURCES += \
knot/modules/dcudb.c \
knot/modules/dcudb.h
knot/modules/rosedb.c \
knot/modules/rosedb.h
dcudb_tool_SOURCES = \
knot/modules/dcudb_tool.c
rosedb_tool_SOURCES = \
knot/modules/rosedb_tool.c
bin_PROGRAMS += dcudb_tool
dcudb_tool_LDADD = libknot.la libknotd.la
bin_PROGRAMS += rosedb_tool
rosedb_tool_LDADD = libknot.la libknotd.la
endif
# Create storage and run-time directories
......
......@@ -16,7 +16,7 @@
#include <lmdb.h>
#include "knot/modules/dcudb.h"
#include "knot/modules/rosedb.h"
#include "knot/nameserver/process_query.h"
struct cache
......@@ -257,7 +257,7 @@ int cache_remove(MDB_txn *txn, MDB_dbi dbi, const knot_dname_t *name)
#define DEFAULT_PORT 514
#define SYSLOG_BUFLEN 1024 /* RFC3164, 4.1 message size. */
#define SYSLOG_FACILITY 3 /* System daemon. */
#define MODULE_ERR(msg...) log_error("module 'dcu', " msg)
#define MODULE_ERR(msg...) log_error("module 'rose', " msg)
/*! \brief Safe stream skipping. */
static int stream_skip(char **stream, size_t *maxlen, int nbytes)
......@@ -278,7 +278,7 @@ static int stream_skip(char **stream, size_t *maxlen, int nbytes)
return KNOT_ESPACE; \
}
static int dcudb_log_message(char *stream, size_t *maxlen, struct entry *entry, struct query_data *qdata)
static int rosedb_log_message(char *stream, size_t *maxlen, struct entry *entry, struct query_data *qdata)
{
struct sockaddr_storage addr;
socklen_t addr_len = sizeof(addr);
......@@ -334,7 +334,7 @@ static int dcudb_log_message(char *stream, size_t *maxlen, struct entry *entry,
return KNOT_EOK;
}
static int dcudb_send_log(int sock, struct sockaddr_storage *dst_addr, struct entry *entry, struct query_data *qdata)
static int rosedb_send_log(int sock, struct sockaddr_storage *dst_addr, struct entry *entry, struct query_data *qdata)
{
char buf[SYSLOG_BUFLEN];
char *stream = buf;
......@@ -355,7 +355,7 @@ static int dcudb_send_log(int sock, struct sockaddr_storage *dst_addr, struct en
STREAM_WRITE(stream, &maxlen, snprintf, "%s[%lu]: ", PACKAGE_NAME, (unsigned long) getpid());
/* Prepare log message line. */
int ret = dcudb_log_message(stream, &maxlen, entry, qdata);
int ret = rosedb_log_message(stream, &maxlen, entry, qdata);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -367,7 +367,7 @@ static int dcudb_send_log(int sock, struct sockaddr_storage *dst_addr, struct en
return ret;
}
static int dcudb_synth(knot_pkt_t *pkt, struct entry *entry)
static int rosedb_synth(knot_pkt_t *pkt, struct entry *entry)
{
size_t addr_len = 0;
struct sockaddr_storage addr;
......@@ -388,7 +388,7 @@ static int dcudb_synth(knot_pkt_t *pkt, struct entry *entry)
return ret;
}
static int dcudb_query_txn(MDB_txn *txn, MDB_dbi dbi, knot_pkt_t *pkt, struct query_data *qdata)
static int rosedb_query_txn(MDB_txn *txn, MDB_dbi dbi, knot_pkt_t *pkt, struct query_data *qdata)
{
struct entry entry;
int ret = 0;
......@@ -410,14 +410,14 @@ static int dcudb_query_txn(MDB_txn *txn, MDB_dbi dbi, knot_pkt_t *pkt, struct qu
}
/* Synthetize A record to response. */
ret = dcudb_synth(pkt, &entry);
ret = rosedb_synth(pkt, &entry);
/* Send message to syslog. */
struct sockaddr_storage syslog_addr;
sockaddr_set(&syslog_addr, AF_INET, entry.syslog_ip, DEFAULT_PORT);
int sock = net_unbound_socket(AF_INET, &syslog_addr);
if (sock > 0) {
dcudb_send_log(sock, &syslog_addr, &entry, qdata);
rosedb_send_log(sock, &syslog_addr, &entry, qdata);
close(sock);
}
......@@ -425,7 +425,7 @@ static int dcudb_query_txn(MDB_txn *txn, MDB_dbi dbi, knot_pkt_t *pkt, struct qu
return ret;
}
static int dcudb_query(int state, knot_pkt_t *pkt, struct query_data *qdata, void *ctx)
static int rosedb_query(int state, knot_pkt_t *pkt, struct query_data *qdata, void *ctx)
{
if (pkt == NULL || qdata == NULL || ctx == NULL) {
return NS_PROC_FAIL;
......@@ -444,7 +444,7 @@ static int dcudb_query(int state, knot_pkt_t *pkt, struct query_data *qdata, voi
return state;
}
ret = dcudb_query_txn(txn, cache->dbi, pkt, qdata);
ret = rosedb_query_txn(txn, cache->dbi, pkt, qdata);
if (ret != 0) { /* Can't find matching zone, ignore. */
mdb_txn_abort(txn);
return state;
......@@ -455,7 +455,7 @@ static int dcudb_query(int state, knot_pkt_t *pkt, struct query_data *qdata, voi
return NS_PROC_DONE;
}
int dcudb_load(struct query_plan *plan, struct query_module *self)
int rosedb_load(struct query_plan *plan, struct query_module *self)
{
struct cache *cache = cache_open(self->param, 0, self->mm);
if (cache == NULL) {
......@@ -465,10 +465,10 @@ int dcudb_load(struct query_plan *plan, struct query_module *self)
self->ctx = cache;
return query_plan_step(plan, QPLAN_BEGIN, dcudb_query, cache);
return query_plan_step(plan, QPLAN_BEGIN, rosedb_query, cache);
}
int dcudb_unload(struct query_module *self)
int rosedb_unload(struct query_module *self)
{
cache_close(self->ctx);
return KNOT_EOK;
......
......@@ -36,7 +36,7 @@
#include "knot/nameserver/query_module.h"
/*! \brief Module interface. */
int dcudb_load(struct query_plan *plan, struct query_module *self);
int dcudb_unload(struct query_module *self);
int rosedb_load(struct query_plan *plan, struct query_module *self);
int rosedb_unload(struct query_module *self);
/*! @} */
#include <string.h>
#include <stdlib.h>
#include <lmdb.h>
#include "knot/modules/dcudb.c"
#include "knot/modules/rosedb.c"
static int dcudb_add(struct cache *cache, int argc, char *argv[]);
static int dcudb_del(struct cache *cache, int argc, char *argv[]);
static int dcudb_get(struct cache *cache, int argc, char *argv[]);
static int dcudb_list(struct cache *cache, int argc, char *argv[]);
static int rosedb_add(struct cache *cache, int argc, char *argv[]);
static int rosedb_del(struct cache *cache, int argc, char *argv[]);
static int rosedb_get(struct cache *cache, int argc, char *argv[]);
static int rosedb_list(struct cache *cache, int argc, char *argv[]);
struct tool_action {
const char *name;
......@@ -17,15 +17,15 @@ struct tool_action {
#define TOOL_ACTION_COUNT 4
static struct tool_action TOOL_ACTION[TOOL_ACTION_COUNT] = {
{ "add", dcudb_add, 4, "<zone> <ip> <threat_code> <syslog_ip>" },
{ "del", dcudb_del, 1, "<zone>" },
{ "get", dcudb_get, 1, "<zone>" },
{ "list", dcudb_list, 0, "" },
{ "add", rosedb_add, 4, "<zone> <ip> <threat_code> <syslog_ip>" },
{ "del", rosedb_del, 1, "<zone>" },
{ "get", rosedb_get, 1, "<zone>" },
{ "list", rosedb_list, 0, "" },
};
static int help(void)
{
printf("Usage: dcudb_tool <dbdir> <action> [params]\n");
printf("Usage: rosedb_tool <dbdir> <action> [params]\n");
printf("Actions:\n");
for (unsigned i = 0; i < TOOL_ACTION_COUNT; ++i) {
struct tool_action *ta = &TOOL_ACTION[i];
......@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
return ret;
}
static int dcudb_add(struct cache *cache, int argc, char *argv[])
static int rosedb_add(struct cache *cache, int argc, char *argv[])
{
printf("ADD %s\t%s\t%s\t%s\n", argv[0], argv[1], argv[2], argv[3]);
......@@ -107,7 +107,7 @@ static int dcudb_add(struct cache *cache, int argc, char *argv[])
return ret;
}
static int dcudb_del(struct cache *cache, int argc, char *argv[])
static int rosedb_del(struct cache *cache, int argc, char *argv[])
{
printf("DEL %s\n", argv[0]);
......@@ -126,7 +126,7 @@ static int dcudb_del(struct cache *cache, int argc, char *argv[])
return ret;
}
static int dcudb_get(struct cache *cache, int argc, char *argv[])
static int rosedb_get(struct cache *cache, int argc, char *argv[])
{
MDB_txn *txn = NULL;
int ret = mdb_txn_begin(cache->env, NULL, MDB_RDONLY, &txn);
......@@ -148,7 +148,7 @@ static int dcudb_get(struct cache *cache, int argc, char *argv[])
return ret;
}
static int dcudb_list(struct cache *cache, int argc, char *argv[])
static int rosedb_list(struct cache *cache, int argc, char *argv[])
{
MDB_txn *txn = NULL;
int ret = mdb_txn_begin(cache->env, NULL, MDB_RDONLY, &txn);
......
......@@ -7,7 +7,7 @@
#include "knot/modules/synth_record.h"
#include "knot/modules/dnsproxy.h"
#ifdef HAVE_LMDB
#include "knot/modules/dcudb.h"
#include "knot/modules/rosedb.h"
#endif
#if USE_DNSTAP
#include "knot/modules/dnstap.h"
......@@ -25,7 +25,7 @@ struct compiled_module MODULES[] = {
{ "synth_record", &synth_record_load, &synth_record_unload },
{ "dnsproxy", &dnsproxy_load, &dnsproxy_unload },
#ifdef HAVE_LMDB
{ "dcudb", &dcudb_load, &dcudb_unload },
{ "rosedb", &rosedb_load, &rosedb_unload },
#endif
#if USE_DNSTAP
{ "dnstap", &dnstap_load, &dnstap_unload }
......
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