author | mjm <mjm> | 2002-11-22 23:41:17 (UTC) |
---|---|---|
committer | mjm <mjm> | 2002-11-22 23:41:17 (UTC) |
commit | b4affc7067cdc7ede2217607be71fe3091a2a599 (patch) (unidiff) | |
tree | a3c12499038b2700ddc5a259ed664bdeae2deb6a /noncore/net/wellenreiter/daemon | |
parent | 5a346c71bf5255eb769c9fceb34358c06e60aef3 (diff) | |
download | opie-b4affc7067cdc7ede2217607be71fe3091a2a599.zip opie-b4affc7067cdc7ede2217607be71fe3091a2a599.tar.gz opie-b4affc7067cdc7ede2217607be71fe3091a2a599.tar.bz2 |
uses libwellenreiter now
Diffstat (limited to 'noncore/net/wellenreiter/daemon') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/Makefile | 15 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/config.hh | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.cc | 36 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.hh | 3 |
4 files changed, 27 insertions, 28 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/Makefile b/noncore/net/wellenreiter/daemon/source/Makefile index dc459af..f6efa3d 100644 --- a/noncore/net/wellenreiter/daemon/source/Makefile +++ b/noncore/net/wellenreiter/daemon/source/Makefile | |||
@@ -4,3 +4,2 @@ CPP = g++ | |||
4 | 4 | ||
5 | CFLAGS= | ||
6 | OPTIMFLAGS= -g | 5 | OPTIMFLAGS= -g |
@@ -8,4 +7,4 @@ WARNFLAGS = -Wall -pedantic -DDEBUG | |||
8 | LDFLAGS = | 7 | LDFLAGS = |
9 | LIBS = -lpcap | 8 | LIBS = -lpcap ../../libwellenreiter/source/libwellenreiter.a |
10 | OBJ = daemon.o log.o sendgui.o getgui.o sniffer.o | 9 | OBJ = daemon.o |
11 | 10 | ||
@@ -15,3 +14,3 @@ OBJ = daemon.o log.o sendgui.o getgui.o sniffer.o | |||
15 | %.o : %.cc | 14 | %.o : %.cc |
16 | $(CPP) $(CFLAGS) $(WARNFLAGS) $(OPTIMFLAGS) -c $< -o $@ | 15 | $(CPP) $(WARNFLAGS) $(OPTIMFLAGS) -c $< -o $@ |
17 | 16 | ||
@@ -20,3 +19,3 @@ all: wellenreiterd | |||
20 | wellenreiterd:$(OBJ) | 19 | wellenreiterd:$(OBJ) |
21 | $(CPP) $(OPTIMFLAGS) $(WARNFLAGS) $(CFLAGS) $(OBJ) $(LDFLAGS) $(LIBS) -o $@ | 20 | $(CPP) $(OPTIMFLAGS) $(WARNFLAGS) $(OBJ) $(LDFLAGS) $(LIBS) -o $@ |
22 | @echo Build wellenreiterd | 21 | @echo Build wellenreiterd |
@@ -27,5 +26,3 @@ clean distclean realclean: | |||
27 | 26 | ||
28 | wellenreiterd.o:config.hh | 27 | daemon.o:config.hh |
29 | serve.o: config.hh | 28 | |
30 | log.o: config.hh | ||
31 | sendgui.o: config.hh | ||
diff --git a/noncore/net/wellenreiter/daemon/source/config.hh b/noncore/net/wellenreiter/daemon/source/config.hh index b124f41..b54ff46 100644 --- a/noncore/net/wellenreiter/daemon/source/config.hh +++ b/noncore/net/wellenreiter/daemon/source/config.hh | |||
@@ -16,2 +16,3 @@ | |||
16 | 16 | ||
17 | #define DAEMONADDR "127.0.0.1" | ||
17 | #define DAEMONPORT 37772 /* Port of Daemon */ | 18 | #define DAEMONPORT 37772 /* Port of Daemon */ |
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc index 8724efa..b3a37b6 100644 --- a/noncore/net/wellenreiter/daemon/source/daemon.cc +++ b/noncore/net/wellenreiter/daemon/source/daemon.cc | |||
@@ -8,5 +8,2 @@ | |||
8 | #include "daemon.hh" | 8 | #include "daemon.hh" |
9 | #include "log.hh" | ||
10 | #include "sendgui.hh" | ||
11 | #include "getgui.hh" | ||
12 | 9 | ||
@@ -15,3 +12,4 @@ int main(int argc, char **argv) | |||
15 | { | 12 | { |
16 | int sock, maxfd; | 13 | int sock, maxfd, guiport=GUIPORT; |
14 | char guihost[]="127.0.0.1"; | ||
17 | struct sockaddr_in *cliaddr; | 15 | struct sockaddr_in *cliaddr; |
@@ -25,6 +23,8 @@ int main(int argc, char **argv) | |||
25 | /* Setup socket for incoming commands */ | 23 | /* Setup socket for incoming commands */ |
26 | if(!commsock(&sock)) | 24 | if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0) |
27 | return 0; | 25 | { |
28 | 26 | wl_logerr("Cannot setup socket"); | |
29 | log_info("Set up socket '%d' for GUI communication", sock); | 27 | exit(-1); |
28 | } | ||
29 | wl_loginfo("Set up socket '%d' for GUI communication", sock); | ||
30 | 30 | ||
@@ -33,3 +33,3 @@ int main(int argc, char **argv) | |||
33 | /* Start main loop */ | 33 | /* Start main loop */ |
34 | log_info("Starting main loop"); | 34 | wl_loginfo("Starting main loop"); |
35 | while(1) | 35 | while(1) |
@@ -42,3 +42,3 @@ int main(int argc, char **argv) | |||
42 | { | 42 | { |
43 | log_err("Error calling select: %s", strerror(errno)); | 43 | wl_logerr("Error calling select: %s", strerror(errno)); |
44 | break; | 44 | break; |
@@ -52,9 +52,9 @@ int main(int argc, char **argv) | |||
52 | { | 52 | { |
53 | log_err("Cannot read from socket: %s", strerror(errno)); | 53 | wl_logerr("Cannot read from socket: %s", strerror(errno)); |
54 | break; | 54 | break; |
55 | } | 55 | } |
56 | log_info("Received command from '%s': %s", inet_ntoa(cliaddr->sin_addr), buffer); | 56 | wl_loginfo("Received command from '%s': %s", inet_ntoa(cliaddr->sin_addr), buffer); |
57 | 57 | ||
58 | /* Pass string to analyze function */ | 58 | /* Pass string to analyze function */ |
59 | commstring(buffer); | 59 | // sendcomm(guihost, guiport, buffer); |
60 | 60 | ||
@@ -68,16 +68,14 @@ int main(int argc, char **argv) | |||
68 | { | 68 | { |
69 | log_err("Cannot read from stdin: %s", strerror(errno)); | 69 | wl_logerr("Cannot read from stdin: %s", strerror(errno)); |
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | log_info("Sending command to '%s': %s", GUIADDR, buffer); | 72 | wl_loginfo("Sending command to '%s': %s", GUIADDR, buffer); |
73 | 73 | ||
74 | /* Send string to GUI */ | 74 | /* Send string to GUI */ |
75 | sendgui("%d: %s", 1234, buffer); | 75 | sendcomm(guihost, guiport, "%d: %s", 1234, buffer); |
76 | 76 | ||
77 | } | 77 | } |
78 | |||
79 | } | 78 | } |
80 | |||
81 | close(sock); | 79 | close(sock); |
82 | return 0; | 80 | exit(0); |
83 | } | 81 | } |
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.hh b/noncore/net/wellenreiter/daemon/source/daemon.hh index 6776d37..a9a97ac 100644 --- a/noncore/net/wellenreiter/daemon/source/daemon.hh +++ b/noncore/net/wellenreiter/daemon/source/daemon.hh | |||
@@ -15,2 +15,5 @@ | |||
15 | 15 | ||
16 | #include "../../libwellenreiter/source/sock.hh" | ||
17 | #include "../../libwellenreiter/source/log.hh" | ||
18 | |||
16 | #endif /* DAEMON_HH */ | 19 | #endif /* DAEMON_HH */ |