Commit db197db18288fb98577acec549a6fcd14415925b
1 parent
25f6a1f9
Now all classes are moved in according archives. Coming closer to the original p…
…urpose of the class construct to build small independent reusable code fragments.
Showing
21 changed files
with
120 additions
and
80 deletions
1 | -/** | |
2 | - * \file | |
3 | - * | |
4 | - * \author Georg Hopp | |
5 | - * | |
6 | - * \copyright | |
7 | - * Copyright © 2012 Georg Hopp | |
8 | - * | |
9 | - * This program is free software: you can redistribute it and/or modify | |
10 | - * it under the terms of the GNU General Public License as published by | |
11 | - * the Free Software Foundation, either version 3 of the License, or | |
12 | - * (at your option) any later version. | |
13 | - * | |
14 | - * This program is distributed in the hope that it will be useful, | |
15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | - * GNU General Public License for more details. | |
18 | - * | |
19 | - * You should have received a copy of the GNU General Public License | |
20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | - */ | |
22 | - | |
23 | 1 | #ifndef __STREAM_H__ |
24 | 2 | #define __STREAM_H__ |
25 | 3 | |
26 | -#include <sys/types.h> | |
27 | -#include <openssl/ssl.h> | |
28 | - | |
29 | -#include "class.h" | |
30 | - | |
31 | -typedef enum e_StreamHandleType { | |
32 | - STREAM_FD = 0, | |
33 | - STREAM_SSL | |
34 | -} StreamHandleType; | |
35 | - | |
36 | -CLASS(Stream) { | |
37 | - StreamHandleType type; | |
38 | - union { | |
39 | - int fd; | |
40 | - SSL * ssl; | |
41 | - } handle; | |
42 | -}; | |
43 | - | |
44 | -ssize_t streamRead(Stream, void *, size_t); | |
45 | -ssize_t streamWrite(Stream, void *, size_t); | |
4 | +#include "stream/stream.h" | |
5 | +#include "stream/interface/reader.h" | |
6 | +#include "stream/interface/writer.h" | |
46 | 7 | |
47 | 8 | #endif // __STREAM_H__ |
48 | 9 | ... | ... |
... | ... | @@ -22,12 +22,12 @@ |
22 | 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | */ |
24 | 24 | |
25 | -#ifndef __STREAM_READER_H__ | |
26 | -#define __STREAM_READER_H__ | |
25 | +#ifndef __STREAM_INTERFACE_READER_H__ | |
26 | +#define __STREAM_INTERFACE_READER_H__ | |
27 | 27 | |
28 | 28 | #include <sys/types.h> |
29 | 29 | |
30 | -#include "stream.h" | |
30 | +#include "stream/stream.h" | |
31 | 31 | |
32 | 32 | typedef ssize_t (* fptr_streamReaderRead)(void *, Stream); |
33 | 33 | |
... | ... | @@ -40,6 +40,6 @@ struct i_StreamReader { |
40 | 40 | |
41 | 41 | extern ssize_t streamReaderRead(void *, Stream); |
42 | 42 | |
43 | -#endif // __STREAM_READER_H__ | |
43 | +#endif // __STREAM_INTERFACE_READER_H__ | |
44 | 44 | |
45 | 45 | // vim: set ts=4 sw=4: | ... | ... |
... | ... | @@ -22,12 +22,12 @@ |
22 | 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | */ |
24 | 24 | |
25 | -#ifndef __STREAM_WRITER_H__ | |
26 | -#define __STREAM_WRITER_H__ | |
25 | +#ifndef __STREAM_INTERFACE_WRITER_H__ | |
26 | +#define __STREAM_INTERFACE_WRITER_H__ | |
27 | 27 | |
28 | 28 | #include <sys/types.h> |
29 | 29 | |
30 | -#include "stream.h" | |
30 | +#include "stream/stream.h" | |
31 | 31 | |
32 | 32 | typedef ssize_t (* fptr_streamWriterWrite)(void *, Stream); |
33 | 33 | |
... | ... | @@ -40,6 +40,6 @@ struct i_StreamWriter { |
40 | 40 | |
41 | 41 | extern ssize_t streamWriterWrite(void *, Stream); |
42 | 42 | |
43 | -#endif // __STREAM_WRITER_H__ | |
43 | +#endif // __STREAM_INTERFACE_WRITER_H__ | |
44 | 44 | |
45 | 45 | // vim: set ts=4 sw=4: | ... | ... |
include/stream/stream.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright © 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#ifndef __STREAM_STREAM_H__ | |
24 | +#define __STREAM_STREAM_H__ | |
25 | + | |
26 | +#include <sys/types.h> | |
27 | +#include <openssl/ssl.h> | |
28 | + | |
29 | +#include "class.h" | |
30 | + | |
31 | +typedef enum e_StreamHandleType { | |
32 | + STREAM_FD = 0, | |
33 | + STREAM_SSL | |
34 | +} StreamHandleType; | |
35 | + | |
36 | +CLASS(Stream) { | |
37 | + StreamHandleType type; | |
38 | + union { | |
39 | + int fd; | |
40 | + SSL * ssl; | |
41 | + } handle; | |
42 | +}; | |
43 | + | |
44 | +ssize_t streamRead(Stream, void *, size_t); | |
45 | +ssize_t streamWrite(Stream, void *, size_t); | |
46 | + | |
47 | +#endif // __STREAM_STREAM_H__ | |
48 | + | |
49 | +// vim: set ts=4 sw=4: | ... | ... |
1 | 1 | ACLOCAL_AMFLAGS = -I m4 |
2 | 2 | |
3 | -IFACE = interface/stream_reader.c \ | |
4 | - interface/stream_writer.c \ | |
5 | - interface/subject.c interface/observer.c | |
6 | -SOCKET = socket.c socket/accept.c socket/connect.c socket/listen.c | |
7 | -STREAM = stream.c stream/read.c stream/write.c | |
8 | -SERVER = server.c server/run.c server/close_conn.c server/poll.c \ | |
9 | - server/handle_accept.c server/read.c server/write.c | |
10 | -SESSION = session.c session/add.c session/get.c session/delete.c | |
11 | -UTILS = utils/hash.c \ | |
12 | - utils/memory.c \ | |
13 | - utils/http.c \ | |
14 | - utils/daemonize.c \ | |
15 | - utils/signalHandling.c | |
3 | +IFACE = interface/subject.c \ | |
4 | + interface/observer.c | |
5 | +UTILS = utils/hash.c \ | |
6 | + utils/memory.c \ | |
7 | + utils/http.c \ | |
8 | + utils/daemonize.c \ | |
9 | + utils/signalHandling.c | |
16 | 10 | |
17 | 11 | LIBS = ./http/libhttp.a \ |
18 | 12 | ./auth/libauth.a \ |
19 | 13 | ./cbuf/libcbuf.a \ |
20 | 14 | ./class/libclass.a \ |
21 | 15 | ./hash/libhash.a \ |
22 | - ./logger/liblogger.a | |
16 | + ./logger/liblogger.a \ | |
17 | + ./server/libserver.a \ | |
18 | + ./session/libsession.a \ | |
19 | + ./socket/libsocket.a \ | |
20 | + ./stream/libstream.a | |
23 | 21 | |
24 | 22 | AM_CFLAGS = -Wall -I ../include/ |
25 | 23 | |
26 | 24 | bin_PROGRAMS = taskrambler |
27 | 25 | |
28 | -taskrambler_SOURCES = taskrambler.c \ | |
29 | - $(IFACE) $(SOCKET) $(SERVER) \ | |
30 | - $(UTILS) $(SESSION) $(STREAM) | |
26 | +taskrambler_SOURCES = taskrambler.c $(IFACE) $(UTILS) | |
31 | 27 | taskrambler_CFLAGS = -Wall -I ../include/ $(COVERAGE_CFLAGS) |
32 | 28 | taskrambler_LDADD = $(LIBS) -lrt -lssl -lldap |
33 | 29 | taskrambler_LDFLAGS = $(COVERAGE_LDFLAGS) |
34 | 30 | |
35 | -SUBDIRS = auth cbuf class hash http logger | |
31 | +SUBDIRS = auth cbuf class hash http logger server session socket stream | ... | ... |
src/server/Makefile.am
0 → 100644
src/session/Makefile.am
0 → 100644
src/socket/Makefile.am
0 → 100644
src/stream/Makefile.am
0 → 100644
Please
register
or
login
to post a comment