author | mjm <mjm> | 2003-02-07 11:35:02 (UTC) |
---|---|---|
committer | mjm <mjm> | 2003-02-07 11:35:02 (UTC) |
commit | e92743832becd6dc8040e62e73c8ac3f7194f2d6 (patch) (unidiff) | |
tree | 16c10598f92097f5900278c780196a30a42ab023 | |
parent | 9bbfe155d26fe42ecb31744de0525a1f854b7ca5 (diff) | |
download | opie-e92743832becd6dc8040e62e73c8ac3f7194f2d6.zip opie-e92743832becd6dc8040e62e73c8ac3f7194f2d6.tar.gz opie-e92743832becd6dc8040e62e73c8ac3f7194f2d6.tar.bz2 |
inserted temporary channel switching via alarm()
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.cc | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc index 51c2194..d6e8f6b 100644 --- a/noncore/net/wellenreiter/daemon/source/daemon.cc +++ b/noncore/net/wellenreiter/daemon/source/daemon.cc | |||
@@ -9,2 +9,16 @@ | |||
9 | 9 | ||
10 | // temporary solution, will be removed soon | ||
11 | #define MAXCHANNEL 13 | ||
12 | char sniffer_device[6]; | ||
13 | int channel=0; | ||
14 | int timedout=1; | ||
15 | |||
16 | static int chanswitch() | ||
17 | { | ||
18 | if(channel >= MAXCHANNEL) | ||
19 | channel=1 | ||
20 | card_set_channel(sniffer_device, channel, card_type); | ||
21 | timedout=0; | ||
22 | } | ||
23 | |||
10 | /* Main function of wellenreiterd */ | 24 | /* Main function of wellenreiterd */ |
@@ -13,3 +27,3 @@ int main(int argc, char **argv) | |||
13 | int sock, maxfd, retval, card_type; | 27 | int sock, maxfd, retval, card_type; |
14 | char buffer[WL_SOCKBUF], sniffer_device[6]; | 28 | char buffer[WL_SOCKBUF]; |
15 | struct pcap_pkthdr header; | 29 | struct pcap_pkthdr header; |
@@ -27,2 +41,5 @@ int main(int argc, char **argv) | |||
27 | 41 | ||
42 | // removed soon, see above | ||
43 | SIGNAL(SIGALRM, chanswitch); | ||
44 | |||
28 | /* Set sniffer device */ | 45 | /* Set sniffer device */ |
@@ -74,2 +91,6 @@ int main(int argc, char **argv) | |||
74 | 91 | ||
92 | // blah | ||
93 | timedout=1; | ||
94 | alarm(1); | ||
95 | |||
75 | /* socket or pcap handle bigger? Will be cleaned up, have to check pcap */ | 96 | /* socket or pcap handle bigger? Will be cleaned up, have to check pcap */ |
@@ -77,3 +98,3 @@ int main(int argc, char **argv) | |||
77 | 98 | ||
78 | if(select(maxfd, &rset, NULL, NULL, NULL) < 0) | 99 | if(select(maxfd, &rset, NULL, NULL, NULL) < 0 && timedout) |
79 | { | 100 | { |
@@ -87,3 +108,3 @@ int main(int argc, char **argv) | |||
87 | /* Receive data from socket */ | 108 | /* Receive data from socket */ |
88 | if((retval=wl_recv(&sock, saddr, buffer, sizeof(buffer))) < 0) | 109 | if((retval=wl_recv(&sock, saddr, buffer, sizeof(buffer))) < 0 && timedout) |
89 | { | 110 | { |