diff --git a/configure.ac b/configure.ac index 4c6f6cc..4606fbb 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ AC_PREREQ([2.68]) AC_INIT([taskrambler], [0.0.1], [Georg Hopp ]) LT_INIT AM_INIT_AUTOMAKE([subdir-objects]) -#AM_SILENT_RULES([yes]) +AM_SILENT_RULES([yes]) AC_COPYRIGHT([Copyright © 2012 Georg Hopp]) AC_REVISION([$Revision: 0.01 $]) AC_CONFIG_SRCDIR([src/taskrambler.c]) @@ -52,5 +52,6 @@ AC_CONFIG_FILES([Makefile src/class/Makefile src/hash/Makefile src/http/Makefile + src/logger/Makefile tests/Makefile]) AC_OUTPUT diff --git a/include/http.h b/include/http.h index fde505b..5eb5f04 100644 --- a/include/http.h +++ b/include/http.h @@ -10,6 +10,7 @@ #include "http/parser.h" #include "http/writer.h" #include "http/worker.h" +#include "http/interface/http_intro.h" #endif // __HTTP_H__ diff --git a/include/interface/http_intro.h b/include/http/interface/http_intro.h similarity index 100% rename from include/interface/http_intro.h rename to include/http/interface/http_intro.h diff --git a/include/logger.h b/include/logger.h index a9577db..5680044 100644 --- a/include/logger.h +++ b/include/logger.h @@ -1,56 +1,8 @@ -/** - * \file - * A generic logger class and two extended classes, One that logs to - * stderr and one that logs to the system syslog. - * - * \author Georg Hopp - * - * \copyright - * Copyright © 2012 Georg Hopp - * - * 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 . - */ - #ifndef __LOGGER_H__ #define __LOGGER_H__ -#include "class.h" - -typedef enum logger_level { - LOGGER_DEBUG=0, - LOGGER_INFO, - LOGGER_NOTICE, - LOGGER_WARNING, - LOGGER_ERR, - LOGGER_CRIT, - LOGGER_ALERT, - LOGGER_EMERG -} logger_level; - -extern const char * const logger_level_str[]; - -CLASS(Logger) { - logger_level min_level; -}; - -CLASS(LoggerStderr) { - EXTENDS(Logger); -}; - -CLASS(LoggerSyslog) { - EXTENDS(Logger); -}; +#include "logger/logger.h" +#include "logger/interface/logger.h" #endif // __LOGGER_H__ diff --git a/include/interface/logger.h b/include/logger/interface/logger.h similarity index 90% rename from include/interface/logger.h rename to include/logger/interface/logger.h index 9f02f02..549f584 100644 --- a/include/interface/logger.h +++ b/include/logger/interface/logger.h @@ -21,8 +21,8 @@ * along with this program. If not, see . */ -#ifndef __INTERFACE_LOGGER_H__ -#define __INTERFACE_LOGGER_H__ +#ifndef __LOGGER_INTERFACE_LOGGER_H__ +#define __LOGGER_INTERFACE_LOGGER_H__ #include @@ -40,6 +40,6 @@ struct i_Logger { extern void loggerLog(void *, logger_level, const char * const, ...); -#endif // __INTERFACE_LOGGER_H__ +#endif // __LOGGER_INTERFACE_LOGGER_H__ // vim: set ts=4 sw=4: diff --git a/include/logger/logger.h b/include/logger/logger.h new file mode 100644 index 0000000..fc10124 --- /dev/null +++ b/include/logger/logger.h @@ -0,0 +1,57 @@ +/** + * \file + * A generic logger class and two extended classes, One that logs to + * stderr and one that logs to the system syslog. + * + * \author Georg Hopp + * + * \copyright + * Copyright © 2012 Georg Hopp + * + * 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 . + */ + +#ifndef __LOGGER_LOGGER_H__ +#define __LOGGER_LOGGER_H__ + +#include "class.h" + +typedef enum logger_level { + LOGGER_DEBUG=0, + LOGGER_INFO, + LOGGER_NOTICE, + LOGGER_WARNING, + LOGGER_ERR, + LOGGER_CRIT, + LOGGER_ALERT, + LOGGER_EMERG +} logger_level; + +extern const char * const logger_level_str[]; + +CLASS(Logger) { + logger_level min_level; +}; + +CLASS(LoggerStderr) { + EXTENDS(Logger); +}; + +CLASS(LoggerSyslog) { + EXTENDS(Logger); +}; + +#endif // __LOGGER_LOGGER_H__ + +// vim: set ts=4 sw=4: diff --git a/src/Makefile.am b/src/Makefile.am index 076900a..7a28d74 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,13 +1,12 @@ ACLOCAL_AMFLAGS = -I m4 -IFACE = interface/stream_reader.c interface/logger.c \ - interface/stream_writer.c interface/http_intro.c \ +IFACE = interface/stream_reader.c \ + interface/stream_writer.c \ interface/subject.c interface/observer.c SOCKET = socket.c socket/accept.c socket/connect.c socket/listen.c STREAM = stream.c stream/read.c stream/write.c SERVER = server.c server/run.c server/close_conn.c server/poll.c \ server/handle_accept.c server/read.c server/write.c -LOGGER = logger.c logger/stderr.c logger/syslog.c SESSION = session.c session/add.c session/get.c session/delete.c UTILS = utils/hash.c \ utils/memory.c \ @@ -19,17 +18,18 @@ LIBS = ./http/libhttp.a \ ./auth/libauth.a \ ./cbuf/libcbuf.a \ ./class/libclass.a \ - ./hash/libhash.a + ./hash/libhash.a \ + ./logger/liblogger.a AM_CFLAGS = -Wall -I ../include/ bin_PROGRAMS = taskrambler taskrambler_SOURCES = taskrambler.c \ - $(IFACE) $(SOCKET) $(SERVER) $(LOGGER) \ + $(IFACE) $(SOCKET) $(SERVER) \ $(UTILS) $(SESSION) $(STREAM) taskrambler_CFLAGS = -Wall -I ../include/ $(COVERAGE_CFLAGS) taskrambler_LDADD = $(LIBS) -lrt -lssl -lldap taskrambler_LDFLAGS = $(COVERAGE_LDFLAGS) -SUBDIRS = auth cbuf class hash http +SUBDIRS = auth cbuf class hash http logger diff --git a/src/auth/libauth.a b/src/auth/libauth.a index 7c72fa3..c26ed76 100644 Binary files a/src/auth/libauth.a and b/src/auth/libauth.a differ diff --git a/src/cbuf/libcbuf.a b/src/cbuf/libcbuf.a index b04e394..e12cb9a 100644 Binary files a/src/cbuf/libcbuf.a and b/src/cbuf/libcbuf.a differ diff --git a/src/class/libclass.a b/src/class/libclass.a index 6d3c5ba..9f49e8e 100644 Binary files a/src/class/libclass.a and b/src/class/libclass.a differ diff --git a/src/hash/libhash.a b/src/hash/libhash.a index b9c9147..f2e9d17 100644 Binary files a/src/hash/libhash.a and b/src/hash/libhash.a differ diff --git a/src/http/Makefile.am b/src/http/Makefile.am index 0285899..a60d27f 100644 --- a/src/http/Makefile.am +++ b/src/http/Makefile.am @@ -37,5 +37,5 @@ HEADER = header.c \ noinst_LIBRARIES = libhttp.a libhttp_a_SOURCES = $(MSG) $(MSGQ) $(REQ) $(RESP) $(PARSER) $(WRITER) \ - $(WORKER) $(HEADER) + $(WORKER) $(HEADER) interface/http_intro.c libhttp_a_CFLAGS = -Wall -I ../../include/ diff --git a/src/interface/http_intro.c b/src/http/interface/http_intro.c similarity index 96% rename from src/interface/http_intro.c rename to src/http/interface/http_intro.c index bf14c4d..125f475 100644 --- a/src/interface/http_intro.c +++ b/src/http/interface/http_intro.c @@ -21,7 +21,7 @@ */ #include "class.h" -#include "interface/http_intro.h" +#include "http/interface/http_intro.h" const struct interface i_HttpIntro = { "httpIntro", diff --git a/src/http/libhttp.a b/src/http/libhttp.a index 4c65377..71d70d4 100644 Binary files a/src/http/libhttp.a and b/src/http/libhttp.a differ diff --git a/src/http/message/header_size_get.c b/src/http/message/header_size_get.c index 5388db5..59b10b3 100644 --- a/src/http/message/header_size_get.c +++ b/src/http/message/header_size_get.c @@ -27,7 +27,7 @@ #include "http/message.h" #include "http/response.h" #include "http/header.h" -#include "interface/http_intro.h" +#include "http/interface/http_intro.h" #include "hash.h" static size_t size; diff --git a/src/http/message/header_to_string.c b/src/http/message/header_to_string.c index 1b615cb..37a2814 100644 --- a/src/http/message/header_to_string.c +++ b/src/http/message/header_to_string.c @@ -26,7 +26,7 @@ #include "http/response.h" #include "http/header.h" -#include "interface/http_intro.h" +#include "http/interface/http_intro.h" #include "hash.h" static char * string; diff --git a/src/http/parser/parse.c b/src/http/parser/parse.c index f392ede..84df37f 100644 --- a/src/http/parser/parse.c +++ b/src/http/parser/parse.c @@ -22,13 +22,14 @@ #include -#include "http/parser.h" -#include "http/header.h" #include "class.h" -#include "interface/http_intro.h" #include "cbuf.h" #include "stream.h" +#include "http/parser.h" +#include "http/header.h" +#include "http/interface/http_intro.h" + #include "utils/memory.h" #include "commons.h" diff --git a/src/http/request.c b/src/http/request.c index a352687..b380301 100644 --- a/src/http/request.c +++ b/src/http/request.c @@ -27,7 +27,7 @@ #include "class.h" #include "hash.h" -#include "interface/http_intro.h" +#include "http/interface/http_intro.h" #include "http/request.h" #include "utils/memory.h" diff --git a/src/http/response.c b/src/http/response.c index d1b9d45..db53354 100644 --- a/src/http/response.c +++ b/src/http/response.c @@ -27,10 +27,10 @@ #include #include "class.h" -#include "interface/http_intro.h" +#include "utils/memory.h" #include "http/response.h" -#include "utils/memory.h" +#include "http/interface/http_intro.h" static diff --git a/src/interface/stream_reader.c b/src/interface/stream_reader.c index ffaf49c..1797c60 100644 --- a/src/interface/stream_reader.c +++ b/src/interface/stream_reader.c @@ -21,8 +21,8 @@ */ #include "class.h" -#include "interface/stream_reader.h" #include "stream.h" +#include "interface/stream_reader.h" const struct interface i_StreamReader = { "streamReader", diff --git a/src/logger/Makefile.am b/src/logger/Makefile.am new file mode 100644 index 0000000..6e4f2cb --- /dev/null +++ b/src/logger/Makefile.am @@ -0,0 +1,6 @@ +ACLOCAL_AMFLAGS = -I m4 + +noinst_LIBRARIES = liblogger.a + +liblogger_a_SOURCES = interface/logger.c logger.c stderr.c syslog.c +liblogger_a_CFLAGS = -Wall -I ../../include/ diff --git a/src/interface/logger.c b/src/logger/interface/logger.c similarity index 95% rename from src/interface/logger.c rename to src/logger/interface/logger.c index 84e3dd9..1ab7c2d 100644 --- a/src/interface/logger.c +++ b/src/logger/interface/logger.c @@ -24,8 +24,8 @@ #include #include -#include "logger.h" -#include "interface/logger.h" +#include "logger/logger.h" +#include "logger/interface/logger.h" const struct interface i_Logger = { "logger", diff --git a/src/logger/liblogger.a b/src/logger/liblogger.a new file mode 100644 index 0000000..567085f Binary files /dev/null and b/src/logger/liblogger.a differ diff --git a/src/logger.c b/src/logger/logger.c similarity index 94% rename from src/logger.c rename to src/logger/logger.c index 6519f95..4d8ab63 100644 --- a/src/logger.c +++ b/src/logger/logger.c @@ -22,9 +22,9 @@ #include -#include "logger.h" #include "class.h" -#include "interface/logger.h" +#include "logger/logger.h" +#include "logger/interface/logger.h" const char * const diff --git a/src/logger/stderr.c b/src/logger/stderr.c index 104714b..8df121e 100644 --- a/src/logger/stderr.c +++ b/src/logger/stderr.c @@ -22,8 +22,8 @@ #include -#include "logger.h" -#include "interface/logger.h" +#include "logger/logger.h" +#include "logger/interface/logger.h" static void diff --git a/src/logger/syslog.c b/src/logger/syslog.c index 75fcd40..4f331ac 100644 --- a/src/logger/syslog.c +++ b/src/logger/syslog.c @@ -22,8 +22,8 @@ #include -#include "logger.h" -#include "interface/logger.h" +#include "logger/logger.h" +#include "logger/interface/logger.h" static const diff --git a/src/server/handle_accept.c b/src/server/handle_accept.c index 9e20aa1..ab0cb83 100644 --- a/src/server/handle_accept.c +++ b/src/server/handle_accept.c @@ -29,7 +29,7 @@ #include "http/worker.h" #include "server.h" #include "class.h" -#include "interface/logger.h" +#include "logger.h" #include "stream.h" int diff --git a/src/server/poll.c b/src/server/poll.c index 77cfe07..cf061c8 100644 --- a/src/server/poll.c +++ b/src/server/poll.c @@ -24,7 +24,7 @@ #include #include "server.h" -#include "interface/logger.h" +#include "logger.h" #include "utils/signalHandling.h" diff --git a/src/server/read.c b/src/server/read.c index 5eb1adc..d32e25c 100644 --- a/src/server/read.c +++ b/src/server/read.c @@ -21,7 +21,7 @@ */ #include "server.h" -#include "interface/logger.h" +#include "logger.h" #include "interface/stream_reader.h" void serverCloseConn(Server, unsigned int); diff --git a/src/server/run.c b/src/server/run.c index 6702be6..3ba416c 100644 --- a/src/server/run.c +++ b/src/server/run.c @@ -21,7 +21,7 @@ */ #include "server.h" -#include "interface/logger.h" +#include "logger.h" #include "utils/signalHandling.h" diff --git a/src/server/write.c b/src/server/write.c index bacbf81..9da1a62 100644 --- a/src/server/write.c +++ b/src/server/write.c @@ -21,7 +21,7 @@ */ #include "server.h" -#include "interface/logger.h" +#include "logger.h" #include "interface/stream_writer.h" void serverCloseConn(Server, unsigned int); diff --git a/src/socket.c b/src/socket.c index 8f761d0..ead4f00 100644 --- a/src/socket.c +++ b/src/socket.c @@ -27,7 +27,6 @@ #include "socket.h" #include "logger.h" #include "class.h" -#include "interface/logger.h" static int diff --git a/src/socket/accept.c b/src/socket/accept.c index f8b5a4e..3c7de3b 100644 --- a/src/socket/accept.c +++ b/src/socket/accept.c @@ -25,7 +25,7 @@ #include "socket.h" #include "class.h" -#include "interface/logger.h" +#include "logger.h" Sock socketAccept(Sock this, char (*remoteAddr)[16]) diff --git a/src/socket/connect.c b/src/socket/connect.c index 04bab48..6502288 100644 --- a/src/socket/connect.c +++ b/src/socket/connect.c @@ -25,7 +25,7 @@ #include "socket.h" #include "class.h" -#include "interface/logger.h" +#include "logger.h" void diff --git a/src/socket/listen.c b/src/socket/listen.c index 418a1d0..aff5273 100644 --- a/src/socket/listen.c +++ b/src/socket/listen.c @@ -25,7 +25,7 @@ #include "socket.h" #include "class.h" -#include "interface/logger.h" +#include "logger.h" void diff --git a/src/taskrambler.c b/src/taskrambler.c index f01b06a..5e900aa 100644 --- a/src/taskrambler.c +++ b/src/taskrambler.c @@ -41,7 +41,7 @@ #include "auth.h" #include "class.h" -#include "interface/logger.h" +#include "logger.h" #include "utils/signalHandling.h" #include "utils/memory.h"