Browse Source

Now all classes are moved in according archives. Coming closer to the original purpose of the class construct to build small independent reusable code fragments.

release0.1.5
Georg Hopp 14 years ago
parent
commit
db197db182
  1. 4
      configure.ac
  2. 45
      include/stream.h
  3. 8
      include/stream/interface/reader.h
  4. 8
      include/stream/interface/writer.h
  5. 49
      include/stream/stream.h
  6. 32
      src/Makefile.am
  7. 2
      src/http/parser.c
  8. 3
      src/http/worker.c
  9. 2
      src/http/writer.c
  10. 9
      src/server/Makefile.am
  11. 2
      src/server/read.c
  12. 0
      src/server/server.c
  13. 2
      src/server/write.c
  14. 6
      src/session/Makefile.am
  15. 0
      src/session/session.c
  16. 6
      src/socket/Makefile.am
  17. 0
      src/socket/socket.c
  18. 10
      src/stream/Makefile.am
  19. 5
      src/stream/interface/stream_reader.c
  20. 5
      src/stream/interface/stream_writer.c
  21. 2
      src/stream/stream.c

4
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

45
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 <http://www.gnu.org/licenses/>.
*/
#ifndef __STREAM_H__
#define __STREAM_H__
#include <sys/types.h>
#include <openssl/ssl.h>
#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__

8
include/interface/stream_reader.h → include/stream/interface/reader.h

@ -22,12 +22,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __STREAM_READER_H__
#define __STREAM_READER_H__
#ifndef __STREAM_INTERFACE_READER_H__
#define __STREAM_INTERFACE_READER_H__
#include <sys/types.h>
#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:

8
include/interface/stream_writer.h → include/stream/interface/writer.h

@ -22,12 +22,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __STREAM_WRITER_H__
#define __STREAM_WRITER_H__
#ifndef __STREAM_INTERFACE_WRITER_H__
#define __STREAM_INTERFACE_WRITER_H__
#include <sys/types.h>
#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:

49
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 <http://www.gnu.org/licenses/>.
*/
#ifndef __STREAM_STREAM_H__
#define __STREAM_STREAM_H__
#include <sys/types.h>
#include <openssl/ssl.h>
#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:

32
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

2
src/http/parser.c

@ -25,7 +25,7 @@
#include <stdarg.h>
#include "class.h"
#include "interface/stream_reader.h"
#include "stream.h"
#include "http/parser.h"
#include "http/message/queue.h"

3
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

2
src/http/writer.c

@ -23,7 +23,7 @@
#include <stdarg.h>
#include "class.h"
#include "interface/stream_writer.h"
#include "stream.h"
#include "http/message/queue.h"
#include "http/writer.h"

9
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/

2
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);

0
src/server.c → src/server/server.c

2
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);

6
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/

0
src/session.c → src/session/session.c

6
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/

0
src/socket.c → src/socket/socket.c

10
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/

5
src/interface/stream_reader.c → 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",

5
src/interface/stream_writer.c → 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",

2
src/stream.c → src/stream/stream.c

@ -24,7 +24,7 @@
#include <openssl/ssl.h>
#include "class.h"
#include "stream.h"
#include "stream/stream.h"
static
Loading…
Cancel
Save