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 | |
parent | 5a346c71bf5255eb769c9fceb34358c06e60aef3 (diff) | |
download | opie-b4affc7067cdc7ede2217607be71fe3091a2a599.zip opie-b4affc7067cdc7ede2217607be71fe3091a2a599.tar.gz opie-b4affc7067cdc7ede2217607be71fe3091a2a599.tar.bz2 |
uses libwellenreiter now
-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 | |||
@@ -3,10 +3,9 @@ | |||
3 | CPP = g++ | 3 | CPP = g++ |
4 | 4 | ||
5 | CFLAGS= | ||
6 | OPTIMFLAGS= -g | 5 | OPTIMFLAGS= -g |
7 | WARNFLAGS= -Wall -pedantic -DDEBUG | 6 | 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 | ||
12 | .SUFFIXES: | 11 | .SUFFIXES: |
@@ -14,10 +13,10 @@ OBJ = daemon.o log.o sendgui.o getgui.o sniffer.o | |||
14 | 13 | ||
15 | %.o : %.cc | 14 | %.o : %.cc |
16 | $(CPP) $(CFLAGS) $(WARNFLAGS) $(OPTIMFLAGS) -c $< -o $@ | 15 | $(CPP) $(WARNFLAGS) $(OPTIMFLAGS) -c $< -o $@ |
17 | 16 | ||
18 | all:wellenreiterd | 17 | all:wellenreiterd |
19 | 18 | ||
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 |
23 | 22 | ||
@@ -26,6 +25,4 @@ clean distclean realclean: | |||
26 | @echo All dependent files have been removed. | 25 | @echo All dependent files have been removed. |
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 | |||
@@ -15,4 +15,5 @@ | |||
15 | #define VERSION "0.2" /* Version of wellenreiter */ | 15 | #define VERSION "0.2" /* Version of wellenreiter */ |
16 | 16 | ||
17 | #define DAEMONADDR "127.0.0.1" | ||
17 | #define DAEMONPORT 37772 /* Port of Daemon */ | 18 | #define DAEMONPORT 37772 /* Port of Daemon */ |
18 | 19 | ||
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 | |||
@@ -7,12 +7,10 @@ | |||
7 | #include "config.hh" | 7 | #include "config.hh" |
8 | #include "daemon.hh" | 8 | #include "daemon.hh" |
9 | #include "log.hh" | ||
10 | #include "sendgui.hh" | ||
11 | #include "getgui.hh" | ||
12 | 9 | ||
13 | /* Main function of wellenreiterd */ | 10 | /* Main function of wellenreiterd */ |
14 | int main(int argc, char **argv) | 11 | 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; |
18 | socklen_t len=sizeof(struct sockaddr); | 16 | socklen_t len=sizeof(struct sockaddr); |
@@ -24,13 +22,15 @@ int main(int argc, char **argv) | |||
24 | 22 | ||
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 | ||
31 | FD_ZERO(&rset); | 31 | FD_ZERO(&rset); |
32 | 32 | ||
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) |
36 | { | 36 | { |
@@ -41,5 +41,5 @@ int main(int argc, char **argv) | |||
41 | if(select(maxfd, &rset, NULL, NULL, NULL) < 0) | 41 | if(select(maxfd, &rset, NULL, NULL, NULL) < 0) |
42 | { | 42 | { |
43 | log_err("Error calling select: %s", strerror(errno)); | 43 | wl_logerr("Error calling select: %s", strerror(errno)); |
44 | break; | 44 | break; |
45 | } | 45 | } |
@@ -51,11 +51,11 @@ int main(int argc, char **argv) | |||
51 | if(recvfrom(sock, buffer, sizeof(buffer)-1, 0, (struct sockaddr *)cliaddr, &len) < 0) | 51 | if(recvfrom(sock, buffer, sizeof(buffer)-1, 0, (struct sockaddr *)cliaddr, &len) < 0) |
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 | ||
61 | } | 61 | } |
@@ -67,17 +67,15 @@ int main(int argc, char **argv) | |||
67 | if(fgets(buffer, sizeof(buffer) - 1, fp) == NULL) | 67 | if(fgets(buffer, sizeof(buffer) - 1, fp) == NULL) |
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 | |||
@@ -14,3 +14,6 @@ | |||
14 | #include <errno.h> | 14 | #include <errno.h> |
15 | 15 | ||
16 | #include "../../libwellenreiter/source/sock.hh" | ||
17 | #include "../../libwellenreiter/source/log.hh" | ||
18 | |||
16 | #endif /* DAEMON_HH */ | 19 | #endif /* DAEMON_HH */ |