summaryrefslogtreecommitdiff
authormjm <mjm>2003-02-09 19:22:51 (UTC)
committer mjm <mjm>2003-02-09 19:22:51 (UTC)
commit39eed07684a2ae7d76aa61cdb00c8a4bcfc66ef0 (patch) (unidiff)
treea39b10b915ec6dbe0709ccbaa0e40e8ffa84ee68
parentb4f7c17a0f1e96f1975d268e39d9194f2413dc33 (diff)
downloadopie-39eed07684a2ae7d76aa61cdb00c8a4bcfc66ef0.zip
opie-39eed07684a2ae7d76aa61cdb00c8a4bcfc66ef0.tar.gz
opie-39eed07684a2ae7d76aa61cdb00c8a4bcfc66ef0.tar.bz2
generic cleaup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/daemon/source/daemon.cc47
1 files changed, 25 insertions, 22 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc
index 4407436..5cf4e97 100644
--- a/noncore/net/wellenreiter/daemon/source/daemon.cc
+++ b/noncore/net/wellenreiter/daemon/source/daemon.cc
@@ -32,3 +32,3 @@ int main(int argc, char **argv)
32 usage(); 32 usage();
33 33
34 /* Set sniffer device */ 34 /* Set sniffer device */
@@ -42,3 +42,5 @@ int main(int argc, char **argv)
42 42
43 if(!card_into_monitormode(&handletopcap, cardtype.iface, cardtype.type)) 43 /* set card into monitor mode */
44 if(!card_into_monitormode(&handletopcap, cardtype.iface,
45 cardtype.type))
44 { 46 {
@@ -49,16 +51,14 @@ int main(int argc, char **argv)
49 51
50 52 /* setup pcap */
51 /////// following line will be moved to lib as soon as possible //////////// 53 if((handletopcap = pcap_open_live(cardtype.iface,
52 if((handletopcap = pcap_open_live(cardtype.iface, BUFSIZ, 1, 0, NULL)) == NULL) 54 BUFSIZ, 1, 0, NULL)) == NULL)
53 { 55 {
54 wl_logerr("pcap_open_live() failed: %s", strerror(errno)); 56 wl_logerr("pcap_open_live() failed: %s", strerror(errno));
55 exit(EXIT_FAILURE); 57 exit(EXIT_FAILURE);
56 } 58 }
57 59
58#ifdef HAVE_PCAP_NONBLOCK 60#ifdef HAVE_PCAP_NONBLOCK
59 pcap_setnonblock(handletopcap, 1, NULL); 61 pcap_setnonblock(handletopcap, 1, NULL);
60#endif 62#endif
61 //////////////////////////////////////// 63
62
63
64 /* Setup socket for incoming commands */ 64 /* Setup socket for incoming commands */
@@ -72,3 +72,4 @@ int main(int argc, char **argv)
72 /* Create channelswitching thread */ 72 /* Create channelswitching thread */
73 if(pthread_create(&sub, NULL, channel_switcher, (void *)&cardtype) != 0) 73 if(pthread_create(&sub, NULL, channel_switcher,
74 (void *)&cardtype) != 0)
74 { 75 {
@@ -97,4 +98,5 @@ int main(int argc, char **argv)
97 98
98 /* socket or pcap handle bigger? Will be cleaned up, have to check pcap */ 99 /* maxfd = biggest filefd */
99 maxfd = (sock > pcap_fileno(handletopcap) ? sock + 1: pcap_fileno(handletopcap)) + 1; 100 maxfd = (sock > pcap_fileno(handletopcap) ?
101 sock + 1 : pcap_fileno(handletopcap)) + 1;
100 102
@@ -124,7 +126,7 @@ int main(int argc, char **argv)
124 case 99: 126 case 99:
125 wl_loginfo("Received STOPSNIFF command"); 127 wl_loginfo("Received STOPSNIFF command");
126 break; 128 break;
127 default: 129 default:
128 wl_logerr("Received unknown command: %d", retval); 130 wl_logerr("Received unknown command: %d", retval);
129 break; 131 break;
130 } 132 }
@@ -150,3 +152,4 @@ int main(int argc, char **argv)
150 152
151void usage(void) 153void
154usage(void)
152{ 155{