Commit 5e48ae85 authored by Lubos Slovak's avatar Lubos Slovak

Source files reorganization.

- Sources separated according to the future compilation modules:
  - src/knot/ contains all sources related to server (compiles into
    knotc and knotd)
  - src/alloc/ contains sources of slab allocator (may be compiled
    into standalone library).
  - src/dnslib/ contains dnslib sources (may be compiled as
    standalone library).
  - src/tests/ contains unittests (compiles into unittests).
  - src/zoneparser/ contains sources of zone compiler (compiles
    into knot-zcompile).

TODO: Need to refactor makefile to separate the compilation of
      these modules. However, unittests still depend on all
      modules.

refs #400
parent 31bece7b
......@@ -10,41 +10,6 @@ src/alloc/malloc.h
src/alloc/slab.c
src/alloc/slab.h
src/alloc/alloc-common.h
src/common.h
src/ctl/knotc_main.c
src/ctl/process.c
src/ctl/process.h
src/lib/bitset.c
src/lib/bitset.h
src/lib/lists.h
src/lib/lists.c
src/lib/base32.h
src/lib/base32.c
src/main.c
src/other/debug.h
src/other/log.c
src/other/log.h
src/other/print.c
src/other/print.h
src/other/latency.c
src/other/latency.h
src/server/dthreads.c
src/server/dthreads.h
src/server/name-server.c
src/server/name-server.h
src/server/server.c
src/server/server.h
src/server/socket.c
src/server/socket.h
src/server/tcp-handler.c
src/server/tcp-handler.h
src/server/udp-handler.c
src/server/udp-handler.h
src/stat/gatherer.c
src/stat/gatherer.h
src/stat/stat.h
src/stat/stat.c
src/stat/stat-common.h
src/dnslib/dnslib-common.h
src/dnslib/dname.h
src/dnslib/dname.c
......@@ -104,6 +69,49 @@ src/zoneparser/zparser.y
src/zoneparser/zlexer.l
src/zoneparser/tests/unittests_zp_main.c
src/zoneparser/tests/zcompile_tests.c
src/knot/common.h
src/knot/main.c
src/knot/ctl/knotc_main.c
src/knot/ctl/process.c
src/knot/ctl/process.h
src/knot/lib/bitset.c
src/knot/lib/bitset.h
src/knot/lib/lists.h
src/knot/lib/lists.c
src/knot/lib/base32.h
src/knot/lib/base32.c
src/knot/other/debug.h
src/knot/other/log.c
src/knot/other/log.h
src/knot/other/print.c
src/knot/other/print.h
src/knot/other/latency.c
src/knot/other/latency.h
src/knot/stat/gatherer.c
src/knot/stat/gatherer.h
src/knot/stat/stat.h
src/knot/stat/stat.c
src/knot/stat/stat-common.h
src/knot/server/dthreads.c
src/knot/server/dthreads.h
src/knot/server/name-server.c
src/knot/server/name-server.h
src/knot/server/server.c
src/knot/server/server.h
src/knot/server/socket.c
src/knot/server/socket.h
src/knot/server/tcp-handler.c
src/knot/server/tcp-handler.h
src/knot/server/udp-handler.c
src/knot/server/udp-handler.h
src/knot/ctl/process.c
src/knot/ctl/process.h
src/knot/conf/cf-lex.l
src/knot/conf/cf-parse.y
src/knot/conf/conf.c
src/knot/conf/conf.h
src/knot/conf/logconf.c
src/knot/conf/logconf.h
src/tests/conf_tests.c
src/tests/cuckoo_tests.c
src/tests/da_tests.c
......@@ -135,13 +143,5 @@ src/tests/dnslib/dnslib_response_tests.c
src/tests/dnslib/dnslib_rrsig_set_tests.c
src/tests/dnslib/dnslib_zone_tests.c
src/tests/dnslib/dnslib_edns_tests.c
src/ctl/process.c
src/ctl/process.h
src/conf/cf-lex.l
src/conf/cf-parse.y
src/conf/conf.c
src/conf/conf.h
src/conf/logconf.c
src/conf/logconf.h
tests/querytcp.c
src/tests/zoneparser_tests.c
tests/querytcp.c
......@@ -3,7 +3,7 @@
AC_PREREQ([2.67])
AC_INIT([knot], [0.2], [bug-me-knot@nic.cz])
AM_INIT_AUTOMAKE([gnu -Wall -Werror])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_SRCDIR([src/knot/main.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS([_GNU_SOURCE])
......
......@@ -31,7 +31,7 @@ CLEANFILES = \
libknot_la-cf-parse.h
knotc_SOURCES = \
ctl/knotc_main.c
knot/ctl/knotc_main.c
knot_zcompile_SOURCES = \
zoneparser/zoneparser_main.c \
......@@ -66,27 +66,26 @@ nodist_unittests_SOURCES = \
tests/sample_conf.rc
knotd_SOURCES = \
main.c
knot/main.c
noinst_LTLIBRARIES = libknot.la
libknot_la_SOURCES = \
common.h \
alloc/slab.c \
alloc/malloc.c \
conf/cf-parse.y \
conf/cf-lex.l \
conf/conf.c \
conf/logconf.c \
ctl/process.c \
lib/lists.c \
alloc/slab.h \
alloc/malloc.h \
knot/stat/gatherer.c \
knot/stat/stat.c \
knot/stat/gatherer.h \
knot/stat/stat.h \
dnslib/ext/dynamic-array.c \
lib/bitset.c \
dnslib/ext/skip-list.c \
lib/base32.c \
dnslib/ext/base32hex.c \
stat/gatherer.c \
stat/stat.c \
dnslib/edns.c \
dnslib/ext/skip-list.h \
dnslib/ext/dynamic-array.h \
dnslib/ext/tree.h \
dnslib/ext/base32hex.h \
dnslib/edns.c \
dnslib/utils.c \
dnslib/rrset.c \
dnslib/dname.c \
......@@ -100,33 +99,12 @@ libknot_la_SOURCES = \
dnslib/rdata.c \
dnslib/descriptor.c \
dnslib/nsec3.c \
server/dthreads.c \
server/socket.c \
server/name-server.c \
server/server.c \
server/udp-handler.c \
server/tcp-handler.c \
dnslib/hash/hash-functions.c \
dnslib/hash/cuckoo-hash-table.c \
dnslib/hash/universal-system.c \
other/log.c \
other/print.c \
alloc/slab.h \
alloc/malloc.h \
conf/logconf.h \
conf/conf.h \
ctl/process.h \
lib/lists.h \
dnslib/ext/skip-list.h \
dnslib/ext/dynamic-array.h \
dnslib/ext/tree.h \
lib/bitset.h \
lib/base32.h \
dnslib/ext/base32hex.h \
tests/libtap/tap.h \
tests/tap_unit.h \
stat/gatherer.h \
stat/stat.h \
dnslib/hash/universal-system.h \
dnslib/hash/cuckoo-hash-table.h \
dnslib/hash/hash-functions.h \
dnslib/zonedb.h \
dnslib/consts.h \
dnslib/node.h \
......@@ -145,18 +123,40 @@ libknot_la_SOURCES = \
dnslib/packet.h \
dnslib/debug.h \
dnslib/nsec3.h \
server/socket.h \
server/name-server.h \
server/udp-handler.h \
server/tcp-handler.h \
server/dthreads.h \
server/server.h \
dnslib/hash/universal-system.h \
dnslib/hash/cuckoo-hash-table.h \
dnslib/hash/hash-functions.h \
other/print.h \
other/log.h \
other/debug.h
knot/common.h \
knot/lib/lists.c \
knot/lib/bitset.c \
knot/lib/base32.c \
knot/lib/lists.h \
knot/lib/bitset.h \
knot/lib/base32.h \
knot/other/log.c \
knot/other/print.c \
knot/other/print.h \
knot/other/log.h \
knot/other/debug.h \
knot/conf/cf-parse.y \
knot/conf/cf-lex.l \
knot/conf/conf.c \
knot/conf/logconf.c \
knot/conf/logconf.h \
knot/conf/conf.h \
knot/ctl/process.c \
knot/ctl/process.h \
knot/server/dthreads.c \
knot/server/socket.c \
knot/server/name-server.c \
knot/server/server.c \
knot/server/udp-handler.c \
knot/server/tcp-handler.c \
knot/server/socket.h \
knot/server/name-server.h \
knot/server/udp-handler.h \
knot/server/tcp-handler.h \
knot/server/dthreads.h \
knot/server/server.h \
tests/libtap/tap.h \
tests/tap_unit.h
libknot_la_LIBADD = @LIBOBJS@
......
......@@ -46,10 +46,10 @@ typedef unsigned int uint;
/* Common includes.
*/
#include "other/latency.h"
#include "other/print.h"
#include "other/log.h"
#include "other/debug.h"
#include "knot/other/latency.h"
#include "knot/other/print.h"
#include "knot/other/log.h"
#include "knot/other/debug.h"
/* Common macros.
*/
......
......@@ -14,8 +14,8 @@
#include <stdarg.h>
#include <arpa/inet.h>
#include "conf/conf.h"
#include "other/log.h"
#include "knot/conf/conf.h"
#include "knot/other/log.h"
#include "libknot_la-cf-parse.h" /* Automake generated header. */
/* Imported symbols. */
......
......@@ -11,7 +11,7 @@
#include <string.h>
#include <stdlib.h>
#include "dnslib/dname.h"
#include "conf/conf.h"
#include "knot/conf/conf.h"
extern int yylex (void);
extern void cf_error(const char *msg);
......
......@@ -7,8 +7,8 @@
#include <unistd.h>
#include <errno.h>
#include "conf/conf.h"
#include "common.h"
#include "knot/conf/conf.h"
#include "knot/common.h"
static const char *DEFAULT_CONFIG_1 = "/." PROJECT_EXEC "/" PROJECT_EXEC \
".conf";
......
......@@ -16,8 +16,8 @@
#include <sys/socket.h>
#include "dnslib/descriptor.h"
#include "lib/lists.h"
#include "other/log.h"
#include "knot/lib/lists.h"
#include "knot/other/log.h"
/* Constants. */
#define CONFIG_DEFAULT_PORT 53
......
......@@ -4,10 +4,10 @@
#include <stdlib.h>
#include <stdint.h>
#include "conf/logconf.h"
#include "conf/conf.h"
#include "other/log.h"
#include "lib/lists.h"
#include "knot/conf/logconf.h"
#include "knot/conf/conf.h"
#include "knot/other/log.h"
#include "knot/lib/lists.h"
int log_conf_hook(const struct conf_t *conf)
{
......
......@@ -4,10 +4,10 @@
#include <unistd.h>
#include <string.h>
#include "common.h"
#include "ctl/process.h"
#include "conf/conf.h"
#include "conf/logconf.h"
#include "knot/common.h"
#include "knot/ctl/process.h"
#include "knot/conf/conf.h"
#include "knot/conf/logconf.h"
#include "dnslib/zone-load.h"
enum Constants {
......
......@@ -5,9 +5,9 @@
#include <errno.h>
#include <string.h>
#include "common.h"
#include "ctl/process.h"
#include "conf/conf.h"
#include "knot/common.h"
#include "knot/ctl/process.h"
#include "knot/conf/conf.h"
const char* pid_filename()
{
......
......@@ -3,7 +3,7 @@
#include <string.h>
#include <stdlib.h>
#include "lib/bitset.h"
#include "knot/lib/bitset.h"
#define WORD_SIZE 32
#define WORD_CHECK 31
......
......@@ -27,7 +27,7 @@
#define _BIRD_LISTS_C_
#include <stdlib.h>
#include "lib/lists.h"
#include "knot/lib/lists.h"
/**
* add_tail - append a node to a list
......
......@@ -57,7 +57,7 @@ void insert_node(node *, node *);
/*! \todo This is broken atm.
#ifndef _BIRD_LISTS_C_
#define LIST_INLINE extern inline
#include "lib/lists.c"
#include "knot/lib/lists.c"
#undef LIST_INLINE
#else
#define LIST_INLINE
......
......@@ -3,12 +3,12 @@
#include <stdlib.h>
#include <unistd.h>
#include "common.h"
#include "server/server.h"
#include "knot/common.h"
#include "knot/server/server.h"
#include "zoneparser/zoneparser.h"
#include "ctl/process.h"
#include "conf/conf.h"
#include "conf/logconf.h"
#include "knot/ctl/process.h"
#include "knot/conf/conf.h"
#include "knot/conf/logconf.h"
/*----------------------------------------------------------------------------*/
......
......@@ -11,8 +11,8 @@
#ifndef _KNOT_DEBUG_H_
#define _KNOT_DEBUG_H_
#include "other/log.h"
#include "other/print.h"
#include "knot/other/log.h"
#include "knot/other/print.h"
//#define SM_DEBUG
//#define NS_DEBUG
......
......@@ -4,10 +4,10 @@
#include <string.h>
#include <stdlib.h>
#include "common.h"
#include "other/log.h"
#include "lib/lists.h"
#include "conf/conf.h"
#include "knot/common.h"
#include "knot/other/log.h"
#include "knot/lib/lists.h"
#include "knot/conf/conf.h"
/*! Log source table. */
static uint8_t *LOG_FCL = 0;
......
#include <config.h>
#include <stdio.h>
#include "common.h"
#include "knot/common.h"
#include "print.h"
#include "log.h"
......
......@@ -6,8 +6,8 @@
#include <unistd.h>
#include <errno.h>
#include "common.h"
#include "server/dthreads.h"
#include "knot/common.h"
#include "knot/server/dthreads.h"
/* Lock thread state for R/W. */
static inline void lock_thread_rw(dthread_t *thread)
......
......@@ -5,9 +5,9 @@
#include <urcu.h>
#include "common.h"
#include "server/name-server.h"
#include "stat/stat.h"
#include "knot/common.h"
#include "knot/server/name-server.h"
#include "knot/stat/stat.h"
#include "dnslib/dnslib.h"
#include "dnslib/debug.h"
......
......@@ -22,7 +22,7 @@
#include <stdint.h>
#include "common.h"
#include "knot/common.h"
#include "dnslib/zonedb.h"
#include "dnslib/edns.h"
......
......@@ -7,17 +7,17 @@
#include <openssl/evp.h>
#include <assert.h>
#include "common.h"
#include "server/server.h"
#include "server/udp-handler.h"
#include "server/tcp-handler.h"
#include "server/name-server.h"
#include "stat/stat.h"
#include "knot/common.h"
#include "knot/server/server.h"
#include "knot/server/udp-handler.h"
#include "knot/server/tcp-handler.h"
#include "knot/server/name-server.h"
#include "knot/stat/stat.h"
#include "dnslib/zonedb.h"
#include "dnslib/zone-load.h"
#include "dnslib/debug.h"
#include "dnslib/dname.h"
#include "conf/conf.h"
#include "knot/conf/conf.h"
typedef struct {
int fd;
......
......@@ -19,10 +19,10 @@
#ifndef _KNOT_SERVER_H_
#define _KNOT_SERVER_H_
#include "common.h"
#include "server/name-server.h"
#include "server/socket.h"
#include "server/dthreads.h"
#include "knot/common.h"
#include "knot/server/name-server.h"
#include "knot/server/socket.h"
#include "knot/server/dthreads.h"
#include "dnslib/zonedb.h"
struct server;
......
......@@ -11,8 +11,8 @@
#include <netinet/ip.h>
#include <arpa/inet.h>
#include "common.h"
#include "server/socket.h"
#include "knot/common.h"
#include "knot/server/socket.h"
int socket_create(int family, int type)
{
......
......@@ -10,10 +10,10 @@
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
#include "server/tcp-handler.h"
#include "server/name-server.h"
#include "stat/stat.h"
#include "knot/common.h"
#include "knot/server/tcp-handler.h"
#include "knot/server/name-server.h"
#include "knot/stat/stat.h"
/*! \brief TCP connection pool. */
typedef struct tcp_pool_t {
......
......@@ -16,9 +16,9 @@
#ifndef _KNOT_TCPHANDLER_H_
#define _KNOT_TCPHANDLER_H_
#include "server/socket.h"
#include "server/server.h"
#include "server/dthreads.h"
#include "knot/server/socket.h"
#include "knot/server/server.h"
#include "knot/server/dthreads.h"
/*!
......
......@@ -9,11 +9,11 @@
#include <assert.h>
#include <errno.h>
#include "common.h"
#include "server/udp-handler.h"
#include "server/name-server.h"
#include "stat/stat.h"
#include "server/server.h"
#include "knot/common.h"
#include "knot/server/udp-handler.h"
#include "knot/server/name-server.h"
#include "knot/stat/stat.h"
#include "knot/server/server.h"
int udp_master(dthread_t *thread)
{
......
......@@ -16,9 +16,9 @@
#ifndef _KNOT_UDPHANDLER_H_
#define _KNOT_UDPHANDLER_H_
#include "server/socket.h"
#include "server/server.h"
#include "server/dthreads.h"
#include "knot/server/socket.h"
#include "knot/server/server.h"
#include "knot/server/dthreads.h"
/*!
* \brief UDP handler thread runnable.
......
#include <config.h>
#include <pthread.h>
#include "stat/stat-common.h"
#include "knot/stat/stat-common.h"
#include "alloc/malloc.h"
#include "stat/gatherer.h"
#include "knot/stat/gatherer.h"
gatherer_t *new_gatherer()
{
......
......@@ -9,9 +9,9 @@
#include <string.h>
#include <stdlib.h>
#include "stat/stat-common.h"
#include "stat/stat.h"
#include "stat/gatherer.h"
#include "knot/stat/stat-common.h"
#include "knot/stat/stat.h"
#include "knot/stat/gatherer.h"
#ifdef STAT_COMPILE
......
......@@ -19,7 +19,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include "stat/gatherer.h"
#include "knot/stat/gatherer.h"
#ifdef STAT_COMPILE
#define STAT_INIT(x) x = stat_new()
......
#include <stdio.h>
#include "tests/tap_unit.h"
#include "conf/conf.h"
#include "knot/conf/conf.h"
/* Resources. */
#include "sample_conf.rc"
......
#include "server/dthreads.h"
#include "knot/server/dthreads.h"
#include "tests/tap_unit.h"
#include <sys/select.h>
#include <pthread.h>
......
#include "server/server.h"
#include "knot/server/server.h"
#include "tests/tap_unit.h"
static int server_tests_count(int argc, char *argv[]);
......
#include <config.h>
#include "common.h"
#include "knot/common.h"
#include "tests/tap_unit.h"
// Units to test
......
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