Showing
22 changed files
with
13 additions
and
354 deletions
... | ... | @@ -11,7 +11,7 @@ AM_INIT_AUTOMAKE |
11 | 11 | AM_SILENT_RULES([yes]) |
12 | 12 | AC_COPYRIGHT([Copyright © 2014 Georg Hopp]) |
13 | 13 | AC_REVISION([0.0.0]) |
14 | -AC_CONFIG_SRCDIR([src/stream/stream.c]) | |
14 | +AC_CONFIG_SRCDIR([src/stream.c]) | |
15 | 15 | AC_CONFIG_HEADERS([trio.h]) |
16 | 16 | AC_CONFIG_MACRO_DIR([m4]) |
17 | 17 | |
... | ... | @@ -61,8 +61,5 @@ AC_CONFIG_FILES([Makefile |
61 | 61 | docs/Makefile |
62 | 62 | tests/Makefile |
63 | 63 | src/Makefile |
64 | - src/logger/Makefile | |
65 | - src/socket/Makefile | |
66 | - src/stream/Makefile | |
67 | 64 | include/Makefile]) |
68 | 65 | AC_OUTPUT | ... | ... |
include/tr/interface/logger.h
deleted
100644 → 0
1 | -/** | |
2 | - * \file | |
3 | - * The logger interface. | |
4 | - * | |
5 | - * \author Georg Hopp | |
6 | - * | |
7 | - * \copyright | |
8 | - * Copyright © 2012 Georg Hopp | |
9 | - * | |
10 | - * This program is free software: you can redistribute it and/or modify | |
11 | - * it under the terms of the GNU General Public License as published by | |
12 | - * the Free Software Foundation, either version 3 of the License, or | |
13 | - * (at your option) any later version. | |
14 | - * | |
15 | - * This program is distributed in the hope that it will be useful, | |
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | - * GNU General Public License for more details. | |
19 | - * | |
20 | - * You should have received a copy of the GNU General Public License | |
21 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | - */ | |
23 | - | |
24 | -#ifndef __TR_INTERFACE_LOGGER_H__ | |
25 | -#define __TR_INTERFACE_LOGGER_H__ | |
26 | - | |
27 | -#include <stdarg.h> | |
28 | - | |
29 | -#include "trbase.h" | |
30 | -#include "tr/logger.h" | |
31 | - | |
32 | -typedef void (* fptr_TR_log)(void *, TR_logger_level, const char * const); | |
33 | - | |
34 | -TR_INTERFACE(TR_Logger) { | |
35 | - TR_IFID; | |
36 | - fptr_TR_log log; | |
37 | -}; | |
38 | - | |
39 | -extern void TR_loggerLog(void *, TR_logger_level, const char * const, ...); | |
40 | - | |
41 | -#endif // __TR_INTERFACE_LOGGER_H__ | |
42 | - | |
43 | -// vim: set ts=4 sw=4: |
include/tr/logger.h
deleted
100644 → 0
1 | -/** | |
2 | - * \file | |
3 | - * A generic logger class and two extended classes, One that logs to | |
4 | - * stderr and one that logs to the system syslog. | |
5 | - * | |
6 | - * \author Georg Hopp | |
7 | - * | |
8 | - * \copyright | |
9 | - * Copyright © 2012 Georg Hopp | |
10 | - * | |
11 | - * This program is free software: you can redistribute it and/or modify | |
12 | - * it under the terms of the GNU General Public License as published by | |
13 | - * the Free Software Foundation, either version 3 of the License, or | |
14 | - * (at your option) any later version. | |
15 | - * | |
16 | - * This program is distributed in the hope that it will be useful, | |
17 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | - * GNU General Public License for more details. | |
20 | - * | |
21 | - * You should have received a copy of the GNU General Public License | |
22 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | - */ | |
24 | - | |
25 | -#ifndef __TR_LOGGER_H__ | |
26 | -#define __TR_LOGGER_H__ | |
27 | - | |
28 | -#include "trbase.h" | |
29 | - | |
30 | -typedef enum { | |
31 | - TR_LOGGER_DEBUG=0, | |
32 | - TR_LOGGER_INFO, | |
33 | - TR_LOGGER_NOTICE, | |
34 | - TR_LOGGER_WARNING, | |
35 | - TR_LOGGER_ERR, | |
36 | - TR_LOGGER_CRIT, | |
37 | - TR_LOGGER_ALERT, | |
38 | - TR_LOGGER_EMERG | |
39 | -} TR_logger_level; | |
40 | - | |
41 | -#include "tr/interface/logger.h" | |
42 | - | |
43 | -extern const char * const TR_logger_level_str[]; | |
44 | - | |
45 | -TR_CLASS(TR_Logger) { | |
46 | - TR_logger_level min_level; | |
47 | -}; | |
48 | - | |
49 | -TR_CLASS(TR_LoggerStderr) { | |
50 | - TR_EXTENDS(TR_Logger); | |
51 | -}; | |
52 | - | |
53 | -TR_CLASS(TR_LoggerSyslog) { | |
54 | - TR_EXTENDS(TR_Logger); | |
55 | -}; | |
56 | - | |
57 | -#endif // __TR_LOGGER_H__ | |
58 | - | |
59 | -// vim: set ts=4 sw=4: |
... | ... | @@ -3,14 +3,19 @@ AUTOMAKE_OPTIONS = subdir-objects |
3 | 3 | |
4 | 4 | AM_CFLAGS += -I../include/ |
5 | 5 | |
6 | -TRIOLIBS = logger/liblogger.la \ | |
7 | - stream/libstream.la \ | |
8 | - socket/libsocket.la | |
6 | +TRIO = stream.c \ | |
7 | + read.c \ | |
8 | + write.c \ | |
9 | + socket.c \ | |
10 | + accept.c \ | |
11 | + connect.c \ | |
12 | + listen.c \ | |
13 | + nonblock.c \ | |
14 | + i_reader.c \ | |
15 | + i_writer.c | |
9 | 16 | |
10 | 17 | lib_LTLIBRARIES = libtrio.la |
11 | 18 | |
12 | -libtrio_la_SOURCES = | |
19 | +libtrio_la_SOURCES = $(TRIO) | |
13 | 20 | libtrio_la_CFLAGS = $(AM_CFLAGS) |
14 | -libtrio_la_LIBADD = $(TRIOLIBS) | |
15 | - | |
16 | -SUBDIRS = logger socket stream | |
21 | +libtrio_la_LIBADD = | ... | ... |
src/logger/Makefile.am
deleted
100644 → 0
src/logger/i_logger.c
deleted
100644 → 0
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 | -#include <stdlib.h> | |
24 | -#include <stdio.h> | |
25 | -#include <stdarg.h> | |
26 | - | |
27 | -#include "tr/logger.h" | |
28 | -#include "tr/interface/logger.h" | |
29 | -#include "trbase.h" | |
30 | - | |
31 | -TR_CREATE_INTERFACE(TR_Logger, 1); | |
32 | - | |
33 | -void | |
34 | -TR_loggerLog( | |
35 | - void * _object, | |
36 | - TR_logger_level level, | |
37 | - const char * const fmt, | |
38 | - ...) { | |
39 | - TR_Logger object = _object; | |
40 | - | |
41 | - if (level >= object->min_level) { | |
42 | - char * msg = NULL; | |
43 | - size_t msg_size = 0; | |
44 | - va_list params; | |
45 | - | |
46 | - va_start(params, fmt); | |
47 | - msg_size = vsnprintf(NULL, msg_size, fmt, params); | |
48 | - va_end(params); | |
49 | - | |
50 | - msg = TR_malloc(msg_size + 1); | |
51 | - | |
52 | - va_start(params, fmt); | |
53 | - vsnprintf(msg, msg_size + 1, fmt, params); | |
54 | - va_end(params); | |
55 | - | |
56 | - TR_CALL(_object, TR_Logger, log, level, msg); | |
57 | - | |
58 | - TR_MEM_FREE(msg); | |
59 | - } | |
60 | -} | |
61 | - | |
62 | -// vim: set ts=4 sw=4: |
src/logger/logger.c
deleted
100644 → 0
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 | -#include <stdarg.h> | |
24 | - | |
25 | -#include "trbase.h" | |
26 | -#include "tr/logger.h" | |
27 | -#include "tr/interface/logger.h" | |
28 | - | |
29 | -const | |
30 | -char * const | |
31 | -TR_logger_level_str[] = { | |
32 | - "DEBUG", | |
33 | - "INFO", | |
34 | - "NOTICE", | |
35 | - "WARNING", | |
36 | - "ERR", | |
37 | - "CRIT", | |
38 | - "ALERT", | |
39 | - "EMERG" | |
40 | -}; | |
41 | - | |
42 | -static | |
43 | -int | |
44 | -loggerCtor(void * _this, va_list * params) | |
45 | -{ | |
46 | - TR_Logger this = _this; | |
47 | - this->min_level = va_arg(*params, int); | |
48 | - | |
49 | - return 0; | |
50 | -} | |
51 | - | |
52 | -static void loggerDtor(void * _this) {} | |
53 | - | |
54 | -TR_INIT_IFACE(TR_Class, loggerCtor, loggerDtor, NULL); | |
55 | -TR_CREATE_CLASS(TR_Logger, NULL, TR_IF(TR_Class)); | |
56 | - | |
57 | -// vim: set ts=4 sw=4: |
src/logger/stderr.c
deleted
100644 → 0
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 | -#include <stdio.h> | |
24 | - | |
25 | -#include "trbase.h" | |
26 | -#include "tr/logger.h" | |
27 | -#include "tr/interface/logger.h" | |
28 | - | |
29 | -static | |
30 | -void | |
31 | -logStderr(void * this, TR_logger_level level, const char * const msg) | |
32 | -{ | |
33 | - fprintf(stderr, "[%s] %s\n", TR_logger_level_str[level], msg); | |
34 | -} | |
35 | - | |
36 | -TR_INIT_IFACE(TR_Logger, logStderr); | |
37 | -TR_CREATE_CLASS(TR_LoggerStderr, TR_Logger, TR_IF(TR_Logger)); | |
38 | - | |
39 | -// vim: set ts=4 sw=4: |
src/logger/syslog.c
deleted
100644 → 0
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 | -#include <syslog.h> | |
24 | - | |
25 | -#include "trbase.h" | |
26 | -#include "tr/logger.h" | |
27 | -#include "tr/interface/logger.h" | |
28 | - | |
29 | -static | |
30 | -const | |
31 | -int syslog_priority[] = { | |
32 | - LOG_USER | LOG_DEBUG, | |
33 | - LOG_USER | LOG_INFO, | |
34 | - LOG_USER | LOG_NOTICE, | |
35 | - LOG_USER | LOG_WARNING, | |
36 | - LOG_USER | LOG_ERR, | |
37 | - LOG_USER | LOG_CRIT, | |
38 | - LOG_USER | LOG_ALERT, | |
39 | - LOG_USER | LOG_EMERG | |
40 | -}; | |
41 | - | |
42 | -static | |
43 | -void | |
44 | -logSyslog(void * this, TR_logger_level level, const char * const msg) | |
45 | -{ | |
46 | - syslog(syslog_priority[level], "[%s] %s", TR_logger_level_str[level], msg); | |
47 | -} | |
48 | - | |
49 | -TR_INIT_IFACE(TR_Logger, logSyslog); | |
50 | -TR_CREATE_CLASS(TR_LoggerSyslog, TR_Logger, TR_IF(TR_Logger)); | |
51 | - | |
52 | -// vim: set ts=4 sw=4: |
src/socket/Makefile.am
deleted
100644 → 0
src/stream/Makefile.am
deleted
100644 → 0
Please
register
or
login
to post a comment