summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-04 19:51:46 (UTC)
committer mjm <mjm>2002-12-04 19:51:46 (UTC)
commit1f70a97d8f4ccedbfdbde72e70649f01d92f190a (patch) (unidiff)
treef1908f235fb90ed578f66bcbfa4d255090b2ed62
parentad62016e2d341876c068bead69a40ebd0370d822 (diff)
downloadopie-1f70a97d8f4ccedbfdbde72e70649f01d92f190a.zip
opie-1f70a97d8f4ccedbfdbde72e70649f01d92f190a.tar.gz
opie-1f70a97d8f4ccedbfdbde72e70649f01d92f190a.tar.bz2
fit to new sniffer function
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/daemon/source/daemon.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc
index 6467af7..95f2f83 100644
--- a/noncore/net/wellenreiter/daemon/source/daemon.cc
+++ b/noncore/net/wellenreiter/daemon/source/daemon.cc
@@ -48,72 +48,72 @@ int main(int argc, char **argv)
48 } 48 }
49 wl_loginfo("Your successfully listen on %s in 802.11 raw mode", SNIFFER_DEVICE); 49 wl_loginfo("Your successfully listen on %s in 802.11 raw mode", SNIFFER_DEVICE);
50 //////////////////////////////////////// 50 ////////////////////////////////////////
51 51
52 /* Setup socket for incoming commands */ 52 /* Setup socket for incoming commands */
53 if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0) 53 if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0)
54 { 54 {
55 wl_logerr("Cannot setup socket"); 55 wl_logerr("Cannot setup socket");
56 exit(-1); 56 exit(-1);
57 } 57 }
58 wl_loginfo("Set up socket '%d' for GUI communication", sock); 58 wl_loginfo("Set up socket '%d' for GUI communication", sock);
59 59
60 FD_ZERO(&rset); 60 FD_ZERO(&rset);
61 61
62 /* Start main loop */ 62 /* Start main loop */
63 wl_loginfo("Starting main loop"); 63 wl_loginfo("Starting main loop");
64 while(1) 64 while(1)
65 { 65 {
66 66
67 FD_SET(sock, &rset); 67 FD_SET(sock, &rset);
68 FD_SET(pcap_fileno(handletopcap), &rset); 68 FD_SET(pcap_fileno(handletopcap), &rset);
69 maxfd=sock + pcap_fileno(handletopcap) + 1; 69 maxfd=sock + pcap_fileno(handletopcap) + 1;
70 70
71 if(select(maxfd, &rset, NULL, NULL, NULL) < 0) 71 if(select(maxfd, &rset, NULL, NULL, NULL) < 0)
72 { 72 {
73 wl_logerr("Error calling select: %s", strerror(errno)); 73 wl_logerr("Error calling select: %s", strerror(errno));
74 break; 74 break;
75 } 75 }
76 76
77 /* Got data on local socket from GUI */ 77 /* Got data on local socket from GUI */
78 if(FD_ISSET(sock, &rset)) 78 if(FD_ISSET(sock, &rset))
79 { 79 {
80 /* Receive data from socket */ 80 /* Receive data from socket */
81 if((retval=recvcomm(&sock, buffer, sizeof(buffer))) < 0) 81 if((retval=recvcomm(&sock, buffer, sizeof(buffer))) < 0)
82 { 82 {
83 wl_logerr("Error trying to read: %s", strerror(errno)); 83 wl_logerr("Error trying to read: %s", strerror(errno));
84 break; 84 break;
85 } 85 }
86 else 86 else
87 { 87 {
88 /* check type of packet and start function according to it */ 88 /* check type of packet and start function according to it */
89 switch(retval) 89 switch(retval)
90 { 90 {
91 case 98: 91 case 98:
92 wl_loginfo("Received STARTSNIFF command"); 92 wl_loginfo("Received STARTSNIFF command");
93 break; 93 break;
94 case 99: 94 case 99:
95 wl_loginfo("Received STOPSNIFF command"); 95 wl_loginfo("Received STOPSNIFF command");
96 break; 96 break;
97 default: 97 default:
98 wl_logerr("Received unknown command: %d", retval); 98 wl_logerr("Received unknown command: %d", retval);
99 break; 99 break;
100 } 100 }
101 } 101 }
102 } /* FD_ISSET */ 102 } /* FD_ISSET */
103 103
104 /* Check pcap lib for packets */ 104 /* Check pcap lib for packets */
105 if(FD_ISSET(pcap_fileno(handletopcap), &rset)) 105 if(FD_ISSET(pcap_fileno(handletopcap), &rset))
106 { 106 {
107 107
108 /* Grab one single packet */ 108 /* Grab one single packet */
109 packet = pcap_next(handletopcap, &header); 109 packet = pcap_next(handletopcap, &header);
110 110
111 /* process the packet */ 111 /* process the packet */
112 process_packets(&header,*&packet); 112 process_packets(&header,*&packet, GUIADDR, GUIPORT);
113 } 113 }
114 114
115 } /* while(1) */ 115 } /* while(1) */
116 116
117 close(sock); 117 close(sock);
118 exit(0); 118 exit(0);
119} 119}