author | mjm <mjm> | 2003-02-26 22:17:26 (UTC) |
---|---|---|
committer | mjm <mjm> | 2003-02-26 22:17:26 (UTC) |
commit | ed168abe1c9c1384b0151ea9b49a7e364f9b67be (patch) (side-by-side diff) | |
tree | 4364879aaa3c6fe8d963256a36717efc1b24d03c | |
parent | 60da6fed3516c5cb73930d0d2cdae253a16c12f8 (diff) | |
download | opie-ed168abe1c9c1384b0151ea9b49a7e364f9b67be.zip opie-ed168abe1c9c1384b0151ea9b49a7e364f9b67be.tar.gz opie-ed168abe1c9c1384b0151ea9b49a7e364f9b67be.tar.bz2 |
added ok and fail msgs for gui
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc index d77d987..3a28217 100644 --- a/noncore/net/wellenreiter/daemon/source/daemon.cc +++ b/noncore/net/wellenreiter/daemon/source/daemon.cc @@ -91,69 +91,73 @@ int main(int argc, char **argv) /* Start main loop */ wl_loginfo("Starting main loop"); while(1) { FD_SET(sock, &rset); FD_SET(pcap_fileno(handletopcap), &rset); /* maxfd = biggest filefd */ maxfd = (sock > pcap_fileno(handletopcap) ? sock + 1 : pcap_fileno(handletopcap)) + 1; if(select(maxfd, &rset, NULL, NULL, NULL) < 0) { wl_logerr("Error calling select: %s", strerror(errno)); break; } /* Got data on local socket from GUI */ if(FD_ISSET(sock, &rset)) { /* Receive data from socket */ if((retval=wl_recv(&sock, saddr, buffer, sizeof(buffer))) < 0) { wl_logerr("Error trying to read: %s", strerror(errno)); break; } else { /* check type of packet and start function according to it */ switch(retval) { - case 98: + case STARTSNIFF: wl_loginfo("Received STARTSNIFF command"); + if(!send_ok(GUIADDR, GUIPORT, STARTSNIFF)) + wl_logerr("Cannot set OK_CMD to GUI"); break; - case 99: + case STOPSNIFF: wl_loginfo("Received STOPSNIFF command"); + if(!send_ok(GUIADDR, GUIPORT, STOPSNIFF)) + wl_logerr("Cannot set FAIL_CMD to GUI"); break; default: wl_logerr("Received unknown command: %d", retval); break; } } } /* FD_ISSET */ /* Check pcap lib for packets */ if(FD_ISSET(pcap_fileno(handletopcap), &rset)) { /* Grab one single packet */ packet = pcap_next(handletopcap, &header); /* process the packet */ process_packets(&header,*&packet, GUIADDR, GUIPORT); } } /* while(1) */ close(sock); exit(EXIT_SUCCESS); } void usage(void) { fprintf(stderr, "Usage: wellenreiter <device> <cardtype>\n" \ "\t<device> = Wirelessdevice (e.g. wlan0)\n" \ "\t<cardtype> = Cardtype:\tCisco\t= 1\n" \ "\t\t\t\tNG\t= 2\n" \ |