-rw-r--r-- | noncore/net/wellenreiter/daemon/source/getgui.cc | 43 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/getgui.hh | 16 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/log.cc | 52 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/log.hh | 14 |
4 files changed, 0 insertions, 125 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/getgui.cc b/noncore/net/wellenreiter/daemon/source/getgui.cc deleted file mode 100644 index f56f40b..0000000 --- a/noncore/net/wellenreiter/daemon/source/getgui.cc +++ b/dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * Setup UDP socket for commands | ||
3 | * Misc wrapper functions for incoming commands | ||
4 | * | ||
5 | * $Id$ | ||
6 | */ | ||
7 | |||
8 | #include "config.hh" | ||
9 | #include "getgui.hh" | ||
10 | #include "log.hh" | ||
11 | |||
12 | struct sockaddr_in saddr; | ||
13 | |||
14 | /* Setup UDP Socket for incoming commands */ | ||
15 | int commsock(int *sock) | ||
16 | { | ||
17 | |||
18 | if((*sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0) | ||
19 | { | ||
20 | log_err("Cannot set up socket: %s", strerror(errno)); | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | memset(&saddr, 0, sizeof(saddr)); | ||
25 | saddr.sin_family = PF_INET; | ||
26 | saddr.sin_port = htons(DAEMONPORT); | ||
27 | saddr.sin_addr.s_addr = htonl(INADDR_ANY); | ||
28 | |||
29 | if(bind(*sock,(struct sockaddr *)&saddr, sizeof(saddr)) < 0) | ||
30 | { | ||
31 | log_err("Cannot bind socket: %s", strerror(errno)); | ||
32 | close(*sock); | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | return 1; | ||
37 | } | ||
38 | |||
39 | int commstring(const char *input) | ||
40 | { | ||
41 | |||
42 | return 1; | ||
43 | } | ||
diff --git a/noncore/net/wellenreiter/daemon/source/getgui.hh b/noncore/net/wellenreiter/daemon/source/getgui.hh deleted file mode 100644 index f5a37f9..0000000 --- a/noncore/net/wellenreiter/daemon/source/getgui.hh +++ b/dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /* $id */ | ||
2 | |||
3 | #ifndef GETGUI_HH | ||
4 | #define GETGUI_HH | ||
5 | |||
6 | #include <sys/types.h> | ||
7 | #include <sys/socket.h> | ||
8 | #include <netinet/in.h> | ||
9 | #include <string.h> | ||
10 | #include <unistd.h> | ||
11 | #include <errno.h> | ||
12 | |||
13 | int commsock(int *); | ||
14 | int commstring(const char *); | ||
15 | |||
16 | #endif /* GETGUI_HH */ | ||
diff --git a/noncore/net/wellenreiter/daemon/source/log.cc b/noncore/net/wellenreiter/daemon/source/log.cc deleted file mode 100644 index 47589d2..0000000 --- a/noncore/net/wellenreiter/daemon/source/log.cc +++ b/dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | /* | ||
2 | * Small functions to log to syslog | ||
3 | * | ||
4 | * $Id$ | ||
5 | */ | ||
6 | |||
7 | #include "config.hh" | ||
8 | #include "log.hh" | ||
9 | |||
10 | /* Log to syslog INFO */ | ||
11 | void log_info(const char *fmt,...) | ||
12 | { | ||
13 | |||
14 | char buffer[4096]; | ||
15 | va_list ap; | ||
16 | |||
17 | memset(buffer, 0, sizeof(buffer)), | ||
18 | va_start(ap, fmt); | ||
19 | vsnprintf(buffer, sizeof(buffer)-1, fmt, ap); | ||
20 | va_end(ap); | ||
21 | |||
22 | openlog(PROGNAME, LOG_PID, LOG_SYSLOG); | ||
23 | syslog(LOG_INFO, "(info) %s", buffer); | ||
24 | closelog(); | ||
25 | |||
26 | #ifdef DEBUG | ||
27 | fprintf(stderr, "(info) %s\n", buffer); | ||
28 | #endif | ||
29 | |||
30 | } | ||
31 | |||
32 | /* Log to syslog ERR */ | ||
33 | void log_err(const char *fmt,...) | ||
34 | { | ||
35 | |||
36 | char buffer[4096]; | ||
37 | va_list ap; | ||
38 | |||
39 | memset(buffer, 0, sizeof(buffer)); | ||
40 | va_start(ap, fmt); | ||
41 | vsnprintf(buffer, sizeof(buffer)-1, fmt, ap); | ||
42 | va_end(ap); | ||
43 | |||
44 | openlog(PROGNAME, LOG_PID, LOG_SYSLOG); | ||
45 | syslog(LOG_INFO, "(err) %s", buffer); | ||
46 | closelog(); | ||
47 | |||
48 | #ifdef DEBUG | ||
49 | fprintf(stderr, "(err) %s\n", buffer); | ||
50 | #endif | ||
51 | |||
52 | } | ||
diff --git a/noncore/net/wellenreiter/daemon/source/log.hh b/noncore/net/wellenreiter/daemon/source/log.hh deleted file mode 100644 index bdea7e4..0000000 --- a/noncore/net/wellenreiter/daemon/source/log.hh +++ b/dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* $Id$ */ | ||
2 | |||
3 | #ifndef LOG_HH | ||
4 | #define LOG_HH | ||
5 | |||
6 | #include <stdio.h> | ||
7 | #include <syslog.h> | ||
8 | #include <stdarg.h> | ||
9 | #include <string.h> | ||
10 | |||
11 | void log_info(const char *, ...); | ||
12 | void log_err(const char *, ...); | ||
13 | |||
14 | #endif /* LOG_HH */ | ||