diff --git a/configure.ac b/configure.ac
index 4606fbb..dd22ab9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,5 +53,9 @@ AC_CONFIG_FILES([Makefile
src/hash/Makefile
src/http/Makefile
src/logger/Makefile
+ src/server/Makefile
+ src/session/Makefile
+ src/socket/Makefile
+ src/stream/Makefile
tests/Makefile])
AC_OUTPUT
diff --git a/include/stream.h b/include/stream.h
index d7cffed..2b3072b 100644
--- a/include/stream.h
+++ b/include/stream.h
@@ -1,48 +1,9 @@
-/**
- * \file
- *
- * \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 __STREAM_H__
#define __STREAM_H__
-#include
-#include
-
-#include "class.h"
-
-typedef enum e_StreamHandleType {
- STREAM_FD = 0,
- STREAM_SSL
-} StreamHandleType;
-
-CLASS(Stream) {
- StreamHandleType type;
- union {
- int fd;
- SSL * ssl;
- } handle;
-};
-
-ssize_t streamRead(Stream, void *, size_t);
-ssize_t streamWrite(Stream, void *, size_t);
+#include "stream/stream.h"
+#include "stream/interface/reader.h"
+#include "stream/interface/writer.h"
#endif // __STREAM_H__
diff --git a/include/interface/stream_reader.h b/include/stream/interface/reader.h
similarity index 88%
rename from include/interface/stream_reader.h
rename to include/stream/interface/reader.h
index e353a12..8719099 100644
--- a/include/interface/stream_reader.h
+++ b/include/stream/interface/reader.h
@@ -22,12 +22,12 @@
* along with this program. If not, see .
*/
-#ifndef __STREAM_READER_H__
-#define __STREAM_READER_H__
+#ifndef __STREAM_INTERFACE_READER_H__
+#define __STREAM_INTERFACE_READER_H__
#include
-#include "stream.h"
+#include "stream/stream.h"
typedef ssize_t (* fptr_streamReaderRead)(void *, Stream);
@@ -40,6 +40,6 @@ struct i_StreamReader {
extern ssize_t streamReaderRead(void *, Stream);
-#endif // __STREAM_READER_H__
+#endif // __STREAM_INTERFACE_READER_H__
// vim: set ts=4 sw=4:
diff --git a/include/interface/stream_writer.h b/include/stream/interface/writer.h
similarity index 88%
rename from include/interface/stream_writer.h
rename to include/stream/interface/writer.h
index bbca388..99d434d 100644
--- a/include/interface/stream_writer.h
+++ b/include/stream/interface/writer.h
@@ -22,12 +22,12 @@
* along with this program. If not, see .
*/
-#ifndef __STREAM_WRITER_H__
-#define __STREAM_WRITER_H__
+#ifndef __STREAM_INTERFACE_WRITER_H__
+#define __STREAM_INTERFACE_WRITER_H__
#include
-#include "stream.h"
+#include "stream/stream.h"
typedef ssize_t (* fptr_streamWriterWrite)(void *, Stream);
@@ -40,6 +40,6 @@ struct i_StreamWriter {
extern ssize_t streamWriterWrite(void *, Stream);
-#endif // __STREAM_WRITER_H__
+#endif // __STREAM_INTERFACE_WRITER_H__
// vim: set ts=4 sw=4:
diff --git a/include/stream/stream.h b/include/stream/stream.h
new file mode 100644
index 0000000..eb16104
--- /dev/null
+++ b/include/stream/stream.h
@@ -0,0 +1,49 @@
+/**
+ * \file
+ *
+ * \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 __STREAM_STREAM_H__
+#define __STREAM_STREAM_H__
+
+#include
+#include
+
+#include "class.h"
+
+typedef enum e_StreamHandleType {
+ STREAM_FD = 0,
+ STREAM_SSL
+} StreamHandleType;
+
+CLASS(Stream) {
+ StreamHandleType type;
+ union {
+ int fd;
+ SSL * ssl;
+ } handle;
+};
+
+ssize_t streamRead(Stream, void *, size_t);
+ssize_t streamWrite(Stream, void *, size_t);
+
+#endif // __STREAM_STREAM_H__
+
+// vim: set ts=4 sw=4:
diff --git a/src/Makefile.am b/src/Makefile.am
index 7a28d74..9fdba34 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,35 +1,31 @@
ACLOCAL_AMFLAGS = -I m4
-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
-SESSION = session.c session/add.c session/get.c session/delete.c
-UTILS = utils/hash.c \
- utils/memory.c \
- utils/http.c \
- utils/daemonize.c \
- utils/signalHandling.c
+IFACE = interface/subject.c \
+ interface/observer.c
+UTILS = utils/hash.c \
+ utils/memory.c \
+ utils/http.c \
+ utils/daemonize.c \
+ utils/signalHandling.c
LIBS = ./http/libhttp.a \
./auth/libauth.a \
./cbuf/libcbuf.a \
./class/libclass.a \
./hash/libhash.a \
- ./logger/liblogger.a
+ ./logger/liblogger.a \
+ ./server/libserver.a \
+ ./session/libsession.a \
+ ./socket/libsocket.a \
+ ./stream/libstream.a
AM_CFLAGS = -Wall -I ../include/
bin_PROGRAMS = taskrambler
-taskrambler_SOURCES = taskrambler.c \
- $(IFACE) $(SOCKET) $(SERVER) \
- $(UTILS) $(SESSION) $(STREAM)
+taskrambler_SOURCES = taskrambler.c $(IFACE) $(UTILS)
taskrambler_CFLAGS = -Wall -I ../include/ $(COVERAGE_CFLAGS)
taskrambler_LDADD = $(LIBS) -lrt -lssl -lldap
taskrambler_LDFLAGS = $(COVERAGE_LDFLAGS)
-SUBDIRS = auth cbuf class hash http logger
+SUBDIRS = auth cbuf class hash http logger server session socket stream
diff --git a/src/http/parser.c b/src/http/parser.c
index 28e57c8..d5b227a 100644
--- a/src/http/parser.c
+++ b/src/http/parser.c
@@ -25,7 +25,7 @@
#include
#include "class.h"
-#include "interface/stream_reader.h"
+#include "stream.h"
#include "http/parser.h"
#include "http/message/queue.h"
diff --git a/src/http/worker.c b/src/http/worker.c
index cc85af1..b74eb54 100644
--- a/src/http/worker.c
+++ b/src/http/worker.c
@@ -34,9 +34,6 @@
#include "http/parser.h"
#include "http/writer.h"
-#include "interface/stream_reader.h"
-#include "interface/stream_writer.h"
-
#include "utils/memory.h"
static
diff --git a/src/http/writer.c b/src/http/writer.c
index 0c381e8..612c574 100644
--- a/src/http/writer.c
+++ b/src/http/writer.c
@@ -23,7 +23,7 @@
#include
#include "class.h"
-#include "interface/stream_writer.h"
+#include "stream.h"
#include "http/message/queue.h"
#include "http/writer.h"
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
new file mode 100644
index 0000000..a73bb16
--- /dev/null
+++ b/src/server/Makefile.am
@@ -0,0 +1,9 @@
+ACLOCAL_AMFLAGS = -I m4
+
+SERVER = server.c run.c close_conn.c poll.c \
+ handle_accept.c read.c write.c
+
+noinst_LIBRARIES = libserver.a
+
+libserver_a_SOURCES = $(SERVER)
+libserver_a_CFLAGS = -Wall -I ../../include/
diff --git a/src/server/read.c b/src/server/read.c
index d32e25c..a8add3e 100644
--- a/src/server/read.c
+++ b/src/server/read.c
@@ -22,7 +22,7 @@
#include "server.h"
#include "logger.h"
-#include "interface/stream_reader.h"
+#include "stream.h"
void serverCloseConn(Server, unsigned int);
diff --git a/src/server.c b/src/server/server.c
similarity index 100%
rename from src/server.c
rename to src/server/server.c
diff --git a/src/server/write.c b/src/server/write.c
index 9da1a62..cad36da 100644
--- a/src/server/write.c
+++ b/src/server/write.c
@@ -22,7 +22,7 @@
#include "server.h"
#include "logger.h"
-#include "interface/stream_writer.h"
+#include "stream.h"
void serverCloseConn(Server, unsigned int);
diff --git a/src/session/Makefile.am b/src/session/Makefile.am
new file mode 100644
index 0000000..7b6d884
--- /dev/null
+++ b/src/session/Makefile.am
@@ -0,0 +1,6 @@
+ACLOCAL_AMFLAGS = -I m4
+
+noinst_LIBRARIES = libsession.a
+
+libsession_a_SOURCES = session.c add.c get.c delete.c
+libsession_a_CFLAGS = -Wall -I ../../include/
diff --git a/src/session.c b/src/session/session.c
similarity index 100%
rename from src/session.c
rename to src/session/session.c
diff --git a/src/socket/Makefile.am b/src/socket/Makefile.am
new file mode 100644
index 0000000..89ef4f0
--- /dev/null
+++ b/src/socket/Makefile.am
@@ -0,0 +1,6 @@
+ACLOCAL_AMFLAGS = -I m4
+
+noinst_LIBRARIES = libsocket.a
+
+libsocket_a_SOURCES = socket.c accept.c connect.c listen.c
+libsocket_a_CFLAGS = -Wall -I ../../include/
diff --git a/src/socket.c b/src/socket/socket.c
similarity index 100%
rename from src/socket.c
rename to src/socket/socket.c
diff --git a/src/stream/Makefile.am b/src/stream/Makefile.am
new file mode 100644
index 0000000..946bd5b
--- /dev/null
+++ b/src/stream/Makefile.am
@@ -0,0 +1,10 @@
+ACLOCAL_AMFLAGS = -I m4
+
+STREAM = stream.c read.c write.c
+IFACE = interface/stream_reader.c \
+ interface/stream_writer.c
+
+noinst_LIBRARIES = libstream.a
+
+libstream_a_SOURCES = $(STREAM) $(IFACE)
+libstream_a_CFLAGS = -Wall -I ../../include/
diff --git a/src/interface/stream_reader.c b/src/stream/interface/stream_reader.c
similarity index 93%
rename from src/interface/stream_reader.c
rename to src/stream/interface/stream_reader.c
index 1797c60..abd042b 100644
--- a/src/interface/stream_reader.c
+++ b/src/stream/interface/stream_reader.c
@@ -21,8 +21,9 @@
*/
#include "class.h"
-#include "stream.h"
-#include "interface/stream_reader.h"
+
+#include "stream/stream.h"
+#include "stream/interface/reader.h"
const struct interface i_StreamReader = {
"streamReader",
diff --git a/src/interface/stream_writer.c b/src/stream/interface/stream_writer.c
similarity index 93%
rename from src/interface/stream_writer.c
rename to src/stream/interface/stream_writer.c
index d3153dc..1928328 100644
--- a/src/interface/stream_writer.c
+++ b/src/stream/interface/stream_writer.c
@@ -21,8 +21,9 @@
*/
#include "class.h"
-#include "interface/stream_writer.h"
-#include "stream.h"
+
+#include "stream/stream.h"
+#include "stream/interface/writer.h"
const struct interface i_StreamWriter = {
"streamWriter",
diff --git a/src/stream.c b/src/stream/stream.c
similarity index 97%
rename from src/stream.c
rename to src/stream/stream.c
index 827a0c8..e417cbc 100644
--- a/src/stream.c
+++ b/src/stream/stream.c
@@ -24,7 +24,7 @@
#include
#include "class.h"
-#include "stream.h"
+#include "stream/stream.h"
static