-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.cc | 18 |
1 files changed, 11 insertions, 7 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 @@ -111,31 +111,35 @@ int main(int argc, char **argv) { /* 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: - wl_loginfo("Received STARTSNIFF command"); - break; - case 99: - wl_loginfo("Received STOPSNIFF command"); - break; - default: + case STARTSNIFF: + wl_loginfo("Received STARTSNIFF command"); + if(!send_ok(GUIADDR, GUIPORT, STARTSNIFF)) + wl_logerr("Cannot set OK_CMD to GUI"); + break; + 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); |